@citolab/qti-components 7.0.6-beta.0 → 7.0.6-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/{chunk-QGKK4T2J.js → chunks/chunk-3V6LA7B3.js} +1 -1
- package/cdn/chunks/chunk-4UJBK6JO.js +1 -0
- package/cdn/chunks/chunk-4WXQYE2P.js +8 -0
- package/cdn/{chunk-L4TDHAKL.js → chunks/chunk-5BR5CJFH.js} +5 -5
- package/cdn/chunks/chunk-5GCSZ3CH.js +73 -0
- package/cdn/{chunk-BLKKKK6C.js → chunks/chunk-5P7CTN7Q.js} +1 -1
- package/cdn/{chunk-A536ZOJJ.js → chunks/chunk-6S4CDN3T.js} +1 -1
- package/cdn/chunks/chunk-7XYBFL7U.js +934 -0
- package/cdn/chunks/chunk-DZCKF45D.js +5 -0
- package/cdn/chunks/chunk-EHK76KRT.js +1 -0
- package/cdn/chunks/chunk-IAP2CEE7.js +1 -0
- package/cdn/chunks/chunk-IMJOPCFR.js +1 -0
- package/cdn/chunks/chunk-KWPDTFYH.js +1 -0
- package/cdn/{chunk-MFWSHIPH.js → chunks/chunk-L4CUWIE6.js} +1 -1
- package/cdn/{chunk-4DFVJE2A.js → chunks/chunk-LZZB4VGC.js} +1 -1
- package/cdn/{chunk-SQDSHH6N.js → chunks/chunk-MJMONWKB.js} +1 -1
- package/cdn/chunks/chunk-N5OHGRGG.js +8 -0
- package/cdn/chunks/chunk-NDHSIO2G.js +8 -0
- package/cdn/{chunk-ROXN2HIJ.js → chunks/chunk-PKT2SJQD.js} +1 -1
- package/cdn/chunks/chunk-QQCGUVEV.js +1 -0
- package/cdn/chunks/chunk-QV6I5NVQ.js +8 -0
- package/cdn/chunks/chunk-R33OODNX.js +1 -0
- package/cdn/chunks/chunk-RXKI3AO4.js +1 -0
- package/cdn/chunks/chunk-TQBDBMWL.js +5 -0
- package/cdn/chunks/chunk-X2KBNXRO.js +6 -0
- package/cdn/chunks/chunk-XUJ7TXHW.js +1 -0
- package/cdn/exports/expression-result.js +0 -0
- package/cdn/exports/interaction.interface.js +0 -0
- package/cdn/exports/interaction.js +1 -0
- package/cdn/exports/item.context.js +1 -0
- package/cdn/exports/qti-assessment-item.context.js +1 -0
- package/cdn/exports/qti-condition-expression.js +1 -0
- package/cdn/exports/qti-expression.js +1 -0
- package/cdn/exports/variables.js +0 -0
- package/cdn/index.global.js +7 -58
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-item/core/index.js +1 -1
- package/cdn/qti-loader/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/styles.js +1 -1
- package/cdn/qti-test/components/test-component.abstract.js +1 -1
- package/cdn/qti-test/components/test-item-link.js +1 -1
- package/cdn/qti-test/components/test-next.js +1 -1
- package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -1
- package/cdn/qti-test/components/test-prev.js +1 -1
- package/cdn/qti-test/components/test-view.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/cdn/qti-transformers/index.js +1 -1
- package/dist/{chunk-ANLIJZBL.js → chunks/chunk-3EU75IUF.js} +4 -4
- package/dist/chunks/chunk-3EU75IUF.js.map +1 -0
- package/dist/{chunk-CNQYM52B.js → chunks/chunk-4GNVYCBN.js} +65 -7
- package/dist/chunks/chunk-4GNVYCBN.js.map +1 -0
- package/dist/{chunk-UB5K44DB.js → chunks/chunk-4O5F7WV7.js} +1 -1
- package/dist/chunks/chunk-4O5F7WV7.js.map +1 -0
- package/dist/{chunk-OO6JSYLP.js → chunks/chunk-6JXR63MH.js} +4 -4
- package/dist/chunks/chunk-6JXR63MH.js.map +1 -0
- package/dist/{chunk-4FH7P7YI.js → chunks/chunk-7QMCKYDR.js} +4 -4
- package/dist/chunks/chunk-7QMCKYDR.js.map +1 -0
- package/dist/{chunk-3TFUBCJW.js → chunks/chunk-A24F75DB.js} +4 -4
- package/dist/chunks/chunk-A24F75DB.js.map +1 -0
- package/dist/chunks/chunk-BPHQLJWE.js +102 -0
- package/dist/chunks/chunk-BPHQLJWE.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-DLUJN2FW.js +22 -0
- package/dist/chunks/chunk-DLUJN2FW.js.map +1 -0
- package/dist/{chunk-4YG2FPKK.js → chunks/chunk-ELDMXTUQ.js} +1 -1
- package/dist/chunks/chunk-ELDMXTUQ.js.map +1 -0
- package/dist/chunks/chunk-FV7HWK54.js +29 -0
- package/dist/chunks/chunk-FV7HWK54.js.map +1 -0
- package/dist/{chunk-6SG3NMKU.js → chunks/chunk-GSWZT6N2.js} +4 -4
- package/dist/chunks/chunk-GSWZT6N2.js.map +1 -0
- package/dist/chunks/chunk-H2JE6IVU.js +15 -0
- package/dist/{chunk-QYN5S4EM.js → chunks/chunk-HHVRU3AJ.js} +5 -5
- package/dist/chunks/chunk-HHVRU3AJ.js.map +1 -0
- package/dist/{chunk-2CHF3TMY.js → chunks/chunk-J2SHENRN.js} +1 -1
- package/dist/{chunk-UBZPSVSE.js → chunks/chunk-K6ATVWMP.js} +5131 -5341
- package/dist/chunks/chunk-K6ATVWMP.js.map +1 -0
- package/dist/chunks/chunk-KOEILLVS.js +8 -0
- package/dist/chunks/chunk-KOEILLVS.js.map +1 -0
- package/dist/{chunk-F7HTXGGH.js → chunks/chunk-KYAIMBP5.js} +3 -3
- package/dist/chunks/chunk-KYAIMBP5.js.map +1 -0
- package/dist/{chunk-F3NTI6TX.js → chunks/chunk-UFYWCLXF.js} +1 -1
- package/dist/chunks/chunk-UFYWCLXF.js.map +1 -0
- package/dist/chunks/chunk-UN2IFSGC.js +1 -0
- package/dist/{chunk-2OA7E3E7.js → chunks/chunk-XDMSEAYC.js} +1 -1
- package/dist/chunks/chunk-XDMSEAYC.js.map +1 -0
- package/dist/chunks/chunk-XSI6FXGD.js +19 -0
- package/dist/chunks/chunk-XSI6FXGD.js.map +1 -0
- package/dist/chunks/chunk-ZPNJ2HP5.js +71 -0
- package/dist/chunks/chunk-ZPNJ2HP5.js.map +1 -0
- package/dist/exports/expression-result.d.ts +19 -0
- package/dist/exports/expression-result.js +1 -0
- package/dist/exports/expression-result.js.map +1 -0
- package/dist/exports/interaction.d.ts +23 -0
- package/dist/exports/interaction.interface.d.ts +13 -0
- package/dist/exports/interaction.interface.js +1 -0
- package/dist/exports/interaction.interface.js.map +1 -0
- package/dist/exports/interaction.js +8 -0
- package/dist/exports/interaction.js.map +1 -0
- package/dist/exports/item.context.d.ts +12 -0
- package/dist/exports/item.context.js +8 -0
- package/dist/exports/item.context.js.map +1 -0
- package/dist/exports/qti-assessment-item.context.d.ts +10 -0
- package/dist/exports/qti-assessment-item.context.js +8 -0
- package/dist/exports/qti-assessment-item.context.js.map +1 -0
- package/dist/exports/qti-condition-expression.d.ts +13 -0
- package/dist/exports/qti-condition-expression.js +10 -0
- package/dist/exports/qti-condition-expression.js.map +1 -0
- package/dist/exports/qti-expression.d.ts +21 -0
- package/dist/exports/qti-expression.js +9 -0
- package/dist/exports/qti-expression.js.map +1 -0
- package/dist/exports/variables.d.ts +3 -0
- package/dist/exports/variables.js +1 -0
- package/dist/exports/variables.js.map +1 -0
- package/dist/index.d.ts +12 -3
- package/dist/index.js +35 -28
- package/dist/qti-components/index.d.ts +36 -9
- package/dist/qti-components/index.js +10 -16
- package/dist/qti-components-jsx.d.ts +328 -623
- package/dist/qti-item/core/index.js +5 -5
- package/dist/qti-loader/index.d.ts +7 -1
- package/dist/qti-loader/index.js +5 -23
- package/dist/qti-loader/index.js.map +1 -1
- package/dist/{qti-simple-choice-DxWcdKHi.d.ts → qti-response-declaration-DAeBp8HH.d.ts} +463 -613
- package/dist/qti-test/components/index.d.ts +8 -2
- package/dist/qti-test/components/index.js +12 -11
- package/dist/qti-test/components/styles.js +2 -2
- package/dist/qti-test/components/test-component.abstract.d.ts +8 -2
- package/dist/qti-test/components/test-component.abstract.js +5 -4
- package/dist/qti-test/components/test-item-link.d.ts +8 -2
- package/dist/qti-test/components/test-item-link.js +7 -6
- package/dist/qti-test/components/test-next.d.ts +8 -2
- package/dist/qti-test/components/test-next.js +7 -6
- package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +8 -2
- package/dist/qti-test/components/test-paging-buttons-stamp.js +6 -5
- package/dist/qti-test/components/test-prev.d.ts +8 -2
- package/dist/qti-test/components/test-prev.js +7 -6
- package/dist/qti-test/components/test-view.d.ts +8 -2
- package/dist/qti-test/components/test-view.js +6 -5
- package/dist/qti-test/core/index.d.ts +15 -4
- package/dist/qti-test/core/index.js +6 -6
- package/dist/qti-transformers/index.js +2 -2
- package/dist/{test.context-DbSTxKk_.d.ts → test.context-CaENAJNk.d.ts} +4 -2
- package/dist/variables-cO3DzqJy.d.ts +33 -0
- package/dist/vscode.html-custom-data.json +208 -275
- package/package.json +14 -20
- package/cdn/chunk-4I75QSIL.js +0 -8
- package/cdn/chunk-5WCOPF7O.js +0 -73
- package/cdn/chunk-DC2R556M.js +0 -5
- package/cdn/chunk-GALSGMIP.js +0 -5
- package/cdn/chunk-KYOTSBCX.js +0 -1
- package/cdn/chunk-T4A5AZCI.js +0 -939
- package/cdn/chunk-VI2WKTN4.js +0 -1
- package/cdn/qti-components/index.global.js +0 -226
- package/cdn/qti-item/core/index.global.js +0 -149
- package/cdn/qti-loader/index.global.js +0 -1
- package/cdn/qti-test/components/index.global.js +0 -207
- package/cdn/qti-test/components/styles.global.js +0 -44
- package/cdn/qti-test/components/test-component.abstract.global.js +0 -170
- package/cdn/qti-test/components/test-item-link.global.js +0 -170
- package/cdn/qti-test/components/test-next.global.js +0 -170
- package/cdn/qti-test/components/test-next.spec.css +0 -1
- package/cdn/qti-test/components/test-next.spec.global.js +0 -64
- package/cdn/qti-test/components/test-next.spec.js +0 -713
- package/cdn/qti-test/components/test-paging-buttons-stamp.global.js +0 -207
- package/cdn/qti-test/components/test-prev.global.js +0 -170
- package/cdn/qti-test/components/test-view.global.js +0 -170
- package/cdn/qti-test/core/index.global.js +0 -205
- package/cdn/qti-transformers/index.global.js +0 -1
- package/dist/chunk-2OA7E3E7.js.map +0 -1
- package/dist/chunk-3TFUBCJW.js.map +0 -1
- package/dist/chunk-44VE5POH.js +0 -55
- package/dist/chunk-4FH7P7YI.js.map +0 -1
- package/dist/chunk-4YG2FPKK.js.map +0 -1
- package/dist/chunk-6SG3NMKU.js.map +0 -1
- package/dist/chunk-ANLIJZBL.js.map +0 -1
- package/dist/chunk-CNQYM52B.js.map +0 -1
- package/dist/chunk-F3NTI6TX.js.map +0 -1
- package/dist/chunk-F7HTXGGH.js.map +0 -1
- package/dist/chunk-MAC76UNI.js +0 -1
- package/dist/chunk-OO6JSYLP.js.map +0 -1
- package/dist/chunk-QYN5S4EM.js.map +0 -1
- package/dist/chunk-UB5K44DB.js.map +0 -1
- package/dist/chunk-UBZPSVSE.js.map +0 -1
- package/dist/qti-test/components/test-next.spec.css +0 -2481
- package/dist/qti-test/components/test-next.spec.css.map +0 -1
- package/dist/qti-test/components/test-next.spec.d.ts +0 -13
- package/dist/qti-test/components/test-next.spec.js +0 -45904
- package/dist/qti-test/components/test-next.spec.js.map +0 -1
- /package/cdn/{chunk-22HAPLRD.js → chunks/chunk-3GO57DNP.js} +0 -0
- /package/cdn/{chunk-LVW3MHTI.js → chunks/chunk-5FCXUJAG.js} +0 -0
- /package/cdn/{chunk-IXSX4SJX.js → chunks/chunk-6MCYE7P5.js} +0 -0
- /package/cdn/{chunk-M6AATWPS.js → chunks/chunk-FRS2J3OS.js} +0 -0
- /package/dist/{chunk-44VE5POH.js.map → chunks/chunk-H2JE6IVU.js.map} +0 -0
- /package/dist/{chunk-2CHF3TMY.js.map → chunks/chunk-J2SHENRN.js.map} +0 -0
- /package/dist/{chunk-MAC76UNI.js.map → chunks/chunk-UN2IFSGC.js.map} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/lib/decorators/live-query.ts
|
|
2
|
+
function liveQuery(querySelector, _options) {
|
|
3
|
+
let observer;
|
|
4
|
+
return (proto, decoratedFnName) => {
|
|
5
|
+
const { connectedCallback, disconnectedCallback } = proto;
|
|
6
|
+
proto.connectedCallback = function() {
|
|
7
|
+
connectedCallback.call(this);
|
|
8
|
+
const callback = (mutationList) => {
|
|
9
|
+
const elementsToWatch = Array.from(this.querySelectorAll(querySelector)).concat(
|
|
10
|
+
Array.from(this.shadowRoot?.querySelectorAll(querySelector) || [])
|
|
11
|
+
);
|
|
12
|
+
for (const mutation of mutationList) {
|
|
13
|
+
const addedNodes = Array.from(mutation.addedNodes).map((e) => e);
|
|
14
|
+
const removedNodes = Array.from(mutation.addedNodes).map((e) => e);
|
|
15
|
+
if (mutation.type === "childList" && addedNodes.find((n) => elementsToWatch.includes(n))) {
|
|
16
|
+
this[decoratedFnName](addedNodes, removedNodes);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
observer = new MutationObserver(callback);
|
|
21
|
+
observer.observe(this, { childList: true, subtree: true });
|
|
22
|
+
const elementsAdded = Array.from(this.querySelectorAll(querySelector)).concat(
|
|
23
|
+
Array.from(this.shadowRoot?.querySelectorAll(querySelector) || [])
|
|
24
|
+
);
|
|
25
|
+
this[decoratedFnName](Array.from(elementsAdded), []);
|
|
26
|
+
};
|
|
27
|
+
proto.disconnectedCallback = function() {
|
|
28
|
+
disconnectedCallback.call(this);
|
|
29
|
+
observer.disconnect();
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
liveQuery
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=chunk-D3RGDWKP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/decorators/live-query.ts"],"sourcesContent":["// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the 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\nimport type { LitElement } from 'lit';\n\ntype UpdateHandler = (prev?: unknown, next?: unknown) => void;\n\ntype NonUndefined<A> = A extends undefined ? never : A;\n\ntype UpdateHandlerFunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends UpdateHandler ? K : never;\n}[keyof T];\n\ninterface LiveQueryOptions {\n /**\n * If true, will only start watching after the initial update/render\n */\n}\n\nexport function liveQuery(querySelector: string, _options?: LiveQueryOptions) {\n let observer: MutationObserver;\n // const resolvedOptions: Required<LiveQueryOptions> = {\n // ...options\n // };\n return <ElemClass extends LitElement>(\n proto: ElemClass,\n decoratedFnName: UpdateHandlerFunctionKeys<ElemClass>\n ): void => {\n const { connectedCallback, disconnectedCallback } = proto;\n\n proto.connectedCallback = function (this: ElemClass) {\n connectedCallback.call(this);\n const callback = (mutationList: MutationRecord[]) => {\n const elementsToWatch = Array.from(this.querySelectorAll(querySelector)).concat(\n Array.from(this.shadowRoot?.querySelectorAll(querySelector) || [])\n );\n for (const mutation of mutationList) {\n const addedNodes = Array.from(mutation.addedNodes).map(e => e as Element);\n const removedNodes = Array.from(mutation.addedNodes).map(e => e as Element);\n if (mutation.type === 'childList' && addedNodes.find(n => elementsToWatch.includes(n))) {\n (this[decoratedFnName] as unknown as UpdateHandler)(addedNodes, removedNodes);\n }\n }\n };\n observer = new MutationObserver(callback);\n observer.observe(this, { childList: true, subtree: true });\n\n const elementsAdded = Array.from(this.querySelectorAll(querySelector)).concat(\n Array.from(this.shadowRoot?.querySelectorAll(querySelector) || [])\n );\n (this[decoratedFnName] as unknown as UpdateHandler)(Array.from(elementsAdded), []);\n };\n\n proto.disconnectedCallback = function (this: ElemClass) {\n disconnectedCallback.call(this);\n observer.disconnect();\n };\n };\n}\n"],"mappings":";AA8BO,SAAS,UAAU,eAA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+
baseType: "string",
|
|
7
|
+
value: "unknown",
|
|
8
|
+
type: "outcome"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
identifier: "numAttempts",
|
|
12
|
+
cardinality: "single",
|
|
13
|
+
baseType: "integer",
|
|
14
|
+
value: "0",
|
|
15
|
+
type: "response"
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
itemContextVariables
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-DLUJN2FW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/exports/item.context.ts"],"sourcesContent":["import type { VariableDeclaration } from './variables';\n\nexport interface ItemContext {\n href?: string;\n identifier: string;\n variables: ReadonlyArray<VariableDeclaration<string | string[] | null>>;\n}\n\nexport const itemContextVariables = [\n {\n identifier: 'completionStatus',\n cardinality: 'single',\n baseType: 'string',\n value: 'unknown',\n type: 'outcome'\n },\n {\n identifier: 'numAttempts',\n cardinality: 'single',\n baseType: 'integer',\n value: '0',\n type: 'response'\n }\n] as VariableDeclaration<string | string[]>[];\n"],"mappings":";AAQO,IAAM,uBAAuB;AAAA,EAClC;AAAA,IACE,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA;AAAA,IACE,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/decorators/watch.ts"],"sourcesContent":["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"],"mappings":";AA6BO,SAAS,MAAM,cAAiC,SAAwB;AAC7E,QAAM,kBAA0C;AAAA,IAC9C,sBAAsB;AAAA,IACtB,GAAG;AAAA,EACL;AACA,SAAO,CACL,OACA,oBACG;AAEH,UAAM,EAAE,OAAO,IAAI;AACnB,UAAM,oBAAoB,MAAM,QAAQ,YAAY,IAAI,eAAe,CAAC,YAAY;AAGpF,UAAM,SAAS,SAA2B,cAAgE;AACxG,wBAAkB,QAAQ,cAAY;AACpC,cAAM,MAAM;AACZ,YAAI,aAAa,IAAI,GAAG,GAAG;AACzB,gBAAM,WAAW,aAAa,IAAI,GAAG;AACrC,gBAAM,WAAW,KAAK,GAAG;AAEzB,cAAI,aAAa,UAAU;AACzB,gBAAI,CAAC,gBAAgB,wBAAwB,KAAK,YAAY;AAC5D,cAAC,KAAK,eAAe,EAA+B,UAAU,QAAQ;AAAA,YACxE;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAED,aAAO,KAAK,MAAM,YAAY;AAAA,IAChC;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
qtiTransformItem,
|
|
3
|
+
qtiTransformManifest,
|
|
4
|
+
qtiTransformTest
|
|
5
|
+
} from "./chunk-XDMSEAYC.js";
|
|
6
|
+
|
|
7
|
+
// src/lib/qti-loader/qti-loader.ts
|
|
8
|
+
var getManifestInfo = async (manifestURL) => {
|
|
9
|
+
const baseURI = manifestURL.substring(0, manifestURL.lastIndexOf("/"));
|
|
10
|
+
const test = await qtiTransformManifest().load(`${manifestURL}`).then((api) => api.assessmentTest());
|
|
11
|
+
const testHTMLDoc = await qtiTransformTest().load(`${baseURI}/${test.href}`).then((api) => api.htmlDoc());
|
|
12
|
+
const items = await qtiTransformTest().load(`${baseURI}/${test.href}`).then((api) => api.items());
|
|
13
|
+
const testURL = `${baseURI}/${test.href}`;
|
|
14
|
+
const testURI = `${baseURI}/${test.href.substring(0, test.href.lastIndexOf("/"))}`;
|
|
15
|
+
return {
|
|
16
|
+
testHTMLDoc,
|
|
17
|
+
testURI,
|
|
18
|
+
testURL,
|
|
19
|
+
items,
|
|
20
|
+
testIdentifier: test.identifier
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
var getItemByUri = async (itemUri) => qtiTransformItem().load(itemUri).then((api) => api.htmlDoc().firstElementChild);
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
getManifestInfo,
|
|
27
|
+
getItemByUri
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=chunk-FV7HWK54.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-loader/qti-loader.ts"],"sourcesContent":["import type { QtiAssessmentItem } from '../qti-components';\nimport { qtiTransformItem, qtiTransformTest } from '../qti-transformers';\nimport { qtiTransformManifest } from '../qti-transformers/qti-transform-manifest';\n\nexport type ManifestInfo = {\n testIdentifier: string;\n testHTMLDoc: DocumentFragment;\n testURI: string;\n testURL: string;\n items: {\n identifier: string;\n href: string;\n category: string;\n }[];\n};\n\n// Utility function to ensure package URIs end with a '/'\n// const normalizeUri = (uri: string) => (uri.endsWith('/') ? uri : `${uri}/`);\n\n// Fetches assessment data from the manifest\nexport const getManifestInfo = async (manifestURL: string): Promise<ManifestInfo> => {\n const baseURI = manifestURL.substring(0, manifestURL.lastIndexOf('/'));\n\n const test = await qtiTransformManifest()\n .load(`${manifestURL}`)\n .then(api => api.assessmentTest());\n\n const testHTMLDoc = await qtiTransformTest()\n .load(`${baseURI}/${test.href}`)\n .then(api => api.htmlDoc());\n\n const items = await qtiTransformTest()\n .load(`${baseURI}/${test.href}`)\n .then(api => api.items());\n\n const testURL = `${baseURI}/${test.href}`;\n const testURI = `${baseURI}/${test.href.substring(0, test.href.lastIndexOf('/'))}`;\n\n return {\n testHTMLDoc,\n testURI,\n testURL,\n items,\n testIdentifier: test.identifier\n };\n};\n\n// Fetches a single item by URI\nexport const getItemByUri = async (itemUri: string): Promise<QtiAssessmentItem> =>\n qtiTransformItem()\n .load(itemUri)\n .then(api => api.htmlDoc().firstElementChild as QtiAssessmentItem);\n"],"mappings":";;;;;;;AAoBO,IAAM,kBAAkB,OAAO,gBAA+C;AACnF,QAAM,UAAU,YAAY,UAAU,GAAG,YAAY,YAAY,GAAG,CAAC;AAErE,QAAM,OAAO,MAAM,qBAAqB,EACrC,KAAK,GAAG,WAAW,EAAE,EACrB,KAAK,SAAO,IAAI,eAAe,CAAC;AAEnC,QAAM,cAAc,MAAM,iBAAiB,EACxC,KAAK,GAAG,OAAO,IAAI,KAAK,IAAI,EAAE,EAC9B,KAAK,SAAO,IAAI,QAAQ,CAAC;AAE5B,QAAM,QAAQ,MAAM,iBAAiB,EAClC,KAAK,GAAG,OAAO,IAAI,KAAK,IAAI,EAAE,EAC9B,KAAK,SAAO,IAAI,MAAM,CAAC;AAE1B,QAAM,UAAU,GAAG,OAAO,IAAI,KAAK,IAAI;AACvC,QAAM,UAAU,GAAG,OAAO,IAAI,KAAK,KAAK,UAAU,GAAG,KAAK,KAAK,YAAY,GAAG,CAAC,CAAC;AAEhF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,KAAK;AAAA,EACvB;AACF;AAGO,IAAM,eAAe,OAAO,YACjC,iBAAiB,EACd,KAAK,OAAO,EACZ,KAAK,SAAO,IAAI,QAAQ,EAAE,iBAAsC;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
btn,
|
|
3
3
|
dis
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4O5F7WV7.js";
|
|
5
5
|
import {
|
|
6
6
|
TestComponent
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3EU75IUF.js";
|
|
8
8
|
import {
|
|
9
9
|
__decorateClass
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-H2JE6IVU.js";
|
|
11
11
|
|
|
12
12
|
// src/lib/qti-test/components/test-prev.ts
|
|
13
13
|
import { css, html } from "lit";
|
|
@@ -47,4 +47,4 @@ TestPrev = __decorateClass([
|
|
|
47
47
|
export {
|
|
48
48
|
TestPrev
|
|
49
49
|
};
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-GSWZT6N2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-prev.ts"],"sourcesContent":["import { css, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { TestComponent } from './test-component.abstract';\nimport * as styles from './styles';\n\n/**\n * Represents a custom element for navigating to the previous test item.\n *\n * @remarks\n * This element provides functionality for navigating to the previous test item.\n *\n * @example\n * ```html\n * <test-prev></test-prev>\n * ```\n */\n@customElement('test-prev')\nexport class TestPrev extends TestComponent {\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n constructor() {\n super();\n this._internals.role = 'button';\n this._internals.ariaLabel = 'Next item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this.disabled) this._requestItem(this.items[this.itemIndex - 1].identifier);\n });\n }\n\n willUpdate(changedProperties: Map<string | number | symbol, unknown>) {\n super.willUpdate(changedProperties);\n if (changedProperties.has('_testContext')) {\n this.disabled = !this._testElement?.el || this.itemIndex === 0 || this.itemIndex === -1;\n }\n }\n\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-previous': TestPrev;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,KAAK,YAAY;AAC1B,SAAS,qBAAqB;AAgBvB,IAAM,WAAN,cAAuB,cAAc;AAAA,EAU1C,cAAc;AACZ,UAAM;AACN,SAAK,WAAW,OAAO;AACvB,SAAK,WAAW,YAAY;AAE5B,SAAK,iBAAiB,SAAS,OAAK;AAClC,QAAE,eAAe;AACjB,UAAI,CAAC,KAAK,SAAU,MAAK,aAAa,KAAK,MAAM,KAAK,YAAY,CAAC,EAAE,UAAU;AAAA,IACjF,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,mBAA2D;AACpE,UAAM,WAAW,iBAAiB;AAClC,QAAI,kBAAkB,IAAI,cAAc,GAAG;AACzC,WAAK,WAAW,CAAC,KAAK,cAAc,MAAM,KAAK,cAAc,KAAK,KAAK,cAAc;AAAA,IACvF;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AACF;AA/Ba,SACJ,SAAS;AAAA;AAAA,QAEH,GAAG;AAAA;AAAA;AAAA,QAGH,GAAG;AAAA;AAAA;AANL,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export {
|
|
13
|
+
__decorateClass
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=chunk-H2JE6IVU.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
item_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J2SHENRN.js";
|
|
4
4
|
import {
|
|
5
5
|
qtiTransformItem
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XDMSEAYC.js";
|
|
7
7
|
import {
|
|
8
8
|
watch
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ELDMXTUQ.js";
|
|
10
10
|
import {
|
|
11
11
|
__decorateClass
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-H2JE6IVU.js";
|
|
13
13
|
|
|
14
14
|
// src/lib/qti-item/core/components/item-container.ts
|
|
15
15
|
import { LitElement, html } from "lit";
|
|
@@ -104,4 +104,4 @@ export {
|
|
|
104
104
|
ItemContainer,
|
|
105
105
|
QtiItem
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-HHVRU3AJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-item/core/components/item-container.ts","../../src/lib/qti-item/core/qti-item.ts"],"sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { until } from 'lit/directives/until.js';\nimport { watch } from '../../../decorators/watch';\nimport itemCss from '../../../../item.css?inline';\nimport { qtiTransformItem } from '../../../qti-transformers';\n\n/**\n * `<item-container>` is a custom element designed for hosting the qti-assessment-item.\n * The `qti-assessment-item` will be placed inside the shadow DOM of this element.\n * The element loads the item from the provided URL and renders it inside the shadow DOM.\n *\n * ### Styling\n * Add a class to the element for styling.\n *\n * ```html\n * <qti-item>\n * <item-container class=\"m-4 bg-white\" item-url=\"./path/to/item.xml\"></item-container>\n * </qti-item>\n * ```\n */\n@customElement('item-container')\nexport class ItemContainer extends LitElement {\n /** URL of the item to load */\n @property({ type: String, attribute: 'item-url' })\n itemURL: string = null;\n\n /** A parsed HTML document */\n @state()\n itemDoc: DocumentFragment = null;\n\n /** The raw XML string */\n @state()\n itemXML: string = null;\n\n /** Template content if provided */\n private templateContent = null;\n\n @watch('itemURL', { waitUntilFirstUpdate: true })\n protected async handleItemURLChange() {\n if (!this.itemURL) return;\n try {\n const api = await qtiTransformItem().load(this.itemURL);\n this.itemDoc = api.htmlDoc();\n } catch (error) {\n console.error('Error loading or parsing XML:', error);\n }\n }\n\n @watch('itemXML', { waitUntilFirstUpdate: true })\n protected handleItemXMLChange() {\n if (!this.itemXML) return;\n try {\n this.itemDoc = qtiTransformItem().parse(this.itemXML).htmlDoc();\n } catch (error) {\n console.error('Error parsing XML:', error);\n }\n }\n\n async connectedCallback(): Promise<void> {\n super.connectedCallback();\n this.initializeTemplateContent();\n this.applyStyles();\n if (this.itemURL) {\n this.handleItemURLChange();\n }\n if (this.itemXML) {\n this.handleItemXMLChange();\n }\n }\n\n private initializeTemplateContent() {\n const template = this.querySelector('template') as HTMLTemplateElement;\n this.templateContent = template ? template.content : html``;\n }\n\n private applyStyles() {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(itemCss);\n this.shadowRoot.adoptedStyleSheets = [sheet];\n }\n\n render() {\n return html`\n ${this.templateContent}\n <slot></slot>\n ${until(this.itemDoc, html`<span>Loading...</span>`)}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-container': ItemContainer;\n }\n}\n","import { html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n/**\n * `<qti-item>` is a custom element designed for rendering a single `qti-assessment-item`.\n * It can also host some functionalities to interact with the item like scoring, showing feedback, etc.\n * Placing a mandatory `<item-container>` inside '<qti-item>' will load or parse the item and render it.\n * See `<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@customElement('qti-item')\nexport class QtiItem extends LitElement {\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-item': QtiItem;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,YAAY,YAAY;AACjC,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,aAAa;AAoBf,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC;AAAA;AAGL,mBAAkB;AAIlB,mBAA4B;AAI5B,mBAAkB;AAGlB;AAAA,SAAQ,kBAAkB;AAAA;AAAA,EAG1B,MAAgB,sBAAsB;AACpC,QAAI,CAAC,KAAK,QAAS;AACnB,QAAI;AACF,YAAM,MAAM,MAAM,iBAAiB,EAAE,KAAK,KAAK,OAAO;AACtD,WAAK,UAAU,IAAI,QAAQ;AAAA,IAC7B,SAAS,OAAO;AACd,cAAQ,MAAM,iCAAiC,KAAK;AAAA,IACtD;AAAA,EACF;AAAA,EAGU,sBAAsB;AAC9B,QAAI,CAAC,KAAK,QAAS;AACnB,QAAI;AACF,WAAK,UA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