@wcstack/speech 1.20.0 → 1.21.1
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/README.ja.md +7 -0
- package/README.md +7 -0
- package/dist/index.d.ts +100 -3
- package/dist/index.esm.js +223 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/SpeakCore.ts","../src/autoTrigger.ts","../src/components/Speak.ts","../src/core/ListenCore.ts","../src/listenAutoTrigger.ts","../src/components/Listen.ts","../src/registerComponents.ts","../src/bootstrapSpeech.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n listenTriggerAttribute: string;\n tagNames: {\n speak: string;\n listen: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-speaktarget\",\n listenTriggerAttribute: \"data-listentarget\",\n tagNames: {\n speak: \"wcs-speak\",\n listen: \"wcs-listen\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\n// Internal, mutable live config used by the components/autoTriggers (they read it\n// at call time so setConfig() takes effect without re-import). Typed as the\n// readonly IConfig at the export boundary — the `as IConfig` is a compile-time\n// view only and does NOT freeze the object, so this export must stay\n// package-internal (it is not re-exported from exports.ts). Public consumers get\n// the deep-frozen clone from getConfig() instead, which is the only safe\n// read-only handle.\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (typeof partialConfig.autoTrigger === \"boolean\") {\n _config.autoTrigger = partialConfig.autoTrigger;\n }\n if (typeof partialConfig.triggerAttribute === \"string\") {\n _config.triggerAttribute = partialConfig.triggerAttribute;\n }\n if (typeof partialConfig.listenTriggerAttribute === \"string\") {\n _config.listenTriggerAttribute = partialConfig.listenTriggerAttribute;\n }\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import {\n IWcBindable, SpeakOptions, SpeechVoiceInfo, WcsSpeakErrorDetail,\n} from \"../types.js\";\n\n/**\n * Headless text-to-speech primitive. A thin, framework-agnostic wrapper around\n * the SpeechSynthesis API exposed through the wc-bindable protocol.\n *\n * It is the \"command\" half of the speech package (the recognition half is\n * ListenCore): state drives the element, never the reverse, except for the\n * observable progress/status it publishes back.\n *\n * - **speak(text, options)** queues an utterance. Like the native API, multiple\n * calls queue; `cancel()` clears the queue and stops the current utterance.\n * - **pause() / resume()** suspend and resume the queue.\n * - The observable surface mirrors the live SpeechSynthesis flags\n * (`speaking` / `paused` / `pending`) and exposes voice-list loading\n * (`voices`, which the API populates asynchronously via `voiceschanged`) plus\n * word-boundary progress (`charIndex` / `spokenWord`) for karaoke-style\n * highlighting.\n *\n * Unlike geolocation/clipboard there is no permission gate — synthesis needs no\n * user grant. Failures never throw: they surface through the `error` property so\n * they flow into the declarative state.\n */\nexport class SpeakCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"voices\", event: \"wcs-speak:voices-changed\" },\n { name: \"speaking\", event: \"wcs-speak:speaking-changed\" },\n { name: \"paused\", event: \"wcs-speak:paused-changed\" },\n { name: \"pending\", event: \"wcs-speak:pending-changed\" },\n { name: \"charIndex\", event: \"wcs-speak:boundary\", getter: (e: Event) => (e as CustomEvent).detail?.charIndex ?? null },\n { name: \"spokenWord\", event: \"wcs-speak:boundary\", getter: (e: Event) => (e as CustomEvent).detail?.word ?? null },\n { name: \"error\", event: \"wcs-speak:error\" },\n { name: \"unsupported\", event: \"wcs-speak:unsupported-changed\" },\n ],\n commands: [\n { name: \"speak\" },\n { name: \"cancel\" },\n { name: \"pause\" },\n { name: \"resume\" },\n ],\n };\n\n private _target: EventTarget;\n\n private _voices: SpeechVoiceInfo[] = [];\n private _rawVoices: SpeechSynthesisVoice[] = [];\n private _speaking: boolean = false;\n private _paused: boolean = false;\n private _pending: boolean = false;\n private _charIndex: number | null = null;\n private _spokenWord: string | null = null;\n private _error: WcsSpeakErrorDetail | null = null;\n private _unsupported: boolean = false;\n\n // Count of utterances submitted via speak() but not yet started, and of\n // utterances started but not yet ended/errored. `pending`/`speaking` are\n // derived from these so the queue model is reflected accurately even when\n // several utterances are in flight.\n private _queued: number = 0;\n private _started: number = 0;\n\n // Monotonic id of the current synthesis lifecycle. Bumped by cancel() and\n // dispose(). Each speak() captures it; every utterance event handler bails if\n // it is stale, so a queued/canceled utterance's late callback (notably the\n // \"canceled\" error the browser fires from cancel()) never mutates state or\n // dispatches on a torn-down element.\n private _gen: number = 0;\n\n // True once the voiceschanged subscription has been (or is being) established;\n // reset by dispose(). Guards reinitVoices() so the first connect after\n // construction does not double-subscribe, while a reconnect after dispose()\n // does re-subscribe.\n private _voicesSubscribed: boolean = false;\n\n // SSR: feature detection (`_setUnsupported`) and the initial `getVoices()` read\n // are synchronous, and the `voiceschanged` subscription is established eagerly\n // in the constructor, so there is no asynchronous probe to await before\n // snapshotting — readiness is immediate. The Shell exposes this as\n // connectedCallbackPromise.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n // Probe support up front so observers see the real flag before the first read.\n // Routed through the setter (not a direct assignment) so the field starts at\n // its `false` default and the unsupported case actually transitions\n // false→true; the supported case is same-value guarded and dispatches nothing.\n this._setUnsupported(!this._hasApi());\n this._initVoices();\n }\n\n get voices(): SpeechVoiceInfo[] {\n return this._voices;\n }\n\n get speaking(): boolean {\n return this._speaking;\n }\n\n get paused(): boolean {\n return this._paused;\n }\n\n get pending(): boolean {\n return this._pending;\n }\n\n get charIndex(): number | null {\n return this._charIndex;\n }\n\n get spokenWord(): string | null {\n return this._spokenWord;\n }\n\n get error(): WcsSpeakErrorDetail | null {\n return this._error;\n }\n\n // Resolved once in the constructor (`_setUnsupported(!_hasApi())`) and never\n // re-evaluated: the speechSynthesis API's presence is immutable for the\n // lifetime of a document, so there's nothing to re-check.\n get unsupported(): boolean {\n return this._unsupported;\n }\n\n /** Resolves once the first probe settles (immediate — see `_ready`). */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // --- State setters with event dispatch ---\n\n private _setVoices(voices: SpeechVoiceInfo[]): void {\n // Same-value guard, like the other setters. `voiceschanged` can fire several\n // times with an identical list (engines re-announce after warm-up); compare\n // the normalized snapshot content so a redundant re-announcement does not\n // re-dispatch voices-changed. A genuine list change (length or any field)\n // still fires.\n if (this._voicesEqual(this._voices, voices)) return;\n this._voices = voices;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:voices-changed\", {\n detail: voices,\n bubbles: true,\n }));\n }\n\n private _voicesEqual(a: SpeechVoiceInfo[], b: SpeechVoiceInfo[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n const x = a[i];\n const y = b[i];\n if (x.name !== y.name || x.lang !== y.lang || x.default !== y.default\n || x.localService !== y.localService || x.voiceURI !== y.voiceURI) {\n return false;\n }\n }\n return true;\n }\n\n private _setSpeaking(speaking: boolean): void {\n if (this._speaking === speaking) return;\n this._speaking = speaking;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:speaking-changed\", {\n detail: speaking,\n bubbles: true,\n }));\n }\n\n private _setPaused(paused: boolean): void {\n if (this._paused === paused) return;\n this._paused = paused;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:paused-changed\", {\n detail: paused,\n bubbles: true,\n }));\n }\n\n private _setPending(pending: boolean): void {\n if (this._pending === pending) return;\n this._pending = pending;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:pending-changed\", {\n detail: pending,\n bubbles: true,\n }));\n }\n\n private _setBoundary(charIndex: number | null, word: string | null): void {\n // Boundary events stream rapidly with changing offsets; dispatch each. The\n // guard only suppresses redundant resets (e.g. an end after an already-null\n // boundary) so a cleared highlight does not re-fire.\n if (this._charIndex === charIndex && this._spokenWord === word) return;\n this._charIndex = charIndex;\n this._spokenWord = word;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:boundary\", {\n detail: { charIndex, word },\n bubbles: true,\n }));\n }\n\n private _setError(error: WcsSpeakErrorDetail | null): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setUnsupported(unsupported: boolean): void {\n if (this._unsupported === unsupported) return;\n this._unsupported = unsupported;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:unsupported-changed\", {\n detail: unsupported,\n bubbles: true,\n }));\n }\n\n // --- Public API ---\n\n /**\n * Queue an utterance for `text` with optional per-utterance parameters. Never\n * throws: when the API is unavailable it surfaces an `error` and returns. An\n * empty/whitespace-only `text` is a no-op (the browser would not fire start).\n */\n speak(text: string, options: SpeakOptions = {}): void {\n if (!this._hasApi()) {\n this._setError(this._unsupportedError());\n return;\n }\n if (typeof text !== \"string\" || text.trim() === \"\") {\n return;\n }\n\n const synth = window.speechSynthesis;\n const utterance = new window.SpeechSynthesisUtterance(text);\n if (typeof options.rate === \"number\") utterance.rate = options.rate;\n if (typeof options.pitch === \"number\") utterance.pitch = options.pitch;\n if (typeof options.volume === \"number\") utterance.volume = options.volume;\n if (typeof options.lang === \"string\" && options.lang !== \"\") utterance.lang = options.lang;\n if (typeof options.voice === \"string\" && options.voice !== \"\") {\n const match = this._rawVoices.find((v) => v.name === options.voice);\n if (match) utterance.voice = match;\n }\n\n const gen = this._gen;\n // Per-utterance \"has started\" flag. The browser can fire onerror/onend\n // *before* onstart (e.g. a `synthesis-unavailable` / `audio-busy` failure on\n // a still-queued utterance). In that case the utterance only ever counted\n // toward `_queued`, so the terminal handler must decrement `_queued` — not\n // `_started` — otherwise `pending` (derived from `_queued > 0`) sticks true\n // forever. onstart sets this flag so the terminal handler knows which counter\n // to release.\n let started = false;\n utterance.onstart = (): void => {\n if (gen !== this._gen) return;\n started = true;\n this._queued = Math.max(0, this._queued - 1);\n this._started++;\n this._setSpeaking(true);\n this._setPending(this._queued > 0);\n this._setBoundary(null, null);\n };\n utterance.onboundary = (event: SpeechSynthesisEvent): void => {\n if (gen !== this._gen) return;\n try {\n const charIndex = event.charIndex;\n const length = (event as unknown as { charLength?: number }).charLength;\n // Prefer the engine-provided word length. Some engines omit `charLength`\n // on word boundaries; fall back to the run of non-whitespace at charIndex\n // so `spokenWord` (the karaoke highlight) still works there.\n const word = (typeof length === \"number\" && length > 0)\n ? text.substring(charIndex, charIndex + length)\n : (text.slice(charIndex).match(/^\\S+/)?.[0] ?? \"\");\n this._setBoundary(charIndex, word);\n } catch {\n // A malformed boundary event must not escape the browser callback.\n }\n };\n utterance.onpause = (): void => {\n if (gen !== this._gen) return;\n this._setPaused(true);\n };\n utterance.onresume = (): void => {\n if (gen !== this._gen) return;\n this._setPaused(false);\n };\n utterance.onend = (): void => {\n if (gen !== this._gen) return;\n this._finishUtterance(started);\n };\n utterance.onerror = (event: SpeechSynthesisErrorEvent): void => {\n if (gen !== this._gen) return;\n this._setError(this._normalizeError(event));\n this._finishUtterance(started);\n };\n\n this._setError(null);\n this._queued++;\n this._setPending(true);\n synth.speak(utterance);\n }\n\n /**\n * Clear the queue and stop the current utterance immediately. Resets all\n * progress state synchronously and invalidates in-flight utterance callbacks\n * (the browser fires a \"canceled\" error per utterance) so they do not surface\n * as real errors.\n */\n cancel(): void {\n if (!this._hasApi()) return;\n // Neutralize every in-flight utterance's pending callbacks before triggering\n // the native cancel (which fires \"canceled\" onerror/onend on each).\n this._gen++;\n // Chrome quirk: cancelling while the engine is paused can leave the synth in\n // a state where the *next* speak() produces no audio. Resume first so cancel\n // happens from a running state. resume() on an idle/non-paused engine is a\n // harmless no-op, so guarding on the tracked `_paused` flag is sufficient.\n if (this._paused) {\n window.speechSynthesis.resume();\n }\n window.speechSynthesis.cancel();\n this._queued = 0;\n this._started = 0;\n this._setSpeaking(false);\n this._setPending(false);\n this._setPaused(false);\n this._setBoundary(null, null);\n }\n\n pause(): void {\n if (!this._hasApi()) return;\n window.speechSynthesis.pause();\n }\n\n resume(): void {\n if (!this._hasApi()) return;\n window.speechSynthesis.resume();\n }\n\n /**\n * Re-establish the voiceschanged subscription after a dispose() — e.g. the\n * Shell element was disconnected and then reconnected (reparented). No-op while\n * a subscription is already live, so the first connect after construction does\n * not double-subscribe.\n */\n reinitVoices(): void {\n if (!this._voicesSubscribed) {\n this._initVoices();\n }\n }\n\n /**\n * Establish monitoring (§3.5). Synthesis is command-driven (speak/cancel), so\n * observe() only (re-)establishes the live `voiceschanged` subscription —\n * idempotent via reinitVoices()'s `_voicesSubscribed` guard, so the first\n * connect after construction does not double-subscribe while a reconnect after\n * dispose() does. Returns the `ready` promise for SSR. Call from the Shell's\n * connectedCallback.\n */\n observe(): Promise<void> {\n this.reinitVoices();\n return this._ready;\n }\n\n /**\n * Detach the live voiceschanged listener and neutralize any in-flight\n * utterance callbacks. Call from the Shell's `disconnectedCallback`.\n */\n dispose(): void {\n this._voicesSubscribed = false;\n this._gen++;\n // Reset the queue bookkeeping silently (no dispatch on a disposed element);\n // a reconnect starts fresh. The observable snapshot (error / charIndex /\n // spokenWord) is intentionally *kept* so a reparented element preserves its\n // last state, mirroring GeolocationCore.dispose(). The next speak() resets\n // error / boundary for its own lifecycle.\n this._queued = 0;\n this._started = 0;\n this._speaking = false;\n this._paused = false;\n this._pending = false;\n if (this._hasApi()) {\n window.speechSynthesis.removeEventListener(\"voiceschanged\", this._onVoicesChanged);\n }\n }\n\n // --- Internal ---\n\n // `started` is the per-utterance flag set by its onstart. An utterance that\n // ended/errored after starting releases a `_started` slot; one that never\n // started (terminal event before onstart) releases its `_queued` slot instead,\n // so `pending` correctly returns to false.\n private _finishUtterance(started: boolean): void {\n if (started) {\n this._started = Math.max(0, this._started - 1);\n } else {\n this._queued = Math.max(0, this._queued - 1);\n }\n this._setSpeaking(this._started > 0);\n this._setPending(this._queued > 0);\n if (this._started === 0 && this._queued === 0) {\n this._setPaused(false);\n this._setBoundary(null, null);\n }\n }\n\n private _hasApi(): boolean {\n return typeof window !== \"undefined\"\n && !!window.speechSynthesis\n && typeof (window as unknown as { SpeechSynthesisUtterance?: unknown }).SpeechSynthesisUtterance === \"function\";\n }\n\n private _initVoices(): void {\n if (!this._hasApi()) return;\n this._voicesSubscribed = true;\n this._loadVoices();\n window.speechSynthesis.addEventListener(\"voiceschanged\", this._onVoicesChanged);\n }\n\n private _onVoicesChanged = (): void => {\n this._loadVoices();\n };\n\n private _loadVoices(): void {\n const raw = window.speechSynthesis.getVoices() ?? [];\n this._rawVoices = raw;\n this._setVoices(raw.map((v) => this._normalizeVoice(v)));\n }\n\n private _normalizeVoice(voice: SpeechSynthesisVoice): SpeechVoiceInfo {\n return {\n name: voice.name,\n lang: voice.lang,\n default: voice.default,\n localService: voice.localService,\n voiceURI: voice.voiceURI,\n };\n }\n\n private _normalizeError(event: SpeechSynthesisErrorEvent): WcsSpeakErrorDetail {\n const error = event.error ?? \"synthesis-failed\";\n return { error, message: `Speech synthesis failed: ${error}.` };\n }\n\n private _unsupportedError(): WcsSpeakErrorDetail {\n return { error: \"unsupported\", message: \"SpeechSynthesis API is not available in this environment.\" };\n }\n}\n","import { config } from \"./config.js\";\nimport type { WcsSpeak } from \"./components/Speak.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n // A misconfigured triggerAttribute (e.g. one with a space) makes the attribute\n // selector invalid and closest() throw SyntaxError; guard so a bad config\n // disables only this shortcut rather than killing every document click handler.\n let triggerElement: Element | null;\n try {\n triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n } catch {\n return;\n }\n if (!triggerElement) return;\n\n const speakId = triggerElement.getAttribute(config.triggerAttribute);\n if (!speakId) return;\n\n // Resolve the registered constructor at call time instead of importing Speak as\n // a value, avoiding a components/Speak.ts ⇄ autoTrigger.ts cycle\n // (Speak.connectedCallback() calls registerAutoTrigger()). instanceof against\n // the customElements registry keeps the same identity guarantee.\n const SpeakCtor = customElements.get(config.tagNames.speak);\n const speakElement = document.getElementById(speakId);\n if (!SpeakCtor || !(speakElement instanceof SpeakCtor)) return;\n\n // The text to speak comes from the trigger element: an explicit `data-speaktext`\n // attribute wins, otherwise the element's text content. This keeps the\n // click-driven shortcut declarative without inventing a payload channel.\n const explicit = triggerElement.getAttribute(\"data-speaktext\");\n // textContent is always a string for an Element; the cast avoids an\n // unreachable null-coalesce branch. speak() tolerates a non-string anyway.\n // The textContent fallback is trimmed (HTML indentation otherwise leaks leading\n // / trailing whitespace into the utterance); an explicit data-speaktext is kept\n // verbatim so an author can deliberately include surrounding spaces.\n const text = explicit !== null ? explicit : (triggerElement.textContent as string).trim();\n\n event.preventDefault();\n (speakElement as WcsSpeak).speak(text);\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","import { config } from \"../config.js\";\nimport { IWcBindable, SpeakOptions, SpeechVoiceInfo, WcsSpeakErrorDetail } from \"../types.js\";\nimport { SpeakCore } from \"../core/SpeakCore.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\n\n/**\n * `<wcs-speak>` — declarative text-to-speech. Wraps SpeakCore and exposes:\n *\n * - **`say`** (reactive input): writing a value speaks it, suppressing same-value\n * writes so it fires only when the bound source actually changes. The\n * imperative `speak` command instead speaks on demand (even the same text\n * again). See `docs/speech-tag-design.md` § 5.\n * - per-utterance parameters (`rate` / `pitch` / `volume` / `voice` / `lang`) as\n * mirrored attributes.\n * - the Core's observable surface (voices / speaking / paused / pending /\n * charIndex / spokenWord / error / unsupported) via delegated getters.\n */\nexport class WcsSpeak extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...SpeakCore.wcBindable,\n // Shell-level settable surface. `say` is a momentary reactive command-property\n // with no mirrored attribute (it carries dynamic text, not declarative config),\n // mirroring how <wcs-geo>'s `trigger` has no attribute. The rest mirror their\n // HTML attributes idempotently.\n inputs: [\n { name: \"say\" },\n { name: \"rate\", attribute: \"rate\" },\n { name: \"pitch\", attribute: \"pitch\" },\n { name: \"volume\", attribute: \"volume\" },\n { name: \"voice\", attribute: \"voice\" },\n { name: \"lang\", attribute: \"lang\" },\n { name: \"manual\", attribute: \"manual\" },\n ],\n commands: SpeakCore.wcBindable.commands,\n };\n\n private _core: SpeakCore;\n private _say: string = \"\";\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n // States are wired BEFORE the Core is constructed (unlike the canonical\n // Core-then-internals-then-wireStates order): SpeakCore's constructor\n // synchronously dispatches `wcs-speak:unsupported-changed` when the\n // SpeechSynthesis API is absent, so the listener must already be attached\n // to observe that first (and, in a fixed-support environment, only) event.\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-speak:speaking-changed\": (d) => ({ speaking: d === true }),\n \"wcs-speak:paused-changed\": (d) => ({ paused: d === true }),\n \"wcs-speak:pending-changed\": (d) => ({ pending: d === true }),\n \"wcs-speak:unsupported-changed\": (d) => ({ unsupported: d === true }),\n \"wcs-speak:error\": (d) => ({ error: d != null }),\n });\n this._core = new SpeakCore(this);\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Attribute accessors ---\n\n get rate(): number {\n return this._numberAttr(\"rate\", 1);\n }\n\n set rate(value: number) {\n this.setAttribute(\"rate\", String(value));\n }\n\n get pitch(): number {\n return this._numberAttr(\"pitch\", 1);\n }\n\n set pitch(value: number) {\n this.setAttribute(\"pitch\", String(value));\n }\n\n get volume(): number {\n return this._numberAttr(\"volume\", 1);\n }\n\n set volume(value: number) {\n this.setAttribute(\"volume\", String(value));\n }\n\n get voice(): string {\n return this.getAttribute(\"voice\") ?? \"\";\n }\n\n set voice(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"voice\");\n } else {\n this.setAttribute(\"voice\", String(value));\n }\n }\n\n get lang(): string {\n return this.getAttribute(\"lang\") ?? \"\";\n }\n\n set lang(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"lang\");\n } else {\n this.setAttribute(\"lang\", String(value));\n }\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n // --- Reactive command-property ---\n\n get say(): string {\n return this._say;\n }\n\n set say(value: string | null) {\n // Reactive: writing a new value speaks it. `manual` mutes the path entirely\n // (the imperative `speak` command still works) — both an opt-out and the hook\n // used to avoid a recognition echo loop while listening. A conforming binder\n // never delivers `undefined` (it skips the write), but a direct assignment\n // can, so normalize null/undefined to a no-op.\n //\n // ECHO-LOOP WARNING: when wiring <wcs-listen> → state → `say`, the synthesized\n // audio will be re-recognized unless speech is muted while listening. There is\n // no code-level interlock here (the two tags are decoupled): the consumer MUST\n // wire it — bind `manual` to the listening flag (or gate the bound source).\n // See README \"Echo loop\" and the speech-echo example.\n if (value == null) return;\n if (this.manual) return;\n const v = String(value);\n // Same-value guard: only speak when the bound source actually changes. For\n // \"speak the same text again on demand\", use the `speak` command instead.\n if (v === this._say) return;\n this._say = v;\n this.speak(v);\n }\n\n // --- Core delegated getters ---\n\n get voices(): SpeechVoiceInfo[] {\n return this._core.voices;\n }\n\n get speaking(): boolean {\n return this._core.speaking;\n }\n\n get paused(): boolean {\n return this._core.paused;\n }\n\n get pending(): boolean {\n return this._core.pending;\n }\n\n get charIndex(): number | null {\n return this._core.charIndex;\n }\n\n get spokenWord(): string | null {\n return this._core.spokenWord;\n }\n\n get error(): WcsSpeakErrorDetail | null {\n return this._core.error;\n }\n\n get unsupported(): boolean {\n return this._core.unsupported;\n }\n\n // --- Commands ---\n\n speak(text: string): void {\n this._core.speak(text, this._options());\n }\n\n cancel(): void {\n this._core.cancel();\n }\n\n pause(): void {\n this._core.pause();\n }\n\n resume(): void {\n this._core.resume();\n }\n\n // --- Internal ---\n\n private _numberAttr(name: string, fallback: number): number {\n const attr = this.getAttribute(name);\n if (attr === null || attr.trim() === \"\") return fallback;\n // Strict parse via Number() (unlike parseInt, \"1px\" -> NaN, not 1). Fall back\n // to the API default for any non-finite value, matching the geolocation\n // \"invalid values fall back to default\" convention.\n const parsed = Number(attr);\n return Number.isFinite(parsed) ? parsed : fallback;\n }\n\n private _options(): SpeakOptions {\n return {\n rate: this.rate,\n pitch: this.pitch,\n volume: this.volume,\n voice: this.voice,\n lang: this.lang,\n };\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // observe() revives the voiceschanged subscription after a reconnect\n // (reparenting) and returns the readiness promise for SSR; it wraps\n // reinitVoices() (no-op on the first connect — the constructor subscribed).\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n // Detach event subscriptions and neutralize in-flight utterance callbacks.\n // Any utterance already speaking finishes naturally (SpeechSynthesis is a\n // global singleton; cancelling here would stop other <wcs-speak> elements\n // too). Call `cancel()` explicitly to stop audio.\n this._core.dispose();\n }\n}\n","import {\n IWcBindable, ListenOptions, ListenPermissionState,\n WcsListenResultDetail, WcsListenAlternative, WcsListenErrorDetail,\n} from \"../types.js\";\n\n// The vendor-prefixed constructor is not in the DOM lib types; declare a minimal\n// shape so we can feature-detect and construct it.\n// Minimal structural shapes for the recognition result/error events. The DOM lib\n// does not ship the prefixed API's types, so we declare just the fields read here\n// instead of using `any`, keeping the handlers type-checked and consistent with\n// the typed state fields. All fields are optional/loose because real engines vary\n// (resultIndex / charLength omitted, malformed events) and the handlers already\n// defend against that at runtime.\ninterface RecognitionAlternativeLike {\n transcript?: string;\n confidence?: number;\n}\ninterface RecognitionResultLike {\n readonly length: number;\n isFinal?: boolean;\n [index: number]: RecognitionAlternativeLike;\n}\ninterface RecognitionResultListLike {\n readonly length: number;\n [index: number]: RecognitionResultLike;\n}\ninterface RecognitionResultEventLike {\n results: RecognitionResultListLike;\n resultIndex?: number;\n}\ninterface RecognitionErrorEventLike {\n error?: string;\n}\n\ninterface SpeechRecognitionLike extends EventTarget {\n lang: string;\n continuous: boolean;\n interimResults: boolean;\n maxAlternatives: number;\n start(): void;\n stop(): void;\n abort(): void;\n onstart: ((event: Event) => void) | null;\n onend: ((event: Event) => void) | null;\n onresult: ((event: RecognitionResultEventLike) => void) | null;\n onerror: ((event: RecognitionErrorEventLike) => void) | null;\n}\n\ntype SpeechRecognitionCtor = new () => SpeechRecognitionLike;\n\n/**\n * Headless speech-to-text primitive. A thin, framework-agnostic wrapper around\n * the SpeechRecognition API (vendor-prefixed `webkitSpeechRecognition` in\n * Chrome) exposed through the wc-bindable protocol.\n *\n * It is the \"event\" half of the speech package (the synthesis half is\n * SpeakCore): recognition results flow element → state.\n *\n * Two phases mirror geolocation:\n * - **one-shot** (`continuous = false`) — recognize until the first `end`.\n * - **continuous** (`continuous = true`) — keep a single session open across\n * phrases. The browser still ends a session on silence; auto-restart bridges\n * that gap **but is opt-in via `maxRestarts`**: with the default `maxRestarts\n * = 0` a continuous session is *not* restarted on `end` (the safe default —\n * unbounded restart is the infinite-loop risk we guard against). Set\n * `maxRestarts > 0` to bridge N silences. The cap also stops a persistent\n * failure (e.g. `not-allowed`) from spinning forever or exhausting quota; a\n * real result resets the budget so only consecutive empty restarts count.\n *\n * A microphone permission gate (like geolocation's) reflects\n * `navigator.permissions.query({ name: \"microphone\" })`. Failures never throw —\n * they surface through the `error` property.\n */\nexport class ListenCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"interimTranscript\", event: \"wcs-listen:interim-changed\" },\n { name: \"finalTranscript\", event: \"wcs-listen:final-changed\" },\n { name: \"result\", event: \"wcs-listen:result\" },\n { name: \"listening\", event: \"wcs-listen:listening-changed\" },\n { name: \"permission\", event: \"wcs-listen:permission-changed\" },\n { name: \"error\", event: \"wcs-listen:error\" },\n { name: \"unsupported\", event: \"wcs-listen:unsupported-changed\" },\n ],\n commands: [\n { name: \"start\" },\n { name: \"stop\" },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _recognition: SpeechRecognitionLike | null = null;\n\n private _interimTranscript: string = \"\";\n private _finalTranscript: string = \"\";\n private _result: WcsListenResultDetail | null = null;\n private _listening: boolean = false;\n private _permission: ListenPermissionState = \"prompt\";\n private _error: WcsListenErrorDetail | null = null;\n private _unsupported: boolean = false;\n\n // Intent flag: true between start() and stop()/abort()/terminal-error. Gates\n // the auto-restart loop so a session that ended because the user stopped it\n // does not restart.\n private _active: boolean = false;\n private _continuous: boolean = false;\n private _maxRestarts: number = 0;\n private _restartCount: number = 0;\n\n // Permission tracking — same machinery as GeolocationCore.\n private _permissionStatus: PermissionStatus | null = null;\n private _permissionSubscribed: boolean = false;\n private _permGen: number = 0;\n\n // SSR: feature detection (`_setUnsupported`) is synchronous and the permission\n // `change` subscription is established eagerly in the constructor, so there is\n // no asynchronous probe to await before snapshotting — readiness is immediate.\n // The Shell exposes this as connectedCallbackPromise.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n const Ctor = this._getCtor();\n this._setUnsupported(!Ctor);\n if (Ctor) {\n this._recognition = new Ctor();\n this._attachHandlers(this._recognition);\n }\n this._initPermission();\n }\n\n get interimTranscript(): string {\n return this._interimTranscript;\n }\n\n get finalTranscript(): string {\n return this._finalTranscript;\n }\n\n get result(): WcsListenResultDetail | null {\n return this._result;\n }\n\n get listening(): boolean {\n return this._listening;\n }\n\n get permission(): ListenPermissionState {\n return this._permission;\n }\n\n get error(): WcsListenErrorDetail | null {\n return this._error;\n }\n\n // Resolved once in the constructor (`_setUnsupported(!Ctor)`) and never\n // re-evaluated: the SpeechRecognition API's presence is immutable for the\n // lifetime of a document, so there's nothing to re-check.\n get unsupported(): boolean {\n return this._unsupported;\n }\n\n /** Resolves once the first probe settles (immediate — see `_ready`). */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // --- State setters with event dispatch ---\n\n private _setInterim(value: string): void {\n if (this._interimTranscript === value) return;\n this._interimTranscript = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:interim-changed\", { detail: value, bubbles: true }));\n }\n\n private _setFinal(value: string): void {\n if (this._finalTranscript === value) return;\n this._finalTranscript = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:final-changed\", { detail: value, bubbles: true }));\n }\n\n private _setResult(value: WcsListenResultDetail): void {\n this._result = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:result\", { detail: value, bubbles: true }));\n }\n\n private _setListening(value: boolean): void {\n if (this._listening === value) return;\n this._listening = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:listening-changed\", { detail: value, bubbles: true }));\n }\n\n private _setPermission(value: ListenPermissionState): void {\n if (this._permission === value) return;\n this._permission = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:permission-changed\", { detail: value, bubbles: true }));\n }\n\n private _setError(value: WcsListenErrorDetail | null): void {\n if (this._error === value) return;\n this._error = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:error\", { detail: value, bubbles: true }));\n }\n\n private _setUnsupported(value: boolean): void {\n if (this._unsupported === value) return;\n this._unsupported = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:unsupported-changed\", { detail: value, bubbles: true }));\n }\n\n // --- Public API ---\n\n /**\n * Begin a recognition session. Resets the transcripts (a fresh, user-initiated\n * listen), applies options, and starts. Idempotent while already listening: a\n * redundant start() is ignored so the browser does not throw \"recognition has\n * already started\".\n */\n start(options: ListenOptions = {}): void {\n if (!this._recognition) {\n this._setError(this._unsupportedError());\n return;\n }\n if (this._active) return;\n\n this._continuous = options.continuous ?? false;\n // `maxRestarts` is a restart *count*, so floor any fractional input to an\n // integer (e.g. 2.5 → 2). `_restartCount` increments by 1, so a fractional\n // cap would otherwise compare inconsistently. Non-finite/negative → 0.\n this._maxRestarts = typeof options.maxRestarts === \"number\" && options.maxRestarts >= 0\n ? Math.floor(options.maxRestarts)\n : 0;\n this._restartCount = 0;\n this._recognition.lang = options.lang ?? \"\";\n this._recognition.continuous = this._continuous;\n this._recognition.interimResults = options.interimResults ?? false;\n if (typeof options.maxAlternatives === \"number\") {\n this._recognition.maxAlternatives = options.maxAlternatives;\n }\n\n // Fresh session: clear prior transcripts and error.\n this._setInterim(\"\");\n this._setFinal(\"\");\n this._setError(null);\n this._active = true;\n this._safeStart();\n }\n\n stop(): void {\n if (!this._recognition) return;\n // Clear intent first so the end handler does not auto-restart.\n this._active = false;\n this._recognition.stop();\n }\n\n abort(): void {\n if (!this._recognition) return;\n this._active = false;\n this._recognition.abort();\n }\n\n /**\n * Re-establish the permission `change` subscription after a dispose().\n */\n reinitPermission(): void {\n if (!this._permissionSubscribed) {\n this._initPermission();\n }\n }\n\n /**\n * Establish monitoring (§3.5). Recognition is command-driven (start/stop), so\n * observe() only (re-)establishes the live permission subscription — idempotent\n * via reinitPermission()'s `_permissionSubscribed` guard, so the first connect\n * after construction does not double-subscribe while a reconnect after dispose()\n * does. Returns the `ready` promise for SSR. Call from the Shell's\n * connectedCallback.\n */\n observe(): Promise<void> {\n this.reinitPermission();\n return this._ready;\n }\n\n /**\n * Stop recognition and detach the live permission listener. Call from the\n * Shell's `disconnectedCallback`.\n */\n dispose(): void {\n // Only the live subscriptions and the listening shadow are reset here. The\n // observable snapshot (transcripts / result / error) is intentionally *kept*\n // so a reparented element preserves its last state, mirroring how\n // GeolocationCore.dispose() leaves `position` / `error` intact. The next\n // start() clears the transcripts and error for its fresh session anyway.\n this._active = false;\n this._permissionSubscribed = false;\n this._permGen++;\n if (this._recognition) {\n // abort() is the immediate teardown; guard against environments where it\n // throws on an idle recognizer.\n try {\n this._recognition.abort();\n } catch {\n // ignore — teardown is best-effort.\n }\n }\n // Reset the listening shadow silently (no dispatch on a disposed element),\n // mirroring GeolocationCore's `_loading` reset. The abort() above neutralizes\n // the recognizer but its `end` (which would clear listening via the setter)\n // may not have fired yet; forcing false here means a reconnect+start's\n // `onstart` still transitions false→true through the same-value guard, so the\n // state never desyncs to a stale `true`.\n this._listening = false;\n if (this._permissionStatus) {\n this._permissionStatus.removeEventListener(\"change\", this._onPermissionChange);\n this._permissionStatus = null;\n }\n }\n\n // --- Internal: recognition lifecycle ---\n\n private _attachHandlers(recognition: SpeechRecognitionLike): void {\n recognition.onstart = (): void => {\n this._setListening(true);\n };\n recognition.onresult = (event: RecognitionResultEventLike): void => {\n try {\n this._handleResult(event);\n } catch {\n // A malformed result event must not escape the browser callback.\n }\n };\n recognition.onerror = (event: RecognitionErrorEventLike): void => {\n this._setError(this._normalizeError(event));\n // Terminal errors must not be retried — they would spin the restart loop.\n // The set is deliberately limited to the permission-class errors that can\n // never self-recover within a session. Transient failures\n // (`network` / `audio-capture` / `no-speech`) are intentionally *not*\n // terminal: they are recoverable, so a continuous session restarts through\n // them, bounded by `maxRestarts` (the cap is the guard against a persistent\n // transient failure spinning forever).\n if (event && (event.error === \"not-allowed\" || event.error === \"service-not-allowed\")) {\n this._active = false;\n }\n };\n recognition.onend = (): void => {\n if (this._active && this._continuous && this._restartCount < this._maxRestarts) {\n // Auto-restart bridges a silence-induced `end`. Keep `listening` true\n // across the gap rather than flickering true→false→true: from the\n // consumer's perspective the continuous session never stopped. The\n // immediately-following start()'s `onstart` re-sets true (same-value\n // guarded → no-op), so the flag stays steady. A genuine stop (no\n // restart) still drops to false below.\n this._restartCount++;\n this._safeStart();\n // _safeStart() clears _active if the restart threw; in that case the\n // session is over, so reflect listening=false rather than leaving it\n // stuck true.\n if (!this._active) this._setListening(false);\n return;\n }\n // No restart: the session is fully over.\n this._setListening(false);\n this._active = false;\n };\n }\n\n private _handleResult(event: RecognitionResultEventLike): void {\n const results = event.results;\n let interim = \"\";\n let finalChunk = \"\";\n // Per the Web Speech spec, `resultIndex` is the lowest index in `results`\n // that changed in this event, so we only fold in `[resultIndex, length)` and\n // accumulate finals (`this._finalTranscript + finalChunk`). This assumes the\n // engine advances `resultIndex` past already-finalized results. A nonconforming\n // engine that omits `resultIndex` (`?? 0`) or re-reports finalized results at\n // index 0 on every event could double-accumulate the same final chunk; standard\n // browser engines don't, so this is not hardened against here.\n for (let i = event.resultIndex ?? 0; i < results.length; i++) {\n const res = results[i];\n const transcript = res?.[0]?.transcript ?? \"\";\n if (res?.isFinal) {\n finalChunk += transcript;\n } else {\n interim += transcript;\n }\n }\n if (finalChunk !== \"\") {\n this._setFinal(this._finalTranscript + finalChunk);\n }\n this._setInterim(interim);\n // Any result is progress — reset the restart budget so only *consecutive*\n // empty restarts count toward the cap.\n this._restartCount = 0;\n\n const last = results[results.length - 1];\n if (last) {\n this._setResult(this._normalizeResult(last));\n }\n }\n\n private _normalizeResult(result: RecognitionResultLike): WcsListenResultDetail {\n const alternatives: WcsListenAlternative[] = [];\n for (let i = 0; i < result.length; i++) {\n alternatives.push({\n transcript: result[i]?.transcript ?? \"\",\n confidence: result[i]?.confidence ?? 0,\n });\n }\n const top = alternatives[0] ?? { transcript: \"\", confidence: 0 };\n return {\n transcript: top.transcript,\n confidence: top.confidence,\n isFinal: !!result.isFinal,\n alternatives,\n };\n }\n\n private _safeStart(): void {\n try {\n this._recognition!.start();\n } catch {\n // start() throws if already started; surface nothing — the live session\n // continues. Reset intent so state stays consistent.\n this._active = false;\n }\n }\n\n // --- Internal: feature detection & permission (mirrors GeolocationCore) ---\n\n private _getCtor(): SpeechRecognitionCtor | null {\n // Guard window access without a separate (in-browser unreachable) early\n // return, mirroring SpeakCore's `_hasApi` style.\n const w = (typeof window === \"undefined\" ? undefined : window) as unknown as {\n SpeechRecognition?: SpeechRecognitionCtor;\n webkitSpeechRecognition?: SpeechRecognitionCtor;\n } | undefined;\n return w?.SpeechRecognition ?? w?.webkitSpeechRecognition ?? null;\n }\n\n private _initPermission(): void {\n if (typeof navigator === \"undefined\" || !navigator.permissions || typeof navigator.permissions.query !== \"function\") {\n this._setPermission(\"unsupported\");\n return;\n }\n this._permissionSubscribed = true;\n const gen = ++this._permGen;\n navigator.permissions.query({ name: \"microphone\" as PermissionName }).then(\n (status) => {\n if (gen !== this._permGen) return;\n this._permissionStatus = status;\n this._setPermission(status.state as ListenPermissionState);\n status.addEventListener(\"change\", this._onPermissionChange);\n },\n () => {\n if (gen !== this._permGen) return;\n this._setPermission(\"unsupported\");\n },\n );\n }\n\n private _onPermissionChange = (event: Event): void => {\n const status = event.target as PermissionStatus;\n this._setPermission(status.state as ListenPermissionState);\n };\n\n private _normalizeError(event: RecognitionErrorEventLike): WcsListenErrorDetail {\n const error = (event && event.error) ? event.error : \"aborted\";\n return { error, message: `Speech recognition failed: ${error}.` };\n }\n\n private _unsupportedError(): WcsListenErrorDetail {\n return { error: \"unsupported\", message: \"SpeechRecognition API is not available in this environment.\" };\n }\n}\n","import { config } from \"./config.js\";\nimport type { WcsListen } from \"./components/Listen.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n // A misconfigured listenTriggerAttribute (e.g. one with a space) makes the\n // attribute selector invalid and closest() throw SyntaxError; guard so a bad\n // config disables only this shortcut rather than killing every click handler.\n let triggerElement: Element | null;\n try {\n triggerElement = target.closest<Element>(`[${config.listenTriggerAttribute}]`);\n } catch {\n return;\n }\n if (!triggerElement) return;\n\n const listenId = triggerElement.getAttribute(config.listenTriggerAttribute);\n if (!listenId) return;\n\n const ListenCtor = customElements.get(config.tagNames.listen);\n const listenElement = document.getElementById(listenId);\n if (!ListenCtor || !(listenElement instanceof ListenCtor)) return;\n\n event.preventDefault();\n // Toggle: clicking starts a session, clicking again while listening stops it.\n const el = listenElement as WcsListen;\n if (el.listening) {\n el.stop();\n } else {\n el.start();\n }\n}\n\nexport function registerListenAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterListenAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","import { config } from \"../config.js\";\nimport {\n IWcBindable, ListenOptions, ListenPermissionState, WcsListenResultDetail, WcsListenErrorDetail,\n} from \"../types.js\";\nimport { ListenCore } from \"../core/ListenCore.js\";\nimport { registerListenAutoTrigger } from \"../listenAutoTrigger.js\";\n\n/**\n * `<wcs-listen>` — declarative speech-to-text. Wraps ListenCore and exposes the\n * recognition surface (interim/final transcripts, structured result, listening\n * flag, microphone permission, error) plus the two-phase start/stop/abort\n * commands and a momentary `trigger` for DOM-driven starts.\n *\n * Mirrors `<wcs-geo>`: `manual` suppresses the connect-time auto-start, and the\n * `continuous` attribute selects the auto-restarting session phase.\n */\nexport class WcsListen extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...ListenCore.wcBindable,\n properties: [\n ...ListenCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-listen:trigger-changed\" },\n ],\n inputs: [\n { name: \"lang\", attribute: \"lang\" },\n { name: \"continuous\", attribute: \"continuous\" },\n { name: \"interim\", attribute: \"interim\" },\n { name: \"maxRestarts\", attribute: \"max-restarts\" },\n { name: \"manual\", attribute: \"manual\" },\n { name: \"trigger\" },\n ],\n commands: ListenCore.wcBindable.commands,\n };\n\n private _core: ListenCore;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n // States are wired BEFORE the Core is constructed (unlike the canonical\n // Core-then-internals-then-wireStates order): ListenCore's constructor\n // synchronously dispatches `wcs-listen:unsupported-changed` when the\n // SpeechRecognition API is absent (notably Safari, which ships\n // SpeechSynthesis but not SpeechRecognition), so the listener must already\n // be attached to observe that first (and, in a fixed-support environment,\n // only) event.\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-listen:listening-changed\": (d) => ({ listening: d === true }),\n \"wcs-listen:unsupported-changed\": (d) => ({ unsupported: d === true }),\n \"wcs-listen:error\": (d) => ({ error: d != null }),\n });\n this._core = new ListenCore(this);\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Attribute accessors ---\n\n get lang(): string {\n return this.getAttribute(\"lang\") ?? \"\";\n }\n\n set lang(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"lang\");\n } else {\n this.setAttribute(\"lang\", String(value));\n }\n }\n\n get continuous(): boolean {\n return this.hasAttribute(\"continuous\");\n }\n\n set continuous(value: boolean) {\n if (value) {\n this.setAttribute(\"continuous\", \"\");\n } else {\n this.removeAttribute(\"continuous\");\n }\n }\n\n get interim(): boolean {\n return this.hasAttribute(\"interim\");\n }\n\n set interim(value: boolean) {\n if (value) {\n this.setAttribute(\"interim\", \"\");\n } else {\n this.removeAttribute(\"interim\");\n }\n }\n\n get maxRestarts(): number {\n const attr = this.getAttribute(\"max-restarts\");\n if (attr === null || attr.trim() === \"\") return 0;\n const parsed = Number(attr);\n // A restart *count* is an integer, so floor fractional input (e.g. 1.9 → 1)\n // here too, keeping the getter's value identical to the effective cap the\n // Core applies (ListenCore.start floors it as well). Non-finite/negative → 0.\n return Number.isFinite(parsed) && parsed >= 0 ? Math.floor(parsed) : 0;\n }\n\n set maxRestarts(value: number) {\n this.setAttribute(\"max-restarts\", String(value));\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n // --- Core delegated getters ---\n\n get interimTranscript(): string {\n return this._core.interimTranscript;\n }\n\n get finalTranscript(): string {\n return this._core.finalTranscript;\n }\n\n get result(): WcsListenResultDetail | null {\n return this._core.result;\n }\n\n get listening(): boolean {\n return this._core.listening;\n }\n\n get permission(): ListenPermissionState {\n return this._core.permission;\n }\n\n get error(): WcsListenErrorDetail | null {\n return this._core.error;\n }\n\n get unsupported(): boolean {\n return this._core.unsupported;\n }\n\n // --- Command property ---\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n // Momentary command-property: a false→true write starts a session. Mirrors\n // <wcs-geo>'s trigger. Prefer the command-token protocol (`command.start:\n // $command.listen`) for state-driven starts; this exists for DOM triggers and\n // simple boolean bindings.\n const v = !!value;\n if (v) {\n this._trigger = true;\n this.start();\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-listen:trigger-changed\", { detail: false, bubbles: true }));\n }\n }\n\n // --- Commands ---\n\n start(): void {\n this._core.start(this._options());\n }\n\n stop(): void {\n this._core.stop();\n }\n\n abort(): void {\n this._core.abort();\n }\n\n // --- Internal ---\n\n private _options(): ListenOptions {\n return {\n lang: this.lang,\n continuous: this.continuous,\n interimResults: this.interim,\n maxRestarts: this.maxRestarts,\n };\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerListenAutoTrigger();\n }\n // observe() (re-)establishes the permission subscription and returns the\n // readiness promise for SSR; it wraps reinitPermission() (idempotent).\n this._connectedCallbackPromise = this._core.observe();\n if (!this.manual) {\n // Non-blocking auto-start, mirroring <wcs-geo>: start() is fired\n // unconditionally without first awaiting/inspecting the (async) permission\n // state. A `denied` mic surfaces as a `not-allowed` error via the `error`\n // property (and stops auto-restart), rather than the connect path silently\n // suppressing the start. This keeps the permission model declarative and\n // consistent with geolocation. Use `manual` to require an explicit start.\n this.start();\n }\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsSpeak } from \"./components/Speak.js\";\nimport { WcsListen } from \"./components/Listen.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.speak)) {\n customElements.define(config.tagNames.speak, WcsSpeak);\n }\n if (!customElements.get(config.tagNames.listen)) {\n customElements.define(config.tagNames.listen, WcsListen);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapSpeech(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":["registered","handleClick"],"mappings":"AAYA,MAAM,OAAO,GAAoB;AAC/B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,sBAAsB,EAAE,mBAAmB;AAC3C,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,WAAW;AAClB,QAAA,MAAM,EAAE,YAAY;AACrB,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KA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CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC9C,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACxD;AACA,IAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC/C,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC1D;AACF;;ACPM,SAAU,eAAe,CAAC,UAA4B,EAAA;IAC1D,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/speechCapabilities.ts","../src/core/SpeakCore.ts","../src/autoTrigger.ts","../src/components/Speak.ts","../src/core/ListenCore.ts","../src/listenAutoTrigger.ts","../src/components/Listen.ts","../src/registerComponents.ts","../src/bootstrapSpeech.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n autoTrigger: boolean;\n triggerAttribute: string;\n listenTriggerAttribute: string;\n tagNames: {\n speak: string;\n listen: string;\n };\n}\n\nconst _config: IInternalConfig = {\n autoTrigger: true,\n triggerAttribute: \"data-speaktarget\",\n listenTriggerAttribute: \"data-listentarget\",\n tagNames: {\n speak: \"wcs-speak\",\n listen: \"wcs-listen\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\n// Internal, mutable live config used by the components/autoTriggers (they read it\n// at call time so setConfig() takes effect without re-import). Typed as the\n// readonly IConfig at the export boundary — the `as IConfig` is a compile-time\n// view only and does NOT freeze the object, so this export must stay\n// package-internal (it is not re-exported from exports.ts). Public consumers get\n// the deep-frozen clone from getConfig() instead, which is the only safe\n// read-only handle.\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (typeof partialConfig.autoTrigger === \"boolean\") {\n _config.autoTrigger = partialConfig.autoTrigger;\n }\n if (typeof partialConfig.triggerAttribute === \"string\") {\n _config.triggerAttribute = partialConfig.triggerAttribute;\n }\n if (typeof partialConfig.listenTriggerAttribute === \"string\") {\n _config.listenTriggerAttribute = partialConfig.listenTriggerAttribute;\n }\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","/**\n * speechCapabilities.ts\n *\n * speech node 固有の error code(taxonomy)と derivation。汎用の error info 型は\n * `./platformCapability.js`(/io-core/ から copy-distribution される生成ファイル)から\n * import する。speech パッケージは 2 つの Core を持つ:\n *\n * - ListenCore(`<wcs-listen>`, SpeechRecognition / STT) — 認識セッションの\n * start/stop/abort。監視ではなく command 駆動だが、競合する非同期 operation の lane は\n * 持たない(直近の start が単一セッションを置換する)ため、lane は採用せず error\n * taxonomy(errorInfo)のみを追加する。\n * - SpeakCore(`<wcs-speak>`, SpeechSynthesis / TTS) — 発話キュー。同上。\n *\n * SpeechRecognitionErrorEvent と SpeechSynthesisErrorEvent は `error` enum の値集合が\n * 異なるため、taxonomy も Core ごとに別 derive を持つ。いずれの Core も error detail の\n * `.error` は既に安定コード(SpeechRecognition/SpeechSynthesis の error enum、または\n * `\"unsupported\"` fallback)であり Error.name ではないので、derivation は notification と\n * 同型の「`.error` コードを taxonomy に写す純粋 map」である。想定外のコードは防御的に\n * `speech-error` へ畳む。\n */\n\nimport type { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport type { WcsListenErrorDetail, WcsSpeakErrorDetail } from \"../types.js\";\n\n// ---------------------------------------------------------------------------\n// SpeechRecognition (STT) — <wcs-listen>\n// ---------------------------------------------------------------------------\n\n/** 安定した listen(SpeechRecognition)error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_LISTEN_ERROR_CODE = {\n /** SpeechRecognition API 非対応(`SpeechRecognition` / `webkitSpeechRecognition` 不在)。 */\n CapabilityMissing: \"capability-missing\",\n /** `not-allowed` / `service-not-allowed` — マイク権限拒否 / サービス不許可。 */\n NotAllowed: \"not-allowed\",\n /** `audio-capture` — マイクが読めない(不在 / ハードウェア)。 */\n NotReadable: \"not-readable\",\n /** `no-speech` — 無音のまま検出できず(transient — retry で成功しうる)。 */\n NoSpeech: \"no-speech\",\n /** `network` — 認識バックエンドへの通信失敗(transient)。 */\n NetworkError: \"network-error\",\n /** `aborted` — セッションが中断された(transient)。 */\n Aborted: \"aborted\",\n /** `language-not-supported` / `bad-grammar` — 言語 / 文法が不正(前提条件違反)。 */\n InvalidArgument: \"invalid-argument\",\n /** その他 / 想定外の error code に対する防御的 fallback。 */\n SpeechError: \"speech-error\",\n} as const;\n\n/**\n * listen(SpeechRecognition)の失敗を serializable な error taxonomy に写す。引数は\n * `wcs-listen:error` の detail(`{ error, message }`)そのもの。`.error` は\n * `SpeechRecognitionErrorEvent.error` enum(または `\"unsupported\"` / `\"aborted\"`\n * fallback)で、Error.name ではない。\n *\n * - `\"unsupported\"` は開始前の能力欠如 → phase=\"probe\" / capability-missing。\n * - `\"not-allowed\"` / `\"service-not-allowed\"` はマイク権限拒否 → phase=\"start\" /\n * not-allowed。回復しない(recoverable=false)。ListenCore はこの 2 つを終端扱いにし\n * 自動再開を止める。\n * - `\"audio-capture\"` はマイクの読取失敗 → phase=\"start\" / not-readable / false。\n * - `\"no-speech\"` / `\"network\"` / `\"aborted\"` は transient で、continuous セッションは\n * `maxRestarts` の範囲で自動再開しうる → phase=\"execute\" / recoverable=true。\n * - `\"language-not-supported\"` / `\"bad-grammar\"` は言語 / 文法の前提違反 →\n * phase=\"start\" / invalid-argument / false。\n * - それ以外(未知コード)は防御的に phase=\"execute\" / speech-error / false。\n */\nexport function deriveListenErrorInfo(error: WcsListenErrorDetail): WcsIoErrorInfo {\n const { error: code, message } = error;\n switch (code) {\n case \"unsupported\":\n return { code: WCS_LISTEN_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n case \"not-allowed\":\n case \"service-not-allowed\":\n return { code: WCS_LISTEN_ERROR_CODE.NotAllowed, phase: \"start\", recoverable: false, message };\n case \"audio-capture\":\n return { code: WCS_LISTEN_ERROR_CODE.NotReadable, phase: \"start\", recoverable: false, message };\n case \"no-speech\":\n return { code: WCS_LISTEN_ERROR_CODE.NoSpeech, phase: \"execute\", recoverable: true, message };\n case \"network\":\n return { code: WCS_LISTEN_ERROR_CODE.NetworkError, phase: \"execute\", recoverable: true, message };\n case \"aborted\":\n return { code: WCS_LISTEN_ERROR_CODE.Aborted, phase: \"execute\", recoverable: true, message };\n case \"language-not-supported\":\n case \"bad-grammar\":\n return { code: WCS_LISTEN_ERROR_CODE.InvalidArgument, phase: \"start\", recoverable: false, message };\n default:\n return { code: WCS_LISTEN_ERROR_CODE.SpeechError, phase: \"execute\", recoverable: false, message };\n }\n}\n\n// ---------------------------------------------------------------------------\n// SpeechSynthesis (TTS) — <wcs-speak>\n// ---------------------------------------------------------------------------\n\n/** 安定した speak(SpeechSynthesis)error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_SPEAK_ERROR_CODE = {\n /** SpeechSynthesis API 非対応(`speechSynthesis` / `SpeechSynthesisUtterance` 不在)。 */\n CapabilityMissing: \"capability-missing\",\n /** `not-allowed` — 合成が許可されていない。 */\n NotAllowed: \"not-allowed\",\n /** `canceled` / `interrupted` — 発話がキャンセル / 中断された(transient)。 */\n Aborted: \"aborted\",\n /** `audio-busy` / `audio-hardware` — オーディオ出力の占有 / ハードウェア障害。 */\n NotReadable: \"not-readable\",\n /** `network` — 合成バックエンドへの通信失敗(transient)。 */\n NetworkError: \"network-error\",\n /** `language-unavailable` / `voice-unavailable` / `text-too-long` / `invalid-argument` —\n * 発話パラメータが不正 / 未対応(前提条件違反)。 */\n InvalidArgument: \"invalid-argument\",\n /** `synthesis-unavailable` / `synthesis-failed` — 合成そのものが失敗した。 */\n SynthesisFailed: \"synthesis-failed\",\n /** その他 / 想定外の error code に対する防御的 fallback。 */\n SpeechError: \"speech-error\",\n} as const;\n\n/**\n * speak(SpeechSynthesis)の失敗を serializable な error taxonomy に写す。引数は\n * `wcs-speak:error` の detail(`{ error, message }`)そのもの。`.error` は\n * `SpeechSynthesisErrorEvent.error` enum(または `\"unsupported\"` /\n * `\"synthesis-failed\"` fallback)で、Error.name ではない。\n *\n * - `\"unsupported\"` は開始前の能力欠如 → phase=\"probe\" / capability-missing。\n * - `\"not-allowed\"` は合成不許可 → phase=\"start\" / not-allowed / false。\n * - `\"canceled\"` / `\"interrupted\"` は cancel()/後続発話による中断 → phase=\"execute\" /\n * aborted / recoverable=true(通常は SpeakCore の世代ガードが握りつぶすため error として\n * 表面化しないが、防御的に写す)。\n * - `\"audio-busy\"` はオーディオ占有で transient(retry で回復しうる)→ phase=\"execute\" /\n * not-readable / recoverable=true。`\"audio-hardware\"` はハードウェア障害で回復しない →\n * 同 not-readable だが recoverable=false。\n * - `\"network\"` は transient → phase=\"execute\" / network-error / recoverable=true。\n * - `\"language-unavailable\"` / `\"voice-unavailable\"` / `\"text-too-long\"` /\n * `\"invalid-argument\"` は発話パラメータの前提違反 → phase=\"start\" / invalid-argument /\n * false。\n * - `\"synthesis-unavailable\"` / `\"synthesis-failed\"` は合成実行の失敗 → phase=\"execute\" /\n * synthesis-failed / false。\n * - それ以外(未知コード)は防御的に phase=\"execute\" / speech-error / false。\n */\nexport function deriveSpeakErrorInfo(error: WcsSpeakErrorDetail): WcsIoErrorInfo {\n const { error: code, message } = error;\n switch (code) {\n case \"unsupported\":\n return { code: WCS_SPEAK_ERROR_CODE.CapabilityMissing, phase: \"probe\", recoverable: false, message };\n case \"not-allowed\":\n return { code: WCS_SPEAK_ERROR_CODE.NotAllowed, phase: \"start\", recoverable: false, message };\n case \"canceled\":\n case \"interrupted\":\n return { code: WCS_SPEAK_ERROR_CODE.Aborted, phase: \"execute\", recoverable: true, message };\n case \"audio-busy\":\n return { code: WCS_SPEAK_ERROR_CODE.NotReadable, phase: \"execute\", recoverable: true, message };\n case \"audio-hardware\":\n return { code: WCS_SPEAK_ERROR_CODE.NotReadable, phase: \"execute\", recoverable: false, message };\n case \"network\":\n return { code: WCS_SPEAK_ERROR_CODE.NetworkError, phase: \"execute\", recoverable: true, message };\n case \"language-unavailable\":\n case \"voice-unavailable\":\n case \"text-too-long\":\n case \"invalid-argument\":\n return { code: WCS_SPEAK_ERROR_CODE.InvalidArgument, phase: \"start\", recoverable: false, message };\n case \"synthesis-unavailable\":\n case \"synthesis-failed\":\n return { code: WCS_SPEAK_ERROR_CODE.SynthesisFailed, phase: \"execute\", recoverable: false, message };\n default:\n return { code: WCS_SPEAK_ERROR_CODE.SpeechError, phase: \"execute\", recoverable: false, message };\n }\n}\n","import {\n IWcBindable, SpeakOptions, SpeechVoiceInfo, WcsSpeakErrorDetail,\n} from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { deriveSpeakErrorInfo } from \"./speechCapabilities.js\";\n\n/**\n * Headless text-to-speech primitive. A thin, framework-agnostic wrapper around\n * the SpeechSynthesis API exposed through the wc-bindable protocol.\n *\n * It is the \"command\" half of the speech package (the recognition half is\n * ListenCore): state drives the element, never the reverse, except for the\n * observable progress/status it publishes back.\n *\n * - **speak(text, options)** queues an utterance. Like the native API, multiple\n * calls queue; `cancel()` clears the queue and stops the current utterance.\n * - **pause() / resume()** suspend and resume the queue.\n * - The observable surface mirrors the live SpeechSynthesis flags\n * (`speaking` / `paused` / `pending`) and exposes voice-list loading\n * (`voices`, which the API populates asynchronously via `voiceschanged`) plus\n * word-boundary progress (`charIndex` / `spokenWord`) for karaoke-style\n * highlighting.\n *\n * Unlike geolocation/clipboard there is no permission gate — synthesis needs no\n * user grant. Failures never throw: they surface through the `error` property so\n * they flow into the declarative state.\n */\nexport class SpeakCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"voices\", event: \"wcs-speak:voices-changed\" },\n { name: \"speaking\", event: \"wcs-speak:speaking-changed\" },\n { name: \"paused\", event: \"wcs-speak:paused-changed\" },\n { name: \"pending\", event: \"wcs-speak:pending-changed\" },\n { name: \"charIndex\", event: \"wcs-speak:boundary\", getter: (e: Event) => (e as CustomEvent).detail?.charIndex ?? null },\n { name: \"spokenWord\", event: \"wcs-speak:boundary\", getter: (e: Event) => (e as CustomEvent).detail?.word ?? null },\n { name: \"error\", event: \"wcs-speak:error\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from `error.error` (the\n // SpeechSynthesisErrorEvent.error code / \"unsupported\"); the existing `error`\n // property/event are unchanged. Fires wcs-speak:error-info-changed. No lane —\n // speak() is a momentary queue submission with no competing async operation to\n // serialize.\n { name: \"errorInfo\", event: \"wcs-speak:error-info-changed\" },\n { name: \"unsupported\", event: \"wcs-speak:unsupported-changed\" },\n ],\n commands: [\n { name: \"speak\" },\n { name: \"cancel\" },\n { name: \"pause\" },\n { name: \"resume\" },\n ],\n };\n\n private _target: EventTarget;\n\n private _voices: SpeechVoiceInfo[] = [];\n private _rawVoices: SpeechSynthesisVoice[] = [];\n private _speaking: boolean = false;\n private _paused: boolean = false;\n private _pending: boolean = false;\n private _charIndex: number | null = null;\n private _spokenWord: string | null = null;\n private _error: WcsSpeakErrorDetail | null = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n private _unsupported: boolean = false;\n\n // Count of utterances submitted via speak() but not yet started, and of\n // utterances started but not yet ended/errored. `pending`/`speaking` are\n // derived from these so the queue model is reflected accurately even when\n // several utterances are in flight.\n private _queued: number = 0;\n private _started: number = 0;\n\n // Monotonic id of the current synthesis lifecycle. Bumped by cancel() and\n // dispose(). Each speak() captures it; every utterance event handler bails if\n // it is stale, so a queued/canceled utterance's late callback (notably the\n // \"canceled\" error the browser fires from cancel()) never mutates state or\n // dispatches on a torn-down element.\n private _gen: number = 0;\n\n // True once the voiceschanged subscription has been (or is being) established;\n // reset by dispose(). Guards reinitVoices() so the first connect after\n // construction does not double-subscribe, while a reconnect after dispose()\n // does re-subscribe.\n private _voicesSubscribed: boolean = false;\n\n // SSR: feature detection (`_setUnsupported`) and the initial `getVoices()` read\n // are synchronous, and the `voiceschanged` subscription is established eagerly\n // in the constructor, so there is no asynchronous probe to await before\n // snapshotting — readiness is immediate. The Shell exposes this as\n // connectedCallbackPromise.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n // Probe support up front so observers see the real flag before the first read.\n // Routed through the setter (not a direct assignment) so the field starts at\n // its `false` default and the unsupported case actually transitions\n // false→true; the supported case is same-value guarded and dispatches nothing.\n this._setUnsupported(!this._hasApi());\n this._initVoices();\n }\n\n get voices(): SpeechVoiceInfo[] {\n return this._voices;\n }\n\n get speaking(): boolean {\n return this._speaking;\n }\n\n get paused(): boolean {\n return this._paused;\n }\n\n get pending(): boolean {\n return this._pending;\n }\n\n get charIndex(): number | null {\n return this._charIndex;\n }\n\n get spokenWord(): string | null {\n return this._spokenWord;\n }\n\n get error(): WcsSpeakErrorDetail | null {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-speak:error-info-changed`), derived from `error`; the existing `error`\n * property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n // Resolved once in the constructor (`_setUnsupported(!_hasApi())`) and never\n // re-evaluated: the speechSynthesis API's presence is immutable for the\n // lifetime of a document, so there's nothing to re-check.\n get unsupported(): boolean {\n return this._unsupported;\n }\n\n /** Resolves once the first probe settles (immediate — see `_ready`). */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // --- State setters with event dispatch ---\n\n private _setVoices(voices: SpeechVoiceInfo[]): void {\n // Same-value guard, like the other setters. `voiceschanged` can fire several\n // times with an identical list (engines re-announce after warm-up); compare\n // the normalized snapshot content so a redundant re-announcement does not\n // re-dispatch voices-changed. A genuine list change (length or any field)\n // still fires.\n if (this._voicesEqual(this._voices, voices)) return;\n this._voices = voices;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:voices-changed\", {\n detail: voices,\n bubbles: true,\n }));\n }\n\n private _voicesEqual(a: SpeechVoiceInfo[], b: SpeechVoiceInfo[]): boolean {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n const x = a[i];\n const y = b[i];\n if (x.name !== y.name || x.lang !== y.lang || x.default !== y.default\n || x.localService !== y.localService || x.voiceURI !== y.voiceURI) {\n return false;\n }\n }\n return true;\n }\n\n private _setSpeaking(speaking: boolean): void {\n if (this._speaking === speaking) return;\n this._speaking = speaking;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:speaking-changed\", {\n detail: speaking,\n bubbles: true,\n }));\n }\n\n private _setPaused(paused: boolean): void {\n if (this._paused === paused) return;\n this._paused = paused;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:paused-changed\", {\n detail: paused,\n bubbles: true,\n }));\n }\n\n private _setPending(pending: boolean): void {\n if (this._pending === pending) return;\n this._pending = pending;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:pending-changed\", {\n detail: pending,\n bubbles: true,\n }));\n }\n\n private _setBoundary(charIndex: number | null, word: string | null): void {\n // Boundary events stream rapidly with changing offsets; dispatch each. The\n // guard only suppresses redundant resets (e.g. an end after an already-null\n // boundary) so a cleared highlight does not re-fire.\n if (this._charIndex === charIndex && this._spokenWord === word) return;\n this._charIndex = charIndex;\n this._spokenWord = word;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:boundary\", {\n detail: { charIndex, word },\n bubbles: true,\n }));\n }\n\n private _setError(error: WcsSpeakErrorDetail | null): void {\n if (this._error === error) return;\n this._error = error;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive from the\n // error code (or null on clear). Fires before the `error` event so an observer\n // binding both sees the classification first, mirroring the io-node family.\n this._commitErrorInfo(error === null ? null : deriveSpeakErrorInfo(error));\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n // Called only from _setError (which already guards on error identity), so\n // errorInfo transitions exactly when error does — no separate guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n private _setUnsupported(unsupported: boolean): void {\n if (this._unsupported === unsupported) return;\n this._unsupported = unsupported;\n this._target.dispatchEvent(new CustomEvent(\"wcs-speak:unsupported-changed\", {\n detail: unsupported,\n bubbles: true,\n }));\n }\n\n // --- Public API ---\n\n /**\n * Queue an utterance for `text` with optional per-utterance parameters. Never\n * throws: when the API is unavailable it surfaces an `error` and returns. An\n * empty/whitespace-only `text` is a no-op (the browser would not fire start).\n */\n speak(text: string, options: SpeakOptions = {}): void {\n if (!this._hasApi()) {\n this._setError(this._unsupportedError());\n return;\n }\n if (typeof text !== \"string\" || text.trim() === \"\") {\n return;\n }\n\n const synth = window.speechSynthesis;\n const utterance = new window.SpeechSynthesisUtterance(text);\n if (typeof options.rate === \"number\") utterance.rate = options.rate;\n if (typeof options.pitch === \"number\") utterance.pitch = options.pitch;\n if (typeof options.volume === \"number\") utterance.volume = options.volume;\n if (typeof options.lang === \"string\" && options.lang !== \"\") utterance.lang = options.lang;\n if (typeof options.voice === \"string\" && options.voice !== \"\") {\n const match = this._rawVoices.find((v) => v.name === options.voice);\n if (match) utterance.voice = match;\n }\n\n const gen = this._gen;\n // Per-utterance \"has started\" flag. The browser can fire onerror/onend\n // *before* onstart (e.g. a `synthesis-unavailable` / `audio-busy` failure on\n // a still-queued utterance). In that case the utterance only ever counted\n // toward `_queued`, so the terminal handler must decrement `_queued` — not\n // `_started` — otherwise `pending` (derived from `_queued > 0`) sticks true\n // forever. onstart sets this flag so the terminal handler knows which counter\n // to release.\n let started = false;\n utterance.onstart = (): void => {\n if (gen !== this._gen) return;\n started = true;\n this._queued = Math.max(0, this._queued - 1);\n this._started++;\n this._setSpeaking(true);\n this._setPending(this._queued > 0);\n this._setBoundary(null, null);\n };\n utterance.onboundary = (event: SpeechSynthesisEvent): void => {\n if (gen !== this._gen) return;\n try {\n const charIndex = event.charIndex;\n const length = (event as unknown as { charLength?: number }).charLength;\n // Prefer the engine-provided word length. Some engines omit `charLength`\n // on word boundaries; fall back to the run of non-whitespace at charIndex\n // so `spokenWord` (the karaoke highlight) still works there.\n const word = (typeof length === \"number\" && length > 0)\n ? text.substring(charIndex, charIndex + length)\n : (text.slice(charIndex).match(/^\\S+/)?.[0] ?? \"\");\n this._setBoundary(charIndex, word);\n } catch {\n // A malformed boundary event must not escape the browser callback.\n }\n };\n utterance.onpause = (): void => {\n if (gen !== this._gen) return;\n this._setPaused(true);\n };\n utterance.onresume = (): void => {\n if (gen !== this._gen) return;\n this._setPaused(false);\n };\n utterance.onend = (): void => {\n if (gen !== this._gen) return;\n this._finishUtterance(started);\n };\n utterance.onerror = (event: SpeechSynthesisErrorEvent): void => {\n if (gen !== this._gen) return;\n this._setError(this._normalizeError(event));\n this._finishUtterance(started);\n };\n\n this._setError(null);\n this._queued++;\n this._setPending(true);\n synth.speak(utterance);\n }\n\n /**\n * Clear the queue and stop the current utterance immediately. Resets all\n * progress state synchronously and invalidates in-flight utterance callbacks\n * (the browser fires a \"canceled\" error per utterance) so they do not surface\n * as real errors.\n */\n cancel(): void {\n if (!this._hasApi()) return;\n // Neutralize every in-flight utterance's pending callbacks before triggering\n // the native cancel (which fires \"canceled\" onerror/onend on each).\n this._gen++;\n // Chrome quirk: cancelling while the engine is paused can leave the synth in\n // a state where the *next* speak() produces no audio. Resume first so cancel\n // happens from a running state. resume() on an idle/non-paused engine is a\n // harmless no-op, so guarding on the tracked `_paused` flag is sufficient.\n if (this._paused) {\n window.speechSynthesis.resume();\n }\n window.speechSynthesis.cancel();\n this._queued = 0;\n this._started = 0;\n this._setSpeaking(false);\n this._setPending(false);\n this._setPaused(false);\n this._setBoundary(null, null);\n }\n\n pause(): void {\n if (!this._hasApi()) return;\n window.speechSynthesis.pause();\n }\n\n resume(): void {\n if (!this._hasApi()) return;\n window.speechSynthesis.resume();\n }\n\n /**\n * Re-establish the voiceschanged subscription after a dispose() — e.g. the\n * Shell element was disconnected and then reconnected (reparented). No-op while\n * a subscription is already live, so the first connect after construction does\n * not double-subscribe.\n */\n reinitVoices(): void {\n if (!this._voicesSubscribed) {\n this._initVoices();\n }\n }\n\n /**\n * Establish monitoring (§3.5). Synthesis is command-driven (speak/cancel), so\n * observe() only (re-)establishes the live `voiceschanged` subscription —\n * idempotent via reinitVoices()'s `_voicesSubscribed` guard, so the first\n * connect after construction does not double-subscribe while a reconnect after\n * dispose() does. Returns the `ready` promise for SSR. Call from the Shell's\n * connectedCallback.\n */\n observe(): Promise<void> {\n this.reinitVoices();\n return this._ready;\n }\n\n /**\n * Detach the live voiceschanged listener and neutralize any in-flight\n * utterance callbacks. Call from the Shell's `disconnectedCallback`.\n */\n dispose(): void {\n this._voicesSubscribed = false;\n this._gen++;\n // Reset the queue bookkeeping silently (no dispatch on a disposed element);\n // a reconnect starts fresh. The observable snapshot (error / charIndex /\n // spokenWord) is intentionally *kept* so a reparented element preserves its\n // last state, mirroring GeolocationCore.dispose(). The next speak() resets\n // error / boundary for its own lifecycle.\n this._queued = 0;\n this._started = 0;\n this._speaking = false;\n this._paused = false;\n this._pending = false;\n if (this._hasApi()) {\n window.speechSynthesis.removeEventListener(\"voiceschanged\", this._onVoicesChanged);\n }\n }\n\n // --- Internal ---\n\n // `started` is the per-utterance flag set by its onstart. An utterance that\n // ended/errored after starting releases a `_started` slot; one that never\n // started (terminal event before onstart) releases its `_queued` slot instead,\n // so `pending` correctly returns to false.\n private _finishUtterance(started: boolean): void {\n if (started) {\n this._started = Math.max(0, this._started - 1);\n } else {\n this._queued = Math.max(0, this._queued - 1);\n }\n this._setSpeaking(this._started > 0);\n this._setPending(this._queued > 0);\n if (this._started === 0 && this._queued === 0) {\n this._setPaused(false);\n this._setBoundary(null, null);\n }\n }\n\n private _hasApi(): boolean {\n return typeof window !== \"undefined\"\n && !!window.speechSynthesis\n && typeof (window as unknown as { SpeechSynthesisUtterance?: unknown }).SpeechSynthesisUtterance === \"function\";\n }\n\n private _initVoices(): void {\n if (!this._hasApi()) return;\n this._voicesSubscribed = true;\n this._loadVoices();\n window.speechSynthesis.addEventListener(\"voiceschanged\", this._onVoicesChanged);\n }\n\n private _onVoicesChanged = (): void => {\n this._loadVoices();\n };\n\n private _loadVoices(): void {\n const raw = window.speechSynthesis.getVoices() ?? [];\n this._rawVoices = raw;\n this._setVoices(raw.map((v) => this._normalizeVoice(v)));\n }\n\n private _normalizeVoice(voice: SpeechSynthesisVoice): SpeechVoiceInfo {\n return {\n name: voice.name,\n lang: voice.lang,\n default: voice.default,\n localService: voice.localService,\n voiceURI: voice.voiceURI,\n };\n }\n\n private _normalizeError(event: SpeechSynthesisErrorEvent): WcsSpeakErrorDetail {\n const error = event.error ?? \"synthesis-failed\";\n return { error, message: `Speech synthesis failed: ${error}.` };\n }\n\n private _unsupportedError(): WcsSpeakErrorDetail {\n return { error: \"unsupported\", message: \"SpeechSynthesis API is not available in this environment.\" };\n }\n}\n","import { config } from \"./config.js\";\nimport type { WcsSpeak } from \"./components/Speak.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n // A misconfigured triggerAttribute (e.g. one with a space) makes the attribute\n // selector invalid and closest() throw SyntaxError; guard so a bad config\n // disables only this shortcut rather than killing every document click handler.\n let triggerElement: Element | null;\n try {\n triggerElement = target.closest<Element>(`[${config.triggerAttribute}]`);\n } catch {\n return;\n }\n if (!triggerElement) return;\n\n const speakId = triggerElement.getAttribute(config.triggerAttribute);\n if (!speakId) return;\n\n // Resolve the registered constructor at call time instead of importing Speak as\n // a value, avoiding a components/Speak.ts ⇄ autoTrigger.ts cycle\n // (Speak.connectedCallback() calls registerAutoTrigger()). instanceof against\n // the customElements registry keeps the same identity guarantee.\n const SpeakCtor = customElements.get(config.tagNames.speak);\n const speakElement = document.getElementById(speakId);\n if (!SpeakCtor || !(speakElement instanceof SpeakCtor)) return;\n\n // The text to speak comes from the trigger element: an explicit `data-speaktext`\n // attribute wins, otherwise the element's text content. This keeps the\n // click-driven shortcut declarative without inventing a payload channel.\n const explicit = triggerElement.getAttribute(\"data-speaktext\");\n // textContent is always a string for an Element; the cast avoids an\n // unreachable null-coalesce branch. speak() tolerates a non-string anyway.\n // The textContent fallback is trimmed (HTML indentation otherwise leaks leading\n // / trailing whitespace into the utterance); an explicit data-speaktext is kept\n // verbatim so an author can deliberately include surrounding spaces.\n const text = explicit !== null ? explicit : (triggerElement.textContent as string).trim();\n\n event.preventDefault();\n (speakElement as WcsSpeak).speak(text);\n}\n\nexport function registerAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","import { config } from \"../config.js\";\nimport { IWcBindable, SpeakOptions, SpeechVoiceInfo, WcsSpeakErrorDetail } from \"../types.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { SpeakCore } from \"../core/SpeakCore.js\";\nimport { registerAutoTrigger } from \"../autoTrigger.js\";\n\n/**\n * `<wcs-speak>` — declarative text-to-speech. Wraps SpeakCore and exposes:\n *\n * - **`say`** (reactive input): writing a value speaks it, suppressing same-value\n * writes so it fires only when the bound source actually changes. The\n * imperative `speak` command instead speaks on demand (even the same text\n * again). See `docs/speech-tag-design.md` § 5.\n * - per-utterance parameters (`rate` / `pitch` / `volume` / `voice` / `lang`) as\n * mirrored attributes.\n * - the Core's observable surface (voices / speaking / paused / pending /\n * charIndex / spokenWord / error / unsupported) via delegated getters.\n */\nexport class WcsSpeak extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...SpeakCore.wcBindable,\n // Shell-level settable surface. `say` is a momentary reactive command-property\n // with no mirrored attribute (it carries dynamic text, not declarative config),\n // mirroring how <wcs-geo>'s `trigger` has no attribute. The rest mirror their\n // HTML attributes idempotently.\n inputs: [\n { name: \"say\" },\n { name: \"rate\", attribute: \"rate\" },\n { name: \"pitch\", attribute: \"pitch\" },\n { name: \"volume\", attribute: \"volume\" },\n { name: \"voice\", attribute: \"voice\" },\n { name: \"lang\", attribute: \"lang\" },\n { name: \"manual\", attribute: \"manual\" },\n ],\n commands: SpeakCore.wcBindable.commands,\n };\n\n private _core: SpeakCore;\n private _say: string = \"\";\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n // States are wired BEFORE the Core is constructed (unlike the canonical\n // Core-then-internals-then-wireStates order): SpeakCore's constructor\n // synchronously dispatches `wcs-speak:unsupported-changed` when the\n // SpeechSynthesis API is absent, so the listener must already be attached\n // to observe that first (and, in a fixed-support environment, only) event.\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-speak:speaking-changed\": (d) => ({ speaking: d === true }),\n \"wcs-speak:paused-changed\": (d) => ({ paused: d === true }),\n \"wcs-speak:pending-changed\": (d) => ({ pending: d === true }),\n \"wcs-speak:unsupported-changed\": (d) => ({ unsupported: d === true }),\n \"wcs-speak:error\": (d) => ({ error: d != null }),\n });\n this._core = new SpeakCore(this);\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Attribute accessors ---\n\n get rate(): number {\n return this._numberAttr(\"rate\", 1);\n }\n\n set rate(value: number) {\n this.setAttribute(\"rate\", String(value));\n }\n\n get pitch(): number {\n return this._numberAttr(\"pitch\", 1);\n }\n\n set pitch(value: number) {\n this.setAttribute(\"pitch\", String(value));\n }\n\n get volume(): number {\n return this._numberAttr(\"volume\", 1);\n }\n\n set volume(value: number) {\n this.setAttribute(\"volume\", String(value));\n }\n\n get voice(): string {\n return this.getAttribute(\"voice\") ?? \"\";\n }\n\n set voice(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"voice\");\n } else {\n this.setAttribute(\"voice\", String(value));\n }\n }\n\n get lang(): string {\n return this.getAttribute(\"lang\") ?? \"\";\n }\n\n set lang(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"lang\");\n } else {\n this.setAttribute(\"lang\", String(value));\n }\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n // --- Reactive command-property ---\n\n get say(): string {\n return this._say;\n }\n\n set say(value: string | null) {\n // Reactive: writing a new value speaks it. `manual` mutes the path entirely\n // (the imperative `speak` command still works) — both an opt-out and the hook\n // used to avoid a recognition echo loop while listening. A conforming binder\n // never delivers `undefined` (it skips the write), but a direct assignment\n // can, so normalize null/undefined to a no-op.\n //\n // ECHO-LOOP WARNING: when wiring <wcs-listen> → state → `say`, the synthesized\n // audio will be re-recognized unless speech is muted while listening. There is\n // no code-level interlock here (the two tags are decoupled): the consumer MUST\n // wire it — bind `manual` to the listening flag (or gate the bound source).\n // See README \"Echo loop\" and the speech-echo example.\n if (value == null) return;\n if (this.manual) return;\n const v = String(value);\n // Same-value guard: only speak when the bound source actually changes. For\n // \"speak the same text again on demand\", use the `speak` command instead.\n if (v === this._say) return;\n this._say = v;\n this.speak(v);\n }\n\n // --- Core delegated getters ---\n\n get voices(): SpeechVoiceInfo[] {\n return this._core.voices;\n }\n\n get speaking(): boolean {\n return this._core.speaking;\n }\n\n get paused(): boolean {\n return this._core.paused;\n }\n\n get pending(): boolean {\n return this._core.pending;\n }\n\n get charIndex(): number | null {\n return this._core.charIndex;\n }\n\n get spokenWord(): string | null {\n return this._core.spokenWord;\n }\n\n get error(): WcsSpeakErrorDetail | null {\n return this._core.error;\n }\n\n // Additive Phase 6 taxonomy output (event wcs-speak:error-info-changed),\n // delegated from the Core; declared via the inherited SpeakCore.wcBindable.\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get unsupported(): boolean {\n return this._core.unsupported;\n }\n\n // --- Commands ---\n\n speak(text: string): void {\n this._core.speak(text, this._options());\n }\n\n cancel(): void {\n this._core.cancel();\n }\n\n pause(): void {\n this._core.pause();\n }\n\n resume(): void {\n this._core.resume();\n }\n\n // --- Internal ---\n\n private _numberAttr(name: string, fallback: number): number {\n const attr = this.getAttribute(name);\n if (attr === null || attr.trim() === \"\") return fallback;\n // Strict parse via Number() (unlike parseInt, \"1px\" -> NaN, not 1). Fall back\n // to the API default for any non-finite value, matching the geolocation\n // \"invalid values fall back to default\" convention.\n const parsed = Number(attr);\n return Number.isFinite(parsed) ? parsed : fallback;\n }\n\n private _options(): SpeakOptions {\n return {\n rate: this.rate,\n pitch: this.pitch,\n volume: this.volume,\n voice: this.voice,\n lang: this.lang,\n };\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerAutoTrigger();\n }\n // observe() revives the voiceschanged subscription after a reconnect\n // (reparenting) and returns the readiness promise for SSR; it wraps\n // reinitVoices() (no-op on the first connect — the constructor subscribed).\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n // Detach event subscriptions and neutralize in-flight utterance callbacks.\n // Any utterance already speaking finishes naturally (SpeechSynthesis is a\n // global singleton; cancelling here would stop other <wcs-speak> elements\n // too). Call `cancel()` explicitly to stop audio.\n this._core.dispose();\n }\n}\n","import {\n IWcBindable, ListenOptions, ListenPermissionState,\n WcsListenResultDetail, WcsListenAlternative, WcsListenErrorDetail,\n} from \"../types.js\";\nimport { WcsIoErrorInfo } from \"./platformCapability.js\";\nimport { deriveListenErrorInfo } from \"./speechCapabilities.js\";\n\n// The vendor-prefixed constructor is not in the DOM lib types; declare a minimal\n// shape so we can feature-detect and construct it.\n// Minimal structural shapes for the recognition result/error events. The DOM lib\n// does not ship the prefixed API's types, so we declare just the fields read here\n// instead of using `any`, keeping the handlers type-checked and consistent with\n// the typed state fields. All fields are optional/loose because real engines vary\n// (resultIndex / charLength omitted, malformed events) and the handlers already\n// defend against that at runtime.\ninterface RecognitionAlternativeLike {\n transcript?: string;\n confidence?: number;\n}\ninterface RecognitionResultLike {\n readonly length: number;\n isFinal?: boolean;\n [index: number]: RecognitionAlternativeLike;\n}\ninterface RecognitionResultListLike {\n readonly length: number;\n [index: number]: RecognitionResultLike;\n}\ninterface RecognitionResultEventLike {\n results: RecognitionResultListLike;\n resultIndex?: number;\n}\ninterface RecognitionErrorEventLike {\n error?: string;\n}\n\ninterface SpeechRecognitionLike extends EventTarget {\n lang: string;\n continuous: boolean;\n interimResults: boolean;\n maxAlternatives: number;\n start(): void;\n stop(): void;\n abort(): void;\n onstart: ((event: Event) => void) | null;\n onend: ((event: Event) => void) | null;\n onresult: ((event: RecognitionResultEventLike) => void) | null;\n onerror: ((event: RecognitionErrorEventLike) => void) | null;\n}\n\ntype SpeechRecognitionCtor = new () => SpeechRecognitionLike;\n\n/**\n * Headless speech-to-text primitive. A thin, framework-agnostic wrapper around\n * the SpeechRecognition API (vendor-prefixed `webkitSpeechRecognition` in\n * Chrome) exposed through the wc-bindable protocol.\n *\n * It is the \"event\" half of the speech package (the synthesis half is\n * SpeakCore): recognition results flow element → state.\n *\n * Two phases mirror geolocation:\n * - **one-shot** (`continuous = false`) — recognize until the first `end`.\n * - **continuous** (`continuous = true`) — keep a single session open across\n * phrases. The browser still ends a session on silence; auto-restart bridges\n * that gap **but is opt-in via `maxRestarts`**: with the default `maxRestarts\n * = 0` a continuous session is *not* restarted on `end` (the safe default —\n * unbounded restart is the infinite-loop risk we guard against). Set\n * `maxRestarts > 0` to bridge N silences. The cap also stops a persistent\n * failure (e.g. `not-allowed`) from spinning forever or exhausting quota; a\n * real result resets the budget so only consecutive empty restarts count.\n *\n * A microphone permission gate (like geolocation's) reflects\n * `navigator.permissions.query({ name: \"microphone\" })`. Failures never throw —\n * they surface through the `error` property.\n */\nexport class ListenCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"interimTranscript\", event: \"wcs-listen:interim-changed\" },\n { name: \"finalTranscript\", event: \"wcs-listen:final-changed\" },\n { name: \"result\", event: \"wcs-listen:result\" },\n { name: \"listening\", event: \"wcs-listen:listening-changed\" },\n { name: \"permission\", event: \"wcs-listen:permission-changed\" },\n { name: \"error\", event: \"wcs-listen:error\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output derived from `error.error` (the\n // SpeechRecognitionErrorEvent.error code / \"unsupported\"); the existing `error`\n // property/event are unchanged. Fires wcs-listen:error-info-changed. No lane —\n // recognition has no competing async operation to serialize.\n { name: \"errorInfo\", event: \"wcs-listen:error-info-changed\" },\n { name: \"unsupported\", event: \"wcs-listen:unsupported-changed\" },\n ],\n commands: [\n { name: \"start\" },\n { name: \"stop\" },\n { name: \"abort\" },\n ],\n };\n\n private _target: EventTarget;\n private _recognition: SpeechRecognitionLike | null = null;\n\n private _interimTranscript: string = \"\";\n private _finalTranscript: string = \"\";\n private _result: WcsListenResultDetail | null = null;\n private _listening: boolean = false;\n private _permission: ListenPermissionState = \"prompt\";\n private _error: WcsListenErrorDetail | null = null;\n private _errorInfo: WcsIoErrorInfo | null = null;\n private _unsupported: boolean = false;\n\n // Intent flag: true between start() and stop()/abort()/terminal-error. Gates\n // the auto-restart loop so a session that ended because the user stopped it\n // does not restart.\n private _active: boolean = false;\n private _continuous: boolean = false;\n private _maxRestarts: number = 0;\n private _restartCount: number = 0;\n\n // Permission tracking — same machinery as GeolocationCore.\n private _permissionStatus: PermissionStatus | null = null;\n private _permissionSubscribed: boolean = false;\n private _permGen: number = 0;\n\n // SSR: feature detection (`_setUnsupported`) is synchronous and the permission\n // `change` subscription is established eagerly in the constructor, so there is\n // no asynchronous probe to await before snapshotting — readiness is immediate.\n // The Shell exposes this as connectedCallbackPromise.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n const Ctor = this._getCtor();\n this._setUnsupported(!Ctor);\n if (Ctor) {\n this._recognition = new Ctor();\n this._attachHandlers(this._recognition);\n }\n this._initPermission();\n }\n\n get interimTranscript(): string {\n return this._interimTranscript;\n }\n\n get finalTranscript(): string {\n return this._finalTranscript;\n }\n\n get result(): WcsListenResultDetail | null {\n return this._result;\n }\n\n get listening(): boolean {\n return this._listening;\n }\n\n get permission(): ListenPermissionState {\n return this._permission;\n }\n\n get error(): WcsListenErrorDetail | null {\n return this._error;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable`), or null. Additive wc-bindable property (event\n * `wcs-listen:error-info-changed`), derived from `error`; the existing `error`\n * property/event are unchanged.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n // Resolved once in the constructor (`_setUnsupported(!Ctor)`) and never\n // re-evaluated: the SpeechRecognition API's presence is immutable for the\n // lifetime of a document, so there's nothing to re-check.\n get unsupported(): boolean {\n return this._unsupported;\n }\n\n /** Resolves once the first probe settles (immediate — see `_ready`). */\n get ready(): Promise<void> {\n return this._ready;\n }\n\n // --- State setters with event dispatch ---\n\n private _setInterim(value: string): void {\n if (this._interimTranscript === value) return;\n this._interimTranscript = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:interim-changed\", { detail: value, bubbles: true }));\n }\n\n private _setFinal(value: string): void {\n if (this._finalTranscript === value) return;\n this._finalTranscript = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:final-changed\", { detail: value, bubbles: true }));\n }\n\n private _setResult(value: WcsListenResultDetail): void {\n this._result = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:result\", { detail: value, bubbles: true }));\n }\n\n private _setListening(value: boolean): void {\n if (this._listening === value) return;\n this._listening = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:listening-changed\", { detail: value, bubbles: true }));\n }\n\n private _setPermission(value: ListenPermissionState): void {\n if (this._permission === value) return;\n this._permission = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:permission-changed\", { detail: value, bubbles: true }));\n }\n\n private _setError(value: WcsListenErrorDetail | null): void {\n if (this._error === value) return;\n this._error = value;\n // Keep the additive `errorInfo` taxonomy in sync with `error`: derive from the\n // error code (or null on clear). Fires before the `error` event so an observer\n // binding both sees the classification first, mirroring the io-node family.\n this._commitErrorInfo(value === null ? null : deriveListenErrorInfo(value));\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:error\", { detail: value, bubbles: true }));\n }\n\n // Called only from _setError (which already guards on error identity), so\n // errorInfo transitions exactly when error does — no separate guard needed here.\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:error-info-changed\", { detail: info, bubbles: true }));\n }\n\n private _setUnsupported(value: boolean): void {\n if (this._unsupported === value) return;\n this._unsupported = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-listen:unsupported-changed\", { detail: value, bubbles: true }));\n }\n\n // --- Public API ---\n\n /**\n * Begin a recognition session. Resets the transcripts (a fresh, user-initiated\n * listen), applies options, and starts. Idempotent while already listening: a\n * redundant start() is ignored so the browser does not throw \"recognition has\n * already started\".\n */\n start(options: ListenOptions = {}): void {\n if (!this._recognition) {\n this._setError(this._unsupportedError());\n return;\n }\n if (this._active) return;\n\n this._continuous = options.continuous ?? false;\n // `maxRestarts` is a restart *count*, so floor any fractional input to an\n // integer (e.g. 2.5 → 2). `_restartCount` increments by 1, so a fractional\n // cap would otherwise compare inconsistently. Non-finite/negative → 0.\n this._maxRestarts = typeof options.maxRestarts === \"number\" && options.maxRestarts >= 0\n ? Math.floor(options.maxRestarts)\n : 0;\n this._restartCount = 0;\n this._recognition.lang = options.lang ?? \"\";\n this._recognition.continuous = this._continuous;\n this._recognition.interimResults = options.interimResults ?? false;\n if (typeof options.maxAlternatives === \"number\") {\n this._recognition.maxAlternatives = options.maxAlternatives;\n }\n\n // Fresh session: clear prior transcripts and error.\n this._setInterim(\"\");\n this._setFinal(\"\");\n this._setError(null);\n this._active = true;\n this._safeStart();\n }\n\n stop(): void {\n if (!this._recognition) return;\n // Clear intent first so the end handler does not auto-restart.\n this._active = false;\n this._recognition.stop();\n }\n\n abort(): void {\n if (!this._recognition) return;\n this._active = false;\n this._recognition.abort();\n }\n\n /**\n * Re-establish the permission `change` subscription after a dispose().\n */\n reinitPermission(): void {\n if (!this._permissionSubscribed) {\n this._initPermission();\n }\n }\n\n /**\n * Establish monitoring (§3.5). Recognition is command-driven (start/stop), so\n * observe() only (re-)establishes the live permission subscription — idempotent\n * via reinitPermission()'s `_permissionSubscribed` guard, so the first connect\n * after construction does not double-subscribe while a reconnect after dispose()\n * does. Returns the `ready` promise for SSR. Call from the Shell's\n * connectedCallback.\n */\n observe(): Promise<void> {\n this.reinitPermission();\n return this._ready;\n }\n\n /**\n * Stop recognition and detach the live permission listener. Call from the\n * Shell's `disconnectedCallback`.\n */\n dispose(): void {\n // Only the live subscriptions and the listening shadow are reset here. The\n // observable snapshot (transcripts / result / error) is intentionally *kept*\n // so a reparented element preserves its last state, mirroring how\n // GeolocationCore.dispose() leaves `position` / `error` intact. The next\n // start() clears the transcripts and error for its fresh session anyway.\n this._active = false;\n this._permissionSubscribed = false;\n this._permGen++;\n if (this._recognition) {\n // abort() is the immediate teardown; guard against environments where it\n // throws on an idle recognizer.\n try {\n this._recognition.abort();\n } catch {\n // ignore — teardown is best-effort.\n }\n }\n // Reset the listening shadow silently (no dispatch on a disposed element),\n // mirroring GeolocationCore's `_loading` reset. The abort() above neutralizes\n // the recognizer but its `end` (which would clear listening via the setter)\n // may not have fired yet; forcing false here means a reconnect+start's\n // `onstart` still transitions false→true through the same-value guard, so the\n // state never desyncs to a stale `true`.\n this._listening = false;\n if (this._permissionStatus) {\n this._permissionStatus.removeEventListener(\"change\", this._onPermissionChange);\n this._permissionStatus = null;\n }\n }\n\n // --- Internal: recognition lifecycle ---\n\n private _attachHandlers(recognition: SpeechRecognitionLike): void {\n recognition.onstart = (): void => {\n this._setListening(true);\n };\n recognition.onresult = (event: RecognitionResultEventLike): void => {\n try {\n this._handleResult(event);\n } catch {\n // A malformed result event must not escape the browser callback.\n }\n };\n recognition.onerror = (event: RecognitionErrorEventLike): void => {\n this._setError(this._normalizeError(event));\n // Terminal errors must not be retried — they would spin the restart loop.\n // The set is deliberately limited to the permission-class errors that can\n // never self-recover within a session. Transient failures\n // (`network` / `audio-capture` / `no-speech`) are intentionally *not*\n // terminal: they are recoverable, so a continuous session restarts through\n // them, bounded by `maxRestarts` (the cap is the guard against a persistent\n // transient failure spinning forever).\n if (event && (event.error === \"not-allowed\" || event.error === \"service-not-allowed\")) {\n this._active = false;\n }\n };\n recognition.onend = (): void => {\n if (this._active && this._continuous && this._restartCount < this._maxRestarts) {\n // Auto-restart bridges a silence-induced `end`. Keep `listening` true\n // across the gap rather than flickering true→false→true: from the\n // consumer's perspective the continuous session never stopped. The\n // immediately-following start()'s `onstart` re-sets true (same-value\n // guarded → no-op), so the flag stays steady. A genuine stop (no\n // restart) still drops to false below.\n this._restartCount++;\n this._safeStart();\n // _safeStart() clears _active if the restart threw; in that case the\n // session is over, so reflect listening=false rather than leaving it\n // stuck true.\n if (!this._active) this._setListening(false);\n return;\n }\n // No restart: the session is fully over.\n this._setListening(false);\n this._active = false;\n };\n }\n\n private _handleResult(event: RecognitionResultEventLike): void {\n const results = event.results;\n let interim = \"\";\n let finalChunk = \"\";\n // Per the Web Speech spec, `resultIndex` is the lowest index in `results`\n // that changed in this event, so we only fold in `[resultIndex, length)` and\n // accumulate finals (`this._finalTranscript + finalChunk`). This assumes the\n // engine advances `resultIndex` past already-finalized results. A nonconforming\n // engine that omits `resultIndex` (`?? 0`) or re-reports finalized results at\n // index 0 on every event could double-accumulate the same final chunk; standard\n // browser engines don't, so this is not hardened against here.\n for (let i = event.resultIndex ?? 0; i < results.length; i++) {\n const res = results[i];\n const transcript = res?.[0]?.transcript ?? \"\";\n if (res?.isFinal) {\n finalChunk += transcript;\n } else {\n interim += transcript;\n }\n }\n if (finalChunk !== \"\") {\n this._setFinal(this._finalTranscript + finalChunk);\n }\n this._setInterim(interim);\n // Any result is progress — reset the restart budget so only *consecutive*\n // empty restarts count toward the cap.\n this._restartCount = 0;\n\n const last = results[results.length - 1];\n if (last) {\n this._setResult(this._normalizeResult(last));\n }\n }\n\n private _normalizeResult(result: RecognitionResultLike): WcsListenResultDetail {\n const alternatives: WcsListenAlternative[] = [];\n for (let i = 0; i < result.length; i++) {\n alternatives.push({\n transcript: result[i]?.transcript ?? \"\",\n confidence: result[i]?.confidence ?? 0,\n });\n }\n const top = alternatives[0] ?? { transcript: \"\", confidence: 0 };\n return {\n transcript: top.transcript,\n confidence: top.confidence,\n isFinal: !!result.isFinal,\n alternatives,\n };\n }\n\n private _safeStart(): void {\n try {\n this._recognition!.start();\n } catch {\n // start() throws if already started; surface nothing — the live session\n // continues. Reset intent so state stays consistent.\n this._active = false;\n }\n }\n\n // --- Internal: feature detection & permission (mirrors GeolocationCore) ---\n\n private _getCtor(): SpeechRecognitionCtor | null {\n // Guard window access without a separate (in-browser unreachable) early\n // return, mirroring SpeakCore's `_hasApi` style.\n const w = (typeof window === \"undefined\" ? undefined : window) as unknown as {\n SpeechRecognition?: SpeechRecognitionCtor;\n webkitSpeechRecognition?: SpeechRecognitionCtor;\n } | undefined;\n return w?.SpeechRecognition ?? w?.webkitSpeechRecognition ?? null;\n }\n\n private _initPermission(): void {\n if (typeof navigator === \"undefined\" || !navigator.permissions || typeof navigator.permissions.query !== \"function\") {\n this._setPermission(\"unsupported\");\n return;\n }\n this._permissionSubscribed = true;\n const gen = ++this._permGen;\n navigator.permissions.query({ name: \"microphone\" as PermissionName }).then(\n (status) => {\n if (gen !== this._permGen) return;\n this._permissionStatus = status;\n this._setPermission(status.state as ListenPermissionState);\n status.addEventListener(\"change\", this._onPermissionChange);\n },\n () => {\n if (gen !== this._permGen) return;\n this._setPermission(\"unsupported\");\n },\n );\n }\n\n private _onPermissionChange = (event: Event): void => {\n const status = event.target as PermissionStatus;\n this._setPermission(status.state as ListenPermissionState);\n };\n\n private _normalizeError(event: RecognitionErrorEventLike): WcsListenErrorDetail {\n const error = (event && event.error) ? event.error : \"aborted\";\n return { error, message: `Speech recognition failed: ${error}.` };\n }\n\n private _unsupportedError(): WcsListenErrorDetail {\n return { error: \"unsupported\", message: \"SpeechRecognition API is not available in this environment.\" };\n }\n}\n","import { config } from \"./config.js\";\nimport type { WcsListen } from \"./components/Listen.js\";\n\nlet registered = false;\n\nfunction handleClick(event: Event): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n\n // A misconfigured listenTriggerAttribute (e.g. one with a space) makes the\n // attribute selector invalid and closest() throw SyntaxError; guard so a bad\n // config disables only this shortcut rather than killing every click handler.\n let triggerElement: Element | null;\n try {\n triggerElement = target.closest<Element>(`[${config.listenTriggerAttribute}]`);\n } catch {\n return;\n }\n if (!triggerElement) return;\n\n const listenId = triggerElement.getAttribute(config.listenTriggerAttribute);\n if (!listenId) return;\n\n const ListenCtor = customElements.get(config.tagNames.listen);\n const listenElement = document.getElementById(listenId);\n if (!ListenCtor || !(listenElement instanceof ListenCtor)) return;\n\n event.preventDefault();\n // Toggle: clicking starts a session, clicking again while listening stops it.\n const el = listenElement as WcsListen;\n if (el.listening) {\n el.stop();\n } else {\n el.start();\n }\n}\n\nexport function registerListenAutoTrigger(): void {\n if (registered) return;\n registered = true;\n document.addEventListener(\"click\", handleClick);\n}\n\nexport function unregisterListenAutoTrigger(): void {\n if (!registered) return;\n registered = false;\n document.removeEventListener(\"click\", handleClick);\n}\n","import { config } from \"../config.js\";\nimport {\n IWcBindable, ListenOptions, ListenPermissionState, WcsListenResultDetail, WcsListenErrorDetail,\n} from \"../types.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\nimport { ListenCore } from \"../core/ListenCore.js\";\nimport { registerListenAutoTrigger } from \"../listenAutoTrigger.js\";\n\n/**\n * `<wcs-listen>` — declarative speech-to-text. Wraps ListenCore and exposes the\n * recognition surface (interim/final transcripts, structured result, listening\n * flag, microphone permission, error) plus the two-phase start/stop/abort\n * commands and a momentary `trigger` for DOM-driven starts.\n *\n * Mirrors `<wcs-geo>`: `manual` suppresses the connect-time auto-start, and the\n * `continuous` attribute selects the auto-restarting session phase.\n */\nexport class WcsListen extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n static wcBindable: IWcBindable = {\n ...ListenCore.wcBindable,\n properties: [\n ...ListenCore.wcBindable.properties,\n { name: \"trigger\", event: \"wcs-listen:trigger-changed\" },\n ],\n inputs: [\n { name: \"lang\", attribute: \"lang\" },\n { name: \"continuous\", attribute: \"continuous\" },\n { name: \"interim\", attribute: \"interim\" },\n { name: \"maxRestarts\", attribute: \"max-restarts\" },\n { name: \"manual\", attribute: \"manual\" },\n { name: \"trigger\" },\n ],\n commands: ListenCore.wcBindable.commands,\n };\n\n private _core: ListenCore;\n private _trigger: boolean = false;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n // States are wired BEFORE the Core is constructed (unlike the canonical\n // Core-then-internals-then-wireStates order): ListenCore's constructor\n // synchronously dispatches `wcs-listen:unsupported-changed` when the\n // SpeechRecognition API is absent (notably Safari, which ships\n // SpeechSynthesis but not SpeechRecognition), so the listener must already\n // be attached to observe that first (and, in a fixed-support environment,\n // only) event.\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-listen:listening-changed\": (d) => ({ listening: d === true }),\n \"wcs-listen:unsupported-changed\": (d) => ({ unsupported: d === true }),\n \"wcs-listen:error\": (d) => ({ error: d != null }),\n });\n this._core = new ListenCore(this);\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Attribute accessors ---\n\n get lang(): string {\n return this.getAttribute(\"lang\") ?? \"\";\n }\n\n set lang(value: string | null) {\n if (value == null) {\n this.removeAttribute(\"lang\");\n } else {\n this.setAttribute(\"lang\", String(value));\n }\n }\n\n get continuous(): boolean {\n return this.hasAttribute(\"continuous\");\n }\n\n set continuous(value: boolean) {\n if (value) {\n this.setAttribute(\"continuous\", \"\");\n } else {\n this.removeAttribute(\"continuous\");\n }\n }\n\n get interim(): boolean {\n return this.hasAttribute(\"interim\");\n }\n\n set interim(value: boolean) {\n if (value) {\n this.setAttribute(\"interim\", \"\");\n } else {\n this.removeAttribute(\"interim\");\n }\n }\n\n get maxRestarts(): number {\n const attr = this.getAttribute(\"max-restarts\");\n if (attr === null || attr.trim() === \"\") return 0;\n const parsed = Number(attr);\n // A restart *count* is an integer, so floor fractional input (e.g. 1.9 → 1)\n // here too, keeping the getter's value identical to the effective cap the\n // Core applies (ListenCore.start floors it as well). Non-finite/negative → 0.\n return Number.isFinite(parsed) && parsed >= 0 ? Math.floor(parsed) : 0;\n }\n\n set maxRestarts(value: number) {\n this.setAttribute(\"max-restarts\", String(value));\n }\n\n get manual(): boolean {\n return this.hasAttribute(\"manual\");\n }\n\n set manual(value: boolean) {\n if (value) {\n this.setAttribute(\"manual\", \"\");\n } else {\n this.removeAttribute(\"manual\");\n }\n }\n\n // --- Core delegated getters ---\n\n get interimTranscript(): string {\n return this._core.interimTranscript;\n }\n\n get finalTranscript(): string {\n return this._core.finalTranscript;\n }\n\n get result(): WcsListenResultDetail | null {\n return this._core.result;\n }\n\n get listening(): boolean {\n return this._core.listening;\n }\n\n get permission(): ListenPermissionState {\n return this._core.permission;\n }\n\n get error(): WcsListenErrorDetail | null {\n return this._core.error;\n }\n\n // Additive Phase 6 taxonomy output (event wcs-listen:error-info-changed),\n // delegated from the Core; declared via the inherited ListenCore.wcBindable.\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get unsupported(): boolean {\n return this._core.unsupported;\n }\n\n // --- Command property ---\n\n get trigger(): boolean {\n return this._trigger;\n }\n\n set trigger(value: boolean) {\n // Momentary command-property: a false→true write starts a session. Mirrors\n // <wcs-geo>'s trigger. Prefer the command-token protocol (`command.start:\n // $command.listen`) for state-driven starts; this exists for DOM triggers and\n // simple boolean bindings.\n const v = !!value;\n if (v) {\n this._trigger = true;\n this.start();\n this._trigger = false;\n this.dispatchEvent(new CustomEvent(\"wcs-listen:trigger-changed\", { detail: false, bubbles: true }));\n }\n }\n\n // --- Commands ---\n\n start(): void {\n this._core.start(this._options());\n }\n\n stop(): void {\n this._core.stop();\n }\n\n abort(): void {\n this._core.abort();\n }\n\n // --- Internal ---\n\n private _options(): ListenOptions {\n return {\n lang: this.lang,\n continuous: this.continuous,\n interimResults: this.interim,\n maxRestarts: this.maxRestarts,\n };\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n if (config.autoTrigger) {\n registerListenAutoTrigger();\n }\n // observe() (re-)establishes the permission subscription and returns the\n // readiness promise for SSR; it wraps reinitPermission() (idempotent).\n this._connectedCallbackPromise = this._core.observe();\n if (!this.manual) {\n // Non-blocking auto-start, mirroring <wcs-geo>: start() is fired\n // unconditionally without first awaiting/inspecting the (async) permission\n // state. A `denied` mic surfaces as a `not-allowed` error via the `error`\n // property (and stops auto-restart), rather than the connect path silently\n // suppressing the start. This keeps the permission model declarative and\n // consistent with geolocation. Use `manual` to require an explicit start.\n this.start();\n }\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsSpeak } from \"./components/Speak.js\";\nimport { WcsListen } from \"./components/Listen.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.speak)) {\n customElements.define(config.tagNames.speak, WcsSpeak);\n }\n if (!customElements.get(config.tagNames.listen)) {\n customElements.define(config.tagNames.listen, WcsListen);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapSpeech(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":["registered","handleClick"],"mappings":"AAYA,MAAM,OAAO,GAAoB;AAC/B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,sBAAsB,EAAE,mBAAmB;AAC3C,IAAA,QAAQ,EAAE;AACR,QAAA,KAAK,EAAE,WAAW;AAClB,QAAA,MAAM,EAAE,YAAY;AACrB,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;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