@citolab/qti-components 8.0.0 → 8.0.1
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/index.global.js +1 -1
- package/cdn/index.js +591 -217
- package/dist/base.d.ts +135 -9
- package/dist/{chunk-MJVPNN7W.js → chunk-3AJOQCDU.js} +2 -2
- package/dist/chunk-7HC5SMCU.js +102 -0
- package/dist/chunk-7HC5SMCU.js.map +1 -0
- package/dist/{chunk-MGF5F3S2.js → chunk-CAO4JRLY.js} +2 -2
- package/dist/{chunk-5SJS36BI.js → chunk-F4BNJWYN.js} +1 -1
- package/dist/{chunk-5SJS36BI.js.map → chunk-F4BNJWYN.js.map} +1 -1
- package/dist/{chunk-5QYII4OZ.js → chunk-LVBIQDPM.js} +2 -2
- package/dist/{chunk-W4QZPCNC.js → chunk-QECOPVPO.js} +2 -2
- package/dist/{chunk-LZJHHZQ2.js → chunk-RXGDQDOV.js} +177 -173
- package/dist/chunk-RXGDQDOV.js.map +1 -0
- package/dist/{chunk-KYEZRYO6.js → chunk-XU7HNT4F.js} +4 -4
- package/dist/computed-item.types.d-BKZdSLLJ.d.ts +19 -0
- package/dist/computed.types.d-rKLSPvVG.d.ts +42 -0
- package/dist/config.context.d-BvU9r-Mg.d.ts +91 -0
- package/dist/corrections.d.ts +432 -1
- package/dist/corrections.js +5 -5
- package/dist/elements.d.ts +393 -1
- package/dist/index.d.ts +58 -9
- package/dist/index.js +16 -8
- package/dist/interaction.d-D4MstYRz.d.ts +115 -0
- package/dist/interaction.interface.d-CvjHM2bi.d.ts +46 -0
- package/dist/interactions.d.ts +1569 -1
- package/dist/interactions.js +2 -2
- package/dist/item.css +588 -214
- package/dist/item.d.ts +92 -1
- package/dist/item.js +3 -3
- package/dist/item.types.d-QU7LljEK.d.ts +82 -0
- package/dist/loader.d.ts +22 -1
- package/dist/processing.d.ts +730 -1
- package/dist/qti-components-jsx.d.ts +221 -231
- package/dist/qti-components-jsx.js +1 -0
- package/dist/qti-condition-expression.d-aMvBvpc6.d.ts +8 -0
- package/dist/qti-expression.d-BietT_8b.d.ts +31 -0
- package/dist/qti-feedback.d-DZbad0RN.d.ts +21 -0
- package/dist/qti-rule-base.d-ajOnfGXY.d.ts +16 -0
- package/dist/qti-transform-test.d-BL7GGFJj.d.ts +70 -0
- package/dist/qti.context.d-CejJMlfZ.d.ts +50 -0
- package/dist/response.d-_8y4kjGP.d.ts +106 -0
- package/dist/test.d.ts +699 -1
- package/dist/test.js +11 -3
- package/dist/transformers.d.ts +18 -1
- package/package.json +11 -8
- package/dist/chunk-LZJHHZQ2.js.map +0 -1
- package/dist/chunk-WCQ26LV7.js +0 -102
- package/dist/chunk-WCQ26LV7.js.map +0 -1
- /package/dist/{chunk-MJVPNN7W.js.map → chunk-3AJOQCDU.js.map} +0 -0
- /package/dist/{chunk-MGF5F3S2.js.map → chunk-CAO4JRLY.js.map} +0 -0
- /package/dist/{chunk-5QYII4OZ.js.map → chunk-LVBIQDPM.js.map} +0 -0
- /package/dist/{chunk-W4QZPCNC.js.map → chunk-QECOPVPO.js.map} +0 -0
- /package/dist/{chunk-KYEZRYO6.js.map → chunk-XU7HNT4F.js.map} +0 -0
package/dist/test.d.ts
CHANGED
|
@@ -1 +1,699 @@
|
|
|
1
|
-
|
|
1
|
+
import * as lit from 'lit';
|
|
2
|
+
import { LitElement, PropertyValues, nothing } from 'lit';
|
|
3
|
+
import { QtiAssessmentItem } from './elements.js';
|
|
4
|
+
import { TemplateFunction } from '@heximal/templates';
|
|
5
|
+
import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-BietT_8b.js';
|
|
6
|
+
import { g as VariableValue, b as OutcomeVariable, V as VariableDeclaration } from './item.types.d-QU7LljEK.js';
|
|
7
|
+
import { S as SessionContext, V as View, C as ComputedContext, a as ComputedItem } from './computed.types.d-rKLSPvVG.js';
|
|
8
|
+
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
9
|
+
import { QtiModalFeedback } from '@qti-components/elements/elements';
|
|
10
|
+
import { Q as QtiRuleBase } from './qti-rule-base.d-ajOnfGXY.js';
|
|
11
|
+
import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
12
|
+
import { t as transformItemApi, b as transformTestApi } from './qti-transform-test.d-BL7GGFJj.js';
|
|
13
|
+
import './interaction.interface.d-CvjHM2bi.js';
|
|
14
|
+
import './qti-feedback.d-DZbad0RN.js';
|
|
15
|
+
import './computed-item.types.d-BKZdSLLJ.js';
|
|
16
|
+
|
|
17
|
+
declare class QtiAssessmentItemRef extends LitElement {
|
|
18
|
+
category?: string;
|
|
19
|
+
identifier?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
fixed?: boolean;
|
|
22
|
+
href?: string;
|
|
23
|
+
weigths: Map<string, number>;
|
|
24
|
+
xmlDoc: DocumentFragment;
|
|
25
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
26
|
+
get assessmentItem(): QtiAssessmentItem | null;
|
|
27
|
+
myTemplate: TemplateFunction;
|
|
28
|
+
connectedCallback(): Promise<void>;
|
|
29
|
+
render(): unknown;
|
|
30
|
+
}
|
|
31
|
+
declare global {
|
|
32
|
+
interface HTMLElementTagNameMap {
|
|
33
|
+
'qti-assessment-item-ref': QtiAssessmentItemRef;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare class QtiAssessmentTest extends LitElement {
|
|
38
|
+
#private;
|
|
39
|
+
identifier: string;
|
|
40
|
+
get title(): string;
|
|
41
|
+
set title(value: string);
|
|
42
|
+
_testContext?: TestContext;
|
|
43
|
+
connectedCallback(): Promise<void>;
|
|
44
|
+
render(): lit.TemplateResult<1>;
|
|
45
|
+
}
|
|
46
|
+
declare global {
|
|
47
|
+
interface HTMLElementTagNameMap {
|
|
48
|
+
'qti-assessment-test': QtiAssessmentTest;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface TestBaseInterface extends LitElement {
|
|
53
|
+
testContext: Readonly<TestContext>;
|
|
54
|
+
sessionContext: Readonly<SessionContext>;
|
|
55
|
+
configContext?: Readonly<ConfigContext>;
|
|
56
|
+
_testElement: QtiAssessmentTest;
|
|
57
|
+
updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type PostLoadTransformCallback = (transformer: transformItemApi, itemRef: QtiAssessmentItemRef) => transformItemApi | Promise<transformItemApi>;
|
|
61
|
+
type PostLoadTestTransformCallback = (transformer: transformTestApi, testElement: QtiAssessmentTest) => transformTestApi | Promise<transformTestApi>;
|
|
62
|
+
|
|
63
|
+
declare const QtiTest_base: (abstract new (...args: any[]) => {}) & (abstract new (...args: any[]) => {
|
|
64
|
+
updateAssessmentItemView(assessmentItem: QtiAssessmentItem, view: View): void;
|
|
65
|
+
}) & (abstract new (...args: any[]) => {
|
|
66
|
+
updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;
|
|
67
|
+
getOutcome(identifier: string): Readonly<OutcomeVariable>;
|
|
68
|
+
getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
|
|
69
|
+
outcomeProcessing(): boolean;
|
|
70
|
+
}) & (abstract new (...args: any[]) => TestBaseInterface) & typeof LitElement;
|
|
71
|
+
/**
|
|
72
|
+
* `<qti-test>` is a custom element designed for rendering and interacting with QTI (Question and Test Interoperability) tests.
|
|
73
|
+
*
|
|
74
|
+
* This component leverages several mixins to provide functionality for loading, navigating, processing, and displaying QTI test assessments.
|
|
75
|
+
*
|
|
76
|
+
* ### Example Usage
|
|
77
|
+
*
|
|
78
|
+
* Minimal example including navigation:
|
|
79
|
+
*
|
|
80
|
+
* ```html
|
|
81
|
+
* <qti-test>
|
|
82
|
+
* <test-navigation>
|
|
83
|
+
* <test-container test-url="./path/to/assessment.xml"></test-container>
|
|
84
|
+
* <nav class="flex">
|
|
85
|
+
* <test-prev></test-prev>
|
|
86
|
+
* <test-next></test-next>
|
|
87
|
+
* </nav>
|
|
88
|
+
* </test-navigation>
|
|
89
|
+
* </qti-test>
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* Use the following file structure
|
|
93
|
+
* A qti-test loads a QTI3.0 assessmenttest.xml file from a package folder.
|
|
94
|
+
*
|
|
95
|
+
* ```plaintext
|
|
96
|
+
* Root/
|
|
97
|
+
* ├── index.html
|
|
98
|
+
* └── /assets/api/examples/
|
|
99
|
+
* ├── assessmenttest.xml
|
|
100
|
+
* └── imsmanifest.xml
|
|
101
|
+
*
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* ### Test components
|
|
105
|
+
*
|
|
106
|
+
* Use test components inside the qti-test component for added functionality.
|
|
107
|
+
* ### Test next
|
|
108
|
+
* `<test-next> | TestNext`
|
|
109
|
+
*
|
|
110
|
+
* ### Test prev
|
|
111
|
+
*
|
|
112
|
+
* `<test-prev> | TestPrev`
|
|
113
|
+
* ### Test components
|
|
114
|
+
*
|
|
115
|
+
* You can use normal class names to style the elements.
|
|
116
|
+
* And you can use the `test-prev` and `test-next` elements to navigate through the test.
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
119
|
+
declare class QtiTest extends QtiTest_base {
|
|
120
|
+
configContext: ConfigContext;
|
|
121
|
+
/**
|
|
122
|
+
* Renders the component's template.
|
|
123
|
+
* Provides a default `<slot>` for content projection.
|
|
124
|
+
*/
|
|
125
|
+
connectedCallback(): Promise<void>;
|
|
126
|
+
render(): lit.TemplateResult<1>;
|
|
127
|
+
}
|
|
128
|
+
declare global {
|
|
129
|
+
interface HTMLElementTagNameMap {
|
|
130
|
+
'qti-test': QtiTest;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
declare class QtiAssessmentSection extends LitElement {
|
|
135
|
+
#private;
|
|
136
|
+
identifier: string;
|
|
137
|
+
required: string;
|
|
138
|
+
fixed: boolean;
|
|
139
|
+
get title(): string;
|
|
140
|
+
set title(value: string);
|
|
141
|
+
visible: boolean;
|
|
142
|
+
keepTogether: boolean;
|
|
143
|
+
_testContext?: TestContext;
|
|
144
|
+
connectedCallback(): Promise<void>;
|
|
145
|
+
render(): lit.TemplateResult<1>;
|
|
146
|
+
}
|
|
147
|
+
declare global {
|
|
148
|
+
interface HTMLElementTagNameMap {
|
|
149
|
+
'qti-assessment-section': QtiAssessmentSection;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare class QtiTestPart extends LitElement {
|
|
154
|
+
#private;
|
|
155
|
+
identifier: string;
|
|
156
|
+
get title(): string;
|
|
157
|
+
set title(value: string);
|
|
158
|
+
class: string;
|
|
159
|
+
navigationMode: 'linear' | 'nonlinear';
|
|
160
|
+
submissionMode: 'individual' | 'simultaneous';
|
|
161
|
+
connectedCallback(): Promise<void>;
|
|
162
|
+
render(): lit.TemplateResult<1>;
|
|
163
|
+
}
|
|
164
|
+
declare global {
|
|
165
|
+
interface HTMLElementTagNameMap {
|
|
166
|
+
'qti-test-part': QtiTestPart;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
declare class QtiTestFeedback extends QtiModalFeedback {
|
|
171
|
+
static styles: lit.CSSResult;
|
|
172
|
+
render(): lit.TemplateResult<1>;
|
|
173
|
+
}
|
|
174
|
+
declare global {
|
|
175
|
+
interface HTMLElementTagNameMap {
|
|
176
|
+
'qti-test-feedback': QtiTestFeedback;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
declare class QtiOutcomeProcessing extends LitElement {
|
|
181
|
+
static styles: lit.CSSResult[];
|
|
182
|
+
render(): lit.TemplateResult<1>;
|
|
183
|
+
process(): void;
|
|
184
|
+
}
|
|
185
|
+
declare global {
|
|
186
|
+
interface HTMLElementTagNameMap {
|
|
187
|
+
'qti-outcome-processing': QtiOutcomeProcessing;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
declare class QtiOutcomeProcessingProcessor {
|
|
191
|
+
process(rules: QtiRuleBase[]): void;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
declare class QtiTestVariables extends QtiExpression<number> {
|
|
195
|
+
#private;
|
|
196
|
+
_testContext?: TestContext;
|
|
197
|
+
constructor();
|
|
198
|
+
getResult(): number;
|
|
199
|
+
calculate(): number;
|
|
200
|
+
}
|
|
201
|
+
declare class QtiTestVariablesExpression implements QtiExpressionBase<number> {
|
|
202
|
+
private testContext;
|
|
203
|
+
private itemVariable;
|
|
204
|
+
private includedItems;
|
|
205
|
+
constructor(testContext: TestContext, itemVariable: string, includedItems: {
|
|
206
|
+
item: string;
|
|
207
|
+
weight: number;
|
|
208
|
+
}[]);
|
|
209
|
+
calculate(): number;
|
|
210
|
+
}
|
|
211
|
+
declare global {
|
|
212
|
+
interface HTMLElementTagNameMap {
|
|
213
|
+
'qti-test-variables': QtiTestVariables;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
type CustomEventMap = {
|
|
218
|
+
'test-end-attempt': CustomEvent;
|
|
219
|
+
};
|
|
220
|
+
declare global {
|
|
221
|
+
interface GlobalEventHandlersEventMap extends CustomEventMap {
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
declare class TestNavigation extends LitElement {
|
|
225
|
+
#private;
|
|
226
|
+
identifier: string | undefined;
|
|
227
|
+
initContext: {
|
|
228
|
+
identifier: string;
|
|
229
|
+
[key: string]: any;
|
|
230
|
+
}[];
|
|
231
|
+
qtiContext: QtiContext;
|
|
232
|
+
configContext: ConfigContext;
|
|
233
|
+
protected _testContext?: TestContext;
|
|
234
|
+
protected _sessionContext?: SessionContext;
|
|
235
|
+
protected computedContext: ComputedContext;
|
|
236
|
+
autoScoreItems: boolean;
|
|
237
|
+
constructor();
|
|
238
|
+
/** The currently active assessment item, exposed for optional presentation extensions. */
|
|
239
|
+
protected get activeAssessmentItem(): QtiAssessmentItem | undefined;
|
|
240
|
+
render(): lit.TemplateResult<1>;
|
|
241
|
+
protected willUpdate(_changedProperties: PropertyValues): void;
|
|
242
|
+
}
|
|
243
|
+
declare global {
|
|
244
|
+
interface HTMLElementTagNameMap {
|
|
245
|
+
'test-navigation': TestNavigation;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Represents a custom element for navigating to the next test item.
|
|
251
|
+
*
|
|
252
|
+
* @remarks
|
|
253
|
+
* This element provides functionality for navigating to the next test item.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```html
|
|
257
|
+
* <test-next></test-next>
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
declare class TestNext extends LitElement {
|
|
261
|
+
#private;
|
|
262
|
+
_internalDisabled: boolean;
|
|
263
|
+
protected computedContext: ComputedContext;
|
|
264
|
+
sectionItems: ComputedItem[];
|
|
265
|
+
itemIndex: number;
|
|
266
|
+
_handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext): void;
|
|
267
|
+
static styles: lit.CSSResult;
|
|
268
|
+
constructor();
|
|
269
|
+
connectedCallback(): void;
|
|
270
|
+
willUpdate(_changedProperties: Map<string | number | symbol, unknown>): void;
|
|
271
|
+
checkDisabled(): void;
|
|
272
|
+
protected _requestItem(identifier: string): void;
|
|
273
|
+
render(): lit.TemplateResult<1>;
|
|
274
|
+
}
|
|
275
|
+
declare global {
|
|
276
|
+
interface HTMLElementTagNameMap {
|
|
277
|
+
'test-next': TestNext;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Represents a custom element for navigating to the previous test item.
|
|
283
|
+
*
|
|
284
|
+
* @remarks
|
|
285
|
+
* This element provides functionality for navigating to the previous test item.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```html
|
|
289
|
+
* <test-prev></test-prev>
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
declare class TestPrev extends LitElement {
|
|
293
|
+
_internalDisabled: boolean;
|
|
294
|
+
private computedContext;
|
|
295
|
+
sectionItems: ComputedItem[];
|
|
296
|
+
itemIndex: number;
|
|
297
|
+
_handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext): void;
|
|
298
|
+
static styles: lit.CSSResult;
|
|
299
|
+
constructor();
|
|
300
|
+
willUpdate(_changedProperties: Map<string | number | symbol, unknown>): void;
|
|
301
|
+
checkDisabled(): void;
|
|
302
|
+
protected _requestItem(identifier: string): void;
|
|
303
|
+
render(): lit.TemplateResult<1>;
|
|
304
|
+
}
|
|
305
|
+
declare global {
|
|
306
|
+
interface HTMLElementTagNameMap {
|
|
307
|
+
'test-prev': TestPrev;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare class TestView extends LitElement {
|
|
312
|
+
#private;
|
|
313
|
+
static DEFAULT_VIEW_OPTIONS: string[];
|
|
314
|
+
private sessionContext;
|
|
315
|
+
/** label accompanying the select view dropdown */
|
|
316
|
+
label: string;
|
|
317
|
+
/** The options to display in the dropdown, default: ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor'] */
|
|
318
|
+
viewOptions: string;
|
|
319
|
+
protected _handleViewOptionsChange: () => void;
|
|
320
|
+
connectedCallback(): void;
|
|
321
|
+
private _viewOptions;
|
|
322
|
+
protected _switchView(view: string): void;
|
|
323
|
+
render(): lit.TemplateResult<1>;
|
|
324
|
+
}
|
|
325
|
+
declare global {
|
|
326
|
+
interface HTMLElementTagNameMap {
|
|
327
|
+
'test-view': TestView;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
declare class TestItemLink extends LitElement {
|
|
332
|
+
static styles: lit.CSSResult;
|
|
333
|
+
private itemId;
|
|
334
|
+
constructor();
|
|
335
|
+
protected _requestItem(identifier: string): void;
|
|
336
|
+
render(): lit.TemplateResult<1>;
|
|
337
|
+
}
|
|
338
|
+
declare global {
|
|
339
|
+
interface HTMLElementTagNameMap {
|
|
340
|
+
'test-item-link': TestItemLink;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare class TestEndAttempt extends LitElement {
|
|
345
|
+
static styles: lit.CSSResult;
|
|
346
|
+
constructor();
|
|
347
|
+
render(): lit.TemplateResult<1>;
|
|
348
|
+
}
|
|
349
|
+
declare global {
|
|
350
|
+
interface HTMLElementTagNameMap {
|
|
351
|
+
'test-end-attempt': TestEndAttempt;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* @deprecated test-paging-buttons-stamp is deprecated and will be removed in the future.
|
|
357
|
+
*/
|
|
358
|
+
declare class TestPagingButtonsStamp extends LitElement {
|
|
359
|
+
#private;
|
|
360
|
+
private computedContext;
|
|
361
|
+
myTemplate: TemplateFunction;
|
|
362
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
363
|
+
constructor();
|
|
364
|
+
connectedCallback(): void;
|
|
365
|
+
render(): lit.TemplateResult<1>;
|
|
366
|
+
}
|
|
367
|
+
declare global {
|
|
368
|
+
interface HTMLElementTagNameMap {
|
|
369
|
+
'test-paging-buttons-stamp': TestPagingButtonsStamp;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* `<test-container>` is a custom element designed for hosting the qti-assessment-item.
|
|
375
|
+
* The `qti-assessment-test` will be placed inside the shadow DOM of this element.
|
|
376
|
+
* The element loads the test from the provided URL and renders it inside the shadow DOM.
|
|
377
|
+
*
|
|
378
|
+
* ```html
|
|
379
|
+
* <qti-test>
|
|
380
|
+
* <test-navigation>
|
|
381
|
+
* <test-container class="m-4 bg-white" test-url="./path/to/assessmenttest.xml"></test-container>
|
|
382
|
+
* </test-navigation>
|
|
383
|
+
* </qti-test>
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
declare class TestContainer extends LitElement {
|
|
387
|
+
#private;
|
|
388
|
+
/** Scoped registry used by the test shadow root. Must be set before connection. */
|
|
389
|
+
customElementRegistry: CustomElementRegistry | null;
|
|
390
|
+
/** URL of the item to load */
|
|
391
|
+
testURL: string;
|
|
392
|
+
/** A parsed HTML document */
|
|
393
|
+
testDoc: DocumentFragment;
|
|
394
|
+
/** The raw XML string */
|
|
395
|
+
testXML: string;
|
|
396
|
+
protected qtiContext: QtiContext;
|
|
397
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
398
|
+
/** Callback function to transform the test after loading */
|
|
399
|
+
protected handleTestURLChange(): Promise<void>;
|
|
400
|
+
protected handleTestXMLChange(): void;
|
|
401
|
+
connectedCallback(): Promise<void>;
|
|
402
|
+
render(): lit.TemplateResult<1>;
|
|
403
|
+
}
|
|
404
|
+
declare global {
|
|
405
|
+
interface HTMLElementTagNameMap {
|
|
406
|
+
'test-container': TestContainer;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
declare class TestPrintVariables extends LitElement {
|
|
411
|
+
computedContext?: ComputedContext;
|
|
412
|
+
static styles: lit.CSSResult;
|
|
413
|
+
render(): lit.TemplateResult<1>;
|
|
414
|
+
}
|
|
415
|
+
declare global {
|
|
416
|
+
interface HTMLElementTagNameMap {
|
|
417
|
+
'test-print-item-variables': TestPrintVariables;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @deprecated test-section-buttons-stamp is deprecated and will be removed in the future.
|
|
423
|
+
*/
|
|
424
|
+
declare class TestSectionButtonsStamp extends LitElement {
|
|
425
|
+
#private;
|
|
426
|
+
private computedContext;
|
|
427
|
+
myTemplate: TemplateFunction;
|
|
428
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
429
|
+
constructor();
|
|
430
|
+
connectedCallback(): void;
|
|
431
|
+
render(): lit.TemplateResult<1>;
|
|
432
|
+
}
|
|
433
|
+
declare global {
|
|
434
|
+
interface HTMLElementTagNameMap {
|
|
435
|
+
'test-section-buttons-stamp': TestSectionButtonsStamp;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
declare class TestSectionLink extends LitElement {
|
|
440
|
+
#private;
|
|
441
|
+
static styles: lit.CSSResult;
|
|
442
|
+
private sectionId;
|
|
443
|
+
constructor();
|
|
444
|
+
render(): lit.TemplateResult<1>;
|
|
445
|
+
}
|
|
446
|
+
declare global {
|
|
447
|
+
interface HTMLElementTagNameMap {
|
|
448
|
+
'test-section-link': TestSectionLink;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare class TestPrintContext extends LitElement {
|
|
453
|
+
computedContext?: ComputedContext;
|
|
454
|
+
render(): lit.TemplateResult<1>;
|
|
455
|
+
}
|
|
456
|
+
declare global {
|
|
457
|
+
interface HTMLElementTagNameMap {
|
|
458
|
+
'test-print-context': TestPrintContext;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* A custom web component that renders a test stamp using the Lit framework.
|
|
464
|
+
* This component is deprecated and will be removed in the future.
|
|
465
|
+
* @customElement
|
|
466
|
+
* @extends {LitElement}
|
|
467
|
+
*/
|
|
468
|
+
declare class TestStamp extends LitElement {
|
|
469
|
+
/**
|
|
470
|
+
* Indicates whether the component is in debug mode.
|
|
471
|
+
* When set to `true`, the available objects and properties (i.e.: stampContext) is displayed.
|
|
472
|
+
*/
|
|
473
|
+
debug: boolean;
|
|
474
|
+
private computedContext;
|
|
475
|
+
private stampContext;
|
|
476
|
+
myTemplate: TemplateFunction;
|
|
477
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
478
|
+
connectedCallback(): void;
|
|
479
|
+
protected willUpdate(_changedProperties: PropertyValues): void;
|
|
480
|
+
render(): lit.TemplateResult<1>;
|
|
481
|
+
}
|
|
482
|
+
declare global {
|
|
483
|
+
interface HTMLElementTagNameMap {
|
|
484
|
+
'test-stamp': TestStamp;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
declare class TestScoringButtons extends LitElement {
|
|
489
|
+
#private;
|
|
490
|
+
view: string;
|
|
491
|
+
disabled: boolean;
|
|
492
|
+
myTemplate: TemplateFunction | null;
|
|
493
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
494
|
+
connectedCallback(): void;
|
|
495
|
+
protected computedContext?: ComputedContext;
|
|
496
|
+
render(): lit.TemplateResult<1> | typeof nothing;
|
|
497
|
+
constructor();
|
|
498
|
+
}
|
|
499
|
+
declare global {
|
|
500
|
+
interface HTMLElementTagNameMap {
|
|
501
|
+
'test-scoring-buttons': TestScoringButtons;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
declare class TestViewToggle extends LitElement {
|
|
506
|
+
myTemplate: any;
|
|
507
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
508
|
+
private sessionContext;
|
|
509
|
+
connectedCallback(): void;
|
|
510
|
+
_switchView(view: string): void;
|
|
511
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
512
|
+
render(): lit.TemplateResult<1>;
|
|
513
|
+
}
|
|
514
|
+
declare global {
|
|
515
|
+
interface HTMLElementTagNameMap {
|
|
516
|
+
'test-view-toggle': TestViewToggle;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
declare class TestScoringFeedback extends LitElement {
|
|
521
|
+
protected computedContext?: ComputedContext;
|
|
522
|
+
view: View;
|
|
523
|
+
render(): lit.TemplateResult<1>;
|
|
524
|
+
}
|
|
525
|
+
declare global {
|
|
526
|
+
interface HTMLElementTagNameMap {
|
|
527
|
+
'test-scoring-feedback': TestScoringFeedback;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
declare class TestCheckItem extends LitElement {
|
|
532
|
+
static styles: lit.CSSResult;
|
|
533
|
+
constructor();
|
|
534
|
+
render(): lit.TemplateResult<1>;
|
|
535
|
+
}
|
|
536
|
+
declare global {
|
|
537
|
+
interface HTMLElementTagNameMap {
|
|
538
|
+
'test-check-item': TestCheckItem;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
type SpeechState = 'idle' | 'playing' | 'paused';
|
|
543
|
+
interface TtsContext {
|
|
544
|
+
state: SpeechState;
|
|
545
|
+
/** Index of the currently highlighted reading element (0-based). */
|
|
546
|
+
currentElementIndex: number;
|
|
547
|
+
/** Total number of navigable reading elements in the current item. */
|
|
548
|
+
elementCount: number;
|
|
549
|
+
play(): void;
|
|
550
|
+
pause(): void;
|
|
551
|
+
resume(): void;
|
|
552
|
+
stop(): void;
|
|
553
|
+
prevElement(): void;
|
|
554
|
+
nextElement(): void;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
declare const ttsContext: {
|
|
558
|
+
__context__: TtsContext;
|
|
559
|
+
};
|
|
560
|
+
/**
|
|
561
|
+
* Base class shared by all TTS control elements. Consumes `ttsContext` and
|
|
562
|
+
* mirrors the current speech state onto CSS custom states so each child can
|
|
563
|
+
* be styled with `:state(playing)`, `:state(paused)`, `:state(idle)`.
|
|
564
|
+
*/
|
|
565
|
+
declare abstract class TtsButtonBase extends LitElement {
|
|
566
|
+
#private;
|
|
567
|
+
static styles: lit.CSSResult;
|
|
568
|
+
protected _tts?: TtsContext;
|
|
569
|
+
updated(changed: PropertyValues): void;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* `<test-item-to-speech>` is the controller and context provider. It manages
|
|
573
|
+
* speech synthesis, word highlighting, and item element lookup. Compose your
|
|
574
|
+
* own player by placing control elements as children.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* ```html
|
|
578
|
+
* <test-item-to-speech language="nl-NL">
|
|
579
|
+
* <test-tts-play></test-tts-play>
|
|
580
|
+
* <test-tts-prev>◀◀</test-tts-prev>
|
|
581
|
+
* <test-tts-next>▶▶</test-tts-next>
|
|
582
|
+
* <test-tts-stop>■</test-tts-stop>
|
|
583
|
+
* </test-item-to-speech>
|
|
584
|
+
* ```
|
|
585
|
+
*
|
|
586
|
+
* @cssstate idle - No speech active
|
|
587
|
+
* @cssstate playing - Speech is playing
|
|
588
|
+
* @cssstate paused - Speech is paused
|
|
589
|
+
*/
|
|
590
|
+
declare class TestItemToSpeech extends LitElement {
|
|
591
|
+
#private;
|
|
592
|
+
language: string;
|
|
593
|
+
protected _sessionContext?: SessionContext;
|
|
594
|
+
_ttsContext: TtsContext;
|
|
595
|
+
constructor();
|
|
596
|
+
willUpdate(changed: PropertyValues): void;
|
|
597
|
+
updated(_changed: PropertyValues): void;
|
|
598
|
+
connectedCallback(): void;
|
|
599
|
+
disconnectedCallback(): void;
|
|
600
|
+
render(): lit.TemplateResult<1>;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Play/pause/resume toggle button — always enabled, cycles through states.
|
|
604
|
+
* Use named slots `play` and `pause` to customise the icons/labels independently.
|
|
605
|
+
*
|
|
606
|
+
* @example
|
|
607
|
+
* ```html
|
|
608
|
+
* <test-tts-play>
|
|
609
|
+
* <span slot="play">▶ Play</span>
|
|
610
|
+
* <span slot="pause">⏸ Pause</span>
|
|
611
|
+
* </test-tts-play>
|
|
612
|
+
* ```
|
|
613
|
+
*
|
|
614
|
+
* @cssstate idle / playing / paused
|
|
615
|
+
* @csspart button
|
|
616
|
+
*/
|
|
617
|
+
declare class TestTtsPlay extends TtsButtonBase {
|
|
618
|
+
#private;
|
|
619
|
+
render(): lit.TemplateResult<1>;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Pause button — enabled only when playing.
|
|
623
|
+
* @cssstate idle / playing / paused
|
|
624
|
+
* @csspart button
|
|
625
|
+
*/
|
|
626
|
+
declare class TestTtsPause extends TtsButtonBase {
|
|
627
|
+
render(): lit.TemplateResult<1>;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Resume button — enabled only when paused.
|
|
631
|
+
* @cssstate idle / playing / paused
|
|
632
|
+
* @csspart button
|
|
633
|
+
*/
|
|
634
|
+
declare class TestTtsResume extends TtsButtonBase {
|
|
635
|
+
render(): lit.TemplateResult<1>;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Stop button — enabled when playing or paused.
|
|
639
|
+
* @cssstate idle / playing / paused
|
|
640
|
+
* @csspart button
|
|
641
|
+
*/
|
|
642
|
+
declare class TestTtsStop extends TtsButtonBase {
|
|
643
|
+
render(): lit.TemplateResult<1>;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Prev-element button — moves cursor to the previous reading element and pauses.
|
|
647
|
+
* Disabled at the first element or when no elements are loaded.
|
|
648
|
+
* @cssstate idle / playing / paused
|
|
649
|
+
* @csspart button
|
|
650
|
+
*/
|
|
651
|
+
declare class TestTtsPrev extends TtsButtonBase {
|
|
652
|
+
render(): lit.TemplateResult<1>;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Next-element button — moves cursor to the next reading element and pauses.
|
|
656
|
+
* Disabled at the last element or when no elements are loaded.
|
|
657
|
+
* @cssstate idle / playing / paused
|
|
658
|
+
* @csspart button
|
|
659
|
+
*/
|
|
660
|
+
declare class TestTtsNext extends TtsButtonBase {
|
|
661
|
+
render(): lit.TemplateResult<1>;
|
|
662
|
+
}
|
|
663
|
+
declare global {
|
|
664
|
+
interface HTMLElementTagNameMap {
|
|
665
|
+
'test-item-to-speech': TestItemToSpeech;
|
|
666
|
+
'test-tts-play': TestTtsPlay;
|
|
667
|
+
'test-tts-pause': TestTtsPause;
|
|
668
|
+
'test-tts-resume': TestTtsResume;
|
|
669
|
+
'test-tts-stop': TestTtsStop;
|
|
670
|
+
'test-tts-prev': TestTtsPrev;
|
|
671
|
+
'test-tts-next': TestTtsNext;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, IMyQtiTest {
|
|
676
|
+
}
|
|
677
|
+
interface IMyQtiTest {
|
|
678
|
+
testContext: Readonly<TestContext>;
|
|
679
|
+
sessionContext: Readonly<SessionContext>;
|
|
680
|
+
configContext: ConfigContext;
|
|
681
|
+
updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;
|
|
682
|
+
}
|
|
683
|
+
interface ITestNavigationMixin {
|
|
684
|
+
navigate: 'item' | 'section' | null;
|
|
685
|
+
requestTimeout: number;
|
|
686
|
+
showLoadingIndicators: boolean;
|
|
687
|
+
postLoadTransformCallback: PostLoadTransformCallback | null;
|
|
688
|
+
postLoadTestTransformCallback: PostLoadTestTransformCallback | null;
|
|
689
|
+
navigateTo(type: 'item' | 'section', id?: string): void;
|
|
690
|
+
retryNavigation(): void;
|
|
691
|
+
}
|
|
692
|
+
interface ITestProcessingMixin {
|
|
693
|
+
updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;
|
|
694
|
+
getOutcome(identifier: string): Readonly<OutcomeVariable>;
|
|
695
|
+
getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
|
|
696
|
+
outcomeProcessing(): boolean;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
export { type IMyQtiTest, type IQtiTest, type ITestNavigationMixin, type ITestProcessingMixin, QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiOutcomeProcessing, QtiOutcomeProcessingProcessor, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, QtiTestVariablesExpression, type SpeechState, TestCheckItem, TestContainer, TestEndAttempt, TestItemLink, TestItemToSpeech, TestNavigation, TestNext, TestPagingButtonsStamp, TestPrev, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestSectionButtonsStamp, TestSectionLink, TestStamp, TestTtsNext, TestTtsPause, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop, TestView, TestViewToggle, type TtsContext, ttsContext };
|