@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,137 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/lib/qti-test/test-base.ts
|
|
13
|
+
import { provide } from "@lit/context";
|
|
14
|
+
import { LitElement } from "lit";
|
|
15
|
+
import { state } from "lit/decorators.js";
|
|
16
|
+
|
|
17
|
+
// src/lib/qti-test/context/test.context.ts
|
|
18
|
+
import { createContext } from "@lit/context";
|
|
19
|
+
var testContext = createContext(Symbol("test"));
|
|
20
|
+
var testElement = createContext(Symbol("testElement"));
|
|
21
|
+
|
|
22
|
+
// src/lib/qti-test/test-base.ts
|
|
23
|
+
var TestBase = class extends LitElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
this._testContext = { items: [], testOutcomeVariables: [] };
|
|
27
|
+
this.testElement = { el: null };
|
|
28
|
+
/**
|
|
29
|
+
* Updates the variables of an assessment item in the test context.
|
|
30
|
+
* - Matches the assessment item with the corresponding test context item.
|
|
31
|
+
* - If the item is not found, logs a warning.
|
|
32
|
+
* - Updates variables in the test context if exactly one variable exists.
|
|
33
|
+
* - Otherwise, syncs the assessment item's variables with the test context.
|
|
34
|
+
*
|
|
35
|
+
* @param assessmentItem - The assessment item to update.
|
|
36
|
+
*/
|
|
37
|
+
this._updateItemInTestContext = (assessmentItem) => {
|
|
38
|
+
const { identifier, variables } = assessmentItem;
|
|
39
|
+
const itemContext = this._testContext.items.find((i) => i?.identifier === identifier);
|
|
40
|
+
if (!itemContext) {
|
|
41
|
+
console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (itemContext.variables?.length === 1) {
|
|
45
|
+
this._updateItemVariablesInTestContext(identifier, variables);
|
|
46
|
+
} else {
|
|
47
|
+
assessmentItem.variables = [...itemContext.variables || []];
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
this.addEventListener("qti-assessment-test-connected", (e) => {
|
|
51
|
+
const qtiAssessmentTest = e.detail;
|
|
52
|
+
const items = Array.from(qtiAssessmentTest.querySelectorAll("qti-assessment-item-ref")).map(
|
|
53
|
+
(itemRef) => ({
|
|
54
|
+
href: itemRef.href,
|
|
55
|
+
identifier: itemRef.identifier,
|
|
56
|
+
category: itemRef.category,
|
|
57
|
+
variables: [{ identifier: "completionStatus", value: "not_attempted", type: "outcome" }]
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
this.testElement = { el: qtiAssessmentTest };
|
|
61
|
+
this._testContext = { ...this._testContext, items };
|
|
62
|
+
});
|
|
63
|
+
this.addEventListener("qti-assessment-item-connected", (e) => {
|
|
64
|
+
this._updateItemInTestContext(e.detail);
|
|
65
|
+
});
|
|
66
|
+
this.addEventListener("qti-outcome-changed", (e) => {
|
|
67
|
+
const assessmentitem = e.composedPath()[0];
|
|
68
|
+
this._updateItemVariablesInTestContext(assessmentitem.identifier, assessmentitem.variables);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
get context() {
|
|
72
|
+
return this._testContext;
|
|
73
|
+
}
|
|
74
|
+
// /* restores the context by updating existing items and adding new items from the "contextToRestore" parameter into the "this._context.items" array. */
|
|
75
|
+
set context(testContext2) {
|
|
76
|
+
if (testContext2 === null || testContext2 === void 0) return;
|
|
77
|
+
this._testContext = { ...testContext2 };
|
|
78
|
+
testContext2.items?.forEach((itemContext) => {
|
|
79
|
+
const existingItemContext = this._testContext.items.find((i) => i.identifier === itemContext.identifier);
|
|
80
|
+
if (existingItemContext) {
|
|
81
|
+
existingItemContext.variables = itemContext.variables;
|
|
82
|
+
} else {
|
|
83
|
+
this._testContext.items.push(itemContext);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
_updateItemVariablesInTestContext(identifier, variables) {
|
|
88
|
+
this._testContext = {
|
|
89
|
+
...this._testContext,
|
|
90
|
+
// Spread existing test context properties
|
|
91
|
+
items: this._testContext.items.map((itemContext) => {
|
|
92
|
+
if (itemContext.identifier !== identifier) {
|
|
93
|
+
return itemContext;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
...itemContext,
|
|
97
|
+
// Keep other properties of the item context
|
|
98
|
+
variables: variables.map((variable) => {
|
|
99
|
+
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
100
|
+
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
101
|
+
})
|
|
102
|
+
};
|
|
103
|
+
})
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// private _addItemToTestContext(
|
|
107
|
+
// e: CustomEvent<{ href: string; identifier: string; category: string }> & { target: QtiAssessmentItemRef }
|
|
108
|
+
// ): void {
|
|
109
|
+
// const { href, identifier, category } = e.detail;
|
|
110
|
+
// // Update test context items, adding a new item if the identifier is not already in the list
|
|
111
|
+
// if (!this._testContext.items.some(item => item.identifier === identifier)) {
|
|
112
|
+
// this._testContext.items.push({
|
|
113
|
+
// href,
|
|
114
|
+
// identifier,
|
|
115
|
+
// category,
|
|
116
|
+
// variables: [{ identifier: 'completionStatus', value: 'not_attempted', type: 'outcome' }]
|
|
117
|
+
// // category: e.target.category
|
|
118
|
+
// });
|
|
119
|
+
// }
|
|
120
|
+
// }
|
|
121
|
+
connectedCallback() {
|
|
122
|
+
super.connectedCallback();
|
|
123
|
+
this.setAttribute("qti-test", "");
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
__decorateClass([
|
|
127
|
+
state(),
|
|
128
|
+
provide({ context: testContext })
|
|
129
|
+
], TestBase.prototype, "_testContext", 2);
|
|
130
|
+
__decorateClass([
|
|
131
|
+
state(),
|
|
132
|
+
provide({ context: testElement })
|
|
133
|
+
], TestBase.prototype, "testElement", 2);
|
|
134
|
+
export {
|
|
135
|
+
TestBase
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=test-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/test-base.ts","../../src/lib/qti-test/context/test.context.ts"],"sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement } from 'lit';\nimport { state } from 'lit/decorators.js';\nimport { TestContext, testContext, TestElement, testElement } from './context';\nimport { QtiAssessmentTest } from './qti-assessment-test';\nimport { ItemContext, QtiAssessmentItem, VariableValue } from '../qti-components';\n\nexport abstract class TestBase extends LitElement {\n @state()\n @provide({ context: testContext })\n protected _testContext: Readonly<TestContext> = { items: [], testOutcomeVariables: [] };\n\n @state()\n @provide({ context: testElement })\n protected testElement: TestElement = { el: null };\n\n constructor() {\n super();\n\n this.addEventListener('qti-assessment-test-connected', (e: CustomEvent<QtiAssessmentTest>) => {\n const qtiAssessmentTest = e.detail;\n\n const items = Array.from(qtiAssessmentTest.querySelectorAll('qti-assessment-item-ref')).map(\n (itemRef): ItemContext & { category: string } => ({\n href: itemRef.href,\n identifier: itemRef.identifier,\n category: itemRef.category,\n variables: [{ identifier: 'completionStatus', value: 'not_attempted', type: 'outcome' }]\n })\n );\n this.testElement = { el: qtiAssessmentTest };\n this._testContext = { ...this._testContext, items };\n });\n this.addEventListener('qti-assessment-item-connected', (e: CustomEvent<QtiAssessmentItem>) => {\n this._updateItemInTestContext(e.detail);\n });\n this.addEventListener('qti-outcome-changed', e => {\n const assessmentitem = e.composedPath()[0] as QtiAssessmentItem;\n this._updateItemVariablesInTestContext(assessmentitem.identifier, assessmentitem.variables);\n });\n\n // this.addEventListener(\n // 'qti-assessment-item-ref-connected',\n // (e: CustomEvent<{ href: string; identifier: string; category: string }> & { target: QtiAssessmentItemRef }) => {\n // this._addItemToTestContext(e);\n // }\n // );\n }\n\n get context(): TestContext {\n return this._testContext;\n }\n\n // /* restores the context by updating existing items and adding new items from the \"contextToRestore\" parameter into the \"this._context.items\" array. */\n set context(testContext: TestContext) {\n if (testContext === null || testContext === undefined) return;\n this._testContext = { ...testContext }; // Clone the context to avoid modifying the original object\n // // append the items that are not yet in the context and replace the ones that are\n testContext.items?.forEach(itemContext => {\n const existingItemContext = this._testContext.items.find(i => i.identifier === itemContext.identifier);\n if (existingItemContext) {\n existingItemContext.variables = itemContext.variables;\n } else {\n this._testContext.items.push(itemContext);\n }\n });\n }\n\n private _updateItemVariablesInTestContext(\n identifier: string,\n variables: VariableValue<string | string[] | null>[]\n ): void {\n // Update the test context with modified variables for the specified item\n this._testContext = {\n ...this._testContext, // Spread existing test context properties\n items: this._testContext.items.map(itemContext => {\n // If the item identifier doesn't match, keep it unchanged\n if (itemContext.identifier !== identifier) {\n return itemContext;\n }\n\n // Update the matching item with new variables\n return {\n ...itemContext, // Keep other properties of the item context\n variables: variables.map(variable => {\n // Find a matching variable in the current item context\n const matchingVariable = itemContext.variables.find(v => v.identifier === variable.identifier);\n\n // Merge matching variable with the new one, or use the new variable if no match\n return matchingVariable ? { ...matchingVariable, ...variable } : variable;\n })\n };\n })\n };\n }\n\n /**\n * Updates the variables of an assessment item in the test context.\n * - Matches the assessment item with the corresponding test context item.\n * - If the item is not found, logs a warning.\n * - Updates variables in the test context if exactly one variable exists.\n * - Otherwise, syncs the assessment item's variables with the test context.\n *\n * @param assessmentItem - The assessment item to update.\n */\n private _updateItemInTestContext = (assessmentItem: QtiAssessmentItem): void => {\n const { identifier, variables } = assessmentItem;\n\n // console.log(this._testContext);\n\n // Find the corresponding item in the test context by identifier\n const itemContext = this._testContext.items.find(i => i?.identifier === identifier);\n\n if (!itemContext) {\n console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);\n return;\n }\n\n // Update variables in the test context or sync them to the assessment item\n if (itemContext.variables?.length === 1) {\n // The loaded qti-assessment-item itself has variables which are not in test context yet.\n this._updateItemVariablesInTestContext(identifier, variables);\n } else {\n // Sync the assessment item's variables with the test context\n assessmentItem.variables = [...(itemContext.variables || [])];\n }\n };\n\n // private _addItemToTestContext(\n // e: CustomEvent<{ href: string; identifier: string; category: string }> & { target: QtiAssessmentItemRef }\n // ): void {\n // const { href, identifier, category } = e.detail;\n\n // // Update test context items, adding a new item if the identifier is not already in the list\n // if (!this._testContext.items.some(item => item.identifier === identifier)) {\n // this._testContext.items.push({\n // href,\n // identifier,\n // category,\n // variables: [{ identifier: 'completionStatus', value: 'not_attempted', type: 'outcome' }]\n // // category: e.target.category\n // });\n // }\n // }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('qti-test', '');\n }\n}\n","import { createContext } from '@lit/context';\nimport { QtiAssessmentTest } from '../qti-assessment-test';\nimport { ItemContext, VariableDeclaration } from '../../qti-components';\nimport { View } from '../mixins/test-view.mixin';\n\nexport interface TestContext {\n items: (ItemContext & { category?: string })[];\n testOutcomeVariables: VariableDeclaration<string | string[]>[];\n navPartId?: string | null;\n navSectionId?: string | null;\n navItemId?: string | null;\n navItemLoading?: boolean;\n navTestLoading?: boolean;\n view?: View;\n}\n\nexport const testContext = createContext<Readonly<TestContext>>(Symbol('test'));\n\nexport type TestElement = {\n el: QtiAssessmentTest;\n};\n\nexport const testElement = createContext<Readonly<TestElement>>(Symbol('testElement'));\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;;;ACFtB,SAAS,qBAAqB;AA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AA,EAFT,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,YAAY,CAAC;AAAA,GAFb,SAGV;AAIA;AAAA,EAFT,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,YAAY,CAAC;AAAA,GANb,SAOV;","names":["testContext"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-transformers/qti-transformers.ts","../../src/lib/qti-transformers/qti-transform-item.ts","../../src/lib/qti-transformers/qti-transform-manifest.ts","../../src/lib/qti-transformers/qti-transform-test.ts"],"sourcesContent":["const xml = String.raw;\n\n/* <!-- convert CDATA to comments -->\n <xsl:template match=\"text()[contains(., 'CDATA')]\">\n <xsl:comment>\n <xsl:value-of select=\".\"/>\n </xsl:comment>\n</xsl:template>\n*/\n\n/*\n <!-- remove xml comments -->\n <xsl:template match=\"comment()\" />\n */\n\nconst xmlToHTML = xml`<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n<xsl:output method=\"html\" version=\"5.0\" encoding=\"UTF-8\" indent=\"yes\" />\n <xsl:template match=\"@*|node()\">\n <xsl:copy>\n <xsl:apply-templates select=\"@*|node()\"/>\n </xsl:copy>\n </xsl:template>\n\n <!-- remove existing namespaces -->\n <xsl:template match=\"*\">\n <!-- remove element prefix -->\n <xsl:element name=\"{local-name()}\">\n <!-- process attributes -->\n <xsl:for-each select=\"@*\">\n <!-- remove attribute prefix -->\n <xsl:attribute name=\"{local-name()}\">\n <xsl:value-of select=\".\"/>\n </xsl:attribute>\n </xsl:for-each>\n <xsl:apply-templates/>\n </xsl:element>\n</xsl:template>\n</xsl:stylesheet>`;\n\n// Function to extend elements with a specific tag name by adding an extension suffix\nexport function extendElementName(xmlFragment: XMLDocument, tagName: string, extension: string) {\n xmlFragment.querySelectorAll(tagName).forEach(element => {\n const newTagName = `${tagName}-${extension}`;\n const newElement = createElementWithNewTagName(element, newTagName);\n element.replaceWith(newElement);\n });\n}\n\n// Function to extend any element with a specific class pattern (e.g., \"extend:suffix\")\nexport function extendElementsWithClass(xmlFragment: XMLDocument, classNamePattern: string) {\n xmlFragment.querySelectorAll('*').forEach(element => {\n const classList = element.classList;\n if (classList) {\n classList.forEach(className => {\n if (className.startsWith(`${classNamePattern}:`)) {\n const suffix = className.slice(`${classNamePattern}:`.length);\n const newTagName = `${element.nodeName}-${suffix}`;\n const newElement = createElementWithNewTagName(element, newTagName);\n element.replaceWith(newElement);\n }\n });\n }\n });\n}\n\n// Helper function to create a new element with a new tag name and copy attributes and children\nfunction createElementWithNewTagName(element, newTagName) {\n const newElement = document.createElement(newTagName);\n // Copy attributes\n for (const attr of element.attributes) {\n newElement.setAttribute(attr.name, attr.value);\n }\n // Copy child nodes\n while (element.firstChild) {\n newElement.appendChild(element.firstChild);\n }\n return newElement;\n}\n\nexport function itemsFromTest(xmlFragment: DocumentFragment) {\n const items: { identifier: string; href: string; category: string }[] = [];\n xmlFragment.querySelectorAll('qti-assessment-item-ref').forEach(el => {\n const identifier = el.getAttribute('identifier');\n const href = el.getAttribute('href');\n const category = el.getAttribute('category');\n items.push({ identifier, href, category });\n });\n return items;\n}\n\nlet currentRequest: XMLHttpRequest | null = null;\n\nexport function loadXML(url, cancelPreviousRequest = false) {\n if (cancelPreviousRequest && currentRequest !== null) {\n currentRequest.abort(); // Abort the ongoing request if there is one\n }\n\n return new Promise<XMLDocument | null>((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n currentRequest = xhr; // Store the current request\n\n xhr.open('GET', url, true);\n xhr.responseType = 'document';\n\n xhr.onload = () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(xhr.responseXML);\n } else {\n reject(xhr.statusText);\n }\n };\n\n xhr.onerror = () => {\n reject(xhr.statusText);\n };\n\n xhr.send();\n });\n}\n\nexport function parseXML(xmlDocument: string) {\n const parser = new DOMParser();\n const xmlFragment = parser.parseFromString(xmlDocument, 'text/xml');\n return xmlFragment;\n}\n\nexport function toHTML(xmlFragment: Document): DocumentFragment {\n const processor = new XSLTProcessor();\n const xsltDocument = new DOMParser().parseFromString(xmlToHTML, 'text/xml');\n processor.importStylesheet(xsltDocument);\n const itemHTMLFragment = processor.transformToFragment(xmlFragment, document);\n return itemHTMLFragment;\n}\n\nexport function setLocation(xmlFragment: DocumentFragment, location: string) {\n if (!location.endsWith('/')) {\n location += '/';\n }\n\n xmlFragment.querySelectorAll('[src],[href],[primary-path]').forEach(elWithSrc => {\n let attr: 'src' | 'href' | 'primary-path' | '' = '';\n\n if (elWithSrc.getAttribute('src')) {\n attr = 'src';\n }\n if (elWithSrc.getAttribute('href')) {\n attr = 'href';\n }\n if (elWithSrc.getAttribute('primary-path')) {\n attr = 'primary-path';\n }\n const attrValue = elWithSrc.getAttribute(attr)?.trim();\n\n if (!attrValue.startsWith('data:') && !attrValue.startsWith('http')) {\n const newSrcValue = location + encodeURI(attrValue);\n elWithSrc.setAttribute(attr, newSrcValue);\n }\n });\n}\n\nexport function convertCDATAtoComment(xmlFragment: DocumentFragment) {\n const cdataElements = xmlFragment.querySelectorAll('qti-custom-operator[class=\"js.org\"] > qti-base-value');\n cdataElements.forEach(element => {\n const commentText = document.createComment(element.textContent);\n element.replaceChild(commentText, element.firstChild);\n });\n}\n\nexport function stripStyleSheets(xmlFragment: DocumentFragment) {\n // remove qti-stylesheet tag\n xmlFragment.querySelectorAll('qti-stylesheet').forEach(stylesheet => stylesheet.remove());\n}\n","/**\n * Browser based QTI-XML to HTML transformer.\n * Returns an object with methods to load, parse, transform and serialize QTI XML items.\n * @returns An object with methods to load, parse, transform and serialize QTI XML items.\n * @example\n * const qtiTransformer = qtiTransformItem();\n * await qtiTransformer.load('path/to/xml/file.xml');\n * qtiTransformer.path('/assessmentItem/itemBody');\n * const html = qtiTransformer.html();\n * const xml = qtiTransformer.xml();\n * const htmldoc = qtiTransformer.htmldoc();\n * const xmldoc = qtiTransformer.xmldoc();\n *\n * qtiTransformItem().parse(storyXML).html()\n */\n\nimport {\n convertCDATAtoComment,\n extendElementName,\n extendElementsWithClass,\n loadXML,\n parseXML,\n setLocation,\n stripStyleSheets,\n toHTML\n} from './qti-transformers';\n\nexport type transformItemApi = {\n load: (uri: string, cancelPreviousRequest?: boolean) => Promise<transformItemApi>;\n parse: (xmlString: string) => transformItemApi;\n path: (location: string) => transformItemApi;\n fn: (fn: (xmlFragment: XMLDocument) => void) => transformItemApi;\n pciHooks: (uri: string) => transformItemApi;\n extendElementName: (elementName: string, extend: string) => transformItemApi;\n extendElementsWithClass: (param?: string) => transformItemApi;\n customInteraction: (baseRef: string, baseItem: string) => transformItemApi;\n convertCDATAtoComment: () => transformItemApi;\n stripStyleSheets: () => transformItemApi;\n html: () => string;\n xml: () => string;\n htmlDoc: () => DocumentFragment;\n xmlDoc: () => XMLDocument;\n};\n\nexport const qtiTransformItem = () => {\n let xmlFragment: XMLDocument;\n\n const api: transformItemApi = {\n async load(uri: string, cancelPreviousRequest = false): Promise<typeof api> {\n return new Promise<typeof api>(resolve => {\n loadXML(uri, cancelPreviousRequest).then(xml => {\n xmlFragment = xml;\n // set the base path for images and other resources,\n // you probably want to set the base path to the document root else you can use the path method to set it\n api.path(uri.substring(0, uri.lastIndexOf('/')));\n return resolve(api);\n });\n });\n },\n parse(xmlString: string): typeof api {\n xmlFragment = parseXML(xmlString);\n return api;\n },\n path: (location: string): typeof api => {\n setLocation(xmlFragment, location);\n return api;\n },\n fn(fn: (xmlFragment: XMLDocument) => void): typeof api {\n fn(xmlFragment);\n return api;\n },\n pciHooks(uri: string): typeof api {\n const attributes = ['hook', 'module'];\n const documentPath = uri.substring(0, uri.lastIndexOf('/'));\n for (const attribute of attributes) {\n const srcAttributes = xmlFragment.querySelectorAll('[' + attribute + ']');\n srcAttributes.forEach(node => {\n const srcValue = node.getAttribute(attribute)!;\n if (!srcValue.startsWith('data:') && !srcValue.startsWith('http')) {\n // Just paste the relative path of the src location after the documentrootPath\n // old pcis can have a .js, new pci's don't\n node.setAttribute('base-url', uri);\n node.setAttribute(\n 'module',\n documentPath + '/' + encodeURI(srcValue + (srcValue.endsWith('.js') ? '' : '.js'))\n );\n }\n });\n }\n return api;\n },\n extendElementName: (tagName: string, extension: string): typeof api => {\n extendElementName(xmlFragment, tagName, extension);\n return api;\n },\n extendElementsWithClass: (param: string = 'extend'): typeof api => {\n extendElementsWithClass(xmlFragment, param);\n return api;\n },\n customInteraction(baseRef: string, baseItem: string): typeof api {\n const qtiCustomInteraction = xmlFragment.querySelector('qti-custom-interaction');\n const qtiCustomInteractionObject = qtiCustomInteraction.querySelector('object');\n\n qtiCustomInteraction.setAttribute('data-base-ref', baseRef);\n qtiCustomInteraction.setAttribute('data-base-item', baseRef + baseItem);\n qtiCustomInteraction.setAttribute('data', qtiCustomInteractionObject.getAttribute('data'));\n qtiCustomInteraction.setAttribute('width', qtiCustomInteractionObject.getAttribute('width'));\n qtiCustomInteraction.setAttribute('height', qtiCustomInteractionObject.getAttribute('height'));\n\n qtiCustomInteraction.removeChild(qtiCustomInteractionObject);\n return api;\n },\n convertCDATAtoComment(): typeof api {\n convertCDATAtoComment(xmlFragment);\n return api;\n },\n stripStyleSheets(): typeof api {\n stripStyleSheets(xmlFragment);\n return api;\n },\n html() {\n return new XMLSerializer().serializeToString(toHTML(xmlFragment));\n },\n xml(): string {\n return new XMLSerializer().serializeToString(xmlFragment);\n },\n htmlDoc() {\n return toHTML(xmlFragment);\n },\n xmlDoc(): XMLDocument {\n return xmlFragment; // new XMLSerializer().serializeToString(xmlFragment);\n }\n };\n return api;\n};\n","import { loadXML, parseXML } from './qti-transformers';\n\nexport const qtiTransformManifest = (): {\n load: (uri: string) => Promise<typeof api>;\n assessmentTest: () => { href: string; identifier: string };\n} => {\n let xmlFragment: XMLDocument;\n\n const api = {\n async load(uri) {\n return new Promise<typeof api>(resolve => {\n loadXML(uri).then(xml => {\n xmlFragment = xml;\n return resolve(api);\n });\n });\n },\n parse(xmlString: string) {\n xmlFragment = parseXML(xmlString);\n },\n assessmentTest() {\n const el = xmlFragment.querySelector('resource[type=\"imsqti_test_xmlv3p0\"]');\n return { href: el.getAttribute('href'), identifier: el.getAttribute('identifier') };\n }\n };\n return api;\n};\n","/**\n * Returns an object with methods to load, parse and transform QTI tests.\n * @returns An object with methods to load, parse and transform QTI tests.\n * @example\n * const qtiTransformer = qtiTransformTest();\n * await qtiTransformer.load('https://example.com/test.xml');\n * const items = qtiTransformer.items();\n * const html = qtiTransformer.html();\n * const xml = qtiTransformer.xml();\n */\n\nimport { itemsFromTest, loadXML, parseXML, setLocation, toHTML } from './qti-transformers';\n\nexport type transformTestApi = {\n load: (uri: string) => Promise<transformTestApi>;\n parse: (xmlString: string) => transformTestApi;\n path: (location: string) => transformTestApi;\n fn: (fn: (xmlFragment: XMLDocument) => void) => transformTestApi;\n items: () => { identifier: string; href: string; category: string }[];\n html: () => string;\n xml: () => string;\n htmlDoc: () => DocumentFragment;\n xmlDoc: () => XMLDocument;\n};\n\nexport const qtiTransformTest = (): transformTestApi => {\n let xmlFragment: XMLDocument;\n\n const api: transformTestApi = {\n async load(uri) {\n return new Promise<transformTestApi>((resolve, _) => {\n loadXML(uri).then(xml => {\n xmlFragment = xml;\n\n api.path(uri.substring(0, uri.lastIndexOf('/')));\n return resolve(api);\n });\n });\n },\n parse(xmlString: string) {\n xmlFragment = parseXML(xmlString);\n return api;\n },\n path: (location: string): typeof api => {\n setLocation(xmlFragment, location);\n return api;\n },\n fn(fn: (xmlFragment: XMLDocument) => void) {\n fn(xmlFragment);\n return api;\n },\n items() {\n return itemsFromTest(xmlFragment);\n },\n html() {\n return new XMLSerializer().serializeToString(toHTML(xmlFragment));\n },\n xml(): string {\n return new XMLSerializer().serializeToString(xmlFragment);\n },\n htmlDoc() {\n return toHTML(xmlFragment);\n },\n xmlDoc(): XMLDocument {\n return xmlFragment;\n }\n };\n return api;\n};\n"],"mappings":";AAAA,IAAM,MAAM,OAAO;AAenB,IAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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IACT;AAAA,IACA,QAAQ;AACN,aAAO,cAAc,WAAW;AAAA,IAClC;AAAA,IACA,OAAO;AACL,aAAO,IAAI,cAAc,EAAE,kBAAkB,OAAO,WAAW,CAAC;AAAA,IAClE;AAAA,IACA,MAAc;AACZ,aAAO,IAAI,cAAc,EAAE,kBAAkB,WAAW;AAAA,IAC1D;AAAA,IACA,UAAU;AACR,aAAO,OAAO,WAAW;AAAA,IAC3B;AAAA,IACA,SAAsB;AACpB,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":["xml","xml","xml"]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import './qti-test/qti-assessment-test/qti-test-part.js';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import * as lit_html from 'lit-html';
|
|
4
|
+
import { j as QtiAssessmentItem, af as ItemContext, e as VariableDeclaration } from './qti-simple-choice-DxWcdKHi.js';
|
|
5
|
+
|
|
6
|
+
declare class QtiAssessmentItemRef extends LitElement {
|
|
7
|
+
category?: string;
|
|
8
|
+
identifier?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
fixed?: boolean;
|
|
11
|
+
href?: string;
|
|
12
|
+
_testContext?: TestContext;
|
|
13
|
+
weigths: Map<string, number>;
|
|
14
|
+
xmlDoc: DocumentFragment;
|
|
15
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
16
|
+
get assessmentItem(): QtiAssessmentItem | null;
|
|
17
|
+
connectedCallback(): Promise<void>;
|
|
18
|
+
render(): lit_html.TemplateResult<1>;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'qti-assessment-item-ref': QtiAssessmentItemRef;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class QtiAssessmentSection extends LitElement {
|
|
27
|
+
identifier: string;
|
|
28
|
+
required: string;
|
|
29
|
+
fixed: boolean;
|
|
30
|
+
title: string;
|
|
31
|
+
visible: boolean;
|
|
32
|
+
keepTogether: boolean;
|
|
33
|
+
_testContext?: TestContext;
|
|
34
|
+
connectedCallback(): Promise<void>;
|
|
35
|
+
render(): lit_html.TemplateResult<1>;
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
'qti-assessment-section': QtiAssessmentSection;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare class QtiAssessmentTest extends LitElement {
|
|
44
|
+
identifier: string;
|
|
45
|
+
title: string;
|
|
46
|
+
_testContext?: TestContext;
|
|
47
|
+
connectedCallback(): Promise<void>;
|
|
48
|
+
render(): lit_html.TemplateResult<1>;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
'qti-assessment-test': QtiAssessmentTest;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type View = 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor' | '';
|
|
57
|
+
declare module '../context' {
|
|
58
|
+
interface TestContext {
|
|
59
|
+
view?: View;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
type Constructor<T = {}> = abstract new (...args: any[]) => T;
|
|
63
|
+
declare class TestViewInterface {
|
|
64
|
+
}
|
|
65
|
+
declare const TestViewMixin: <T extends Constructor<TestBase>>(superClass: T) => Constructor<TestViewInterface> & T;
|
|
66
|
+
|
|
67
|
+
interface TestContext {
|
|
68
|
+
items: (ItemContext & {
|
|
69
|
+
category?: string;
|
|
70
|
+
})[];
|
|
71
|
+
testOutcomeVariables: VariableDeclaration<string | string[]>[];
|
|
72
|
+
navPartId?: string | null;
|
|
73
|
+
navSectionId?: string | null;
|
|
74
|
+
navItemId?: string | null;
|
|
75
|
+
navItemLoading?: boolean;
|
|
76
|
+
navTestLoading?: boolean;
|
|
77
|
+
view?: View;
|
|
78
|
+
}
|
|
79
|
+
declare const testContext: {
|
|
80
|
+
__context__: Readonly<TestContext>;
|
|
81
|
+
};
|
|
82
|
+
type TestElement = {
|
|
83
|
+
el: QtiAssessmentTest;
|
|
84
|
+
};
|
|
85
|
+
declare const testElement: {
|
|
86
|
+
__context__: Readonly<TestElement>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
declare abstract class TestBase extends LitElement {
|
|
90
|
+
protected _testContext: Readonly<TestContext>;
|
|
91
|
+
protected testElement: TestElement;
|
|
92
|
+
constructor();
|
|
93
|
+
get context(): TestContext;
|
|
94
|
+
set context(testContext: TestContext);
|
|
95
|
+
private _updateItemVariablesInTestContext;
|
|
96
|
+
/**
|
|
97
|
+
* Updates the variables of an assessment item in the test context.
|
|
98
|
+
* - Matches the assessment item with the corresponding test context item.
|
|
99
|
+
* - If the item is not found, logs a warning.
|
|
100
|
+
* - Updates variables in the test context if exactly one variable exists.
|
|
101
|
+
* - Otherwise, syncs the assessment item's variables with the test context.
|
|
102
|
+
*
|
|
103
|
+
* @param assessmentItem - The assessment item to update.
|
|
104
|
+
*/
|
|
105
|
+
private _updateItemInTestContext;
|
|
106
|
+
connectedCallback(): void;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { QtiAssessmentItemRef as Q, type TestContext as T, type View as V, QtiAssessmentSection as a, QtiAssessmentTest as b, type TestElement as c, testElement as d, TestViewMixin as e, TestBase as f, testContext as t };
|
|
@@ -416,7 +416,7 @@
|
|
|
416
416
|
},
|
|
417
417
|
{
|
|
418
418
|
"name": "qti-hottext-interaction",
|
|
419
|
-
"description": "\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**",
|
|
419
|
+
"description": "\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**\n\n### **Methods:**\n ",
|
|
420
420
|
"attributes": [
|
|
421
421
|
{ "name": "min-choices", "values": [] },
|
|
422
422
|
{ "name": "max-choices", "values": [] },
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
},
|
|
451
451
|
{
|
|
452
452
|
"name": "qti-choice-interaction",
|
|
453
|
-
"description": "An sample element.\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**\n\n### **Slots:**\n - _default_ - default slot of the choices\n- **prompt** - slot of the prompt\n\n### **CSS Properties:**\n - **--qti-bg-active** - The active background color _(default: #ffecec)_\n- **--qti-border-active** - The active border color _(default: #f86d70)_\n- **--qti-padding-horizontal** - The option horizontal padding _(default: 1px)_\n- **--qti-padding-vertical** - The option vertical padding _(default: solid)_\n- **--qti-border-radius** - The option border radius _(default: 8px)_\n\n### **CSS Parts:**\n - **slot** - The choice elements\n- **prompt** - The prompt\n- **message** - The validation message",
|
|
453
|
+
"description": "An sample element.\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**\n\n### **Methods:**\n \n\n### **Slots:**\n - _default_ - default slot of the choices\n- **prompt** - slot of the prompt\n\n### **CSS Properties:**\n - **--qti-bg-active** - The active background color _(default: #ffecec)_\n- **--qti-border-active** - The active border color _(default: #f86d70)_\n- **--qti-padding-horizontal** - The option horizontal padding _(default: 1px)_\n- **--qti-padding-vertical** - The option vertical padding _(default: solid)_\n- **--qti-border-radius** - The option border radius _(default: 8px)_\n\n### **CSS Parts:**\n - **slot** - The choice elements\n- **prompt** - The prompt\n- **message** - The validation message",
|
|
454
454
|
"attributes": [
|
|
455
455
|
{ "name": "orientation", "values": [{ "name": "Orientation" }] },
|
|
456
456
|
{ "name": "class", "values": [] },
|
|
@@ -519,12 +519,12 @@
|
|
|
519
519
|
},
|
|
520
520
|
{
|
|
521
521
|
"name": "qti-associate-interaction",
|
|
522
|
-
"description": "\n---\n\n\n### **Events:**\n - **qti-
|
|
522
|
+
"description": "\n---\n\n\n### **Events:**\n - **qti-interaction-response**\n- **qti-register-interaction**",
|
|
523
523
|
"attributes": [
|
|
524
524
|
{ "name": "min-associations", "values": [] },
|
|
525
525
|
{ "name": "max-associations", "values": [] },
|
|
526
|
-
{ "name": "disabled", "values": [] },
|
|
527
526
|
{ "name": "response-identifier", "values": [] },
|
|
527
|
+
{ "name": "disabled", "values": [] },
|
|
528
528
|
{ "name": "readonly", "values": [] }
|
|
529
529
|
],
|
|
530
530
|
"references": []
|
|
@@ -545,24 +545,27 @@
|
|
|
545
545
|
},
|
|
546
546
|
{
|
|
547
547
|
"name": "qti-end-attempt-interaction",
|
|
548
|
-
"description": "\n---\n\n\n### **Events:**\n - **end-attempt
|
|
548
|
+
"description": "\n---\n\n\n### **Events:**\n - **end-attempt**",
|
|
549
549
|
"attributes": [
|
|
550
|
-
{ "name": "count-attempt", "values": [] },
|
|
551
|
-
{ "name": "title", "values": [{ "name": "end attempt" }] },
|
|
552
550
|
{ "name": "response-identifier", "values": [] },
|
|
553
551
|
{ "name": "disabled", "values": [] },
|
|
554
|
-
{
|
|
552
|
+
{
|
|
553
|
+
"name": "count-attempt",
|
|
554
|
+
"description": "Defines the number of attempts that a user can make using the 'endAttemptInteraction' mechanism (this can be used to limit the number of hints, etc.). [More information](https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/index.html#DataCharacteristic_EndAttemptInteraction.Attr_count-attempt)",
|
|
555
|
+
"values": [{ "name": "true" }, { "name": "false" }]
|
|
556
|
+
},
|
|
557
|
+
{ "name": "title", "values": [] }
|
|
555
558
|
],
|
|
556
559
|
"references": []
|
|
557
560
|
},
|
|
558
561
|
{
|
|
559
562
|
"name": "qti-gap-match-interaction",
|
|
560
|
-
"description": "\n---\n\n\n### **Events:**\n - **qti-
|
|
563
|
+
"description": "\n---\n\n\n### **Events:**\n - **qti-interaction-response**\n- **qti-register-interaction**",
|
|
561
564
|
"attributes": [
|
|
562
565
|
{ "name": "min-associations", "values": [] },
|
|
563
566
|
{ "name": "max-associations", "values": [] },
|
|
564
|
-
{ "name": "disabled", "values": [] },
|
|
565
567
|
{ "name": "response-identifier", "values": [] },
|
|
568
|
+
{ "name": "disabled", "values": [] },
|
|
566
569
|
{ "name": "readonly", "values": [] }
|
|
567
570
|
],
|
|
568
571
|
"references": []
|
|
@@ -591,19 +594,19 @@
|
|
|
591
594
|
},
|
|
592
595
|
{
|
|
593
596
|
"name": "qti-graphic-gap-match-interaction",
|
|
594
|
-
"description": "\n---\n\n\n### **Events:**\n - **qti-
|
|
597
|
+
"description": "\n---\n\n\n### **Events:**\n - **qti-interaction-response**\n- **qti-register-interaction**",
|
|
595
598
|
"attributes": [
|
|
596
599
|
{ "name": "min-associations", "values": [] },
|
|
597
600
|
{ "name": "max-associations", "values": [] },
|
|
598
|
-
{ "name": "disabled", "values": [] },
|
|
599
601
|
{ "name": "response-identifier", "values": [] },
|
|
602
|
+
{ "name": "disabled", "values": [] },
|
|
600
603
|
{ "name": "readonly", "values": [] }
|
|
601
604
|
],
|
|
602
605
|
"references": []
|
|
603
606
|
},
|
|
604
607
|
{
|
|
605
608
|
"name": "qti-graphic-order-interaction",
|
|
606
|
-
"description": "\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**",
|
|
609
|
+
"description": "\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**\n\n### **Methods:**\n ",
|
|
607
610
|
"attributes": [
|
|
608
611
|
{ "name": "min-choices", "values": [] },
|
|
609
612
|
{ "name": "max-choices", "values": [] },
|
|
@@ -615,7 +618,7 @@
|
|
|
615
618
|
},
|
|
616
619
|
{
|
|
617
620
|
"name": "qti-hotspot-interaction",
|
|
618
|
-
"description": "\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**",
|
|
621
|
+
"description": "\n---\n\n\n### **Events:**\n - **qti-register-interaction**\n- **qti-interaction-response**\n\n### **Methods:**\n ",
|
|
619
622
|
"attributes": [
|
|
620
623
|
{ "name": "min-choices", "values": [] },
|
|
621
624
|
{ "name": "max-choices", "values": [] },
|
|
@@ -627,7 +630,7 @@
|
|
|
627
630
|
},
|
|
628
631
|
{
|
|
629
632
|
"name": "qti-match-interaction",
|
|
630
|
-
"description": "\n---\n\n\n### **Events:**\n - **qti-
|
|
633
|
+
"description": "\n---\n\n\n### **Events:**\n - **qti-interaction-response**\n- **qti-register-interaction**",
|
|
631
634
|
"attributes": [
|
|
632
635
|
{ "name": "class", "values": [] },
|
|
633
636
|
{ "name": "response-identifier", "values": [] },
|
|
@@ -650,7 +653,7 @@
|
|
|
650
653
|
},
|
|
651
654
|
{
|
|
652
655
|
"name": "qti-order-interaction",
|
|
653
|
-
"description": "\n---\n\n\n### **Events:**\n - **qti-
|
|
656
|
+
"description": "\n---\n\n\n### **Events:**\n - **qti-interaction-response**\n- **qti-register-interaction**",
|
|
654
657
|
"attributes": [
|
|
655
658
|
{
|
|
656
659
|
"name": "orientation",
|
|
@@ -664,8 +667,8 @@
|
|
|
664
667
|
},
|
|
665
668
|
{ "name": "min-associations", "values": [] },
|
|
666
669
|
{ "name": "max-associations", "values": [] },
|
|
667
|
-
{ "name": "disabled", "values": [] },
|
|
668
670
|
{ "name": "response-identifier", "values": [] },
|
|
671
|
+
{ "name": "disabled", "values": [] },
|
|
669
672
|
{ "name": "readonly", "values": [] }
|
|
670
673
|
],
|
|
671
674
|
"references": []
|
|
@@ -804,6 +807,24 @@
|
|
|
804
807
|
],
|
|
805
808
|
"references": []
|
|
806
809
|
},
|
|
810
|
+
{
|
|
811
|
+
"name": "qti-item",
|
|
812
|
+
"description": "`<qti-item>` is a custom element designed for rendering a single `qti-assessment-item`.\nIt can also host some functionalities to interact with the item like scoring, showing feedback, etc.\nPlacing a mandatory `<item-container>` inside '<qti-item>' will load or parse the item and render it.\nSee `<item-container>` for more details.\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",
|
|
813
|
+
"attributes": [],
|
|
814
|
+
"references": []
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
"name": "item-container",
|
|
818
|
+
"description": "`<item-container>` is a custom element designed for hosting the qti-assessment-item.\nThe `qti-assessment-item` will be placed inside the shadow DOM of this element.\nThe element loads the item from the provided URL and renders it inside the shadow DOM.\n\n### Styling\nAdd 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",
|
|
819
|
+
"attributes": [
|
|
820
|
+
{
|
|
821
|
+
"name": "item-url",
|
|
822
|
+
"description": "URL of the item to load",
|
|
823
|
+
"values": []
|
|
824
|
+
}
|
|
825
|
+
],
|
|
826
|
+
"references": []
|
|
827
|
+
},
|
|
807
828
|
{
|
|
808
829
|
"name": "qti-assessment-item-ref",
|
|
809
830
|
"description": "\n---\n\n\n### **Events:**\n - **qti-assessment-item-ref-connected**",
|
|
@@ -878,8 +899,16 @@
|
|
|
878
899
|
"name": "test-view",
|
|
879
900
|
"description": "\n---\n\n\n### **Events:**\n - **on-test-switch-view**\n- **qti-request-test-item**",
|
|
880
901
|
"attributes": [
|
|
881
|
-
{
|
|
882
|
-
|
|
902
|
+
{
|
|
903
|
+
"name": "label",
|
|
904
|
+
"description": "label accompanying the select view dropdown",
|
|
905
|
+
"values": []
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
"name": "view-options",
|
|
909
|
+
"description": "The options to display in the dropdown, default: ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor']",
|
|
910
|
+
"values": []
|
|
911
|
+
}
|
|
883
912
|
],
|
|
884
913
|
"references": []
|
|
885
914
|
},
|
|
@@ -891,7 +920,7 @@
|
|
|
891
920
|
},
|
|
892
921
|
{
|
|
893
922
|
"name": "test-container",
|
|
894
|
-
"description": "`<test-container>` is a custom element designed for hosting the qti-assessment-item.\nThe `qti-assessment-test` will be placed inside the shadow DOM of this element.\nThe element loads the
|
|
923
|
+
"description": "`<test-container>` is a custom element designed for hosting the qti-assessment-item.\nThe `qti-assessment-test` will be placed inside the shadow DOM of this element.\nThe element loads the test from the provided URL and renders it inside the shadow DOM.\n\n```html\n<qti-test>\n <test-container class=\"m-4 bg-white\" test-url=\"./path/to/assessmenttest.xml\"></test-container>\n</qti-test>\n```\n---\n",
|
|
895
924
|
"attributes": [
|
|
896
925
|
{
|
|
897
926
|
"name": "test-url",
|
|
@@ -909,24 +938,6 @@
|
|
|
909
938
|
{ "name": "skip-on-category", "values": [] }
|
|
910
939
|
],
|
|
911
940
|
"references": []
|
|
912
|
-
},
|
|
913
|
-
{
|
|
914
|
-
"name": "qti-item",
|
|
915
|
-
"description": "`<qti-item>` is a custom element designed for rendering a single `qti-assessment-item`.\nIt can also host some functionalities to interact with the item like scoring, showing feedback, etc.\nPlacing a mandatory `<item-container>` inside '<qti-item>' will load or parse the item and render it.\nSee `<item-container>` for more details.\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",
|
|
916
|
-
"attributes": [],
|
|
917
|
-
"references": []
|
|
918
|
-
},
|
|
919
|
-
{
|
|
920
|
-
"name": "item-container",
|
|
921
|
-
"description": "`<item-container>` is a custom element designed for hosting the qti-assessment-item.\nThe `qti-assessment-item` will be placed inside the shadow DOM of this element.\nThe element loads the item from the provided URL and renders it inside the shadow DOM.\n\n### Styling\nAdd 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",
|
|
922
|
-
"attributes": [
|
|
923
|
-
{
|
|
924
|
-
"name": "item-url",
|
|
925
|
-
"description": "URL of the item to load",
|
|
926
|
-
"values": []
|
|
927
|
-
}
|
|
928
|
-
],
|
|
929
|
-
"references": []
|
|
930
941
|
}
|
|
931
942
|
]
|
|
932
943
|
}
|