From b0cc447fbb325edcb6cc7d57c724ada3ba9b7301 Mon Sep 17 00:00:00 2001 From: Koryei Date: Wed, 25 Nov 2026 12:52:40 -0500 Subject: [PATCH 1/5] feat(scaffold): flat and frame grounds, a card hero, duotone art New flags: --ground lit|flat|frame (flat and frame take --palette cobalt, mint or sand and set the theme from the colour), --hero card (centred headline, the product card cropped at the fold, a traced diagram behind it, annotation chips on it) and --art column|vase|sphere|drape|strata for the split hero. The lit scaffold now prints that the gradient is the default of machine-built pages. Split and card heroes get their own tracking steps. The mint ink-3 was darkened after the checker found 4.33:1 under grain. Every combination passes signs, check, craft, overflow and reduced motion. Co-Authored-By: Claude Sonnet 5.5 --- README.md | 14 ++- SKILL.md | 6 +- assets/recipes/annotate.mjs | 9 +- assets/recipes/annotate.test.mjs | 4 +- assets/recipes/flat.mjs | 9 +- assets/recipes/flat.test.mjs | 7 +- assets/starters/landing/index.html | 27 ++++++ assets/starters/landing/landing.css | 36 ++++++- references/devices.md | 4 +- references/directions.md | 41 +++++++- references/landing-craft.md | 6 +- references/materials.md | 2 + scripts/scaffold.mjs | 68 +++++++++++--- test/grounds.test.mjs | 141 ++++++++++++++++++++++++++++ test/swap.test.mjs | 20 ++++ test/tracking.test.mjs | 10 +- 16 files changed, 361 insertions(+), 43 deletions(-) create mode 100644 test/grounds.test.mjs diff --git a/README.md b/README.md index 1a89687..bdeb38e 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,11 @@ node scripts/scaffold.mjs my-app --kind app --theme dark | **Landing page** | A lit grainient ground, a floating nav, a product frame, an uneven bento, steps, one big number, a closing call and a footer. The motion kit is wired in: ordered entrance, scroll reveals, count-up, and a hover and press state on every control. | | **App screen** (`--kind app`) | A sidebar that becomes a menu on a phone, a page header with one primary action, four key numbers, one chart, a table whose status is a word and a dot, and an empty state that says what to do. | -Seven grounds are built in (`--shape pools`, `horizon`, `bowl`, `blob`, `sweep`, `rays` or `contour`). Add `--hero split` to put the headline beside the one object only your product has, or `--minimal` for a short brief with few facts. Every placeholder is marked `data-todo`, and `signs.mjs` reports any left, so unfinished copy cannot ship. +Seven lit grounds are built in (`--shape pools`, `horizon`, `bowl`, `blob`, `sweep`, `rays` or `contour`). The soft grainy gradient is also what most machine-built pages reach for now, so there are first-class alternatives: `--ground flat` (one saturated colour, `--palette cobalt`, `mint` or `sand`) and `--ground frame` (a dark rounded panel set into the page). `--hero split` puts the headline beside the one object only your product has, and `--art column` (or `vase`, `sphere`, `drape`, `strata`) fills it with a duotone print as a stand-in. `--hero card` centres the headline and crops the product card at the fold, with a traced diagram behind it and annotation chips on it. `--minimal` is for a short brief with few facts. + +```bash +node scripts/scaffold.mjs my-page --ground flat --palette cobalt --hero card +``` Every placeholder is marked `data-todo`, and `signs.mjs` reports any left, so unfinished copy cannot ship. ## The tools @@ -146,10 +150,10 @@ Plain Node scripts with no dependencies. The agent runs them for you, and you ca | `scripts/signs.mjs ` | Finds tells in the rendered page: hue gradients, glows, emoji, hype words, unverified claims, looping animation and more. | `--allow` licenses a device your committed direction uses on purpose | | `scripts/check.mjs ` | Reads WCAG contrast from the rendered pixels, so gradients, images and pseudo-element backgrounds are judged too. Also checks touch targets, small text, missing names, focus styles, layout shift and document basics. | `--widths` | | `scripts/craft.mjs ` | Hovers every control with a real pointer and diffs the result, so a control that ignores the pointer is caught, not missed. Also flags layout-property transitions and motion that ignores the reduced-motion setting. | `--shots` writes a rest and hover crop per control | -| `scripts/scaffold.mjs ` | Starts a landing page or an app screen from a tested starter. | `--kind`, `--theme`, `--palette`, `--shape`, `--hero`, `--minimal` | +| `scripts/scaffold.mjs ` | Starts a landing page or an app screen from a tested starter. | `--kind`, `--theme`, `--palette`, `--shape`, `--ground`, `--hero`, `--art`, `--minimal` | | `scripts/inline.mjs ` | Folds a finished page, with its styles, script and fonts, into one file you can send. | `--out page.html` | | `scripts/lib-add.mjs add ` | Pulls real source from Bencho, BoardUI, Aceternity or any shadcn registry. Files only, with the licence notice. | `--dry-run`, `--out` | -| `scripts/dotify.mjs ` | Turns a picture or drawn SVG into dithered, halftone, hex-dot or ASCII art for a hero object. | `--invert` | +| `scripts/dotify.mjs ` | Turns a picture or drawn SVG into dithered, halftone, hex-dot, engraved-line or ASCII art for a hero object. | `--mode`, `--invert`, `--fill`, `--bg` | | `scripts/swap.mjs ` | The swap-the-name test. With the product name removed, does the first screen still use the nouns of the product's own subject, and does its artwork name them? It catches a page where only the skeleton is the product's own. It cannot judge the picture. | `--nouns`, `--name`, `--typographic` | | `scripts/score.mjs ` | Runs every check and prints one score out of 100, with what cost points. | | | `scripts/term-shot.mjs -- ` | Runs a terminal program at a set width in a real pseudo-terminal and captures its text and an image. | | @@ -180,9 +184,9 @@ references/ assets/motion/ the motion kit: entrance, reveal, count-up, magnetic, tilt, spotlight, marquee, draw, sweep buttons assets/starters/ the landing and app starters, tested in a browser assets/fonts/ Geist, Geist Mono and Instrument Serif under the Open Font Licence -assets/recipes/ tested generators and kits: grounds, contours, stones, vessels, dither, halftone, HUD callouts, isometric art +assets/recipes/ tested generators and kits: grounds, flat colour tones, duotone prints, annotation chips and diagrams, headline helpers, contours, stones, vessels, dither, halftone, HUD callouts, isometric art scripts/ the measuring and building tools above -evals/ briefs, scoring and the write-up of every test round +evals/ briefs, scoring, a tracking measurement and the write-up of every test round examples/ real before and after runs ``` diff --git a/SKILL.md b/SKILL.md index e0773d6..a188c28 100644 --- a/SKILL.md +++ b/SKILL.md @@ -34,7 +34,7 @@ One fixed run for every request. Do the steps in order. Each step names the file | 8 | **Report** | Short, plain, honest about what is left | [references/report.md](references/report.md) | | 9 | **Log** | Project lessons into the project; skill lessons proposed, never self-applied | [references/lessons.md](references/lessons.md) | -Also load, as the work needs them: the surface file for the mode ([web-app](references/surfaces/web-app.md), [landing](references/surfaces/landing.md), [reading](references/surfaces/reading.md), [showpiece](references/surfaces/showpiece.md), [terminal](references/surfaces/terminal.md), [iOS](references/surfaces/native-ios.md), [Android](references/surfaces/native-android.md)); [house-rules.md](references/house-rules.md) for default numbers; [anti-slop.md](references/anti-slop.md) for the tells to remove; [libraries.md](references/libraries.md) before adding any outside component, kit or library; [principles.md](references/principles.md) for the reason under every rule, when a case is not covered; [visual-craft.md](references/visual-craft.md) for the one rich moment on a new screen; [landing-craft.md](references/landing-craft.md) for why the best landing pages work and which kit piece builds each decision; [directions.md](references/directions.md) for committed looks and the hero object pipeline; [devices.md](references/devices.md) for the structural moves that make a page memorable, each with the reason it works; [materials.md](references/materials.md) for surface, light and grain; [hover.md](references/hover.md) for hover and press states. +Also load, as the work needs them: the surface file for the mode ([web-app](references/surfaces/web-app.md), [landing](references/surfaces/landing.md), [reading](references/surfaces/reading.md), [showpiece](references/surfaces/showpiece.md), [terminal](references/surfaces/terminal.md), [iOS](references/surfaces/native-ios.md), [Android](references/surfaces/native-android.md)); [house-rules.md](references/house-rules.md) for default numbers; [anti-slop.md](references/anti-slop.md) for the tells to remove; [libraries.md](references/libraries.md) before adding any outside component, kit or library; [principles.md](references/principles.md) for the reason under every rule, when a case is not covered; [visual-craft.md](references/visual-craft.md) for the one rich moment on a new screen; [landing-craft.md](references/landing-craft.md) for why the best landing pages work and which kit piece builds each decision; [directions.md](references/directions.md) for committed looks, choosing the ground (lit, flat, frame, duotone) and the hero object pipeline; [devices.md](references/devices.md) for the structural moves that make a page memorable, each with the reason it works; [materials.md](references/materials.md) for surface, light and grain; [hover.md](references/hover.md) for hover and press states. ## Rules that always hold @@ -61,10 +61,10 @@ Plain Node 22+ scripts in `scripts/`, no installs, using the Chrome on the machi | `scripts/drift.mjs --save before.json` | Counts font sizes, weights, radii, colours, spacing in use; later `--against before.json` | | `scripts/signs.mjs [--allow "Tell"]` | Finds machine-made tells in the rendered page; `--allow` licenses devices a committed direction uses on purpose | | `scripts/check.mjs ` | Contrast, touch-target size, small text, missing names | -| `scripts/scaffold.mjs --theme dark --palette midnight` | Starts a landing page from a complete, tested starter: lit grainient ground, floating nav, product frame, bento, steps, closing call, footer, with the motion kit and open fonts wired in. Replace every `data-todo`; `signs.mjs` reports any left. `--minimal` drops the optional sections for a short brief. `--kind app` starts an app screen instead: sidebar, header, key numbers, chart, table and empty state, tested the same way. `inline.mjs --out page.html` folds the result into one file | +| `scripts/scaffold.mjs --theme dark --palette midnight` | Starts a landing page from a complete, tested starter: lit grainient ground, floating nav, product frame, bento, steps, closing call, footer, with the motion kit and open fonts wired in. Replace every `data-todo`; `signs.mjs` reports any left. `--minimal` drops the optional sections for a short brief. The lit gradient is the default of machine-built pages, so choose the ground on purpose: `--ground flat --palette cobalt|mint|sand` or `--ground frame` are first-class; `--hero card` crops the product card at the fold with a traced diagram and annotation chips; `--art column|vase|sphere|drape|strata` puts a duotone print in the split hero (a stand-in for the product's own artifact). `--kind app` starts an app screen instead: sidebar, header, key numbers, chart, table and empty state, tested the same way. `inline.mjs --out page.html` folds the result into one file | | `scripts/lib-add.mjs add bencho ` | Pulls real source from Bencho, BoardUI, Aceternity or any shadcn registry (files only, with a licence notice and the packages to install). See `libraries.md` | | `scripts/craft.mjs [--shots dir]` | Hovers every control with a real pointer and diffs both the computed style and the pixels, so a control that ignores the pointer, or answers it invisibly, is caught; also flags transitions on layout properties and motion that ignores the reduced-motion setting | -| `scripts/dotify.mjs --mode hex` | Turns any picture or drawn SVG into dithered, halftone, hex-dot or ASCII art for a hero object | +| `scripts/dotify.mjs --mode hex` | Turns any picture or drawn SVG into dithered, halftone, hex-dot, engraved-line or ASCII art for a hero object; `--fill` and `--bg` make it a two-colour duotone | | `scripts/swap.mjs --nouns "clause,redline" --name Marrow` | The swap-the-name test: with the product name removed, does the first screen still use the product's own nouns, and does its artwork name the artifact? Refuses nouns that fit any product. Catches a page where only the skeleton is owned | | `scripts/score.mjs ` | Runs every check and prints one score out of 100 | | `scripts/term-shot.mjs -- ` | Runs a terminal command at a given width and captures text and image (needs Python 3) | diff --git a/assets/recipes/annotate.mjs b/assets/recipes/annotate.mjs index 3611375..cd6b8bd 100644 --- a/assets/recipes/annotate.mjs +++ b/assets/recipes/annotate.mjs @@ -4,7 +4,7 @@ // // import { chip, heroDiagram, annotationCss } from './annotate.mjs'; // chip({ label: 'Clause 4.2 deviates', x: 8, y: 30, pointer: 'br' }) // HTML, positioned in % of its parent -// heroDiagram({ width: 1200, height: 520, card: { x: 230, y: 250, w: 740 }, seed: 2 }) // an SVG string +// heroDiagram({ width: 1200, height: 520, card: { x: 200, y: 250, w: 800 }, seed: 2 }) // an SVG string // // Rules that keep it honest (references/directions.md, "Annotations"): a chip points at something real in the // picture, says one thing in plain words, and never claims a number the product cannot back. Three chips at most. @@ -69,18 +69,17 @@ export function elbow([x1, y1], [x2, y2], { first = 'h', radius = 14 } = {}) { return roundedPolyline([[x1, y1], [x2, y1], [x2, y2]], radius); } -// A diagram that sits behind a card: nodes at the left, right and top, each joined to the card by a thin traced line. +// A diagram that sits behind a card: nodes at the left and right, each joined to the card by a thin traced line. // Seeded, so the same page always gets the same diagram. `card` is { x, y, w }: where the card's top edge is. // Every label is a placeholder (data-todo): replace each with the name of one of the product's own parts. -export function heroDiagram({ width = 1200, height = 520, card = { x: 230, y: 250, w: 740 }, seed = 1, stroke = 'var(--line-strong)', text = 'var(--ink-3)', labels } = {}) { +export function heroDiagram({ width = 1200, height = 520, card = { x: 200, y: 250, w: 800 }, seed = 1, stroke = 'var(--line-strong)', text = 'var(--ink-3)', labels } = {}) { const rand = rng(seed); - const names = labels ?? ['Part one', 'Part two', 'Part three', 'Part four', 'Part five']; + const names = labels ?? ['Part one', 'Part two', 'Part three', 'Part four']; const slots = [ { side: 'l', x: 36, y: 70 + rand() * 50, join: [card.x + card.w * 0.12, card.y], first: 'h' }, { side: 'l', x: 36, y: 200 + rand() * 40, join: [card.x, card.y + 56 + rand() * 30], first: 'hvh' }, { side: 'r', x: width - 36, y: 56 + rand() * 50, join: [card.x + card.w * 0.88, card.y], first: 'h' }, { side: 'r', x: width - 36, y: 190 + rand() * 50, join: [card.x + card.w, card.y + 56 + rand() * 30], first: 'hvh' }, - { side: 'l', x: card.x + card.w * 0.46, y: 30 + rand() * 20, join: [card.x + card.w * 0.5, card.y], first: 'v' }, ]; const paths = []; const nodes = []; diff --git a/assets/recipes/annotate.test.mjs b/assets/recipes/annotate.test.mjs index e7e10e5..7f3d3ef 100644 --- a/assets/recipes/annotate.test.mjs +++ b/assets/recipes/annotate.test.mjs @@ -41,13 +41,13 @@ test('the diagram is the same for a seed, decorative, flat, and every label is a assert.match(a, /aria-hidden="true"/); assert.doesNotMatch(a, /gradient|filter|animate/i); const texts = a.match(/]*>/g); - assert.equal(texts.length, 5); + assert.equal(texts.length, 4); for (const t of texts) assert.match(t, /data-todo/); assert.match(heroDiagram({ labels: ['Clause', 'Redline'] }), /Clause/); }); test('every line of the diagram stays inside the picture', () => { - const svg = heroDiagram({ width: 1200, height: 520, card: { x: 230, y: 250, w: 740 }, seed: 7 }); + const svg = heroDiagram({ width: 1200, height: 520, card: { x: 200, y: 250, w: 800 }, seed: 7 }); for (const d of svg.match(/ d="[^"]+"/g)) for (const [, x, y] of d.matchAll(/(-?\d+(?:\.\d)?) (-?\d+(?:\.\d)?)/g)) { assert.ok(Number(x) >= 0 && Number(x) <= 1200 && Number(y) >= 0 && Number(y) <= 520, `${x},${y}`); } diff --git a/assets/recipes/flat.mjs b/assets/recipes/flat.mjs index 9412d75..6f088e5 100644 --- a/assets/recipes/flat.mjs +++ b/assets/recipes/flat.mjs @@ -17,7 +17,7 @@ import { grainCss } from './mesh.mjs'; export const FLATS = { cobalt: { base: '#1f43d6', dark: true, ink: '#f6f4ee', ink2: '#e1e6fb', ink3: '#d3daf9', accent: '#f7d63a', onAccent: '#14120a', panel: '#0a1250', panelAccent: '#f7d63a' }, - mint: { base: '#8fe3bd', dark: false, ink: '#0b2e22', ink2: '#1d4a3a', ink3: '#2f5f4d', accent: '#0b5c3f', onAccent: '#ffffff', panel: '#0b2e22', panelAccent: '#8fe3bd' }, + mint: { base: '#8fe3bd', dark: false, ink: '#0b2e22', ink2: '#1d4a3a', ink3: '#245241', accent: '#0b5c3f', onAccent: '#ffffff', panel: '#0b2e22', panelAccent: '#8fe3bd' }, sand: { base: '#e8dfca', dark: false, ink: '#1a1914', ink2: '#3d3a31', ink3: '#5c574b', accent: '#a82e17', onAccent: '#ffffff', panel: '#1a1914', panelAccent: '#e9a98a' }, }; export const FLAT_NAMES = Object.keys(FLATS); @@ -88,7 +88,7 @@ export function flatThemeCss({ tone = 'cobalt' } = {}) { // The tokens re-pointed at the panel, so everything inside it (type, buttons, cards, lines) reads as dark-theme // without a second set of rules. The kit's buttons and the starter's type use these names only. -const PANEL_SCOPE = `--bg: var(--panel); --ink: var(--panel-ink); --ink-2: var(--panel-ink-2); --ink-3: var(--panel-ink-3); --line: var(--panel-line); --line-strong: var(--panel-strong); --surface: var(--panel-surface); --accent: var(--panel-accent); --on-accent: #0b0a0f; color-scheme: dark;`; +const PANEL_SCOPE = `--bg: var(--panel); --ink: var(--panel-ink); --ink-2: var(--panel-ink-2); --ink-3: var(--panel-ink-3); --line: var(--panel-line); --line-strong: var(--panel-strong); --surface: var(--panel-surface); --accent: var(--panel-accent); --on-accent: #0b0a0f; color: var(--ink); color-scheme: dark;`; export function flatGroundCss({ tone = 'cobalt', ground = 'flat', grain = 0.3 } = {}) { const f = FLATS[tone]; @@ -99,14 +99,15 @@ export function flatGroundCss({ tone = 'cobalt', ground = 'flat', grain = 0.3 } if (ground === 'frame') { return `${common} /* Frame: the page stays in the tone; the hero is a dark panel set in below the nav. */ -.hero { ${PANEL_SCOPE} margin-top: 5.25rem; min-height: min(100svh - 6rem, 60rem); background: var(--panel); } +.hero.is-frame { ${PANEL_SCOPE} margin-top: 5.25rem; min-height: min(100svh - 6rem, 60rem); background: var(--panel); } .closer { ${PANEL_SCOPE} background: var(--panel); } ${grained('.hero .ground::after, .closer .ground::after', true)} `; } return `${common} -/* Flat: the hero is the tone itself; the closing call is a darker panel of the same hue. */ +/* Flat: the hero is the tone itself; the product card and the closing call are darker panels of the same hue. */ .closer { ${PANEL_SCOPE} background: var(--panel); } +.hero-card .window { ${PANEL_SCOPE} background: var(--panel); border-color: var(--panel-strong); } ${grained('.hero .ground::after', f.dark)} ${grained('.closer .ground::after', true)} `; diff --git a/assets/recipes/flat.test.mjs b/assets/recipes/flat.test.mjs index dd58494..f7b7566 100644 --- a/assets/recipes/flat.test.mjs +++ b/assets/recipes/flat.test.mjs @@ -12,7 +12,8 @@ for (const tone of FLAT_NAMES) { test(`${tone}: every text colour passes on the ground and on the card, and so do the accent and the panel`, () => { const t = flatTokens(tone); for (const [name, c] of [['ink', t.ink], ['ink-2', t.ink2], ['ink-3', t.ink3]]) { - assert.ok(contrast(c, t.bg) >= 4.5, `${name} on the ground: ${contrast(c, t.bg).toFixed(2)}`); + const floor = name === 'ink-3' ? 5 : 4.5; // the lighter tint carries small text, and the grain darkens the ground a little + assert.ok(contrast(c, t.bg) >= floor, `${name} on the ground: ${contrast(c, t.bg).toFixed(2)}`); assert.ok(contrast(c, t.surfaceHex) >= 4.5, `${name} on the card: ${contrast(c, t.surfaceHex).toFixed(2)}`); } assert.ok(contrast(t.accent, t.bg) >= 4.5, `accent as text on the ground: ${contrast(t.accent, t.bg).toFixed(2)}`); @@ -36,8 +37,8 @@ test('the theme writes every token the starter uses, and the panel set', () => { test('flat keeps the hero in the tone and the closing call in the panel; frame puts the hero in the panel', () => { const flat = flatGroundCss({ tone: 'mint', ground: 'flat' }); assert.match(flat, /\.closer \{ --bg: var\(--panel\)/); - assert.doesNotMatch(flat, /\.hero \{/); + assert.doesNotMatch(flat, /\.hero\.is-frame/); const frame = flatGroundCss({ tone: 'sand', ground: 'frame' }); - assert.match(frame, /\.hero \{ --bg: var\(--panel\)/); + assert.match(frame, /\.hero\.is-frame \{ --bg: var\(--panel\)/); assert.match(frame, /margin-top: 5\.25rem/); }); diff --git a/assets/starters/landing/index.html b/assets/starters/landing/index.html index e1d360e..ef4b2ce 100644 --- a/assets/starters/landing/index.html +++ b/assets/starters/landing/index.html @@ -56,6 +56,7 @@

