@citolab/qti-components 9.3.0 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +217 -204
- package/dist/base.d.ts +10 -10
- package/dist/base.js +1 -1
- package/dist/{chunk-G5RQ5GKG.js → chunk-3BAQWO5C.js} +2 -2
- package/dist/{chunk-ZG7FBQFP.js → chunk-ACRN7YJM.js} +2 -2
- package/dist/{chunk-JLZCZVRX.js → chunk-B5XHZI2P.js} +2 -2
- package/dist/{chunk-RAJQKCQ3.js → chunk-B74SYQB2.js} +2 -2
- package/dist/{chunk-YIYHCHHM.js → chunk-BMXG7D2N.js} +2 -2
- package/dist/{chunk-FG5JAWSN.js → chunk-C3JPUV36.js} +2 -2
- package/dist/{chunk-TDWLV5OD.js → chunk-GNTO3IFM.js} +559 -251
- package/dist/chunk-GNTO3IFM.js.map +1 -0
- package/dist/{chunk-7VDR765S.js → chunk-JHPQJDAV.js} +2 -2
- package/dist/{chunk-CQHGVPOT.js → chunk-LKHRHFXO.js} +6 -6
- package/dist/{chunk-JGPWBIVD.js → chunk-MSGYZE6L.js} +2 -2
- package/dist/{chunk-YVZWNLF4.js → chunk-R7MMMDP7.js} +139 -18
- package/dist/chunk-R7MMMDP7.js.map +1 -0
- package/dist/{chunk-REKCRWJV.js → chunk-XEWGFAS4.js} +166 -104
- package/dist/chunk-XEWGFAS4.js.map +1 -0
- package/dist/{computed.types.d-DB5gfOh9.d.ts → computed.types.d-gJrBeUMG.d.ts} +1 -1
- package/dist/corrections.d.ts +9 -9
- package/dist/corrections.js +7 -7
- package/dist/elements.d.ts +46 -6
- package/dist/elements.js +5 -3
- package/dist/index.d.ts +12 -12
- package/dist/index.js +16 -12
- package/dist/{interaction.d-DegNJ5ZA.d.ts → interaction.d-g6XG0T0Z.d.ts} +2 -2
- package/dist/interactions.d.ts +4 -4
- package/dist/interactions.js +3 -3
- package/dist/item.d.ts +4 -4
- package/dist/item.js +3 -3
- package/dist/{item.types.d-BDFrq19E.d.ts → item.types.d-B55QkJ92.d.ts} +10 -0
- package/dist/loader.d.ts +2 -2
- package/dist/processing.d.ts +3 -3
- package/dist/processing.js +3 -3
- package/dist/qti-components-jsx.d.ts +353 -266
- package/dist/{qti-condition-expression.d-DLboq8bR.d.ts → qti-condition-expression.d-L7yb3Rzy.d.ts} +1 -1
- package/dist/{qti-expression.d-BksT9iLB.d.ts → qti-expression.d-CuaLjZ6g.d.ts} +1 -1
- package/dist/{qti-feedback.d-D-w6-mJv.d.ts → qti-feedback.d-wMYNVkkj.d.ts} +2 -3
- package/dist/{qti-item.d-D_-9_0e6.d.ts → qti-item.d-DgC1AQbY.d.ts} +1 -1
- package/dist/{qti-test.d-D-ELy0Mr.d.ts → qti-test.d-Cud5Gvy0.d.ts} +204 -42
- package/dist/{qti-text-entry-interaction.d-CATtcPyX.d.ts → qti-text-entry-interaction.d-DKvz9ncv.d.ts} +2 -2
- package/dist/{session.context.d-Cjs0BkJB.d.ts → session.context.d-D5080LVx.d.ts} +3 -1
- package/dist/test.d.ts +58 -11
- package/dist/test.js +6 -4
- package/package.json +4 -4
- package/dist/chunk-REKCRWJV.js.map +0 -1
- package/dist/chunk-TDWLV5OD.js.map +0 -1
- package/dist/chunk-YVZWNLF4.js.map +0 -1
- /package/dist/{chunk-G5RQ5GKG.js.map → chunk-3BAQWO5C.js.map} +0 -0
- /package/dist/{chunk-ZG7FBQFP.js.map → chunk-ACRN7YJM.js.map} +0 -0
- /package/dist/{chunk-JLZCZVRX.js.map → chunk-B5XHZI2P.js.map} +0 -0
- /package/dist/{chunk-RAJQKCQ3.js.map → chunk-B74SYQB2.js.map} +0 -0
- /package/dist/{chunk-YIYHCHHM.js.map → chunk-BMXG7D2N.js.map} +0 -0
- /package/dist/{chunk-FG5JAWSN.js.map → chunk-C3JPUV36.js.map} +0 -0
- /package/dist/{chunk-7VDR765S.js.map → chunk-JHPQJDAV.js.map} +0 -0
- /package/dist/{chunk-CQHGVPOT.js.map → chunk-LKHRHFXO.js.map} +0 -0
- /package/dist/{chunk-JGPWBIVD.js.map → chunk-MSGYZE6L.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
import { b as ItemContext, V as VariableDeclaration, g as ResponseVariable, B as BaseType } from './item.types.d-
|
|
3
|
+
import { b as ItemContext, V as VariableDeclaration, g as ResponseVariable, B as BaseType } from './item.types.d-B55QkJ92.js';
|
|
4
4
|
import { a as QtiContextType, Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
5
5
|
|
|
6
6
|
interface TestContext {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
import { a as Cardinality } from './item.types.d-
|
|
3
|
+
import { a as Cardinality } from './item.types.d-B55QkJ92.js';
|
|
4
4
|
|
|
5
5
|
declare abstract class QtiVariableDeclaration extends LitElement {
|
|
6
6
|
render(): lit.TemplateResult<1>;
|
|
@@ -13,9 +13,8 @@ declare abstract class QtiFeedback extends LitElement {
|
|
|
13
13
|
outcomeIdentifier: string;
|
|
14
14
|
protected identifier: string;
|
|
15
15
|
showStatus: string;
|
|
16
|
-
private _context
|
|
16
|
+
private get _context();
|
|
17
17
|
private _computedContext?;
|
|
18
|
-
connectedCallback(): void;
|
|
19
18
|
checkShowFeedback(outcomeIdentifier: string): void;
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
4
|
-
import { C as ComputedItemContext, V as View } from './session.context.d-
|
|
4
|
+
import { C as ComputedItemContext, V as View } from './session.context.d-D5080LVx.js';
|
|
5
5
|
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
6
6
|
import { QtiAssessmentItem } from './elements.js';
|
|
7
7
|
|
|
@@ -1,15 +1,49 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, PropertyValues, nothing } from 'lit';
|
|
3
|
-
import {
|
|
4
|
-
import { C as ComputedContext, a as ComputedItem } from './computed.types.d-
|
|
3
|
+
import { b as transformTestApi, t as transformItemApi } from './qti-transform-test.d-BL7GGFJj.js';
|
|
4
|
+
import { C as ComputedContext, a as ComputedItem } from './computed.types.d-gJrBeUMG.js';
|
|
5
5
|
import { QtiAssessmentItem, QtiModalFeedback } from './elements.js';
|
|
6
|
+
import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
7
|
+
import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-CuaLjZ6g.js';
|
|
6
8
|
import { TemplateFunction } from '@heximal/templates';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { S as SessionContext, V as View } from './session.context.d-Cjs0BkJB.js';
|
|
9
|
+
import { h as VariableValue, b as ItemContext, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-B55QkJ92.js';
|
|
10
|
+
import { S as SessionContext, V as View } from './session.context.d-D5080LVx.js';
|
|
10
11
|
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
11
12
|
import { b as QtiRuleBase } from './qti-rule-base.d-Bdzg8eGH.js';
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
declare class QtiAssessmentTest extends LitElement {
|
|
15
|
+
#private;
|
|
16
|
+
identifier: string;
|
|
17
|
+
get title(): string;
|
|
18
|
+
set title(value: string);
|
|
19
|
+
_testContext?: TestContext;
|
|
20
|
+
connectedCallback(): Promise<void>;
|
|
21
|
+
render(): lit.TemplateResult<1>;
|
|
22
|
+
}
|
|
23
|
+
declare global {
|
|
24
|
+
interface HTMLElementTagNameMap {
|
|
25
|
+
'qti-assessment-test': QtiAssessmentTest;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Defined here, and re-exported by the navigation mixin under the same name, so this file imports
|
|
31
|
+
* nothing from the mixin: the mixin imports the components that consume this context, and a type
|
|
32
|
+
* import counts as a dependency for madge.
|
|
33
|
+
*/
|
|
34
|
+
type PostLoadTestTransformCallback = (transformer: transformTestApi, testElement: QtiAssessmentTest) => transformTestApi | Promise<transformTestApi>;
|
|
35
|
+
/**
|
|
36
|
+
* What the components inside a test need from the `qti-test` that contains them: the things a host
|
|
37
|
+
* put on it, and the element to query. Provided by `qti-test` about itself.
|
|
38
|
+
*
|
|
39
|
+
* It is context and not `closest('qti-test')` because a request crosses shadow roots and `closest`
|
|
40
|
+
* stops at the first one, so a navigation or container a host renders inside its own component
|
|
41
|
+
* would never find its test. Internal on purpose: not exported from the package, and not API.
|
|
42
|
+
*/
|
|
43
|
+
interface TestHost extends HTMLElement {
|
|
44
|
+
qtiContext: QtiContext;
|
|
45
|
+
postLoadTestTransformCallback: PostLoadTestTransformCallback | null;
|
|
46
|
+
}
|
|
13
47
|
|
|
14
48
|
/**
|
|
15
49
|
* The model a `<template item-ref>` is rendered with.
|
|
@@ -56,6 +90,9 @@ declare class QtiAssessmentItemRef extends LitElement {
|
|
|
56
90
|
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
57
91
|
get assessmentItem(): QtiAssessmentItem | null;
|
|
58
92
|
myTemplate: TemplateFunction | null;
|
|
93
|
+
/** The `qti-test` this ref belongs to, wherever it renders: light DOM, or any depth of shadow roots. */
|
|
94
|
+
protected testHost?: TestHost;
|
|
95
|
+
disconnectedCallback(): void;
|
|
59
96
|
connectedCallback(): Promise<void>;
|
|
60
97
|
render(): unknown;
|
|
61
98
|
}
|
|
@@ -86,21 +123,6 @@ declare global {
|
|
|
86
123
|
}
|
|
87
124
|
}
|
|
88
125
|
|
|
89
|
-
declare class QtiAssessmentTest extends LitElement {
|
|
90
|
-
#private;
|
|
91
|
-
identifier: string;
|
|
92
|
-
get title(): string;
|
|
93
|
-
set title(value: string);
|
|
94
|
-
_testContext?: TestContext;
|
|
95
|
-
connectedCallback(): Promise<void>;
|
|
96
|
-
render(): lit.TemplateResult<1>;
|
|
97
|
-
}
|
|
98
|
-
declare global {
|
|
99
|
-
interface HTMLElementTagNameMap {
|
|
100
|
-
'qti-assessment-test': QtiAssessmentTest;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
126
|
/**
|
|
105
127
|
* @summary The qti-item-session-control element contains configurations relating to flow of test sessions.
|
|
106
128
|
* @documentation https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/imsqti_asi_v3p0p1_infomodel_v1p0.html#Derived_ItemSessionControl
|
|
@@ -214,12 +236,16 @@ interface TestBaseInterface extends LitElement {
|
|
|
214
236
|
testContext: Readonly<TestContext>;
|
|
215
237
|
sessionContext: Readonly<SessionContext>;
|
|
216
238
|
configContext?: Readonly<ConfigContext>;
|
|
239
|
+
/** Provided by `qti-test`. */
|
|
240
|
+
qtiContext?: Readonly<QtiContext>;
|
|
217
241
|
_testElement: QtiAssessmentTest;
|
|
218
|
-
updateItemVariables(itemRefID: string, variables:
|
|
242
|
+
updateItemVariables(itemRefID: string, variables: readonly ItemVariableValue[], state?: ItemContext['state']): void;
|
|
219
243
|
}
|
|
244
|
+
/** A value to set on an item; `type` is only needed for a variable the item does not declare. */
|
|
245
|
+
type ItemVariableValue = Pick<VariableValue<string | string[] | null>, 'identifier' | 'value'> & Partial<Pick<VariableValue<string | string[] | null>, 'type'>>;
|
|
220
246
|
|
|
221
247
|
type PostLoadTransformCallback = (transformer: transformItemApi, itemRef: QtiAssessmentItemRef) => transformItemApi | Promise<transformItemApi>;
|
|
222
|
-
|
|
248
|
+
|
|
223
249
|
/**
|
|
224
250
|
* Exactly what this mixin adds. `IQtiTest` composes it (see ../types/iqti-test, which
|
|
225
251
|
* re-exports it), and `TestNavigationClass` below `implements` it, so the interface and the
|
|
@@ -250,6 +276,72 @@ interface ITestNavigationMixin {
|
|
|
250
276
|
};
|
|
251
277
|
}
|
|
252
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Everything a host needs to persist to resume a candidate's test session, and nothing else.
|
|
281
|
+
*
|
|
282
|
+
* Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —
|
|
283
|
+
* a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
|
|
284
|
+
*
|
|
285
|
+
* Deliberately not here:
|
|
286
|
+
* - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes
|
|
287
|
+
* from the item XML on every load, and persisting the answer key with the candidate's data is
|
|
288
|
+
* both bloat and a leak;
|
|
289
|
+
* - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.
|
|
290
|
+
* The shuffle `seed` in particular must be passed in again, or the restored order changes;
|
|
291
|
+
* - `view`: a role the host decides, not something the candidate produced;
|
|
292
|
+
* - anything computed — scores per section, `done`, `active` — which is rederived from this.
|
|
293
|
+
*/
|
|
294
|
+
interface QtiTestState {
|
|
295
|
+
/** Bumped on any incompatible change to this shape. A state with another version is ignored. */
|
|
296
|
+
version: 1;
|
|
297
|
+
test: {
|
|
298
|
+
items: QtiTestStateItem[];
|
|
299
|
+
/** Test-level outcome values. Only outcomes the test declares are restored. */
|
|
300
|
+
outcomes: QtiTestStateValue[];
|
|
301
|
+
};
|
|
302
|
+
session: QtiTestStateSession;
|
|
303
|
+
}
|
|
304
|
+
interface QtiTestStateItem {
|
|
305
|
+
/** The `qti-assessment-item-ref` identifier. */
|
|
306
|
+
identifier: string;
|
|
307
|
+
variables: (QtiTestStateValue & {
|
|
308
|
+
type?: 'response' | 'outcome' | 'template' | 'context';
|
|
309
|
+
})[];
|
|
310
|
+
/** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */
|
|
311
|
+
state?: Record<string, string | null>;
|
|
312
|
+
}
|
|
313
|
+
interface QtiTestStateValue {
|
|
314
|
+
identifier: string;
|
|
315
|
+
value: string | string[] | null;
|
|
316
|
+
}
|
|
317
|
+
/** Where the candidate is. */
|
|
318
|
+
interface QtiTestStateSession {
|
|
319
|
+
navPartId?: string | null;
|
|
320
|
+
navSectionId?: string | null;
|
|
321
|
+
navItemRefId?: string | null;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
declare global {
|
|
325
|
+
interface GlobalEventHandlersEventMap {
|
|
326
|
+
'qti-state-changed': CustomEvent<QtiTestState>;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
interface ITestStateMixin {
|
|
330
|
+
/**
|
|
331
|
+
* The candidate's persistable state: what they answered and where they are.
|
|
332
|
+
*
|
|
333
|
+
* Assign a stored state to resume. It may be assigned at any time: before the test document
|
|
334
|
+
* has loaded it is held and applied as soon as the test connects — before the first item
|
|
335
|
+
* loads, so items and the initial navigation start from it — and after that it is applied
|
|
336
|
+
* immediately and the test navigates to the restored position.
|
|
337
|
+
*
|
|
338
|
+
* Items are matched by item-ref identifier; items the state does not mention start fresh, and
|
|
339
|
+
* stored items, test outcomes or a position the test no longer has are ignored. Restoring is a
|
|
340
|
+
* resume, so linear-mode navigation restrictions do not apply.
|
|
341
|
+
*/
|
|
342
|
+
state: QtiTestState;
|
|
343
|
+
}
|
|
344
|
+
|
|
253
345
|
type CustomEventMap = {
|
|
254
346
|
'test-end-attempt': CustomEvent;
|
|
255
347
|
};
|
|
@@ -264,7 +356,15 @@ declare class TestNavigation extends LitElement {
|
|
|
264
356
|
identifier: string;
|
|
265
357
|
[key: string]: any;
|
|
266
358
|
}[];
|
|
267
|
-
|
|
359
|
+
/**
|
|
360
|
+
* @deprecated Set `qtiContext` on `qti-test`, which provides it. This is an alias for the
|
|
361
|
+
* enclosing test's: reading returns it, writing replaces it, so a host that has always set the
|
|
362
|
+
* shuffle seed here keeps working. Removed in the next major.
|
|
363
|
+
*
|
|
364
|
+
* Written before the navigation is inside a test, it waits and is handed over on connect.
|
|
365
|
+
*/
|
|
366
|
+
get qtiContext(): QtiContext;
|
|
367
|
+
set qtiContext(value: QtiContext);
|
|
268
368
|
configContext: ConfigContext;
|
|
269
369
|
protected _testContext?: TestContext;
|
|
270
370
|
protected _sessionContext?: SessionContext;
|
|
@@ -443,6 +543,8 @@ declare class TestContainer extends LitElement {
|
|
|
443
543
|
testDoc: DocumentFragment | null;
|
|
444
544
|
/** The raw XML string */
|
|
445
545
|
testXML: string | null;
|
|
546
|
+
/** The `qti-test` this container is in: where the host's `postLoadTestTransformCallback` lives. */
|
|
547
|
+
protected testHost?: TestHost;
|
|
446
548
|
protected qtiContext: QtiContext;
|
|
447
549
|
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
448
550
|
/** Callback function to transform the test after loading */
|
|
@@ -543,7 +645,7 @@ declare class TestScoringButtons extends LitElement {
|
|
|
543
645
|
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
544
646
|
connectedCallback(): void;
|
|
545
647
|
protected computedContext?: ComputedContext;
|
|
546
|
-
render():
|
|
648
|
+
render(): lit.TemplateResult<1> | typeof nothing;
|
|
547
649
|
constructor();
|
|
548
650
|
}
|
|
549
651
|
declare global {
|
|
@@ -579,6 +681,7 @@ declare global {
|
|
|
579
681
|
}
|
|
580
682
|
|
|
581
683
|
declare class TestCheckItem extends LitElement {
|
|
684
|
+
protected testHost?: TestHost;
|
|
582
685
|
static styles: lit.CSSResult;
|
|
583
686
|
constructor();
|
|
584
687
|
render(): lit.TemplateResult<1>;
|
|
@@ -661,17 +764,66 @@ declare abstract class TtsButtonBase extends LitElement {
|
|
|
661
764
|
* The transformer copies `xml:lang` over as a plain `lang` attribute, so QTI authored with
|
|
662
765
|
* `xml:lang="en-GB"` on a `<p>` or on the item root is honoured without further work.
|
|
663
766
|
*
|
|
664
|
-
* ###
|
|
767
|
+
* ### What is read
|
|
768
|
+
*
|
|
769
|
+
* Decided once per connect, by where the player is placed. The first rule that matches wins:
|
|
770
|
+
*
|
|
771
|
+
* 1. **Next to a stimulus placeholder** — the player shares its parent with a
|
|
772
|
+
* `[data-stimulus-idref]` element, e.g. in a reading-text panel beside the questions: the
|
|
773
|
+
* player reads that stimulus (its `qti-stimulus-body`), and only that. Not inside the
|
|
774
|
+
* placeholder: loading a stimulus replaces the placeholder's content. Items and navigation
|
|
775
|
+
* are ignored; when the stimulus is (re)loaded or the placeholder swapped, the player starts
|
|
776
|
+
* over on the new content.
|
|
777
|
+
* 2. **Next to `[data-tts-content]`** — the player shares its parent with an element marked
|
|
778
|
+
* `data-tts-content`: any HTML, not QTI, e.g. a start screen rendered by React. The marker goes
|
|
779
|
+
* on one container; the player reads the readable elements inside it. Navigation is ignored.
|
|
780
|
+
* The reading list is rebuilt when the player starts from the top, and when an element in it
|
|
781
|
+
* has left the page — so a re-render of the content never interrupts speech.
|
|
782
|
+
* 3. **Inside a `qti-assessment-item-ref`** — e.g. in a `<template item-ref>` on `<qti-test>`,
|
|
783
|
+
* so every item gets a player of its own: the player reads that item, and only that item.
|
|
784
|
+
* The navigation cursor is ignored; speech stops when the player leaves the page with its item.
|
|
785
|
+
* 4. **Anywhere else** — a toolbar in the page chrome: the player follows the navigation cursor
|
|
786
|
+
* and reads the item `navItemRefId` (session context) points at, found in any
|
|
787
|
+
* `test-container` reachable from the player. Navigating stops speech and starts the next
|
|
788
|
+
* item from the top.
|
|
789
|
+
*
|
|
790
|
+
* ```html
|
|
791
|
+
* <!-- 1. a player for the shared reading text -->
|
|
792
|
+
* <aside>
|
|
793
|
+
* <test-item-to-speech>…</test-item-to-speech>
|
|
794
|
+
* <div data-stimulus-idref="Stimulus1"></div>
|
|
795
|
+
* </aside>
|
|
796
|
+
*
|
|
797
|
+
* <!-- 2. a player for any other HTML -->
|
|
798
|
+
* <div>
|
|
799
|
+
* <test-item-to-speech>…</test-item-to-speech>
|
|
800
|
+
* <section data-tts-content lang="nl-NL">…</section>
|
|
801
|
+
* </div>
|
|
802
|
+
*
|
|
803
|
+
* <!-- 3. one player per item -->
|
|
804
|
+
* <qti-test>
|
|
805
|
+
* <template item-ref>
|
|
806
|
+
* <test-item-to-speech>…</test-item-to-speech>
|
|
807
|
+
* {{ xmlDoc }}
|
|
808
|
+
* </template>
|
|
809
|
+
* …
|
|
810
|
+
* </qti-test>
|
|
811
|
+
*
|
|
812
|
+
* <!-- 4. one player in the toolbar, following navigation -->
|
|
813
|
+
* <test-navigation>
|
|
814
|
+
* <header><test-item-to-speech>…</test-item-to-speech></header>
|
|
815
|
+
* <test-container test-url="…"></test-container>
|
|
816
|
+
* </test-navigation>
|
|
817
|
+
* ```
|
|
665
818
|
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
670
|
-
* `qti-assessment-item-ref` identifier, in the player's own tree first and otherwise in
|
|
671
|
-
* any `test-container` shadow root reachable from it, so the player can live inside the
|
|
672
|
-
* item card, next to it, or in the page chrome.
|
|
819
|
+
* In modes 3 and 4 the item re-rendering (navigating to the item already shown) restarts the
|
|
820
|
+
* player on the fresh content. An item player reads the item body as rendered: a stimulus
|
|
821
|
+
* placed inside the item is read with it, one placed outside (mode 1) is not. Only one player
|
|
822
|
+
* can speak at a time; starting one stops any other.
|
|
673
823
|
*
|
|
674
|
-
*
|
|
824
|
+
* Read are `p`, `h1`–`h6`, `li`, `dt`, `dd`, `th`, `td`, `caption`, `blockquote`, `figcaption`,
|
|
825
|
+
* `qti-prompt` and `qti-simple-choice` — the innermost match only — unless hidden (`display: none`)
|
|
826
|
+
* or inside `aria-hidden="true"`.
|
|
675
827
|
*
|
|
676
828
|
* ### Starting somewhere in the middle
|
|
677
829
|
*
|
|
@@ -689,16 +841,12 @@ declare class TestItemToSpeech extends LitElement {
|
|
|
689
841
|
static styles: lit.CSSResult;
|
|
690
842
|
/** Fallback language when neither the item content nor the document declares one. */
|
|
691
843
|
language: string;
|
|
692
|
-
/**
|
|
693
|
-
* Identifier of the `qti-assessment-item-ref` this player reads. Leave unset to follow the
|
|
694
|
-
* navigation cursor (`navItemRefId`) instead.
|
|
695
|
-
*/
|
|
696
|
-
itemRefId?: string;
|
|
697
844
|
protected _sessionContext?: SessionContext;
|
|
845
|
+
/** The `qti-test` this player is in, across shadow roots. */
|
|
846
|
+
protected testHost?: TestHost;
|
|
698
847
|
_ttsContext: TtsContext;
|
|
699
848
|
constructor();
|
|
700
849
|
willUpdate(changed: PropertyValues): void;
|
|
701
|
-
updated(changed: PropertyValues): void;
|
|
702
850
|
connectedCallback(): void;
|
|
703
851
|
disconnectedCallback(): void;
|
|
704
852
|
render(): lit.TemplateResult<1>;
|
|
@@ -800,7 +948,7 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
|
|
|
800
948
|
getOutcome(identifier: string): Readonly<OutcomeVariable>;
|
|
801
949
|
getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
|
|
802
950
|
outcomeProcessing(): boolean;
|
|
803
|
-
}) & (abstract new (...args: any[]) => TestBaseInterface) & typeof LitElement;
|
|
951
|
+
}) & (abstract new (...args: any[]) => ITestStateMixin) & (abstract new (...args: any[]) => TestBaseInterface) & typeof LitElement;
|
|
804
952
|
/**
|
|
805
953
|
* `<qti-test>` is a custom element designed for rendering and interacting with QTI (Question and Test Interoperability) tests.
|
|
806
954
|
*
|
|
@@ -848,9 +996,23 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
|
|
|
848
996
|
* You can use normal class names to style the elements.
|
|
849
997
|
* And you can use the `test-prev` and `test-next` elements to navigate through the test.
|
|
850
998
|
*
|
|
999
|
+
* @event qti-state-changed - The candidate's persistable state changed. `detail` is a `QtiTestState`; assign it back to `state` to resume.
|
|
1000
|
+
* @event qti-test-context-updated - Deprecated: listen to `qti-state-changed` to persist a session. `detail` is the full test context, including declaration metadata and the answer key. Removed in the next major.
|
|
851
1001
|
*/
|
|
852
1002
|
declare class QtiTest extends QtiTest_base {
|
|
1003
|
+
constructor();
|
|
853
1004
|
configContext: ConfigContext;
|
|
1005
|
+
/**
|
|
1006
|
+
* Who is taking which test, and the optional shuffle `seed`. Provided here, at the test, so
|
|
1007
|
+
* everything inside reads one value: the test-container shuffling the item order, the test
|
|
1008
|
+
* shuffling interactions as it navigates, and the expressions that read `QTI_CONTEXT`.
|
|
1009
|
+
*
|
|
1010
|
+
* Pass the same `seed` when resuming a session, or the order comes back different. Replace the
|
|
1011
|
+
* object, do not mutate it: an in-place change does not notify the components inside.
|
|
1012
|
+
*
|
|
1013
|
+
* `test-navigation.qtiContext` is an alias of this.
|
|
1014
|
+
*/
|
|
1015
|
+
qtiContext: QtiContext;
|
|
854
1016
|
/**
|
|
855
1017
|
* Renders the component's template.
|
|
856
1018
|
* Provides a default `<slot>` for content projection.
|
|
@@ -864,4 +1026,4 @@ declare global {
|
|
|
864
1026
|
}
|
|
865
1027
|
}
|
|
866
1028
|
|
|
867
|
-
export {
|
|
1029
|
+
export { TestSectionLink as A, TestStamp as B, TestTtsNext as C, TestTtsPause as D, TestTtsPick as E, TestTtsPlay as F, TestTtsPrev as G, TestTtsResume as H, type ITestNavigationMixin as I, TestTtsStop as J, TestView as K, TestViewToggle as L, type TtsContext as M, ttsContext as N, type ItemVariableValue as O, QtiAssessmentItemRef as Q, type SpeechState as S, TestCheckItem as T, type ITestStateMixin as a, type ItemRefTemplateModel as b, QtiAssessmentSection as c, QtiAssessmentTest as d, QtiItemSessionControl as e, QtiNumberSelected as f, QtiOutcomeProcessing as g, QtiOutcomeProcessingProcessor as h, QtiTest as i, QtiTestFeedback as j, QtiTestPart as k, QtiTestVariables as l, QtiTestVariablesExpression as m, TestContainer as n, TestEndAttempt as o, TestItemLink as p, TestItemToSpeech as q, TestNavigation as r, TestNext as s, TestPagingButtonsStamp as t, TestPrev as u, TestPrintContext as v, TestPrintVariables as w, TestScoringButtons as x, TestScoringFeedback as y, TestSectionButtonsStamp as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, CSSResultGroup, PropertyValues } from 'lit';
|
|
3
|
-
import { I as Interaction } from './interaction.d-
|
|
3
|
+
import { I as Interaction } from './interaction.d-g6XG0T0Z.js';
|
|
4
4
|
import { V as ValidatableInteraction } from './interaction.interface.d-CvjHM2bi.js';
|
|
5
5
|
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
6
|
-
import { B as BaseType, a as Cardinality, b as ItemContext, Q as QtiAreaMapEntry } from './item.types.d-
|
|
6
|
+
import { B as BaseType, a as Cardinality, b as ItemContext, Q as QtiAreaMapEntry } from './item.types.d-B55QkJ92.js';
|
|
7
7
|
import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
|
|
8
8
|
import * as lit_directives_ref_js from 'lit/directives/ref.js';
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as VariableDeclaration } from './item.types.d-
|
|
1
|
+
import { V as VariableDeclaration } from './item.types.d-B55QkJ92.js';
|
|
2
2
|
|
|
3
3
|
type ComputedItemContext = {
|
|
4
4
|
identifier: string;
|
|
@@ -21,7 +21,9 @@ interface SessionContext {
|
|
|
21
21
|
navPartId?: string | null;
|
|
22
22
|
navSectionId?: string | null;
|
|
23
23
|
navItemRefId?: string | null;
|
|
24
|
+
/** @deprecated Never set by the library. Removed in the next major. */
|
|
24
25
|
navItemLoading?: boolean;
|
|
26
|
+
/** @deprecated Never set by the library. Removed in the next major. */
|
|
25
27
|
navTestLoading?: boolean;
|
|
26
28
|
view?: View;
|
|
27
29
|
}
|
package/dist/test.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { I as ITestNavigationMixin } from './qti-test.d-
|
|
2
|
-
export {
|
|
1
|
+
import { O as ItemVariableValue, I as ITestNavigationMixin, a as ITestStateMixin } from './qti-test.d-Cud5Gvy0.js';
|
|
2
|
+
export { b as ItemRefTemplateModel, Q as QtiAssessmentItemRef, c as QtiAssessmentSection, d as QtiAssessmentTest, e as QtiItemSessionControl, f as QtiNumberSelected, g as QtiOutcomeProcessing, h as QtiOutcomeProcessingProcessor, i as QtiTest, j as QtiTestFeedback, k as QtiTestPart, l as QtiTestVariables, m as QtiTestVariablesExpression, S as SpeechState, T as TestCheckItem, n as TestContainer, o as TestEndAttempt, p as TestItemLink, q as TestItemToSpeech, r as TestNavigation, s as TestNext, t as TestPagingButtonsStamp, u as TestPrev, v as TestPrintContext, w as TestPrintVariables, x as TestScoringButtons, y as TestScoringFeedback, z as TestSectionButtonsStamp, A as TestSectionLink, B as TestStamp, C as TestTtsNext, D as TestTtsPause, E as TestTtsPick, F as TestTtsPlay, G as TestTtsPrev, H as TestTtsResume, J as TestTtsStop, K as TestView, L as TestViewToggle, M as TtsContext, N as ttsContext } from './qti-test.d-Cud5Gvy0.js';
|
|
3
3
|
import { LitElement } from 'lit';
|
|
4
|
-
import {
|
|
5
|
-
import { S as SessionContext } from './session.context.d-
|
|
4
|
+
import { b as ItemContext, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-B55QkJ92.js';
|
|
5
|
+
import { S as SessionContext } from './session.context.d-D5080LVx.js';
|
|
6
6
|
import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
|
|
7
|
-
import { T as TestContext } from './qti-expression.d-
|
|
7
|
+
import { T as TestContext } from './qti-expression.d-CuaLjZ6g.js';
|
|
8
8
|
import './qti-transform-test.d-BL7GGFJj.js';
|
|
9
|
-
import './computed.types.d-
|
|
9
|
+
import './computed.types.d-gJrBeUMG.js';
|
|
10
10
|
import './elements.js';
|
|
11
11
|
import './interaction.interface.d-CvjHM2bi.js';
|
|
12
|
-
import './qti-feedback.d-
|
|
12
|
+
import './qti-feedback.d-wMYNVkkj.js';
|
|
13
13
|
import './qti-rule-base.d-Bdzg8eGH.js';
|
|
14
|
-
import '@heximal/templates';
|
|
15
14
|
import './qti.context.d-CejJMlfZ.js';
|
|
15
|
+
import '@heximal/templates';
|
|
16
16
|
|
|
17
|
-
interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, IMyQtiTest {
|
|
17
|
+
interface IQtiTest extends LitElement, ITestNavigationMixin, ITestProcessingMixin, ITestStateMixin, IMyQtiTest {
|
|
18
18
|
}
|
|
19
19
|
interface IMyQtiTest {
|
|
20
20
|
testContext: Readonly<TestContext>;
|
|
21
21
|
sessionContext: Readonly<SessionContext>;
|
|
22
22
|
configContext: ConfigContext;
|
|
23
|
-
|
|
23
|
+
/** Sets values on one item, keyed by its `qti-assessment-item-ref` identifier. */
|
|
24
|
+
updateItemVariables(itemRefID: string, variables: readonly ItemVariableValue[], state?: ItemContext['state']): void;
|
|
24
25
|
}
|
|
25
26
|
interface ITestProcessingMixin {
|
|
26
27
|
updateOutcomeVariable(identifier: string, value: string | string[] | undefined): void;
|
|
@@ -29,4 +30,50 @@ interface ITestProcessingMixin {
|
|
|
29
30
|
outcomeProcessing(): boolean;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Everything a host needs to persist to resume a candidate's test session, and nothing else.
|
|
35
|
+
*
|
|
36
|
+
* Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —
|
|
37
|
+
* a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.
|
|
38
|
+
*
|
|
39
|
+
* Deliberately not here:
|
|
40
|
+
* - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes
|
|
41
|
+
* from the item XML on every load, and persisting the answer key with the candidate's data is
|
|
42
|
+
* both bloat and a leak;
|
|
43
|
+
* - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.
|
|
44
|
+
* The shuffle `seed` in particular must be passed in again, or the restored order changes;
|
|
45
|
+
* - `view`: a role the host decides, not something the candidate produced;
|
|
46
|
+
* - anything computed — scores per section, `done`, `active` — which is rederived from this.
|
|
47
|
+
*/
|
|
48
|
+
interface QtiTestState {
|
|
49
|
+
/** Bumped on any incompatible change to this shape. A state with another version is ignored. */
|
|
50
|
+
version: 1;
|
|
51
|
+
test: {
|
|
52
|
+
items: QtiTestStateItem[];
|
|
53
|
+
/** Test-level outcome values. Only outcomes the test declares are restored. */
|
|
54
|
+
outcomes: QtiTestStateValue[];
|
|
55
|
+
};
|
|
56
|
+
session: QtiTestStateSession;
|
|
57
|
+
}
|
|
58
|
+
interface QtiTestStateItem {
|
|
59
|
+
/** The `qti-assessment-item-ref` identifier. */
|
|
60
|
+
identifier: string;
|
|
61
|
+
variables: (QtiTestStateValue & {
|
|
62
|
+
type?: 'response' | 'outcome' | 'template' | 'context';
|
|
63
|
+
})[];
|
|
64
|
+
/** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */
|
|
65
|
+
state?: Record<string, string | null>;
|
|
66
|
+
}
|
|
67
|
+
interface QtiTestStateValue {
|
|
68
|
+
identifier: string;
|
|
69
|
+
value: string | string[] | null;
|
|
70
|
+
}
|
|
71
|
+
/** Where the candidate is. */
|
|
72
|
+
interface QtiTestStateSession {
|
|
73
|
+
navPartId?: string | null;
|
|
74
|
+
navSectionId?: string | null;
|
|
75
|
+
navItemRefId?: string | null;
|
|
76
|
+
}
|
|
77
|
+
declare const QTI_TEST_STATE_VERSION = 1;
|
|
78
|
+
|
|
79
|
+
export { type IMyQtiTest, type IQtiTest, ITestNavigationMixin, type ITestProcessingMixin, ITestStateMixin, QTI_TEST_STATE_VERSION, type QtiTestState, type QtiTestStateItem, type QtiTestStateSession, type QtiTestStateValue };
|
package/dist/test.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-JHPQJDAV.js";
|
|
2
2
|
import {
|
|
3
|
+
QTI_TEST_STATE_VERSION,
|
|
3
4
|
QtiAssessmentItemRef,
|
|
4
5
|
QtiAssessmentSection,
|
|
5
6
|
QtiAssessmentTest,
|
|
@@ -38,13 +39,14 @@ import {
|
|
|
38
39
|
TestView,
|
|
39
40
|
TestViewToggle,
|
|
40
41
|
ttsContext
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-
|
|
42
|
+
} from "./chunk-GNTO3IFM.js";
|
|
43
|
+
import "./chunk-XEWGFAS4.js";
|
|
43
44
|
import "./chunk-A32YH4H5.js";
|
|
44
45
|
import "./chunk-4DB4SC5K.js";
|
|
45
46
|
import "./chunk-TLAVOBEM.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-R7MMMDP7.js";
|
|
47
48
|
export {
|
|
49
|
+
QTI_TEST_STATE_VERSION,
|
|
48
50
|
QtiAssessmentItemRef,
|
|
49
51
|
QtiAssessmentSection,
|
|
50
52
|
QtiAssessmentTest,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citolab/qti-components",
|
|
3
3
|
"description": "QTI component utilities",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.4.0",
|
|
5
5
|
"author": "",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@heximal/templates": "^0.1.5",
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"lit-html": "^3.3.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@qti-components/base": "^2.
|
|
13
|
+
"@qti-components/base": "^2.4.0",
|
|
14
14
|
"@qti-components/corrections": "^0.4.0",
|
|
15
|
-
"@qti-components/elements": "^1.
|
|
15
|
+
"@qti-components/elements": "^1.9.0",
|
|
16
16
|
"@qti-components/interactions": "^1.10.4",
|
|
17
17
|
"@qti-components/item": "^1.5.0",
|
|
18
18
|
"@qti-components/loader": "^1.3.3",
|
|
19
19
|
"@qti-components/processing": "^1.6.0",
|
|
20
|
-
"@qti-components/test": "^1.
|
|
20
|
+
"@qti-components/test": "^1.9.0",
|
|
21
21
|
"@qti-components/theme": "^2.2.1",
|
|
22
22
|
"@qti-components/transformers": "^1.7.3"
|
|
23
23
|
},
|