@citolab/qti-components 7.4.0 → 7.4.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/custom-elements.json +152 -152
- package/dist/chunks/{chunk-6K4ROGDD.js → chunk-4BDOB6KY.js} +12 -11
- package/dist/chunks/chunk-4BDOB6KY.js.map +1 -0
- package/dist/chunks/chunk-4OGJBG35.js +8 -0
- package/dist/chunks/chunk-4OGJBG35.js.map +1 -0
- package/dist/chunks/{chunk-LN74Z5QM.js → chunk-7RW7LCEJ.js} +258 -589
- package/dist/chunks/chunk-7RW7LCEJ.js.map +1 -0
- package/dist/chunks/chunk-C5RLRG3L.js +10 -0
- package/dist/chunks/chunk-C5RLRG3L.js.map +1 -0
- package/dist/chunks/chunk-CJADUWEC.js +10 -0
- package/dist/chunks/chunk-CJADUWEC.js.map +1 -0
- package/dist/chunks/chunk-DVQQ7I6Y.js +8 -0
- package/dist/chunks/chunk-DVQQ7I6Y.js.map +1 -0
- package/dist/chunks/{chunk-O5N4DCU6.js → chunk-ELDMXTUQ.js} +2 -7
- package/dist/chunks/chunk-ELDMXTUQ.js.map +1 -0
- package/dist/chunks/chunk-ERYHQVOT.js +8 -0
- package/dist/chunks/chunk-ERYHQVOT.js.map +1 -0
- package/dist/chunks/chunk-GAAFN7QF.js +146 -0
- package/dist/chunks/chunk-GAAFN7QF.js.map +1 -0
- package/dist/chunks/chunk-H2JE6IVU.js +15 -0
- package/dist/chunks/chunk-H2JE6IVU.js.map +1 -0
- package/dist/chunks/chunk-H6KHXSIO.js +8 -0
- package/dist/chunks/chunk-H6KHXSIO.js.map +1 -0
- package/dist/chunks/chunk-HFAUM56X.js +208 -0
- package/dist/chunks/chunk-HFAUM56X.js.map +1 -0
- package/dist/chunks/chunk-JQ6HWGRY.js +22 -0
- package/dist/chunks/chunk-JQ6HWGRY.js.map +1 -0
- package/dist/chunks/{chunk-GUDRSXIP.js → chunk-K47QFOQX.js} +6 -20
- package/dist/chunks/chunk-K47QFOQX.js.map +1 -0
- package/dist/chunks/chunk-NJNQOQUU.js +8 -0
- package/dist/chunks/chunk-NJNQOQUU.js.map +1 -0
- package/dist/chunks/chunk-SV4K25ZI.js +19 -0
- package/dist/chunks/chunk-SV4K25ZI.js.map +1 -0
- package/dist/chunks/{chunk-TJ6ZOT7A.js → chunk-UVKOJQ52.js} +26 -24
- package/dist/chunks/chunk-UVKOJQ52.js.map +1 -0
- package/dist/chunks/{chunk-JDY5GL7E.js → chunk-WFUXZ4UT.js} +1 -13
- package/dist/chunks/{chunk-JDY5GL7E.js.map → chunk-WFUXZ4UT.js.map} +1 -1
- package/dist/custom-elements.json +152 -152
- package/dist/{computed-item.context-DpK-sS0T.d.ts → exports/computed-item.context.d.ts} +6 -2
- package/dist/exports/computed-item.context.js +8 -0
- package/dist/exports/computed-item.context.js.map +1 -0
- package/dist/exports/computed.context.d.ts +34 -0
- package/dist/exports/computed.context.js +8 -0
- package/dist/exports/computed.context.js.map +1 -0
- package/dist/{config.context-CmQ9L62n.d.ts → exports/config.context.d.ts} +4 -1
- package/dist/exports/config.context.js +8 -0
- package/dist/exports/config.context.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 +46 -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 +12 -0
- package/dist/exports/interaction.js.map +1 -0
- package/dist/exports/item.context.d.ts +11 -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 +9 -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 +14 -0
- package/dist/exports/qti-condition-expression.js +11 -0
- package/dist/exports/qti-condition-expression.js.map +1 -0
- package/dist/exports/qti-expression.d.ts +23 -0
- package/dist/exports/qti-expression.js +10 -0
- package/dist/exports/qti-expression.js.map +1 -0
- package/dist/exports/qti-test.d.ts +12 -0
- package/dist/exports/qti-test.js +1 -0
- package/dist/exports/qti-test.js.map +1 -0
- package/dist/exports/qti.context.d.ts +14 -0
- package/dist/exports/qti.context.js +8 -0
- package/dist/exports/qti.context.js.map +1 -0
- package/dist/exports/session.context.d.ts +15 -0
- package/dist/exports/session.context.js +10 -0
- package/dist/exports/session.context.js.map +1 -0
- package/dist/exports/test.context.d.ts +16 -0
- package/dist/exports/test.context.js +10 -0
- package/dist/exports/test.context.js.map +1 -0
- package/dist/exports/variables.d.ts +2 -0
- package/dist/exports/variables.js +1 -0
- package/dist/exports/variables.js.map +1 -0
- package/dist/index.d.ts +18 -6
- package/dist/index.js +25 -12
- package/dist/{qti-assessment-item-D77dJ1Ot.d.ts → qti-assessment-item-l-mN3teH.d.ts} +2 -1
- package/dist/qti-components/index.d.ts +14 -76
- package/dist/qti-components/index.js +13 -4
- package/dist/qti-item/index.d.ts +4 -3
- package/dist/qti-item/index.js +6 -3
- package/dist/qti-loader/index.d.ts +3 -2
- package/dist/qti-loader/index.js +2 -1
- package/dist/qti-loader/index.js.map +1 -1
- package/dist/qti-modal-feedback-PKbhO-3w.d.ts +30 -0
- package/dist/qti-test/index.d.ts +16 -129
- package/dist/qti-test/index.js +11 -4
- package/dist/qti-test-BwvOhz_-.d.ts +118 -0
- package/dist/qti-transform-item-C9WtMeDR.d.ts +39 -0
- package/dist/qti-transformers/index.d.ts +2 -38
- package/dist/qti-transformers/index.js +2 -1
- package/dist/{variables-Vgyr6yyW.d.ts → variables-BCkyLoXK.d.ts} +7 -10
- package/package.json +1 -2
- package/dist/chunks/chunk-6K4ROGDD.js.map +0 -1
- package/dist/chunks/chunk-GUDRSXIP.js.map +0 -1
- package/dist/chunks/chunk-LN74Z5QM.js.map +0 -1
- package/dist/chunks/chunk-O5N4DCU6.js.map +0 -1
- package/dist/chunks/chunk-TJ6ZOT7A.js.map +0 -1
- package/dist/test.context-L609DNAz.d.ts +0 -58
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/qti-loader/qti-loader.ts"],"sourcesContent":["import { qtiTransformItem, qtiTransformTest } from '../qti-transformers';\nimport { qtiTransformManifest } from '../qti-transformers/qti-transform-manifest';\n\nimport type { QtiAssessmentItem } from '../qti-components/qti-assessment-item/qti-assessment-item';\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 return qtiTransformItem()\n .load(itemUri)\n .promise.then(api => api.htmlDoc().firstElementChild as QtiAssessmentItem);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-loader/qti-loader.ts"],"sourcesContent":["import { qtiTransformItem, qtiTransformTest } from '../qti-transformers';\nimport { qtiTransformManifest } from '../qti-transformers/qti-transform-manifest';\n\nimport type { QtiAssessmentItem } from '../qti-components/qti-assessment-item/qti-assessment-item';\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 return qtiTransformItem()\n .load(itemUri)\n .promise.then(api => api.htmlDoc().firstElementChild as QtiAssessmentItem);\n};\n"],"mappings":";;;;;;;;AAqBO,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,YAAgD;AACjF,SAAO,iBAAiB,EACrB,KAAK,OAAO,EACZ,QAAQ,KAAK,SAAO,IAAI,QAAQ,EAAE,iBAAsC;AAC7E;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as lit_html from 'lit-html';
|
|
2
|
+
import * as lit from 'lit';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
|
|
5
|
+
declare abstract class QtiFeedback extends LitElement {
|
|
6
|
+
protected showHide: string;
|
|
7
|
+
outcomeIdentifier: string;
|
|
8
|
+
protected identifier: string;
|
|
9
|
+
showStatus: string;
|
|
10
|
+
private _context?;
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
checkShowFeedback(outcomeIdentifier: string): void;
|
|
13
|
+
private showFeedback;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare class QtiModalFeedback extends QtiFeedback {
|
|
17
|
+
static styles: lit.CSSResult;
|
|
18
|
+
render(): lit_html.TemplateResult<1>;
|
|
19
|
+
openFeedback(): void;
|
|
20
|
+
closeFeedback(): void;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
protected updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'qti-modal-feedback': QtiModalFeedback;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { QtiModalFeedback as Q, QtiFeedback as a };
|
package/dist/qti-test/index.d.ts
CHANGED
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
|
-
import { e as VariableValue, O as OutcomeVariable, V as VariableDeclaration } from '../variables-
|
|
2
|
+
import { e as VariableValue, O as OutcomeVariable, V as VariableDeclaration } from '../variables-BCkyLoXK.js';
|
|
3
3
|
import * as lit from 'lit';
|
|
4
4
|
import { LitElement, PropertyValues, nothing } from 'lit';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { SessionContext } from '../exports/session.context.js';
|
|
6
|
+
import { b as QtiAssessmentTest, I as IQtiTest } from '../qti-test-BwvOhz_-.js';
|
|
7
|
+
export { Q as QtiAssessmentItemRef, a as QtiAssessmentSection, d as QtiTestFeedback, c as QtiTestPart } from '../qti-test-BwvOhz_-.js';
|
|
8
|
+
import { TestContext } from '../exports/test.context.js';
|
|
9
|
+
export { INITIAL_TEST_CONTEXT, testContext } from '../exports/test.context.js';
|
|
10
|
+
import { QtiContext } from '../exports/qti.context.js';
|
|
11
|
+
import { ComputedContext, ComputedItem } from '../exports/computed.context.js';
|
|
12
|
+
import { ConfigContext } from '../exports/config.context.js';
|
|
8
13
|
import { TemplateFunction } from '@heximal/templates';
|
|
9
|
-
import { C as ComputedItemContext } from '../computed-item.context-DpK-sS0T.js';
|
|
10
|
-
import { C as ConfigContext } from '../config.context-CmQ9L62n.js';
|
|
11
14
|
import { ViewMode } from 'storybook/internal/types';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
navItemLoading?: boolean;
|
|
19
|
-
navTestLoading?: boolean;
|
|
20
|
-
view?: View;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
declare class QtiAssessmentTest extends LitElement {
|
|
24
|
-
identifier: string;
|
|
25
|
-
get title(): string;
|
|
26
|
-
set title(value: string);
|
|
27
|
-
_testContext?: TestContext;
|
|
28
|
-
private _title;
|
|
29
|
-
connectedCallback(): Promise<void>;
|
|
30
|
-
render(): lit_html.TemplateResult<1>;
|
|
31
|
-
}
|
|
32
|
-
declare global {
|
|
33
|
-
interface HTMLElementTagNameMap {
|
|
34
|
-
'qti-assessment-test': QtiAssessmentTest;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
15
|
+
import '../exports/expression-result.js';
|
|
16
|
+
import '../qti-transform-item-C9WtMeDR.js';
|
|
17
|
+
import '../qti-assessment-item-l-mN3teH.js';
|
|
18
|
+
import '../qti-modal-feedback-PKbhO-3w.js';
|
|
19
|
+
import '../exports/item.context.js';
|
|
20
|
+
import '../exports/computed-item.context.js';
|
|
37
21
|
|
|
38
22
|
declare abstract class TestBase extends LitElement {
|
|
39
23
|
testContext: Readonly<TestContext>;
|
|
@@ -54,78 +38,6 @@ declare abstract class TestBase extends LitElement {
|
|
|
54
38
|
private _updateItemInTestContext;
|
|
55
39
|
}
|
|
56
40
|
|
|
57
|
-
declare class QtiAssessmentItemRef extends LitElement {
|
|
58
|
-
category?: string;
|
|
59
|
-
identifier?: string;
|
|
60
|
-
required?: boolean;
|
|
61
|
-
fixed?: boolean;
|
|
62
|
-
href?: string;
|
|
63
|
-
weigths: Map<string, number>;
|
|
64
|
-
xmlDoc: DocumentFragment;
|
|
65
|
-
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
66
|
-
get assessmentItem(): QtiAssessmentItem | null;
|
|
67
|
-
myTemplate: TemplateFunction;
|
|
68
|
-
connectedCallback(): Promise<void>;
|
|
69
|
-
render(): unknown;
|
|
70
|
-
}
|
|
71
|
-
declare global {
|
|
72
|
-
interface HTMLElementTagNameMap {
|
|
73
|
-
'qti-assessment-item-ref': QtiAssessmentItemRef;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
declare class QtiAssessmentSection extends LitElement {
|
|
78
|
-
identifier: string;
|
|
79
|
-
required: string;
|
|
80
|
-
fixed: boolean;
|
|
81
|
-
get title(): string;
|
|
82
|
-
set title(value: string);
|
|
83
|
-
visible: boolean;
|
|
84
|
-
keepTogether: boolean;
|
|
85
|
-
_testContext?: TestContext;
|
|
86
|
-
private _title;
|
|
87
|
-
connectedCallback(): Promise<void>;
|
|
88
|
-
render(): lit_html.TemplateResult<1>;
|
|
89
|
-
}
|
|
90
|
-
declare global {
|
|
91
|
-
interface HTMLElementTagNameMap {
|
|
92
|
-
'qti-assessment-section': QtiAssessmentSection;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
declare class QtiTestPart extends LitElement {
|
|
97
|
-
identifier: string;
|
|
98
|
-
get title(): string;
|
|
99
|
-
set title(value: string);
|
|
100
|
-
class: string;
|
|
101
|
-
navigationMode: 'linear' | 'nonlinear';
|
|
102
|
-
submissionMode: 'individual' | 'simultaneous';
|
|
103
|
-
private _title;
|
|
104
|
-
connectedCallback(): Promise<void>;
|
|
105
|
-
render(): lit_html.TemplateResult<1>;
|
|
106
|
-
}
|
|
107
|
-
declare global {
|
|
108
|
-
interface HTMLElementTagNameMap {
|
|
109
|
-
'qti-test-part': QtiTestPart;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
declare class QtiTestFeedback extends QtiModalFeedback {
|
|
114
|
-
static styles: lit.CSSResult;
|
|
115
|
-
render(): lit_html.TemplateResult<1>;
|
|
116
|
-
}
|
|
117
|
-
declare global {
|
|
118
|
-
interface HTMLElementTagNameMap {
|
|
119
|
-
'qti-test-feedback': QtiTestFeedback;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
interface IQtiTest {
|
|
124
|
-
testContext: Readonly<TestContext>;
|
|
125
|
-
sessionContext: Readonly<SessionContext>;
|
|
126
|
-
updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
41
|
declare const QtiTest_base: (abstract new (...args: any[]) => {}) & (abstract new (...args: any[]) => {}) & (abstract new (...args: any[]) => {
|
|
130
42
|
updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;
|
|
131
43
|
getOutcome(identifier: string): Readonly<OutcomeVariable>;
|
|
@@ -194,31 +106,6 @@ declare global {
|
|
|
194
106
|
}
|
|
195
107
|
}
|
|
196
108
|
|
|
197
|
-
type ComputedItem = ComputedItemContext & {
|
|
198
|
-
categories?: string[];
|
|
199
|
-
type?: 'info' | 'regular';
|
|
200
|
-
index?: number;
|
|
201
|
-
active?: boolean;
|
|
202
|
-
};
|
|
203
|
-
type ComputedContext = {
|
|
204
|
-
view: View;
|
|
205
|
-
identifier: string;
|
|
206
|
-
title: string;
|
|
207
|
-
testParts: {
|
|
208
|
-
active?: boolean;
|
|
209
|
-
identifier: string;
|
|
210
|
-
navigationMode: 'linear' | 'nonlinear';
|
|
211
|
-
submissionMode: 'individual' | 'simultaneous';
|
|
212
|
-
sections: {
|
|
213
|
-
active?: boolean;
|
|
214
|
-
identifier: string;
|
|
215
|
-
title: string;
|
|
216
|
-
completed?: boolean;
|
|
217
|
-
items: ComputedItem[];
|
|
218
|
-
}[];
|
|
219
|
-
}[];
|
|
220
|
-
};
|
|
221
|
-
|
|
222
109
|
type CustomEventMap = {
|
|
223
110
|
'test-end-attempt': CustomEvent;
|
|
224
111
|
'test-show-correct-response': CustomEvent<{
|
|
@@ -590,4 +477,4 @@ declare global {
|
|
|
590
477
|
}
|
|
591
478
|
}
|
|
592
479
|
|
|
593
|
-
export {
|
|
480
|
+
export { QtiAssessmentTest, QtiTest, TestCheckItem, TestContainer, TestContext, TestEndAttempt, TestItemLink, TestNavigation, TestNext, TestPagingButtonsStamp, TestPrev, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestSectionButtonsStamp, TestSectionLink, TestShowCorrectResponse, TestStamp, TestView, TestViewToggle };
|
package/dist/qti-test/index.js
CHANGED
|
@@ -23,14 +23,21 @@ import {
|
|
|
23
23
|
TestStamp,
|
|
24
24
|
TestView,
|
|
25
25
|
TestViewToggle
|
|
26
|
-
} from "../chunks/chunk-
|
|
26
|
+
} from "../chunks/chunk-UVKOJQ52.js";
|
|
27
|
+
import "../chunks/chunk-K47QFOQX.js";
|
|
27
28
|
import "../chunks/chunk-LSEB52SP.js";
|
|
29
|
+
import "../chunks/chunk-ELDMXTUQ.js";
|
|
30
|
+
import "../chunks/chunk-WFUXZ4UT.js";
|
|
31
|
+
import "../chunks/chunk-H6KHXSIO.js";
|
|
32
|
+
import "../chunks/chunk-C5RLRG3L.js";
|
|
28
33
|
import {
|
|
29
34
|
INITIAL_TEST_CONTEXT,
|
|
30
35
|
testContext
|
|
31
|
-
} from "../chunks/chunk-
|
|
32
|
-
import "../chunks/chunk-
|
|
33
|
-
import "../chunks/chunk-
|
|
36
|
+
} from "../chunks/chunk-CJADUWEC.js";
|
|
37
|
+
import "../chunks/chunk-DVQQ7I6Y.js";
|
|
38
|
+
import "../chunks/chunk-NJNQOQUU.js";
|
|
39
|
+
import "../chunks/chunk-ERYHQVOT.js";
|
|
40
|
+
import "../chunks/chunk-H2JE6IVU.js";
|
|
34
41
|
export {
|
|
35
42
|
INITIAL_TEST_CONTEXT,
|
|
36
43
|
QtiAssessmentItemRef,
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { t as transformItemApi } from './qti-transform-item-C9WtMeDR.js';
|
|
2
|
+
import * as lit from 'lit';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
import { Q as QtiAssessmentItem } from './qti-assessment-item-l-mN3teH.js';
|
|
5
|
+
import { TemplateFunction } from '@heximal/templates';
|
|
6
|
+
import * as lit_html from 'lit-html';
|
|
7
|
+
import { TestContext } from './exports/test.context.js';
|
|
8
|
+
import { Q as QtiModalFeedback } from './qti-modal-feedback-PKbhO-3w.js';
|
|
9
|
+
import { SessionContext } from './exports/session.context.js';
|
|
10
|
+
import { e as VariableValue, O as OutcomeVariable, V as VariableDeclaration } from './variables-BCkyLoXK.js';
|
|
11
|
+
|
|
12
|
+
declare class QtiAssessmentTest extends LitElement {
|
|
13
|
+
identifier: string;
|
|
14
|
+
get title(): string;
|
|
15
|
+
set title(value: string);
|
|
16
|
+
_testContext?: TestContext;
|
|
17
|
+
private _title;
|
|
18
|
+
connectedCallback(): Promise<void>;
|
|
19
|
+
render(): lit_html.TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'qti-assessment-test': QtiAssessmentTest;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare class QtiAssessmentItemRef extends LitElement {
|
|
28
|
+
category?: string;
|
|
29
|
+
identifier?: string;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
fixed?: boolean;
|
|
32
|
+
href?: string;
|
|
33
|
+
weigths: Map<string, number>;
|
|
34
|
+
xmlDoc: DocumentFragment;
|
|
35
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
36
|
+
get assessmentItem(): QtiAssessmentItem | null;
|
|
37
|
+
myTemplate: TemplateFunction;
|
|
38
|
+
connectedCallback(): Promise<void>;
|
|
39
|
+
render(): unknown;
|
|
40
|
+
}
|
|
41
|
+
declare global {
|
|
42
|
+
interface HTMLElementTagNameMap {
|
|
43
|
+
'qti-assessment-item-ref': QtiAssessmentItemRef;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare class QtiAssessmentSection extends LitElement {
|
|
48
|
+
identifier: string;
|
|
49
|
+
required: string;
|
|
50
|
+
fixed: boolean;
|
|
51
|
+
get title(): string;
|
|
52
|
+
set title(value: string);
|
|
53
|
+
visible: boolean;
|
|
54
|
+
keepTogether: boolean;
|
|
55
|
+
_testContext?: TestContext;
|
|
56
|
+
private _title;
|
|
57
|
+
connectedCallback(): Promise<void>;
|
|
58
|
+
render(): lit_html.TemplateResult<1>;
|
|
59
|
+
}
|
|
60
|
+
declare global {
|
|
61
|
+
interface HTMLElementTagNameMap {
|
|
62
|
+
'qti-assessment-section': QtiAssessmentSection;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare class QtiTestPart extends LitElement {
|
|
67
|
+
identifier: string;
|
|
68
|
+
get title(): string;
|
|
69
|
+
set title(value: string);
|
|
70
|
+
class: string;
|
|
71
|
+
navigationMode: 'linear' | 'nonlinear';
|
|
72
|
+
submissionMode: 'individual' | 'simultaneous';
|
|
73
|
+
private _title;
|
|
74
|
+
connectedCallback(): Promise<void>;
|
|
75
|
+
render(): lit_html.TemplateResult<1>;
|
|
76
|
+
}
|
|
77
|
+
declare global {
|
|
78
|
+
interface HTMLElementTagNameMap {
|
|
79
|
+
'qti-test-part': QtiTestPart;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class QtiTestFeedback extends QtiModalFeedback {
|
|
84
|
+
static styles: lit.CSSResult;
|
|
85
|
+
render(): lit_html.TemplateResult<1>;
|
|
86
|
+
}
|
|
87
|
+
declare global {
|
|
88
|
+
interface HTMLElementTagNameMap {
|
|
89
|
+
'qti-test-feedback': QtiTestFeedback;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
type PostLoadTransformCallback = (transformer: transformItemApi, itemRef: QtiAssessmentItemRef) => transformItemApi | Promise<transformItemApi>;
|
|
94
|
+
|
|
95
|
+
interface QtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, IQtiTest {
|
|
96
|
+
}
|
|
97
|
+
interface IQtiTest {
|
|
98
|
+
testContext: Readonly<TestContext>;
|
|
99
|
+
sessionContext: Readonly<SessionContext>;
|
|
100
|
+
updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;
|
|
101
|
+
}
|
|
102
|
+
interface ITestNavigationMixin {
|
|
103
|
+
navigate: 'item' | 'section' | null;
|
|
104
|
+
cacheTransform: boolean;
|
|
105
|
+
requestTimeout: number;
|
|
106
|
+
showLoadingIndicators: boolean;
|
|
107
|
+
postLoadTransformCallback: PostLoadTransformCallback | null;
|
|
108
|
+
navigateTo(type: 'item' | 'section', id?: string): void;
|
|
109
|
+
retryNavigation(): void;
|
|
110
|
+
}
|
|
111
|
+
interface ITestProcessingMixin {
|
|
112
|
+
updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;
|
|
113
|
+
getOutcome(identifier: string): Readonly<OutcomeVariable>;
|
|
114
|
+
getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
|
|
115
|
+
outcomeProcessing(): boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { type IQtiTest as I, QtiAssessmentItemRef as Q, QtiAssessmentSection as a, QtiAssessmentTest as b, QtiTestPart as c, QtiTestFeedback as d, type QtiTest as e, type ITestNavigationMixin as f, type ITestProcessingMixin as g };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
interface ModuleResolutionConfig {
|
|
2
|
+
waitSeconds?: number;
|
|
3
|
+
context?: string;
|
|
4
|
+
catchError?: boolean;
|
|
5
|
+
urlArgs?: string;
|
|
6
|
+
paths: {
|
|
7
|
+
[key: string]: string | string[];
|
|
8
|
+
};
|
|
9
|
+
shim?: {
|
|
10
|
+
[key: string]: {
|
|
11
|
+
deps?: string[];
|
|
12
|
+
exports?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
type transformItemApi = {
|
|
17
|
+
load: (uri: string) => {
|
|
18
|
+
promise: Promise<transformItemApi>;
|
|
19
|
+
request: XMLHttpRequest | null;
|
|
20
|
+
};
|
|
21
|
+
parse: (xmlString: string) => transformItemApi;
|
|
22
|
+
path: (location: string) => transformItemApi;
|
|
23
|
+
fn: (fn: (xmlFragment: XMLDocument) => void) => transformItemApi;
|
|
24
|
+
pciHooks: (uri: string) => transformItemApi;
|
|
25
|
+
configurePci: (baseUrl: string, getModuleResolutionConfig: (baseUrl: string, fileUrl: string) => Promise<ModuleResolutionConfig>, selector?: string) => Promise<transformItemApi>;
|
|
26
|
+
extendElementName: (elementName: string, extend: string) => transformItemApi;
|
|
27
|
+
extendElementsWithClass: (param?: string) => transformItemApi;
|
|
28
|
+
customInteraction: (baseRef: string, baseItem: string) => transformItemApi;
|
|
29
|
+
convertCDATAtoComment: () => transformItemApi;
|
|
30
|
+
shuffleInteractions: () => transformItemApi;
|
|
31
|
+
stripStyleSheets: () => transformItemApi;
|
|
32
|
+
html: () => string;
|
|
33
|
+
xml: () => string;
|
|
34
|
+
htmlDoc: () => DocumentFragment;
|
|
35
|
+
xmlDoc: () => XMLDocument;
|
|
36
|
+
};
|
|
37
|
+
declare const qtiTransformItem: (cache?: boolean) => transformItemApi;
|
|
38
|
+
|
|
39
|
+
export { type ModuleResolutionConfig as M, qtiTransformItem as q, type transformItemApi as t };
|
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
waitSeconds?: number;
|
|
3
|
-
context?: string;
|
|
4
|
-
catchError?: boolean;
|
|
5
|
-
urlArgs?: string;
|
|
6
|
-
paths: {
|
|
7
|
-
[key: string]: string | string[];
|
|
8
|
-
};
|
|
9
|
-
shim?: {
|
|
10
|
-
[key: string]: {
|
|
11
|
-
deps?: string[];
|
|
12
|
-
exports?: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
type transformItemApi = {
|
|
17
|
-
load: (uri: string) => {
|
|
18
|
-
promise: Promise<transformItemApi>;
|
|
19
|
-
request: XMLHttpRequest | null;
|
|
20
|
-
};
|
|
21
|
-
parse: (xmlString: string) => transformItemApi;
|
|
22
|
-
path: (location: string) => transformItemApi;
|
|
23
|
-
fn: (fn: (xmlFragment: XMLDocument) => void) => transformItemApi;
|
|
24
|
-
pciHooks: (uri: string) => transformItemApi;
|
|
25
|
-
configurePci: (baseUrl: string, getModuleResolutionConfig: (baseUrl: string, fileUrl: string) => Promise<ModuleResolutionConfig>, selector?: string) => Promise<transformItemApi>;
|
|
26
|
-
extendElementName: (elementName: string, extend: string) => transformItemApi;
|
|
27
|
-
extendElementsWithClass: (param?: string) => transformItemApi;
|
|
28
|
-
customInteraction: (baseRef: string, baseItem: string) => transformItemApi;
|
|
29
|
-
convertCDATAtoComment: () => transformItemApi;
|
|
30
|
-
shuffleInteractions: () => transformItemApi;
|
|
31
|
-
stripStyleSheets: () => transformItemApi;
|
|
32
|
-
html: () => string;
|
|
33
|
-
xml: () => string;
|
|
34
|
-
htmlDoc: () => DocumentFragment;
|
|
35
|
-
xmlDoc: () => XMLDocument;
|
|
36
|
-
};
|
|
37
|
-
declare const qtiTransformItem: (cache?: boolean) => transformItemApi;
|
|
1
|
+
export { M as ModuleResolutionConfig, q as qtiTransformItem, t as transformItemApi } from '../qti-transform-item-C9WtMeDR.js';
|
|
38
2
|
|
|
39
3
|
declare const qtiTransformManifest: () => {
|
|
40
4
|
load: (uri: string) => Promise<{
|
|
@@ -78,4 +42,4 @@ type transformTestApi = {
|
|
|
78
42
|
};
|
|
79
43
|
declare const qtiTransformTest: () => transformTestApi;
|
|
80
44
|
|
|
81
|
-
export {
|
|
45
|
+
export { qtiTransformManifest, qtiTransformTest, type transformTestApi };
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
responseIdentifier: string;
|
|
3
|
-
response: string | string[];
|
|
4
|
-
}
|
|
5
|
-
interface Calculate {
|
|
6
|
-
calculate: () => string | string[];
|
|
7
|
-
}
|
|
8
|
-
type BaseType = 'boolean' | 'directedPair' | 'duration' | 'float' | 'integer' | 'string' | 'identifier' | 'pair' | 'record';
|
|
9
|
-
type Cardinality = 'multiple' | 'ordered' | 'single' | 'record';
|
|
1
|
+
import { Cardinality, BaseType } from './exports/expression-result.js';
|
|
10
2
|
|
|
11
3
|
type QtiAreaMapping = {
|
|
12
4
|
defaultValue: number;
|
|
@@ -54,5 +46,10 @@ interface ResponseVariable extends VariableDeclaration<string | string[] | null>
|
|
|
54
46
|
areaMapping?: QtiAreaMapping;
|
|
55
47
|
correctResponse?: string | string[] | null;
|
|
56
48
|
}
|
|
49
|
+
interface TemplateVariable extends VariableDeclaration<string | string[] | number | boolean | null> {
|
|
50
|
+
type: 'template';
|
|
51
|
+
mathVariable?: boolean;
|
|
52
|
+
paramVariable?: boolean;
|
|
53
|
+
}
|
|
57
54
|
|
|
58
|
-
export type {
|
|
55
|
+
export type { OutcomeVariable as O, QtiMapping as Q, ResponseVariable as R, TemplateVariable as T, VariableDeclaration as V, QtiMapEntry as a, QtiAreaMapping as b, QtiAreaMapEntry as c, areaShape as d, VariableValue as e };
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20.0.0"
|
|
23
23
|
},
|
|
24
|
-
"version": "7.4.
|
|
24
|
+
"version": "7.4.2",
|
|
25
25
|
"type": "module",
|
|
26
26
|
"main": "./dist/index.js",
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
@@ -95,7 +95,6 @@
|
|
|
95
95
|
"test": "vitest run",
|
|
96
96
|
"attw": "attw --profile esm-only --pack --exclude-entrypoints ./item.css ./react",
|
|
97
97
|
"chromatic": "node chromatic-runner.cjs",
|
|
98
|
-
"prepare": "husky",
|
|
99
98
|
"clean": "rm -rf dist cdn",
|
|
100
99
|
"madge": "madge --circular --extensions ts src"
|
|
101
100
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/qti-item/components/item-container.ts","../../src/lib/qti-item/components/print-item-variables.ts","../../src/lib/exports/computed-item.context.ts","../../src/lib/qti-item/components/item-show-correct-response.ts","../../src/lib/qti-item/components/styles.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';\n\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 { promise: api } = await qtiTransformItem().load(this.itemURL);\n this.itemDoc = (await 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 { consume } from '@lit/context';\nimport { css, html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport { computedItemContext } from '../../exports/computed-item.context';\n\nimport type { ResponseVariable } from '../../exports/variables';\nimport type { ComputedItemContext } from '../../exports/computed-item.context';\n\n@customElement('print-item-variables')\nexport class PrintItemVariables extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n protected computedContext?: ComputedItemContext;\n\n static styles = css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin: 20px 0;\n font-size: 14px;\n text-align: left;\n }\n th,\n td {\n border: 1px solid #ddd;\n padding: 8px;\n }\n th {\n background-color: #f4f4f4;\n font-weight: bold;\n }\n h3 {\n margin-top: 20px;\n font-size: 16px;\n }\n `;\n\n render() {\n const activeItem = this.computedContext;\n\n if (!activeItem || !activeItem.variables) return html``;\n\n const responseVariables: ResponseVariable[] = activeItem.variables.filter(v => v.type === 'response');\n const outcomeVariables = activeItem.variables.filter(v => v.type === 'outcome');\n\n const renderTable = (variables: ResponseVariable[], title: string) => html`\n <h3>${title}</h3>\n <table>\n <thead>\n <tr>\n <th>Identifier</th>\n <th>Value</th>\n <th>Cardinality</th>\n <th>Base Type</th>\n <th>Correct Response / Mappings</th>\n </tr>\n </thead>\n <tbody>\n ${variables.map(v => {\n const correctResponse = v.correctResponse\n ? Array.isArray(v.correctResponse)\n ? v.correctResponse.join(', ')\n : v.correctResponse\n : '';\n\n const mapEntries = v.mapping?.mapEntries?.map(m => `${m.mapKey}=${m.mappedValue}pt`).join(', ') || '';\n\n const areaMapEntries =\n v.areaMapping?.areaMapEntries?.map(m => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(', ') || '';\n\n return html`\n <tr>\n <td>${v.identifier}</td>\n <td>${Array.isArray(v.value) ? v.value.join(', ') : v.value}</td>\n <td>${v.cardinality}</td>\n <td>${v.baseType}</td>\n <td>${correctResponse || mapEntries || areaMapEntries}</td>\n </tr>\n `;\n })}\n </tbody>\n </table>\n `;\n\n return html`\n ${renderTable(responseVariables, 'Response Variables')} ${renderTable(outcomeVariables, 'Outcome Variables')}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'print-item-variables': PrintItemVariables;\n }\n}\n","import { createContext } from '@lit/context';\n\nimport type { VariableDeclaration } from './variables';\n\nexport type ComputedItemContext = {\n identifier: string;\n href?: string;\n correct?: boolean;\n incorrect?: boolean;\n completed?: boolean;\n adaptive?: boolean;\n timeDependent?: boolean;\n title?: string;\n label?: string;\n score?: number;\n maxScore?: number;\n completionStatus?: string;\n variables: ReadonlyArray<VariableDeclaration<string | string[] | null>>;\n};\n\nexport const computedItemContext = createContext<Readonly<ComputedItemContext>>(Symbol('computedItemContext'));\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\nimport { computedItemContext } from '../../exports/computed-item.context';\n\nimport type { ComputedItemContext } from '../../exports/computed-item.context';\n\n@customElement('item-show-correct-response')\nexport class ItemShowCorrectResponse extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n public computedContext?: ComputedItemContext;\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n @property({ type: Boolean, reflect: true }) shown = false;\n @property({ type: Boolean, reflect: true }) disabled = false; // Reflects to `disabled` attribute\n @property({ type: String }) showCorrectText = 'Show correct response';\n @property({ type: String }) hideCorrectText = 'Hide correct response';\n @property({ type: String }) noCorrectResponseText = 'No correct response specified';\n\n private _hasCorrectResponse = false; // correct response is removed on certain point\n private _previousActiveItem = ''; // Store previous active item reference\n\n updated() {\n if (!this._hasCorrectResponse || this._previousActiveItem !== this.computedContext?.identifier) {\n this._previousActiveItem = this.computedContext?.identifier;\n const containsCorrectResponse = !!this.computedContext?.variables.some(v => v['correctResponse']);\n const containsMapping = !!this.computedContext?.variables.some(v => {\n return v['mapping']?.mapEntries?.length > 0 || v['areaMapping']?.areaMapEntries?.length > 0;\n });\n this._hasCorrectResponse = containsCorrectResponse || containsMapping;\n }\n this.disabled = !this._hasCorrectResponse;\n }\n\n private _toggleState() {\n if (this.disabled) return; // Prevent toggle if disabled\n\n this.dispatchEvent(\n new CustomEvent('item-show-correct-response', {\n detail: !this.shown,\n bubbles: true\n })\n );\n }\n\n private _getDisplayedText(): string {\n return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;\n }\n\n render() {\n return html` <div @click=\"${this._toggleState}\">${this._getDisplayedText()}</div> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-show-correct-response': ItemShowCorrectResponse;\n }\n}\n","// /* eslint-disable lit-plugin(no-invalid-css) */\nimport { css } from 'lit';\n\nexport const form = css`\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n padding: 0.5rem 1rem;\n border-radius: 0.25rem;\n user-select: none;\n`;\n\nexport const btn = css`\n background-color: lightgray;\n ${form};\n`;\n\nexport const dis = css`\n cursor: not-allowed;\n opacity: 0.8;\n`;\n\nexport const ind = css`\n ${form};\n border: 1px solid gray;\n`;\n","import { provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\n\nimport { computedItemContext } from '../../exports/computed-item.context';\nimport { configContext } from '../../exports/config.context.ts';\n\nimport type { QtiAssessmentItem } from '../../qti-components/qti-assessment-item/qti-assessment-item.ts';\nimport type { ConfigContext, CorrectResponseMode } from '../../exports/config.context.ts';\nimport type { ItemContext } from '../../exports/item.context';\nimport type { VariableDeclaration } from '../../exports/variables';\nimport type { ComputedItemContext } from '../../exports/computed-item.context';\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 @state()\n @provide({ context: computedItemContext })\n public computedContext: ComputedItemContext;\n private _qtiAssessmentItem?: QtiAssessmentItem;\n\n @state()\n @provide({ context: configContext })\n public configContext: ConfigContext = {};\n\n // Store event handlers as instance properties\n private _onItemContextChanged = this._handleItemContextChanged.bind(this);\n private _onAssessmentItemConnected = this._handleAssessmentItemConnected.bind(this);\n\n private _onHandleShowCorrectResponse = this._handleShowCorrectResponse.bind(this);\n private _onHandleShowCandidateCorrection = this._handleShowCandidateCorrection.bind(this);\n private _onHandleSwitchCorrectResponseMode = this._handleSwitchCorrectResponseMode.bind(this);\n\n constructor() {\n super();\n this.addEventListener('qti-item-context-updated', this._onItemContextChanged);\n this.addEventListener('qti-assessment-item-connected', this._onAssessmentItemConnected);\n this.addEventListener('item-show-correct-response', this._onHandleShowCorrectResponse);\n this.addEventListener('item-show-candidate-correction', this._onHandleShowCandidateCorrection);\n this.addEventListener('item-switch-correct-response-mode', this._onHandleSwitchCorrectResponseMode);\n }\n\n private _handleItemContextChanged(e: CustomEvent<{ itemContext: ItemContext }>) {\n this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail?.itemContext?.variables || []);\n }\n\n private _handleAssessmentItemConnected(e: CustomEvent<QtiAssessmentItem>) {\n const fullVariables = (e.detail as any)._context.variables;\n this._qtiAssessmentItem = e.detail;\n this.computedContext =\n this.computedContext?.identifier === this._qtiAssessmentItem.identifier\n ? { ...this.computedContext, title: this._qtiAssessmentItem.title }\n : ({\n identifier: this._qtiAssessmentItem.identifier,\n title: this._qtiAssessmentItem.title,\n adaptive: this._qtiAssessmentItem.getAttribute('adaptive')?.toLowerCase() === 'true' || false,\n variables: fullVariables,\n correctResponseMode: 'internal'\n } as ComputedItemContext);\n this._updateItemVariablesInTestContext(this._qtiAssessmentItem.identifier, fullVariables || []);\n }\n\n private _handleShowCorrectResponse(e: CustomEvent<boolean>) {\n if (this._qtiAssessmentItem) {\n this._qtiAssessmentItem.showCorrectResponse(e.detail);\n }\n }\n\n private _handleShowCandidateCorrection(e: CustomEvent<boolean>) {\n if (this._qtiAssessmentItem) {\n this._qtiAssessmentItem.showCandidateCorrection(e.detail);\n }\n }\n\n private _handleSwitchCorrectResponseMode(e: CustomEvent<CorrectResponseMode>) {\n // Switch off the correct response first\n this._handleShowCorrectResponse(new CustomEvent('item-show-correct-response', { detail: false, bubbles: true }));\n\n this.configContext = {\n ...this.configContext,\n correctResponseMode: e.detail\n };\n }\n\n private _updateItemVariablesInTestContext(\n identifier: string,\n variables: readonly VariableDeclaration<string | string[] | null>[]\n ): void {\n const rawscore = variables?.find(vr => vr.identifier == 'SCORE')?.value;\n const score = parseFloat(rawscore?.toString());\n const completionStatus = variables?.find(v => v.identifier === 'completionStatus')?.value;\n\n const correct = score !== undefined && !isNaN(score) && score > 0;\n const incorrect = score !== undefined && !isNaN(score) && score <= 0;\n const completed = completionStatus === 'completed';\n this.computedContext = {\n ...this.computedContext,\n identifier,\n correct,\n incorrect,\n completed,\n variables\n };\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('qti-item-context-changed', this._onItemContextChanged);\n this.removeEventListener('qti-assessment-item-connected', this._onAssessmentItemConnected);\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;AAqBf,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,EAAE,SAAS,IAAI,IAAI,MAAM,iBAAiB,EAAE,KAAK,KAAK,OAAO;AACnE,WAAK,WAAW,MAAM,KAAK,QAAQ;AAAA,IACrC,SAAS,OA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AU;AAAA,GACZ;","names":["html","LitElement","customElement","LitElement","html","customElement","css","html","LitElement","customElement","property","consume","css","LitElement","html","css","consume","property","customElement","html","LitElement","customElement","state","LitElement","html","state","customElement"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/qti-components/qti-feedback/qti-modal-feedback/qti-modal-feedback.ts","../../src/lib/qti-components/qti-feedback/qti-feedback.ts","../../src/lib/qti-components/internal/utils.ts","../../src/lib/exports/qti-assessment-item.context.ts","../../src/lib/exports/test.context.ts","../../src/lib/exports/qti.context.ts"],"sourcesContent":["import { css, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport { QtiFeedback } from '../qti-feedback';\n\n@customElement('qti-modal-feedback')\nexport class QtiModalFeedback extends QtiFeedback {\n static override styles = css`\n .qti-dialog {\n background: var(--qti-bg);\n border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);\n border-radius: var(--qti-border-radius);\n padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1000;\n width: auto;\n max-width: 90%;\n }\n\n .button {\n border-radius: var(--qti-border-radius);\n padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);\n background-color: var(--qti-bg-active);\n border: var(--qti-border-active);\n cursor: pointer;\n position: relative;\n display: inline-block;\n }\n\n .button:hover {\n background-color: var(--qti-hover-bg);\n }\n\n .button:disabled {\n background-color: var(--qti-disabled-bg);\n color: var(--qti-disabled-color);\n cursor: not-allowed;\n }\n\n .button:focus {\n outline: var(--qti-focus-border-width) solid var(--qti-focus-color);\n }\n `;\n\n override render() {\n return html`\n <dialog class=\"qti-dialog\" part=\"feedback\" ?open=\"${this.showStatus === 'on'}\">\n <slot></slot>\n <div style=\"margin-top: var(--qti-gap-size); text-align: center;\">\n <button class=\"button close-button\" @click=\"${this.closeFeedback}\">Close</button>\n </div>\n </dialog>\n `;\n }\n\n openFeedback() {\n const dialog = this.shadowRoot?.querySelector('dialog') as HTMLDialogElement | null;\n if (dialog && !dialog.open) {\n dialog.showModal();\n }\n }\n\n closeFeedback() {\n const dialog = this.shadowRoot?.querySelector('dialog') as HTMLDialogElement | null;\n if (dialog && dialog.open) {\n dialog.close();\n this.showStatus = 'off';\n }\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n if (this.showStatus === 'on') {\n this.openFeedback();\n }\n }\n\n protected updated(changedProperties: Map<string | number | symbol, unknown>): void {\n if (changedProperties.has('showStatus')) {\n if (this.showStatus === 'on') {\n this.openFeedback();\n } else {\n this.closeFeedback();\n }\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-modal-feedback': QtiModalFeedback;\n }\n}\n","import { consume } from '@lit/context';\nimport { LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { IsNullOrUndefined } from '../internal/utils';\nimport { itemContext } from '../../exports/qti-assessment-item.context';\n\nimport type { ItemContext } from '../../exports/item.context';\n\nexport abstract class QtiFeedback extends LitElement {\n @property({ type: String, attribute: 'show-hide' })\n protected showHide: string;\n\n @property({ type: String, attribute: 'outcome-identifier' })\n public outcomeIdentifier: string;\n\n @property({ type: String })\n protected identifier: string;\n\n @property({ type: String, attribute: false })\n public showStatus: string;\n\n @consume({ context: itemContext, subscribe: true })\n @state()\n private _context?: ItemContext;\n\n public override connectedCallback() {\n super.connectedCallback();\n this.dispatchEvent(\n new CustomEvent<QtiFeedback>('qti-register-feedback', {\n bubbles: true,\n composed: true,\n detail: this\n })\n );\n }\n\n public checkShowFeedback(outcomeIdentifier: string) {\n const outcomeVariable = this._context.variables.find(v => v.identifier === outcomeIdentifier) || null;\n if (this.outcomeIdentifier !== outcomeIdentifier || !outcomeVariable) return;\n let isFound = false;\n if (Array.isArray(outcomeVariable.value)) {\n isFound = outcomeVariable.value.includes(this.identifier);\n } else {\n isFound =\n (!IsNullOrUndefined(this.identifier) &&\n !IsNullOrUndefined(outcomeVariable?.value) &&\n this.identifier === outcomeVariable.value) ||\n false;\n }\n\n this.showFeedback(isFound);\n }\n\n private showFeedback(value: boolean) {\n this.showStatus = (value && this.showHide === 'show') || (!value && this.showHide === 'hide') ? 'on' : 'off';\n }\n}\n","export const decimalSeparator = () => {\n return new Intl.NumberFormat().format(0.1).replace(/\\d/g, '');\n};\n\nexport const convertNumberToUniversalFormat = (number: number | string) => {\n // check if type is string\n if (typeof number === 'string') {\n return number;\n }\n const dSep = decimalSeparator();\n if (dSep === '.') {\n return number.toLocaleString();\n } else {\n return number.toString().replace('.', '').replace(dSep, '.');\n }\n};\n\nexport function IsNullOrUndefined(value: unknown) {\n return value === null || value === undefined;\n}\n\nexport function removeDoubleSlashes(str: string) {\n const singleForwardSlashes = str\n .replace(/([^:]\\/)\\/+/g, '$1')\n .replace(/\\/\\//g, '/')\n .replace('http:/', 'http://')\n .replace('https:/', 'https://');\n return singleForwardSlashes;\n}\n","import { createContext } from '@lit/context';\n\nimport type { ItemContext } from './item.context';\n\nexport const itemContext = createContext<ItemContext>(Symbol('item'));\n","import { createContext } from '@lit/context';\n\nimport type { ItemContext } from './item.context';\nimport type { VariableDeclaration } from './variables';\n\nexport interface TestContext {\n items: (ItemContext & { category?: string })[];\n testOutcomeVariables?: VariableDeclaration<string | string[] | null>[];\n}\n\nexport const INITIAL_TEST_CONTEXT: Readonly<TestContext> = { items: [], testOutcomeVariables: [] };\n\nexport const testContext = createContext<Readonly<TestContext>>(Symbol('testContext'));\n","import { createContext } from '@lit/context';\n\nexport type QtiContextType = {\n testIdentifier: string;\n candidateIdentifier: string;\n environmentIdentifier: string;\n [key: string]: string | string[]; // Allow for additional context variables\n};\n\nexport interface QtiContext {\n QTI_CONTEXT: QtiContextType;\n}\n\nexport const qtiContext = createContext<Readonly<QtiContext>>(Symbol('qtiContext'));\n"],"mappings":";;;;;AAAA,SAAS,KAAK,YAAY;AAC1B,SAAS,qBAAqB;;;ACD9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