See it working +
120K+
A real figure
@@ -63,6 +64,7 @@

24h
A real figure

+ @@ -75,6 +77,31 @@

Replace with the object only this product has. Label anything drawn as an example.
+ +
+ + + +
+ diff --git a/assets/starters/landing/landing.css b/assets/starters/landing/landing.css index ca5dfff..f04b5f3 100644 --- a/assets/starters/landing/landing.css +++ b/assets/starters/landing/landing.css @@ -50,7 +50,10 @@ a { color: inherit; } @media (min-width: 48rem) { .display { letter-spacing: -0.04em; } } @media (min-width: 62rem) { .display { letter-spacing: -0.05em; } } @media (min-width: 80rem) { .display { letter-spacing: -0.055em; } } -.display .dim { color: var(--ink-3); } +.display .dim, .h2 .dim, .dim { color: var(--ink-3); } +/* Figures: tabular digits, with the decimals set back (assets/recipes/headline.mjs writes this markup). */ +.num { font-variant-numeric: tabular-nums; } +.dec { color: var(--ink-3); } .hero-main { display: grid; gap: 2.5rem; } .hero-object { display: none; margin: 0; } .hero-foot { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 3rem; align-items: end; } @@ -72,6 +75,37 @@ a { color: inherit; } .hero-in.split .stats { justify-content: flex-start; } @media (max-width: 62rem) { .hero-in.split { grid-template-columns: 1fr; } .hero-in.split .hero-object { order: -1; aspect-ratio: 16 / 10; max-width: 28rem; padding: 1rem; } .hero-in.split .hero-object { display: flex; flex-direction: column; gap: .5rem; } .hero-in.split .hero-object svg { flex: 1; min-height: 0; } .hero-in.split .hero-object figcaption { position: static; } } +/* Card hero (scaffold --hero card): a centred headline, then the product card cropped by the bottom of the first screen, + with a thin traced diagram behind it and annotation chips on it. The hero is one screen tall and clips the card. */ +.hero.has-card { align-items: flex-start; height: min(100svh - 1.5rem, 62rem); min-height: 40rem; } +.hero-in.card { padding: 8rem 0 0; justify-items: center; text-align: center; gap: 2.5rem; } +.hero-in.card .hero-main { justify-items: center; gap: 1.75rem; } +.hero-in.card .display { max-width: 15ch; margin-inline: auto; font-size: clamp(2.5rem, 5.4vw, 5.25rem); line-height: 1; letter-spacing: -0.03em; } +@media (min-width: 64rem) { .hero-in.card .display { letter-spacing: -0.035em; } } +@media (min-width: 80rem) { .hero-in.card .display { letter-spacing: -0.045em; } } +@media (min-width: 96rem) { .hero-in.card .display { letter-spacing: -0.05em; } } +.hero-in.card .hero-foot { grid-template-columns: 1fr; justify-items: center; gap: 0; } +.hero-in.card .lede { margin-inline: auto; margin-bottom: 1.5rem; } +.hero-in.card .actions { justify-content: center; } +.hero-card { position: relative; width: min(100%, 56rem); } +.hero-card .window { position: relative; z-index: 1; } +.hero-card .diagram { position: absolute; z-index: 0; left: -25%; top: 0; width: 150%; max-width: none; height: auto; transform: translateY(-48.08%); pointer-events: none; overflow: visible; } +.hero-card .window-body { min-height: 24rem; } +@media (max-width: 62rem) { .hero-card .diagram { display: none; } } +@media (max-width: 40rem) { .hero.has-card { height: min(100svh - 1rem, 56rem); } .hero-in.card { padding-top: 7rem; gap: 2rem; } } + +/* A duotone print in the split hero's object slot (scaffold --art): the picture is the whole plate. */ +.hero-in.split .hero-object.is-art { padding: 0; overflow: hidden; display: flex; flex-direction: column; aspect-ratio: 4 / 5; background: var(--ink); backdrop-filter: none; -webkit-backdrop-filter: none; } +.hero-in.split .hero-object.is-art svg { flex: 1; min-height: 0; width: 100%; height: 100%; } +.hero-in.split .hero-object.is-art figcaption { position: static; margin: 0; padding: 0.75rem 1.25rem 1rem; background: var(--ink); color: var(--bg); } +@media (max-width: 62rem) { .hero-in.split .hero-object.is-art { aspect-ratio: 4 / 3; max-width: 28rem; padding: 0; } } + +/* Split hero tracking follows its own, smaller size (evals/tracking.mjs). */ +.hero-in.split .display { letter-spacing: -0.03em; } +@media (min-width: 62rem) { .hero-in.split .display { letter-spacing: -0.04em; } } +@media (min-width: 80rem) { .hero-in.split .display { letter-spacing: -0.05em; } } +@media (min-width: 96rem) { .hero-in.split .display { letter-spacing: -0.055em; } } + /* ---------- Sections ---------- */ .section { padding: clamp(5rem, 11vw, 9rem) 0 0; } .eyebrow { display: inline-flex; align-items: center; gap: 0.625rem; margin: 0 0 1.25rem; font: 400 0.8125rem/1 var(--mono); color: var(--ink-3); letter-spacing: 0.02em; } diff --git a/references/devices.md b/references/devices.md index 1330e52..7897779 100644 --- a/references/devices.md +++ b/references/devices.md @@ -146,7 +146,7 @@ body { background: var(--table); } /* the texture lives here */ **Why it works.** A number at 80 px is a shape before it is a value, so it does the job of an image while carrying information. It also gives the page a second focal point without a second image. -**How.** The display face, tight tracking, tabular figures, and a label at 12 to 14 px in the mono or the sans. The label sits under the number, not beside it. +**How.** The display face, tight tracking, tabular figures, and a label at 12 to 14 px in the mono or the sans. For a figure with decimals, set the decimals back (`.50`, or `numeral(56498.5, { prefix: '£' })` from `assets/recipes/headline.mjs`): the whole part is the message, the cents are precision, and it still tells the truth. The label sits under the number, not beside it. ```css .stat b { font: 400 clamp(3rem, 6vw, 5.5rem)/0.9 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; } @@ -161,7 +161,7 @@ body { background: var(--table); } /* the texture lives here */ **Why it works.** It gives a long headline a reading rhythm and a hierarchy inside a single line of thought. The eye reads the loud part, then the quiet part, which is the order the argument should land in. It also lets a headline be longer than two lines without becoming a paragraph. -**How.** A `` with a muted colour or a lighter weight. Keep the size identical; the change is weight and colour only. +**How.** A `` with a muted colour or a lighter weight. Keep the size identical; the change is weight and colour only. One word can carry it, not only a whole line ("Smarter *Financial* Management"): `` in the starter, or `tintWord(text, word)` from `assets/recipes/headline.mjs`. The tint is the page's `--ink-3`, so it always passes contrast; do not pick a new colour for it. ```html

