Files
museion/ref/prototypes/wf104-library-ui-prototype.html
T
AlexKucera 135cc0a78e prototype(#104): library UI variants A/B/C — project grouping + Archive placement
Throwaway UI prototype for wayfinder ticket #104. Three variants, ?variant=
param, real dev corpus, Museion #89 tokens. Verdict: B (serif project
sections + rust edge-bar) + nav-rail Archive destination; New Project and
move-piece-between-projects pulled INTO v1 scope by live verdict.
2026-10-12 17:53:32 +02:00

291 lines
16 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Museion — Library UI prototype (#104)</title>
<style>
/* PROTOTYPE #104 — throwaway. How should the library column look once pieces
group by Project? Three variants, ?variant=A|B|C, bottom bar cycles. */
:root {
--bg: #FAF9F3; /* #89 calibrated chrome color */
--surface: #FFFEFB; /* #89 calibrated page color */
--fg: #1a1916;
--muted: #6b6964;
--border: #e8e5df;
--accent: #c96442;
--fg-soft: rgba(26,25,22,.06);
--font-display: 'Iowan Old Style', Charter, Georgia, serif;
--font-body: -apple-system, system-ui, sans-serif;
--font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
--radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px/1.45 var(--font-body); color: var(--fg); background: var(--bg);
display: flex; overflow: hidden; }
.rail { width: 56px; flex: none; border-right: 1px solid var(--border);
display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 2px; }
.rail-btn { width: 44px; height: 44px; display: grid; place-items: center;
border: none; border-radius: var(--radius); background: transparent;
color: var(--muted); cursor: pointer; }
.rail-btn:hover { background: var(--fg-soft); color: var(--fg); }
.rail-btn.current { background: var(--surface); color: var(--fg); box-shadow: inset 2px 0 0 var(--accent); }
.rail-spacer { flex: 1; }
svg { width: 20px; height: 20px; }
.library { width: 232px; flex: none; border-right: 1px solid var(--border);
overflow-y: auto; overflow-x: hidden; padding-bottom: 12px; }
.pane-head { min-height: 52px; display: flex; align-items: center;
justify-content: space-between; gap: 10px; padding: 0 14px;
border-bottom: 1px solid var(--border); background: var(--bg);
position: sticky; top: 0; z-index: 2; }
.pane-head h2 { font: 600 15px/1 var(--font-display); margin: 0; }
.icon-btn { min-height: 44px; width: 44px; display: grid; place-items: center;
border: 1px solid transparent; border-radius: var(--radius);
background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--fg-soft); color: var(--fg); }
.group-label { padding: 18px 14px 7px; color: var(--muted);
font: 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.post-row { width: calc(100% - 16px); margin: 0 8px 4px; padding: 10px;
text-align: left; border: 1px solid transparent; border-radius: var(--radius);
background: transparent; cursor: pointer; display: block; font: inherit; color: inherit; }
.post-row:hover { background: var(--fg-soft); }
.post-row[aria-current] { background: var(--surface); border-color: var(--border); }
.post-title { display: block; font-weight: 600; font-size: 13px; white-space: nowrap;
overflow: hidden; text-overflow: ellipsis; }
.post-meta { display: flex; gap: 10px; margin-top: 5px; color: var(--muted);
font: 11px var(--font-mono); }
.editor { flex: 1; display: grid; place-items: center; color: var(--muted); }
/* ============ Variant A: project headers + Pass-State rows ============ */
.vA .project-head { width: calc(100% - 16px); margin: 14px 8px 2px; padding: 0 6px;
display: flex; align-items: center; gap: 6px; border: none;
background: none; cursor: pointer; color: var(--fg); font: inherit; }
.vA .project-head:first-child { margin-top: 6px; }
.vA .chev { transition: transform .12s; color: var(--muted); flex: none;
display: grid; place-items: center; width: 16px; height: 16px; }
.vA .project-head.closed .chev { transform: rotate(-90deg); }
.vA .project-name { font: 600 11px var(--font-mono); letter-spacing: .06em;
text-transform: uppercase; color: var(--muted);
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vA .project-count { margin-left: auto; font: 11px var(--font-mono); color: var(--muted); opacity: .7; }
.vA .group-label { padding: 10px 30px 5px; }
/* ============ Variant B: mono-11 section per project, rows keep Pass-State ============ */
.vB .project { margin-top: 4px; }
.vB .project-head { width: 100%; display: flex; align-items: baseline; gap: 8px;
padding: 16px 14px 6px; border: none; background: none;
cursor: pointer; color: inherit; font: inherit; text-align: left; }
.vB .project-name { font: 600 15px/1 var(--font-display); white-space: nowrap;
overflow: hidden; text-overflow: ellipsis; }
.vB .project-count { font: 11px var(--font-mono); color: var(--muted); }
.vB .group-label { padding: 8px 22px 5px; font-size: 10px; opacity: .8; }
.vB .post-row { border-left: 2px solid transparent; border-radius: 0 8px 8px 0; }
.vB .post-row[aria-current] { border-left-color: var(--accent); }
/* ============ Variant C: flat rows, project as inline meta ============ */
.vC .post-meta .proj { color: var(--accent); }
/* ============ Archive (A: bottom disclosure, C: nav-rail destination) ============ */
.archive-section { border-top: 1px solid var(--border); margin-top: 16px; }
.archive-head { width: 100%; display: flex; align-items: center; gap: 6px;
padding: 12px 14px 6px; border: none; background: none;
cursor: pointer; color: var(--muted); font: inherit; text-align: left; }
.vA .archive-head .project-name { font: 600 11px var(--font-mono); letter-spacing: .06em;
text-transform: uppercase; }
.vA .archive-head .project-count { margin-left: auto; font: 11px var(--font-mono); opacity: .7; }
/* C: rail destination view */
.rail-view-note { padding: 10px 14px 0; color: var(--muted); font: 11px var(--font-mono); }
.empty { padding: 24px 14px; color: var(--muted); font-size: 12px; }
/* ============ floating variant switcher ============ */
#switcher { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
display: flex; align-items: center; gap: 10px; padding: 8px 12px;
background: #1a1916; color: #faf9f3; border-radius: 999px;
box-shadow: 0 6px 24px rgba(0,0,0,.25); font: 12px var(--font-mono); z-index: 99;
user-select: none; }
#switcher button { background: none; border: none; color: inherit; font: inherit;
cursor: pointer; padding: 4px 8px; border-radius: 6px; }
#switcher button:hover { background: rgba(255,255,255,.15); }
</style>
</head>
<body>
<nav class="rail" aria-label="Navigation">
<button class="rail-btn current" data-rail="posts" title="Posts"
onclick="railNote('Posts — this prototype lives in the library column →')">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><path d="M4 19.5V6a2 2 0 0 1 2-2h11a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a2 2 0 0 1-2-2zm0 0a2 2 0 0 0 2 2h12"/></svg>
</button>
<button class="rail-btn" data-rail="sessions" title="Sessions" onclick="railNote('Sessions — placeholder (#28)')">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><path d="M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6"/></svg>
</button>
<button class="rail-btn" data-rail="learnings" title="Learnings" onclick="railNote('Learnings — placeholder (#26)')">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><path d="M12 3 2 8l10 5 10-5-10-5zM6 10.5V16c0 1.5 2.7 3 6 3s6-1.5 6-3v-5.5"/></svg>
</button>
<span class="rail-spacer"></span>
<button class="rail-btn" data-rail="archive" title="Archive" onclick="showArchiveView()"
id="archive-rail-btn" style="display:none">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><path d="M3 8h18v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8zm2 0V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v2M10 12h4"/></svg>
</button>
<button class="rail-btn" data-rail="settings" title="Settings" onclick="railNote('Settings — unchanged by this prototype')">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1.87-.34 1.7 1.7 0 0 0-1 1.56V21a2 2 0 1 1-4 0v-.07a1.7 1.7 0 0 0-1-1.56 1.7 1.7 0 0 0-1.87.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.7 1.7 0 0 0 .34-1.87 1.7 1.7 0 0 0-1.56-1H3a2 2 0 1 1 0-4h.07a1.7 1.7 0 0 0 1.56-1 1.7 1.7 0 0 0-.34-1.87l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.7 1.7 0 0 0 1.87.34h0a1.7 1.7 0 0 0 1-1.56V3a2 2 0 1 1 4 0v.07a1.7 1.7 0 0 0 1 1.56 1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.7 1.7 0 0 0-.34 1.87v0a1.7 1.7 0 0 0 1.56 1H21a2 2 0 1 1 0 4h-.07a1.7 1.7 0 0 0-1.56 1z"/></svg>
</button>
</nav>
<aside class="library" id="library" aria-label="Library"></aside>
<main class="editor" id="editor">editor column — unchanged</main>
<div id="switcher">
<button onclick="cycle(-1)" aria-label="Previous variant">←</button>
<span id="variant-label"></span>
<button onclick="cycle(1)" aria-label="Next variant">→</button>
</div>
<script>
'use strict';
/* Real dev corpus (~/Documents/Museion/posts, 2026-10-12) projected into the
project world per #103: default project posts; alexander → outline-flavored. */
const DATA = [
{ project: 'essays', pieces: [
{ id: 'the-expected-value-of-showing-up', title: 'The expected value of showing up',
state: 'First Draft', origin: 'writer' },
{ id: 'museion-handoff', title: 'Reading-mode pivot: apex vs handrolled TextKit',
state: 'First Draft', origin: 'writer' },
]},
{ project: 'posts', pieces: [
{ id: 'kitchen-sink', title: 'Kitchen sink', state: 'First Draft', origin: 'writer' },
]},
{ project: 'alexander', pieces: [
{ id: 'alexander', title: 'Alexander', state: 'First Draft', origin: 'writer', kind: 'outline' },
]},
];
const ARCHIVE = [
{ project: 'awards-speech-2024', pieces: [
{ id: 'acceptance', title: 'Acceptance speech', state: 'Pass-1 Done', origin: 'writer' },
{ id: 'thank-yous', title: 'Thank-you notes', state: 'Pass-1 Done', origin: 'writer' },
]},
];
const VARIANTS = { A: 'Project headers · Pass-State rows', B: 'Section per project · edge bar', C: 'Flat rows · project as meta' };
const ESC = s => s.replace(/&/g,'&amp;').replace(/</g,'&lt;');
const STAR = '<span title="outline" style="cursor:help">✳</span>';
function rowHTML(p, withProject) {
return `<button class="post-row" onclick="pick(this)" title="context menu: Rename · Move to Project… · Move to Trash">
<span class="post-title">${ESC(p.title)}${p.kind === 'outline' ? ' ' + STAR : ''}</span>
<span class="post-meta">${withProject ? `<span class="proj">${ESC(p.project)}</span>` : ''}
<span>${p.state}</span><span>${p.origin}</span></span>
</button>`;
}
function piecesWithProject(groups) {
return groups.flatMap(g => g.pieces.map(p => ({ ...p, project: g.project })));
}
function renderA() {
return `<div class="vA">` + DATA.map((g,gi) => `
<button class="project-head" onclick="toggleProject(this)">
<span class="chev"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="12" height="12"><path d="M6 9l6 6 6-6"/></svg></span>
<span class="project-name">${ESC(g.project)}</span>
<span class="project-count">${g.pieces.length}</span>
</button>
<div class="project-body">${passGroups(g.pieces, false)}</div>`).join('') + `
<div class="archive-section">
<button class="archive-head" onclick="toggleProject(this)">
<span class="chev"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="12" height="12"><path d="M6 9l6 6 6-6"/></svg></span>
<span class="project-name">Archive</span>
<span class="project-count">${ARCHIVE.reduce((n,g)=>n+g.pieces.length,0)}</span>
</button>
<div class="project-body">${ARCHIVE.map(g => `
<div class="group-label">${ESC(g.project)}</div>
${g.pieces.map(p => rowHTML(p, false)).join('')}`).join('')}
</div>
</div></div>`;
}
function renderB() {
return `<div class="vB">` + DATA.map(g => `
<section class="project">
<button class="project-head" onclick="toggleProject(this)">
<span class="project-name">${ESC(g.project)}</span>
<span class="project-count">${g.pieces.length}</span>
</button>
<div class="project-body">${passGroups(g.pieces, false)}</div>
</section>`).join('') + `
<div class="archive-section">
<button class="archive-head" onclick="toggleProject(this)" style="font:600 11px var(--font-mono); letter-spacing:.06em; text-transform:uppercase">
<span class="chev"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="12" height="12"><path d="M6 9l6 6 6-6"/></svg></span>
<span>Archive · ${ARCHIVE.reduce((n,g)=>n+g.pieces.length,0)}</span>
</button>
<div class="project-body">${ARCHIVE.map(g => `
<div class="group-label">${ESC(g.project)}</div>
${g.pieces.map(p => rowHTML(p, false)).join('')}`).join('')}
</div>
</div></div>`;
}
function renderC() {
return `<div class="vC">
<div class="group-label">Library</div>
${piecesWithProject(DATA).map(p => rowHTML(p, true)).join('')}
<div class="rail-view-note" style="padding:14px 14px 0">↙ Archive lives at the nav rail (box icon, bottom)</div>
</div>`;
}
function renderArchiveRailView() {
return `<div class="vC">
<div class="group-label">Archive — read-only feel, fully openable</div>
${ARCHIVE.map(g => `
<div class="group-label" style="padding-top:14px">${ESC(g.project)}</div>
${g.pieces.map(p => rowHTML(p, false)).join('')}`).join('')}
<div class="rail-view-note" style="padding:14px 14px 0">↩ back = the Posts rail button (draft icon)</div>
</div>`;
}
function passGroups(pieces, withProject) {
const by = {};
pieces.forEach(p => (by[p.state] = by[p.state] || []).push(p));
return Object.entries(by).map(([state, ps]) =>
`<div class="group-label">${ESC(state)}</div>${ps.map(p => rowHTML(p, withProject)).join('')}`).join('');
}
function toggleProject(btn) {
btn.classList.toggle('closed');
const body = btn.nextElementSibling;
body.style.display = body.style.display === 'none' ? '' : 'none';
}
function pick(row) {
document.querySelectorAll('.post-row[aria-current]').forEach(r => r.removeAttribute('aria-current'));
row.setAttribute('aria-current', 'page');
}
function railNote(msg) { document.getElementById('editor').textContent = msg; }
function showArchiveView() {
document.getElementById('library').innerHTML = renderArchiveRailView();
document.querySelectorAll('.rail-btn').forEach(b => b.classList.remove('current'));
document.getElementById('archive-rail-btn').classList.add('current');
}
const RENDER = { A: renderA, B: renderB, C: renderC };
function apply(v, push) {
document.getElementById('library').innerHTML = RENDER[v]();
document.getElementById('variant-label').textContent = `${v} — ${VARIANTS[v]}`;
document.getElementById('archive-rail-btn').style.display = v === 'C' ? '' : 'none';
document.querySelectorAll('.rail-btn[data-rail=posts]').forEach(b => b.classList.add('current'));
if (push) history.replaceState(null, '', '?variant=' + v);
}
function cycle(dir) {
const keys = Object.keys(VARIANTS);
const cur = new URLSearchParams(location.search).get('variant') || 'A';
apply(keys[(keys.indexOf(cur) + dir + keys.length) % keys.length], true);
}
document.addEventListener('keydown', e => {
if (/input|textarea/i.test(e.target.tagName) || e.target.isContentEditable) return;
if (e.key === 'ArrowLeft') cycle(-1);
if (e.key === 'ArrowRight') cycle(1);
});
apply(new URLSearchParams(location.search).get('variant') || 'A', false);
</script>
</body>
</html>