From b747553bf6045c1afc3b00fa7c15c365138c3ffc Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Fri, 4 Sep 2026 13:00:10 +0200 Subject: [PATCH] refactor: scope routing module --- CHANGELOG.md | 2 ++ VERSION | 2 +- docs/ARCHITECTURE.md | 1 + static/index.html | 16 ++++++++-------- static/js/routing.js | 27 +++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5198b..05b10c9 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 +- **Routing namespace migration.** Route configuration, sound selection, speed previews, routing tests, and routing-log + rendering now use a private scope with live compatibility accessors and a `window.TTVC.routing` API. - **Voice-source namespace migration.** Source URL management, filtering, source metadata normalization, and library import helpers now use a private scope with explicit compatibility exports and a `window.TTVC.voiceSources` API. - **Voice-clone namespace migration.** Clone audio loading/upload, microphone monitoring, design presets, and voice-design diff --git a/VERSION b/VERSION index 082a2e6..3b3fac8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.77 +1.24.78 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 48626e9..1adf4a7 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -67,6 +67,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed) - ✅ TTS preview and performance-history helpers use a private scope with explicit preview/history compatibility exports. - ✅ Voice-clone audio, recording, and design controls use a private scope with explicit compatibility exports. - ✅ Voice-source discovery and import helpers use a private scope with explicit source-list/import compatibility exports. +- ✅ TTS routing configuration and routing-log UI use a private scope with live route/sound 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 5da5b53..78527b0 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/routing.js b/static/js/routing.js index 8d63655..b7b9b72 100644 --- a/static/js/routing.js +++ b/static/js/routing.js @@ -1,5 +1,7 @@ // ── TTS routing ────────────────────────────────────────────────────────── +(function (root) { + let _ttsRoutes = []; // Any / Auto first (they are the routing-specific values), then every language // from the shared list in utils.js — the old hardcoded eight could not express @@ -643,3 +645,28 @@ $('routing-sound-list')?.addEventListener('click', e => { } }); +Object.assign(root, { + ROUTE_LANGS, _routingSetStatus, routeSelectOptions, enhanceRouteLangSelects, + ROUTE_BACKENDS, _routeSounds, routeSoundOptions, loadRouteSounds, + _routeSoundPickerTarget, _routeSoundPlayingButton, routeSoundUrl, + setRouteSoundField, renderRouteSoundBrowser, openRouteSoundBrowser, + closeRouteSoundBrowser, playRouteSound, ROUTE_SPEED_PREVIEW_TEXT, + previewRouteSpeed, _routeSpeedPreviewButton, useRouteSound, routeBackendOptions, + refreshRoutingVoiceOptions, newRoute, renderRoutingList, readRoutingForm, + loadRoutingTab, saveRoutingTab, renderRouteTestResult, routingLogTime, + routingLogBadge, routingLogMeta, _routingLogItems, _routingLogFilter, + routingLogPassesFilter, renderCurrentRoutingLog, renderRoutingLog, loadRoutingLog, + clearRoutingLog, testRouting, uploadRouteSoundForRow, +}); +Object.defineProperty(root, '_ttsRoutes', { configurable: true, get: () => _ttsRoutes, set: v => { _ttsRoutes = v; } }); +root.TTVC = root.TTVC || {}; +root.TTVC.routing = root.TTVC.routing || {}; +Object.assign(root.TTVC.routing, { + get routes() { return _ttsRoutes; }, + get sounds() { return _routeSounds; }, + load: loadRoutingTab, + save: saveRoutingTab, + test: testRouting, + render: renderRoutingList, +}); +})(window);