From 67ee55d3ac753fd9af00a865d2d2271636a96717 Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Fri, 4 Sep 2026 13:23:54 +0200 Subject: [PATCH] refactor: scope character library --- CHANGELOG.md | 2 ++ TODO.md | 3 ++- VERSION | 2 +- docs/ARCHITECTURE.md | 1 + static/index.html | 16 ++++++++-------- static/js/library-characters.js | 23 +++++++++++++++++++++++ 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 379b57f..0a9ec5c 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 +- **Character-library namespace migration.** Character rendering, detail views, avatar handling, and generation actions + now live behind a private scope with compatibility exports and a `window.TTVC.characterLibrary` API. - **Character-sheet namespace migration.** Character-sheet extraction, prompt helpers, and Reader/Rehearser entry points now use a private scope with compatibility exports and a `window.TTVC.characterSheets` API. - **Voice-library namespace migration.** Voice loading, rendering, benchmarking, and add/import workflows now use a diff --git a/TODO.md b/TODO.md index 48f4b4f..3061fd0 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. - Voice-library loading, rendering, benchmarking, import workflows, and character-sheet extraction are now scoped; + Voice-library loading, rendering, benchmarking, import workflows, character-sheet extraction, and character-library + rendering/actions 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. diff --git a/VERSION b/VERSION index 81c020d..9bbc347 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.86 +1.24.87 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 09d77a8..fb1e165 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -76,6 +76,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed) - ✅ 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. - ✅ Character-sheet extraction and prompt helpers use a private scope with explicit compatibility exports and a namespace API. +- ✅ Character-library rendering, detail, avatar, and generation actions use a private scope with compatibility exports and a namespace API. - ✅ `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 9c3d47a..7c2bd03 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/library-characters.js b/static/js/library-characters.js index 4e2ea61..4cb09c4 100644 --- a/static/js/library-characters.js +++ b/static/js/library-characters.js @@ -4,6 +4,8 @@ // ── Characters / Cast ───────────────────────────────────────────────────────── +(function (root) { + let _libCharsRenderSeq = 0; async function _libReviewVisualPairs(button, container) { @@ -3697,3 +3699,24 @@ window._charAutoGenerateImage = _charAutoGenerateImage; window._charAutoGenerateConceptArt = _charAutoGenerateConceptArt; window._openConceptArtLightbox = _openConceptArtLightbox; window.libraryRenderCharacters = libraryRenderCharacters; + +Object.assign(root, { + _libStr, _charAutoGenerateConsistentImages, +}); +root.TTVC = root.TTVC || {}; +root.TTVC.characterLibrary = root.TTVC.characterLibrary || {}; +Object.assign(root.TTVC.characterLibrary, { + render: libraryRenderCharacters, + detail: _charDetailPage, + openDetail: _charDetailModal, + avatar: { open: _openAvatarLightbox, syncVoicePicture: _syncVoicePictureFromChar }, + actions: { + searchOnline: _charSearchOnline, + designVoice: _charDesignVoice, + autoDesignVoice: _charAutoDesignVoice, + generateImage: _charAutoGenerateImage, + generateConceptArt: _charAutoGenerateConceptArt, + }, + openBookContextEditor, +}); +})(window);