refactor: scope audiobook state modules

This commit is contained in:
mARTin-B78 2026-09-04 12:26:21 +02:00
parent 2aca152fe8
commit cc4fc4ae2e
6 changed files with 40 additions and 18 deletions

View File

@ -8,6 +8,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
## [Unreleased]
### Changed
- **Stateful Audiobook namespace migration.** Casting/recast orchestration and preview/export now keep internal helpers
private and publish their public compatibility surface explicitly through `window.TTVC.audiobook`.
- **Pure leaf namespace migration.** Rehearser parsing/training and Audiobook parsing/segmentation helpers now keep
declarations private and publish explicit compatibility exports alongside their `window.TTVC` APIs.
- **P1 architecture audit.** Marked the incremental frontend modularization complete: all planned Audiobook/Rehearser

View File

@ -1 +1 @@
1.24.57
1.24.58

View File

@ -48,6 +48,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed)
- ✅ `audiobook-cast.js` — cast Markdown export, legacy page-stamping migration, deterministic speaker/sentence/duplicate/alias normalization helpers, and the live cast-view renderer.
- ✅ `audiobook-pipeline.js` — LLM casting, unknown-speaker recast, automatic repair, and cast-view orchestration.
- ✅ `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.
- ✅ `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.

View File

@ -10,7 +10,7 @@
<meta name="format-detection" content="telephone=no">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#2563EB">
<meta name="app-version" content="1.24.57">
<meta name="app-version" content="1.24.58">
<link rel="manifest" href="/manifest.webmanifest">
<link rel="icon" href="/static/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icon.svg">
@ -27,12 +27,12 @@
<!-- ── Core styles (local — no CDN dependency for first paint) ────────── -->
<link rel="stylesheet" href="/static/vendor/mdi/materialdesignicons.min.css">
<link rel="stylesheet" href="/static/style.css?v=1.24.57">
<link rel="stylesheet" href="/static/css/resource-diagnostics.css?v=1.24.57">
<link rel="stylesheet" href="/static/css/background-jobs.css?v=1.24.57">
<link rel="stylesheet" href="/static/css/voice-design.css?v=1.24.57">
<link rel="stylesheet" href="/static/css/rehearser.css?v=1.24.57">
<link rel="stylesheet" href="/static/css/audiobook.css?v=1.24.57">
<link rel="stylesheet" href="/static/style.css?v=1.24.58">
<link rel="stylesheet" href="/static/css/resource-diagnostics.css?v=1.24.58">
<link rel="stylesheet" href="/static/css/background-jobs.css?v=1.24.58">
<link rel="stylesheet" href="/static/css/voice-design.css?v=1.24.58">
<link rel="stylesheet" href="/static/css/rehearser.css?v=1.24.58">
<link rel="stylesheet" href="/static/css/audiobook.css?v=1.24.58">
<!-- ── Flag icons — non-blocking (loaded async, icons appear after JS) ── -->
@ -397,7 +397,7 @@ window.toggleNavTree = function(treeId, chevronId) {
</script>
<!-- loader.js: fetches sections → loads JS modules → removes skeleton -->
<script src="/static/loader.js?v=1.24.57"></script>
<script src="/static/loader.js?v=1.24.58"></script>
</body>
</html>

View File

@ -1,5 +1,6 @@
// Audiobook LLM casting and recast orchestration.
// Loaded after cast helpers and before audiobook.js; dependencies resolve at call time.
(function (root) {
// Every long-running audiobook action opens with a "already running?" guard.
// They all used to `return` in silence, so clicking Recast / Verify / Export
@ -1060,9 +1061,16 @@ async function audiobookCast(overrideUrl, overrideModel, resume) {
}
window.TTVC=window.TTVC||{};
window.TTVC.audiobook=window.TTVC.audiobook||{};
Object.assign(window.TTVC.audiobook,{
root._abBusyGuard = _abBusyGuard;
root.audiobookRecastUnknown = audiobookRecastUnknown;
root.audiobookAutoRepairEnabled = audiobookAutoRepairEnabled;
root.audiobookAutoRepairCast = audiobookAutoRepairCast;
root.audiobookRecastUntilThreshold = audiobookRecastUntilThreshold;
root.audiobookOpenCastView = audiobookOpenCastView;
root.audiobookCast = audiobookCast;
root.TTVC=root.TTVC||{};
root.TTVC.audiobook=root.TTVC.audiobook||{};
Object.assign(root.TTVC.audiobook,{
startCast:audiobookCast,
openCastView:audiobookOpenCastView,
recastUnknown:audiobookRecastUnknown,
@ -1072,4 +1080,5 @@ Object.assign(window.TTVC.audiobook,{
openCastView:audiobookOpenCastView,
autoRepair:audiobookAutoRepairCast,
},
});
});
})(window);

View File

@ -1,5 +1,6 @@
// Audiobook cast preview, Rehearser handoff, and chapter export UI.
// Loaded after the casting pipeline and before audiobook.js; dependencies resolve at call time.
(function (root) {
// ── Editable attribution preview ─────────────────────────────────────────────
@ -771,9 +772,18 @@ async function audiobookBrowseExports() {
$('reh-tb-browse-exports')?.addEventListener('click', audiobookBrowseExports);
window.TTVC=window.TTVC||{};
window.TTVC.audiobook=window.TTVC.audiobook||{};
Object.assign(window.TTVC.audiobook,{
root.audiobookOpenCurrentInRehearser = audiobookOpenCurrentInRehearser;
root.audiobookShowPreview = audiobookShowPreview;
root.audiobookApplyPreviewAndOpen = audiobookApplyPreviewAndOpen;
root.audiobookBuildScript = audiobookBuildScript;
root.audiobookOpenInRehearser = audiobookOpenInRehearser;
root.audiobookIsChapter = audiobookIsChapter;
root.audiobookLineVoice = audiobookLineVoice;
root.audiobookExport = audiobookExport;
root.audiobookBrowseExports = audiobookBrowseExports;
root.TTVC=root.TTVC||{};
root.TTVC.audiobook=root.TTVC.audiobook||{};
Object.assign(root.TTVC.audiobook,{
preview:{
show:audiobookShowPreview,
apply:audiobookApplyPreviewAndOpen,
@ -783,5 +793,5 @@ Object.assign(window.TTVC.audiobook,{
export:audiobookExport,
browse:audiobookBrowseExports,
},
});
});
})(window);