@qti-components/test 1.10.1 → 2.0.0-next.10

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 (78) hide show
  1. package/dist/components/index.d.ts +0 -11
  2. package/dist/components/index.js +0 -11
  3. package/dist/components/index.js.map +1 -1
  4. package/dist/components/qti-test/getting-started.fixtures.d.ts +6 -0
  5. package/dist/components/qti-test/getting-started.fixtures.js +7 -0
  6. package/dist/components/qti-test/getting-started.fixtures.js.map +1 -0
  7. package/dist/components/qti-test/qti-test.d.ts +1 -0
  8. package/dist/components/qti-test/showcase.fixtures.d.ts +6 -0
  9. package/dist/components/qti-test/showcase.fixtures.js +7 -0
  10. package/dist/components/qti-test/showcase.fixtures.js.map +1 -0
  11. package/dist/components/styles.d.ts +8 -1
  12. package/dist/components/styles.js +63 -14
  13. package/dist/components/styles.js.map +1 -1
  14. package/dist/components/test-bookmark/test-bookmark.d.ts +48 -0
  15. package/dist/components/test-bookmark/test-bookmark.js +149 -0
  16. package/dist/components/test-bookmark/test-bookmark.js.map +1 -0
  17. package/dist/components/test-check-item/test-check-item.d.ts +9 -2
  18. package/dist/components/test-check-item/test-check-item.js +19 -13
  19. package/dist/components/test-check-item/test-check-item.js.map +1 -1
  20. package/dist/components/test-end-attempt/test-end-attempt.js +7 -2
  21. package/dist/components/test-end-attempt/test-end-attempt.js.map +1 -1
  22. package/dist/components/test-item-link/test-item-link.js +7 -2
  23. package/dist/components/test-item-link/test-item-link.js.map +1 -1
  24. package/dist/components/test-navigation/test-navigation.js +8 -2
  25. package/dist/components/test-navigation/test-navigation.js.map +1 -1
  26. package/dist/components/test-next/test-next.js +8 -2
  27. package/dist/components/test-next/test-next.js.map +1 -1
  28. package/dist/components/test-prev/test-prev.js +7 -2
  29. package/dist/components/test-prev/test-prev.js.map +1 -1
  30. package/dist/components/test-section-link/test-section-link.js +7 -2
  31. package/dist/components/test-section-link/test-section-link.js.map +1 -1
  32. package/dist/components/test-stamp/test-stamp.d.ts +3 -2
  33. package/dist/components/test-stamp/test-stamp.js +9 -4
  34. package/dist/components/test-stamp/test-stamp.js.map +1 -1
  35. package/dist/components/test-submit/test-submit.d.ts +16 -0
  36. package/dist/components/test-submit/test-submit.js +37 -0
  37. package/dist/components/test-submit/test-submit.js.map +1 -0
  38. package/dist/elements.d.ts +34 -44
  39. package/dist/elements.js +4 -30
  40. package/dist/elements.js.map +1 -1
  41. package/dist/index.d.ts +2 -0
  42. package/dist/index.js +2 -0
  43. package/dist/index.js.map +1 -1
  44. package/dist/mixins/test-navigation.mixin.js +4 -2
  45. package/dist/mixins/test-navigation.mixin.js.map +1 -1
  46. package/dist/mixins/test-processing.mixin.d.ts +1 -0
  47. package/dist/mixins/test-processing.mixin.js +22 -1
  48. package/dist/mixins/test-processing.mixin.js.map +1 -1
  49. package/dist/mixins/test-state.mixin.js +25 -1
  50. package/dist/mixins/test-state.mixin.js.map +1 -1
  51. package/dist/plugin-state.d.ts +8 -0
  52. package/dist/plugin-state.js +7 -0
  53. package/dist/plugin-state.js.map +1 -0
  54. package/dist/plugins/elements.d.ts +75 -0
  55. package/dist/plugins/elements.js +35 -0
  56. package/dist/plugins/elements.js.map +1 -0
  57. package/dist/plugins/index.d.ts +2 -0
  58. package/dist/plugins/index.js +3 -0
  59. package/dist/plugins/index.js.map +1 -0
  60. package/dist/public-events.d.ts +9 -0
  61. package/dist/public-events.js +3 -0
  62. package/dist/public-events.js.map +1 -1
  63. package/dist/tts/elements.d.ts +28 -0
  64. package/dist/tts/elements.js +14 -0
  65. package/dist/tts/elements.js.map +1 -0
  66. package/dist/{components/test-item-to-speech → tts}/test-item-to-speech.d.ts +9 -9
  67. package/dist/{components/test-item-to-speech → tts}/test-item-to-speech.js +81 -92
  68. package/dist/tts/test-item-to-speech.js.map +1 -0
  69. package/dist/types/qti-test-state.d.ts +12 -1
  70. package/dist/types/qti-test-state.js.map +1 -1
  71. package/package.json +11 -7
  72. package/dist/components/test-item-to-speech/test-item-to-speech.js.map +0 -1
  73. package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.d.ts +0 -19
  74. package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js +0 -39
  75. package/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js.map +0 -1
  76. package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.d.ts +0 -19
  77. package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js +0 -39
  78. package/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js.map +0 -1
@@ -8,20 +8,29 @@ import { html, LitElement, css } from 'lit';
8
8
  import { consume, provide, createContext } from '@lit/context';
9
9
  import { property, state } from 'lit/decorators.js';
10
10
  import { ifDefined } from 'lit/directives/if-defined.js';
11
- import { sessionContext } from '@qti-components/base';
12
- import { testHostContext } from '../../internal/test-host.context';
13
- import * as styles from '../styles';
11
+ import { computedContext } from '@qti-components/base';
12
+ import * as styles from '../components/styles';
14
13
  // ─── CSS Custom Highlight ─────────────────────────────────────────────────────
15
14
  const HIGHLIGHT_ELEMENT = 'tts-element'; // navigation cursor — whole element
16
15
  const HIGHLIGHT_WORD = 'tts-word'; // word boundary during speech
17
- // Shared across all instances — added to whichever shadow root needs it
16
+ // Shared across all instances — added to whichever shadow root needs it. The two highlights are
17
+ // tints of the theme's info (the element being read) and warning (the word being spoken) colours,
18
+ // see-through so the text and its own background stay visible. Without the theme they fall back to
19
+ // the system Highlight and Mark colours. A host repaints them with --test-tts-element-highlight and
20
+ // --test-tts-word-highlight.
18
21
  let highlightSheet = null;
