@qti-components/extended 0.0.0-stage → 1.0.0-next.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/LICENSE.md +674 -0
- package/dist/elements.d.ts +100 -0
- package/dist/elements.js +44 -0
- package/dist/elements.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/qti-extended-jsx.d.ts +1894 -0
- package/dist/qti-extended-jsx.js +1 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.js +7 -0
- package/dist/register.js.map +1 -0
- package/dist/test-bookmark/test-bookmark.d.ts +45 -0
- package/dist/test-bookmark/test-bookmark.js +136 -0
- package/dist/test-bookmark/test-bookmark.js.map +1 -0
- package/dist/test-character-sheet/test-character-sheet.d.ts +46 -0
- package/dist/test-character-sheet/test-character-sheet.js +259 -0
- package/dist/test-character-sheet/test-character-sheet.js.map +1 -0
- package/dist/test-item-link/test-item-link.d.ts +13 -0
- package/dist/test-item-link/test-item-link.js +28 -0
- package/dist/test-item-link/test-item-link.js.map +1 -0
- package/dist/test-lock/test-lock.d.ts +72 -0
- package/dist/test-lock/test-lock.js +242 -0
- package/dist/test-lock/test-lock.js.map +1 -0
- package/dist/test-print-context/test-print-context.d.ts +11 -0
- package/dist/test-print-context/test-print-context.js +20 -0
- package/dist/test-print-context/test-print-context.js.map +1 -0
- package/dist/test-print-item-variables/test-print-item-variables.d.ts +17 -0
- package/dist/test-print-item-variables/test-print-item-variables.js +95 -0
- package/dist/test-print-item-variables/test-print-item-variables.js.map +1 -0
- package/dist/test-print-state/test-print-state.d.ts +29 -0
- package/dist/test-print-state/test-print-state.js +101 -0
- package/dist/test-print-state/test-print-state.js.map +1 -0
- package/dist/test-scoring-buttons/test-scoring-buttons.d.ts +19 -0
- package/dist/test-scoring-buttons/test-scoring-buttons.js +95 -0
- package/dist/test-scoring-buttons/test-scoring-buttons.js.map +1 -0
- package/dist/test-scoring-feedback/test-scoring-feedback.d.ts +13 -0
- package/dist/test-scoring-feedback/test-scoring-feedback.js +54 -0
- package/dist/test-scoring-feedback/test-scoring-feedback.js.map +1 -0
- package/dist/test-section-link/test-section-link.d.ts +13 -0
- package/dist/test-section-link/test-section-link.js +28 -0
- package/dist/test-section-link/test-section-link.js.map +1 -0
- package/dist/test-stamp/test-stamp.d.ts +29 -0
- package/dist/test-stamp/test-stamp.js +105 -0
- package/dist/test-stamp/test-stamp.js.map +1 -0
- package/dist/test-view-toggle/test-view-toggle.d.ts +16 -0
- package/dist/test-view-toggle/test-view-toggle.js +49 -0
- package/dist/test-view-toggle/test-view-toggle.js.map +1 -0
- package/dist/test-view-toggle/test-view.d.ts +20 -0
- package/dist/test-view-toggle/test-view.js +73 -0
- package/dist/test-view-toggle/test-view.js.map +1 -0
- package/dist/test-zoom/test-zoom.d.ts +75 -0
- package/dist/test-zoom/test-zoom.js +158 -0
- package/dist/test-zoom/test-zoom.js.map +1 -0
- package/dist/tts/elements.d.ts +28 -0
- package/dist/tts/elements.js +14 -0
- package/dist/tts/elements.js.map +1 -0
- package/dist/tts/test-item-to-speech.d.ts +260 -0
- package/dist/tts/test-item-to-speech.js +1091 -0
- package/dist/tts/test-item-to-speech.js.map +1 -0
- package/package.json +65 -3
- package/README.md +0 -3
|
@@ -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;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CA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AAI,eAAe,CAAC;;KAE7D,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;;GASG;AAEH,MAAM,OAAO,WAAY,SAAQ,aAAa;IAC5C,IAAuB,QAAQ;QAC7B,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,KAAK,CAAC;IACrC,CAAC;IAEQ,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';\nimport { computedContext } from '@citolab/qti-components/qti-base';\nimport { controlStyles as styles } from '@citolab/qti-components/qti-test/plugin-api';\n\nimport type { PropertyValues } from 'lit';\nimport type { ComputedContext } from '@citolab/qti-components/qti-base';\nimport type { QtiAssessmentItem } from '@citolab/qti-components/qti-elements';\nimport type { QtiAssessmentItemRef } from '@citolab/qti-components/qti-test';\n\n// ─── CSS Custom Highlight ─────────────────────────────────────────────────────\n\n/**\n * Whether `node` sits inside `ancestor`, also through shadow roots: the test a notification comes\n * from is this element's own test when the element is somewhere inside it.\n */\nconst isInside = (node: Node, ancestor: EventTarget | undefined): boolean => {\n for (let current: Node | null = node; current; ) {\n if (current === ancestor) return true;\n current = current.parentNode ?? (current instanceof ShadowRoot ? current.host : null);\n }\n return false;\n};\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(--qc-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(--qc-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(--button-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 /* A toggle that is on (the pick button in pick mode). The host carries :state(selected) for a\n page's own rules; in here the inner button's aria-pressed says the same thing and matches in\n a browser without :state(), so the look keys on that. */\n button[aria-pressed='true'],\n button[aria-pressed='true']:hover {\n background-color: var(\n --button-selected-background-color,\n var(--test-button-selected-background-color, var(--qti-selected-bg, Highlight))\n );\n color: var(--button-selected-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 #mirroredSelected = false;\n\n /** Whether this control is a toggle that is on; mirrored as `:state(selected)`. A plain button never is. */\n protected get selected(): boolean {\n return false;\n }\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 const selected = this.selected;\n if (state === this.#mirroredState && picking === this.#mirroredPicking && selected === this.#mirroredSelected)\n return;\n this.#mirroredState = state;\n this.#mirroredPicking = picking;\n this.#mirroredSelected = selected;\n this.#internals.states.clear();\n if (state) this.#internals.states.add(state);\n if (picking) this.#internals.states.add('picking');\n if (selected) this.#internals.states.add('selected');\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), are painted through the `--button-*` slots every button in the theme shares\n * (`--test-button-*` still works as an alias), and can be sized with `--button-size` and\n * `--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 #boundHandleItemConnected = this.#handleItemConnected.bind(this);\n #boundHandleNavigation = (event: Event) => {\n if (isInside(this, event.composedPath()[0])) this.#stop();\n };\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: `qc-item-rendered` (bubbles, composed) passes our own item-ref when our item\n // renders again. Listened to under both names, directly: `listenPublic` has no unsubscribe,\n // and a reset is idempotent, so the alias copy of the dual dispatch is harmless.\n this.#itemRef.addEventListener('qc-item-rendered', this.#boundHandleItemConnected);\n this.#itemRef.addEventListener('cito-item-rendered', this.#boundHandleItemConnected); // old name, one major\n } else {\n // Cursor mode: the test sends `qc-test-navigation-started` as soon as it takes a navigation\n // request — stop right away instead of waiting for the new position to arrive through the\n // computed context. A notification goes up from the test, so it is heard on the document and\n // kept only when it comes from the test this player sits in. Both names, for the reason above.\n this.ownerDocument.addEventListener('qc-test-navigation-started', this.#boundHandleNavigation);\n this.ownerDocument.addEventListener('cito-test-navigation-started', this.#boundHandleNavigation); // old name, one major\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.#itemRef?.removeEventListener('qc-item-rendered', this.#boundHandleItemConnected);\n this.#itemRef?.removeEventListener('cito-item-rendered', this.#boundHandleItemConnected);\n this.ownerDocument.removeEventListener('qc-test-navigation-started', this.#boundHandleNavigation);\n this.ownerDocument.removeEventListener('cito-test-navigation-started', this.#boundHandleNavigation);\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)`, and,\n * being the toggle that switched it on, as `:state(selected)`, painted through\n * `--button-selected-background-color` / `--button-selected-color`.\n * @cssstate idle / playing / paused\n * @cssstate picking\n * @cssstate selected - This toggle is on: pick mode is active\n * @csspart button\n */\n\nexport class TestTtsPick extends TtsButtonBase {\n protected override get selected(): boolean {\n return this._tts?.picking ?? false;\n }\n\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qti-components/extended",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Test plugins for @citolab/qti-components: navigation links, end attempt, scoring, print and view helpers, bookmark, text-to-speech, zoom and a character sheet",
|
|
4
|
+
"version": "1.0.0-next.0",
|
|
5
|
+
"author": "",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@qti-components/utilities": "^1.3.3"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@citolab/qti-components": "^10.0.0-next.17",
|
|
11
|
+
"@heximal/templates": "^0.1.5",
|
|
12
|
+
"@lit/context": "^1.1.6",
|
|
13
|
+
"lit": "^3.3.1"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"qti",
|
|
17
|
+
"test",
|
|
18
|
+
"plugins"
|
|
19
|
+
],
|
|
20
|
+
"license": "GPL-3.0-only",
|
|
21
|
+
"main": "dist/index.js",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./elements": {
|
|
28
|
+
"types": "./dist/elements.d.ts",
|
|
29
|
+
"import": "./dist/elements.js"
|
|
30
|
+
},
|
|
31
|
+
"./register": {
|
|
32
|
+
"types": "./dist/register.d.ts",
|
|
33
|
+
"import": "./dist/register.js"
|
|
34
|
+
},
|
|
35
|
+
"./react": {
|
|
36
|
+
"types": "./dist/qti-extended-jsx.d.ts",
|
|
37
|
+
"default": "./dist/qti-extended-jsx.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@citolab/qti-components": "^10.0.0-next.17",
|
|
42
|
+
"@heximal/templates": "^0.1.5",
|
|
43
|
+
"@lit/context": "^1.1.6",
|
|
44
|
+
"lit": "^3.3.1"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"sideEffects": true,
|
|
50
|
+
"type": "module",
|
|
51
|
+
"types": "dist/index.d.ts",
|
|
52
|
+
"files": [
|
|
53
|
+
"dist"
|
|
54
|
+
],
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/Citolab/qti-components.git",
|
|
58
|
+
"directory": "packages/qti-extended"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"attw": "attw --profile esm-only --pack",
|
|
62
|
+
"build": "pnpm run clean && run-s cem:react-types cem:react-types:patch-ref build:tsc",
|
|
63
|
+
"build:tsc": "tsc --paths null --noEmit false",
|
|
64
|
+
"cem:react-types": "pnpm -C ../.. run cem && node -e \"require('fs').writeFileSync('dist/qti-extended-jsx.js','export {};\\n')\"",
|
|
65
|
+
"cem:react-types:patch-ref": "node ../../tools/build/patch-jsx-react-ref.mjs dist/qti-extended-jsx.d.ts",
|
|
66
|
+
"clean": "rm -rf dist"
|
|
67
|
+
}
|
|
6
68
|
}
|
package/README.md
DELETED