From 3a7f0bf677f9b0761ba5d6691e2159838cce2cd9 Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Fri, 4 Sep 2026 12:30:13 +0200 Subject: [PATCH] refactor: scope rehearser io --- CHANGELOG.md | 2 ++ VERSION | 2 +- docs/ARCHITECTURE.md | 1 + static/index.html | 16 ++++++++-------- static/js/rehearser-io.js | 30 ++++++++++++++++++++++++++---- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad21316..a2a060e 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 +- **Rehearser I/O namespace migration.** Serialization, library persistence, import/export, and PDF helpers now use a + private implementation scope with explicit compatibility exports and the existing namespace API. - **Rehearser playback namespace migration.** WebAudio transport, decoded-buffer caching, line-audio caching, and batch synthesis now use a private implementation scope with explicit compatibility exports and a tested namespace API. - **Stateful Audiobook namespace migration.** Casting/recast orchestration and preview/export now keep internal helpers diff --git a/VERSION b/VERSION index 74eb4d2..c69cdff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.59 +1.24.60 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 7b94c94..c1e4ee7 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -50,6 +50,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed) - ✅ `audiobook-preview-export.js` — editable cast preview, Rehearser handoff, chapter-aware export, and export browsing. - ✅ Stateful Audiobook modules use private scopes with explicit legacy exports; their public APIs are namespace-tested. - ✅ Rehearser playback uses a private scope with explicit transport/cache compatibility exports and a namespace-tested API. +- ✅ Rehearser I/O uses a private scope with explicit serialization/library/import 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 e58b2cd..22f12f6 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/rehearser-io.js b/static/js/rehearser-io.js index 25bf77e..fd8e7b0 100644 --- a/static/js/rehearser-io.js +++ b/static/js/rehearser-io.js @@ -1,6 +1,8 @@ // Rehearser serialization, library I/O, and import/export helpers. // Loaded before rehearser.js; dependencies resolve when user actions invoke them. +(function (root) { + // ── Serialization ───────────────────────────────────────────────────────── async function clipsToJson(clips) { @@ -442,9 +444,29 @@ function loadRecord(rec) { } -window.TTVC=window.TTVC||{}; -window.TTVC.rehearser=window.TTVC.rehearser||{}; -Object.assign(window.TTVC.rehearser,{ +// Preserve the classic-script surface for existing handlers while keeping I/O +// implementation details private to this module. +Object.assign(root, { + clipsToJson, + clipsFromJson, + rehCurrentRecord, + linesToScriptText, + saveToLibrary, + rehAutoSaveImport, + exportToFile, + exportFountain, + exportFDX, + importFDX, + exportOSF, + loadPdfJs, + importPDFScript, + importFromFile, + loadRecord, +}); + +root.TTVC=root.TTVC||{}; +root.TTVC.rehearser=root.TTVC.rehearser||{}; +Object.assign(root.TTVC.rehearser,{ io:{ currentRecord:rehCurrentRecord, save:saveToLibrary, @@ -454,4 +476,4 @@ Object.assign(window.TTVC.rehearser,{ loadRecord, }, }); - +})(window);