176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
chore: delete the retired handbook page system, its migration tool and fonts
matin3b6ad2ce0def
diff --git a/assets/css/handbook.css b/assets/css/handbook.cssdeleted file mode 100644index 72461c09..00000000--- a/assets/css/handbook.css+++ /dev/null@@ -1,145 +0,0 @@-/* Animation Handbook — shared page chrome for the demo pages.- Linked after each demo's own <style>, so these rules win where they overlap.- The animation itself keeps its own styles; only the layout around it lives here. */--@font-face{font-family:'Schibsted Grotesk';src:url('../fonts/schibsted-latin-ext.woff2') format('woff2');font-weight:400 900;font-style:normal;font-display:swap;- unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}-@font-face{font-family:'Schibsted Grotesk';src:url('../fonts/schibsted-latin.woff2') format('woff2');font-weight:400 900;font-style:normal;font-display:swap;- unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}--:root{- --hb-font:'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;- --disp:var(--hb-font);--mono:var(--hb-font);- --hb-bg:#0b0b0d;--hb-panel:#111114;--hb-panel-2:#0d0d10;- --hb-ink:#f4f4f2;--hb-dim:#adadb2;--hb-muted:#77777e;--hb-line:rgba(255,255,255,.085);- --hb-accent:var(--ui-accent,#6ea8ff);--hb-bar:48px;-}--body.hb{margin:0;padding:0;background:var(--hb-bg);color:var(--hb-ink);font-family:var(--hb-font);-webkit-font-smoothing:antialiased}-body.hb :focus-visible{outline:2px solid var(--hb-accent);outline-offset:2px}--/* Demo styles often set display on classes such as .kv; keep the hidden attribute authoritative. */-body.hb [hidden]{display:none!important}--/* Top bar */-.hb-bar{position:sticky;top:0;z-index:50;height:var(--hb-bar);display:flex;align-items:center;justify-content:space-between;gap:8px;- padding:0 clamp(6px,1.6vw,16px);background:rgba(11,11,13,.88);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);- border-bottom:1px solid var(--hb-line);font:500 11px/1 var(--hb-font);letter-spacing:.1em;text-transform:uppercase}-.hb-bar a{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;min-width:44px;padding:0 8px;- border-radius:6px;color:var(--hb-muted);text-decoration:none}-.hb-bar .hb-home{color:var(--hb-ink)}-.hb-pager{display:flex}--/* First screen: the stage fills the view, the side column sits beside it */-.hb-view{display:grid;grid-template-columns:minmax(0,1fr) clamp(300px,27vw,370px);grid-template-rows:minmax(0,1fr);- grid-template-areas:"stage side";gap:clamp(10px,1.2vw,16px);padding:clamp(10px,1.2vw,16px);box-sizing:border-box;- height:calc(100vh - var(--hb-bar));height:calc(100dvh - var(--hb-bar));min-height:560px}-.hb-view>.stage{grid-area:stage;width:auto;height:auto;min-width:0;min-height:0;flex:none;margin:0}-.hb-replay{grid-area:stage;align-self:end;justify-self:end;position:relative;z-index:3;margin:12px;min-height:44px;padding:0 16px;- border:1px solid var(--hb-line);border-radius:999px;background:rgba(17,17,20,.85);color:var(--hb-dim);font:500 12px/1 var(--hb-font);cursor:pointer}--.hb-view>.hb-side{grid-area:side;width:auto;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;gap:18px;- padding:18px 18px 0;background:var(--hb-panel);border:1px solid var(--hb-line);border-radius:10px}-.hb-head{margin:0;flex:none}-.hb-cat{margin:0;font:500 11px/1.3 var(--hb-font);letter-spacing:.14em;text-transform:uppercase;color:var(--hb-accent)}-.hb-side .hb-head h1{margin:8px 0 0;font:800 clamp(28px,2.6vw,36px)/1 var(--hb-font);letter-spacing:-.03em;color:var(--hb-ink)}-.hb-side .hb-lede{margin:8px 0 0;font:400 13px/1.6 var(--hb-font);color:var(--hb-dim)}-.hb-label{margin:0 0 8px;font:500 11px/1 var(--hb-font);letter-spacing:.14em;text-transform:uppercase;color:var(--hb-muted)}--/* Settings: the demo's own controls, restyled compactly */-.hb-settings{display:flex;flex-direction:column;gap:10px;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#2a2a30 transparent}-.hb-settings{padding-bottom:24px;-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 24px),transparent);mask-image:linear-gradient(to bottom,#000 calc(100% - 24px),transparent)}-.hb-settings .lbl{margin:0;font:500 12px/1.3 var(--hb-font);letter-spacing:0;text-transform:none;color:var(--hb-dim)}-.hb-settings div:has(>.sr){display:grid;grid-template-columns:1fr auto;grid-template-areas:"label value" "slider slider";column-gap:10px}-.hb-settings div:has(>.sr)>.lbl{grid-area:label}-.hb-settings .sr{display:contents}-.hb-settings .sr input[type=range]{grid-area:slider;width:100%;min-height:30px;margin:0;accent-color:var(--hb-accent);cursor:pointer}-.hb-settings .sv{grid-area:value;width:auto;font:500 12px/1.3 var(--hb-font);color:var(--hb-ink);text-align:right}-.hb-settings div:has(>select){display:flex;align-items:center;justify-content:space-between;gap:10px}-.hb-settings select,.hb-settings input[type=text],.hb-settings textarea{min-height:32px;padding:6px 8px;border:1px solid var(--hb-line);- border-radius:6px;background:var(--hb-panel-2);color:var(--hb-ink);font:500 12px/1.4 var(--hb-font)}-.hb-settings input[type=text],.hb-settings textarea{width:100%;font-weight:400}-.hb-settings .seg{display:flex;flex-wrap:wrap;gap:4px}-.hb-settings .seg button{flex:1 1 0;min-width:0;min-height:36px;padding:6px 4px;border:1px solid var(--hb-line);border-radius:6px;- background:none;color:var(--hb-muted);font:500 12px/1.2 var(--hb-font);cursor:pointer}-.hb-settings .seg button.on{border-color:var(--hb-accent);color:var(--hb-accent);background:color-mix(in srgb,var(--hb-accent) 12%,transparent)}-.hb-settings .tog{display:flex;flex-direction:row-reverse;align-items:center;justify-content:space-between;gap:10px;min-height:36px;- font:500 12px/1.3 var(--hb-font);color:var(--hb-dim);cursor:pointer}-.hb-settings .tog input{appearance:none;-webkit-appearance:none;flex:none;width:36px;height:20px;margin:0;border-radius:999px;cursor:pointer;- background:radial-gradient(circle at 10px 50%,var(--hb-ink) 6.5px,transparent 7px) #2a2a30}-.hb-settings .tog input:checked{background:radial-gradient(circle at 26px 50%,#0b0b0d 6.5px,transparent 7px) var(--hb-accent)}-.hb-settings .kv{display:flex;justify-content:space-between;gap:10px;font:400 12px/1.4 var(--hb-font);color:var(--hb-muted)}-.hb-settings .kv .v{color:var(--hb-ink)}-/* Live readouts ("State") come after the controls people change */-.hb-settings>.lbl:has(+.kv),.hb-settings>.kv{order:1}-.hb-settings>.lbl:has(+.kv){margin-top:4px;padding-top:12px;border-top:1px solid var(--hb-line)}-.hb-settings>.kv+.div{display:none}-.hb-settings .div{height:1px;margin:2px 0;background:var(--hb-line)}-.hb-settings .btn-row{display:flex;gap:6px}-.hb-settings .act{flex:1;min-height:36px;padding:0 6px;border:1px solid var(--hb-line);border-radius:6px;background:none;- color:var(--hb-ink);font:500 12px/1 var(--hb-font);cursor:pointer}-.hb-settings .act.pri{border-color:var(--hb-accent);color:var(--hb-accent)}--/* Prompt box and Read more stay visible at the bottom of the column */-.hb-take{flex:none;display:flex;flex-direction:column;gap:10px;padding:12px 0 18px;background:var(--hb-panel);border-top:1px solid var(--hb-line)}-.hb-prompt-box{padding:12px;border:1px solid var(--hb-line);border-radius:8px;background:var(--hb-panel-2)}-.hb-prompt{margin:0;font:400 13px/1.6 var(--hb-font);color:var(--hb-ink)}-.hb-clamp{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}-.hb-set{margin:8px 0 0;font:500 12px/1.5 var(--hb-font);color:var(--hb-accent)}-.hb-copy{display:block;width:100%;margin-top:10px;min-height:44px;border:0;border-radius:6px;background:var(--hb-ink);color:#0b0b0d;- font:600 12px/1 var(--hb-font);letter-spacing:.04em;cursor:pointer}-.hb-more{width:100%;min-height:44px;border:1px solid var(--hb-line);border-radius:6px;background:none;color:var(--hb-dim);- font:500 12px/1 var(--hb-font);cursor:pointer}--/* Read more: the explanation below the first screen */-.hb-details{border-top:1px solid var(--hb-line);scroll-margin-top:var(--hb-bar)}-.hb-details-in{max-width:1120px;margin:0 auto;padding:clamp(20px,3vw,40px) clamp(16px,3vw,32px) 96px;display:grid;- grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:clamp(20px,4vw,56px)}-.hb-details .hb-back{grid-column:1/-1;justify-self:start;display:inline-flex;align-items:center;min-height:44px;color:var(--hb-muted);- text-decoration:none;font:500 11px/1 var(--hb-font);letter-spacing:.1em;text-transform:uppercase}-.hb-details h2{margin:0 0 10px;font:700 20px/1.2 var(--hb-font);letter-spacing:-.01em;color:var(--hb-ink)}-.hb-details section+section{margin-top:34px}-.hb-details p,.hb-details li,.hb-details dd{margin:0;font:400 14px/1.75 var(--hb-font);color:var(--hb-dim)}-.hb-details p+p{margin-top:10px}-.hb-details ul{margin:0;padding:0;list-style:none}-.hb-details li{position:relative;padding-left:18px}-.hb-details li+li{margin-top:4px}-.hb-details li::before{content:"–";position:absolute;left:0;color:var(--hb-accent)}-.hb-details a{color:var(--hb-ink)}-.hb-details dl{margin:0;display:grid;grid-template-columns:minmax(120px,auto) 1fr;gap:12px 20px}-.hb-details dt{font:500 14px/1.5 var(--hb-font);color:var(--hb-ink)}-.hb-details dt small{display:block;font:400 12px/1.4 var(--hb-font);color:var(--hb-muted)}-.hb-full{padding:16px;border:1px solid var(--hb-line);border-radius:10px;background:var(--hb-panel)}-.hb-details .hb-full-text{color:var(--hb-ink);line-height:1.7}-.hb-details .hb-set{margin-top:8px;font:500 12px/1.5 var(--hb-font);color:var(--hb-accent)}-.hb-rel{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--hb-line);- border-radius:8px;text-decoration:none}-.hb-rel+.hb-rel{margin-top:8px}-.hb-rel b{display:block;font:700 16px/1.3 var(--hb-font);color:var(--hb-ink)}-.hb-rel small{display:block;margin-top:2px;font:400 12px/1.5 var(--hb-font);color:var(--hb-muted)}-.hb-rel i{font-style:normal;color:var(--hb-muted)}-.hb-details .hb-note{color:var(--hb-muted)}--@media(hover:hover){- .hb-bar a:hover{color:var(--hb-ink)}- .hb-replay:hover{color:var(--hb-ink);border-color:rgba(255,255,255,.25)}- .hb-copy:hover{background:#fff}- .hb-more:hover{color:var(--hb-ink);border-color:rgba(255,255,255,.25)}- .hb-details .hb-back:hover{color:var(--hb-ink)}- .hb-rel:hover{border-color:rgba(255,255,255,.25)}-}--@media(max-width:1024px){.hb-view{grid-template-columns:minmax(0,1fr) 300px}}-@media(min-width:601px) and (max-height:760px){- .hb-view>.hb-side{overflow-y:auto}- .hb-settings{flex:none;overflow:visible;-webkit-mask-image:none;mask-image:none;padding-bottom:0}-}-@media(max-width:760px){.hb-details-in{grid-template-columns:1fr}}-@media(max-width:600px){- .hb-bar .hb-name{display:none}- .hb-view{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;grid-template-areas:"stage" "side";height:auto;min-height:0}- .hb-view>.stage{height:calc(100vh * .56);height:calc(100svh * .56);min-height:320px}- .hb-view>.hb-side{overflow:visible}- .hb-settings{overflow:visible;-webkit-mask-image:none;mask-image:none;padding-bottom:0}- .hb-settings .sr input[type=range],.hb-settings .seg button,.hb-settings .act,.hb-settings .tog,.hb-settings select,.hb-settings input[type=text],.hb-settings textarea{min-height:44px}-}diff --git a/assets/fonts/brico-400.woff2 b/assets/fonts/brico-400.woff2deleted file mode 100644index ccc73da0..00000000Binary files a/assets/fonts/brico-400.woff2 and /dev/null differdiff --git a/assets/fonts/brico-700.woff2 b/assets/fonts/brico-700.woff2deleted file mode 100644index 515c1f09..00000000Binary files a/assets/fonts/brico-700.woff2 and /dev/null differdiff --git a/assets/fonts/brico-800.woff2 b/assets/fonts/brico-800.woff2deleted file mode 100644index b3da42eb..00000000Binary files a/assets/fonts/brico-800.woff2 and /dev/null differdiff --git a/assets/fonts/plex-400.woff2 b/assets/fonts/plex-400.woff2deleted file mode 100644index 0804aaff..00000000Binary files a/assets/fonts/plex-400.woff2 and /dev/null differdiff --git a/assets/fonts/plex-500.woff2 b/assets/fonts/plex-500.woff2deleted file mode 100644index 090f82f7..00000000Binary files a/assets/fonts/plex-500.woff2 and /dev/null differdiff --git a/assets/js/handbook.js b/assets/js/handbook.jsdeleted file mode 100644index 4feb4d82..00000000--- a/assets/js/handbook.js+++ /dev/null@@ -1,329 +0,0 @@-/* Animation Handbook — shared behaviour for the demo pages.- * Builds the prompt box (settings line + Copy prompt), "Read more" with the- * explanation from the demo's README.md, and the stage's Replay button.- * The pure helpers are exported for tests/handbook.test.js. */-(function (root, factory) {- var api = factory();- if (typeof module === 'object' && module.exports) { module.exports = api; return; }- root.Handbook = api;- if (typeof document === 'undefined') return;- if (document.readyState === 'loading') {- document.addEventListener('DOMContentLoaded', function () { api.boot(document, root); });- } else {- api.boot(document, root);- }-})(typeof self !== 'undefined' ? self : this, function () {- 'use strict';-- /* ---------- Pure helpers ---------- */-- function escapeHtml(s) {- return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');- }-- // Text with Markdown code and bold markers removed, safe to insert as HTML.- function plain(s) {- return escapeHtml(String(s).replace(/`/g, '').replace(/\*\*/g, ''));- }-- // Allow only relative paths, "#" anchors and http(s) URLs as link targets; anything else- // (e.g. a javascript: URL) is rejected and rendered as plain link text instead.- function isSafeHref(href) {- return /^(?:https?:|#|\.{0,2}\/|[\w.-]+(?:\/|$))/i.test(href) &&- !/^[a-z][a-z0-9+.-]*:/i.test(href.replace(/^https?:/i, ''));- }-- // Inline Markdown from README prose. Inline code becomes plain text: the site shows no code.- function inline(md) {- return escapeHtml(md)- .replace(/`([^`]+)`/g, '$1')- .replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, function (m, label, href) {- return isSafeHref(href) ? '<a href="' + href + '">' + label + '</a>' : label;- })- .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')- .replace(/\*([^*\n]+)\*/g, '<em>$1</em>');- }-- // A README split into { "What it is": "...", ... } by its "## " headings.- function sections(md) {- var out = {}, current = null, buf = [];- String(md).replace(/\r\n?/g, '\n').split('\n').forEach(function (line) {- var m = /^##\s+(.+?)\s*$/.exec(line);- if (m) {- if (current) out[current] = buf.join('\n').trim();- current = m[1];- buf = [];- } else if (current) {- buf.push(line);- }- });- if (current) out[current] = buf.join('\n').trim();- return out;- }-- function paragraphs(text) {- return String(text || '').split(/\n\s*\n/)- .map(function (p) { return p.trim(); })- .filter(Boolean)- .map(function (p) { return '<p>' + inline(p.replace(/\s*\n\s*/g, ' ')) + '</p>'; })- .join('');- }-- function bullets(text) {- return String(text || '').split('\n')- .filter(function (l) { return /^\s*[-*]\s+/.test(l); })- .map(function (l) { return inline(l.replace(/^\s*[-*]\s+/, '')); });- }-- // "Duration (`--dur`)" becomes "Duration": parentheticals that hold code are dropped.- function cleanName(s) {- return plain(String(s).replace(/\s*\(`[^`]*`[^)]*\)/g, ''));- }-- // The Key parameters table as [{ name, value, effect }], without its header and divider rows.- function table(text) {- var rows = String(text || '').split('\n')- .filter(function (l) { return /^\s*\|/.test(l); })- .map(function (l) {- return l.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map(function (c) { return c.trim(); });- });- return rows.slice(1)- .filter(function (r) { return !r.every(function (c) { return /^:?-{2,}:?$/.test(c); }); })- .map(function (r) { return { name: cleanName(r[0] || ''), value: plain(r[1] || ''), effect: inline(r[2] || '') }; });- }-- // "- [Name](../slug/) — description" lines as [{ name, href, desc }].- function seeAlso(text) {- return String(text || '').split('\n').map(function (l) {- var m = /^\s*[-*]\s+\[([^\]]+)\]\(([^)\s]+)\)\s*(?:[—–-]\s*(.*))?$/.exec(l);- return m ? { name: plain(m[1]), href: m[2], desc: m[3] ? inline(m[3]) : '' } : null;- }).filter(Boolean);- }-- function settingsLine(items) {- return (items || [])- .filter(function (i) { return i && i.label && i.value; })- .map(function (i) { return i.label + ' ' + i.value; })- .join(', ');- }-- /* ---------- Page behaviour ---------- */-- var CONTROLS = 'input[type=range], input[type=checkbox], select, .seg, .swatches';-- function text(node) { return node ? node.textContent.replace(/\s+/g, ' ').trim() : ''; }-- function labelFor(doc, control) {- var own = control.getAttribute('data-hb-label');- if (own) return own;- var by = control.getAttribute('aria-labelledby');- if (by && doc.getElementById(by)) return text(doc.getElementById(by));- var tog = control.closest('.tog');- if (tog) return text(tog.querySelector('span') || tog);- for (var p = control.previousElementSibling; p; p = p.previousElementSibling) {- if (p.classList.contains('lbl')) return text(p);- }- return control.parentElement ? text(control.parentElement.querySelector(':scope > .lbl')) : '';- }-- function valueFor(control) {- if (control.matches('input[type=range]')) {- var row = control.closest('.sr');- var shown = row && row.querySelector('.sv');- return shown ? text(shown) : control.value;- }- if (control.matches('input[type=checkbox]')) return control.checked ? 'on' : 'off';- if (control.matches('select')) return control.selectedOptions[0] ? text(control.selectedOptions[0]) : control.value;- var active = control.querySelector('.on');- return active ? (active.getAttribute('aria-label') || text(active)) : '';- }-- // The demo's current settings in page order, skipping playback controls and anything marked data-hb-skip.- function readSettings(doc, scope) {- return Array.prototype.filter.call(scope.querySelectorAll(CONTROLS), function (control) {- return !control.closest('[data-hb-skip], [hidden], .btn-row') && control.getClientRects().length > 0;- }).map(function (control) {- return { label: labelFor(doc, control), value: valueFor(control) };- });- }-- function make(doc, tag, className, html) {- var node = doc.createElement(tag);- node.className = className;- if (html) node.innerHTML = html;- return node;- }-- function renderAbout(md) {- var s = sections(md), html = '';- if (s['What it is']) html += '<section><h2>What it is</h2>' + paragraphs(s['What it is']) + '</section>';- var uses = bullets(s['When to use it']);- if (uses.length) {- html += '<section><h2>When to use it</h2><ul>' +- uses.map(function (u) { return '<li>' + u + '</li>'; }).join('') + '</ul></section>';- }- var params = table(s['Key parameters']);- if (params.length) {- html += '<section><h2>What the controls do</h2><dl>' + params.map(function (p) {- return '<dt>' + p.name + (p.value ? '<small>default ' + p.value + '</small>' : '') + '</dt><dd>' + p.effect + '</dd>';- }).join('') + '</dl></section>';- }- return { html: html, related: seeAlso(s['See also']) };- }-- function loadReadme(doc, win, details) {- var about = details.querySelector('.hb-about');- var fallback = '<p class="hb-note">The full explanation is in <a href="README.md">README.md</a>.</p>';- if (win.location.protocol === 'file:' || !win.fetch) { about.innerHTML = fallback; return; }- win.fetch('README.md').then(function (res) {- if (!res.ok) throw new Error('README ' + res.status);- return res.text();- }).then(function (md) {- var out = renderAbout(md);- about.innerHTML = out.html || fallback;- if (!out.related.length) return;- var box = details.querySelector('.hb-related');- box.querySelector('.hb-rel-list').innerHTML = out.related.map(function (r) {- return '<a class="hb-rel" href="' + escapeHtml(r.href) + '"><span><b>' + r.name + '</b>' +- (r.desc ? '<small>' + r.desc + '</small>' : '') + '</span><i aria-hidden="true">→</i></a>';- }).join('');- box.hidden = false;- }).catch(function () { about.innerHTML = fallback; });- }-- function boot(doc, win) {- var view = doc.querySelector('.hb-view');- var side = view && view.querySelector('.hb-side');- var promptEl = side && side.querySelector('.hb-prompt');- if (!promptEl) return;-- var settings = side.querySelector('.hb-settings');- var title = text(side.querySelector('h1'));- var promptText = text(promptEl);- var reduce = win.matchMedia ? win.matchMedia('(prefers-reduced-motion: reduce)') : null;- var lines = [];-- function currentLine() { return settings ? settingsLine(readSettings(doc, settings)) : ''; }- function copyText() {- var line = currentLine();- return promptText + (line ? '\n\nSettings from the demo: ' + line + '.' : '');- }- function refreshLines() {- var line = currentLine();- lines.forEach(function (node) { node.textContent = line ? 'Your settings: ' + line : ''; node.hidden = !line; });- }- function settingsNode() { var node = make(doc, 'p', 'hb-set'); lines.push(node); return node; }- function copyButton() {- var button = make(doc, 'button', 'hb-copy', 'Copy prompt');- button.type = 'button';- button.setAttribute('aria-live', 'polite');- button.addEventListener('click', function () {- function show(label) {- button.textContent = label;- win.setTimeout(function () { button.textContent = 'Copy prompt'; }, 1500);- }- function selectInstead() {- var range = doc.createRange();- range.selectNodeContents(promptEl);- var selection = win.getSelection();- selection.removeAllRanges();- selection.addRange(range);- show(/Mac|iPhone|iPad/.test(win.navigator.platform || win.navigator.userAgent) ? 'Press ⌘C to copy' : 'Press Ctrl+C to copy');- }- var clip = win.navigator.clipboard;- if (clip && clip.writeText) clip.writeText(copyText()).then(function () { show('Copied ✓'); }, selectInstead);- else selectInstead();- });- return button;- }- function scrollBehavior() { return reduce && reduce.matches ? 'auto' : 'smooth'; }-- // Prompt box: three-line preview, the live settings line and Copy prompt.- promptEl.classList.add('hb-clamp');- var box = promptEl.closest('.hb-prompt-box') || promptEl.parentElement;- box.appendChild(settingsNode());- box.appendChild(copyButton());-- // Read more: the explanation, full prompt and related animations below the first screen.- var details = make(doc, 'section', 'hb-details',- '<div class="hb-details-in">' +- '<a class="hb-back" href="#top">↑ Back to the demo</a>' +- '<div class="hb-about"><p class="hb-note">Loading the explanation…</p></div>' +- '<div class="hb-extra">' +- '<section><h2>Full prompt</h2><div class="hb-full"><p class="hb-full-text"></p></div></section>' +- '<section class="hb-related" hidden><h2>Related animations</h2><div class="hb-rel-list"></div></section>' +- '</div>' +- '</div>');- details.id = 'details';- details.hidden = true;- details.tabIndex = -1;- details.setAttribute('aria-label', 'About ' + title);- details.querySelector('.hb-full-text').textContent = promptText;- var full = details.querySelector('.hb-full');- full.appendChild(settingsNode());- full.appendChild(copyButton());- view.insertAdjacentElement('afterend', details);-- var more = make(doc, 'button', 'hb-more');- more.type = 'button';- more.setAttribute('aria-controls', 'details');- (side.querySelector('.hb-take') || side).appendChild(more);- function setOpen(open, scroll) {- details.hidden = !open;- more.setAttribute('aria-expanded', String(open));- more.textContent = open ? 'Show less ↑' : 'Read more about ' + title + ' ↓';- if (open && scroll) {- details.scrollIntoView({ behavior: scrollBehavior(), block: 'start' });- details.focus({ preventScroll: true });- }- }- setOpen(false, false);- more.addEventListener('click', function () { setOpen(details.hidden, true); });- details.querySelector('.hb-back').addEventListener('click', function (e) {- e.preventDefault();- win.scrollTo({ top: 0, behavior: scrollBehavior() });- });- if (win.location.hash === '#details') win.setTimeout(function () { setOpen(true, true); }, 300);- loadReadme(doc, win, details);-- // Replay, auto-play and "changing a setting replays it" all press the demo's own buttons.- var replayCtl = doc.querySelector('[data-hb-replay]');- var resetCtl = doc.querySelector('[data-hb-reset]');- var loopCtl = doc.querySelector('[data-hb-loop]');- function replay() {- if (resetCtl) resetCtl.click();- win.requestAnimationFrame(function () {- win.requestAnimationFrame(function () { replayCtl.click(); });- });- }- if (replayCtl) {- var replayButton = make(doc, 'button', 'hb-replay', '↻ Replay');- replayButton.type = 'button';- replayButton.setAttribute('aria-label', 'Replay the animation');- replayButton.addEventListener('click', replay);- view.insertBefore(replayButton, side);- if (doc.body.hasAttribute('data-hb-autoplay')) win.setTimeout(function () { replayCtl.click(); }, 400);- }-- var timer = 0;- function onSettingsChange(e) {- var target = e.target;- if ((e.type === 'click' || e.type === 'keyup') && !target.closest('.seg, .swatches')) return;- if (target.closest('.btn-row, [data-hb-loop]')) return;- win.setTimeout(refreshLines, 0);- if (!replayCtl || (loopCtl && loopCtl.checked)) return;- win.clearTimeout(timer);- timer = win.setTimeout(replay, 250);- }- if (settings) {- ['input', 'change', 'click', 'keyup'].forEach(function (type) { settings.addEventListener(type, onSettingsChange); });- }- refreshLines();- }-- return {- escapeHtml: escapeHtml, plain: plain, inline: inline, sections: sections, paragraphs: paragraphs,- bullets: bullets, cleanName: cleanName, table: table, seeAlso: seeAlso, settingsLine: settingsLine,- readSettings: readSettings, boot: boot- };-});diff --git a/samples/demo-page-design.html b/samples/demo-page-design.htmldeleted file mode 100644index 5b4d617a..00000000--- a/samples/demo-page-design.html+++ /dev/null@@ -1,280 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>-<meta charset="UTF-8">-<meta name="viewport" content="width=device-width, initial-scale=1.0">-<title>Bounce In — demo page design sample</title>-<link rel="icon" type="image/svg+xml" href="../favicon.svg">-<style>-@font-face{font-family:'Bricolage';src:url('fonts/brico-700.woff2') format('woff2');font-weight:700;font-display:swap}-@font-face{font-family:'Bricolage';src:url('fonts/brico-800.woff2') format('woff2');font-weight:800;font-display:swap}-@font-face{font-family:'PlexMono';src:url('fonts/plex-400.woff2') format('woff2');font-weight:400;font-display:swap}-@font-face{font-family:'PlexMono';src:url('fonts/plex-500.woff2') format('woff2');font-weight:500;font-display:swap}-:root{- --bg:#0b0b0d;--panel:#111114;--panel-2:#0d0d10;--stage:#08080a;- --ink:#f4f4f2;--ink-dim:#adadb2;--muted:#77777e;--line:rgba(255,255,255,.085);- --accent:#5fd88a;--accent-soft:rgba(95,216,138,.12);- --disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;- --bar:48px;--dur:1100ms;-}-*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}-html{scroll-behavior:smooth}-body{background:var(--bg);color:var(--ink);font-family:var(--mono);font-size:13px;-webkit-font-smoothing:antialiased}-a{color:inherit}-button{font-family:var(--mono);cursor:pointer}-:focus-visible{outline:2px solid var(--accent);outline-offset:2px}--.bar{position:sticky;top:0;z-index:10;height:var(--bar);display:flex;align-items:center;justify-content:space-between;- padding:0 clamp(6px,1.6vw,16px);background:rgba(11,11,13,.88);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);- border-bottom:1px solid var(--line);font-size:11px;letter-spacing:.1em;text-transform:uppercase}-.bar a{color:var(--muted);text-decoration:none;display:inline-flex;align-items:center;gap:6px;min-height:44px;min-width:44px;justify-content:center;padding:0 8px;border-radius:6px}-.bar a:hover{color:var(--ink)}-.bar .home{color:var(--ink);font-weight:500}-.bar nav{display:flex}--.view{display:grid;grid-template-columns:minmax(0,1fr) clamp(300px,27vw,370px);gap:clamp(10px,1.2vw,16px);- padding:clamp(10px,1.2vw,16px);height:calc(var(--vh,100dvh) - var(--bar));min-height:560px}-.stage{position:relative;min-height:0;border:1px solid var(--line);border-radius:10px;background:var(--stage);- display:flex;align-items:center;justify-content:center;overflow:hidden}-.stage::before{content:"";position:absolute;inset:0;pointer-events:none;- background-image:radial-gradient(rgba(255,255,255,.05) 1px,transparent 1.4px);background-size:24px 24px}-.card{position:relative;background:#161b22;border:1px solid #30363d;border-radius:14px;padding:clamp(28px,4vw,48px);- text-align:center;max-width:300px;opacity:0;transform:scale(.3) translateY(40px)}-.card.in{animation:bounce-in var(--dur) ease forwards}-.card.still{opacity:1;transform:none}-.card-icon{font-size:36px;margin-bottom:14px}-.card-title{font-family:var(--disp);font-weight:700;font-size:clamp(18px,2vw,22px);margin-bottom:8px}-.card-sub{font-size:11px;color:var(--muted);line-height:1.65}-.replay{position:absolute;right:12px;bottom:12px;min-height:44px;padding:0 16px;border-radius:999px;border:1px solid var(--line);- background:rgba(17,17,20,.85);color:var(--ink-dim);font-size:12px;display:inline-flex;align-items:center;gap:8px}-.replay:hover{color:var(--ink);border-color:rgba(255,255,255,.25)}--.panel{min-height:0;overflow-y:auto;background:var(--panel);border:1px solid var(--line);border-radius:10px;- padding:18px;display:flex;flex-direction:column;gap:18px}-.meta{font-size:10px;letter-spacing:.16em;text-transform:uppercase;color:var(--accent)}-h1{font-family:var(--disp);font-weight:800;font-size:clamp(28px,2.6vw,36px);letter-spacing:-.02em;line-height:1;margin-top:8px}-.lede{color:var(--ink-dim);font-size:12.5px;line-height:1.6;margin-top:8px}-.sec-h{display:flex;justify-content:space-between;align-items:baseline;gap:8px;font-size:10px;letter-spacing:.16em;- text-transform:uppercase;color:var(--muted);margin-bottom:8px}-.sec-h span{letter-spacing:.04em;text-transform:none;font-size:11px}-.ctl+.ctl{margin-top:6px}-.ctl-row{display:flex;justify-content:space-between;font-size:12px;color:var(--ink-dim)}-.ctl-row b{color:var(--ink);font-weight:500}-input[type=range]{width:100%;accent-color:var(--accent);min-height:30px;cursor:pointer}-.seg{display:flex;gap:4px;margin-top:6px}-.seg button{flex:1;min-height:36px;border:1px solid var(--line);border-radius:6px;background:none;color:var(--muted);font-size:12px}-.seg button.on{border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}-.switch{display:flex;align-items:center;justify-content:space-between;min-height:40px;margin-top:6px;font-size:12px;color:var(--ink-dim);cursor:pointer}-.switch input{appearance:none;-webkit-appearance:none;width:36px;height:20px;border-radius:999px;background:#2a2a30;position:relative;cursor:pointer;transition:background .2s}-.switch input::after{content:"";position:absolute;top:3px;left:3px;width:14px;height:14px;border-radius:50%;background:var(--ink);transition:transform .2s}-.switch input:checked{background:var(--accent)}-.switch input:checked::after{transform:translateX(16px);background:#0b0b0d}--.prompt{border:1px solid var(--line);border-radius:8px;padding:12px;background:var(--panel-2)}-.brief{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;line-height:1.6;font-size:12.5px}-.set{margin-top:8px;font-size:11px;line-height:1.5;color:var(--accent)}-.copy{margin-top:10px;width:100%;min-height:44px;border:0;border-radius:6px;background:var(--ink);color:#0b0b0d;font-size:12px;font-weight:500;letter-spacing:.04em}-.copy:hover{background:#fff}-.more{width:100%;min-height:44px;border:1px solid var(--line);border-radius:6px;background:none;color:var(--ink-dim);font-size:12px}-.more:hover{color:var(--ink);border-color:rgba(255,255,255,.25)}--.details{border-top:1px solid var(--line);margin-top:8px}-.d-in{max-width:1120px;margin:0 auto;padding:clamp(28px,4vw,56px) clamp(16px,3vw,32px) 96px;- display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:clamp(28px,4vw,64px)}-.back{grid-column:1/-1;justify-self:start;margin-bottom:calc(-1 * clamp(12px,2.5vw,40px));color:var(--muted);text-decoration:none;font-size:11px;letter-spacing:.1em;text-transform:uppercase;min-height:44px;display:inline-flex;align-items:center}-.back:hover{color:var(--ink)}-.d-in h2{font-family:var(--disp);font-weight:700;font-size:20px;letter-spacing:-.01em;margin-bottom:10px}-.d-in section+section{margin-top:34px}-.d-in p,.d-in li,.d-in dd{color:var(--ink-dim);line-height:1.75;font-size:13px}-.d-in ul{list-style:none}-.d-in li{padding-left:18px;position:relative}-.d-in li+li{margin-top:4px}-.d-in li::before{content:"–";position:absolute;left:0;color:var(--accent)}-dl{display:grid;grid-template-columns:minmax(120px,auto) 1fr;gap:12px 20px}-dt{color:var(--ink);line-height:1.5}-dt small{display:block;color:var(--muted);font-size:11px}-.full{border:1px solid var(--line);border-radius:10px;padding:16px;background:var(--panel)}-.full p{color:var(--ink);line-height:1.7}-.rel{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--line);border-radius:8px;text-decoration:none}-.rel+.rel{margin-top:8px}-.rel:hover{border-color:rgba(255,255,255,.25)}-.rel b{font-family:var(--disp);font-weight:700;font-size:16px}-.rel small{display:block;color:var(--muted);font-size:11.5px;margin-top:2px;line-height:1.5}-.rel i{font-style:normal;color:var(--muted)}--@media(max-width:1024px){.view{grid-template-columns:minmax(0,1fr) 300px}}-@media(max-width:760px){.d-in{grid-template-columns:1fr}}-@media(max-width:600px){- .bar .name{display:none}- .view{grid-template-columns:1fr;height:auto;min-height:0}- .stage{height:calc(var(--vhs,100svh) * .56);min-height:320px}- .panel{overflow:visible}- input[type=range]{min-height:44px}- .seg button{min-height:44px}- .switch{min-height:44px}-}-@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}.card.in{animation:none;opacity:1;transform:none}}-</style>-<style id="kf"></style>-</head>-<body>-<div class="bar">- <a class="home" href="../">← <span>Animation Handbook</span></a>- <nav aria-label="Other animations">- <a href="../animations/02-entrance-and-exit/flip-in/" rel="prev" aria-label="Previous: Flip In">‹ <span class="name">Flip In</span></a>- <a href="../animations/02-entrance-and-exit/rotate-in/" rel="next" aria-label="Next: Rotate In"><span class="name">Rotate In</span> ›</a>- </nav>-</div>--<main class="view">- <div class="stage">- <div class="card" id="card">- <div class="card-icon">◈</div>- <div class="card-title">Bounce Landing</div>- <div class="card-sub">Overshoots, dips, then settles, like something landing with momentum.</div>- </div>- <button class="replay" id="replay" type="button">↻ Replay</button>- </div>-- <aside class="panel">- <div>- <div class="meta">02.02 · Entrance & Exit</div>- <h1>Bounce In</h1>- <p class="lede">Overshoots its final size and position, then springs back to rest.</p>- </div>-- <section aria-label="Settings">- <div class="sec-h">Settings</div>- <div class="ctl"><div class="ctl-row"><label for="ov">Overshoot</label><b id="ov-v">60%</b></div><input type="range" id="ov" min="0" max="100" step="5" value="60"></div>- <div class="ctl"><div class="ctl-row"><label for="du">Duration</label><b id="du-v">1100 ms</b></div><input type="range" id="du" min="300" max="2000" step="100" value="1100"></div>- <div class="ctl"><div class="ctl-row"><span id="bo-l">Bounces</span></div>- <div class="seg" role="group" aria-labelledby="bo-l"><button type="button" data-b="1" class="on">1</button><button type="button" data-b="2">2</button><button type="button" data-b="3">3</button></div></div>- <label class="switch">Fade in while bouncing<input type="checkbox" id="fa" checked></label>- </section>-- <section class="prompt" aria-label="Prompt">- <div class="sec-h">Prompt <span>paste into any AI tool</span></div>- <p class="brief" id="brief"></p>- <p class="set" id="set"></p>- <button class="copy" type="button" data-copy>Copy prompt</button>- </section>-- <button class="more" id="more" type="button" aria-expanded="false" aria-controls="details">Read more about Bounce In ↓</button>- </aside>-</main>--<div class="details" id="details" hidden>- <div class="d-in">- <a class="back" href="#top" id="back">↑ Back to the demo</a>- <div>- <section>- <h2>What it is</h2>- <p>Bounce In brings an element up from small and low, overshoots its final size and position, then springs back to rest, like something landing with momentum. A real bounce isn't one smooth curve: it's a few hand-placed steps, each going a little past the target and coming back.</p>- </section>- <section>- <h2>When to use it</h2>- <ul>- <li>Playful confirmations: a success badge, a "message sent" check, an added-to-cart chip</li>- <li>Toasts, tooltips and popovers where a little life makes the appearance feel responsive</li>- <li>Game UI, kids' products and brands whose tone welcomes personality</li>- <li>Any single element small enough that an energetic entrance won't feel heavy</li>- </ul>- </section>- <section>- <h2>What the controls do</h2>- <dl>- <dt>Overshoot<small>default 60%</small></dt><dd>How far past full size it grows. 0% means no bounce, 100% is exaggerated.</dd>- <dt>Duration<small>default 1100 ms</small></dt><dd>Bounces need room to breathe. Too short and the spring reads as a jitter.</dd>- <dt>Bounces<small>default 1</small></dt><dd>How many times it overshoots. Almost always one; more looks cartoonish.</dd>- <dt>Fade in<small>default on</small></dt><dd>Whether it fades in while it bounces, or is visible from the start.</dd>- </dl>- </section>- </div>- <div>- <section>- <h2>Full prompt</h2>- <div class="full">- <p id="full"></p>- <p class="set" id="set2"></p>- <button class="copy" type="button" data-copy>Copy prompt</button>- </div>- </section>- <section>- <h2>Related animations</h2>- <a class="rel" href="../animations/02-entrance-and-exit/scale-in/"><span><b>Scale In</b><small>The same entrance without the overshoot</small></span><i>→</i></a>- <a class="rel" href="../animations/02-entrance-and-exit/rotate-in/"><span><b>Rotate In</b><small>A springy ease with a spin, good for icons</small></span><i>→</i></a>- <a class="rel" href="../animations/02-entrance-and-exit/slide-in/"><span><b>Slide In</b><small>Enters from the side and also suits a spring</small></span><i>→</i></a>- </section>- </div>- </div>-</div>--<script>-const PROMPT = 'Add a bounce-in entrance animation to [the element you want to animate]. When it appears, it should start small and a little below its final spot, grow slightly past full size, dip just under it, then settle, as if it landed with a small spring. Fade it in at the same time. Keep it to one bounce, because more than that looks cartoonish. Animate only transform and opacity so it stays smooth. If the visitor has reduced motion turned on, show the element without the bounce.';-const $ = id => document.getElementById(id);-const card = $('card'), ov = $('ov'), du = $('du'), fa = $('fa');-const reduce = matchMedia('(prefers-reduced-motion: reduce)');-let bounces = 1, timer;--function settings(sep, nbsp) {- const s = ['overshoot ' + ov.value + '%', 'duration ' + du.value + ' ms', bounces + (bounces > 1 ? ' bounces' : ' bounce'), 'fade ' + (fa.checked ? 'on' : 'off')];- return (nbsp ? s.map(x => x.replace(/ /g, ' ')) : s).join(sep);-}-function buildKeyframes() {- const t = ov.value / 100, stops = { 1: [55, 80], 2: [45, 65, 80, 90], 3: [40, 57, 70, 80, 88, 94] }[bounces];- const over = [.15, .06, .025], under = [.07, .03, .012], upY = [-8, -4, -2], downY = [3, 1.5, .8];- let k = '@keyframes bounce-in{0%{opacity:' + (fa.checked ? 0 : 1) + ';transform:scale(.3) translateY(40px)}';- stops.forEach((p, i) => {- const n = i >> 1, up = i % 2 === 0;- const s = up ? 1 + t * over[n] : 1 - t * under[n], y = (up ? upY[n] : downY[n]) * t;- k += p + '%{' + (i === 0 ? 'opacity:1;' : '') + 'transform:scale(' + s.toFixed(3) + ') translateY(' + y.toFixed(1) + 'px)}';- });- $('kf').textContent = k + '100%{opacity:1;transform:scale(1) translateY(0)}}';- document.documentElement.style.setProperty('--dur', du.value + 'ms');-}-function play() {- if (reduce.matches) { card.classList.add('still'); return; }- card.classList.remove('in', 'still'); void card.offsetWidth; card.classList.add('in');-}-function update(replay) {- $('ov-v').textContent = ov.value + '%';- $('du-v').textContent = du.value + ' ms';- $('set').textContent = $('set2').textContent = '+ your settings: ' + settings(' · ', true);- buildKeyframes();- if (replay) { clearTimeout(timer); timer = setTimeout(play, 250); }-}-[ov, du, fa].forEach(el => el.addEventListener('input', () => update(true)));-document.querySelectorAll('.seg button').forEach(b => b.addEventListener('click', () => {- document.querySelectorAll('.seg button').forEach(x => x.classList.toggle('on', x === b));- bounces = +b.dataset.b; update(true);-}));-$('replay').addEventListener('click', play);--$('brief').textContent = $('full').textContent = PROMPT;-document.querySelectorAll('[data-copy]').forEach(btn => btn.addEventListener('click', () => {- const text = PROMPT + '\n\nSettings from the demo: ' + settings(', ') + '.';- const done = ok => { btn.textContent = ok ? 'Copied ✓' : 'Copy failed'; setTimeout(() => btn.textContent = 'Copy prompt', 1500); };- navigator.clipboard.writeText(text).then(() => done(true), () => done(false));-}));--const more = $('more'), details = $('details');-function openDetails(open, scroll) {- details.hidden = !open;- more.setAttribute('aria-expanded', String(open));- more.textContent = open ? 'Show less ↑' : 'Read more about Bounce In ↓';- if (open && scroll) details.scrollIntoView({ block: 'start', behavior: scroll });-}-more.addEventListener('click', () => openDetails(details.hidden, reduce.matches ? 'instant' : 'smooth'));-$('back').addEventListener('click', e => { e.preventDefault(); scrollTo({ top: 0 }); });--update(false);-if (location.hash === '#details') setTimeout(() => openDetails(true, 'instant'), 300);-// Screenshot helpers for this design sample: ?frame=860 pins the viewport height, ?open shows the details without scrolling.-const q = new URLSearchParams(location.search);-if (q.has('frame')) ['--vh', '--vhs'].forEach(v => document.documentElement.style.setProperty(v, q.get('frame') + 'px'));-if (q.has('open')) openDetails(true, false);-if (q.has('still')) card.classList.add('still');-setTimeout(play, 450);-</script>-</body>-</html>diff --git a/tests/fixtures/legacy-demo.html b/tests/fixtures/legacy-demo.htmldeleted file mode 100644index 60230ca0..00000000--- a/tests/fixtures/legacy-demo.html+++ /dev/null@@ -1,41 +0,0 @@-<!DOCTYPE html>-<html lang="en">-<head>- <meta charset="UTF-8">- <title>Sample Demo — Animation Handbook</title>- <style>- @font-face{font-family:'Bricolage';src:url('../../../assets/fonts/brico-700.woff2') format('woff2');font-weight:700;font-display:swap}- @font-face{font-family:'PlexMono';src:url('../../../assets/fonts/plex-400.woff2') format('woff2');font-weight:400;font-display:swap}- :root{--bg:#0b0b0d;--ui-accent:#5fd88a;--disp:'Bricolage','Arial Narrow',sans-serif;--mono:'PlexMono',ui-monospace,Menlo,Consolas,monospace;--stage-h:620px}- body{padding:24px}- </style>-<style id="ah-inject">-.ah-bar{position:fixed}-</style>-</head>-<body>-<div class="ah-bar" role="navigation" aria-label="Animation Handbook"><a class="ah-home" href="../../../">← Animation Handbook</a><span class="ah-actions"><a class="ah-hideSm" href="../a/" rel="prev" title="Previous">‹ Prev</a><button type="button" id="ah-copy" class="ah-hideSm">Copy source</button></span></div>-<header>- <h1>Sample Demo</h1>- <p>Uses `code` words in its summary.</p>-</header>-<div class="layout">- <div class="stage"><div class="card" id="card">Card</div></div>- <aside>- <p class="note">A technical note that now lives in the README.</p>- <div><div class="lbl" id="dur-lbl">Duration</div>- <div class="sr"><input type="range" id="dur-sl" aria-labelledby="dur-lbl" min="100" max="2000" value="600"><span class="sv" id="dur-v">600ms</span></div>- </div>- <label class="tog" for="loop-tog"><input type="checkbox" id="loop-tog"><span>Auto-loop</span></label>- <div class="btn-row">- <button class="act pri" id="btn-in">Play in</button>- <button class="act" id="btn-rst">Reset</button>- </div>- </aside>-</div>-<script>- document.getElementById('btn-in').addEventListener('click',()=>{});-</script>-<script>(function(){var b=document.getElementById("ah-copy");if(!b)return;})();</script>-</body>-</html>diff --git a/tests/handbook.test.js b/tests/handbook.test.jsdeleted file mode 100644index cf6eea06..00000000--- a/tests/handbook.test.js+++ /dev/null@@ -1,76 +0,0 @@-// Unit tests for the pure helpers in assets/js/handbook.js.-// Run from the repo root: node --test "tests/*.test.js"-const test = require('node:test');-const assert = require('node:assert/strict');-const HB = require('../assets/js/handbook.js');--test('escapeHtml escapes markup characters', () => {- assert.equal(HB.escapeHtml('<a href="x">&</a>'), '<a href="x">&</a>');-});--test('plain drops code and bold markers and escapes', () => {- assert.equal(HB.plain('`ease-out` **fast** <b>'), 'ease-out fast <b>');-});--test('inline shows code as plain text and renders links, bold and italics', () => {- assert.equal(HB.inline('Use `opacity` on **one** *hero* [card](../scale-in/)'),- 'Use opacity on <strong>one</strong> <em>hero</em> <a href="../scale-in/">card</a>');- assert.equal(HB.inline('a < b'), 'a < b');-});--test('inline only links relative, anchor and http(s) URLs', () => {- assert.ok(!HB.inline('[x](javascript:alert(1))').includes('<a'), 'no link for javascript: URLs');- assert.equal(HB.inline('[a](https://example.com/p)'), '<a href="https://example.com/p">a</a>');- assert.equal(HB.inline('[b](#top)'), '<a href="#top">b</a>');- assert.equal(HB.inline('[c](../scale-in/)'), '<a href="../scale-in/">c</a>');- assert.equal(HB.inline('(see [Scale In](../scale-in/))'), '(see <a href="../scale-in/">Scale In</a>)');-});--test('sections splits a README by its ## headings', () => {- const md = '# Title\r\n\r\n## What it is\r\nLine one\r\nline two\r\n\r\n## When to use it\r\n- A\r\n- B\r\n';- assert.deepEqual(HB.sections(md), { 'What it is': 'Line one\nline two', 'When to use it': '- A\n- B' });-});--test('sections keeps ### lines inside the section they belong to', () => {- assert.deepEqual(HB.sections('## A\n### not a section\nx'), { A: '### not a section\nx' });-});--test('paragraphs joins wrapped lines and splits on blank lines', () => {- assert.equal(HB.paragraphs('One\ntwo.\n\nThree `x`.'), '<p>One two.</p><p>Three x.</p>');- assert.equal(HB.paragraphs(undefined), '');-});--test('bullets returns the list items as inline HTML', () => {- assert.deepEqual(HB.bullets('- Hero **copy**\nnot a bullet\n- Toasts'), ['Hero <strong>copy</strong>', 'Toasts']);-});--test('cleanName drops parentheticals that hold code', () => {- assert.equal(HB.cleanName('Duration (`--dur`)'), 'Duration');- assert.equal(HB.cleanName('Perspective (`--persp`, on parent)'), 'Perspective');- assert.equal(HB.cleanName('Two curtains (split)'), 'Two curtains (split)');-});--test('table reads Key parameters rows and skips the header and divider', () => {- const md = '| Parameter | Default | Effect |\n|-----------|---------|--------|\n' +- '| Duration (`--dur`) | 600ms | Under 150ms **barely** registers |\n| Easing | `ease-out` | Settles gently |';- assert.deepEqual(HB.table(md), [- { name: 'Duration', value: '600ms', effect: 'Under 150ms <strong>barely</strong> registers' },- { name: 'Easing', value: 'ease-out', effect: 'Settles gently' }- ]);- assert.deepEqual(HB.table(''), []);-});--test('seeAlso reads name, link and description', () => {- const md = '- [Scale In](../scale-in/) — the same entrance without the overshoot\n- [Blur In](../blur-in/)\nText';- assert.deepEqual(HB.seeAlso(md), [- { name: 'Scale In', href: '../scale-in/', desc: 'the same entrance without the overshoot' },- { name: 'Blur In', href: '../blur-in/', desc: '' }- ]);-});--test('settingsLine joins label and value pairs and skips empty ones', () => {- assert.equal(HB.settingsLine([- { label: 'Duration', value: '600ms' }, { label: 'Easing', value: 'Ease out' }, { label: 'Mode', value: '' }- ]), 'Duration 600ms, Easing Ease out');- assert.equal(HB.settingsLine([]), '');-});diff --git a/tests/migrate.test.js b/tests/migrate.test.jsdeleted file mode 100644index 9c85596b..00000000--- a/tests/migrate.test.js+++ /dev/null@@ -1,72 +0,0 @@-// Tests for tools/migrate-demo.js. Run from the repo root: node --test "tests/*.test.js"-const test = require('node:test');-const assert = require('node:assert/strict');-const fs = require('node:fs');-const path = require('node:path');-const { migrate } = require('../tools/migrate-demo.js');--const legacy = fs.readFileSync(path.join(__dirname, 'fixtures', 'legacy-demo.html'), 'utf8');-const cfg = { category: '02-entrance-and-exit', name: 'Entrance & Exit' };-const demo = {- slug: 'sample-demo', number: '02.12',- prev: { href: '../flip-in/', name: 'Flip In' }, next: null,- autoplay: true,- attrs: { 'btn-in': 'data-hb-replay', 'btn-rst': 'data-hb-reset', 'loop-tog': 'data-hb-skip data-hb-loop' },- edits: [['<span>Auto-loop</span>', '<span>Loop it</span>']],- lede: 'Moves a card into view.',- prompt: 'Add a <b> & [x] prompt.'-};-const out = migrate(legacy, cfg, demo);--test('removes the legacy chrome, fonts and font variables', () => {- for (const gone of ['ah-inject', 'ah-bar', 'ah-copy', 'Copy source', 'Bricolage', 'PlexMono', '--disp', '--mono', 'class="note"', 'class="layout"', '<header>']) {- assert.ok(!out.includes(gone), `still contains ${gone}`);- }-});--test('links the shared stylesheet and script at the end of <head>', () => {- assert.ok(out.includes('<link rel="stylesheet" href="../../../assets/css/handbook.css">\n<script src="../../../assets/js/handbook.js" defer></script>\n</head>'));-});--test('marks the body and builds the top bar', () => {- assert.ok(out.includes('<body class="hb" data-hb-autoplay>'));- assert.ok(out.includes('<a class="hb-home" href="../../../">← <span>Animation Handbook</span></a>'));- assert.ok(out.includes('<a href="../flip-in/" rel="prev" aria-label="Previous: Flip In">‹ <span class="hb-name">Flip In</span></a>'));- assert.ok(!out.includes('rel="next"'));-});--test('moves the title into the side column with the number, category and plain lede', () => {- assert.ok(out.includes('<main class="hb-view">'));- assert.ok(out.includes('<aside class="hb-side">'));- assert.ok(out.includes('<p class="hb-cat">02.12 · Entrance & Exit</p>'));- assert.ok(out.includes('<h1>Sample Demo</h1>'));- assert.ok(out.includes('<p class="hb-lede">Moves a card into view.</p>'));- assert.ok(out.includes('<section class="hb-settings" aria-label="Settings">'));- assert.ok(out.includes('</aside>\n</main>\n'));-});--test('adds the escaped prompt and keeps the controls and demo script', () => {- assert.ok(out.includes('<p class="hb-prompt">Add a <b> & [x] prompt.</p>'));- assert.ok(out.includes('id="dur-sl"'));- assert.ok(out.includes("document.getElementById('btn-in').addEventListener"));-});--test('applies marker attributes and one-off edits', () => {- assert.ok(out.includes('id="btn-in" data-hb-replay'));- assert.ok(out.includes('id="btn-rst" data-hb-reset'));- assert.ok(out.includes('id="loop-tog" data-hb-skip data-hb-loop'));- assert.ok(out.includes('<span>Loop it</span>'));-});--test('keeps the original lede when none is given', () => {- const kept = migrate(legacy, cfg, { ...demo, lede: undefined });- assert.ok(kept.includes('<p class="hb-lede">Uses `code` words in its summary.</p>'));-});--test('refuses edits that do not match exactly once', () => {- assert.throws(() => migrate(legacy, cfg, { ...demo, edits: [['<span>Nope</span>', 'x']] }), /edit/);-});--test('refuses to migrate a page twice', () => {- assert.throws(() => migrate(out, cfg, demo), /already migrated/);-});diff --git a/tools/migrate-demo.js b/tools/migrate-demo.jsdeleted file mode 100644index e7ea3f9b..00000000--- a/tools/migrate-demo.js+++ /dev/null@@ -1,108 +0,0 @@-#!/usr/bin/env node-// One-time migration of legacy demo pages to the shared demo layout.-// See docs/superpowers/specs/2026-09-25-demo-page-redesign-design.md.-// Usage (repo root): node tools/migrate-demo.js tools/migrations/<category>.json [slug ...]-'use strict';-const fs = require('node:fs');-const path = require('node:path');-const { escapeHtml } = require('../assets/js/handbook.js');--// Replace `find` exactly once; anything else means the page doesn't have the expected shape.-function replaceOnce(html, find, replacement, step) {- const count = typeof find === 'string'- ? html.split(find).length - 1- : (html.match(new RegExp(find.source, find.flags.includes('g') ? find.flags : find.flags + 'g')) || []).length;- if (count !== 1) throw new Error(`${step}: expected exactly 1 match, found ${count}`);- return html.replace(find, typeof replacement === 'function' ? replacement : () => replacement);-}--function pagerLink(rel, target) {- if (!target) return '';- const label = rel === 'prev' ? 'Previous' : 'Next';- const name = `<span class="hb-name">${escapeHtml(target.name)}</span>`;- return `<a href="${target.href}" rel="${rel}" aria-label="${label}: ${escapeHtml(target.name)}">` +- (rel === 'prev' ? `‹ ${name}` : `${name} ›`) + '</a>';-}--function topBar(demo) {- return '<nav class="hb-bar" aria-label="Animation Handbook">' +- '<a class="hb-home" href="../../../">← <span>Animation Handbook</span></a>' +- `<span class="hb-pager">${pagerLink('prev', demo.prev)}${pagerLink('next', demo.next)}</span></nav>`;-}--function migrate(html, cfg, demo) {- if (html.includes('class="hb-view"')) throw new Error('already migrated');- let out = html.replace(/\r\n/g, '\n');-- // Legacy top bar styles, font files and font variables.- out = replaceOnce(out, /\n<style id="ah-inject">[\s\S]*?<\/style>/, '', 'ah-inject style');- const fontFace = /^[ \t]*@font-face\{font-family:'(?:Bricolage|PlexMono)'[^\n]*\n/gm;- if (!fontFace.test(out)) throw new Error('font-face lines: none found');- out = out.replace(fontFace, '');- out = replaceOnce(out, /--disp:[^;}]*;?/, '', '--disp variable');- out = replaceOnce(out, /--mono:[^;}]*;?/, '', '--mono variable');-- // Shared assets, body marker and the new top bar.- out = replaceOnce(out, '</head>',- '<link rel="stylesheet" href="../../../assets/css/handbook.css">\n' +- '<script src="../../../assets/js/handbook.js" defer></script>\n</head>', '</head>');- out = replaceOnce(out, '<body>', `<body class="hb"${demo.autoplay ? ' data-hb-autoplay' : ''}>`, '<body>');- out = replaceOnce(out, /<div class="ah-bar"[^\n]*<\/div>\n/, topBar(demo) + '\n', 'ah-bar');- out = replaceOnce(out, /\n<script>\(function\(\)\{var b=document\.getElementById\("ah-copy"\)[^\n]*<\/script>/, '', 'copy-source script');-- // The header moves into the side column; the note moves out (its content lives in the README).- let title = '';- let lede = '';- out = replaceOnce(out, /<header>\s*<h1>([\s\S]*?)<\/h1>\s*<p>([\s\S]*?)<\/p>\s*<\/header>\n/,- (m, h, p) => { title = h.trim(); lede = p.trim(); return ''; }, 'header');- if (demo.lede) lede = escapeHtml(demo.lede);- const head =- ' <header class="hb-head">\n' +- ` <p class="hb-cat">${demo.number} · ${escapeHtml(cfg.name)}</p>\n` +- ` <h1>${title}</h1>\n` +- ` <p class="hb-lede">${lede}</p>\n` +- ' </header>\n' +- ' <section class="hb-settings" aria-label="Settings">\n' +- ' <h2 class="hb-label">Settings</h2>\n';- out = replaceOnce(out, '<div class="layout">', '<main class="hb-view">', 'layout wrapper');- out = replaceOnce(out, /(\n[ \t]*)<aside>\n/, (m, indent) => `${indent}<aside class="hb-side">\n${head}`, 'aside open');- out = replaceOnce(out, /\n[ \t]*<p class="note">[\s\S]*?<\/p>/, '', 'note');- const take =- ' </section>\n' +- ' <div class="hb-take">\n' +- ' <section class="hb-prompt-box" aria-labelledby="hb-prompt-title">\n' +- ' <h2 class="hb-label" id="hb-prompt-title">Prompt</h2>\n' +- ` <p class="hb-prompt">${escapeHtml(demo.prompt)}</p>\n` +- ' </section>\n' +- ' </div>\n';- out = replaceOnce(out, /([ \t]*)<\/aside>\n<\/div>\n/, (m, indent) => `${take}${indent}</aside>\n</main>\n`, 'aside close');-- // Markers the shared script looks for, then one-off edits.- for (const [id, attrs] of Object.entries(demo.attrs || {})) {- out = replaceOnce(out, `id="${id}"`, `id="${id}" ${attrs}`, `attrs for #${id}`);- }- for (const [find, replacement] of demo.edits || []) {- out = replaceOnce(out, find, replacement, `edit "${find.slice(0, 40)}"`);- }- return out;-}--function main(argv) {- const [configPath, ...only] = argv;- if (!configPath) {- console.error('Usage: node tools/migrate-demo.js <config.json> [slug ...]');- process.exit(2);- }- const cfg = JSON.parse(fs.readFileSync(configPath, 'utf8'));- const demos = cfg.demos.filter(d => !only.length || only.includes(d.slug));- if (only.length && demos.length !== only.length) throw new Error(`unknown slug in: ${only.join(', ')}`);- const root = path.resolve(__dirname, '..');- for (const demo of demos) {- const file = path.join(root, 'animations', cfg.category, demo.slug, 'index.html');- fs.writeFileSync(file, migrate(fs.readFileSync(file, 'utf8'), cfg, demo));- console.log('migrated', path.relative(root, file));- }-}--if (require.main === module) main(process.argv.slice(2));-module.exports = { migrate, topBar, replaceOnce };