Repo Interface für tests

This commit is contained in:
2026-03-05 08:26:51 +01:00
parent 8f4dd5840d
commit 4b31fc7664
171 changed files with 3518 additions and 2297 deletions

View File

@@ -0,0 +1,37 @@
import { warnOnce } from './app-dom.js';
export function readPageConfig(configId, root = document) {
const id = `page-config-${String(configId || '').trim()}`;
if (!id || id === 'page-config-') {
warnOnce('UI_CONFIG_INVALID', 'Invalid page config id', { module: 'page-config', configId });
return null;
}
const node = root.getElementById(id);
if (!node) {
warnOnce('UI_CONFIG_MISSING', `Missing page config element: #${id}`, { module: 'page-config', configId });
return null;
}
const raw = String(node.textContent || '').trim();
if (raw === '') {
warnOnce('UI_CONFIG_EMPTY', `Empty page config payload: #${id}`, { module: 'page-config', configId });
return null;
}
try {
const parsed = JSON.parse(raw);
if (!parsed || typeof parsed !== 'object') {
warnOnce('UI_CONFIG_INVALID', `Page config is not an object: #${id}`, { module: 'page-config', configId });
return null;
}
return parsed;
} catch (error) {
warnOnce('UI_CONFIG_PARSE_FAIL', `Failed to parse page config: #${id}`, {
module: 'page-config',
configId,
error,
});
return null;
}
}