refactor: scope character library

This commit is contained in:
mARTin-B78 2026-09-04 12:49:22 +02:00
parent 0e615d52de
commit 8002ca1d75
6 changed files with 37 additions and 12 deletions

View File

@ -8,6 +8,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
## [Unreleased]
### Changed
- **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.
- **Studio namespace migration.** Four-phase navigation, DOM borrowing, resume state, and cast-footer coordination now
use a private scope with explicit compatibility exports and a tested `window.TTVC.studio` surface.
- **Rehearser cast namespace migration.** Cast view rendering, filtering, sorting, and delegated controls now use a

View File

@ -124,9 +124,9 @@ architecture change: the larger Audiobook/Rehearser/style split.
voice design, I/O, library, stage, and recording blocks plus Audiobook casting, preview, export, and feature styles
are isolated. Core Reader state and compatibility event wiring remain ordered in the legacy entry points.
- [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 state/core modules,
Reader, and Rehearser state modules now use private scopes with explicit compatibility exports. Remaining utility and
library modules still require the same responsibility-by-responsibility migration.
- [ ] 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.
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.
- [x] Add a dependency-free frontend syntax and top-level declaration collision gate (`npm run check:frontend`);

View File

@ -1 +1 @@
1.24.72
1.24.73

View File

@ -62,6 +62,7 @@ Done incrementally as global-scope ordered files (no ES-module change needed)
- ✅ Rehearser voice-design uses a private scope with explicit development and backend-refresh 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.
- ✅ Character library persistence and rendering use a private scope with explicit identity/image 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.

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.72">
<meta name="app-version" content="1.24.73">
<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.72">
<link rel="stylesheet" href="/static/css/resource-diagnostics.css?v=1.24.72">
<link rel="stylesheet" href="/static/css/background-jobs.css?v=1.24.72">
<link rel="stylesheet" href="/static/css/voice-design.css?v=1.24.72">
<link rel="stylesheet" href="/static/css/rehearser.css?v=1.24.72">
<link rel="stylesheet" href="/static/css/audiobook.css?v=1.24.72">
<link rel="stylesheet" href="/static/style.css?v=1.24.73">
<link rel="stylesheet" href="/static/css/resource-diagnostics.css?v=1.24.73">
<link rel="stylesheet" href="/static/css/background-jobs.css?v=1.24.73">
<link rel="stylesheet" href="/static/css/voice-design.css?v=1.24.73">
<link rel="stylesheet" href="/static/css/rehearser.css?v=1.24.73">
<link rel="stylesheet" href="/static/css/audiobook.css?v=1.24.73">
<!-- ── 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.72"></script>
<script src="/static/loader.js?v=1.24.73"></script>
</body>
</html>

View File

@ -4,6 +4,8 @@
// All function signatures are unchanged from the IndexedDB version so callers
// (audiobook.js, character-sheets.js, etc.) need no edits.
(function (root) {
// Fields a user can edit, mirroring CS_SCALAR_FIELDS plus the labelled basics.
const CL_EDIT_FIELDS = [
['name', 'Name'], ['aliases', 'Aliases / also known as'], ['first_name', 'First name'], ['last_name', 'Last name'], ['title', 'Title / role'],
@ -535,3 +537,23 @@ window.clUpsert = clUpsert;
window.clGetAll = clGetAll;
window.clPut = clPut;
window.clGetAllByTagOrBook = clGetAllByTagOrBook;
Object.assign(root, {
CL_EDIT_FIELDS, clGetAll, clGet, clPut, clDelete, clKey, clHslToHex, clNameHue,
clNormalizeColor, CL_IDENTITY_FIELDS, CL_ALIAS_MAX_TOKENS, CL_ALIAS_MAX_CHARS,
CL_ALIAS_STOPWORDS, clSplitIdentityTokens, clIdentityNames, clMergeAliases,
clSameIdentity, _clStr, _clSanitize, clMergeSheet, clMergeTags, clUpsert,
clSetImage, clGetAllByTagOrBook, clUpsertMany, _clIdbGetAll, _clRecords,
clRender, clAllProductions, clApplyFilter, clCardHtml, clEdit, clDeleteRec,
});
root.TTVC = root.TTVC || {};
root.TTVC.characters = root.TTVC.characters || {};
Object.assign(root.TTVC.characters, {
list: clGetAll,
get: clGet,
upsert: clUpsert,
upsertMany: clUpsertMany,
setImage: clSetImage,
render: clRender,
});
})(window);