feat(ux): Settings-Control-Center in Theme-Runtime laden

This commit is contained in:
Masterluke77
2026-07-12 21:41:25 +02:00
parent 773bdf5606
commit 0b597b75c8
+19 -84
View File
@@ -92,114 +92,48 @@ function loadUxFoundation() {
else window.addEventListener('load', loadBehavior, { once: true });
}
function loadFluxStudioAssets() {
if (!document.querySelector('link[data-ux-flux-studio]')) {
function loadAssetPair({ key, css, js }) {
if (!document.querySelector(`link[data-ux-${key}]`)) {
const stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.href = '/flux-studio-ux.css?v=1.44.0';
stylesheet.setAttribute('data-ux-flux-studio', 'style');
stylesheet.href = css;
stylesheet.setAttribute(`data-ux-${key}`, 'style');
document.head.append(stylesheet);
}
const loadBehavior = () => {
if (document.querySelector('script[data-ux-flux-studio]')) return;
if (document.querySelector(`script[data-ux-${key}]`)) return;
const script = document.createElement('script');
script.src = '/flux-studio-ux.js?v=1.44.0';
script.setAttribute('data-ux-flux-studio', 'script');
script.src = js;
script.setAttribute(`data-ux-${key}`, 'script');
script.async = false;
document.body.append(script);
};
if (document.readyState === 'complete') loadBehavior();
else window.addEventListener('load', loadBehavior, { once: true });
}
function loadFluxStudioAssets() {
loadAssetPair({ key: 'flux-studio', css: '/flux-studio-ux.css?v=1.44.0', js: '/flux-studio-ux.js?v=1.44.0' });
}
function loadQualityCenterAssets() {
if (!document.querySelector('link[data-ux-quality-center]')) {
const stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.href = '/quality-center-ux.css?v=1.44.0';
stylesheet.setAttribute('data-ux-quality-center', 'style');
document.head.append(stylesheet);
}
const loadBehavior = () => {
if (document.querySelector('script[data-ux-quality-center]')) return;
const script = document.createElement('script');
script.src = '/quality-center-ux.js?v=1.44.0';
script.setAttribute('data-ux-quality-center', 'script');
script.async = false;
document.body.append(script);
};
if (document.readyState === 'complete') loadBehavior();
else window.addEventListener('load', loadBehavior, { once: true });
loadAssetPair({ key: 'quality-center', css: '/quality-center-ux.css?v=1.44.0', js: '/quality-center-ux.js?v=1.44.0' });
}
function loadInventoryWorkspaceAssets() {
if (!document.querySelector('link[data-ux-inventory-workspace]')) {
const stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.href = '/inventory-workspace.css?v=1.44.0';
stylesheet.setAttribute('data-ux-inventory-workspace', 'style');
document.head.append(stylesheet);
}
const loadBehavior = () => {
if (document.querySelector('script[data-ux-inventory-workspace]')) return;
const script = document.createElement('script');
script.src = '/inventory-workspace.js?v=1.44.0';
script.setAttribute('data-ux-inventory-workspace', 'script');
script.async = false;
document.body.append(script);
};
if (document.readyState === 'complete') loadBehavior();
else window.addEventListener('load', loadBehavior, { once: true });
loadAssetPair({ key: 'inventory-workspace', css: '/inventory-workspace.css?v=1.44.0', js: '/inventory-workspace.js?v=1.44.0' });
}
function loadTemplateWorkspaceAssets() {
if (!document.querySelector('link[data-ux-template-workspace]')) {
const stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.href = '/template-workspace.css?v=1.44.0';
stylesheet.setAttribute('data-ux-template-workspace', 'style');
document.head.append(stylesheet);
}
const loadBehavior = () => {
if (document.querySelector('script[data-ux-template-workspace]')) return;
const script = document.createElement('script');
script.src = '/template-workspace.js?v=1.44.0';
script.setAttribute('data-ux-template-workspace', 'script');
script.async = false;
document.body.append(script);
};
if (document.readyState === 'complete') loadBehavior();
else window.addEventListener('load', loadBehavior, { once: true });
loadAssetPair({ key: 'template-workspace', css: '/template-workspace.css?v=1.44.0', js: '/template-workspace.js?v=1.44.0' });
}
function loadTodayWorkspaceAssets() {
if (!document.querySelector('link[data-ux-today-workspace]')) {
const stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.href = '/today-workspace.css?v=1.44.0';
stylesheet.setAttribute('data-ux-today-workspace', 'style');
document.head.append(stylesheet);
}
loadAssetPair({ key: 'today-workspace', css: '/today-workspace.css?v=1.44.0', js: '/today-workspace.js?v=1.44.0' });
}
const loadBehavior = () => {
if (document.querySelector('script[data-ux-today-workspace]')) return;
const script = document.createElement('script');
script.src = '/today-workspace.js?v=1.44.0';
script.setAttribute('data-ux-today-workspace', 'script');
script.async = false;
document.body.append(script);
};
if (document.readyState === 'complete') loadBehavior();
else window.addEventListener('load', loadBehavior, { once: true });
function loadSettingsControlCenterAssets() {
loadAssetPair({ key: 'settings-control-center', css: '/settings-control-center.css?v=1.44.0', js: '/settings-control-center.js?v=1.44.0' });
}
applyState(readStoredState(), { persist: false, dispatch: false });
@@ -209,6 +143,7 @@ loadQualityCenterAssets();
loadInventoryWorkspaceAssets();
loadTemplateWorkspaceAssets();
loadTodayWorkspaceAssets();
loadSettingsControlCenterAssets();
window.matchMedia?.('(prefers-color-scheme: dark)').addEventListener?.('change', () => {
if (document.documentElement.dataset.themePreference === 'system') restoreStored();
});