Design and drafting software for architects. From site to client-ready design.

diff --git a/references/directions.md b/references/directions.md index fcb1028..fd95d4f 100644 --- a/references/directions.md +++ b/references/directions.md @@ -18,6 +18,20 @@ A device that `anti-slop.md` would remove on a default screen (small uppercase m Reference leaning: when the person's taste runs technical, default to Instrument or Blueprint for technical products. +## Choosing the ground + +The ground is the largest thing on the first screen, so it is the first thing a visitor remembers, and the soft grainy gradient (the lit ground) is now what most machine-built pages reach for. It is a good ground. It is also a default, and a page whose ground, skeleton and type are all defaults is replaceable. Choose the ground on purpose and write the reason in the concept (`direction.md`): one clause. + +| Ground | It says | Use it when | Build with | +| --- | --- | --- | --- | +| **Lit** (soft grainy gradient) | atmosphere, calm, a place | the product is about light, space, mood or the future, or the picture on top has to feel part of a scene. Say why: "lit, because the product is a night-shift monitor" | `scaffold` default; `mesh.mjs` | +| **Flat colour** | a decision: one colour carries the nav, the ground and the buttons | the product has a colour it owns, or the type and the product card have to carry the page | `scaffold --ground flat --palette cobalt\|mint\|sand`; `flat.mjs` | +| **Frame** (a dark panel set into a light page) | a stage: the product is shown inside a room of its own | the product card is the point and needs contrast against a quiet page | `scaffold --ground frame --palette sand --hero card`; `flat.mjs` | +| **Duotone print** | craft: a picture made in one ink, tied to the interface by its texture | there is a subject worth drawing, a real artifact, drawn from the product | `duotone.mjs`, `dotify.mjs --mode lines`; `scaffold --art strata` | +| **The artifact itself** | the page is made of what the product makes | the artifact is visual (a strip log, a score, a map, a receipt, a waveform) | draw it in code, large, as the hero object (`visual-craft.md`) | + +A flat or framed ground hides nothing, so use it only when the layout and the type are good; the checks read contrast from the pixels, so it is also the easiest ground to get right. These grounds are first-class: the lit gradient is not the safe choice, it is one choice. + ## The grammar of the instrument family The most distinctive pages share eight habits. A direction in this family uses most of them. @@ -106,6 +120,31 @@ Use the system stacks in `house-rules.md`. By direction: **Instrument** pairs th **Moment:** a drawn object from the product's world (`visual-craft.md`): a contour field, vessels, stones, an invoice. **Don't:** go instrument on a product that is about people and warmth. +## Flat colour + +**Feel:** a decision. One saturated colour for the whole first screen, so the type, the product card and the one picture on it do the work. +**Palette:** `flat.mjs` has cobalt, mint and sand, each with its own ink, tinted text, accent and a darker panel of the same hue, all checked for contrast. The accent is for hover fills, focus and one chip, never for body text on the ground. **Type:** the sans at display size, with one word in the lighter tint. +**Devices:** the product card as a darker panel on the colour; a thin traced diagram behind it; one or two annotation chips; the closing call as a dark inset panel. +**Build with:** `scaffold --ground flat --palette cobalt --hero card`. +**Don't:** add a gradient to "warm it up" (that is the lit ground again), or use a second saturated colour. + +## Framed panel + +**Feel:** a stage. The page stays quiet; the hero is a dark rounded panel set in below the nav, with the product on it. +**Build with:** `scaffold --ground frame --palette sand --hero card`, or `--hero split --art strata`. A frame with nothing in it is just a large dark rectangle, so it needs the card or a print. +**Mixed radius is a decision:** a rounded nav and panel with sharp-cornered buttons or chips reads as deliberate; round everything or keep two radii and name them. + +## Duotone print + +**Feel:** printed. One subject, one ink, one paper, with a halftone, a line screen or a dither that ties the picture to the interface. +**Devices:** the subject at large scale, cropped by its frame; the same ink as the page's ground colour (the scaffold uses `var(--bg)` for ink and `var(--ink)` for paper, so it follows the theme); the grain of the ground over the top. +**Build with:** `duotone.mjs` (`duotoneSvg({ subject, mode: 'halftone' | 'lines' | 'dither' })`), `dotify.mjs --mode lines` for the product's own artifact rendered to HTML, `scaffold --art column|vase|sphere|drape|strata`. +**The stand-ins are stand-ins.** A column or a vase is the technique, not the idea: unless the product is about columns, replace it with the product's own artifact (a clause, a core, a tide chart) before the swap test (`gate.md`). The built-in subjects are drawn by computation, so there is no photograph, no licence and no stock image. + +## Annotations (a technique, not a direction) + +A product picture explains itself when it is annotated: a **chip** says what to look at, its **arrow** says where, a **thin traced line** shows how the card connects to the rest of the product. `annotate.mjs` makes the chips (`chip()`, styles from `annotationCss()`) and the diagram (`heroDiagram()`); `scaffold --hero card` places them. Rules: three chips at most; a chip points at something real in the picture; one plain statement, never a number the product cannot back; diagram nodes name the product's own parts; hide both on a phone rather than shrink them. + --- ## Making any of these the product's own @@ -116,6 +155,6 @@ The finished looks above are starting points. What makes one feel *made for this - The **hero object** drawn from its world, not a generic sphere or chip. - **Real labels** from its real facts. - **One accent** from its world or brand. -- **One signature** (a status dot, a unit, a typeface detail) used everywhere. +- **One signature** (a status dot, a unit, a typeface detail, one artwork, one interaction) used everywhere, with everything else calm. If you could swap the product name and the page still fits, it is a template. Go back to the inventory. diff --git a/references/landing-craft.md b/references/landing-craft.md index 61b3bdb..091c4fb 100644 --- a/references/landing-craft.md +++ b/references/landing-craft.md @@ -2,7 +2,7 @@ A good landing page is not a layout with a nice colour. It is a handful of decisions made together: **where the light comes from, where the type sits in it, what is big, what moves and in what order, and how everything answers the pointer.** This file explains each decision, why it works on a person, how to build it with the kits in this skill, and which script catches it when it is wrong. -Start every landing page with `node scripts/scaffold.mjs [--theme dark|light] [--palette name] [--shape rays|bowl|blob|...] [--hero split] [--motes]`. `--hero split` puts the headline beside the one object only this product has (a drawing, the real screen, a diagram). (An app screen is a different starter: `--kind app`, see `surfaces/web-app.md`.) For a short brief with few facts, add `--minimal`: it keeps the hero, the steps, the closing call and the footer, and removes the ticker, product, features and proof sections together with their links, so nothing is left to delete. To deliver a single file, run `node scripts/inline.mjs --out page.html`. It gives you a page that already makes these decisions and already passes every check. Your job is then to replace the placeholder content with the product's own and to push the direction until it could only be this product. +Start every landing page with `node scripts/scaffold.mjs [--theme dark|light] [--palette name] [--shape rays|bowl|blob|...] [--hero stack|split|card] [--ground lit|flat|frame] [--art column|vase|sphere|drape|strata] [--motes]`. `--hero split` puts the headline beside the one object only this product has (a drawing, the real screen, a diagram; `--art` fills it with a duotone print as a stand-in). `--hero card` centres the headline and crops the product card at the fold, with a traced diagram behind it and annotation chips on it. `--ground flat` or `frame` swaps the lit gradient for a colour (`--palette cobalt|mint|sand`); the theme follows the colour. (An app screen is a different starter: `--kind app`, see `surfaces/web-app.md`.) For a short brief with few facts, add `--minimal`: it keeps the hero, the steps, the closing call and the footer, and removes the ticker, product, features and proof sections together with their links, so nothing is left to delete. To deliver a single file, run `node scripts/inline.mjs --out page.html`. It gives you a page that already makes these decisions and already passes every check. Your job is then to replace the placeholder content with the product's own and to push the direction until it could only be this product. ## Before the scaffold: the concept @@ -10,7 +10,9 @@ The starter gives a page that already works. It does not give a page that is alr ## The ten decisions -### 1. The ground is light, not colour +### 1. The ground is light, not colour (or, on purpose, a colour) + +**Read this first: the lit ground is a default now.** It is a strong one, and nearly every page an agent builds reaches for it, which makes a page that uses it without a reason one more of the same. Use it when the concept says why this product wants light (`direction.md`). Otherwise choose from `directions.md` ("Choosing the ground"): flat colour, a framed panel, a duotone print, or the artifact itself. `scaffold --ground flat|frame` builds the first two with the same checks. The rest of this decision is how to build the lit ground well. **What good pages do.** The first screen is a luminous gradient with grain: a bowl of blue light pouring from the top into dark, a warm cloud on one side of a cream page, a glowing horizon, an arc of atmosphere. It is the biggest thing on the page and it contains no content. diff --git a/references/materials.md b/references/materials.md index 7ae6dfc..d10288d 100644 --- a/references/materials.md +++ b/references/materials.md @@ -30,6 +30,8 @@ Pick **one** material for the page and let the others appear only as small accen ## The grainient, built properly +It is also the default ground of machine-built pages now, so choose it on purpose (`directions.md`, "Choosing the ground"): a flat colour, a framed panel or a duotone print are equal options, and `scaffold --ground` builds them. + A grainient is not a linear gradient with pretty colours. It is a **mesh of soft light** with grain on top. Build it in four layers, back to front: 1. **Base.** The page's own background colour, so the ground never fights the content. diff --git a/scripts/scaffold.mjs b/scripts/scaffold.mjs index f0200c2..3d4d23d 100644 --- a/scripts/scaffold.mjs +++ b/scripts/scaffold.mjs @@ -3,14 +3,21 @@ // a product frame, a bento, steps, a big number, a closing call and a footer, with the motion kit wired in. // // node scripts/scaffold.mjs [--kind landing|app] [--theme dark|light] [--palette ember] [--shape bowl] [--accent '#e8742c'] -// [--seed 1] [--grain 0.45] [--hero stack|split] +// [--seed 1] [--grain 0.45] [--hero stack|split|card] [--ground lit|flat|frame] [--art column] // // kind landing (default) or app: a working surface with a sidebar, key numbers, a chart, a table and an empty state // theme dark or light (default dark) // palette one of the built-in grounds (see assets/recipes/mesh.mjs), or use --accent to derive one // minimal keep only the hero, the steps, the closing call and the footer (for a short brief with few facts) // motes drifting specks in the light (a slow breath, stopped under reduced motion) -// hero stack (headline over its copy) or split (headline beside the one object only this product has) +// hero stack (headline over its copy), split (headline beside the one object only this product has) or +// card (centred headline, then the product card cropped by the bottom of the first screen, with a traced +// diagram behind it and annotation chips on it; it replaces the product section) +// ground lit (default: the soft grainy gradient, the default of machine-built pages, so say why the product wants it), +// flat (one saturated colour carries the first screen; --palette cobalt|mint|sand), or frame (the page in +// that colour, the hero a dark rounded panel set in below the nav). The theme follows the colour. +// art a duotone print in the split hero's object slot: column | vase | sphere | drape | strata. A stand-in to show the +// technique: replace it with a picture of the product's own artifact (assets/recipes/duotone.mjs, dotify.mjs) // shape pools | horizon | bowl | blob | sweep | rays | contour for the hero ground (default: bowl on dark, blob on light) // // Everything marked data-todo is placeholder. Replace it with the product's real words and numbers. @@ -19,6 +26,9 @@ import { copyFileSync, cpSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; +import { chip, annotationCss, heroDiagram } from '../assets/recipes/annotate.mjs'; +import { SUBJECT_NAMES, duotoneSvg } from '../assets/recipes/duotone.mjs'; +import { FLATS, FLAT_NAMES, flatGroundCss, flatThemeCss } from '../assets/recipes/flat.mjs'; import { PALETTES, fromAccent, grainient, hexToHsl, hslToHex } from '../assets/recipes/mesh.mjs'; import { isMain, parseArgs } from './lib/args.mjs'; @@ -49,24 +59,55 @@ export function themeCss({ dark, palette }) { `; } -export function scaffold(dest, { theme = 'dark', palette = 'midnight', accent, shape, seed = 1, grain = 0.45, hero: heroLayout = 'stack', motes = false, minimal = false } = {}) { +export function scaffold(dest, { theme = 'dark', palette = 'midnight', accent, shape, seed = 1, grain = 0.45, hero: heroLayout = 'stack', motes = false, minimal = false, ground = 'lit', art } = {}) { + if (!['lit', 'flat', 'frame'].includes(ground)) throw new Error(`--ground is lit, flat or frame (got "${ground}").`); + if (!['stack', 'split', 'card'].includes(heroLayout)) throw new Error(`--hero is stack, split or card (got "${heroLayout}").`); + if (art && !SUBJECT_NAMES.includes(art)) throw new Error(`--art is one of ${SUBJECT_NAMES.join(', ')} (got "${art}").`); + if (art && heroLayout === 'card') throw new Error('--art goes in the split hero\'s object slot; the card hero shows the product card instead.'); + if (art) heroLayout = 'split'; + // Flat and frame grounds take a colour from --palette (cobalt, mint, sand); the default is cobalt, or sand for a frame. + let tone; + if (ground !== 'lit') { + tone = FLATS[palette] ? palette : ground === 'frame' ? 'sand' : 'cobalt'; + if (palette && palette !== 'midnight' && !FLATS[palette]) throw new Error(`Unknown tone "${palette}". Flat and frame grounds use ${FLAT_NAMES.join(', ')}.`); + } + // A flat or framed ground is a colour with its own text colours, so the theme follows the colour. + if (tone) theme = FLATS[tone].dark ? 'dark' : 'light'; const dark = theme === 'dark'; let pal; - if (accent) pal = fromAccent(accent, { dark }); + if (tone) pal = { base: FLATS[tone].base, counter: FLATS[tone].accent, family: [], dark }; + else if (accent) pal = fromAccent(accent, { dark }); else { pal = PALETTES[palette === 'midnight' && !dark ? 'ember' : palette]; if (!pal) throw new Error(`Unknown palette "${palette}". Use one of ${Object.keys(PALETTES).join(', ')} or --accent '#hex'.`); if (Boolean(pal.dark) !== dark) throw new Error(`The ${palette} palette is ${pal.dark ? 'dark' : 'light'}: use --theme ${pal.dark ? 'dark' : 'light'}, or pick another palette.`); } const heroShape = shape || (dark ? 'bowl' : 'blob'); - const hero = grainient({ palette: pal, shape: heroShape, seed, grain, selector: '.hero .ground', withMotes: motes, drift: motes, mask: heroShape === 'blob' || heroShape === 'sweep' ? 'none' : 'bottom' }); - const closer = grainient({ palette: pal, shape: dark ? 'horizon' : 'pools', seed: seed + 7, grain, selector: '.closer .ground', mask: 'radial' }); + const hero = tone ? { css: '', problems: [] } : grainient({ palette: pal, shape: heroShape, seed, grain, selector: '.hero .ground', withMotes: motes, drift: motes, mask: heroShape === 'blob' || heroShape === 'sweep' ? 'none' : 'bottom' }); + const closer = tone ? { css: '', problems: [] } : grainient({ palette: pal, shape: dark ? 'horizon' : 'pools', seed: seed + 7, grain, selector: '.closer .ground', mask: 'radial' }); mkdirSync(dest, { recursive: true }); const starter = join(root, 'assets', 'starters', 'landing'); let html = readFileSync(join(starter, 'index.html'), 'utf8').replace('data-theme="dark"', `data-theme="${theme}"`); // The object block exists only in the split layout. html = heroLayout === 'split' ? html.replace('
', '
').replace(/\n?/g, '') : html.replace(/ *[\s\S]*?\n?/, ''); + if (art) { + // The print is the whole plate: ink is the page colour, paper is the text colour, so it follows the theme. + const print = duotoneSvg({ subject: art, seed, mode: art === 'strata' ? 'lines' : 'halftone', ink: 'var(--bg)', paper: 'var(--ink)', width: 440, height: 550 }); + html = html.replace('
/, print); + } + if (heroLayout === 'card') { + html = html.replace('
', '
').replace('
\n?/g, ''); + html = html.replace('', heroDiagram({ seed })).replace('', [ + chip({ label: 'Say what to look at', x: 3, y: 62, pointer: 'tr', todo: true }), + chip({ label: 'One true detail', x: 66, y: 70, pointer: 'tl', tone: 'ink', todo: true }), + ].join('\n ')); + html = html.replace(/ *[\s\S]*?\n?/, ''); + // The card is the product section's job now: cut that section and send its links to the features instead. + html = html.replace(/[\s\S]*?\n?/g, ''); + html = html.replace(/href="#product"/g, 'href="#features"'); + } else html = html.replace(/ *[\s\S]*?\n?/, '').replace(/\n?/g, ''); + if (ground === 'frame') html = html.replace('
[\s\S]*?\n?/g, '') : html.replace(/\n?/g, ''); if (minimal) { @@ -79,9 +120,11 @@ export function scaffold(dest, { theme = 'dark', palette = 'midnight', accent, s copyFileSync(join(root, 'assets', 'motion', 'motion.css'), join(dest, 'motion.css')); copyFileSync(join(root, 'assets', 'motion', 'motion.js'), join(dest, 'motion.js')); cpSync(join(root, 'assets', 'fonts'), join(dest, 'fonts'), { recursive: true }); - writeFileSync(join(dest, 'ground.css'), `${themeCss({ dark, palette: pal })}\n/* Hero ground */\n${hero.css}\n\n/* Closing ground */\n${closer.css}\n`); + const annotations = heroLayout === 'card' ? `\n${annotationCss()}` : ''; + if (tone) writeFileSync(join(dest, 'ground.css'), `${flatThemeCss({ tone })}\n${flatGroundCss({ tone, ground })}${annotations}`); + else writeFileSync(join(dest, 'ground.css'), `${themeCss({ dark, palette: pal })}\n/* Hero ground */\n${hero.css}\n\n/* Closing ground */\n${closer.css}\n${annotations}`); const todo = (readFileSync(join(dest, 'index.html'), 'utf8').match(/data-todo/g) || []).length; - return { dest, todo, palette: pal, problems: [...hero.problems, ...closer.problems], shape: heroShape }; + return { dest, todo, palette: pal, problems: [...hero.problems, ...closer.problems], shape: tone ? `${ground} ${tone}` : `${heroShape} ground`, theme, ground, tone }; } // ---------- app starter ---------- @@ -134,7 +177,7 @@ export function scaffoldApp(dest, { theme = 'dark', accent } = {}) { if (isMain(import.meta.url)) { const { positional, flags } = parseArgs(process.argv.slice(2), { booleans: ['motes', 'minimal'] }); if (!positional[0]) { - console.error("Usage: node scripts/scaffold.mjs [--theme dark|light] [--palette ember] [--shape bowl] [--accent '#e8742c'] [--seed 1] [--grain 0.45] [--hero stack|split] [--motes] [--minimal] [--kind app]"); + console.error("Usage: node scripts/scaffold.mjs [--theme dark|light] [--palette ember] [--shape bowl] [--accent '#e8742c'] [--seed 1] [--grain 0.45] [--hero stack|split|card] [--ground lit|flat|frame] [--art column] [--motes] [--minimal] [--kind app]"); process.exit(2); } try { @@ -146,11 +189,14 @@ if (isMain(import.meta.url)) { shape: typeof flags.shape === 'string' ? flags.shape : undefined, seed: flags.seed ? Number(flags.seed) : 1, grain: flags.grain ? Number(flags.grain) : 0.45, - hero: flags.hero === 'split' ? 'split' : 'stack', + hero: ['split', 'card'].includes(flags.hero) ? flags.hero : 'stack', + ground: typeof flags.ground === 'string' ? flags.ground : 'lit', + art: typeof flags.art === 'string' ? flags.art : undefined, motes: Boolean(flags.motes), minimal: Boolean(flags.minimal), }); - console.log(`Started ${result.dest} (${flags.theme === 'light' ? 'light' : 'dark'}, ${kind === 'app' ? 'app shell' : `${result.shape} ground`})`); + console.log(`Started ${result.dest} (${kind === 'app' ? `${flags.theme === 'light' ? 'light' : 'dark'}, app shell` : `${result.theme}, ${result.shape}`})`); + if (kind !== 'app' && result.ground === 'lit') console.log('Ground: lit, the soft grainy gradient. It is the default of machine-built pages: keep it only if the concept says why this product wants light (flat and frame are the alternatives).'); console.log(`${result.todo} placeholders to replace (every data-todo). signs.mjs lists any left.`); for (const p of result.problems) console.log(`warning: ${p}`); console.log('\nNext: replace the placeholders with the real content, then run shoot, signs, check and craft on index.html.'); diff --git a/test/grounds.test.mjs b/test/grounds.test.mjs new file mode 100644 index 0000000..cae7e34 --- /dev/null +++ b/test/grounds.test.mjs @@ -0,0 +1,141 @@ +// The flat and framed grounds, the card hero and the duotone print, scaffolded and driven in a real browser. +// Each combination has to pass every check the lit starter passes: tells, contrast, targets, the pointer, overflow, +// reveals, reduced motion. A flat colour hides nothing, so contrast is read from the rendered pixels at four widths. +import assert from 'node:assert/strict'; +import { mkdtempSync, readFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { test } from 'node:test'; +import { check } from '../scripts/check.mjs'; +import { craft } from '../scripts/craft.mjs'; +import { scaffold } from '../scripts/scaffold.mjs'; +import { scan } from '../scripts/signs.mjs'; +import { findChrome, launch, openPage, toUrl } from '../scripts/lib/chrome.mjs'; + +const skip = findChrome() ? false : 'no Chrome installed'; +const wait = (ms) => new Promise((r) => setTimeout(r, ms)); +const variants = [ + { name: 'flat cobalt, card hero', options: { ground: 'flat', palette: 'cobalt', hero: 'card', seed: 2 } }, + { name: 'flat mint, split hero with a column print', options: { ground: 'flat', palette: 'mint', art: 'column', seed: 3 } }, + { name: 'frame sand, card hero', options: { ground: 'frame', palette: 'sand', hero: 'card' } }, + { name: 'frame cobalt, split hero with a strata print', options: { ground: 'frame', palette: 'cobalt', art: 'strata' } }, +]; + +for (const { name, options } of variants) { + const dir = mkdtempSync(join(tmpdir(), 'ground-')); + const result = scaffold(dir, options); + const file = join(dir, 'index.html'); + + test(`${name}: the scaffold writes a theme that follows the colour, and the only tell is the placeholder marker`, { skip }, async () => { + assert.deepEqual(result.problems, []); + assert.ok(result.todo > 40, `${result.todo} placeholders`); + assert.equal(result.theme, { cobalt: 'dark', mint: 'light', sand: 'light' }[options.palette]); + assert.deepEqual([...new Set((await scan(file)).map((f) => f.tell))], ['Unfinished placeholder']); + }); + + test(`${name}: contrast, targets, names and focus pass at 320, 390, 1440 and 2560`, { skip }, async () => { + for (const r of await check(file, [320, 390, 1440, 2560])) assert.deepEqual(r.problems, [], `${r.width}px: ${JSON.stringify(r.problems)}`); + }); + + test(`${name}: every control answers the pointer, with a visible change`, { skip }, async () => { + for (const r of await craft(file, { widths: [390, 1440] })) assert.deepEqual(r.problems, [], `${r.width}px: ${JSON.stringify(r.problems)}`); + }); + + test(`${name}: nothing overflows, no console errors, every reveal fires, reduced motion shows everything`, { skip }, async () => { + const chrome = await launch(); + try { + for (const width of [320, 1440, 2560]) { + const page = await openPage(chrome.browser, { width, height: width < 700 ? 800 : 900, mobile: width < 700 }); + await page.goto(toUrl(file), 1200); + assert.equal(await page.evaluate('document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1'), true, `${width}px scrolls sideways`); + const total = await page.evaluate('document.documentElement.scrollHeight'); + for (let y = 0; y <= total; y += 600) { await page.evaluate(`window.scrollTo(0, ${y})`); await wait(80); } + await wait(1500); + assert.equal(await page.evaluate("[...document.querySelectorAll('[data-reveal]')].filter((e) => !e.classList.contains('in')).length"), 0, `${width}px: every reveal fired`); + assert.deepEqual(page.logs, [], `${width}px console errors: ${page.logs.join('; ')}`); + await page.close(); + } + const reduced = await openPage(chrome.browser, { width: 1440, height: 900, reducedMotion: true }); + await reduced.goto(toUrl(file), 400); + assert.equal(await reduced.evaluate("[...document.querySelectorAll('[data-reveal], [data-enter], .m-line > span')].filter((e) => Number(getComputedStyle(e).opacity) < 1).length"), 0); + assert.equal(await reduced.evaluate("document.getAnimations().filter((a) => a.playState === 'running' && a.effect.getTiming().iterations === Infinity).length"), 0); + } finally { await chrome.close(); } + }); +} + +test('a flat ground is a flat colour: the hero shows one tone, with grain and nothing lit', { skip }, async () => { + const dir = mkdtempSync(join(tmpdir(), 'ground-flat-')); + scaffold(dir, { ground: 'flat', palette: 'sand' }); + const css = readFileSync(join(dir, 'ground.css'), 'utf8'); + assert.doesNotMatch(css, /radial-gradient|conic-gradient/, 'no light in a flat ground'); + assert.match(css, /--bg: #e8dfca/); + assert.match(css, /feTurbulence/, 'a little grain, so it is not dead'); + assert.equal(readFileSync(join(dir, 'index.html'), 'utf8').match(/data-theme="(\w+)"/)[1], 'light'); +}); + +test('the card hero is cropped by the bottom of the first screen, and a phone drops the chips and the diagram', { skip }, async () => { + const dir = mkdtempSync(join(tmpdir(), 'ground-card-')); + scaffold(dir, { ground: 'flat', palette: 'cobalt', hero: 'card' }); + const chrome = await launch(); + try { + const desktop = await openPage(chrome.browser, { width: 1440, height: 900 }); + await desktop.goto(toUrl(join(dir, 'index.html')), 1500); + const m = await desktop.evaluate(`(() => { const h = document.querySelector('.hero').getBoundingClientRect(); const w = document.querySelector('.hero-card .window').getBoundingClientRect(); const d = document.querySelector('.hero-card .diagram'); return { heroBottom: h.bottom, windowBottom: w.bottom, windowTop: w.top, vh: innerHeight, chips: [...document.querySelectorAll('.chip')].filter((c) => getComputedStyle(c).display !== 'none').length, diagram: getComputedStyle(d).display }; })()`); + assert.ok(m.heroBottom <= m.vh, 'the hero is one screen tall'); + assert.ok(m.windowBottom > m.heroBottom + 20, 'the card runs past the bottom of the hero and is cropped'); + assert.ok(m.windowTop < m.vh - 150, 'a good part of the card shows in the first screen'); + assert.equal(m.chips, 2); + assert.notEqual(m.diagram, 'none'); + const phone = await openPage(chrome.browser, { width: 390, height: 844, mobile: true }); + await phone.goto(toUrl(join(dir, 'index.html')), 1200); + const p = await phone.evaluate("({ chips: [...document.querySelectorAll('.chip')].filter((c) => getComputedStyle(c).display !== 'none').length, diagram: getComputedStyle(document.querySelector('.hero-card .diagram')).display })"); + assert.deepEqual(p, { chips: 0, diagram: 'none' }); + } finally { await chrome.close(); } +}); + +test('the card hero replaces the product section and every link still lands', async () => { + const dir = mkdtempSync(join(tmpdir(), 'ground-links-')); + scaffold(dir, { hero: 'card' }); + const html = readFileSync(join(dir, 'index.html'), 'utf8'); + assert.doesNotMatch(html, /id="product"|href="#product"||||/); + const ids = new Set([...html.matchAll(/\bid="([^"]+)"/g)].map((m) => m[1])); + for (const [, target] of html.matchAll(/href="#([^"]+)"/g)) assert.ok(ids.has(target), `#${target} has nothing to land on`); +}); + +test('the split hero keeps its stats and drops the card; the stack hero has neither', () => { + for (const hero of ['stack', 'split']) { + const html = readFileSync(join(scaffoldTo({ hero }), 'index.html'), 'utf8'); + assert.match(html, /class="stats"/); + assert.doesNotMatch(html, /hero-card||/); + } +}); + +test('the options refuse nonsense in plain words', () => { + assert.throws(() => scaffold(mkdtempSync(join(tmpdir(), 'g-')), { ground: 'glow' }), /lit, flat or frame/); + assert.throws(() => scaffold(mkdtempSync(join(tmpdir(), 'g-')), { hero: 'wide' }), /stack, split or card/); + assert.throws(() => scaffold(mkdtempSync(join(tmpdir(), 'g-')), { art: 'unicorn' }), /column, vase, sphere, drape, strata/); + assert.throws(() => scaffold(mkdtempSync(join(tmpdir(), 'g-')), { art: 'column', hero: 'card' }), /split hero/); + assert.throws(() => scaffold(mkdtempSync(join(tmpdir(), 'g-')), { ground: 'flat', palette: 'plum' }), /cobalt, mint, sand/); +}); + +test('a lit ground still scaffolds exactly as before: the same files, a grainient, no flat css', () => { + const dir = scaffoldTo({ theme: 'dark', palette: 'midnight' }); + const css = readFileSync(join(dir, 'ground.css'), 'utf8'); + assert.match(css, /radial-gradient/); + assert.doesNotMatch(css, /--panel/); + assert.doesNotMatch(readFileSync(join(dir, 'index.html'), 'utf8'), /is-frame|has-card|is-art/); +}); + +test('a print stands in for the object only when asked, and it carries no text of its own to fake a claim', () => { + const html = readFileSync(join(scaffoldTo({ art: 'drape', ground: 'flat' }), 'index.html'), 'utf8'); + assert.match(html, /class="hero-object is-art"/); + assert.match(html, /var\(--bg\)/); + assert.doesNotMatch(html.match(/
/)[0], //)[0], /data-todo/, 'the caption still says to replace it'); +}); + +function scaffoldTo(options) { + const dir = mkdtempSync(join(tmpdir(), 'ground-x-')); + scaffold(dir, options); + return dir; +} diff --git a/test/swap.test.mjs b/test/swap.test.mjs index cbdd227..32ad9f9 100644 --- a/test/swap.test.mjs +++ b/test/swap.test.mjs @@ -62,3 +62,23 @@ test('the starter hero fails until its object is replaced', { skip }, async () = const r = await swap(join(dir, 'index.html'), { nouns: ['clause', 'redline'] }); assert.equal(r.pass, false, 'a stack hero with only a ground has no artwork'); }); + +test('the card hero passes once its card and chips are about the product, and not before', { skip }, async () => { + const { mkdtempSync, readFileSync, writeFileSync } = await import('node:fs'); + const { tmpdir } = await import('node:os'); + const { join } = await import('node:path'); + const { scaffold } = await import('../scripts/scaffold.mjs'); + const dir = mkdtempSync(join(tmpdir(), 'swap-card-')); + scaffold(dir, { ground: 'flat', palette: 'cobalt', hero: 'card' }); + const file = join(dir, 'index.html'); + const nouns = ['clause', 'redline', 'contract']; + assert.equal((await swap(file, { nouns })).pass, false, 'placeholders name nothing'); + const html = readFileSync(file, 'utf8') + .replace("Example: the product's main screen, cropped at the fold. Replace with the real screen.", 'Example: clause 4.2 of a contract marked against the standard, with a suggested redline') + .replace('What it does,', 'Every clause checked,') + .replace('One true detail', 'Redline suggested'); + writeFileSync(file, html); + const r = await swap(file, { nouns, name: 'Marrow' }); + assert.equal(r.pass, true, JSON.stringify(r.reasons)); + assert.ok(r.found.headline.includes('clause') && r.found.artwork.includes('redline')); +}); diff --git a/test/tracking.test.mjs b/test/tracking.test.mjs index 8dbd079..3fc8951 100644 --- a/test/tracking.test.mjs +++ b/test/tracking.test.mjs @@ -33,20 +33,22 @@ test('tightestAt is size-aware: more room, tighter tracking', { skip }, async () test('the landing starter never sets type tighter than the measured evidence allows, at any width', { skip }, async () => { const sans = await measureTracking({ font: 'Geist' }); const numerals = await measureTracking({ font: 'Geist', headlines: NUMERALS }); - const dir = mkdtempSync(join(tmpdir(), 'tracking-starter-')); - scaffold(dir, { theme: 'dark', palette: 'midnight' }); const chrome = await launch(); try { + for (const [variant, options] of [['stack', { theme: 'dark', palette: 'midnight' }], ['split', { theme: 'dark', palette: 'midnight', hero: 'split' }], ['card', { ground: 'flat', palette: 'cobalt', hero: 'card' }]]) { + const dir = mkdtempSync(join(tmpdir(), `tracking-${variant}-`)); + scaffold(dir, options); for (const width of [320, 390, 768, 1024, 1440, 2560]) { const page = await openPage(chrome.browser, { width, height: 900, mobile: width < 700 }); await page.goto(toUrl(join(dir, 'index.html')), 600); - const measured = await page.evaluate(`['.display', '.h2', '.stats dd', '.cell h3', '.kpi strong', '.step h3'].map((sel) => { const el = document.querySelector(sel); const s = getComputedStyle(el); const size = parseFloat(s.fontSize); return [sel, size, s.letterSpacing === 'normal' ? 0 : parseFloat(s.letterSpacing) / size]; })`); + const measured = await page.evaluate(`['.display', '.h2', '.stats dd', '.cell h3', '.kpi strong', '.step h3'].filter((sel) => document.querySelector(sel)).map((sel) => { const el = document.querySelector(sel); const s = getComputedStyle(el); const size = parseFloat(s.fontSize); return [sel, size, s.letterSpacing === 'normal' ? 0 : parseFloat(s.letterSpacing) / size]; })`); for (const [sel, size, em] of measured) { const rows = /dd|strong/.test(sel) ? numerals : sans; const limit = tightestAt(rows, size); - assert.ok(em >= limit - 0.0051, `${width}px: ${sel} is ${size}px at ${em.toFixed(3)}em; the evidence allows ${limit}em`); + assert.ok(em >= limit - 0.0051, `${variant} ${width}px: ${sel} is ${size}px at ${em.toFixed(3)}em; the evidence allows ${limit}em`); } await page.close(); } + } } finally { await chrome.close(); } }); From c94832b7fc772c3a8c9b65c35d73eb3fecbacae9 Mon Sep 17 00:00:00 2001 From: Koryei Date: Wed, 25 Nov 2026 12:52:46 -0500 Subject: [PATCH 2/5] test(evals): a name mask for blind judging, and two new briefs mask.mjs renders a page with the product name removed from text, labels, alt text and title, optionally with all text blurred, so a judge sees composition and artwork without knowing the product. Brief 13 is a product with an obvious native artifact (a core-sample log); brief 14 is a dull one (shift scheduling). Co-Authored-By: Claude Sonnet 5.5 --- evals/briefs/13-native-artifact.md | 14 +++++ evals/briefs/14-plain-scheduling.md | 13 +++++ evals/mask.mjs | 88 +++++++++++++++++++++++++++++ test/mask.test.mjs | 45 +++++++++++++++ 4 files changed, 160 insertions(+) create mode 100644 evals/briefs/13-native-artifact.md create mode 100644 evals/briefs/14-plain-scheduling.md create mode 100644 evals/mask.mjs create mode 100644 test/mask.test.mjs diff --git a/evals/briefs/13-native-artifact.md b/evals/briefs/13-native-artifact.md new file mode 100644 index 0000000..f1641a9 --- /dev/null +++ b/evals/briefs/13-native-artifact.md @@ -0,0 +1,14 @@ +# Landing page: a product with an obvious native artifact + +Build a landing page for **Coreline**, a field-logging app for geologists who log drill core. On site they record each sample of a core run, and the app assembles the strip log (the vertical column that shows the layers by depth) that goes into the report. + +Facts you may use, and nothing else: + +- Log a core run on a phone, offline, in the field; it syncs when there is signal. +- Each sample records the depth from and to (in metres), a rock type from the firm's own list, a colour and a photo. +- The strip log is drawn automatically from the samples and exports as PDF or CSV. +- A geologist signs off each run. Nothing is final until it is signed. +- Free for one project; then £19 per geologist per month. +- Made in Aberdeen. + +Do not invent customer names, counts, accuracy figures, awards or claims. Any log, depth or figure you draw must be marked as example data. One call to action: start a free project. Output one self-contained HTML file. diff --git a/evals/briefs/14-plain-scheduling.md b/evals/briefs/14-plain-scheduling.md new file mode 100644 index 0000000..34a7fa6 --- /dev/null +++ b/evals/briefs/14-plain-scheduling.md @@ -0,0 +1,13 @@ +# Landing page: a dull product + +Build a landing page for **Tern**, a shift-scheduling app for small cafes and shops. The manager builds the week as a grid of shifts, staff see their own shifts on their phones, and it warns when the rota breaks a rule. + +Facts you may use, and nothing else: + +- Staff enter when they can and cannot work; the manager drags shifts onto a weekly grid. +- It warns when someone is double-booked, or would go over the hours agreed in their contract. +- Staff see their shifts on their phone and can ask to swap; the manager approves every swap. +- Free for up to 10 staff; then £2 per person per month. +- Made in Manchester. + +Do not invent customer names, counts, savings, ratings or claims. Any rota or figure you draw must be marked as example data. One call to action: try it free. Output one self-contained HTML file. diff --git a/evals/mask.mjs b/evals/mask.mjs new file mode 100644 index 0000000..fff8592 --- /dev/null +++ b/evals/mask.mjs @@ -0,0 +1,88 @@ +#!/usr/bin/env node +// Screenshots of a page with the product name masked, for a judge who must not know which product it is. +// +// node evals/mask.mjs --name Marrow --out dir --label P1 [--blur-text] [--scroll 900] +// +// Writes