From ababdf6741dfcf6e068ddd5bb80caa4afd90a014 Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Fri, 4 Sep 2026 13:13:10 +0200 Subject: [PATCH] refactor: scope stt module --- CHANGELOG.md | 2 ++ VERSION | 2 +- docs/ARCHITECTURE.md | 1 + static/index.html | 16 ++++++++-------- static/js/stt.js | 19 +++++++++++++++++++ 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a29e9..a2c0d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi ## [Unreleased] ### Changed +- **STT namespace migration.** STT backend selection, microphone recording, voice loading, and STT-to-TTS helpers now + use a private scope with live compatibility accessors and a `window.TTVC.stt` API. - **AI-backend namespace migration.** LLM snippets and backend interaction controls now live behind a private section scope with an explicit `window.TTVC.aiBackends` API for cross-module snippet initialization. - **Integrations namespace migration.** Endpoint helpers, active-voice listings, virtual design IDs, and API snippet diff --git a/VERSION b/VERSION index 8a71c6f..da128ef 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.82 +1.24.83 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 45efd5e..560237b 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -72,6 +72,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed) - ✅ Combined library production rendering and Reader/Rehearser handoffs use a private scope with an explicit namespace API. - ✅ Integration endpoint and API-snippet helpers use a private scope with explicit voice/endpoint compatibility exports. - ✅ AI-backend section interactions and snippet initialization use a private scope with an explicit namespace API. +- ✅ STT backend, recording, voice-loading, and STT-to-TTS helpers use a private scope with live compatibility accessors. - ✅ `static/css/resource-diagnostics.css` — isolated Performance/resource diagnostic panel styles. - ✅ `static/css/background-jobs.css` — isolated background-job history and retry-panel styles. - ✅ `static/css/voice-design.css` — isolated Voice Design form, samples, and preview-match styles. diff --git a/static/index.html b/static/index.html index 58ec48a..f372145 100644 --- a/static/index.html +++ b/static/index.html @@ -10,7 +10,7 @@ - + @@ -27,12 +27,12 @@ - - - - - - + + + + + + @@ -397,7 +397,7 @@ window.toggleNavTree = function(treeId, chevronId) { - + diff --git a/static/js/stt.js b/static/js/stt.js index 0cd3d57..0f716b9 100644 --- a/static/js/stt.js +++ b/static/js/stt.js @@ -1,5 +1,7 @@ // ── STT -> TTS ─────────────────────────────────────────────────────────── +(function (root) { + let sttTtsSourceId = null; let sttTtsOutputBlob = null; let _sttBackends = []; @@ -288,3 +290,20 @@ $('stt-tts-save-wav-btn')?.addEventListener('click', () => { sttTtsDownload(sttTtsOutputBlob, ($('stt-tts-voice-select').value || 'stt_tts') + '_stt_tts.wav'); }); +Object.assign(root, { + sttTtsSourceId, sttTtsOutputBlob, _sttBackends, sttTtsRecorder, + sttTtsRecordStream, sttTtsRecordChunks, sttTtsRecordTimer, sttTtsRecordSecs, + sttTtsSelectedSttBackend, sttBackendOptionHtml, updateSttBackendHelp, + refreshSttBackends, sttTtsSelectedBackend, sttTtsDownload, sttTtsUploadFile, + sttTtsFetchVoices, sttTtsSetRecording, sttTtsStopTracks, +}); +Object.defineProperty(root, '_sttBackends', { configurable: true, get: () => _sttBackends, set: v => { _sttBackends = v; } }); +root.TTVC = root.TTVC || {}; +root.TTVC.stt = root.TTVC.stt || {}; +Object.assign(root.TTVC.stt, { + get backends() { return _sttBackends; }, + refresh: refreshSttBackends, + fetchVoices: sttTtsFetchVoices, + upload: sttTtsUploadFile, +}); +})(window);