@qti-components/test 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.d.ts +4 -0
- package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js +10 -23
- package/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js.map +1 -1
- package/dist/components/qti-test/qti-test.d.ts +16 -2
- package/dist/components/qti-test/qti-test.js +33 -6
- package/dist/components/qti-test/qti-test.js.map +1 -1
- package/dist/components/test-check-item/test-check-item.d.ts +2 -0
- package/dist/components/test-check-item/test-check-item.js +14 -2
- package/dist/components/test-check-item/test-check-item.js.map +1 -1
- package/dist/components/test-container/test-container.d.ts +3 -0
- package/dist/components/test-container/test-container.js +5 -1
- package/dist/components/test-container/test-container.js.map +1 -1
- package/dist/components/test-item-to-speech/test-item-to-speech.d.ts +61 -15
- package/dist/components/test-item-to-speech/test-item-to-speech.js +285 -103
- package/dist/components/test-item-to-speech/test-item-to-speech.js.map +1 -1
- package/dist/components/test-navigation/test-navigation.d.ts +9 -1
- package/dist/components/test-navigation/test-navigation.js +62 -17
- package/dist/components/test-navigation/test-navigation.js.map +1 -1
- package/dist/components/test-scoring-buttons/test-scoring-buttons.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/test-host.context.d.ts +24 -0
- package/dist/internal/test-host.context.js +3 -0
- package/dist/internal/test-host.context.js.map +1 -0
- package/dist/mixins/index.d.ts +1 -0
- package/dist/mixins/index.js +1 -0
- package/dist/mixins/index.js.map +1 -1
- package/dist/mixins/test-base.d.ts +7 -2
- package/dist/mixins/test-base.js +53 -19
- package/dist/mixins/test-base.js.map +1 -1
- package/dist/mixins/test-navigation.mixin.d.ts +3 -4
- package/dist/mixins/test-navigation.mixin.js +11 -12
- package/dist/mixins/test-navigation.mixin.js.map +1 -1
- package/dist/mixins/test-processing.mixin.js +3 -1
- package/dist/mixins/test-processing.mixin.js.map +1 -1
- package/dist/mixins/test-state.mixin.d.ts +33 -0
- package/dist/mixins/test-state.mixin.js +130 -0
- package/dist/mixins/test-state.mixin.js.map +1 -0
- package/dist/types/iqti-test.d.ts +8 -5
- package/dist/types/iqti-test.js.map +1 -1
- package/dist/types/qti-test-state.d.ts +45 -0
- package/dist/types/qti-test-state.js +2 -0
- package/dist/types/qti-test-state.js.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-item-to-speech.js","sourceRoot":"","sources":["../../../src/components/test-item-to-speech/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,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAMpC,iFAAiF;AAEjF,MAAM,iBAAiB,GAAG,aAAa,CAAC,CAAC,oCAAoC;AAC7E,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,8BAA8B;AAEjE,wEAAwE;AACxE,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;oBACjB,cAAc;KAC7B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAyBD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa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AAC,CAAC,CAAC,MAAM,CAAC,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 { sessionContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { PropertyValues } from 'lit';\nimport type { SessionContext } from '@qti-components/base';\nimport type { QtiAssessmentItem } from '@qti-components/elements';\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\nlet highlightSheet: CSSStyleSheet | null = null;\n\nfunction getHighlightSheet(): CSSStyleSheet {\n if (!highlightSheet) {\n highlightSheet = new CSSStyleSheet();\n highlightSheet.replaceSync(`\n ::highlight(${HIGHLIGHT_ELEMENT}) { background-color: #dbeafe; color: inherit; }\n ::highlight(${HIGHLIGHT_WORD}) { background-color: #ffe066; color: inherit; }\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 html`<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path d=${ICONS[icon]}></path></svg\n ><span class=\"label\">${label}</span>`;\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 }\n button:hover:not(:disabled) {\n ${styles.btnInteractive};\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, #0175aa));\n color: var(--test-button-selected-color, var(--qti-selected-color, #fff));\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 * ### Which item is read\n *\n * By default the player reads the item the test is navigated to (`navItemRefId` from the\n * session context). When several items share one page — a keep-together section or a\n * vertically scrolling booklet — give each player its own `item-ref-id` so it reads that\n * item regardless of the navigation cursor. The item is looked up by its\n * `qti-assessment-item-ref` identifier, in the player's own tree first and otherwise in\n * any `test-container` shadow root reachable from it, so the player can live inside the\n * item card, next to it, or in the page chrome.\n *\n * Only one item can be spoken at a time; starting one player stops any other.\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 * Identifier of the `qti-assessment-item-ref` this player reads. Leave unset to follow the\n * navigation cursor (`navItemRefId`) instead.\n */\n @property({ type: String, attribute: 'item-ref-id' }) itemRefId?: string;\n\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n @state()\n @provide({ context: ttsContext })\n _ttsContext!: TtsContext;\n\n #internals = this.attachInternals();\n #itemElements = new Map<string, QtiAssessmentItem>();\n #boundHandleItemConnected = this.#handleItemConnected.bind(this);\n #eventHost: EventTarget | null = null;\n\n // Current set of block-level reading elements for the active item\n #readingElements: 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 // Tracks previous navItemRefId to detect item switches\n #prevNavItemRefId: string | null | undefined = undefined;\n #prevNavSectionId: string | null | undefined = undefined;\n #boundHandleNavigation = () => this.#stop();\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 override willUpdate(changed: PropertyValues) {\n // no property-driven context updates needed currently\n void changed;\n }\n\n override updated(changed: PropertyValues) {\n if (changed.has('itemRefId') && changed.get('itemRefId') !== undefined) {\n this.#resetReadingPosition();\n }\n const current = this._sessionContext?.navItemRefId ?? null;\n // Stop speech when navItemRefId changes (ignore the initial undefined → value transition).\n // A player pinned to an item keeps its reading position: the cursor moving elsewhere on a\n // multi-item page does not change what this player reads.\n // Moving to another section does take a pinned player's item off the page, so that\n // stops every player; section navigation leaves navItemRefId null, so it needs its own check.\n const section = this._sessionContext?.navSectionId ?? null;\n const itemChanged = this.#prevNavItemRefId !== undefined && this.#prevNavItemRefId !== current;\n const sectionChanged = this.#prevNavSectionId !== undefined && this.#prevNavSectionId !== section;\n if (sectionChanged || (itemChanged && !this.itemRefId)) {\n this.#resetReadingPosition();\n }\n this.#prevNavItemRefId = current;\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 test-container may not be in the DOM yet at this point.\n // qti-assessment-item-connected is bubbles+composed, so it reaches test-navigation / qti-test\n this.#eventHost =\n this.closest('test-navigation') ?? this.closest('qti-test') ?? (this.getRootNode() as EventTarget);\n this.#eventHost.addEventListener('qti-assessment-item-connected', this.#boundHandleItemConnected as EventListener);\n // qti-request-navigation fires synchronously when the user clicks prev/next — stop immediately\n this.#eventHost.addEventListener('qti-request-navigation', this.#boundHandleNavigation);\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(\n 'qti-assessment-item-connected',\n this.#boundHandleItemConnected as EventListener\n );\n this.#eventHost?.removeEventListener('qti-request-navigation', this.#boundHandleNavigation);\n this.#eventHost = null;\n this.#itemElements.clear();\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n #handleItemConnected(event: CustomEvent<QtiAssessmentItem>) {\n const item = event.detail;\n if (item?.identifier) {\n this.#itemElements.set(item.identifier, item);\n // Our item was (re)rendered: the elements we collected earlier are detached now.\n if (this.itemRefId && item.identifier === this.itemRefId && this.#readingElements !== null) {\n this.#resetReadingPosition();\n }\n }\n }\n\n /**\n * Find the rendered `qti-assessment-item` for an item-ref identifier without relying on the\n * connected-event cache — the player may be added after the item rendered (a header built\n * around an existing item) or sit in a shadow root the event never bubbled through.\n */\n #findItemInDom(identifier: string): QtiAssessmentItem | null {\n const esc = (v: string) => (typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(v) : v.replace(/\"/g, '\\\\\"'));\n const selector =\n `qti-assessment-item-ref[identifier=\"${esc(identifier)}\"] qti-assessment-item, ` +\n `qti-assessment-item[identifier=\"${esc(identifier)}\"]`;\n\n // Nearest first: a player placed inside the item's own card.\n const ownRef = this.closest('qti-assessment-item-ref');\n if (ownRef?.getAttribute('identifier') === identifier) {\n const own = ownRef.querySelector<QtiAssessmentItem>('qti-assessment-item');\n if (own) return own;\n }\n\n // Then every root from here up to the document, and the test-container shadow roots in them.\n let root: Node = this.getRootNode();\n while (root) {\n const scope = root as ParentNode;\n const direct = scope.querySelector?.<QtiAssessmentItem>(selector);\n if (direct) return direct;\n for (const container of Array.from(scope.querySelectorAll?.('test-container') ?? [])) {\n const inShadow = container.shadowRoot?.querySelector<QtiAssessmentItem>(selector);\n if (inShadow) return inShadow;\n }\n const host = (root as ShadowRoot).host;\n if (!host) break;\n root = host.getRootNode();\n }\n return 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.#readingElements?.length ?? 0\n };\n }\n\n /** Return cached reading elements, collecting them lazily on first call for the active item. */\n #getReadingElements(): Element[] {\n if (this.#readingElements !== null) return this.#readingElements;\n\n const identifier = this.itemRefId || this._sessionContext?.navItemRefId;\n if (!identifier) return [];\n\n const cached = this.#itemElements.get(identifier);\n const assessmentItem = cached?.isConnected ? cached : this.#findItemInDom(identifier);\n if (!assessmentItem) return [];\n\n const itemBody = assessmentItem.querySelector('qti-item-body');\n if (!itemBody) return [];\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.\n const selector = 'p, h1, h2, h3, h4, h5, h6, li, blockquote, figcaption, qti-prompt, qti-simple-choice';\n this.#readingElements = Array.from(itemBody.querySelectorAll(selector)).filter(\n el => (el.textContent ?? '').trim().length > 0 && !el.querySelector(selector)\n );\n\n return this.#readingElements;\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 in qti-item-body');\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 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.#readingElements ?? [];\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 const elements = this.#getReadingElements();\n if (!elements.length) {\n console.warn('test-item-to-speech: no readable elements found in qti-item-body');\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.#readingElements ?? [];\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 if ((node.textContent ?? '').length > 0) {\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 test-container's shadow root (where highlighted\n * text lives) and to the document (safety net — spec allows document rules to apply\n * across shadow DOM). Called lazily on first highlight use so test-container is\n * guaranteed to be in the DOM by the time navigation or speech starts.\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: test-container's, and the player's own\n // root when the player itself sits inside a shadow tree (e.g. built into an item card).\n const roots = new Set<ShadowRoot>();\n const testContainer =\n this.closest('test-navigation')?.querySelector('test-container') ??\n this.closest('qti-test')?.querySelector('test-container');\n if (testContainer?.shadowRoot) roots.add(testContainer.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"]}
|
|
1
|
+
{"version":3,"file":"test-item-to-speech.js","sourceRoot":"","sources":["../../../src/components/test-item-to-speech/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,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAQpC,iFAAiF;AAEjF,MAAM,iBAAiB,GAAG,aAAa,CAAC,CAAC,oCAAoC;AAC7E,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,8BAA8B;AAEjE,wEAAwE;AACxE,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;oBACjB,cAAc;KAC7B,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,6FAA6F;AAC7F,+FAA+F;AAC/F,gDAAgD;AAChD,MAAM,KAAK,GAAG;IACZ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AK,GAAG,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAA;;;qBAGM,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;oBACtB,KAAK;iBACR,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE;;gBAE/B,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,eAAe,CAAC;;KAE7D,CAAC;IACJ,CAAC;CACF;AAED;;;;;;GAMG;AAEH,MAAM,OAAO,WAAY,SAAQ,aAAa;IACnC,MAAM;QACb,OAAO,IAAI,CAAA;;;qBAGM,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;uBACnB,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,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 { sessionContext } from '@qti-components/base';\n\nimport { testHostContext } from '../../internal/test-host.context';\nimport * as styles from '../styles';\n\nimport type { PropertyValues } from 'lit';\nimport type { SessionContext } from '@qti-components/base';\nimport type { TestHost } from '../../internal/test-host.context';\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiAssessmentItemRef } from '../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\nlet highlightSheet: CSSStyleSheet | null = null;\n\nfunction getHighlightSheet(): CSSStyleSheet {\n if (!highlightSheet) {\n highlightSheet = new CSSStyleSheet();\n highlightSheet.replaceSync(`\n ::highlight(${HIGHLIGHT_ELEMENT}) { background-color: #dbeafe; color: inherit; }\n ::highlight(${HIGHLIGHT_WORD}) { background-color: #ffe066; color: inherit; }\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 button:hover:not(:disabled) {\n ${styles.btnInteractive};\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, #0175aa));\n color: var(--test-button-selected-color, var(--qti-selected-color, #fff));\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** — a toolbar in the page chrome: the player follows the navigation cursor\n * and reads the item `navItemRefId` (session context) points at, found in any\n * `test-container` reachable from the player. Navigating stops speech and starts the next\n * 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 @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n /** The `qti-test` this player is in, across shadow roots. */\n @consume({ context: testHostContext, subscribe: true })\n protected testHost?: TestHost;\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 // Where the item-connected (and, in cursor mode, navigation) events are listened for.\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\n #readingElements: 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 navItemRefId null, so it\n // needs its own check.\n const item = this._sessionContext?.navItemRefId ?? null;\n const section = this._sessionContext?.navSectionId ?? null;\n const itemChanged = this.#prevNavItemRefId !== undefined && this.#prevNavItemRefId !== item;\n const sectionChanged = this.#prevNavSectionId !== undefined && this.#prevNavSectionId !== section;\n if (itemChanged || sectionChanged) 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 test-container 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 // qti-assessment-item-connected is bubbles+composed: it passes the item's own item-ref, and\n // reaches test-navigation / qti-test from inside test-container's shadow root.\n this.#eventHost =\n this.#itemRef ?? this.closest('test-navigation') ?? this.testHost ?? (this.getRootNode() as EventTarget);\n this.#eventHost.addEventListener('qti-assessment-item-connected', this.#boundHandleItemConnected);\n if (!this.#itemRef) {\n // Cursor mode: qti-request-navigation fires synchronously on prev/next — stop right away\n // instead of waiting for the new position to arrive through the session context.\n this.#eventHost.addEventListener('qti-request-navigation', this.#boundHandleNavigation);\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('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 /**\n * An item (re)rendered. If it is ours — e.g. after navigating to the item already shown — the\n * elements collected earlier are detached now. That does not move the navigation cursor, so\n * the check in updated() does not catch it.\n */\n #handleItemConnected(event: Event) {\n if (this.#readingElements === null) return;\n // In item-ref mode the event came through our own item-ref, so it is always ours.\n const identifier = (event as CustomEvent<QtiAssessmentItem>).detail?.identifier;\n if (this.#itemRef || identifier === this._sessionContext?.navItemRefId) this.#resetReadingPosition();\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 /** The item to read: our item-ref's (item-ref mode), or the navigated one (cursor mode). */\n #resolveItem(): QtiAssessmentItem | null {\n if (this.#itemRef) return this.#itemRef.assessmentItem;\n const identifier = this._sessionContext?.navItemRefId;\n return identifier ? this.#findItemInDom(identifier) : null;\n }\n\n /**\n * Cursor mode: find the rendered item for an item-ref identifier. Our own `<qti-test>` first —\n * a page can hold several tests showing the same item — then every root from here up to the\n * document; each scope directly and in the `test-container` shadow roots inside it.\n */\n #findItemInDom(identifier: string): QtiAssessmentItem | null {\n const selector = `qti-assessment-item-ref[identifier=\"${CSS.escape(identifier)}\"] qti-assessment-item`;\n const search = (scope: ParentNode): QtiAssessmentItem | null => {\n const direct = scope.querySelector<QtiAssessmentItem>(selector);\n if (direct) return direct;\n for (const container of Array.from(scope.querySelectorAll('test-container'))) {\n const inShadow = container.shadowRoot?.querySelector<QtiAssessmentItem>(selector);\n if (inShadow) return inShadow;\n }\n return null;\n };\n\n const test = this.closest('qti-test');\n const inTest = test && search(test);\n if (inTest) return inTest;\n\n let root: Node = this.getRootNode();\n for (;;) {\n const found = search(root as ParentNode);\n if (found) return found;\n const host = (root as ShadowRoot).host;\n if (!host) return null;\n root = host.getRootNode();\n }\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\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 test-container's shadow root (where highlighted\n * text lives) and to the document (safety net — spec allows document rules to apply\n * across shadow DOM). Called lazily on first highlight use so test-container is\n * guaranteed to be in the DOM by the time navigation or speech starts.\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: test-container's, and the player's own\n // root when the player itself sits inside a shadow tree (e.g. built into an item card).\n const roots = new Set<ShadowRoot>();\n const testContainer =\n this.closest('test-navigation')?.querySelector('test-container') ??\n this.testHost?.querySelector('test-container');\n if (testContainer?.shadowRoot) roots.add(testContainer.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"]}
|
|
@@ -20,7 +20,15 @@ export declare class TestNavigation extends LitElement {
|
|
|
20
20
|
identifier: string;
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
}[];
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Set `qtiContext` on `qti-test`, which provides it. This is an alias for the
|
|
25
|
+
* enclosing test's: reading returns it, writing replaces it, so a host that has always set the
|
|
26
|
+
* shuffle seed here keeps working. Removed in the next major.
|
|
27
|
+
*
|
|
28
|
+
* Written before the navigation is inside a test, it waits and is handed over on connect.
|
|
29
|
+
*/
|
|
30
|
+
get qtiContext(): QtiContext;
|
|
31
|
+
set qtiContext(value: QtiContext);
|
|
24
32
|
configContext: ConfigContext;
|
|
25
33
|
protected _testContext?: TestContext;
|
|
26
34
|
protected _sessionContext?: SessionContext;
|
|
@@ -4,15 +4,55 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { consume, provide } from '@lit/context';
|
|
7
|
+
import { ContextConsumer, consume, provide } from '@lit/context';
|
|
8
8
|
import { html, LitElement } from 'lit';
|
|
9
9
|
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import { computedContext } from '@qti-components/base';
|
|
11
11
|
import { configContext } from '@qti-components/base';
|
|
12
12
|
import { testContext } from '@qti-components/base';
|
|
13
13
|
import { sessionContext } from '@qti-components/base';
|
|
14
|
-
import {
|
|
14
|
+
import { testHostContext } from '../../internal/test-host.context';
|
|
15
|
+
/** A new object each time: a host that mutates the one it read must not change anyone else's. */
|
|
16
|
+
const newQtiContext = () => ({
|
|
17
|
+
QTI_CONTEXT: { testIdentifier: '', candidateIdentifier: '', environmentIdentifier: 'default' }
|
|
18
|
+
});
|
|
15
19
|
export class TestNavigation extends LitElement {
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Set `qtiContext` on `qti-test`, which provides it. This is an alias for the
|
|
22
|
+
* enclosing test's: reading returns it, writing replaces it, so a host that has always set the
|
|
23
|
+
* shuffle seed here keeps working. Removed in the next major.
|
|
24
|
+
*
|
|
25
|
+
* Written before the navigation is inside a test, it waits and is handed over on connect.
|
|
26
|
+
*/
|
|
27
|
+
get qtiContext() {
|
|
28
|
+
return this.#owner()?.qtiContext ?? (this.#pendingQtiContext ??= newQtiContext());
|
|
29
|
+
}
|
|
30
|
+
set qtiContext(value) {
|
|
31
|
+
if (!this.#warnedQtiContext) {
|
|
32
|
+
this.#warnedQtiContext = true;
|
|
33
|
+
console.warn('[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major ' +
|
|
34
|
+
'release. Set `qtiContext` on `<qti-test>` instead; it is the same value.');
|
|
35
|
+
}
|
|
36
|
+
this.#writeQtiContext(value);
|
|
37
|
+
}
|
|
38
|
+
#pendingQtiContext;
|
|
39
|
+
#warnedQtiContext;
|
|
40
|
+
/** The write the library itself makes. Not the deprecated setter, so it never warns about itself. */
|
|
41
|
+
#writeQtiContext(value) {
|
|
42
|
+
const owner = this.#owner();
|
|
43
|
+
if (owner)
|
|
44
|
+
owner.qtiContext = value;
|
|
45
|
+
else
|
|
46
|
+
this.#pendingQtiContext = value;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The `qti-test` this navigation is in, found through context so it works across shadow roots.
|
|
50
|
+
* A write made before it is known waits in `#pendingQtiContext` and is handed over on arrival.
|
|
51
|
+
*/
|
|
52
|
+
#testHost;
|
|
53
|
+
#owner() {
|
|
54
|
+
return this.#testHost.value ?? null;
|
|
55
|
+
}
|
|
16
56
|
#testElement;
|
|
17
57
|
/**
|
|
18
58
|
* Whether each item's last *ended attempt* reached the optimal outcome, keyed
|
|
@@ -26,13 +66,21 @@ export class TestNavigation extends LitElement {
|
|
|
26
66
|
super();
|
|
27
67
|
this.identifier = undefined;
|
|
28
68
|
this.initContext = [];
|
|
29
|
-
this
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
69
|
+
this.#warnedQtiContext = false;
|
|
70
|
+
/**
|
|
71
|
+
* The `qti-test` this navigation is in, found through context so it works across shadow roots.
|
|
72
|
+
* A write made before it is known waits in `#pendingQtiContext` and is handed over on arrival.
|
|
73
|
+
*/
|
|
74
|
+
this.#testHost = new ContextConsumer(this, {
|
|
75
|
+
context: testHostContext,
|
|
76
|
+
subscribe: true,
|
|
77
|
+
callback: host => {
|
|
78
|
+
if (host && this.#pendingQtiContext) {
|
|
79
|
+
host.qtiContext = this.#pendingQtiContext;
|
|
80
|
+
this.#pendingQtiContext = undefined;
|
|
81
|
+
}
|
|
34
82
|
}
|
|
35
|
-
};
|
|
83
|
+
});
|
|
36
84
|
this.configContext = {};
|
|
37
85
|
this.autoScoreItems = false;
|
|
38
86
|
/**
|
|
@@ -147,13 +195,13 @@ export class TestNavigation extends LitElement {
|
|
|
147
195
|
candidateIdentifier: 'not set',
|
|
148
196
|
environmentIdentifier: 'default'
|
|
149
197
|
};
|
|
150
|
-
this
|
|
198
|
+
this.#writeQtiContext({
|
|
151
199
|
QTI_CONTEXT: {
|
|
152
200
|
...currentContext,
|
|
153
201
|
testIdentifier: this.#testElement.identifier,
|
|
154
202
|
environmentIdentifier: currentContext.environmentIdentifier || 'default'
|
|
155
203
|
}
|
|
156
|
-
};
|
|
204
|
+
});
|
|
157
205
|
}
|
|
158
206
|
// Process qti-context-declaration elements to get default values
|
|
159
207
|
const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]');
|
|
@@ -161,12 +209,12 @@ export class TestNavigation extends LitElement {
|
|
|
161
209
|
const defaultValues = this.#extractDefaultValues(declaration);
|
|
162
210
|
if (Object.keys(defaultValues).length > 0) {
|
|
163
211
|
// Merge default values with current context, but don't override existing runtime values
|
|
164
|
-
this
|
|
212
|
+
this.#writeQtiContext({
|
|
165
213
|
QTI_CONTEXT: {
|
|
166
214
|
...defaultValues, // Default values first
|
|
167
215
|
...this.qtiContext.QTI_CONTEXT // Runtime values override defaults
|
|
168
216
|
}
|
|
169
|
-
};
|
|
217
|
+
});
|
|
170
218
|
}
|
|
171
219
|
});
|
|
172
220
|
const testPartElements = Array.from(this.#testElement?.querySelectorAll(`qti-test-part`) || []);
|
|
@@ -346,7 +394,8 @@ export class TestNavigation extends LitElement {
|
|
|
346
394
|
const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';
|
|
347
395
|
const numAttempts = Number(computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;
|
|
348
396
|
const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;
|
|
349
|
-
|
|
397
|
+
// Published by the item. One that is not on screen has nothing to be invalid.
|
|
398
|
+
const valid = itemContext?.valid ?? true;
|
|
350
399
|
const responseVars = itemContext?.variables?.filter(v => v.type === 'response') || [];
|
|
351
400
|
const isDefaultResponse = responseVars.every(v => {
|
|
352
401
|
if (v.value === undefined || v.value === null) {
|
|
@@ -516,10 +565,6 @@ __decorate([
|
|
|
516
565
|
__decorate([
|
|
517
566
|
state()
|
|
518
567
|
], TestNavigation.prototype, "initContext", void 0);
|
|
519
|
-
__decorate([
|
|
520
|
-
state(),
|
|
521
|
-
provide({ context: qtiContext })
|
|
522
|
-
], TestNavigation.prototype, "qtiContext", void 0);
|
|
523
568
|
__decorate([
|
|
524
569
|
state(),
|
|
525
570
|
consume({ context: configContext, subscribe: true })
|