openvibers/openvibe.design Commits
Short home on phones: one thing at a time, picked with chips (#34)
Changes
@@@ -491,3 +491,62 @@ html.ar-fit .ar-shot--desktop .ar-shot-frame, html.ar-fit .ar-shot--desktop::bef.ov-room article a::after, .ds-act a::after { content: ''; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; }.ds-more::after { content: ''; position: absolute; left: 0; right: 0; top: -14px; bottom: -14px; }}++++/* Pick (the owner's short-pages rule, 2026-10-30): on a phone the front page shows one block at a time, picked with a++ row of chips. Radio inputs and :has(), no script: the chips and the one-block rule live under 640 px and only++ where :has() is understood, so a wider screen, or an older browser, shows every block and no chips. */++.pick-head { display: none; }++.pick-row { display: none; }++@supports selector(:has(*)) { @media (max-width: 640px) {++ .pick-bar { margin-top: 0; }++ .pick-head { display: block; }++ .pick-head h2 { margin: 0 0 4px; font: 700 clamp(20px,2.4vw,28px)/1.2 var(--ov-font,'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif); letter-spacing: -.02em; }++ .pick-row { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 0; padding: 2px 16px 4px; scrollbar-width: none; overscroll-behavior-x: contain; }++ .pick-row::-webkit-scrollbar { display: none; }++ .pick-row input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }++ .pick-row label { display: inline-flex; align-items: center; flex: none; min-height: 44px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--border, #1f2d47); color: var(--text-secondary, #96a7c2); font-size: .9rem; font-weight: 650; white-space: nowrap; cursor: pointer; }++ .pick-row input:checked + label { color: var(--text-primary, #e6edf7); border-color: var(--accent, #3b82f6); background: color-mix(in srgb, var(--accent, #3b82f6) 12%, transparent); }++ .pick-row input:focus-visible + label { outline: 2px solid var(--accent, #3b82f6); outline-offset: 2px; }++ .pick .pick-pane { display: none; }++ .pick .pick-list > li { display: none; }++ /* The chip names the block, so the block's own heading gives way to it; the content stays in the page for the++ crawlers and for the reader on a wide screen. */++ .pick .sc-sec > h2, .pick section > h2, .pick > h2 { display: none; }++} }++++/* The fold (the owner's short-pages rule): closed on a phone, and where there is room it looks like the section it++ replaces: a heading and its content, with no card around it. */++.ds-fold-block { margin-top: 32px; }++.ds-fold-block > summary h2 { margin: 0; font: 700 clamp(19px,2.2vw,26px)/1.2 var(--ov-font,'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif); }++.ds-fold-hint { display: none; }++/* The fold's summary carries the heading, so the section's own heading gives way to it. */++.ds-fold-block .sc-sec > h2, .ds-fold-block > .sc-sec > h2 { display: none; }++@media (min-width: 641px) {++ .ds-fold-block { border: 0; background: none; border-radius: 0; margin-top: 56px; padding: 0; }++ .ds-fold-block > summary { display: block; min-height: 0; padding: 0; }++ .ds-fold-block > summary h2 { margin: 0 0 6px; font: 700 clamp(22px,2.6vw,30px)/1.2 var(--ov-font,'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif); }++ .ds-fold-block > summary span { display: none; }++ .ds-fold-block .sc-sec { margin: 0; padding: 0; }++}++@media (max-width: 640px) {++ .ds-fold-block { margin-top: 24px; }++ .ds-fold-block > summary { cursor: pointer; }++ .ds-fold-hint { display: inline; margin-left: 8px; font-size: .78rem; font-weight: 600; color: var(--text-secondary, #96a7c2); }++}++++++/* A link that points into a pick block opens it: the pane carries the id the link names. */++@supports selector(:has(*)) { @media (max-width: 640px) {++ .pick .pick-pane:target { display: block; }++} }++++/* On a wide screen the pick block is invisible: its blocks sit where they were, in the order they were. */++@media (min-width: 641px) {++ .pick, .pick-body, .pick-pane { display: contents; }++ .pick-bar { display: none; }++}++++/* The chip names the scene, so the scene's own heading gives way to it. */++@supports selector(:has(*)) { @media (max-width: 640px) {++ .pick .sc-scene-text > h2 { display: none; }++} }@@@ -41,7 +41,7 @@ const baseUrl = () => BASE;const canonical = (p) => `${BASE}${p || '/'}`;/** The page around a body: the shared shell with the room's stylesheets and behaviour. */--function layout({ title, description, canonical, path, robots = 'index, follow', body, active = '/', scripts = [], styles = [], jsonLd = [] } = {}) {++function layout({ title, description, canonical, path, robots = 'index, follow', body, active = '/', scripts = [], styles = [], jsonLd = [], inlineStyles = [] } = {}) {const pathNow = path || active || '/';canonical = canonical || (path ? `${BASE}${path}` : undefined);const navbar = {@@@ -76,6 +76,7 @@ function layout({ title, description, canonical, path, robots = 'index, follow',<link rel="stylesheet" href="${esc(ovServe.url('showcase.css'))}"><link rel="stylesheet" href="${esc(asset('css/design.css'))}">${(styles || []).map((rel) => `<link rel="stylesheet" href="${esc(asset(rel))}">`).join('\n')}++${(inlineStyles || []).map((css) => `<style>${css}</style>`).join('\n')}<script src="${esc(ovServe.url('kit-web.js'))}" defer></script><script src="${esc(ovServe.url('motion.js'))}" defer></script>${(scripts || []).map((rel) => `<script src="${esc(asset(rel))}" defer></script>`).join('\n')}nnew file mode 100644@@@ -0,0 +1,109 @@++'use strict';++/**++ * The home on a phone (the owner's short-pages rule, 2026-10-30): one or two screens, app-like.++ *++ * pickBlock() several blocks of the same kind, one at a time on a phone, picked with a row of chips. Radio++ * inputs and :has(), no script: every block stays in the page for crawlers, and a wider screen (or a++ * browser without :has()) shows them all and no chips.++ * pickList() a list of things of the same kind, one at a time on a phone, picked with a row of chips.++ * foldBlock() a part a reader rarely needs, closed on a phone and open where there is room. The page's own markup++ * keeps it open, so a browser without the script shows it as before; the script closes it on a narrow++ * screen and remembers the reader's choice.++ *++ * The CSS for both lives in this site's own stylesheet; the rule that shows the picked block is written for the++ * page, because there is one per block.++ */++const esc = (s) => String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');++++/**++ * A pick block. The panes are the page's own blocks; each one keeps its heading on a wide screen, and on a phone the++ * heading gives way to the chip that names it.++ *++ * pickBlock({ key, label, head, panes }) panes: [{ id, label, html }]++ */++function pickBlock({ key, label, head = '', panes }) {++ // A pane with nothing to show is left out, so the chips and the rules that show them match the page.++ panes = (panes || []).filter((p) => p.html);++ if (!panes.length) return '';++ const chips = panes.map((p, i) => '<input type="radio" name="pick-' + esc(key) + '" id="pk-' + esc(key) + '-' + esc(p.id) + '" value="' + esc(p.id) + '"' + (i === 0 ? ' checked' : '') + '><label for="pk-' + esc(key) + '-' + esc(p.id) + '">' + esc(p.label) + '</label>').join('');++ const body = panes.map((p) => '<div class="pick-pane" id="' + esc(p.id) + '">' + p.html + '</div>').join('');++ return '<div class="pick" id="pick-' + esc(key) + '"><div class="pick-bar"><div class="pick-head"><h2>' + esc(head || label) + '</h2></div><div class="pick-row" role="radiogroup" aria-label="' + esc(label) + '">' + chips + '</div></div><div class="pick-body">' + body + '</div></div>';++}++++/** The rule that shows the picked block of a pick block: one per block, so the CSS is written for the page. */++function pickRule(key, id) {++ return '.pick:has(#pk-' + key + '-' + id + ':checked) #' + id + '{display:block}';++}++++/** The rules for every block of a pick block, in the order they appear. */++function pickRules(key, ids) {++ return ids.map((id) => pickRule(key, id)).join('');++}++++/**++ * A pick list: a list of things of the same kind, one at a time on a phone, picked with a row of chips. The list++ * keeps its own markup and every item stays in the page; the caller marks each item with the index its chip picks.++ *++ * pickList({ key, label, head, labels, html }) labels: the chip labels, in the order of the items++ */++function pickList({ key, label, head = '', labels, html }) {++ labels = labels || [];++ if (!labels.length) return '';++ const chips = labels.map((l, i) => '<input type="radio" name="pick-' + esc(key) + '" id="pk-' + esc(key) + '-' + i + '" value="' + i + '"' + (i === 0 ? ' checked' : '') + '><label for="pk-' + esc(key) + '-' + i + '">' + esc(l) + '</label>').join('');++ return '<div class="pick" id="pick-' + esc(key) + '"><div class="pick-bar"><div class="pick-head"><h2>' + esc(head || label) + '</h2></div><div class="pick-row" role="radiogroup" aria-label="' + esc(label) + '">' + chips + '</div></div>' + html + '</div>';++}++++/** The rule that shows the picked item of a pick list: one per item, so the CSS is written for the page. */++function pickListRule(key, i) {++ return '.pick#pick-' + key + ':has(#pk-' + key + '-' + i + ':checked) .pick-list>li[data-i="' + i + '"]{display:block}';++}++++/** The rules for every item of a pick list. */++function pickListRules(key, n) {++ return Array.from({ length: n }, (_, i) => pickListRule(key, i)).join('');++}++++/**++ * A fold. The head is the heading the block had; the html is what it holds.++ *++ * foldBlock({ id, head, html })++ */++function foldBlock({ id, head, html }) {++ return '<details class="ds-fold ds-fold-block" id="' + esc(id) + '" open><summary>' + head + '<span class="ds-fold-hint">tap to open</span></summary>' + html + '</details>' + foldScript(id);++}++++/** The script a fold carries: closed on a phone unless the reader opened it before, and it remembers that. */++function foldScript(id) {++ return "<script>(function(){var d=document.getElementById(" + JSON.stringify(id) + ");if(!d)return;var k='ov_fold_'+" + JSON.stringify(id) + ";var s=null;try{s=localStorage.getItem(k)}catch(e){}if(s==='open'){d.open=true;return}if(s==='closed'){d.open=false;return}var t=0;if(window.matchMedia&&window.matchMedia('(max-width:640px)').matches){t=Date.now();d.open=false}d.addEventListener('toggle',function(){if(Date.now()-t<300)return;try{localStorage.setItem(k,d.open?'open':'closed')}catch(e){}})})();</script>";++}++++++/**++ * A part of a page's own markup, found by the heading it carries: the site can then show it in a pick block or a++ * fold. { start, end, html } — the section that holds the needle.++ */++function part(html, needle) {++ const at = html.indexOf(needle);++ if (at < 0) return null;++ const start = html.lastIndexOf('<section', at);++ const close = html.indexOf('</section>', at);++ if (start < 0 || close < 0) return null;++ const end = close + '</section>'.length;++ return { start, end, html: html.slice(start, end) };++}++++/** The same part, but replaced by something else. */++function swap(html, needle, withHtml) {++ const p = part(html, needle);++ if (!p) return html;++ return html.slice(0, p.start) + withHtml + html.slice(p.end);++}++++/** The part that carries this heading, as a fold: closed on a phone, the section it was where there is room. */++function foldAround(html, needle, id, head) {++ const p = part(html, needle);++ if (!p) return html;++ return html.slice(0, p.start) + foldBlock({ id, head, html: p.html }) + html.slice(p.end);++}++++module.exports = { pickBlock, pickRule, pickRules, pickList, pickListRule, pickListRules, foldBlock, foldScript, part, swap, foldAround };@@@ -13,6 +13,8 @@*/const layoutLib = require('../render/layout');const kit = require('openvibe-shared/kit');++// The short home (the owner's rule, 2026-10-30): pick blocks and folds.++const { pickBlock, pickRules, foldAround } = require('../render/short');const sc = require('openvibe-shared/showcase');const rooms = require('openvibe-shared/rooms');const { iframeHtml } = require('../arena/sanitize');@@@ -89,7 +91,7 @@ function home({ themes } = {}) {const make = `<ol class="ds-flow" aria-label="How Create works"><li><b>Describe it</b><span>A page, an app screen or a component, in a sentence.</span></li><li><b>Three models draft it</b><span>At once, on your theme, at phone and desktop sizes.</span></li><li><b>Make it yours</b><span>Pick one, click any part to change it or ask for a change, and keep every version.</span></li></ol>`;const draft = (side) => `<figure class="ds-vs-card"><span class="ds-vs-bar"></span><span class="ds-vs-hero"></span><span class="ds-vs-row"><i></i><i></i><i></i></span><figcaption>${side}</figcaption></figure>`;const vs = `<div class="ds-vs" role="img" aria-label="Two drafts side by side, their models hidden">${draft('Left')}<span class="ds-vs-or">or</span>${draft('Right')}</div><p class="ds-fine ds-vs-note">The models' names stay hidden until you vote.</p>`;-- const body = sc.room({++ const room = sc.room({room: 'design',hero: {title: 'Your look, everywhere',@@@ -132,7 +134,33 @@ function home({ themes } = {}) {['What is coming next?', 'Publishing a design straight to OpenVibe.Website and OpenVibe.Space, brand kits that dress a creator\'s channel, overlays and shop in one go, and the kit\'s components as native Android and iOS views.'],] },});-- return layout({ title: null, description: 'Your look, everywhere: one theme across every OpenVibe site, the same theme as code for the web, Android and iOS, and AI design on it, ranked honestly by the Design Arena.', path: '/', body: `<div class="ds-wrap">${body}</div>`, active: '/' });++ // The short home (the owner's rule, 2026-10-30): the three scenes are one pick block, a row of chips picks one++ // of them, and the parts a reader rarely needs are folds.++ const sceneTitles = ['One theme, every site', 'Make it with AI, on your theme', 'See which AI designs best'];++ const arts = [...room.matchAll(/<article class="sc-scene[\s\S]*?<\/article>/g)];++ let body = room;++ if (arts.length) {++ const first = arts[0];++ const last = arts[arts.length - 1];++ const start = body.lastIndexOf('<section class="sc-room-scenes"', first.index);++ const end = body.indexOf('</section>', last.index + last[0].length) + '</section>'.length;++ const pick = pickBlock({++ key: 'scenes',++ label: 'What you can do',++ head: 'What you can do',++ panes: arts.map((a, i) => ({ id: `ds-scene-${i}`, label: sceneTitles[i] || `Scene ${i + 1}`, html: a[0] })),++ });++ body = start > 0 && end > 0 ? body.slice(0, start) + pick + body.slice(end) : body;++ }++ // The code samples and the questions are the parts a reader rarely needs on a phone.++ body = foldAround(body, '>Your theme, in your app</h2>', 'dev', '<h2 id="ds-dev-h">Your theme, in your app</h2>');++ body = foldAround(body, '>Questions</h2>', 'faq', '<h2 id="ds-faq-h">Questions</h2>');++ return layout({++ title: null, description: 'Your look, everywhere: one theme across every OpenVibe site, the same theme as code for the web, Android and iOS, and AI design on it, ranked honestly by the Design Arena.',++ path: '/', body: `<div class="ds-wrap">${body}</div>`, active: '/',++ // The rule that shows the picked scene of the pick block: one per scene, written for this page.++ inlineStyles: [`@supports selector(:has(*)){@media (max-width:640px){${pickRules('scenes', arts.map((_, i) => `ds-scene-${i}`))}}}`],++ });}/** The studio's "As code" sheet: the edited theme compiled in the page (public/js/studio.js). */nnew file mode 100644@@@ -0,0 +1,57 @@++'use strict';++/**++ * The home on a phone (the owner's short-pages rule, 2026-10-30): the three scenes are one pick block, a row of chips++ * picks one of them, and the parts a reader rarely needs are folds. Radio inputs and :has(), no script for the chips;++ * every scene stays in the page for crawlers; a wider screen shows them all and no chips.++ */++const assert = require('assert');++const { boot, check, done } = require('./helpers/boot');++++(async () => {++ const t = await boot();++ try {++ await check('the scenes are one pick block: a chip per scene, the first picked, every scene in the page', async () => {++ const r = await t.get('/');++ assert.strictEqual(r.status, 200, r.text);++ const page = r.text;++ const start = page.indexOf('<div class="pick" id="pick-scenes">');++ assert.ok(start > 0, 'the pick block is on the home');++ const block = page.slice(start, page.indexOf('<section aria-labelledby="ds-strip-h">'));++ assert.match(block, /<div class="pick-row" role="radiogroup" aria-label="What you can do">/);++ const chips = [...block.matchAll(/<input type="radio" name="pick-scenes" id="pk-scenes-(ds-scene-\d+)" value="(ds-scene-\d+)"( checked)?><label for="pk-scenes-ds-scene-\d+">([^<]+)<\/label>/g)];++ assert.strictEqual(chips.length, 3, `a chip per scene (${chips.length})`);++ assert.deepStrictEqual(chips.filter((m) => m[3]).map((m) => m[1]), [chips[0][1]], 'the first scene is picked');++ // Every scene stays in the page, each in its own pane.++ const scenes = [...block.matchAll(/<article class="sc-scene/g)];++ assert.strictEqual(scenes.length, chips.length, 'every scene is in the page');++ for (const m of chips) assert.ok(block.includes(`id="${m[1]}"`), `the pane of ${m[1]} is in the page`);++ assert.ok(block.includes('One theme, every site') && block.includes('Make it with AI, on your theme') && block.includes('See which AI designs best'), 'every scene is named in the page');++ });++++ await check('the CSS guard: the chips are hidden and the scenes all show until 640 px and where :has() is understood', async () => {++ const r = await t.get('/');++ const page = r.text;++ assert.match(page, /<style>@supports selector\(:has\(\*\)\)\{@media \(max-width:640px\)\{\.pick:has\(#pk-scenes-ds-scene-0:checked\) #ds-scene-0\{display:block\}/, 'the rule that shows the picked scene');++ const css = require('fs').readFileSync(require('path').join(__dirname, '..', 'public', 'css', 'design.css'), 'utf8');++ assert.match(css, /\.pick-row \{ display: none; \}/, 'the chips are hidden by default');++ assert.match(css, /@supports selector\(:has\(\*\)\) \{ @media \(max-width: 640px\) \{/, 'the phone rules are under :has() and 640 px');++ assert.match(css, /\.pick-row label \{[^}]*min-height: 44px/, 'a chip is a 44 px target');++ assert.match(css, /\.pick \.pick-pane \{ display: none; \}/, 'the scenes are hidden on a phone');++ });++++ await check('the parts a reader rarely needs are folds, open in the page and closed on a phone', async () => {++ const r = await t.get('/');++ const page = r.text;++ for (const id of ['dev', 'faq']) {++ assert.ok(page.includes(`<details class="ds-fold ds-fold-block" id="${id}" open>`), `${id} is a fold, open in the page`);++ assert.ok(page.includes(`document.getElementById("${id}")`), `${id} has the script that closes it on a phone`);++ }++ // The content of the folds stays in the page.++ assert.match(page, /<h2 id="ds-dev-h">Your theme, in your app<\/h2>/);++ assert.match(page, /<h2 id="ds-faq-h">Questions<\/h2>/);++ assert.match(page, /MaterialTheme\(/, 'the code samples are still on the page');++ });++ } finally {++ await done(t);++ }++})().catch((e) => { console.error(e); process.exit(1); });
@@ -491,3 +491,62 @@ html.ar-fit .ar-shot--desktop .ar-shot-frame, html.ar-fit .ar-shot--desktop::bef
@@ -491,3 +491,62 @@ html.ar-fit .ar-shot--desktop .ar-shot-frame, html.ar-fit .ar-shot--desktop::bef
.ov-room article a::after, .ds-act a::after { content: ''; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; }
.ov-room article a::after, .ds-act a::after { content: ''; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; }
.ds-more::after { content: ''; position: absolute; left: 0; right: 0; top: -14px; bottom: -14px; }
.ds-more::after { content: ''; position: absolute; left: 0; right: 0; top: -14px; bottom: -14px; }
}
}
+
+/* Pick (the owner's short-pages rule, 2026-10-30): on a phone the front page shows one block at a time, picked with a
+ row of chips. Radio inputs and :has(), no script: the chips and the one-block rule live under 640 px and only
+ where :has() is understood, so a wider screen, or an older browser, shows every block and no chips. */
+.pick-head { display: none; }
+.pick-row { display: none; }
+@supports selector(:has(*)) { @media (max-width: 640px) {
+ .pick-bar { margin-top: 0; }
+ .pick-head { display: block; }
+ .pick-head h2 { margin: 0 0 4px; font: 700 clamp(20px,2.4vw,28px)/1.2 var(--ov-font,'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif); letter-spacing: -.02em; }
+ .pick-row { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 0; padding: 2px 16px 4px; scrollbar-width: none; overscroll-behavior-x: contain; }
+ .pick-row::-webkit-scrollbar { display: none; }
+ .pick-row input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
+ .pick-row label { display: inline-flex; align-items: center; flex: none; min-height: 44px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--border, #1f2d47); color: var(--text-secondary, #96a7c2); font-size: .9rem; font-weight: 650; white-space: nowrap; cursor: pointer; }
+ .pick-row input:checked + label { color: var(--text-primary, #e6edf7); border-color: var(--accent, #3b82f6); background: color-mix(in srgb, var(--accent, #3b82f6) 12%, transparent); }
+ .pick-row input:focus-visible + label { outline: 2px solid var(--accent, #3b82f6); outline-offset: 2px; }
+ .pick .pick-pane { display: none; }
+ .pick .pick-list > li { display: none; }
+ /* The chip names the block, so the block's own heading gives way to it; the content stays in the page for the
+ crawlers and for the reader on a wide screen. */
+ .pick .sc-sec > h2, .pick section > h2, .pick > h2 { display: none; }
+} }
+
+/* The fold (the owner's short-pages rule): closed on a phone, and where there is room it looks like the section it
+ replaces: a heading and its content, with no card around it. */
+.ds-fold-block { margin-top: 32px; }
+.ds-fold-block > summary h2 { margin: 0; font: 700 clamp(19px,2.2vw,26px)/1.2 var(--ov-font,'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif); }
+.ds-fold-hint { display: none; }
+/* The fold's summary carries the heading, so the section's own heading gives way to it. */
+.ds-fold-block .sc-sec > h2, .ds-fold-block > .sc-sec > h2 { display: none; }
+@media (min-width: 641px) {
+ .ds-fold-block { border: 0; background: none; border-radius: 0; margin-top: 56px; padding: 0; }
+ .ds-fold-block > summary { display: block; min-height: 0; padding: 0; }
+ .ds-fold-block > summary h2 { margin: 0 0 6px; font: 700 clamp(22px,2.6vw,30px)/1.2 var(--ov-font,'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif); }
+ .ds-fold-block > summary span { display: none; }
+ .ds-fold-block .sc-sec { margin: 0; padding: 0; }
+}
+@media (max-width: 640px) {
+ .ds-fold-block { margin-top: 24px; }
+ .ds-fold-block > summary { cursor: pointer; }
+ .ds-fold-hint { display: inline; margin-left: 8px; font-size: .78rem; font-weight: 600; color: var(--text-secondary, #96a7c2); }
+}
+
+
+/* A link that points into a pick block opens it: the pane carries the id the link names. */
+@supports selector(:has(*)) { @media (max-width: 640px) {
+ .pick .pick-pane:target { display: block; }
+} }
+
+/* On a wide screen the pick block is invisible: its blocks sit where they were, in the order they were. */
+@media (min-width: 641px) {
+ .pick, .pick-body, .pick-pane { display: contents; }
+ .pick-bar { display: none; }
+}
+
+/* The chip names the scene, so the scene's own heading gives way to it. */
+@supports selector(:has(*)) { @media (max-width: 640px) {
+ .pick .sc-scene-text > h2 { display: none; }
+} }
@@ -41,7 +41,7 @@ const baseUrl = () => BASE;
@@ -41,7 +41,7 @@ const baseUrl = () => BASE;
const canonical = (p) => `${BASE}${p || '/'}`;
const canonical = (p) => `${BASE}${p || '/'}`;
/** The page around a body: the shared shell with the room's stylesheets and behaviour. */
/** The page around a body: the shared shell with the room's stylesheets and behaviour. */
-function layout({ title, description, canonical, path, robots = 'index, follow', body, active = '/', scripts = [], styles = [], jsonLd = [] } = {}) {
+function layout({ title, description, canonical, path, robots = 'index, follow', body, active = '/', scripts = [], styles = [], jsonLd = [], inlineStyles = [] } = {}) {
const pathNow = path || active || '/';
const pathNow = path || active || '/';
canonical = canonical || (path ? `${BASE}${path}` : undefined);
canonical = canonical || (path ? `${BASE}${path}` : undefined);
const navbar = {
const navbar = {
@@ -76,6 +76,7 @@ function layout({ title, description, canonical, path, robots = 'index, follow',
@@ -76,6 +76,7 @@ function layout({ title, description, canonical, path, robots = 'index, follow',
<link rel="stylesheet" href="${esc(ovServe.url('showcase.css'))}">
<link rel="stylesheet" href="${esc(ovServe.url('showcase.css'))}">
<link rel="stylesheet" href="${esc(asset('css/design.css'))}">
<link rel="stylesheet" href="${esc(asset('css/design.css'))}">
${(styles || []).map((rel) => `<link rel="stylesheet" href="${esc(asset(rel))}">`).join('\n')}
${(styles || []).map((rel) => `<link rel="stylesheet" href="${esc(asset(rel))}">`).join('\n')}
+${(inlineStyles || []).map((css) => `<style>${css}</style>`).join('\n')}
<script src="${esc(ovServe.url('kit-web.js'))}" defer></script>
<script src="${esc(ovServe.url('kit-web.js'))}" defer></script>
<script src="${esc(ovServe.url('motion.js'))}" defer></script>
<script src="${esc(ovServe.url('motion.js'))}" defer></script>
${(scripts || []).map((rel) => `<script src="${esc(asset(rel))}" defer></script>`).join('\n')}
${(scripts || []).map((rel) => `<script src="${esc(asset(rel))}" defer></script>`).join('\n')}
new file mode 100644
new file mode 100644
@@ -0,0 +1,109 @@
@@ -0,0 +1,109 @@
+'use strict';
+/**
+ * The home on a phone (the owner's short-pages rule, 2026-10-30): one or two screens, app-like.
+ *
+ * pickBlock() several blocks of the same kind, one at a time on a phone, picked with a row of chips. Radio
+ * inputs and :has(), no script: every block stays in the page for crawlers, and a wider screen (or a
+ * browser without :has()) shows them all and no chips.
+ * pickList() a list of things of the same kind, one at a time on a phone, picked with a row of chips.
+ * foldBlock() a part a reader rarely needs, closed on a phone and open where there is room. The page's own markup
+ * keeps it open, so a browser without the script shows it as before; the script closes it on a narrow
+ * screen and remembers the reader's choice.
+ *
+ * The CSS for both lives in this site's own stylesheet; the rule that shows the picked block is written for the
+ * page, because there is one per block.
+ */
+const esc = (s) => String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
+
+/**
+ * A pick block. The panes are the page's own blocks; each one keeps its heading on a wide screen, and on a phone the
+ * heading gives way to the chip that names it.
+ *
+ * pickBlock({ key, label, head, panes }) panes: [{ id, label, html }]
+ */
+function pickBlock({ key, label, head = '', panes }) {
+ // A pane with nothing to show is left out, so the chips and the rules that show them match the page.
+ panes = (panes || []).filter((p) => p.html);
+ if (!panes.length) return '';
+ const chips = panes.map((p, i) => '<input type="radio" name="pick-' + esc(key) + '" id="pk-' + esc(key) + '-' + esc(p.id) + '" value="' + esc(p.id) + '"' + (i === 0 ? ' checked' : '') + '><label for="pk-' + esc(key) + '-' + esc(p.id) + '">' + esc(p.label) + '</label>').join('');
+ const body = panes.map((p) => '<div class="pick-pane" id="' + esc(p.id) + '">' + p.html + '</div>').join('');
+ return '<div class="pick" id="pick-' + esc(key) + '"><div class="pick-bar"><div class="pick-head"><h2>' + esc(head || label) + '</h2></div><div class="pick-row" role="radiogroup" aria-label="' + esc(label) + '">' + chips + '</div></div><div class="pick-body">' + body + '</div></div>';
+}
+
+/** The rule that shows the picked block of a pick block: one per block, so the CSS is written for the page. */
+function pickRule(key, id) {
+ return '.pick:has(#pk-' + key + '-' + id + ':checked) #' + id + '{display:block}';
+}
+
+/** The rules for every block of a pick block, in the order they appear. */
+function pickRules(key, ids) {
+ return ids.map((id) => pickRule(key, id)).join('');
+}
+
+/**
+ * A pick list: a list of things of the same kind, one at a time on a phone, picked with a row of chips. The list
+ * keeps its own markup and every item stays in the page; the caller marks each item with the index its chip picks.
+ *
+ * pickList({ key, label, head, labels, html }) labels: the chip labels, in the order of the items
+ */
+function pickList({ key, label, head = '', labels, html }) {
+ labels = labels || [];
+ if (!labels.length) return '';
+ const chips = labels.map((l, i) => '<input type="radio" name="pick-' + esc(key) + '" id="pk-' + esc(key) + '-' + i + '" value="' + i + '"' + (i === 0 ? ' checked' : '') + '><label for="pk-' + esc(key) + '-' + i + '">' + esc(l) + '</label>').join('');
+ return '<div class="pick" id="pick-' + esc(key) + '"><div class="pick-bar"><div class="pick-head"><h2>' + esc(head || label) + '</h2></div><div class="pick-row" role="radiogroup" aria-label="' + esc(label) + '">' + chips + '</div></div>' + html + '</div>';
+}
+
+/** The rule that shows the picked item of a pick list: one per item, so the CSS is written for the page. */
+function pickListRule(key, i) {
+ return '.pick#pick-' + key + ':has(#pk-' + key + '-' + i + ':checked) .pick-list>li[data-i="' + i + '"]{display:block}';
+}
+
+/** The rules for every item of a pick list. */
+function pickListRules(key, n) {
+ return Array.from({ length: n }, (_, i) => pickListRule(key, i)).join('');
+}
+
+/**
+ * A fold. The head is the heading the block had; the html is what it holds.
+ *
+ * foldBlock({ id, head, html })
+ */
+function foldBlock({ id, head, html }) {
+ return '<details class="ds-fold ds-fold-block" id="' + esc(id) + '" open><summary>' + head + '<span class="ds-fold-hint">tap to open</span></summary>' + html + '</details>' + foldScript(id);
+}
+
+/** The script a fold carries: closed on a phone unless the reader opened it before, and it remembers that. */
+function foldScript(id) {
+ return "<script>(function(){var d=document.getElementById(" + JSON.stringify(id) + ");if(!d)return;var k='ov_fold_'+" + JSON.stringify(id) + ";var s=null;try{s=localStorage.getItem(k)}catch(e){}if(s==='open'){d.open=true;return}if(s==='closed'){d.open=false;return}var t=0;if(window.matchMedia&&window.matchMedia('(max-width:640px)').matches){t=Date.now();d.open=false}d.addEventListener('toggle',function(){if(Date.now()-t<300)return;try{localStorage.setItem(k,d.open?'open':'closed')}catch(e){}})})();</script>";
+}
+
+
+/**
+ * A part of a page's own markup, found by the heading it carries: the site can then show it in a pick block or a
+ * fold. { start, end, html } — the section that holds the needle.
+ */
+function part(html, needle) {
+ const at = html.indexOf(needle);
+ if (at < 0) return null;
+ const start = html.lastIndexOf('<section', at);
+ const close = html.indexOf('</section>', at);
+ if (start < 0 || close < 0) return null;
+ const end = close + '</section>'.length;
+ return { start, end, html: html.slice(start, end) };
+}
+
+/** The same part, but replaced by something else. */
+function swap(html, needle, withHtml) {
+ const p = part(html, needle);
+ if (!p) return html;
+ return html.slice(0, p.start) + withHtml + html.slice(p.end);
+}
+
+/** The part that carries this heading, as a fold: closed on a phone, the section it was where there is room. */
+function foldAround(html, needle, id, head) {
+ const p = part(html, needle);
+ if (!p) return html;
+ return html.slice(0, p.start) + foldBlock({ id, head, html: p.html }) + html.slice(p.end);
+}
+
+module.exports = { pickBlock, pickRule, pickRules, pickList, pickListRule, pickListRules, foldBlock, foldScript, part, swap, foldAround };
@@ -13,6 +13,8 @@
@@ -13,6 +13,8 @@
*/
*/
const layoutLib = require('../render/layout');
const layoutLib = require('../render/layout');
const kit = require('openvibe-shared/kit');
const kit = require('openvibe-shared/kit');
+// The short home (the owner's rule, 2026-10-30): pick blocks and folds.
+const { pickBlock, pickRules, foldAround } = require('../render/short');
const sc = require('openvibe-shared/showcase');
const sc = require('openvibe-shared/showcase');
const rooms = require('openvibe-shared/rooms');
const rooms = require('openvibe-shared/rooms');
const { iframeHtml } = require('../arena/sanitize');
const { iframeHtml } = require('../arena/sanitize');
@@ -89,7 +91,7 @@ function home({ themes } = {}) {
@@ -89,7 +91,7 @@ function home({ themes } = {}) {
const make = `<ol class="ds-flow" aria-label="How Create works"><li><b>Describe it</b><span>A page, an app screen or a component, in a sentence.</span></li><li><b>Three models draft it</b><span>At once, on your theme, at phone and desktop sizes.</span></li><li><b>Make it yours</b><span>Pick one, click any part to change it or ask for a change, and keep every version.</span></li></ol>`;
const make = `<ol class="ds-flow" aria-label="How Create works"><li><b>Describe it</b><span>A page, an app screen or a component, in a sentence.</span></li><li><b>Three models draft it</b><span>At once, on your theme, at phone and desktop sizes.</span></li><li><b>Make it yours</b><span>Pick one, click any part to change it or ask for a change, and keep every version.</span></li></ol>`;
const draft = (side) => `<figure class="ds-vs-card"><span class="ds-vs-bar"></span><span class="ds-vs-hero"></span><span class="ds-vs-row"><i></i><i></i><i></i></span><figcaption>${side}</figcaption></figure>`;
const draft = (side) => `<figure class="ds-vs-card"><span class="ds-vs-bar"></span><span class="ds-vs-hero"></span><span class="ds-vs-row"><i></i><i></i><i></i></span><figcaption>${side}</figcaption></figure>`;
const vs = `<div class="ds-vs" role="img" aria-label="Two drafts side by side, their models hidden">${draft('Left')}<span class="ds-vs-or">or</span>${draft('Right')}</div><p class="ds-fine ds-vs-note">The models' names stay hidden until you vote.</p>`;
const vs = `<div class="ds-vs" role="img" aria-label="Two drafts side by side, their models hidden">${draft('Left')}<span class="ds-vs-or">or</span>${draft('Right')}</div><p class="ds-fine ds-vs-note">The models' names stay hidden until you vote.</p>`;
- const body = sc.room({
+ const room = sc.room({
room: 'design',
room: 'design',
hero: {
hero: {
title: 'Your look, everywhere',
title: 'Your look, everywhere',
@@ -132,7 +134,33 @@ function home({ themes } = {}) {
@@ -132,7 +134,33 @@ function home({ themes } = {}) {
['What is coming next?', 'Publishing a design straight to OpenVibe.Website and OpenVibe.Space, brand kits that dress a creator\'s channel, overlays and shop in one go, and the kit\'s components as native Android and iOS views.'],
['What is coming next?', 'Publishing a design straight to OpenVibe.Website and OpenVibe.Space, brand kits that dress a creator\'s channel, overlays and shop in one go, and the kit\'s components as native Android and iOS views.'],
] },
] },
});
});
- return layout({ title: null, description: 'Your look, everywhere: one theme across every OpenVibe site, the same theme as code for the web, Android and iOS, and AI design on it, ranked honestly by the Design Arena.', path: '/', body: `<div class="ds-wrap">${body}</div>`, active: '/' });
+ // The short home (the owner's rule, 2026-10-30): the three scenes are one pick block, a row of chips picks one
+ // of them, and the parts a reader rarely needs are folds.
+ const sceneTitles = ['One theme, every site', 'Make it with AI, on your theme', 'See which AI designs best'];
+ const arts = [...room.matchAll(/<article class="sc-scene[\s\S]*?<\/article>/g)];
+ let body = room;
+ if (arts.length) {
+ const first = arts[0];
+ const last = arts[arts.length - 1];
+ const start = body.lastIndexOf('<section class="sc-room-scenes"', first.index);
+ const end = body.indexOf('</section>', last.index + last[0].length) + '</section>'.length;
+ const pick = pickBlock({
+ key: 'scenes',
+ label: 'What you can do',
+ head: 'What you can do',
+ panes: arts.map((a, i) => ({ id: `ds-scene-${i}`, label: sceneTitles[i] || `Scene ${i + 1}`, html: a[0] })),
+ });
+ body = start > 0 && end > 0 ? body.slice(0, start) + pick + body.slice(end) : body;
+ }
+ // The code samples and the questions are the parts a reader rarely needs on a phone.
+ body = foldAround(body, '>Your theme, in your app</h2>', 'dev', '<h2 id="ds-dev-h">Your theme, in your app</h2>');
+ body = foldAround(body, '>Questions</h2>', 'faq', '<h2 id="ds-faq-h">Questions</h2>');
+ return layout({
+ title: null, description: 'Your look, everywhere: one theme across every OpenVibe site, the same theme as code for the web, Android and iOS, and AI design on it, ranked honestly by the Design Arena.',
+ path: '/', body: `<div class="ds-wrap">${body}</div>`, active: '/',
+ // The rule that shows the picked scene of the pick block: one per scene, written for this page.
+ inlineStyles: [`@supports selector(:has(*)){@media (max-width:640px){${pickRules('scenes', arts.map((_, i) => `ds-scene-${i}`))}}}`],
+ });
}
}
/** The studio's "As code" sheet: the edited theme compiled in the page (public/js/studio.js). */
/** The studio's "As code" sheet: the edited theme compiled in the page (public/js/studio.js). */
new file mode 100644
new file mode 100644
@@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
+'use strict';
+/**
+ * The home on a phone (the owner's short-pages rule, 2026-10-30): the three scenes are one pick block, a row of chips
+ * picks one of them, and the parts a reader rarely needs are folds. Radio inputs and :has(), no script for the chips;
+ * every scene stays in the page for crawlers; a wider screen shows them all and no chips.
+ */
+const assert = require('assert');
+const { boot, check, done } = require('./helpers/boot');
+
+(async () => {
+ const t = await boot();
+ try {
+ await check('the scenes are one pick block: a chip per scene, the first picked, every scene in the page', async () => {
+ const r = await t.get('/');
+ assert.strictEqual(r.status, 200, r.text);
+ const page = r.text;
+ const start = page.indexOf('<div class="pick" id="pick-scenes">');
+ assert.ok(start > 0, 'the pick block is on the home');
+ const block = page.slice(start, page.indexOf('<section aria-labelledby="ds-strip-h">'));
+ assert.match(block, /<div class="pick-row" role="radiogroup" aria-label="What you can do">/);
+ const chips = [...block.matchAll(/<input type="radio" name="pick-scenes" id="pk-scenes-(ds-scene-\d+)" value="(ds-scene-\d+)"( checked)?><label for="pk-scenes-ds-scene-\d+">([^<]+)<\/label>/g)];
+ assert.strictEqual(chips.length, 3, `a chip per scene (${chips.length})`);
+ assert.deepStrictEqual(chips.filter((m) => m[3]).map((m) => m[1]), [chips[0][1]], 'the first scene is picked');
+ // Every scene stays in the page, each in its own pane.
+ const scenes = [...block.matchAll(/<article class="sc-scene/g)];
+ assert.strictEqual(scenes.length, chips.length, 'every scene is in the page');
+ for (const m of chips) assert.ok(block.includes(`id="${m[1]}"`), `the pane of ${m[1]} is in the page`);
+ assert.ok(block.includes('One theme, every site') && block.includes('Make it with AI, on your theme') && block.includes('See which AI designs best'), 'every scene is named in the page');
+ });
+
+ await check('the CSS guard: the chips are hidden and the scenes all show until 640 px and where :has() is understood', async () => {
+ const r = await t.get('/');
+ const page = r.text;
+ assert.match(page, /<style>@supports selector\(:has\(\*\)\)\{@media \(max-width:640px\)\{\.pick:has\(#pk-scenes-ds-scene-0:checked\) #ds-scene-0\{display:block\}/, 'the rule that shows the picked scene');
+ const css = require('fs').readFileSync(require('path').join(__dirname, '..', 'public', 'css', 'design.css'), 'utf8');
+ assert.match(css, /\.pick-row \{ display: none; \}/, 'the chips are hidden by default');
+ assert.match(css, /@supports selector\(:has\(\*\)\) \{ @media \(max-width: 640px\) \{/, 'the phone rules are under :has() and 640 px');
+ assert.match(css, /\.pick-row label \{[^}]*min-height: 44px/, 'a chip is a 44 px target');
+ assert.match(css, /\.pick \.pick-pane \{ display: none; \}/, 'the scenes are hidden on a phone');
+ });
+
+ await check('the parts a reader rarely needs are folds, open in the page and closed on a phone', async () => {
+ const r = await t.get('/');
+ const page = r.text;
+ for (const id of ['dev', 'faq']) {
+ assert.ok(page.includes(`<details class="ds-fold ds-fold-block" id="${id}" open>`), `${id} is a fold, open in the page`);
+ assert.ok(page.includes(`document.getElementById("${id}")`), `${id} has the script that closes it on a phone`);
+ }
+ // The content of the folds stays in the page.
+ assert.match(page, /<h2 id="ds-dev-h">Your theme, in your app<\/h2>/);
+ assert.match(page, /<h2 id="ds-faq-h">Questions<\/h2>/);
+ assert.match(page, /MaterialTheme\(/, 'the code samples are still on the page');
+ });
+ } finally {
+ await done(t);
+ }
+})().catch((e) => { console.error(e); process.exit(1); });