19
22
  function getHighlightSheet() {
20
23
  if (!highlightSheet) {
21
24
  highlightSheet = new CSSStyleSheet();
22
25
  highlightSheet.replaceSync(`
23
- ::highlight(${HIGHLIGHT_ELEMENT}) { background-color: #dbeafe; color: inherit; }
24
- ::highlight(${HIGHLIGHT_WORD}) { background-color: #ffe066; color: inherit; }
26
+ ::highlight(${HIGHLIGHT_ELEMENT}) {
27
+ background-color: var(--test-tts-element-highlight, color-mix(in oklab, var(--qti-color-info, var(--cito-color-info, Highlight)) 15%, transparent));
28
+ color: inherit;
29
+ }
30
+ ::highlight(${HIGHLIGHT_WORD}) {
31
+ background-color: var(--test-tts-word-highlight, color-mix(in oklab, var(--qti-color-warning, var(--cito-color-warning, Mark)) 55%, transparent));
32
+ color: inherit;
33
+ }
25
34
  `);
26
35
  }
27
36
  return highlightSheet;
@@ -66,8 +75,13 @@ class TtsButtonBase extends LitElement {
66
75
  page as tall as the scrolled content. */
67
76
  position: relative;
68
77
  }
69
- button:hover:not(:disabled) {
70
- ${styles.btnInteractive};
78
+ @media (hover: hover) and (pointer: fine) {
79
+ button:hover:not(:disabled) {
80
+ ${styles.btnInteractive};
81
+ }
82
+ }
83
+ button:active:not(:disabled) {
84
+ ${styles.btnActive};
71
85
  }
72
86
  button:focus-visible {
73
87
  ${styles.focusRing};
@@ -77,8 +91,8 @@ class TtsButtonBase extends LitElement {
77
91
  }
78
92
  button[aria-pressed='true'],
79
93
  button[aria-pressed='true']:hover {
80
- background-color: var(--test-button-selected-background-color, var(--qti-selected-bg, #0175aa));
81
- color: var(--test-button-selected-color, var(--qti-selected-color, #fff));
94
+ background-color: var(--test-button-selected-background-color, var(--qti-selected-bg, Highlight));
95
+ color: var(--test-button-selected-color, var(--qti-selected-color, HighlightText));
82
96
  }
83
97
  svg,
84
98
  ::slotted(svg) {
@@ -176,10 +190,9 @@ __decorate([
176
190
  * 3. **Inside a `qti-assessment-item-ref`** — e.g. in a `<template item-ref>` on `<qti-test>`,
177
191
  * so every item gets a player of its own: the player reads that item, and only that item.
178
192
  * The navigation cursor is ignored; speech stops when the player leaves the page with its item.
179
- * 4. **Anywhere else** — a toolbar in the page chrome: the player follows the navigation cursor
180
- * and reads the item `navItemRefId` (session context) points at, found in any
181
- * `test-container` reachable from the player. Navigating stops speech and starts the next
182
- * item from the top.
193
+ * 4. **Anywhere else inside `<test-navigation>`** — e.g. a toolbar: the player follows the
194
+ * navigation cursor and reads the active item of the computed context. Navigating stops
195
+ * speech and starts the next item from the top.
183
196
  *
184
197
  * ```html
185
198
  * <!-- 1. a player for the shared reading text -->
@@ -250,15 +263,17 @@ export class TestItemToSpeech extends LitElement {
250
263
  #contentMode;
251
264
  // Item-ref mode: the item-ref this player sits in, resolved on connect. Null means cursor mode.
252
265
  #itemRef;
253
- // Where the item-connected (and, in cursor mode, navigation) events are listened for.
266
+ // Item-ref mode: our item-ref, for its item-connected event. Cursor mode: where prev/next's
267
+ // navigation request is heard.
254
268
  #eventHost;
255
269
  #boundHandleItemConnected;
256
270
  #boundHandleNavigation;
257
271
  // Cursor mode: the previous navigation position, to detect moving to another item or section.
258
272
  #prevNavItemRefId;
259
273
  #prevNavSectionId;
260
- // Current set of block-level reading elements for the item
274
+ // Current set of block-level reading elements for the item, and the root they were collected from
261
275
  #readingElements;
276
+ #readingRoot;
262
277
  #currentElementIndex;
263
278
  // Text nodes of the element currently being spoken (for word-boundary highlight)
264
279
  #textNodes;
@@ -290,15 +305,17 @@ export class TestItemToSpeech extends LitElement {
290
305
  this.#contentMode = false;
291
306
  // Item-ref mode: the item-ref this player sits in, resolved on connect. Null means cursor mode.
292
307
  this.#itemRef = null;
293
- // Where the item-connected (and, in cursor mode, navigation) events are listened for.
308
+ // Item-ref mode: our item-ref, for its item-connected event. Cursor mode: where prev/next's
309
+ // navigation request is heard.
294
310
  this.#eventHost = null;
295
311
  this.#boundHandleItemConnected = this.#handleItemConnected.bind(this);
296
312
  this.#boundHandleNavigation = () => this.#stop();
297
313
  // Cursor mode: the previous navigation position, to detect moving to another item or section.
298
314
  this.#prevNavItemRefId = undefined;
299
315
  this.#prevNavSectionId = undefined;
300
- // Current set of block-level reading elements for the item
316
+ // Current set of block-level reading elements for the item, and the root they were collected from
301
317
  this.#readingElements = null;
318
+ this.#readingRoot = null;
302
319
  this.#currentElementIndex = 0;
303
320
  // Text nodes of the element currently being spoken (for word-boundary highlight)
304
321
  this.#textNodes = [];
@@ -340,13 +357,15 @@ export class TestItemToSpeech extends LitElement {
340
357
  if (this.#stimulusMode || this.#contentMode || this.#itemRef)
341
358
  return;
342
359
  // Cursor mode: moving to another item or section stops speech and starts over (ignore the
343
- // initial undefined → value transition). Section navigation leaves navItemRefId null, so it
360
+ // initial undefined → value transition). Section navigation leaves no item active, so it
344
361
  // needs its own check.
345
- const item = this._sessionContext?.navItemRefId ?? null;
346
- const section = this._sessionContext?.navSectionId ?? null;
362
+ const { item, section } = this.#activePosition();
347
363
  const itemChanged = this.#prevNavItemRefId !== undefined && this.#prevNavItemRefId !== item;
348
364
  const sectionChanged = this.#prevNavSectionId !== undefined && this.#prevNavSectionId !== section;
349
- if (itemChanged || sectionChanged)
365
+ // The same item rendered again (e.g. linking to the item already shown): the elements
366
+ // collected earlier are detached. The context updates when an item renders, so check here.
367
+ const rerendered = this.#readingElements !== null && this.#readingRoot !== null && this.#readingRoot !== this.#resolveReadingRoot();
368
+ if (itemChanged || sectionChanged || rerendered)
350
369
  this.#resetReadingPosition();
351
370
  this.#prevNavItemRefId = item;
352
371
  this.#prevNavSectionId = section;
@@ -364,7 +383,7 @@ export class TestItemToSpeech extends LitElement {
364
383
  super.connectedCallback();
365
384
  this.#setSpeechState('idle');
366
385
  // NOTE: #ensureHighlightStyles() is called lazily on first highlight use
367
- // because test-container may not be in the DOM yet at this point.
386
+ // because the item to read may not be in the DOM yet at this point.
368
387
  this.#stimulusMode = this.#stimulusPlaceholder() !== null;
369
388
  if (this.#stimulusMode) {
370
389
  // Stimulus mode: neither items nor navigation decide what is read, only the content of the
@@ -383,14 +402,16 @@ export class TestItemToSpeech extends LitElement {
383
402
  if (this.#contentMode)
384
403
  return;
385
404
  this.#itemRef = this.closest('qti-assessment-item-ref');
386
- // qti-assessment-item-connected is bubbles+composed: it passes the item's own item-ref, and
387
- // reaches test-navigation / qti-test from inside test-container's shadow root.
388
- this.#eventHost =
389
- this.#itemRef ?? this.closest('test-navigation') ?? this.testHost ?? this.getRootNode();
390
- this.#eventHost.addEventListener('qti-assessment-item-connected', this.#boundHandleItemConnected);
391
- if (!this.#itemRef) {
405
+ if (this.#itemRef) {
406
+ // Item-ref mode: qti-assessment-item-connected (bubbles+composed) passes our own item-ref
407
+ // when our item renders again.
408
+ this.#eventHost = this.#itemRef;
409
+ this.#eventHost.addEventListener('qti-assessment-item-connected', this.#boundHandleItemConnected);
410
+ }
411
+ else {
392
412
  // Cursor mode: cito-test-navigate fires synchronously on prev/next — stop right away
393
- // instead of waiting for the new position to arrive through the session context.
413
+ // instead of waiting for the new position to arrive through the computed context.
414
+ this.#eventHost = this.closest('test-navigation') ?? this.getRootNode();
394
415
  this.#eventHost.addEventListener('cito-test-navigate', this.#boundHandleNavigation);
395
416
  this.#eventHost.addEventListener('qti-request-navigation', this.#boundHandleNavigation); // deprecated name, still sent by hosts
396
417
  }
@@ -417,19 +438,22 @@ export class TestItemToSpeech extends LitElement {
417
438
  render() {
418
439
  return html `<slot></slot>`;
419
440
  }
420
- /**
421
- * An item (re)rendered. If it is ours — e.g. after navigating to the item already shown — the
422
- * elements collected earlier are detached now. That does not move the navigation cursor, so
423
- * the check in updated() does not catch it.
424
- */
425
- #handleItemConnected(event) {
426
- if (this.#readingElements === null)
427
- return;
428
- // In item-ref mode the event came through our own item-ref, so it is always ours.
429
- const identifier = event.detail?.identifier;
430
- if (this.#itemRef || identifier === this._sessionContext?.navItemRefId)
441
+ /** Item-ref mode: our item rendered again, so the elements collected earlier are detached. */
442
+ #handleItemConnected() {
443
+ if (this.#readingElements !== null)
431
444
  this.#resetReadingPosition();
432
445
  }
446
+ /** Cursor mode: the active item and section, from the computed context. */
447
+ #activePosition() {
448
+ for (const part of this._computedContext?.testParts ?? []) {
449
+ for (const section of part.sections) {
450
+ if (!section.active)
451
+ continue;
452
+ return { item: section.items.find(item => item.active)?.identifier ?? null, section: section.identifier };
453
+ }
454
+ }
455
+ return { item: null, section: null };
456
+ }
433
457
  /**
434
458
  * Stimulus mode: the stimulus next to the player was (re)loaded or swapped. Forget what was
435
459
  * collected, so the next play reads the new content from the top. Unlike
@@ -475,45 +499,16 @@ export class TestItemToSpeech extends LitElement {
475
499
  return this.#contentElement();
476
500
  return this.#resolveItem()?.querySelector('qti-item-body') ?? null;
477
501
  }
478
- /** The item to read: our item-ref's (item-ref mode), or the navigated one (cursor mode). */
502
+ /**
503
+ * The item to read: our item-ref's (item-ref mode), or the active one (cursor mode). The test
504
+ * looks the active one up in its own items (`computedContext.itemElement`), so a page with
505
+ * several tests showing the same item still reads the right one.
506
+ */
479
507
  #resolveItem() {
480
508
  if (this.#itemRef)
481
509
  return this.#itemRef.assessmentItem;
482
- const identifier = this._sessionContext?.navItemRefId;
483
- return identifier ? this.#findItemInDom(identifier) : null;
484
- }
485
- /**
486
- * Cursor mode: find the rendered item for an item-ref identifier. Our own `<qti-test>` first —
487
- * a page can hold several tests showing the same item — then every root from here up to the
488
- * document; each scope directly and in the `test-container` shadow roots inside it.
489
- */
490
- #findItemInDom(identifier) {
491
- const selector = `qti-assessment-item-ref[identifier="${CSS.escape(identifier)}"] qti-assessment-item`;
492
- const search = (scope) => {
493
- const direct = scope.querySelector(selector);
494
- if (direct)
495
- return direct;
496
- for (const container of Array.from(scope.querySelectorAll('test-container'))) {
497
- const inShadow = container.shadowRoot?.querySelector(selector);
498
- if (inShadow)
499
- return inShadow;
500
- }
501
- return null;
502
- };
503
- const test = this.closest('qti-test');
504
- const inTest = test && search(test);
505
- if (inTest)
506
- return inTest;
507
- let root = this.getRootNode();
508
- for (;;) {
509
- const found = search(root);
510
- if (found)
511
- return found;
512
- const host = root.host;
513
- if (!host)
514
- return null;
515
- root = host.getRootNode();
516
- }
510
+ const { item } = this.#activePosition();
511
+ return item ? (this._computedContext?.itemElement?.(item) ?? null) : null;
517
512
  }
518
513
  /** Update speech state on both the context (notifies children) and the host's CSS custom states. */
519
514
  #setSpeechState(state) {
@@ -553,6 +548,7 @@ export class TestItemToSpeech extends LitElement {
553
548
  // so the next call retries instead of getting stuck on an empty result forever.
554
549
  if (!root)
555
550
  return [];
551
+ this.#readingRoot = root;
556
552
  // Collect block-level elements (and QTI prompt / choice elements) that contain readable text.
557
553
  // Keep only the innermost matches so `<li><p>…</p></li>` is not read twice. Content hidden
558
554
  // from assistive technology (`aria-hidden="true"`, e.g. decorative icons) is not read either.
@@ -852,10 +848,9 @@ export class TestItemToSpeech extends LitElement {
852
848
  return right < 0 ? text.length - charIndex : right;
853
849
  }
854
850
  /**
855
- * Add ::highlight() rules both to test-container's shadow root (where highlighted
856
- * text lives) and to the document (safety net — spec allows document rules to apply
857
- * across shadow DOM). Called lazily on first highlight use so test-container is
858
- * guaranteed to be in the DOM by the time navigation or speech starts.
851
+ * Add ::highlight() rules both to the shadow root the highlighted text lives in and to the
852
+ * document (safety net — spec allows document rules to apply across shadow DOM). Called lazily
853
+ * on first highlight use, once the reading elements have been collected.
859
854
  */
860
855
  #ensureHighlightStyles() {
861
856
  if (!('highlights' in CSS))
@@ -865,13 +860,10 @@ export class TestItemToSpeech extends LitElement {
865
860
  if (!document.adoptedStyleSheets.includes(sheet)) {
866
861
  document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
867
862
  }
868
- // 2. Shadow roots the highlighted text may live in: test-container's, and the player's own
869
- // root when the player itself sits inside a shadow tree (e.g. built into an item card).
863
+ // 2. Shadow roots the highlighted text may live in: the item's (e.g. test-container's), and
864
+ // the player's own root when the player itself sits inside a shadow tree (e.g. built into
865
+ // an item card).
870
866
  const roots = new Set();
871
- const testContainer = this.closest('test-navigation')?.querySelector('test-container') ??
872
- this.testHost?.querySelector('test-container');
873
- if (testContainer?.shadowRoot)
874
- roots.add(testContainer.shadowRoot);
875
867
  const ownRoot = this.getRootNode();
876
868
  if (ownRoot instanceof ShadowRoot)
877
869
  roots.add(ownRoot);
@@ -889,11 +881,8 @@ __decorate([
889
881
  property({ type: String })
890
882
  ], TestItemToSpeech.prototype, "language", void 0);
891
883
  __decorate([
892
- consume({ context: sessionContext, subscribe: true })
893
- ], TestItemToSpeech.prototype, "_sessionContext", void 0);
894
- __decorate([
895
- consume({ context: testHostContext, subscribe: true })
896
- ], TestItemToSpeech.prototype, "testHost", void 0);
884
+ consume({ context: computedContext, subscribe: true })
885
+ ], TestItemToSpeech.prototype, "_computedContext", void 0);
897
886
  __decorate([
898
887
  state(),
899
888
  provide({ context: ttsContext })
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-item-to-speech.js","sourceRoot":"","sources":["../../src/tts/test-item-to-speech.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAO/C,iFAAiF;AAEjF,MAAM,iBAAiB,GAAG,aAAa,CAAC,CAAC,oCAAoC;AAC7E,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,8BAA8B;AAEjE,gGAAgG;AAChG,kGAAkG;AAClG,mGAAmG;AACnG,oGAAoG;AACpG,6BAA6B;AAC7B,IAAI,cAAc,GAAyB,IAAI,CAAC;AAEhD,SAAS,iBAAiB;IACxB,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,IAAI,aAAa,EAAE,CAAC;QACrC,cAAc,CAAC,WAAW,CAAC;oBACX,iBAAiB;;;;oBAIjB,cAAc;;;;KAI7B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAyBD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAa,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAE3E,iFAAiF;AAEjF,6F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,CAAC,CAAC,OAAO;iBAC3C,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE;;gBAE9B,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,gBAAgB,CAAC;;KAE9D,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { html, LitElement, css } from 'lit';\nimport { consume, provide, createContext } from '@lit/context';\nimport { property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { computedContext } from '@qti-components/base';\n\nimport * as styles from '../components/styles';\n\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '@qti-components/base';\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiAssessmentItemRef } from '../components/qti-assessment-item-ref/qti-assessment-item-ref';\n\n// ─── CSS Custom Highlight ─────────────────────────────────────────────────────\n\nconst HIGHLIGHT_ELEMENT = 'tts-element'; // navigation cursor — whole element\nconst HIGHLIGHT_WORD = 'tts-word'; // word boundary during speech\n\n// Shared across all instances — added to whichever shadow root needs it. The two highlights are\n// tints of the theme's info (the element being read) and warning (the word being spoken) colours,\n// see-through so the text and its own background stay visible. Without the theme they fall back to\n// the system Highlight and Mark colours. A host repaints them with --test-tts-element-highlight and\n// --test-tts-word-highlight.\nlet highlightSheet: CSSStyleSheet | null = null;\n\nfunction getHighlightSheet(): CSSStyleSheet {\n if (!highlightSheet) {\n highlightSheet = new CSSStyleSheet();\n highlightSheet.replaceSync(`\n ::highlight(${HIGHLIGHT_ELEMENT}) {\n background-color: var(--test-tts-element-highlight, color-mix(in oklab, var(--qti-color-info, var(--cito-color-info, Highlight)) 15%, transparent));\n color: inherit;\n }\n ::highlight(${HIGHLIGHT_WORD}) {\n background-color: var(--test-tts-word-highlight, color-mix(in oklab, var(--qti-color-warning, var(--cito-color-warning, Mark)) 55%, transparent));\n color: inherit;\n }\n `);\n }\n return highlightSheet;\n}\n\ntype SpeechState = 'idle' | 'playing' | 'paused';\n\n// ─── TTS Context ──────────────────────────────────────────────────────────────\n\nexport interface TtsContext {\n state: SpeechState;\n /** True while every reading element is highlighted and a click on one starts reading there. */\n picking: boolean;\n /** Index of the currently highlighted reading element (0-based). */\n currentElementIndex: number;\n /** Total number of navigable reading elements in the current item. */\n elementCount: number;\n play(): void;\n pause(): void;\n resume(): void;\n stop(): void;\n prevElement(): void;\n nextElement(): void;\n /** Toggle pick mode: highlight all reading elements, then read from the one that is clicked. */\n togglePick(): void;\n}\n\nexport { SpeechState };\nexport const ttsContext = createContext<TtsContext>(Symbol('tts-context'));\n\n// ─── Icons ────────────────────────────────────────────────────────────────────\n\n// Plain geometric glyphs on a 24-unit grid, painted in currentColor. SVG rather than text so\n// every button gets the same box: text glyphs (◀◀ ▶ ⏸ ■ ☞) differ in width, and some fall back\n// to an emoji font with different line metrics.\nconst ICONS = {\n play: 'M8 5v14l11-7z',\n pause: 'M6 5h4v14H6zM14 5h4v14h-4z',\n stop: 'M6 6h12v12H6z',\n prev: 'M6 5h2v14H6zM20 5v14L9 12z',\n next: 'M16 5h2v14h-2zM4 5v14l11-7z',\n pick: 'M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z'\n} as const;\n\n/** Default button content: the icon, plus a visually hidden label as the accessible name. */\nconst iconContent = (icon: keyof typeof ICONS, label: string) => {\n const svg = html`<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"${ICONS[icon]}\"></path>\n </svg>`;\n return html`${svg}<span class=\"label\">${label}</span>`;\n};\n\n// ─── Shared base for child button elements ────────────────────────────────────\n\n/**\n * Base class shared by all TTS control elements. Consumes `ttsContext` and\n * mirrors the current speech state onto CSS custom states so each child can\n * be styled with `:state(playing)`, `:state(paused)`, `:state(idle)`.\n */\nabstract class TtsButtonBase extends LitElement {\n static override styles = css`\n :host {\n display: inline-flex;\n }\n button {\n ${styles.btn};\n min-inline-size: var(--test-button-size, 2.25rem);\n padding-inline: 0.5rem;\n /* Containing block for the visually hidden .label. Without it the label is placed against\n the nearest positioned ancestor, which can sit outside a scroll container and make the\n page as tall as the scrolled content. */\n position: relative;\n }\n @media (hover: hover) and (pointer: fine) {\n button:hover:not(:disabled) {\n ${styles.btnInteractive};\n }\n }\n button:active:not(:disabled) {\n ${styles.btnActive};\n }\n button:focus-visible {\n ${styles.focusRing};\n }\n button:disabled {\n ${styles.dis};\n }\n button[aria-pressed='true'],\n button[aria-pressed='true']:hover {\n background-color: var(--test-button-selected-background-color, var(--qti-selected-bg, Highlight));\n color: var(--test-button-selected-color, var(--qti-selected-color, HighlightText));\n }\n svg,\n ::slotted(svg) {\n flex: none;\n inline-size: var(--test-tts-icon-size, 1.125rem);\n block-size: var(--test-tts-icon-size, 1.125rem);\n }\n svg {\n fill: currentColor;\n }\n /* The default content is icon-only; this keeps the button's accessible name. */\n .label {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n `;\n\n /**\n * Accessible name of the button. Without it the default icon carries an English name, and\n * slotted content names the button by its text; set it when you slot an icon of your own,\n * which has no text to be named by.\n */\n @property({ type: String }) label?: string;\n\n #internals = this.attachInternals();\n\n @consume({ context: ttsContext, subscribe: true })\n protected _tts?: TtsContext;\n\n #mirroredState: SpeechState | undefined;\n #mirroredPicking = false;\n\n override updated(_changed: PropertyValues) {\n // `_tts` is a context field, not a reactive property, so it never shows up in `changed`:\n // compare against what was last mirrored instead.\n const state = this._tts?.state;\n const picking = this._tts?.picking ?? false;\n if (state === this.#mirroredState && picking === this.#mirroredPicking) return;\n this.#mirroredState = state;\n this.#mirroredPicking = picking;\n this.#internals.states.clear();\n if (state) this.#internals.states.add(state);\n if (picking) this.#internals.states.add('picking');\n }\n}\n\n// ─── Controller element ───────────────────────────────────────────────────────\n\n/**\n * `<test-item-to-speech>` is the controller and context provider. It manages\n * speech synthesis, word highlighting, and item element lookup. Compose your\n * own player by placing control elements as children.\n *\n * @example\n * ```html\n * <test-item-to-speech language=\"nl-NL\">\n * <test-tts-play></test-tts-play>\n * <test-tts-prev></test-tts-prev>\n * <test-tts-next></test-tts-next>\n * <test-tts-stop></test-tts-stop>\n * </test-item-to-speech>\n * ```\n *\n * The controller lays its controls out as a wrapping row; each control draws an icon button,\n * and slotted content replaces the icon — a slotted `<svg>` is sized like the default one. Give a\n * 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\n * defaults as fallbacks) and can be sized with `--test-button-size` and `--test-tts-icon-size`.\n *\n * ### Language resolution\n *\n * Each reading element is spoken in the language of the nearest `lang` attribute:\n *\n * 1. `lang` (or `xml:lang`) on the element itself\n * 2. `lang` on the closest ancestor — including `<qti-assessment-item xml:lang>` and, across\n * shadow roots, anything wrapping the test\n * 3. `lang` on the document's `<html>` element\n * 4. the `language` attribute on `<test-item-to-speech>`\n *\n * The transformer copies `xml:lang` over as a plain `lang` attribute, so QTI authored with\n * `xml:lang=\"en-GB\"` on a `<p>` or on the item root is honoured without further work.\n *\n * ### What is read\n *\n * Decided once per connect, by where the player is placed. The first rule that matches wins:\n *\n * 1. **Next to a stimulus placeholder** — the player shares its parent with a\n * `[data-stimulus-idref]` element, e.g. in a reading-text panel beside the questions: the\n * player reads that stimulus (its `qti-stimulus-body`), and only that. Not inside the\n * placeholder: loading a stimulus replaces the placeholder's content. Items and navigation\n * are ignored; when the stimulus is (re)loaded or the placeholder swapped, the player starts\n * over on the new content.\n * 2. **Next to `[data-tts-content]`** — the player shares its parent with an element marked\n * `data-tts-content`: any HTML, not QTI, e.g. a start screen rendered by React. The marker goes\n * on one container; the player reads the readable elements inside it. Navigation is ignored.\n * The reading list is rebuilt when the player starts from the top, and when an element in it\n * has left the page — so a re-render of the content never interrupts speech.\n * 3. **Inside a `qti-assessment-item-ref`** — e.g. in a `<template item-ref>` on `<qti-test>`,\n * so every item gets a player of its own: the player reads that item, and only that item.\n * The navigation cursor is ignored; speech stops when the player leaves the page with its item.\n * 4. **Anywhere else inside `<test-navigation>`** — e.g. a toolbar: the player follows the\n * navigation cursor and reads the active item of the computed context. Navigating stops\n * speech and starts the next item from the top.\n *\n * ```html\n * <!-- 1. a player for the shared reading text -->\n * <aside>\n * <test-item-to-speech>…</test-item-to-speech>\n * <div data-stimulus-idref=\"Stimulus1\"></div>\n * </aside>\n *\n * <!-- 2. a player for any other HTML -->\n * <div>\n * <test-item-to-speech>…</test-item-to-speech>\n * <section data-tts-content lang=\"nl-NL\">…</section>\n * </div>\n *\n * <!-- 3. one player per item -->\n * <qti-test>\n * <template item-ref>\n * <test-item-to-speech>…</test-item-to-speech>\n * {{ xmlDoc }}\n * </template>\n * …\n * </qti-test>\n *\n * <!-- 4. one player in the toolbar, following navigation -->\n * <test-navigation>\n * <header><test-item-to-speech>…</test-item-to-speech></header>\n * <test-container test-url=\"…\"></test-container>\n * </test-navigation>\n * ```\n *\n * In modes 3 and 4 the item re-rendering (navigating to the item already shown) restarts the\n * player on the fresh content. An item player reads the item body as rendered: a stimulus\n * placed inside the item is read with it, one placed outside (mode 1) is not. Only one player\n * can speak at a time; starting one stops any other.\n *\n * Read are `p`, `h1`–`h6`, `li`, `dt`, `dd`, `th`, `td`, `caption`, `blockquote`, `figcaption`,\n * `qti-prompt` and `qti-simple-choice` — the innermost match only — unless hidden (`display: none`)\n * or inside `aria-hidden=\"true\"`.\n *\n * ### Starting somewhere in the middle\n *\n * `<test-tts-pick>` switches the player into pick mode: every reading element gets the blue\n * cursor highlight, and the first click on one of them leaves pick mode and starts reading\n * from that element. Pressing the button again leaves pick mode without reading.\n *\n * @cssstate idle - No speech active\n * @cssstate picking - Pick mode: all reading elements highlighted, waiting for a click\n * @cssstate playing - Speech is playing\n * @cssstate paused - Speech is paused\n */\n\nexport class TestItemToSpeech extends LitElement {\n static override styles = css`\n :host {\n display: inline-flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--test-tts-gap, 0.25rem);\n }\n `;\n\n /** Fallback language when neither the item content nor the document declares one. */\n @property({ type: String }) language = 'nl-NL';\n\n /**\n * The test as `test-navigation` computes it: which item is active, and where it is rendered\n * (`itemElement`). Updated on navigation and whenever an item is rendered.\n */\n @consume({ context: computedContext, subscribe: true })\n protected _computedContext?: ComputedContext;\n\n @state()\n @provide({ context: ttsContext })\n _ttsContext!: TtsContext;\n\n #internals = this.attachInternals();\n\n // Stimulus mode: set on connect when a stimulus placeholder sits next to the player. The\n // placeholder itself is looked up on every use — a host may swap the element.\n #stimulusMode = false;\n // Stimulus mode: resets the player when the stimulus content next to it is replaced.\n #stimulusObserver: MutationObserver | null = null;\n // Content mode: set on connect when a `[data-tts-content]` element sits next to the player.\n // Any HTML, not QTI. No observer: the reading list is rebuilt on demand (#getReadingElements).\n #contentMode = false;\n // Item-ref mode: the item-ref this player sits in, resolved on connect. Null means cursor mode.\n #itemRef: QtiAssessmentItemRef | null = null;\n // Item-ref mode: our item-ref, for its item-connected event. Cursor mode: where prev/next's\n // navigation request is heard.\n #eventHost: EventTarget | null = null;\n #boundHandleItemConnected = this.#handleItemConnected.bind(this);\n #boundHandleNavigation = () => this.#stop();\n\n // Cursor mode: the previous navigation position, to detect moving to another item or section.\n #prevNavItemRefId: string | null | undefined = undefined;\n #prevNavSectionId: string | null | undefined = undefined;\n\n // Current set of block-level reading elements for the item, and the root they were collected from\n #readingElements: Element[] | null = null;\n #readingRoot: Element | null = null;\n #currentElementIndex = 0;\n\n // Text nodes of the element currently being spoken (for word-boundary highlight)\n #textNodes: Text[] = [];\n\n // The utterance this player is speaking; lets the error handler tell \"our speech was\n // cancelled by another player\" apart from a cancel we issued ourselves.\n #currentUtterance: SpeechSynthesisUtterance | null = null;\n\n // Pick mode: all elements highlighted, a click on one starts reading from there.\n #picking = false;\n #pickRoot: EventTarget | null = null;\n #boundHandlePickClick = this.#handlePickClick.bind(this);\n\n // Set when the last element has been read: the cursor stays on it (so prev still works),\n // but the next play starts the item over instead of repeating that last element.\n #finished = false;\n\n // Two separate CSS Highlight objects\n #elementHighlight = new Highlight(); // whole-element cursor\n #wordHighlight = new Highlight(); // current word during speech\n\n constructor() {\n super();\n this._ttsContext = {\n state: 'idle',\n currentElementIndex: 0,\n elementCount: 0,\n play: () => this.#playSpeech(),\n pause: () => this.#pause(),\n resume: () => this.#resume(),\n stop: () => {\n this.#stopPicking();\n this.#stop();\n },\n prevElement: () => this.#prevElement(),\n nextElement: () => this.#nextElement(),\n togglePick: () => this.#togglePick(),\n picking: false\n };\n }\n\n // willUpdate, not updated: resetting writes _ttsContext, and state set here goes into the\n // render already under way instead of scheduling a second one (Lit's change-in-update).\n override willUpdate(changed: PropertyValues) {\n super.willUpdate(changed);\n // Stimulus, content and item-ref mode: the navigation cursor does not change what this player reads.\n if (this.#stimulusMode || this.#contentMode || this.#itemRef) return;\n // Cursor mode: moving to another item or section stops speech and starts over (ignore the\n // initial undefined → value transition). Section navigation leaves no item active, so it\n // needs its own check.\n const { item, section } = this.#activePosition();\n const itemChanged = this.#prevNavItemRefId !== undefined && this.#prevNavItemRefId !== item;\n const sectionChanged = this.#prevNavSectionId !== undefined && this.#prevNavSectionId !== section;\n // The same item rendered again (e.g. linking to the item already shown): the elements\n // collected earlier are detached. The context updates when an item renders, so check here.\n const rerendered =\n this.#readingElements !== null && this.#readingRoot !== null && this.#readingRoot !== this.#resolveReadingRoot();\n if (itemChanged || sectionChanged || rerendered) this.#resetReadingPosition();\n this.#prevNavItemRefId = item;\n this.#prevNavSectionId = section;\n }\n\n /** Stop speech and forget the collected reading elements, so the next play starts afresh. */\n #resetReadingPosition() {\n this.#stopPicking();\n this.#stop();\n this.#readingElements = null;\n this.#currentElementIndex = 0;\n this.#finished = false;\n this.#updateContext();\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.#setSpeechState('idle');\n // NOTE: #ensureHighlightStyles() is called lazily on first highlight use\n // because the item to read may not be in the DOM yet at this point.\n this.#stimulusMode = this.#stimulusPlaceholder() !== null;\n if (this.#stimulusMode) {\n // Stimulus mode: neither items nor navigation decide what is read, only the content of the\n // placeholder. qti-components replaces it whenever it loads a stimulus (innerHTML, then\n // append), so watch the parent — that also catches a host swapping the placeholder itself.\n this.#stimulusObserver = new MutationObserver(records => {\n if (records.some(record => !this.contains(record.target))) this.#handleStimulusReplaced();\n });\n this.#stimulusObserver.observe(this.parentElement!, { childList: true, subtree: true });\n return;\n }\n // Content mode: plain HTML next to the player. Nothing to listen for: what is read only\n // depends on that element, and the reading list is rebuilt when it goes stale.\n this.#contentMode = this.#contentElement() !== null;\n if (this.#contentMode) return;\n this.#itemRef = this.closest<QtiAssessmentItemRef>('qti-assessment-item-ref');\n if (this.#itemRef) {\n // Item-ref mode: qti-assessment-item-connected (bubbles+composed) passes our own item-ref\n // when our item renders again.\n this.#eventHost = this.#itemRef;\n this.#eventHost.addEventListener('qti-assessment-item-connected', this.#boundHandleItemConnected);\n } else {\n // Cursor mode: cito-test-navigate fires synchronously on prev/next — stop right away\n // instead of waiting for the new position to arrive through the computed context.\n this.#eventHost = this.closest('test-navigation') ?? (this.getRootNode() as EventTarget);\n this.#eventHost.addEventListener('cito-test-navigate', this.#boundHandleNavigation);\n this.#eventHost.addEventListener('qti-request-navigation', this.#boundHandleNavigation); // deprecated name, still sent by hosts\n }\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n // Only silence the synthesizer if it is speaking for this player.\n if (this.#currentUtterance) {\n this.#currentUtterance = null;\n speechSynthesis.cancel();\n }\n this.#stopPicking();\n this.#clearAllHighlights();\n this.#eventHost?.removeEventListener('qti-assessment-item-connected', this.#boundHandleItemConnected);\n this.#eventHost?.removeEventListener('cito-test-navigate', this.#boundHandleNavigation);\n this.#eventHost?.removeEventListener('qti-request-navigation', this.#boundHandleNavigation);\n this.#eventHost = null;\n this.#itemRef = null;\n this.#stimulusObserver?.disconnect();\n this.#stimulusObserver = null;\n this.#stimulusMode = false;\n this.#contentMode = false;\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n /** Item-ref mode: our item rendered again, so the elements collected earlier are detached. */\n #handleItemConnected() {\n if (this.#readingElements !== null) this.#resetReadingPosition();\n }\n\n /** Cursor mode: the active item and section, from the computed context. */\n #activePosition(): { item: string | null; section: string | null } {\n for (const part of this._computedContext?.testParts ?? []) {\n for (const section of part.sections) {\n if (!section.active) continue;\n return { item: section.items.find(item => item.active)?.identifier ?? null, section: section.identifier };\n }\n }\n return { item: null, section: null };\n }\n\n /**\n * Stimulus mode: the stimulus next to the player was (re)loaded or swapped. Forget what was\n * collected, so the next play reads the new content from the top. Unlike\n * #resetReadingPosition this only cancels speech that is ours: a stimulus can finish loading\n * while an item player on the same page is speaking.\n */\n #handleStimulusReplaced() {\n if (this.#currentUtterance) {\n this.#currentUtterance = null;\n speechSynthesis.cancel();\n }\n this.#stopPicking();\n this.#clearAllHighlights();\n this.#setSpeechState('idle');\n this.#readingElements = null;\n this.#currentElementIndex = 0;\n this.#finished = false;\n this.#updateContext();\n }\n\n /**\n * Stimulus mode: the `[data-stimulus-idref]` placeholder that shares this player's parent, or\n * null. A placeholder holds the stimulus once loaded; the player cannot sit inside it, because\n * loading replaces the placeholder's content.\n */\n #stimulusPlaceholder(): Element | null {\n return this.parentElement?.querySelector(':scope > [data-stimulus-idref]') ?? null;\n }\n\n /**\n * Content mode: the `[data-tts-content]` element that shares this player's parent, or null.\n * The marker goes on one container; the player finds the readable elements inside it.\n */\n #contentElement(): Element | null {\n return this.parentElement?.querySelector(':scope > [data-tts-content]') ?? null;\n }\n\n /**\n * The element whose text is read: the stimulus body next to the player (stimulus mode), the\n * marked content next to it (content mode), or the item body of the item to read.\n */\n #resolveReadingRoot(): Element | null {\n if (this.#stimulusMode) return this.#stimulusPlaceholder()?.querySelector('qti-stimulus-body') ?? null;\n if (this.#contentMode) return this.#contentElement();\n return this.#resolveItem()?.querySelector('qti-item-body') ?? null;\n }\n\n /**\n * The item to read: our item-ref's (item-ref mode), or the active one (cursor mode). The test\n * looks the active one up in its own items (`computedContext.itemElement`), so a page with\n * several tests showing the same item still reads the right one.\n */\n #resolveItem(): QtiAssessmentItem | null {\n if (this.#itemRef) return this.#itemRef.assessmentItem;\n const { item } = this.#activePosition();\n return item ? ((this._computedContext?.itemElement?.(item) as QtiAssessmentItem | null) ?? null) : null;\n }\n\n /** Update speech state on both the context (notifies children) and the host's CSS custom states. */\n #setSpeechState(state: SpeechState) {\n this._ttsContext = { ...this._ttsContext, state };\n this.#internals.states.delete('idle');\n this.#internals.states.delete('playing');\n this.#internals.states.delete('paused');\n this.#internals.states.add(state);\n }\n\n /** Push currentElementIndex and elementCount into context so children can react. */\n #updateContext() {\n this._ttsContext = {\n ...this._ttsContext,\n currentElementIndex: this.#currentElementIndex,\n elementCount: this.#getReadingElements().length\n };\n }\n\n /**\n * Return the currently readable elements: cached candidates for the item or stimulus (collected lazily on\n * first call), filtered live for visibility on every call. Feedback and other\n * conditionally-shown content (e.g. `qti-feedback-block`, which is `display: none` until a\n * CSS custom state reveals it) is excluded while hidden and picked up again once shown,\n * without needing to re-collect the candidate set.\n */\n #getReadingElements(): Element[] {\n // Content mode has no events or observer telling it the content changed (a framework like\n // React re-renders it at will). Rebuild the list once an element in it has left the page;\n // text changed inside an element needs nothing, it is read when that element is spoken.\n if (this.#contentMode && this.#readingElements?.some(el => !el.isConnected)) {\n this.#readingElements = null;\n this.#currentElementIndex = 0;\n this.#finished = false;\n }\n if (this.#readingElements === null) {\n const root = this.#resolveReadingRoot();\n // Leave the cache empty (rather than `[]`) while the item or stimulus has not rendered yet,\n // so the next call retries instead of getting stuck on an empty result forever.\n if (!root) return [];\n this.#readingRoot = root;\n\n // Collect block-level elements (and QTI prompt / choice elements) that contain readable text.\n // Keep only the innermost matches so `<li><p>…</p></li>` is not read twice. Content hidden\n // from assistive technology (`aria-hidden=\"true\"`, e.g. decorative icons) is not read either.\n const selector =\n 'p, h1, h2, h3, h4, h5, h6, li, dt, dd, th, td, caption, blockquote, figcaption, qti-prompt, qti-simple-choice';\n this.#readingElements = Array.from(root.querySelectorAll(selector)).filter(\n el =>\n (el.textContent ?? '').trim().length > 0 && !el.querySelector(selector) && !el.closest('[aria-hidden=\"true\"]')\n );\n }\n\n return this.#readingElements.filter(el => this.#isVisible(el));\n }\n\n /** True when an element is actually rendered — not `display: none` (itself or an ancestor). */\n #isVisible(element: Element): boolean {\n if (typeof element.checkVisibility === 'function') {\n return element.checkVisibility({ checkOpacity: false, checkVisibilityCSS: true });\n }\n // Older Safari (< 17.4) fallback: display:none leaves no client rects. Doesn't catch\n // visibility:hidden, which still occupies layout, but display:none is what QTI feedback\n // elements actually use (see qti-feedback-block/qti-feedback-inline default styles).\n return element.getClientRects().length > 0;\n }\n\n /**\n * Resolve the speech language for a reading element.\n * Element `lang` → closest ancestor `lang` (crossing shadow hosts) → `<html lang>` → `language` attribute.\n * Empty `lang=\"\"` is treated as absent.\n */\n #resolveLang(element: Element): string {\n let node: Element | null = element;\n while (node) {\n const lang = node.getAttribute('lang') || node.getAttribute('xml:lang');\n if (lang?.trim()) return lang.trim();\n node = node.parentElement ?? (node.getRootNode() as ShadowRoot).host ?? null;\n }\n const documentLang = document.documentElement.getAttribute('lang');\n if (documentLang?.trim()) return documentLang.trim();\n return this.language;\n }\n\n #playSpeech() {\n const elements = this.#getReadingElements();\n if (!elements.length) {\n console.warn('test-item-to-speech: no readable elements found');\n return;\n }\n this.#stopPicking();\n // speechSynthesis is one global queue: another player mid-sentence would otherwise\n // finish first and this one would silently wait its turn.\n speechSynthesis.cancel();\n if (this.#finished) {\n this.#finished = false;\n this.#currentElementIndex = 0;\n }\n // Content mode: starting from the top rebuilds the list, so elements the page added since\n // the last read (a framework re-render) are included.\n if (this.#contentMode && this.#currentElementIndex === 0) this.#readingElements = null;\n this.#speakElement(this.#currentElementIndex);\n }\n\n /** Speak the element at the given index, then auto-advance when it ends. */\n #speakElement(index: number) {\n const elements = this.#getReadingElements();\n\n if (index >= elements.length) {\n // Finished all elements — stay on the last element so the user can walk back with prev\n this.#clearWordHighlight();\n this.#currentElementIndex = elements.length - 1;\n if (elements.length > 0) this.#highlightElement(elements[this.#currentElementIndex]);\n this.#finished = true;\n this.#setSpeechState('idle');\n this.#updateContext();\n return;\n }\n\n this.#currentElementIndex = index;\n this.#finished = false;\n this.#updateContext();\n\n const element = elements[index];\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n this.#highlightElement(element);\n\n // Collect text nodes of this element for word-boundary mapping\n this.#textNodes = this.#collectTextNodes(element);\n const text = this.#textNodes.map(n => n.textContent ?? '').join('');\n\n if (!text.trim()) {\n // Skip blank element and move to next\n this.#speakElement(index + 1);\n return;\n }\n\n const utterance = new SpeechSynthesisUtterance(text);\n utterance.lang = this.#resolveLang(element);\n utterance.rate = 1;\n\n utterance.onboundary = (event: SpeechSynthesisEvent) => {\n if (event.name !== 'word') return;\n this.#updateWordHighlight(event.charIndex, event.charLength ?? 0);\n };\n\n utterance.onend = () => {\n if (this.#currentUtterance !== utterance) return;\n this.#currentUtterance = null;\n this.#clearWordHighlight();\n this.#speakElement(this.#currentElementIndex + 1);\n };\n\n // Fires when speech is cancelled from outside this player (another player starting,\n // or the browser); a cancel we issued ourselves has already cleared #currentUtterance.\n utterance.onerror = () => {\n if (this.#currentUtterance !== utterance) return;\n this.#currentUtterance = null;\n this.#clearAllHighlights();\n this.#setSpeechState('idle');\n };\n\n this.#currentUtterance = utterance;\n speechSynthesis.speak(utterance);\n this.#setSpeechState('playing');\n }\n\n #pause() {\n speechSynthesis.pause();\n this.#setSpeechState('paused');\n }\n\n #resume() {\n speechSynthesis.resume();\n this.#setSpeechState('playing');\n }\n\n #stop() {\n this.#currentUtterance = null;\n speechSynthesis.cancel();\n this.#clearAllHighlights();\n this.#setSpeechState('idle');\n }\n\n // ─── Pick mode ────────────────────────────────────────────────────────────\n\n #togglePick() {\n if (this.#picking) this.#stopPicking();\n else this.#startPicking();\n }\n\n /** Highlight every reading element and wait for a click on one of them. */\n #startPicking() {\n // Content mode: pick from the page as it is now, like starting from the top does.\n if (this.#contentMode) this.#readingElements = null;\n const elements = this.#getReadingElements();\n if (!elements.length) {\n console.warn('test-item-to-speech: no readable elements found');\n return;\n }\n this.#stop();\n this.#picking = true;\n this.#internals.states.add('picking');\n this.#highlightElements(elements);\n // Listen on the item's root so the click is seen before any interaction handles it — in\n // pick mode a click on a choice picks the sentence, it does not answer the question.\n this.#pickRoot = elements[0].getRootNode();\n this.#pickRoot.addEventListener('click', this.#boundHandlePickClick, true);\n this._ttsContext = { ...this._ttsContext, picking: true };\n }\n\n #stopPicking() {\n if (!this.#picking) return;\n this.#picking = false;\n this.#internals.states.delete('picking');\n this.#pickRoot?.removeEventListener('click', this.#boundHandlePickClick, true);\n this.#pickRoot = null;\n this.#clearAllHighlights();\n this._ttsContext = { ...this._ttsContext, picking: false };\n }\n\n #handlePickClick(event: Event) {\n const elements = this.#getReadingElements();\n const path = event.composedPath();\n let index = elements.findIndex(el => path.includes(el));\n if (index < 0) {\n // Not on the text itself. A click on the choice or list item around it (its radio button,\n // the padding) still means \"this one\": take the first reading element inside it.\n const container = path.find(\n (node): node is Element => node instanceof Element && node.matches('qti-simple-choice, li, qti-prompt')\n );\n if (container) index = elements.findIndex(el => container.contains(el));\n }\n if (index < 0) return; // not on a highlighted element — stay in pick mode\n event.preventDefault();\n event.stopPropagation();\n this.#stopPicking();\n speechSynthesis.cancel();\n this.#speakElement(index);\n }\n\n #prevElement() {\n const elements = this.#getReadingElements();\n if (!elements.length) return;\n this.#currentUtterance = null;\n speechSynthesis.cancel();\n this.#clearWordHighlight();\n this.#currentElementIndex = Math.max(0, this.#currentElementIndex - 1);\n this.#finished = false;\n this.#updateContext();\n const el = elements[this.#currentElementIndex];\n el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n this.#highlightElement(el);\n this.#setSpeechState('idle');\n }\n\n #nextElement() {\n const elements = this.#getReadingElements();\n if (!elements.length) return;\n this.#currentUtterance = null;\n speechSynthesis.cancel();\n this.#clearWordHighlight();\n this.#currentElementIndex = Math.min(elements.length - 1, this.#currentElementIndex + 1);\n this.#finished = false;\n this.#updateContext();\n const el = elements[this.#currentElementIndex];\n el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n this.#highlightElement(el);\n this.#setSpeechState('idle');\n }\n\n /** Walk text nodes without crossing shadow DOM boundaries. */\n #collectTextNodes(root: Element): Text[] {\n const nodes: Text[] = [];\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n let node: Node | null;\n while ((node = walker.nextNode())) {\n // Text hidden from assistive technology inside a read element — a decorative icon in a\n // list item — is not spoken either. Skipped here, so speech and word highlight agree.\n if ((node.textContent ?? '').length > 0 && !node.parentElement?.closest('[aria-hidden=\"true\"]')) {\n nodes.push(node as Text);\n }\n }\n return nodes;\n }\n\n /** Highlight the whole element as the navigation cursor (blue). */\n #highlightElement(element: Element) {\n this.#highlightElements([element]);\n }\n\n /** Put the blue cursor highlight on several elements at once (pick mode). */\n #highlightElements(elements: Element[]) {\n if (!('highlights' in CSS)) return;\n this.#ensureHighlightStyles();\n this.#elementHighlight.clear();\n for (const element of elements) {\n const range = new Range();\n range.selectNodeContents(element);\n this.#elementHighlight.add(range);\n }\n CSS.highlights.set(HIGHLIGHT_ELEMENT, this.#elementHighlight);\n }\n\n /** Highlight the current word within #textNodes (yellow, during speech). */\n #updateWordHighlight(charIndex: number, charLength: number) {\n if (!('highlights' in CSS)) return;\n this.#ensureHighlightStyles();\n this.#wordHighlight.clear();\n\n const text = this.#textNodes.map(n => n.textContent ?? '').join('');\n const endIndex = charIndex + (charLength > 0 ? charLength : this.#wordLengthAt(charIndex, text));\n let offset = 0;\n let startNode: Text | null = null;\n let startOffset = 0;\n let endNode: Text | null = null;\n let endOffset = 0;\n\n for (const node of this.#textNodes) {\n const len = node.textContent?.length ?? 0;\n if (!startNode && offset + len > charIndex) {\n startNode = node;\n startOffset = charIndex - offset;\n }\n if (startNode && offset + len >= endIndex) {\n endNode = node;\n endOffset = endIndex - offset;\n break;\n }\n offset += len;\n }\n\n if (startNode && endNode) {\n const range = new Range();\n range.setStart(startNode, startOffset);\n range.setEnd(endNode, endOffset);\n this.#wordHighlight.add(range);\n CSS.highlights.set(HIGHLIGHT_WORD, this.#wordHighlight);\n }\n }\n\n #clearWordHighlight() {\n if (!('highlights' in CSS)) return;\n this.#wordHighlight.clear();\n // The registry is shared by every player on the page: only drop the entry if it is ours.\n if (CSS.highlights.get(HIGHLIGHT_WORD) === this.#wordHighlight) CSS.highlights.delete(HIGHLIGHT_WORD);\n }\n\n #clearAllHighlights() {\n if (!('highlights' in CSS)) return;\n this.#clearWordHighlight();\n this.#elementHighlight.clear();\n if (CSS.highlights.get(HIGHLIGHT_ELEMENT) === this.#elementHighlight) CSS.highlights.delete(HIGHLIGHT_ELEMENT);\n }\n\n /** Fallback word-length when charLength is 0. */\n #wordLengthAt(charIndex: number, text: string): number {\n const right = text.slice(charIndex).search(/\\s/);\n return right < 0 ? text.length - charIndex : right;\n }\n\n /**\n * Add ::highlight() rules both to the shadow root the highlighted text lives in and to the\n * document (safety net — spec allows document rules to apply across shadow DOM). Called lazily\n * on first highlight use, once the reading elements have been collected.\n */\n #ensureHighlightStyles() {\n if (!('highlights' in CSS)) return;\n const sheet = getHighlightSheet();\n\n // 1. Document-level rule — applies broadly regardless of shadow DOM depth\n if (!document.adoptedStyleSheets.includes(sheet)) {\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];\n }\n\n // 2. Shadow roots the highlighted text may live in: the item's (e.g. test-container's), and\n // the player's own root when the player itself sits inside a shadow tree (e.g. built into\n // an item card).\n const roots = new Set<ShadowRoot>();\n const ownRoot = this.getRootNode();\n if (ownRoot instanceof ShadowRoot) roots.add(ownRoot);\n const itemRoot = this.#readingElements?.[0]?.getRootNode();\n if (itemRoot instanceof ShadowRoot) roots.add(itemRoot);\n for (const root of roots) {\n if (!root.adoptedStyleSheets.includes(sheet)) {\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];\n }\n }\n }\n}\n\n// ─── Child control elements ───────────────────────────────────────────────────\n\n/**\n * Play/pause/resume toggle button — always enabled, cycles through states.\n * Use named slots `play` and `pause` to customise the icons/labels independently; `label` and\n * `pause-label` name the button in each state (set them when the slotted content is an icon).\n *\n * @example\n * ```html\n * <test-tts-play>\n * <span slot=\"play\">Voorlezen</span>\n * <span slot=\"pause\">Pauzeren</span>\n * </test-tts-play>\n * ```\n *\n * @cssstate idle / playing / paused\n * @csspart button\n */\n\nexport class TestTtsPlay extends TtsButtonBase {\n /** Accessible name of the button while speech is playing; see `label`. */\n @property({ type: String, attribute: 'pause-label' }) pauseLabel?: string;\n\n #toggle() {\n if (!this._tts) return;\n if (this._tts.state === 'idle') this._tts.play();\n else if (this._tts.state === 'playing') this._tts.pause();\n else this._tts.resume();\n }\n\n override render() {\n const playing = this._tts?.state === 'playing';\n return html`\n <button part=\"button\" aria-label=${ifDefined(playing ? this.pauseLabel : this.label)} @click=${this.#toggle}>\n ${playing\n ? html`<slot name=\"pause\">${iconContent('pause', this.pauseLabel ?? 'Pause')}</slot>`\n : html`<slot name=\"play\">${iconContent('play', this.label ?? 'Play')}</slot>`}\n </button>\n `;\n }\n}\n\n/**\n * Pause button — enabled only when playing.\n * @cssstate idle / playing / paused\n * @csspart button\n */\n\nexport class TestTtsPause extends TtsButtonBase {\n override render() {\n return html`\n <button\n part=\"button\"\n aria-label=${ifDefined(this.label)}\n ?disabled=${this._tts?.state !== 'playing'}\n @click=${() => this._tts?.pause()}\n >\n <slot>${iconContent('pause', this.label ?? 'Pause')}</slot>\n </button>\n `;\n }\n}\n\n/**\n * Resume button — enabled only when paused.\n * @cssstate idle / playing / paused\n * @csspart button\n */\n\nexport class TestTtsResume extends TtsButtonBase {\n override render() {\n return html`\n <button\n part=\"button\"\n aria-label=${ifDefined(this.label)}\n ?disabled=${this._tts?.state !== 'paused'}\n @click=${() => this._tts?.resume()}\n >\n <slot>${iconContent('play', this.label ?? 'Resume')}</slot>\n </button>\n `;\n }\n}\n\n/**\n * Stop button — enabled when playing, paused, or in pick mode (where it leaves pick mode).\n * @cssstate idle / playing / paused\n * @csspart button\n */\n\nexport class TestTtsStop extends TtsButtonBase {\n override render() {\n const idle = this._tts?.state === 'idle' && !this._tts?.picking;\n return html`\n <button part=\"button\" aria-label=${ifDefined(this.label)} ?disabled=${idle} @click=${() => this._tts?.stop()}>\n <slot>${iconContent('stop', this.label ?? 'Stop')}</slot>\n </button>\n `;\n }\n}\n\n/**\n * Prev-element button — moves cursor to the previous reading element and pauses.\n * Disabled at the first element. Reading elements are collected lazily, so an element count\n * of 0 means \"not looked yet\" rather than \"nothing to read\": the button stays enabled and the\n * first click collects them.\n * @cssstate idle / playing / paused\n * @csspart button\n */\n\nexport class TestTtsPrev extends TtsButtonBase {\n override render() {\n const collected = (this._tts?.elementCount ?? 0) > 0;\n const atStart = (this._tts?.currentElementIndex ?? 0) === 0;\n return html`\n <button\n part=\"button\"\n aria-label=${ifDefined(this.label)}\n ?disabled=${collected && atStart}\n @click=${() => this._tts?.prevElement()}\n >\n <slot>${iconContent('prev', this.label ?? 'Previous sentence')}</slot>\n </button>\n `;\n }\n}\n\n/**\n * Next-element button — moves cursor to the next reading element and pauses.\n * Disabled at the last element; enabled while the elements have not been collected yet\n * (see `TestTtsPrev`).\n * @cssstate idle / playing / paused\n * @csspart button\n */\n\nexport class TestTtsNext extends TtsButtonBase {\n override render() {\n const count = this._tts?.elementCount ?? 0;\n const atEnd = count > 0 && (this._tts?.currentElementIndex ?? 0) >= count - 1;\n return html`\n <button\n part=\"button\"\n aria-label=${ifDefined(this.label)}\n ?disabled=${atEnd}\n @click=${() => this._tts?.nextElement()}\n >\n <slot>${iconContent('next', this.label ?? 'Next sentence')}</slot>\n </button>\n `;\n }\n}\n\n/**\n * Pick button — toggles pick mode on the controller: every reading element is highlighted and\n * a click on one of them starts reading from there. Reflects the mode as `:state(picking)`.\n * @cssstate idle / playing / paused\n * @cssstate picking\n * @csspart button\n */\n\nexport class TestTtsPick extends TtsButtonBase {\n override render() {\n return html`\n <button\n part=\"button\"\n aria-label=${ifDefined(this.label)}\n aria-pressed=${this._tts?.picking ? 'true' : 'false'}\n @click=${() => this._tts?.togglePick()}\n >\n <slot>${iconContent('pick', this.label ?? 'Read from here')}</slot>\n </button>\n `;\n }\n}\n\n// ─── Global type declarations ─────────────────────────────────────────────────\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-item-to-speech': TestItemToSpeech;\n 'test-tts-play': TestTtsPlay;\n 'test-tts-pause': TestTtsPause;\n 'test-tts-resume': TestTtsResume;\n 'test-tts-stop': TestTtsStop;\n 'test-tts-prev': TestTtsPrev;\n 'test-tts-next': TestTtsNext;\n 'test-tts-pick': TestTtsPick;\n }\n}\n"]}
@@ -36,8 +36,19 @@ export interface QtiTestStateValue {
36
36
  identifier: string;
37
37
  value: string | string[] | null;
38
38
  }
39
- /** Where the candidate is. */
39
+ /**
40
+ * What each plugin keeps in the state, by plugin name. Empty here: a plugin adds its own entry by
41
+ * augmenting this interface (`declare module` on the module that declares it, with
42
+ * `interface QtiTestPluginState { bookmarks: string[] }`), and reads it with
43
+ * `pluginState(computedContext, 'bookmarks')`. The test never reads an entry; it
44
+ * stores and restores it, so a value must survive `JSON.stringify`.
45
+ */
46
+ export interface QtiTestPluginState {
47
+ }
48
+ /** Where the candidate is, and what plugins keep. */
40
49
  export interface QtiTestStateSession {
50
+ /** Plugin entries by plugin name. Entries of plugins that are not loaded are kept as they are. */
51
+ plugins?: Partial<QtiTestPluginState> & Record<string, unknown>;
41
52
  navPartId?: string | null;
42
53
  navSectionId?: string | null;
43
54
  navItemRefId?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"qti-test-state.js","sourceRoot":"","sources":["../../src/types/qti-test-state.ts"],"names":[],"mappings":"AA8CA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC","sourcesContent":["/**\n * Everything a host needs to persist to resume a candidate's test session, and nothing else.\n *\n * Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —\n * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.\n *\n * Deliberately not here:\n * - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes\n * from the item XML on every load, and persisting the answer key with the candidate's data is\n * both bloat and a leak;\n * - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.\n * The shuffle `seed` in particular must be passed in again, or the restored order changes;\n * - `view`: a role the host decides, not something the candidate produced;\n * - anything computed — scores per section, `done`, `active` — which is rederived from this.\n */\nexport interface QtiTestState {\n /** Bumped on any incompatible change to this shape. A state with another version is ignored. */\n version: 1;\n test: {\n items: QtiTestStateItem[];\n /** Test-level outcome values. Only outcomes the test declares are restored. */\n outcomes: QtiTestStateValue[];\n };\n session: QtiTestStateSession;\n}\n\nexport interface QtiTestStateItem {\n /** The `qti-assessment-item-ref` identifier. */\n identifier: string;\n variables: (QtiTestStateValue & { type?: 'response' | 'outcome' | 'template' | 'context' })[];\n /** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */\n state?: Record<string, string | null>;\n}\n\nexport interface QtiTestStateValue {\n identifier: string;\n value: string | string[] | null;\n}\n\n/** Where the candidate is. */\nexport interface QtiTestStateSession {\n navPartId?: string | null;\n navSectionId?: string | null;\n navItemRefId?: string | null;\n}\n\nexport const QTI_TEST_STATE_VERSION = 1;\n"]}
1
+ {"version":3,"file":"qti-test-state.js","sourceRoot":"","sources":["../../src/types/qti-test-state.ts"],"names":[],"mappings":"AA0DA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC","sourcesContent":["/**\n * Everything a host needs to persist to resume a candidate's test session, and nothing else.\n *\n * Read it from `qtiTest.state` or the `qti-state-changed` event, store it wherever you like —\n * a database, `localStorage`, `sessionStorage` — and assign it back to `qtiTest.state` to resume.\n *\n * Deliberately not here:\n * - declaration metadata (`baseType`, `cardinality`, `correctResponse`, `mapping`, …): it comes\n * from the item XML on every load, and persisting the answer key with the candidate's data is\n * both bloat and a leak;\n * - `configContext` and `qtiContext`: inputs the host supplies on every load, not session state.\n * The shuffle `seed` in particular must be passed in again, or the restored order changes;\n * - `view`: a role the host decides, not something the candidate produced;\n * - anything computed — scores per section, `done`, `active` — which is rederived from this.\n */\nexport interface QtiTestState {\n /** Bumped on any incompatible change to this shape. A state with another version is ignored. */\n version: 1;\n test: {\n items: QtiTestStateItem[];\n /** Test-level outcome values. Only outcomes the test declares are restored. */\n outcomes: QtiTestStateValue[];\n };\n session: QtiTestStateSession;\n}\n\nexport interface QtiTestStateItem {\n /** The `qti-assessment-item-ref` identifier. */\n identifier: string;\n variables: (QtiTestStateValue & { type?: 'response' | 'outcome' | 'template' | 'context' })[];\n /** Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`. */\n state?: Record<string, string | null>;\n}\n\nexport interface QtiTestStateValue {\n identifier: string;\n value: string | string[] | null;\n}\n\n/**\n * What each plugin keeps in the state, by plugin name. Empty here: a plugin adds its own entry by\n * augmenting this interface (`declare module` on the module that declares it, with\n * `interface QtiTestPluginState { bookmarks: string[] }`), and reads it with\n * `pluginState(computedContext, 'bookmarks')`. The test never reads an entry; it\n * stores and restores it, so a value must survive `JSON.stringify`.\n */\n \nexport interface QtiTestPluginState {}\n\n/** Where the candidate is, and what plugins keep. */\nexport interface QtiTestStateSession {\n /** Plugin entries by plugin name. Entries of plugins that are not loaded are kept as they are. */\n plugins?: Partial<QtiTestPluginState> & Record<string, unknown>;\n navPartId?: string | null;\n navSectionId?: string | null;\n navItemRefId?: string | null;\n}\n\nexport const QTI_TEST_STATE_VERSION = 1;\n"]}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@qti-components/test",
3
3
  "description": "QTI test utilities",
4
- "version": "1.10.1",
4
+ "version": "2.0.0-next.10",
5
5
  "author": "",
6
6
  "dependencies": {
7
7
  "@heximal/templates": "^0.1.5",
8
- "@qti-components/base": "^2.5.0",
9
- "@qti-components/elements": "^1.10.1",
10
- "@qti-components/interactions": "^1.10.4",
11
- "@qti-components/processing": "^1.6.1",
12
- "@qti-components/theme": "^2.3.0",
8
+ "@qti-components/base": "^2.5.0-next.2",
9
+ "@qti-components/elements": "^1.10.0-next.3",
10
+ "@qti-components/interactions": "^1.10.5-next.4",
11
+ "@qti-components/processing": "^1.6.1-next.2",
12
+ "@qti-components/theme": "^2.3.0-next.2",
13
13
  "@qti-components/transformers": "^1.7.3",
14
14
  "@qti-components/utilities": "^1.3.3"
15
15
  },
@@ -36,7 +36,11 @@
36
36
  "types": "./dist/register.d.ts",
37
37
  "import": "./dist/register.js"
38
38
  },
39
- "./*": "./dist/*"
39
+ "./*": "./dist/*",
40
+ "./plugins/elements": {
41
+ "types": "./dist/plugins/elements.d.ts",
42
+ "import": "./dist/plugins/elements.js"
43
+ }
40
44
  },
41
45
  "peerDependencies": {
42
46
  "@lit/context": "^1.1.6",