@citolab/qti-components 9.2.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.
Files changed (58) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +359 -229
  3. package/dist/base.d.ts +10 -10
  4. package/dist/base.js +1 -1
  5. package/dist/{chunk-G5RQ5GKG.js → chunk-3BAQWO5C.js} +2 -2
  6. package/dist/{chunk-ZG7FBQFP.js → chunk-ACRN7YJM.js} +2 -2
  7. package/dist/{chunk-JLZCZVRX.js → chunk-B5XHZI2P.js} +2 -2
  8. package/dist/{chunk-RAJQKCQ3.js → chunk-B74SYQB2.js} +2 -2
  9. package/dist/{chunk-YIYHCHHM.js → chunk-BMXG7D2N.js} +2 -2
  10. package/dist/{chunk-FG5JAWSN.js → chunk-C3JPUV36.js} +2 -2
  11. package/dist/{chunk-7PXUE2GR.js → chunk-GNTO3IFM.js} +976 -296
  12. package/dist/chunk-GNTO3IFM.js.map +1 -0
  13. package/dist/{chunk-ZOQVTG5L.js → chunk-JHPQJDAV.js} +2 -2
  14. package/dist/{chunk-GPGUXZ3X.js → chunk-LKHRHFXO.js} +6 -6
  15. package/dist/{chunk-JGPWBIVD.js → chunk-MSGYZE6L.js} +2 -2
  16. package/dist/{chunk-YVZWNLF4.js → chunk-R7MMMDP7.js} +139 -18
  17. package/dist/chunk-R7MMMDP7.js.map +1 -0
  18. package/dist/{chunk-REKCRWJV.js → chunk-XEWGFAS4.js} +166 -104
  19. package/dist/chunk-XEWGFAS4.js.map +1 -0
  20. package/dist/{computed.types.d-DB5gfOh9.d.ts → computed.types.d-gJrBeUMG.d.ts} +1 -1
  21. package/dist/corrections.d.ts +9 -9
  22. package/dist/corrections.js +7 -7
  23. package/dist/elements.d.ts +46 -6
  24. package/dist/elements.js +5 -3
  25. package/dist/index.d.ts +12 -12
  26. package/dist/index.js +18 -12
  27. package/dist/{interaction.d-DegNJ5ZA.d.ts → interaction.d-g6XG0T0Z.d.ts} +2 -2
  28. package/dist/interactions.d.ts +4 -4
  29. package/dist/interactions.js +3 -3
  30. package/dist/item.d.ts +4 -4
  31. package/dist/item.js +3 -3
  32. package/dist/{item.types.d-BDFrq19E.d.ts → item.types.d-B55QkJ92.d.ts} +10 -0
  33. package/dist/loader.d.ts +2 -2
  34. package/dist/processing.d.ts +3 -3
  35. package/dist/processing.js +3 -3
  36. package/dist/qti-components-jsx.d.ts +628 -268
  37. package/dist/{qti-condition-expression.d-DLboq8bR.d.ts → qti-condition-expression.d-L7yb3Rzy.d.ts} +1 -1
  38. package/dist/{qti-expression.d-BksT9iLB.d.ts → qti-expression.d-CuaLjZ6g.d.ts} +1 -1
  39. package/dist/{qti-feedback.d-D-w6-mJv.d.ts → qti-feedback.d-wMYNVkkj.d.ts} +2 -3
  40. package/dist/{qti-item.d-D_-9_0e6.d.ts → qti-item.d-DgC1AQbY.d.ts} +1 -1
  41. package/dist/{qti-test.d-BfAZE6UF.d.ts → qti-test.d-Cud5Gvy0.d.ts} +278 -38
  42. package/dist/{qti-text-entry-interaction.d-CATtcPyX.d.ts → qti-text-entry-interaction.d-DKvz9ncv.d.ts} +2 -2
  43. package/dist/{session.context.d-Cjs0BkJB.d.ts → session.context.d-D5080LVx.d.ts} +3 -1
  44. package/dist/test.d.ts +58 -11
  45. package/dist/test.js +8 -4
  46. package/package.json +4 -4
  47. package/dist/chunk-7PXUE2GR.js.map +0 -1
  48. package/dist/chunk-REKCRWJV.js.map +0 -1
  49. package/dist/chunk-YVZWNLF4.js.map +0 -1
  50. /package/dist/{chunk-G5RQ5GKG.js.map → chunk-3BAQWO5C.js.map} +0 -0
  51. /package/dist/{chunk-ZG7FBQFP.js.map → chunk-ACRN7YJM.js.map} +0 -0
  52. /package/dist/{chunk-JLZCZVRX.js.map → chunk-B5XHZI2P.js.map} +0 -0
  53. /package/dist/{chunk-RAJQKCQ3.js.map → chunk-B74SYQB2.js.map} +0 -0
  54. /package/dist/{chunk-YIYHCHHM.js.map → chunk-BMXG7D2N.js.map} +0 -0
  55. /package/dist/{chunk-FG5JAWSN.js.map → chunk-C3JPUV36.js.map} +0 -0
  56. /package/dist/{chunk-ZOQVTG5L.js.map → chunk-JHPQJDAV.js.map} +0 -0
  57. /package/dist/{chunk-GPGUXZ3X.js.map → chunk-LKHRHFXO.js.map} +0 -0
  58. /package/dist/{chunk-JGPWBIVD.js.map → chunk-MSGYZE6L.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { Q as QtiExpression } from './qti-expression.d-BksT9iLB.js';
1
+ import { Q as QtiExpression } from './qti-expression.d-CuaLjZ6g.js';
2
2
 
3
3
  declare abstract class QtiConditionExpression extends QtiExpression<boolean> {
4
4
  calculate(): Readonly<boolean>;
@@ -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-BDFrq19E.js';
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-BDFrq19E.js';
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-Cjs0BkJB.js';
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 { t as transformItemApi, b as transformTestApi } from './qti-transform-test.d-BL7GGFJj.js';
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';
4
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';
5
8
  import { TemplateFunction } from '@heximal/templates';
6
- import { T as TestContext, Q as QtiExpression, a as QtiExpressionBase } from './qti-expression.d-BksT9iLB.js';
7
- import { h as VariableValue, c as OutcomeVariable, V as VariableDeclaration } from './item.types.d-BDFrq19E.js';
8
- 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';
9
11
  import { C as ConfigContext } from './config.context.d-BvU9r-Mg.js';
10
12
  import { b as QtiRuleBase } from './qti-rule-base.d-Bdzg8eGH.js';
11
- import { C as ComputedContext, a as ComputedItem } from './computed.types.d-DB5gfOh9.js';
12
- import { Q as QtiContext } from './qti.context.d-CejJMlfZ.js';
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.
@@ -26,6 +60,12 @@ interface ItemRefTemplateModel {
26
60
  identifier?: string;
27
61
  href?: string;
28
62
  category?: string;
63
+ /**
64
+ * This item's entry in the computed context, the same object the stamps
65
+ * iterate as `item`: `index` (1-based, null for info items), `score`,
66
+ * `maxScore`, `completed`, `active`, … Undefined until the test has computed it.
67
+ */
68
+ item?: ComputedItem;
29
69
  /** The element being rendered. */
30
70
  itemRef: QtiAssessmentItemRef;
31
71
  }
@@ -36,6 +76,7 @@ declare class QtiAssessmentItemRef extends LitElement {
36
76
  required?: boolean;
37
77
  fixed?: boolean;
38
78
  href?: string;
79
+ protected computedContext?: ComputedContext;
39
80
  /**
40
81
  * The `<qti-weight>` children of this ref, keyed by identifier — what
41
82
  * `qti-test-variables`' `weight-identifier` resolves against.
@@ -49,6 +90,9 @@ declare class QtiAssessmentItemRef extends LitElement {
49
90
  protected createRenderRoot(): HTMLElement | DocumentFragment;
50
91
  get assessmentItem(): QtiAssessmentItem | null;
51
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;
52
96
  connectedCallback(): Promise<void>;
53
97
  render(): unknown;
54
98
  }
@@ -79,21 +123,6 @@ declare global {
79
123
  }
80
124
  }
81
125
 
82
- declare class QtiAssessmentTest extends LitElement {
83
- #private;
84
- identifier: string;
85
- get title(): string;
86
- set title(value: string);
87
- _testContext?: TestContext;
88
- connectedCallback(): Promise<void>;
89
- render(): lit.TemplateResult<1>;
90
- }
91
- declare global {
92
- interface HTMLElementTagNameMap {
93
- 'qti-assessment-test': QtiAssessmentTest;
94
- }
95
- }
96
-
97
126
  /**
98
127
  * @summary The qti-item-session-control element contains configurations relating to flow of test sessions.
99
128
  * @documentation https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/imsqti_asi_v3p0p1_infomodel_v1p0.html#Derived_ItemSessionControl
@@ -207,12 +236,16 @@ interface TestBaseInterface extends LitElement {
207
236
  testContext: Readonly<TestContext>;
208
237
  sessionContext: Readonly<SessionContext>;
209
238
  configContext?: Readonly<ConfigContext>;
239
+ /** Provided by `qti-test`. */
240
+ qtiContext?: Readonly<QtiContext>;
210
241
  _testElement: QtiAssessmentTest;
211
- updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;
242
+ updateItemVariables(itemRefID: string, variables: readonly ItemVariableValue[], state?: ItemContext['state']): void;
212
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'>>;
213
246
 
214
247
  type PostLoadTransformCallback = (transformer: transformItemApi, itemRef: QtiAssessmentItemRef) => transformItemApi | Promise<transformItemApi>;
215
- type PostLoadTestTransformCallback = (transformer: transformTestApi, testElement: QtiAssessmentTest) => transformTestApi | Promise<transformTestApi>;
248
+
216
249
  /**
217
250
  * Exactly what this mixin adds. `IQtiTest` composes it (see ../types/iqti-test, which
218
251
  * re-exports it), and `TestNavigationClass` below `implements` it, so the interface and the
@@ -243,6 +276,72 @@ interface ITestNavigationMixin {
243
276
  };
244
277
  }
245
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
+
246
345
  type CustomEventMap = {
247
346
  'test-end-attempt': CustomEvent;
248
347
  };
@@ -257,7 +356,15 @@ declare class TestNavigation extends LitElement {
257
356
  identifier: string;
258
357
  [key: string]: any;
259
358
  }[];
260
- qtiContext: QtiContext;
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);
261
368
  configContext: ConfigContext;
262
369
  protected _testContext?: TestContext;
263
370
  protected _sessionContext?: SessionContext;
@@ -436,6 +543,8 @@ declare class TestContainer extends LitElement {
436
543
  testDoc: DocumentFragment | null;
437
544
  /** The raw XML string */
438
545
  testXML: string | null;
546
+ /** The `qti-test` this container is in: where the host's `postLoadTestTransformCallback` lives. */
547
+ protected testHost?: TestHost;
439
548
  protected qtiContext: QtiContext;
440
549
  protected createRenderRoot(): HTMLElement | DocumentFragment;
441
550
  /** Callback function to transform the test after loading */
@@ -536,7 +645,7 @@ declare class TestScoringButtons extends LitElement {
536
645
  protected createRenderRoot(): HTMLElement | DocumentFragment;
537
646
  connectedCallback(): void;
538
647
  protected computedContext?: ComputedContext;
539
- render(): typeof nothing | lit.TemplateResult<1>;
648
+ render(): lit.TemplateResult<1> | typeof nothing;
540
649
  constructor();
541
650
  }
542
651
  declare global {
@@ -572,6 +681,7 @@ declare global {
572
681
  }
573
682
 
574
683
  declare class TestCheckItem extends LitElement {
684
+ protected testHost?: TestHost;
575
685
  static styles: lit.CSSResult;
576
686
  constructor();
577
687
  render(): lit.TemplateResult<1>;
@@ -585,6 +695,8 @@ declare global {
585
695
  type SpeechState = 'idle' | 'playing' | 'paused';
586
696
  interface TtsContext {
587
697
  state: SpeechState;
698
+ /** True while every reading element is highlighted and a click on one starts reading there. */
699
+ picking: boolean;
588
700
  /** Index of the currently highlighted reading element (0-based). */
589
701
  currentElementIndex: number;
590
702
  /** Total number of navigable reading elements in the current item. */
@@ -595,6 +707,8 @@ interface TtsContext {
595
707
  stop(): void;
596
708
  prevElement(): void;
597
709
  nextElement(): void;
710
+ /** Toggle pick mode: highlight all reading elements, then read from the one that is clicked. */
711
+ togglePick(): void;
598
712
  }
599
713
 
600
714
  declare const ttsContext: {
@@ -608,8 +722,14 @@ declare const ttsContext: {
608
722
  declare abstract class TtsButtonBase extends LitElement {
609
723
  #private;
610
724
  static styles: lit.CSSResult;
725
+ /**
726
+ * Accessible name of the button. Without it the default icon carries an English name, and
727
+ * slotted content names the button by its text; set it when you slot an icon of your own,
728
+ * which has no text to be named by.
729
+ */
730
+ label?: string;
611
731
  protected _tts?: TtsContext;
612
- updated(changed: PropertyValues): void;
732
+ updated(_changed: PropertyValues): void;
613
733
  }
614
734
  /**
615
735
  * `<test-item-to-speech>` is the controller and context provider. It manages
@@ -620,37 +740,127 @@ declare abstract class TtsButtonBase extends LitElement {
620
740
  * ```html
621
741
  * <test-item-to-speech language="nl-NL">
622
742
  * <test-tts-play></test-tts-play>
623
- * <test-tts-prev>◀◀</test-tts-prev>
624
- * <test-tts-next>▶▶</test-tts-next>
625
- * <test-tts-stop>■</test-tts-stop>
743
+ * <test-tts-prev></test-tts-prev>
744
+ * <test-tts-next></test-tts-next>
745
+ * <test-tts-stop></test-tts-stop>
626
746
  * </test-item-to-speech>
627
747
  * ```
628
748
  *
749
+ * The controller lays its controls out as a wrapping row; each control draws an icon button,
750
+ * and slotted content replaces the icon — a slotted `<svg>` is sized like the default one. Give a
751
+ * control with a slotted icon a `label`, since an icon has no text to name the button by. Buttons read the qti-theme tokens (with the theme's
752
+ * defaults as fallbacks) and can be sized with `--test-button-size` and `--test-tts-icon-size`.
753
+ *
754
+ * ### Language resolution
755
+ *
756
+ * Each reading element is spoken in the language of the nearest `lang` attribute:
757
+ *
758
+ * 1. `lang` (or `xml:lang`) on the element itself
759
+ * 2. `lang` on the closest ancestor — including `<qti-assessment-item xml:lang>` and, across
760
+ * shadow roots, anything wrapping the test
761
+ * 3. `lang` on the document's `<html>` element
762
+ * 4. the `language` attribute on `<test-item-to-speech>`
763
+ *
764
+ * The transformer copies `xml:lang` over as a plain `lang` attribute, so QTI authored with
765
+ * `xml:lang="en-GB"` on a `<p>` or on the item root is honoured without further work.
766
+ *
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
+ * ```
818
+ *
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.
823
+ *
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"`.
827
+ *
828
+ * ### Starting somewhere in the middle
829
+ *
830
+ * `<test-tts-pick>` switches the player into pick mode: every reading element gets the blue
831
+ * cursor highlight, and the first click on one of them leaves pick mode and starts reading
832
+ * from that element. Pressing the button again leaves pick mode without reading.
833
+ *
629
834
  * @cssstate idle - No speech active
835
+ * @cssstate picking - Pick mode: all reading elements highlighted, waiting for a click
630
836
  * @cssstate playing - Speech is playing
631
837
  * @cssstate paused - Speech is paused
632
838
  */
633
839
  declare class TestItemToSpeech extends LitElement {
634
840
  #private;
841
+ static styles: lit.CSSResult;
842
+ /** Fallback language when neither the item content nor the document declares one. */
635
843
  language: string;
636
844
  protected _sessionContext?: SessionContext;
845
+ /** The `qti-test` this player is in, across shadow roots. */
846
+ protected testHost?: TestHost;
637
847
  _ttsContext: TtsContext;
638
848
  constructor();
639
849
  willUpdate(changed: PropertyValues): void;
640
- updated(_changed: PropertyValues): void;
641
850
  connectedCallback(): void;
642
851
  disconnectedCallback(): void;
643
852
  render(): lit.TemplateResult<1>;
644
853
  }
645
854
  /**
646
855
  * Play/pause/resume toggle button — always enabled, cycles through states.
647
- * Use named slots `play` and `pause` to customise the icons/labels independently.
856
+ * Use named slots `play` and `pause` to customise the icons/labels independently; `label` and
857
+ * `pause-label` name the button in each state (set them when the slotted content is an icon).
648
858
  *
649
859
  * @example
650
860
  * ```html
651
861
  * <test-tts-play>
652
- * <span slot="play">▶ Play</span>
653
- * <span slot="pause">⏸ Pause</span>
862
+ * <span slot="play">Voorlezen</span>
863
+ * <span slot="pause">Pauzeren</span>
654
864
  * </test-tts-play>
655
865
  * ```
656
866
  *
@@ -659,6 +869,8 @@ declare class TestItemToSpeech extends LitElement {
659
869
  */
660
870
  declare class TestTtsPlay extends TtsButtonBase {
661
871
  #private;
872
+ /** Accessible name of the button while speech is playing; see `label`. */
873
+ pauseLabel?: string;
662
874
  render(): lit.TemplateResult<1>;
663
875
  }
664
876
  /**
@@ -678,7 +890,7 @@ declare class TestTtsResume extends TtsButtonBase {
678
890
  render(): lit.TemplateResult<1>;
679
891
  }
680
892
  /**
681
- * Stop button — enabled when playing or paused.
893
+ * Stop button — enabled when playing, paused, or in pick mode (where it leaves pick mode).
682
894
  * @cssstate idle / playing / paused
683
895
  * @csspart button
684
896
  */
@@ -687,7 +899,9 @@ declare class TestTtsStop extends TtsButtonBase {
687
899
  }
688
900
  /**
689
901
  * Prev-element button — moves cursor to the previous reading element and pauses.
690
- * Disabled at the first element or when no elements are loaded.
902
+ * Disabled at the first element. Reading elements are collected lazily, so an element count
903
+ * of 0 means "not looked yet" rather than "nothing to read": the button stays enabled and the
904
+ * first click collects them.
691
905
  * @cssstate idle / playing / paused
692
906
  * @csspart button
693
907
  */
@@ -696,13 +910,24 @@ declare class TestTtsPrev extends TtsButtonBase {
696
910
  }
697
911
  /**
698
912
  * Next-element button — moves cursor to the next reading element and pauses.
699
- * Disabled at the last element or when no elements are loaded.
913
+ * Disabled at the last element; enabled while the elements have not been collected yet
914
+ * (see `TestTtsPrev`).
700
915
  * @cssstate idle / playing / paused
701
916
  * @csspart button
702
917
  */
703
918
  declare class TestTtsNext extends TtsButtonBase {
704
919
  render(): lit.TemplateResult<1>;
705
920
  }
921
+ /**
922
+ * Pick button — toggles pick mode on the controller: every reading element is highlighted and
923
+ * a click on one of them starts reading from there. Reflects the mode as `:state(picking)`.
924
+ * @cssstate idle / playing / paused
925
+ * @cssstate picking
926
+ * @csspart button
927
+ */
928
+ declare class TestTtsPick extends TtsButtonBase {
929
+ render(): lit.TemplateResult<1>;
930
+ }
706
931
  declare global {
707
932
  interface HTMLElementTagNameMap {
708
933
  'test-item-to-speech': TestItemToSpeech;
@@ -712,6 +937,7 @@ declare global {
712
937
  'test-tts-stop': TestTtsStop;
713
938
  'test-tts-prev': TestTtsPrev;
714
939
  'test-tts-next': TestTtsNext;
940
+ 'test-tts-pick': TestTtsPick;
715
941
  }
716
942
  }
717
943
 
@@ -722,7 +948,7 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
722
948
  getOutcome(identifier: string): Readonly<OutcomeVariable>;
723
949
  getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
724
950
  outcomeProcessing(): boolean;
725
- }) & (abstract new (...args: any[]) => TestBaseInterface) & typeof LitElement;
951
+ }) & (abstract new (...args: any[]) => ITestStateMixin) & (abstract new (...args: any[]) => TestBaseInterface) & typeof LitElement;
726
952
  /**
727
953
  * `<qti-test>` is a custom element designed for rendering and interacting with QTI (Question and Test Interoperability) tests.
728
954
  *
@@ -770,9 +996,23 @@ declare const QtiTest_base: (abstract new (...args: any[]) => ITestNavigationMix
770
996
  * You can use normal class names to style the elements.
771
997
  * And you can use the `test-prev` and `test-next` elements to navigate through the test.
772
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.
773
1001
  */
774
1002
  declare class QtiTest extends QtiTest_base {
1003
+ constructor();
775
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;
776
1016
  /**
777
1017
  * Renders the component's template.
778
1018
  * Provides a default `<slot>` for content projection.
@@ -786,4 +1026,4 @@ declare global {
786
1026
  }
787
1027
  }
788
1028
 
789
- export { TestStamp as A, TestTtsNext as B, TestTtsPause as C, TestTtsPlay as D, TestTtsPrev as E, TestTtsResume as F, TestTtsStop as G, TestView as H, type ITestNavigationMixin as I, TestViewToggle as J, type TtsContext as K, ttsContext as L, QtiAssessmentItemRef as Q, type SpeechState as S, TestCheckItem as T, type ItemRefTemplateModel as a, QtiAssessmentSection as b, QtiAssessmentTest as c, QtiItemSessionControl as d, QtiNumberSelected as e, QtiOutcomeProcessing as f, QtiOutcomeProcessingProcessor as g, QtiTest as h, QtiTestFeedback as i, QtiTestPart as j, QtiTestVariables as k, QtiTestVariablesExpression as l, TestContainer as m, TestEndAttempt as n, TestItemLink as o, TestItemToSpeech as p, TestNavigation as q, TestNext as r, TestPagingButtonsStamp as s, TestPrev as t, TestPrintContext as u, TestPrintVariables as v, TestScoringButtons as w, TestScoringFeedback as x, TestSectionButtonsStamp as y, TestSectionLink as z };
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-DegNJ5ZA.js';
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-BDFrq19E.js';
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-BDFrq19E.js';
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
  }