refactor: scope settings module

This commit is contained in:
mARTin-B78 2026-09-04 12:51:29 +02:00
parent 8002ca1d75
commit 656d0473d4
5 changed files with 39 additions and 9 deletions

View File

@ -8,6 +8,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
## [Unreleased] ## [Unreleased]
### Changed ### Changed
- **Settings namespace migration.** Settings state, backend catalogs, help rendering, and provider configuration now use
a private scope with live compatibility accessors and a `window.TTVC.settings` API.
- **Character library namespace migration.** SQLite-backed character persistence, identity merging, image updates, and - **Character library namespace migration.** SQLite-backed character persistence, identity merging, image updates, and
rendering now use a private scope with explicit compatibility exports and a `window.TTVC.characters` API. rendering now use a private scope with explicit compatibility exports and a `window.TTVC.characters` API.
- **Studio namespace migration.** Four-phase navigation, DOM borrowing, resume state, and cast-footer coordination now - **Studio namespace migration.** Four-phase navigation, DOM borrowing, resume state, and cast-footer coordination now

View File

@ -1 +1 @@
1.24.73 1.24.74

View File

@ -63,6 +63,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed)
- ✅ Rehearser cast rendering uses a private scope with explicit view/filter/sort compatibility exports. - ✅ Rehearser cast rendering uses a private scope with explicit view/filter/sort compatibility exports.
- ✅ Studio navigation and DOM-borrowing coordination use a private scope with explicit compatibility exports. - ✅ Studio navigation and DOM-borrowing coordination use a private scope with explicit compatibility exports.
- ✅ Character library persistence and rendering use a private scope with explicit identity/image compatibility exports. - ✅ Character library persistence and rendering use a private scope with explicit identity/image compatibility exports.
- ✅ Settings state and backend configuration use a private scope with live compatibility accessors and a namespace API.
- ✅ `static/css/resource-diagnostics.css` — isolated Performance/resource diagnostic panel styles. - ✅ `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/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. - ✅ `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="format-detection" content="telephone=no">
<meta name="color-scheme" content="light dark"> <meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#2563EB"> <meta name="theme-color" content="#2563EB">
<meta name="app-version" content="1.24.73"> <meta name="app-version" content="1.24.74">
<link rel="manifest" href="/manifest.webmanifest"> <link rel="manifest" href="/manifest.webmanifest">
<link rel="icon" href="/static/icon.svg" type="image/svg+xml"> <link rel="icon" href="/static/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/icon.svg"> <link rel="apple-touch-icon" href="/static/icon.svg">
@ -27,12 +27,12 @@
<!-- ── Core styles (local — no CDN dependency for first paint) ────────── --> <!-- ── Core styles (local — no CDN dependency for first paint) ────────── -->
<link rel="stylesheet" href="/static/vendor/mdi/materialdesignicons.min.css"> <link rel="stylesheet" href="/static/vendor/mdi/materialdesignicons.min.css">
<link rel="stylesheet" href="/static/style.css?v=1.24.73"> <link rel="stylesheet" href="/static/style.css?v=1.24.74">
<link rel="stylesheet" href="/static/css/resource-diagnostics.css?v=1.24.73"> <link rel="stylesheet" href="/static/css/resource-diagnostics.css?v=1.24.74">
<link rel="stylesheet" href="/static/css/background-jobs.css?v=1.24.73"> <link rel="stylesheet" href="/static/css/background-jobs.css?v=1.24.74">
<link rel="stylesheet" href="/static/css/voice-design.css?v=1.24.73"> <link rel="stylesheet" href="/static/css/voice-design.css?v=1.24.74">
<link rel="stylesheet" href="/static/css/rehearser.css?v=1.24.73"> <link rel="stylesheet" href="/static/css/rehearser.css?v=1.24.74">
<link rel="stylesheet" href="/static/css/audiobook.css?v=1.24.73"> <link rel="stylesheet" href="/static/css/audiobook.css?v=1.24.74">
<!-- ── Flag icons — non-blocking (loaded async, icons appear after JS) ── --> <!-- ── Flag icons — non-blocking (loaded async, icons appear after JS) ── -->
@ -397,7 +397,7 @@ window.toggleNavTree = function(treeId, chevronId) {
</script> </script>
<!-- loader.js: fetches sections → loads JS modules → removes skeleton --> <!-- loader.js: fetches sections → loads JS modules → removes skeleton -->
<script src="/static/loader.js?v=1.24.73"></script> <script src="/static/loader.js?v=1.24.74"></script>
</body> </body>
</html> </html>

View File

@ -1,5 +1,7 @@
// ── Settings ────────────────────────────────────────────────────────────── // ── Settings ──────────────────────────────────────────────────────────────
(function (root) {
const SETTINGS_SEEN_KEY = 'vcf-settings-seen'; const SETTINGS_SEEN_KEY = 'vcf-settings-seen';
let _appSettings = {}; let _appSettings = {};
let _ttsBackends = []; let _ttsBackends = [];
@ -1059,3 +1061,28 @@ $('helper-apply-btn')?.addEventListener('click', () => {
modal.hidden = true; modal.hidden = true;
}); });
})(); })();
Object.assign(root, {
SETTINGS_SEEN_KEY, IMAGE_GEN_MODELS, IMAGE_GEN_MODEL_CUSTOM,
availableTtsBackends, ttsBackendOptions, styleBackendOptions, backendById,
backendComputeDevice, backendComputeDeviceClass, backendHelpHtml, sttBackendHelpHtml,
updateBackendHelp, updateStyleBackendHelp, updateBackendDependentTabs,
refreshTtsBackendAvailability, _patchSettings, _saveEngineLocalUrls,
_saveEngineContainerNames, ENGINE_API_KEY_SETTING_MAP, engineApiKeyValue,
saveEngineApiKey, restoreEngineApiKeyInputs, SETTINGS_PAGE_GUIDES, SETTINGS_FIELD_HELP,
enhanceSettingsHelp, loadSettings, markSettingsSeen, openSettings, closeSettings,
validateVoiceId,
});
Object.defineProperty(root, '_appSettings', { configurable: true, get: () => _appSettings, set: v => { _appSettings = v; } });
Object.defineProperty(root, '_ttsBackends', { configurable: true, get: () => _ttsBackends, set: v => { _ttsBackends = v; } });
root.TTVC = root.TTVC || {};
root.TTVC.settings = root.TTVC.settings || {};
Object.assign(root.TTVC.settings, {
get appSettings() { return _appSettings; },
get ttsBackends() { return _ttsBackends; },
load: loadSettings,
open: openSettings,
close: closeSettings,
availableTtsBackends,
});
})(window);