diff --git a/CHANGELOG.md b/CHANGELOG.md index 7902294..9060b91 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 +- **Voice-library namespace migration.** Voice loading, rendering, benchmarking, and add/import workflows now use a + private scope with live compatibility accessors and a `window.TTVC.voiceLibrary` API. - **Generation namespace migration.** WAV merging, chunked TTS, history, playlist, effects, and refinement helpers now use a private scope with explicit compatibility exports and a `window.TTVC.generation` API. - **STT namespace migration.** STT backend selection, microphone recording, voice loading, and STT-to-TTS helpers now diff --git a/TODO.md b/TODO.md index f5ecdac..31d1b63 100644 --- a/TODO.md +++ b/TODO.md @@ -126,7 +126,8 @@ architecture change: the larger Audiobook/Rehearser/style split. - [x] Extract Rehearser stage display and cast-sidebar controls into `rehearser-stage.js`. - [ ] Replace broad globals with namespaces such as `window.TTVC.audiobook`; pure leaves, Audiobook/Reader/Rehearser feature modules, Studio, and character-library persistence now use private scopes with explicit compatibility exports. - Remaining utility and legacy library UI modules still require the same responsibility-by-responsibility migration. + Voice-library loading, rendering, benchmarking, and import workflows are now scoped; remaining utility and legacy + library UI modules still require the same responsibility-by-responsibility migration. - [x] Generate the feature-module list for `loader.js` and `scripts/minify.mjs` from one shared manifest; larger responsibility splits remain. - [x] Add a dependency-free frontend syntax and top-level declaration collision gate (`npm run check:frontend`); diff --git a/VERSION b/VERSION index b7a47c2..3c14d8d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.84 +1.24.85 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 43ae090..fc1f2fd 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -74,6 +74,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed) - ✅ 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. - ✅ Generation audio/history/playlist helpers use a private scope with explicit compatibility exports and a namespace API. +- ✅ Voice-library loading, rendering, benchmarking, and import workflows use a private scope with live compatibility exports. - ✅ `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 eaaced4..3e197bc 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/voice-library.js b/static/js/voice-library.js index 19f6636..b9ee2bf 100644 --- a/static/js/voice-library.js +++ b/static/js/voice-library.js @@ -1,5 +1,7 @@ // ── Save voice ──────────────────────────────────────────────────────────── +(function (root) { + $('save-btn').addEventListener('click', async () => { const id = trimmedFileId||designedFileId||currentFileId; if (!id) { toast('No audio ready','error'); return; } @@ -3747,3 +3749,24 @@ async function _bulkSetEnabled(ids, enabled) { } return done; } + +// Keep the mature voice-library integration surface compatible while placing +// implementation state and helpers behind one explicit module scope. +Object.assign(root, { + _vlCacheClear, loadVoiceLibrary, mergeBenchmarkResults, loadLibraryVoiceAudio, + renderVoiceList, runVoiceBenchmark, runVoiceBenchmarkBatch, activeBenchmarkVoices, + benchmarkTargetVoices, openSavedLibraryVoice, suggestLibVoiceId, uploadLibAddFile, + transcribeLibAddCurrent, voiceFileUrl, saveMeta, deleteVoiceGroup, libAddState, +}); +Object.defineProperty(root, '_voices', { configurable: true, get: () => _voices, set: v => { _voices = v; } }); +root.TTVC = root.TTVC || {}; +root.TTVC.voiceLibrary = root.TTVC.voiceLibrary || {}; +Object.assign(root.TTVC.voiceLibrary, { + get voices() { return _voices; }, + load: loadVoiceLibrary, + render: renderVoiceList, + audio: { load: loadLibraryVoiceAudio, url: voiceFileUrl }, + benchmarks: { run: runVoiceBenchmark, runBatch: runVoiceBenchmarkBatch }, + saveMeta, +}); +})(window);