openvibers/openvibe.media Commits
Pages define the default theme's tokens (ADR-024, WS-E task 1): the network-down browser run found --accent undefined on Media with openvibe.network unreachable (Media's styles fell back, shared components did not); baseCss now carries openvibe-shared's DEFAULT_VARS on :root, which the theme loader's per-person values override
Changes
@@@ -105,8 +105,19 @@ function headTags(seo) {}/** Page palette on the shared theme tokens (fallback: the default Vibe theme). */++// The default theme's tokens (openvibe-shared DEFAULT_VARS), so a page paints with them when openvibe.network,++// where the theme loader lives, cannot be reached (ADR-024). The loader's per-person values, set on <html>,++// override them.++const DEFAULT_THEME_CSS = (() => {++ try {++ const vars = require('openvibe-shared/builtin-themes').DEFAULT_VARS || {};++ return Object.entries(vars).filter(([k, v]) => /^--[a-z0-9-]+$/.test(k) && /^[#a-z0-9%.,()\s/+-]+$/i.test(String(v))).map(([k, v]) => `${k}:${v}`).join(';');++ } catch { return ''; }++})();++function baseCss() {return `++ ${DEFAULT_THEME_CSS ? `:root { ${DEFAULT_THEME_CSS} }` : ''}:root { --bg: var(--bg-primary, #0a0f1c); --panel: var(--bg-card, #131c2e); --line: var(--border, #1f2d47);--text: var(--text-primary, #e6edf7); --muted: var(--text-secondary, #96a7c2);--link: var(--accent-light, #60a5fa); --acc: var(--accent, #3b82f6); --on-acc: var(--on-accent, #fff); }nnew file mode 100644@@@ -0,0 +1,15 @@++'use strict';++// ADR-024 (WS-E task 1): Media's pages define the default theme's tokens themselves, so they paint with the++// default theme when openvibe.network (the theme loader) is unreachable. The browser check's --network-down++// run found --accent undefined here on 2026-09-26 (the styles used fallbacks, shared components did not).++const assert = require('assert');++const { baseCss } = require('../server/public/page-frame');++const { DEFAULT_VARS } = require('openvibe-shared/builtin-themes');++++const css = baseCss();++for (const k of ['--accent', '--bg-primary', '--text-primary']) {++ assert.ok(DEFAULT_VARS[k], `openvibe-shared has a default ${k}`);++ assert.ok(css.includes(`${k}:${DEFAULT_VARS[k]}`), `the page defines ${k} as the default theme does`);++}++assert.ok(!/url\(|;\s*}/.test(css.split('\n').find((l) => l.includes('--accent:')) || ''), 'only plain token values');++console.log('theme default: all checks passed');
@@ -105,8 +105,19 @@ function headTags(seo) {
@@ -105,8 +105,19 @@ function headTags(seo) {
}
}
/** Page palette on the shared theme tokens (fallback: the default Vibe theme). */
/** Page palette on the shared theme tokens (fallback: the default Vibe theme). */
+// The default theme's tokens (openvibe-shared DEFAULT_VARS), so a page paints with them when openvibe.network,
+// where the theme loader lives, cannot be reached (ADR-024). The loader's per-person values, set on <html>,
+// override them.
+const DEFAULT_THEME_CSS = (() => {
+ try {
+ const vars = require('openvibe-shared/builtin-themes').DEFAULT_VARS || {};
+ return Object.entries(vars).filter(([k, v]) => /^--[a-z0-9-]+$/.test(k) && /^[#a-z0-9%.,()\s/+-]+$/i.test(String(v))).map(([k, v]) => `${k}:${v}`).join(';');
+ } catch { return ''; }
+})();
+
function baseCss() {
function baseCss() {
return `
return `
+ ${DEFAULT_THEME_CSS ? `:root { ${DEFAULT_THEME_CSS} }` : ''}
:root { --bg: var(--bg-primary, #0a0f1c); --panel: var(--bg-card, #131c2e); --line: var(--border, #1f2d47);
:root { --bg: var(--bg-primary, #0a0f1c); --panel: var(--bg-card, #131c2e); --line: var(--border, #1f2d47);
--text: var(--text-primary, #e6edf7); --muted: var(--text-secondary, #96a7c2);
--text: var(--text-primary, #e6edf7); --muted: var(--text-secondary, #96a7c2);
--link: var(--accent-light, #60a5fa); --acc: var(--accent, #3b82f6); --on-acc: var(--on-accent, #fff); }
--link: var(--accent-light, #60a5fa); --acc: var(--accent, #3b82f6); --on-acc: var(--on-accent, #fff); }
new file mode 100644
new file mode 100644
@@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
+'use strict';
+// ADR-024 (WS-E task 1): Media's pages define the default theme's tokens themselves, so they paint with the
+// default theme when openvibe.network (the theme loader) is unreachable. The browser check's --network-down
+// run found --accent undefined here on 2026-09-26 (the styles used fallbacks, shared components did not).
+const assert = require('assert');
+const { baseCss } = require('../server/public/page-frame');
+const { DEFAULT_VARS } = require('openvibe-shared/builtin-themes');
+
+const css = baseCss();
+for (const k of ['--accent', '--bg-primary', '--text-primary']) {
+ assert.ok(DEFAULT_VARS[k], `openvibe-shared has a default ${k}`);
+ assert.ok(css.includes(`${k}:${DEFAULT_VARS[k]}`), `the page defines ${k} as the default theme does`);
+}
+assert.ok(!/url\(|;\s*}/.test(css.split('\n').find((l) => l.includes('--accent:')) || ''), 'only plain token values');
+console.log('theme default: all checks passed');