@citolab/qti-components 7.0.5 → 7.0.6-beta.0
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/chunk-4DFVJE2A.js +48 -0
- package/cdn/chunk-4I75QSIL.js +8 -0
- package/cdn/chunk-5WCOPF7O.js +73 -0
- package/cdn/chunk-A536ZOJJ.js +43 -0
- package/cdn/chunk-BLKKKK6C.js +11 -0
- package/cdn/chunk-DC2R556M.js +5 -0
- package/cdn/chunk-GALSGMIP.js +5 -0
- package/cdn/chunk-IXSX4SJX.js +1 -0
- package/cdn/chunk-KYOTSBCX.js +1 -0
- package/cdn/chunk-L4TDHAKL.js +24 -0
- package/cdn/chunk-M6AATWPS.js +59 -0
- package/cdn/{chunks/chunk-UIEC4LXR.js → chunk-MFWSHIPH.js} +1 -1
- package/cdn/chunk-QGKK4T2J.js +8 -0
- package/cdn/chunk-ROXN2HIJ.js +8 -0
- package/cdn/{chunks/chunk-CFXQCNG6.js → chunk-SQDSHH6N.js} +18 -2
- package/cdn/chunk-T4A5AZCI.js +939 -0
- package/cdn/index.global.js +71 -71
- package/cdn/index.js +1 -4503
- package/cdn/qti-components/index.global.js +1 -1
- package/cdn/qti-components/index.js +1 -924
- package/cdn/qti-item/core/index.global.js +149 -0
- package/cdn/qti-item/core/index.js +1 -0
- package/cdn/qti-loader/index.js +1 -23
- package/cdn/qti-test/components/index.global.js +1 -36
- package/cdn/qti-test/components/index.js +1 -3598
- package/cdn/qti-test/components/styles.js +1 -17
- package/cdn/qti-test/components/test-component.abstract.js +1 -1
- package/cdn/qti-test/components/test-item-link.js +1 -24
- package/cdn/qti-test/components/test-next.js +1 -24
- package/cdn/qti-test/components/test-next.spec.global.js +1 -234
- package/cdn/qti-test/components/test-next.spec.js +245 -4747
- package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -3
- package/cdn/qti-test/components/test-prev.js +1 -24
- package/cdn/qti-test/components/test-view.js +1 -11
- package/cdn/qti-test/core/index.global.js +205 -0
- package/cdn/qti-test/core/index.js +1 -0
- package/cdn/qti-transformers/index.js +1 -23
- package/dist/{chunks/chunk-Y6UWSECL.js → chunk-2CHF3TMY.js} +2 -2
- package/dist/chunk-2CHF3TMY.js.map +1 -0
- package/dist/{chunks/chunk-XDMSEAYC.js → chunk-2OA7E3E7.js} +1 -1
- package/dist/chunk-2OA7E3E7.js.map +1 -0
- package/dist/{chunks/chunk-W4B23OIP.js → chunk-3TFUBCJW.js} +4 -4
- package/dist/chunk-3TFUBCJW.js.map +1 -0
- package/dist/{chunks/chunk-6YE2KJ4C.js → chunk-44VE5POH.js} +1 -1
- package/dist/{chunks/chunk-3ROZMGAN.js → chunk-4FH7P7YI.js} +4 -4
- package/dist/chunk-4FH7P7YI.js.map +1 -0
- package/dist/{chunks/chunk-ELDMXTUQ.js → chunk-4YG2FPKK.js} +1 -1
- package/dist/chunk-4YG2FPKK.js.map +1 -0
- package/dist/{chunks/chunk-HWA4A3SR.js → chunk-6SG3NMKU.js} +4 -4
- package/dist/chunk-6SG3NMKU.js.map +1 -0
- package/dist/{chunks/chunk-LKINC6JO.js → chunk-ANLIJZBL.js} +6 -6
- package/dist/chunk-ANLIJZBL.js.map +1 -0
- package/dist/{qti-test/qti-test.js → chunk-CNQYM52B.js} +308 -239
- package/dist/chunk-CNQYM52B.js.map +1 -0
- package/dist/{chunks/chunk-XDFXD3BI.js → chunk-F3NTI6TX.js} +2 -2
- package/dist/chunk-F3NTI6TX.js.map +1 -0
- package/dist/{chunks/chunk-ZEFOMZNY.js → chunk-F7HTXGGH.js} +3 -3
- package/dist/chunk-F7HTXGGH.js.map +1 -0
- package/dist/chunk-MAC76UNI.js +1 -0
- package/dist/{chunks/chunk-PUBGXXTM.js → chunk-OO6JSYLP.js} +4 -4
- package/dist/chunk-OO6JSYLP.js.map +1 -0
- package/dist/{chunks/chunk-LROTNPC2.js → chunk-QYN5S4EM.js} +22 -9
- package/dist/chunk-QYN5S4EM.js.map +1 -0
- package/dist/{chunks/chunk-4O5F7WV7.js → chunk-UB5K44DB.js} +1 -1
- package/dist/chunk-UB5K44DB.js.map +1 -0
- package/dist/{chunks/chunk-3OXGDCSU.js → chunk-UBZPSVSE.js} +83 -35
- package/dist/chunk-UBZPSVSE.js.map +1 -0
- package/dist/index.d.ts +5 -10
- package/dist/index.js +131 -11043
- package/dist/index.js.map +1 -1
- package/dist/qti-components/index.js +94 -6431
- package/dist/qti-components/index.js.map +1 -1
- package/dist/qti-components-jsx.d.ts +83 -83
- package/dist/qti-item/{components/item-container.d.ts → core/index.d.ts} +22 -1
- package/dist/qti-item/core/index.js +13 -0
- package/dist/qti-loader/index.js +6 -287
- package/dist/qti-loader/index.js.map +1 -1
- package/dist/qti-test/components/index.d.ts +1 -3
- package/dist/qti-test/components/index.js +23 -4135
- package/dist/qti-test/components/index.js.map +1 -1
- package/dist/qti-test/components/styles.js +7 -22
- package/dist/qti-test/components/styles.js.map +1 -1
- package/dist/qti-test/components/test-component.abstract.d.ts +1 -2
- package/dist/qti-test/components/test-component.abstract.js +6 -145
- package/dist/qti-test/components/test-component.abstract.js.map +1 -1
- package/dist/qti-test/components/test-item-link.d.ts +1 -2
- package/dist/qti-test/components/test-item-link.js +8 -198
- package/dist/qti-test/components/test-item-link.js.map +1 -1
- package/dist/qti-test/components/test-next.d.ts +1 -2
- package/dist/qti-test/components/test-next.js +8 -205
- package/dist/qti-test/components/test-next.js.map +1 -1
- package/{cdn/qti-test/components/test-container.js → dist/qti-test/components/test-next.spec.css} +224 -1292
- package/dist/qti-test/components/test-next.spec.css.map +1 -0
- package/dist/qti-test/components/test-next.spec.d.ts +3 -6
- package/dist/qti-test/components/test-next.spec.js +141 -11152
- package/dist/qti-test/components/test-next.spec.js.map +1 -1
- package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +1 -2
- package/dist/qti-test/components/test-paging-buttons-stamp.js +7 -214
- package/dist/qti-test/components/test-paging-buttons-stamp.js.map +1 -1
- package/dist/qti-test/components/test-prev.d.ts +1 -2
- package/dist/qti-test/components/test-prev.js +8 -205
- package/dist/qti-test/components/test-prev.js.map +1 -1
- package/dist/qti-test/components/test-view.d.ts +1 -2
- package/dist/qti-test/components/test-view.js +7 -205
- package/dist/qti-test/components/test-view.js.map +1 -1
- package/dist/qti-test/core/index.d.ts +121 -0
- package/dist/qti-test/core/index.js +27 -0
- package/dist/qti-transformers/index.js +6 -287
- package/dist/qti-transformers/index.js.map +1 -1
- package/dist/{test-base-BJwG9Ie8.d.ts → test.context-DbSTxKk_.d.ts} +18 -28
- package/dist/vscode.html-custom-data.json +21 -21
- package/package.json +90 -78
- package/cdn/chunks/chunk-4UJBK6JO.js +0 -1
- package/cdn/chunks/chunk-5O3Z7TDV.js +0 -1
- package/cdn/chunks/chunk-65LFT33L.js +0 -8
- package/cdn/chunks/chunk-6D25UFJR.js +0 -8
- package/cdn/chunks/chunk-6UGPNL7M.js +0 -1
- package/cdn/chunks/chunk-CSUKVUZF.js +0 -3
- package/cdn/chunks/chunk-CSY3WI5A.js +0 -1
- package/cdn/chunks/chunk-DAZR7RUI.js +0 -0
- package/cdn/chunks/chunk-EHK76KRT.js +0 -1
- package/cdn/chunks/chunk-EOPEMJS3.js +0 -0
- package/cdn/chunks/chunk-G5O7EN45.js +0 -5
- package/cdn/chunks/chunk-GEFUIFM7.js +0 -0
- package/cdn/chunks/chunk-JLNHEMQG.js +0 -1
- package/cdn/chunks/chunk-LPWIM7QJ.js +0 -902
- package/cdn/chunks/chunk-M3YRM3AV.js +0 -1
- package/cdn/chunks/chunk-M6BOWL2U.js +0 -1
- package/cdn/chunks/chunk-P5IE36FO.js +0 -8
- package/cdn/chunks/chunk-PXH5KN5O.js +0 -1
- package/cdn/chunks/chunk-RBEI6NIF.js +0 -1
- package/cdn/chunks/chunk-SMKIYFFI.js +0 -1
- package/cdn/chunks/chunk-SRLMW23F.js +0 -0
- package/cdn/chunks/chunk-T3YDLD2H.js +0 -11
- package/cdn/chunks/chunk-T6IXJ4W4.js +0 -1
- package/cdn/chunks/chunk-TFAUBGP2.js +0 -0
- package/cdn/chunks/chunk-V44O3GTW.js +0 -0
- package/cdn/chunks/chunk-V6B54FQW.js +0 -5
- package/cdn/chunks/chunk-V6KX6BQN.js +0 -1
- package/cdn/chunks/chunk-VYANBI35.js +0 -1
- package/cdn/chunks/chunk-XUJ7TXHW.js +0 -1
- package/cdn/chunks/chunk-ZIZLFFSG.js +0 -0
- package/cdn/index.css +0 -1
- package/cdn/qti-item/components/index.css +0 -1
- package/cdn/qti-item/components/index.global.js +0 -149
- package/cdn/qti-item/components/index.js +0 -3549
- package/cdn/qti-item/components/item-container.css +0 -1
- package/cdn/qti-item/components/item-container.global.js +0 -149
- package/cdn/qti-item/components/item-container.js +0 -3549
- package/cdn/qti-item/index.css +0 -1
- package/cdn/qti-item/index.global.js +0 -149
- package/cdn/qti-item/index.js +0 -3549
- package/cdn/qti-item/qti-item.global.js +0 -114
- package/cdn/qti-item/qti-item.js +0 -1
- package/cdn/qti-test/components/index.css +0 -1
- package/cdn/qti-test/components/test-container.css +0 -1
- package/cdn/qti-test/components/test-container.global.js +0 -149
- package/cdn/qti-test/context/index.global.js +0 -58
- package/cdn/qti-test/context/index.js +0 -1
- package/cdn/qti-test/context/test.context.global.js +0 -58
- package/cdn/qti-test/context/test.context.js +0 -1
- package/cdn/qti-test/index.css +0 -1
- package/cdn/qti-test/index.global.js +0 -242
- package/cdn/qti-test/index.js +0 -3598
- package/cdn/qti-test/mixins/index.global.js +0 -1
- package/cdn/qti-test/mixins/index.js +0 -23
- package/cdn/qti-test/mixins/test-loader.mixin.global.js +0 -1
- package/cdn/qti-test/mixins/test-loader.mixin.js +0 -23
- package/cdn/qti-test/mixins/test-navigation.mixin.global.js +0 -1
- package/cdn/qti-test/mixins/test-navigation.mixin.js +0 -1
- package/cdn/qti-test/mixins/test-view.mixin.global.js +0 -1
- package/cdn/qti-test/mixins/test-view.mixin.js +0 -1
- package/cdn/qti-test/qti-assessment-test/index.global.js +0 -170
- package/cdn/qti-test/qti-assessment-test/index.js +0 -1
- package/cdn/qti-test/qti-assessment-test/qti-assessment-item-ref.global.js +0 -170
- package/cdn/qti-test/qti-assessment-test/qti-assessment-item-ref.js +0 -1
- package/cdn/qti-test/qti-assessment-test/qti-assessment-section.global.js +0 -170
- package/cdn/qti-test/qti-assessment-test/qti-assessment-section.js +0 -1
- package/cdn/qti-test/qti-assessment-test/qti-assessment-test.global.js +0 -170
- package/cdn/qti-test/qti-assessment-test/qti-assessment-test.js +0 -1
- package/cdn/qti-test/qti-assessment-test/qti-test-part.global.js +0 -114
- package/cdn/qti-test/qti-assessment-test/qti-test-part.js +0 -1
- package/cdn/qti-test/qti-test.global.js +0 -170
- package/cdn/qti-test/qti-test.js +0 -23
- package/cdn/qti-test/test-base.global.js +0 -170
- package/cdn/qti-test/test-base.js +0 -1
- package/dist/chunks/chunk-3G2DDBJW.js +0 -44
- package/dist/chunks/chunk-3G2DDBJW.js.map +0 -1
- package/dist/chunks/chunk-3NLCJYSX.js +0 -1
- package/dist/chunks/chunk-3OXGDCSU.js.map +0 -1
- package/dist/chunks/chunk-3ROZMGAN.js.map +0 -1
- package/dist/chunks/chunk-4O5F7WV7.js.map +0 -1
- package/dist/chunks/chunk-AAQCM2FP.js +0 -56
- package/dist/chunks/chunk-AAQCM2FP.js.map +0 -1
- package/dist/chunks/chunk-D3RGDWKP.js +0 -37
- package/dist/chunks/chunk-D3RGDWKP.js.map +0 -1
- package/dist/chunks/chunk-DJLE6EV2.js +0 -36
- package/dist/chunks/chunk-DJLE6EV2.js.map +0 -1
- package/dist/chunks/chunk-ELDMXTUQ.js.map +0 -1
- package/dist/chunks/chunk-EW5CTHAD.js +0 -1
- package/dist/chunks/chunk-HWA4A3SR.js.map +0 -1
- package/dist/chunks/chunk-IKZWK2C5.js +0 -1
- package/dist/chunks/chunk-IP7JSYO6.js +0 -1
- package/dist/chunks/chunk-IP7JSYO6.js.map +0 -1
- package/dist/chunks/chunk-JE6BMXZU.js +0 -94
- package/dist/chunks/chunk-JE6BMXZU.js.map +0 -1
- package/dist/chunks/chunk-JSPJGWGT.js +0 -20
- package/dist/chunks/chunk-JSPJGWGT.js.map +0 -1
- package/dist/chunks/chunk-LKINC6JO.js.map +0 -1
- package/dist/chunks/chunk-LROTNPC2.js.map +0 -1
- package/dist/chunks/chunk-MTMT2RMF.js +0 -63
- package/dist/chunks/chunk-MTMT2RMF.js.map +0 -1
- package/dist/chunks/chunk-NDJZGJUR.js +0 -65
- package/dist/chunks/chunk-NDJZGJUR.js.map +0 -1
- package/dist/chunks/chunk-OE2LFIH2.js +0 -1
- package/dist/chunks/chunk-OE2LFIH2.js.map +0 -1
- package/dist/chunks/chunk-OJ2XGDWK.js +0 -1
- package/dist/chunks/chunk-OJ2XGDWK.js.map +0 -1
- package/dist/chunks/chunk-PUBGXXTM.js.map +0 -1
- package/dist/chunks/chunk-QRCUNRP5.js +0 -75
- package/dist/chunks/chunk-QRCUNRP5.js.map +0 -1
- package/dist/chunks/chunk-S6JJYCO7.js +0 -51
- package/dist/chunks/chunk-S6JJYCO7.js.map +0 -1
- package/dist/chunks/chunk-U3AALKEP.js +0 -1
- package/dist/chunks/chunk-U3AALKEP.js.map +0 -1
- package/dist/chunks/chunk-UCQFSRYF.js +0 -34
- package/dist/chunks/chunk-UCQFSRYF.js.map +0 -1
- package/dist/chunks/chunk-URGVQ64M.js +0 -1
- package/dist/chunks/chunk-URGVQ64M.js.map +0 -1
- package/dist/chunks/chunk-V4FXK4TP.js +0 -128
- package/dist/chunks/chunk-V4FXK4TP.js.map +0 -1
- package/dist/chunks/chunk-W4B23OIP.js.map +0 -1
- package/dist/chunks/chunk-XDFXD3BI.js.map +0 -1
- package/dist/chunks/chunk-XDMSEAYC.js.map +0 -1
- package/dist/chunks/chunk-XPDS72XY.js +0 -29
- package/dist/chunks/chunk-XPDS72XY.js.map +0 -1
- package/dist/chunks/chunk-Y6UWSECL.js.map +0 -1
- package/dist/chunks/chunk-ZEFOMZNY.js.map +0 -1
- package/dist/index-Cvrd4KQA.d.ts +0 -109
- package/dist/qti-item/components/index.d.ts +0 -3
- package/dist/qti-item/components/index.js +0 -3856
- package/dist/qti-item/components/index.js.map +0 -1
- package/dist/qti-item/components/item-container.js +0 -3856
- package/dist/qti-item/components/item-container.js.map +0 -1
- package/dist/qti-item/index.d.ts +0 -4
- package/dist/qti-item/index.js +0 -3869
- package/dist/qti-item/index.js.map +0 -1
- package/dist/qti-item/qti-item.d.ts +0 -25
- package/dist/qti-item/qti-item.js +0 -26
- package/dist/qti-item/qti-item.js.map +0 -1
- package/dist/qti-test/components/test-container.d.ts +0 -37
- package/dist/qti-test/components/test-container.js +0 -3782
- package/dist/qti-test/components/test-container.js.map +0 -1
- package/dist/qti-test/context/index.d.ts +0 -6
- package/dist/qti-test/context/index.js +0 -9
- package/dist/qti-test/context/index.js.map +0 -1
- package/dist/qti-test/context/test.context.d.ts +0 -6
- package/dist/qti-test/context/test.context.js +0 -9
- package/dist/qti-test/context/test.context.js.map +0 -1
- package/dist/qti-test/index.d.ts +0 -14
- package/dist/qti-test/index.js +0 -4746
- package/dist/qti-test/index.js.map +0 -1
- package/dist/qti-test/mixins/index.d.ts +0 -8
- package/dist/qti-test/mixins/index.js +0 -350
- package/dist/qti-test/mixins/index.js.map +0 -1
- package/dist/qti-test/mixins/test-loader.mixin.d.ts +0 -8
- package/dist/qti-test/mixins/test-loader.mixin.js +0 -240
- package/dist/qti-test/mixins/test-loader.mixin.js.map +0 -1
- package/dist/qti-test/mixins/test-navigation.mixin.d.ts +0 -22
- package/dist/qti-test/mixins/test-navigation.mixin.js +0 -64
- package/dist/qti-test/mixins/test-navigation.mixin.js.map +0 -1
- package/dist/qti-test/mixins/test-view.mixin.d.ts +0 -6
- package/dist/qti-test/mixins/test-view.mixin.js +0 -50
- package/dist/qti-test/mixins/test-view.mixin.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/index.d.ts +0 -6
- package/dist/qti-test/qti-assessment-test/index.js +0 -221
- package/dist/qti-test/qti-assessment-test/index.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.d.ts +0 -6
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.js +0 -85
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.d.ts +0 -6
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.js +0 -73
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.d.ts +0 -6
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.js +0 -54
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.js.map +0 -1
- package/dist/qti-test/qti-assessment-test/qti-test-part.d.ts +0 -19
- package/dist/qti-test/qti-assessment-test/qti-test-part.js +0 -62
- package/dist/qti-test/qti-assessment-test/qti-test-part.js.map +0 -1
- package/dist/qti-test/qti-test.d.ts +0 -68
- package/dist/qti-test/qti-test.js.map +0 -1
- package/dist/qti-test/test-base.d.ts +0 -6
- package/dist/qti-test/test-base.js +0 -137
- package/dist/qti-test/test-base.js.map +0 -1
- /package/cdn/{chunks/chunk-6DMSHH5X.js → chunk-22HAPLRD.js} +0 -0
- /package/cdn/{chunks/chunk-5FCXUJAG.js → chunk-LVW3MHTI.js} +0 -0
- /package/cdn/{chunks/chunk-T4HD2C4F.js → chunk-VI2WKTN4.js} +0 -0
- /package/dist/{chunks/chunk-3NLCJYSX.js.map → chunk-44VE5POH.js.map} +0 -0
- /package/dist/{chunks/chunk-6YE2KJ4C.js.map → chunk-MAC76UNI.js.map} +0 -0
- /package/dist/{chunks/chunk-EW5CTHAD.js.map → qti-item/core/index.js.map} +0 -0
- /package/dist/{chunks/chunk-IKZWK2C5.js.map → qti-test/core/index.js.map} +0 -0
|
@@ -1,208 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (kind && result) __defProp(target, key, result);
|
|
9
|
-
return result;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// src/lib/qti-test/components/test-view.ts
|
|
13
|
-
import { html } from "lit";
|
|
14
|
-
import { customElement, property as property2, state as state2 } from "lit/decorators.js";
|
|
15
|
-
|
|
16
|
-
// src/lib/qti-test/components/test-component.abstract.ts
|
|
17
|
-
import { consume } from "@lit/context";
|
|
18
|
-
import { LitElement } from "lit";
|
|
19
|
-
import { state } from "lit/decorators.js";
|
|
20
|
-
|
|
21
|
-
// src/lib/decorators/watch.ts
|
|
22
|
-
function watch(propertyName, options) {
|
|
23
|
-
const resolvedOptions = {
|
|
24
|
-
waitUntilFirstUpdate: false,
|
|
25
|
-
...options
|
|
26
|
-
};
|
|
27
|
-
return (proto, decoratedFnName) => {
|
|
28
|
-
const { update } = proto;
|
|
29
|
-
const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];
|
|
30
|
-
proto.update = function(changedProps) {
|
|
31
|
-
watchedProperties.forEach((property3) => {
|
|
32
|
-
const key = property3;
|
|
33
|
-
if (changedProps.has(key)) {
|
|
34
|
-
const oldValue = changedProps.get(key);
|
|
35
|
-
const newValue = this[key];
|
|
36
|
-
if (oldValue !== newValue) {
|
|
37
|
-
if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {
|
|
38
|
-
this[decoratedFnName](oldValue, newValue);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
update.call(this, changedProps);
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// src/lib/decorators/prop-internal-state.ts
|
|
49
|
-
import { property } from "lit/decorators.js";
|
|
50
|
-
function propInternalState(options) {
|
|
51
|
-
return (protoOrDescriptor, name) => {
|
|
52
|
-
property(options)(protoOrDescriptor, name);
|
|
53
|
-
const key = `__${name}`;
|
|
54
|
-
Object.defineProperty(protoOrDescriptor, name, {
|
|
55
|
-
get() {
|
|
56
|
-
return this[key];
|
|
57
|
-
},
|
|
58
|
-
set(value) {
|
|
59
|
-
const oldValue = this[key];
|
|
60
|
-
this[key] = value;
|
|
61
|
-
if (oldValue !== value) {
|
|
62
|
-
if (this._internals?.states) {
|
|
63
|
-
const stateName = name.toLowerCase();
|
|
64
|
-
if (value) {
|
|
65
|
-
this._internals.states.add(`--${stateName}`);
|
|
66
|
-
} else {
|
|
67
|
-
this._internals.states.delete(`--${stateName}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (options.aria && this._internals) {
|
|
71
|
-
const ariaAttribute = options.aria;
|
|
72
|
-
if (value) {
|
|
73
|
-
this._internals[ariaAttribute] = "true";
|
|
74
|
-
} else {
|
|
75
|
-
this._internals[ariaAttribute] = null;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
this.requestUpdate(name, oldValue);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
configurable: true,
|
|
82
|
-
enumerable: true
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/lib/qti-test/context/test.context.ts
|
|
88
|
-
import { createContext } from "@lit/context";
|
|
89
|
-
var testContext = createContext(Symbol("test"));
|
|
90
|
-
var testElement = createContext(Symbol("testElement"));
|
|
91
|
-
|
|
92
|
-
// src/lib/qti-test/components/test-component.abstract.ts
|
|
93
|
-
var TestComponent = class extends LitElement {
|
|
94
|
-
constructor() {
|
|
95
|
-
super();
|
|
96
|
-
this.disabled = true;
|
|
97
|
-
this._internals = this.attachInternals();
|
|
98
|
-
}
|
|
99
|
-
_handleTestElementChange(_oldValue, newValue) {
|
|
100
|
-
if (newValue.el) {
|
|
101
|
-
this.disabled = false;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
willUpdate(changedProperties) {
|
|
105
|
-
if (changedProperties.has("_testContext")) {
|
|
106
|
-
const { items = [], navItemId } = this._testContext ?? {};
|
|
107
|
-
this.itemIndex = items.findIndex((item) => item.identifier === navItemId);
|
|
108
|
-
this.items = items;
|
|
109
|
-
this.view = this._testContext?.view;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
_switchView(view) {
|
|
113
|
-
this.dispatchEvent(
|
|
114
|
-
new CustomEvent("on-test-switch-view", {
|
|
115
|
-
composed: true,
|
|
116
|
-
bubbles: true,
|
|
117
|
-
detail: view
|
|
118
|
-
})
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
_requestItem(identifier) {
|
|
122
|
-
this.dispatchEvent(
|
|
123
|
-
new CustomEvent("qti-request-test-item", {
|
|
124
|
-
composed: true,
|
|
125
|
-
bubbles: true,
|
|
126
|
-
detail: identifier
|
|
127
|
-
})
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
__decorateClass([
|
|
132
|
-
propInternalState({
|
|
133
|
-
type: Boolean,
|
|
134
|
-
reflect: true,
|
|
135
|
-
aria: "ariaDisabled"
|
|
136
|
-
// Maps to `aria-disabled` attribute
|
|
137
|
-
})
|
|
138
|
-
], TestComponent.prototype, "disabled", 2);
|
|
139
|
-
__decorateClass([
|
|
140
|
-
state(),
|
|
141
|
-
consume({ context: testContext, subscribe: true })
|
|
142
|
-
], TestComponent.prototype, "_testContext", 2);
|
|
143
|
-
__decorateClass([
|
|
144
|
-
state(),
|
|
145
|
-
consume({ context: testElement, subscribe: true })
|
|
146
|
-
], TestComponent.prototype, "_testElement", 2);
|
|
147
|
-
__decorateClass([
|
|
148
|
-
watch("_testElement")
|
|
149
|
-
], TestComponent.prototype, "_handleTestElementChange", 1);
|
|
150
|
-
|
|
151
|
-
// src/lib/qti-test/components/test-view.ts
|
|
152
|
-
var TestView = class extends TestComponent {
|
|
153
|
-
constructor() {
|
|
154
|
-
super(...arguments);
|
|
155
|
-
this.label = "view";
|
|
156
|
-
this._handleViewOptionsChange = () => {
|
|
157
|
-
this.updateViewOptions();
|
|
158
|
-
};
|
|
159
|
-
this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;
|
|
160
|
-
}
|
|
161
|
-
connectedCallback() {
|
|
162
|
-
super.connectedCallback();
|
|
163
|
-
this.updateViewOptions();
|
|
164
|
-
}
|
|
165
|
-
updateViewOptions() {
|
|
166
|
-
if (this.viewOptions) {
|
|
167
|
-
const options = this.viewOptions.split(",").map((opt) => opt.trim());
|
|
168
|
-
this._viewOptions = options.filter((opt) => TestView.DEFAULT_VIEW_OPTIONS.includes(opt));
|
|
169
|
-
} else {
|
|
170
|
-
this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
render() {
|
|
174
|
-
return html`
|
|
175
|
-
<label part="label" for="viewSelect">${this.label}</label>
|
|
176
|
-
<select
|
|
177
|
-
part="select"
|
|
178
|
-
id="viewSelect"
|
|
179
|
-
.disabled=${this.disabled}
|
|
180
|
-
@change=${(e) => {
|
|
181
|
-
const el = e.target;
|
|
182
|
-
this._switchView(el.value);
|
|
183
|
-
}}
|
|
184
|
-
>
|
|
185
|
-
${this._viewOptions.map((v) => html`<option value="${v}" ?selected=${v === this.view}>${v}</option>`)}
|
|
186
|
-
</select>
|
|
187
|
-
`;
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
TestView.DEFAULT_VIEW_OPTIONS = ["author", "candidate", "proctor", "scorer", "testConstructor", "tutor"];
|
|
191
|
-
__decorateClass([
|
|
192
|
-
property2({ type: String })
|
|
193
|
-
], TestView.prototype, "label", 2);
|
|
194
|
-
__decorateClass([
|
|
195
|
-
property2({ type: String, attribute: "view-options" })
|
|
196
|
-
], TestView.prototype, "viewOptions", 2);
|
|
197
|
-
__decorateClass([
|
|
198
|
-
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
199
|
-
], TestView.prototype, "_handleViewOptionsChange", 2);
|
|
200
|
-
__decorateClass([
|
|
201
|
-
state2()
|
|
202
|
-
], TestView.prototype, "_viewOptions", 2);
|
|
203
|
-
TestView = __decorateClass([
|
|
204
|
-
customElement("test-view")
|
|
205
|
-
], TestView);
|
|
1
|
+
import {
|
|
2
|
+
TestView
|
|
3
|
+
} from "../../chunk-3TFUBCJW.js";
|
|
4
|
+
import "../../chunk-ANLIJZBL.js";
|
|
5
|
+
import "../../chunk-F3NTI6TX.js";
|
|
6
|
+
import "../../chunk-4YG2FPKK.js";
|
|
7
|
+
import "../../chunk-44VE5POH.js";
|
|
206
8
|
export {
|
|
207
9
|
TestView
|
|
208
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/qti-test/components/test-view.ts","../../../src/lib/qti-test/components/test-component.abstract.ts","../../../src/lib/decorators/watch.ts","../../../src/lib/decorators/prop-internal-state.ts","../../../src/lib/qti-test/context/test.context.ts"],"sourcesContent":["import { html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { TestComponent } from './test-component.abstract';\nimport { watch } from '../../decorators/watch';\n\n@customElement('test-view')\nexport class TestView extends TestComponent {\n static DEFAULT_VIEW_OPTIONS = ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor'];\n\n /** label accompanying the select view dropdown */\n @property({ type: String })\n label = 'view';\n\n /** The options to display in the dropdown, default: ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor'] */\n @property({ type: String, attribute: 'view-options' }) viewOptions;\n @watch('viewOptions', { waitUntilFirstUpdate: true })\n protected _handleViewOptionsChange = () => {\n this.updateViewOptions();\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n this.updateViewOptions();\n }\n\n @state()\n private _viewOptions: string[] = TestView.DEFAULT_VIEW_OPTIONS;\n\n private updateViewOptions() {\n if (this.viewOptions) {\n const options = this.viewOptions.split(',').map(opt => opt.trim());\n this._viewOptions = options.filter(opt => TestView.DEFAULT_VIEW_OPTIONS.includes(opt));\n } else {\n this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;\n }\n }\n\n render() {\n return html`\n <label part=\"label\" for=\"viewSelect\">${this.label}</label>\n <select\n part=\"select\"\n id=\"viewSelect\"\n .disabled=${this.disabled}\n @change=${(e: Event) => {\n const el = e.target as HTMLSelectElement;\n this._switchView(el.value);\n }}\n >\n ${this._viewOptions.map(v => html`<option value=\"${v}\" ?selected=${v === this.view}>${v}</option>`)}\n </select>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-view': TestView;\n }\n}\n","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 type { LitElement } from 'lit';\n\ntype UpdateHandler = (prev?: unknown, next?: unknown) => void;\n\ntype NonUndefined<A> = A extends undefined ? never : A;\n\nexport type UpdateHandlerFunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends UpdateHandler ? K : never;\n}[keyof T];\n\ninterface WatchOptions {\n /**\n * If true, will only start watching after the initial update/render\n */\n waitUntilFirstUpdate?: boolean;\n}\n\n/**\n * Runs when observed properties change, e.g. @property or @state, but before the component updates. To wait for an\n * update to complete after a change occurs, use `await this.updateComplete` in the handler. To start watching after the\n * initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n *\n * Usage:\n *\n * @watch('propName')\n * handlePropChange(oldValue, newValue) {\n * ...\n * }\n */\nexport function watch(propertyName: string | string[], options?: WatchOptions) {\n const resolvedOptions: Required<WatchOptions> = {\n waitUntilFirstUpdate: false,\n ...options\n };\n return <ElemClass extends LitElement>(\n proto: ElemClass,\n decoratedFnName: UpdateHandlerFunctionKeys<ElemClass> | any\n ) => {\n // @ts-expect-error - update is a protected property\n const { update } = proto;\n const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];\n\n // @ts-expect-error - update is a protected property\n proto.update = function (this: ElemClass, changedProps: Map<keyof ElemClass, ElemClass[keyof ElemClass]>) {\n watchedProperties.forEach(property => {\n const key = property as keyof ElemClass;\n if (changedProps.has(key)) {\n const oldValue = changedProps.get(key);\n const newValue = this[key];\n\n if (oldValue !== newValue) {\n if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {\n (this[decoratedFnName] as unknown as UpdateHandler)(oldValue, newValue);\n }\n }\n }\n });\n\n update.call(this, changedProps);\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","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,YAAY;AACrB,SAAS,eAAe,YAAAA,WAAU,SAAAC,cAAa;;;ACD/C,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;;;AC2Bf,SAAS,MAAM,cAAiC,SAAwB;AAC7E,QAAM,kBAA0C;AAAA,IAC9C,sBAAsB;AAAA,IACtB,GAAG;AAAA,EACL;AACA,SAAO,CACL,OACA,oBACG;AAEH,UAAM,EAAE,OAAO,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AAAA,GAR1C,SAQ4C;AAE7C;AAAA,EADT,MAAM,eAAe,EAAE,sBAAsB,KAAK,CAAC;AAAA,GATzC,SAUD;AAUF;AAAA,EADPC,OAAM;AAAA,GAnBI,SAoBH;AApBG,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":["property","state","property","property","state"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as lit_html from 'lit-html';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { T as TestContext, d as TestElement } from '../../test.context-DbSTxKk_.js';
|
|
4
|
+
export { Q as QtiAssessmentItemRef, a as QtiAssessmentSection, b as QtiAssessmentTest, c as QtiTestPart, t as testContext, e as testElement } from '../../test.context-DbSTxKk_.js';
|
|
5
|
+
import '../../qti-simple-choice-DxWcdKHi.js';
|
|
6
|
+
import 'lit-html/directives/ref.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `<test-container>` is a custom element designed for hosting the qti-assessment-item.
|
|
10
|
+
* The `qti-assessment-test` will be placed inside the shadow DOM of this element.
|
|
11
|
+
* The element loads the test from the provided URL and renders it inside the shadow DOM.
|
|
12
|
+
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <qti-test>
|
|
15
|
+
* <test-container class="m-4 bg-white" test-url="./path/to/assessmenttest.xml"></test-container>
|
|
16
|
+
* </qti-test>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare class TestContainer extends LitElement {
|
|
20
|
+
/** URL of the item to load */
|
|
21
|
+
testURL: string;
|
|
22
|
+
/** A parsed HTML document */
|
|
23
|
+
testDoc: DocumentFragment;
|
|
24
|
+
/** The raw XML string */
|
|
25
|
+
testXML: string;
|
|
26
|
+
/** Template content if provided */
|
|
27
|
+
private templateContent;
|
|
28
|
+
protected handleTestURLChange(): Promise<void>;
|
|
29
|
+
protected handleTestXMLChange(): void;
|
|
30
|
+
connectedCallback(): Promise<void>;
|
|
31
|
+
private initializeTemplateContent;
|
|
32
|
+
private applyStyles;
|
|
33
|
+
render(): lit_html.TemplateResult<1>;
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface HTMLElementTagNameMap {
|
|
37
|
+
'test-container': TestContainer;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare abstract class TestBase extends LitElement {
|
|
42
|
+
protected _testContext: Readonly<TestContext>;
|
|
43
|
+
protected testElement: TestElement;
|
|
44
|
+
constructor();
|
|
45
|
+
get context(): TestContext;
|
|
46
|
+
set context(testContext: TestContext);
|
|
47
|
+
private _updateItemVariablesInTestContext;
|
|
48
|
+
/**
|
|
49
|
+
* Updates the variables of an assessment item in the test context.
|
|
50
|
+
* - Matches the assessment item with the corresponding test context item.
|
|
51
|
+
* - If the item is not found, logs a warning.
|
|
52
|
+
* - Updates variables in the test context if exactly one variable exists.
|
|
53
|
+
* - Otherwise, syncs the assessment item's variables with the test context.
|
|
54
|
+
*
|
|
55
|
+
* @param assessmentItem - The assessment item to update.
|
|
56
|
+
*/
|
|
57
|
+
private _updateItemInTestContext;
|
|
58
|
+
connectedCallback(): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare const QtiTest_base: (abstract new (...args: any[]) => {}) & (abstract new (...args: any[]) => {}) & (abstract new (...args: any[]) => {}) & typeof TestBase;
|
|
62
|
+
/**
|
|
63
|
+
* `<qti-test>` is a custom element designed for rendering and interacting with QTI (Question and Test Interoperability) tests.
|
|
64
|
+
*
|
|
65
|
+
* This component leverages several mixins to provide functionality for loading, navigating, processing, and displaying QTI test assessments.
|
|
66
|
+
*
|
|
67
|
+
* ### Example Usage
|
|
68
|
+
*
|
|
69
|
+
* Minimal example including navigation:
|
|
70
|
+
*
|
|
71
|
+
* ```html
|
|
72
|
+
* <qti-test>
|
|
73
|
+
* <test-container test-url="./path/to/assessment.xml"></test-container>
|
|
74
|
+
* <nav class="flex">
|
|
75
|
+
* <test-prev></test-prev>
|
|
76
|
+
* <test-next></test-next>
|
|
77
|
+
* </nav>
|
|
78
|
+
* </qti-test>
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* Use the following file structure
|
|
82
|
+
* A qti-test loads a QTI3.0 assessmenttest.xml file from a package folder.
|
|
83
|
+
*
|
|
84
|
+
* ```plaintext
|
|
85
|
+
* Root/
|
|
86
|
+
* ├── index.html
|
|
87
|
+
* └── /assets/api/examples/
|
|
88
|
+
* ├── assessmenttest.xml
|
|
89
|
+
* └── imsmanifest.xml
|
|
90
|
+
*
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* ### Test components
|
|
94
|
+
*
|
|
95
|
+
* Use test components inside the qti-test component for added functionality.
|
|
96
|
+
* ### Test next
|
|
97
|
+
* `<test-next> | TestNext`
|
|
98
|
+
*
|
|
99
|
+
* ### Test prev
|
|
100
|
+
*
|
|
101
|
+
* `<test-prev> | TestPrev`
|
|
102
|
+
* ### Test components
|
|
103
|
+
*
|
|
104
|
+
* You can use normal class names to style the elements.
|
|
105
|
+
* And you can use the `test-prev` and `test-next` elements to navigate through the test.
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
declare class QtiTest extends QtiTest_base {
|
|
109
|
+
/**
|
|
110
|
+
* Renders the component's template.
|
|
111
|
+
* Provides a default `<slot>` for content projection.
|
|
112
|
+
*/
|
|
113
|
+
render(): lit_html.TemplateResult<1>;
|
|
114
|
+
}
|
|
115
|
+
declare global {
|
|
116
|
+
interface HTMLElementTagNameMap {
|
|
117
|
+
'qti-test': QtiTest;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { QtiTest, TestContainer, TestContext, TestElement };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QtiAssessmentItemRef,
|
|
3
|
+
QtiAssessmentSection,
|
|
4
|
+
QtiAssessmentTest,
|
|
5
|
+
QtiTest,
|
|
6
|
+
QtiTestPart,
|
|
7
|
+
TestContainer
|
|
8
|
+
} from "../../chunk-CNQYM52B.js";
|
|
9
|
+
import "../../chunk-2CHF3TMY.js";
|
|
10
|
+
import "../../chunk-2OA7E3E7.js";
|
|
11
|
+
import {
|
|
12
|
+
testContext,
|
|
13
|
+
testElement
|
|
14
|
+
} from "../../chunk-F3NTI6TX.js";
|
|
15
|
+
import "../../chunk-4YG2FPKK.js";
|
|
16
|
+
import "../../chunk-44VE5POH.js";
|
|
17
|
+
export {
|
|
18
|
+
QtiAssessmentItemRef,
|
|
19
|
+
QtiAssessmentSection,
|
|
20
|
+
QtiAssessmentTest,
|
|
21
|
+
QtiTest,
|
|
22
|
+
QtiTestPart,
|
|
23
|
+
TestContainer,
|
|
24
|
+
testContext,
|
|
25
|
+
testElement
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,290 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<xsl:apply-templates select="@*|node()"/>
|
|
8
|
-
</xsl:copy>
|
|
9
|
-
</xsl:template>
|
|
10
|
-
|
|
11
|
-
<!-- remove existing namespaces -->
|
|
12
|
-
<xsl:template match="*">
|
|
13
|
-
<!-- remove element prefix -->
|
|
14
|
-
<xsl:element name="{local-name()}">
|
|
15
|
-
<!-- process attributes -->
|
|
16
|
-
<xsl:for-each select="@*">
|
|
17
|
-
<!-- remove attribute prefix -->
|
|
18
|
-
<xsl:attribute name="{local-name()}">
|
|
19
|
-
<xsl:value-of select="."/>
|
|
20
|
-
</xsl:attribute>
|
|
21
|
-
</xsl:for-each>
|
|
22
|
-
<xsl:apply-templates/>
|
|
23
|
-
</xsl:element>
|
|
24
|
-
</xsl:template>
|
|
25
|
-
</xsl:stylesheet>`;
|
|
26
|
-
function extendElementName(xmlFragment, tagName, extension) {
|
|
27
|
-
xmlFragment.querySelectorAll(tagName).forEach((element) => {
|
|
28
|
-
const newTagName = `${tagName}-${extension}`;
|
|
29
|
-
const newElement = createElementWithNewTagName(element, newTagName);
|
|
30
|
-
element.replaceWith(newElement);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
function extendElementsWithClass(xmlFragment, classNamePattern) {
|
|
34
|
-
xmlFragment.querySelectorAll("*").forEach((element) => {
|
|
35
|
-
const classList = element.classList;
|
|
36
|
-
if (classList) {
|
|
37
|
-
classList.forEach((className) => {
|
|
38
|
-
if (className.startsWith(`${classNamePattern}:`)) {
|
|
39
|
-
const suffix = className.slice(`${classNamePattern}:`.length);
|
|
40
|
-
const newTagName = `${element.nodeName}-${suffix}`;
|
|
41
|
-
const newElement = createElementWithNewTagName(element, newTagName);
|
|
42
|
-
element.replaceWith(newElement);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function createElementWithNewTagName(element, newTagName) {
|
|
49
|
-
const newElement = document.createElement(newTagName);
|
|
50
|
-
for (const attr of element.attributes) {
|
|
51
|
-
newElement.setAttribute(attr.name, attr.value);
|
|
52
|
-
}
|
|
53
|
-
while (element.firstChild) {
|
|
54
|
-
newElement.appendChild(element.firstChild);
|
|
55
|
-
}
|
|
56
|
-
return newElement;
|
|
57
|
-
}
|
|
58
|
-
function itemsFromTest(xmlFragment) {
|
|
59
|
-
const items = [];
|
|
60
|
-
xmlFragment.querySelectorAll("qti-assessment-item-ref").forEach((el) => {
|
|
61
|
-
const identifier = el.getAttribute("identifier");
|
|
62
|
-
const href = el.getAttribute("href");
|
|
63
|
-
const category = el.getAttribute("category");
|
|
64
|
-
items.push({ identifier, href, category });
|
|
65
|
-
});
|
|
66
|
-
return items;
|
|
67
|
-
}
|
|
68
|
-
var currentRequest = null;
|
|
69
|
-
function loadXML(url, cancelPreviousRequest = false) {
|
|
70
|
-
if (cancelPreviousRequest && currentRequest !== null) {
|
|
71
|
-
currentRequest.abort();
|
|
72
|
-
}
|
|
73
|
-
return new Promise((resolve, reject) => {
|
|
74
|
-
const xhr = new XMLHttpRequest();
|
|
75
|
-
currentRequest = xhr;
|
|
76
|
-
xhr.open("GET", url, true);
|
|
77
|
-
xhr.responseType = "document";
|
|
78
|
-
xhr.onload = () => {
|
|
79
|
-
if (xhr.status >= 200 && xhr.status < 300) {
|
|
80
|
-
resolve(xhr.responseXML);
|
|
81
|
-
} else {
|
|
82
|
-
reject(xhr.statusText);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
xhr.onerror = () => {
|
|
86
|
-
reject(xhr.statusText);
|
|
87
|
-
};
|
|
88
|
-
xhr.send();
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
function parseXML(xmlDocument) {
|
|
92
|
-
const parser = new DOMParser();
|
|
93
|
-
const xmlFragment = parser.parseFromString(xmlDocument, "text/xml");
|
|
94
|
-
return xmlFragment;
|
|
95
|
-
}
|
|
96
|
-
function toHTML(xmlFragment) {
|
|
97
|
-
const processor = new XSLTProcessor();
|
|
98
|
-
const xsltDocument = new DOMParser().parseFromString(xmlToHTML, "text/xml");
|
|
99
|
-
processor.importStylesheet(xsltDocument);
|
|
100
|
-
const itemHTMLFragment = processor.transformToFragment(xmlFragment, document);
|
|
101
|
-
return itemHTMLFragment;
|
|
102
|
-
}
|
|
103
|
-
function setLocation(xmlFragment, location) {
|
|
104
|
-
if (!location.endsWith("/")) {
|
|
105
|
-
location += "/";
|
|
106
|
-
}
|
|
107
|
-
xmlFragment.querySelectorAll("[src],[href],[primary-path]").forEach((elWithSrc) => {
|
|
108
|
-
let attr = "";
|
|
109
|
-
if (elWithSrc.getAttribute("src")) {
|
|
110
|
-
attr = "src";
|
|
111
|
-
}
|
|
112
|
-
if (elWithSrc.getAttribute("href")) {
|
|
113
|
-
attr = "href";
|
|
114
|
-
}
|
|
115
|
-
if (elWithSrc.getAttribute("primary-path")) {
|
|
116
|
-
attr = "primary-path";
|
|
117
|
-
}
|
|
118
|
-
const attrValue = elWithSrc.getAttribute(attr)?.trim();
|
|
119
|
-
if (!attrValue.startsWith("data:") && !attrValue.startsWith("http")) {
|
|
120
|
-
const newSrcValue = location + encodeURI(attrValue);
|
|
121
|
-
elWithSrc.setAttribute(attr, newSrcValue);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function convertCDATAtoComment(xmlFragment) {
|
|
126
|
-
const cdataElements = xmlFragment.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value');
|
|
127
|
-
cdataElements.forEach((element) => {
|
|
128
|
-
const commentText = document.createComment(element.textContent);
|
|
129
|
-
element.replaceChild(commentText, element.firstChild);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function stripStyleSheets(xmlFragment) {
|
|
133
|
-
xmlFragment.querySelectorAll("qti-stylesheet").forEach((stylesheet) => stylesheet.remove());
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// src/lib/qti-transformers/qti-transform-item.ts
|
|
137
|
-
var qtiTransformItem = () => {
|
|
138
|
-
let xmlFragment;
|
|
139
|
-
const api = {
|
|
140
|
-
async load(uri, cancelPreviousRequest = false) {
|
|
141
|
-
return new Promise((resolve) => {
|
|
142
|
-
loadXML(uri, cancelPreviousRequest).then((xml2) => {
|
|
143
|
-
xmlFragment = xml2;
|
|
144
|
-
api.path(uri.substring(0, uri.lastIndexOf("/")));
|
|
145
|
-
return resolve(api);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
parse(xmlString) {
|
|
150
|
-
xmlFragment = parseXML(xmlString);
|
|
151
|
-
return api;
|
|
152
|
-
},
|
|
153
|
-
path: (location) => {
|
|
154
|
-
setLocation(xmlFragment, location);
|
|
155
|
-
return api;
|
|
156
|
-
},
|
|
157
|
-
fn(fn) {
|
|
158
|
-
fn(xmlFragment);
|
|
159
|
-
return api;
|
|
160
|
-
},
|
|
161
|
-
pciHooks(uri) {
|
|
162
|
-
const attributes = ["hook", "module"];
|
|
163
|
-
const documentPath = uri.substring(0, uri.lastIndexOf("/"));
|
|
164
|
-
for (const attribute of attributes) {
|
|
165
|
-
const srcAttributes = xmlFragment.querySelectorAll("[" + attribute + "]");
|
|
166
|
-
srcAttributes.forEach((node) => {
|
|
167
|
-
const srcValue = node.getAttribute(attribute);
|
|
168
|
-
if (!srcValue.startsWith("data:") && !srcValue.startsWith("http")) {
|
|
169
|
-
node.setAttribute("base-url", uri);
|
|
170
|
-
node.setAttribute(
|
|
171
|
-
"module",
|
|
172
|
-
documentPath + "/" + encodeURI(srcValue + (srcValue.endsWith(".js") ? "" : ".js"))
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
return api;
|
|
178
|
-
},
|
|
179
|
-
extendElementName: (tagName, extension) => {
|
|
180
|
-
extendElementName(xmlFragment, tagName, extension);
|
|
181
|
-
return api;
|
|
182
|
-
},
|
|
183
|
-
extendElementsWithClass: (param = "extend") => {
|
|
184
|
-
extendElementsWithClass(xmlFragment, param);
|
|
185
|
-
return api;
|
|
186
|
-
},
|
|
187
|
-
customInteraction(baseRef, baseItem) {
|
|
188
|
-
const qtiCustomInteraction = xmlFragment.querySelector("qti-custom-interaction");
|
|
189
|
-
const qtiCustomInteractionObject = qtiCustomInteraction.querySelector("object");
|
|
190
|
-
qtiCustomInteraction.setAttribute("data-base-ref", baseRef);
|
|
191
|
-
qtiCustomInteraction.setAttribute("data-base-item", baseRef + baseItem);
|
|
192
|
-
qtiCustomInteraction.setAttribute("data", qtiCustomInteractionObject.getAttribute("data"));
|
|
193
|
-
qtiCustomInteraction.setAttribute("width", qtiCustomInteractionObject.getAttribute("width"));
|
|
194
|
-
qtiCustomInteraction.setAttribute("height", qtiCustomInteractionObject.getAttribute("height"));
|
|
195
|
-
qtiCustomInteraction.removeChild(qtiCustomInteractionObject);
|
|
196
|
-
return api;
|
|
197
|
-
},
|
|
198
|
-
convertCDATAtoComment() {
|
|
199
|
-
convertCDATAtoComment(xmlFragment);
|
|
200
|
-
return api;
|
|
201
|
-
},
|
|
202
|
-
stripStyleSheets() {
|
|
203
|
-
stripStyleSheets(xmlFragment);
|
|
204
|
-
return api;
|
|
205
|
-
},
|
|
206
|
-
html() {
|
|
207
|
-
return new XMLSerializer().serializeToString(toHTML(xmlFragment));
|
|
208
|
-
},
|
|
209
|
-
xml() {
|
|
210
|
-
return new XMLSerializer().serializeToString(xmlFragment);
|
|
211
|
-
},
|
|
212
|
-
htmlDoc() {
|
|
213
|
-
return toHTML(xmlFragment);
|
|
214
|
-
},
|
|
215
|
-
xmlDoc() {
|
|
216
|
-
return xmlFragment;
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
return api;
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
// src/lib/qti-transformers/qti-transform-manifest.ts
|
|
223
|
-
var qtiTransformManifest = () => {
|
|
224
|
-
let xmlFragment;
|
|
225
|
-
const api = {
|
|
226
|
-
async load(uri) {
|
|
227
|
-
return new Promise((resolve) => {
|
|
228
|
-
loadXML(uri).then((xml2) => {
|
|
229
|
-
xmlFragment = xml2;
|
|
230
|
-
return resolve(api);
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
},
|
|
234
|
-
parse(xmlString) {
|
|
235
|
-
xmlFragment = parseXML(xmlString);
|
|
236
|
-
},
|
|
237
|
-
assessmentTest() {
|
|
238
|
-
const el = xmlFragment.querySelector('resource[type="imsqti_test_xmlv3p0"]');
|
|
239
|
-
return { href: el.getAttribute("href"), identifier: el.getAttribute("identifier") };
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
return api;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// src/lib/qti-transformers/qti-transform-test.ts
|
|
246
|
-
var qtiTransformTest = () => {
|
|
247
|
-
let xmlFragment;
|
|
248
|
-
const api = {
|
|
249
|
-
async load(uri) {
|
|
250
|
-
return new Promise((resolve, _) => {
|
|
251
|
-
loadXML(uri).then((xml2) => {
|
|
252
|
-
xmlFragment = xml2;
|
|
253
|
-
api.path(uri.substring(0, uri.lastIndexOf("/")));
|
|
254
|
-
return resolve(api);
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
},
|
|
258
|
-
parse(xmlString) {
|
|
259
|
-
xmlFragment = parseXML(xmlString);
|
|
260
|
-
return api;
|
|
261
|
-
},
|
|
262
|
-
path: (location) => {
|
|
263
|
-
setLocation(xmlFragment, location);
|
|
264
|
-
return api;
|
|
265
|
-
},
|
|
266
|
-
fn(fn) {
|
|
267
|
-
fn(xmlFragment);
|
|
268
|
-
return api;
|
|
269
|
-
},
|
|
270
|
-
items() {
|
|
271
|
-
return itemsFromTest(xmlFragment);
|
|
272
|
-
},
|
|
273
|
-
html() {
|
|
274
|
-
return new XMLSerializer().serializeToString(toHTML(xmlFragment));
|
|
275
|
-
},
|
|
276
|
-
xml() {
|
|
277
|
-
return new XMLSerializer().serializeToString(xmlFragment);
|
|
278
|
-
},
|
|
279
|
-
htmlDoc() {
|
|
280
|
-
return toHTML(xmlFragment);
|
|
281
|
-
},
|
|
282
|
-
xmlDoc() {
|
|
283
|
-
return xmlFragment;
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
return api;
|
|
287
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
qtiTransformItem,
|
|
3
|
+
qtiTransformManifest,
|
|
4
|
+
qtiTransformTest
|
|
5
|
+
} from "../chunk-2OA7E3E7.js";
|
|
6
|
+
import "../chunk-44VE5POH.js";
|
|
288
7
|
export {
|
|
289
8
|
qtiTransformItem,
|
|
290
9
|
qtiTransformManifest,
|