Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,72 @@
}
}

/*
* Gallery tiles (components/gallery/tile.tsx). The bezel is lit by the same two vars the
* charge field reads, so the page's one pointer listener drives it too — no per-tile work.
*
* Both lit layers use `fixed` attachment: --px/--py are viewport coordinates, and a fixed
* background is positioned against the viewport, so the radial on every tile lines up with
* the field behind the page as if the tiles were not there. Two consequences:
*
* 1. The field passes through the bezel at the same 9%/7% it has on the page, instead of
* stopping dead at each tile's edge.
* 2. The hairline edge nearest the cursor warms to --charge — on neighbouring tiles as
* well as the hovered one, so the grid reads as one surface in one field.
*
* At rest the vars are parked at -1000px and both layers resolve to nothing: the tile is
* --surface inside a --rule hairline. Fine pointers only — iOS ignores `fixed`, which would
* pin the radial to each tile's own box, and touch already gets its charge from the anchor.
*/
.gallery-tile {
border: 1px solid transparent;
background:
linear-gradient(var(--surface) 0 0) padding-box,
linear-gradient(var(--rule) 0 0) border-box;
}
@media (hover: hover) and (pointer: fine) {
.gallery-tile {
background:
radial-gradient(
560px circle at var(--px) var(--py),
color-mix(in oklch, var(--brand) var(--charge-alpha), transparent),
transparent 62%
)
fixed padding-box,
linear-gradient(var(--surface) 0 0) padding-box,
radial-gradient(
320px circle at var(--px) var(--py),
color-mix(in oklch, var(--charge) 80%, var(--rule)),
var(--rule) 100%
)
fixed border-box;
}
}

/*
* The recessed stage: a faint dot lattice, strongest at the walls and gone at the centre,
* so the bench has a surface without anything sitting behind the effect itself. Painted on
* a pseudo-element under the preview (z -1 inside the stage's own stacking context) because
* the fade is a mask, and masking the stage would mask the effect with it.
*/
.gallery-stage {
isolation: isolate;
}
.gallery-stage::before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
border-radius: inherit;
background: radial-gradient(
circle,
color-mix(in oklch, var(--mid) 32%, transparent) 0.75px,
transparent 1.25px
)
center / 18px 18px;
mask-image: radial-gradient(closest-side, transparent 55%, #000 150%);
}

/*
* registry/hover/border-trace-button — the lap. Mirrored here so this repo's own gallery
* renders the effect live; ships to consumers via registry.json's "css" field
Expand Down
59 changes: 53 additions & 6 deletions components/gallery/tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
type Effect,
type GroupDensity,
type UpcomingEffect,
effects,
installCommand,
motionSummary,
} from "@/lib/registry";
Expand All @@ -21,6 +22,39 @@ const stageHeight: Record<GroupDensity, string> = {
wide: "min-h-[320px] sm:min-h-[360px]",
};

/**
* Viewfinder marks in the stage's four corners. At rest they sit in quiet --mid; while the
* tile is hovered or holds focus they close in on the effect and take the charge — the
* stage "finds focus" on whatever the visitor is pointing at. They frame the effect and
* never cross it: inset from the walls, pointer-transparent, nothing drawn in the middle.
*
* Asymmetric on purpose (docs/MOTION.md G4): in on the out-curve inside the enter band,
* back out on the spring inside the release band. Scale, not inset, so it stays on the
* compositor (G12); reduced motion keeps the colour and drops the travel (G10).
*/
function FocusMarks() {
const corner = "absolute size-3 border-current";
return (
<span
aria-hidden
className={[
"pointer-events-none absolute inset-3 text-[color-mix(in_oklch,var(--mid)_55%,transparent)]",
"[transition:color_420ms_ease,transform_420ms_cubic-bezier(0.34,1.4,0.64,1)]",
"group-hover/tile:text-[var(--charge)] group-hover/tile:[transform:scale(0.965)] group-hover/tile:[transition:color_220ms_ease,transform_220ms_cubic-bezier(0.23,1,0.32,1)]",
"group-focus-within/tile:text-[var(--charge)] group-focus-within/tile:[transform:scale(0.965)]",
"motion-reduce:transform-none!",
].join(" ")}
>
<span className={`${corner} left-0 top-0 rounded-tl-[6px] border-l border-t`} />
<span className={`${corner} right-0 top-0 rounded-tr-[6px] border-r border-t`} />
<span className={`${corner} bottom-0 left-0 rounded-bl-[6px] border-b border-l`} />
<span className={`${corner} bottom-0 right-0 rounded-br-[6px] border-b border-r`} />
</span>
);
}

const pad = (n: number) => String(n).padStart(2, "0");

/**
* One gallery cell: a bezel holding a recessed stage, with a footer strip beneath it.
*
Expand All @@ -31,8 +65,9 @@ const stageHeight: Record<GroupDensity, string> = {
* differentiator), the install command copy (persistent, no hover reveal), and the
* arrow that opens the full sheet: preview, source, install, motion.
*
* Colour stays off at rest. Under the pointer the bezel's edge and the arrow warm to
* --charge, and nothing else does (docs/DESIGN.md § Thesis).
* Colour stays off at rest. Under the pointer the bezel's nearest edge, the focus marks,
* the readout and the arrow warm to --charge, and nothing else does (docs/DESIGN.md
* § Thesis). The edge lighting is `.gallery-tile` in app/globals.css.
*/
export async function GalleryTile({
effect,
Expand All @@ -55,6 +90,8 @@ export async function GalleryTile({
) : (
<span className="font-mono text-xs text-[var(--mid)]">preview missing</span>
);
// Position in the frozen 12, not within the group: the numbering runs down the page.
const index = pad(effects.indexOf(effect) + 1);

return (
// The id gives each tile a real fragment target, so a preview that needs a focusable
Expand All @@ -64,17 +101,27 @@ export async function GalleryTile({
// On touch the charge anchors to whichever tile is nearest the viewport centre
// (docs/DESIGN.md § Touch); components/gallery/charge-field.tsx queries this attribute.
data-charge-anchor=""
className="group/tile flex scroll-mt-28 flex-col rounded-[22px] border border-[var(--rule)] bg-[var(--surface)] p-1.5 [transition:border-color_300ms_cubic-bezier(0.23,1,0.32,1)] hover:border-[color-mix(in_oklch,var(--charge)_45%,var(--rule))] focus-within:border-[color-mix(in_oklch,var(--charge)_45%,var(--rule))]"
className="gallery-tile group/tile flex scroll-mt-28 flex-col rounded-[22px] p-1.5"
>
<div
className={`flex flex-1 items-center justify-center rounded-2xl border border-[var(--rule)] bg-[var(--paper)] p-6 ${stageHeight[density]}`}
className={`gallery-stage relative flex flex-1 items-center justify-center rounded-2xl border border-[var(--rule)] bg-[var(--paper)] p-8 shadow-[inset_0_1px_2px_rgb(0_0_0/0.06)] ${stageHeight[density]}`}
>
<FocusMarks />
{preview}
</div>

<div className="relative flex items-center gap-3 rounded-b-2xl px-3 pb-2 pt-3">
<div className="relative flex items-center gap-3 rounded-b-2xl py-2 pl-2 pr-3 pt-3">
{/* The channel number: where this effect sits in the set, in the readout's mono. */}
<span
aria-hidden
className="hidden self-stretch border-r border-[var(--rule)] pr-3 sm:block pt-[3px] font-mono text-[11px] tabular-nums leading-none text-[var(--mid)]"
>
{index}
</span>
<div className="min-w-0 flex-1">
<h3 className="truncate text-[15px] font-medium text-[var(--ink)]">{effect.title}</h3>
<h3 className="truncate text-[15px] font-medium tracking-[-0.01em] text-[var(--ink)]">
{effect.title}
</h3>
<p className="mt-0.5 truncate font-mono text-[11px] tabular-nums text-[var(--mid)] [transition:color_300ms_cubic-bezier(0.23,1,0.32,1)] group-hover/tile:text-[var(--charge)]">
{motionSummary(effect.motion)}
</p>
Expand Down
17 changes: 17 additions & 0 deletions docs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,23 @@ footer strip beneath: the name, a persistent one-line readout of the motion valu
**effect sheet**. Groups lay out two columns wide — each group is four effects, so it is a
clean 2x2 and every stage has room.

The tile carries the page thesis in three places, all achromatic at rest:

- **The lit edge.** The bezel is painted with the same `--px`/`--py` radial as the charge
field, on `fixed` attachment so it lines up with the field behind the page. The field
passes through the tile at its usual alpha instead of stopping at the edge, and the
hairline nearest the cursor warms to `--charge` — on neighbouring tiles too, so the grid
reads as one surface in one field. No extra listener; `.gallery-tile` in
`app/globals.css`. Fine pointers only (iOS ignores `fixed`).
- **Focus marks.** Four viewfinder corners inside the stage, `--mid` at rest. On hover or
focus-within they close in on the effect (scale, out-curve, 220ms) and take `--charge`;
they release on the spring. Reduced motion keeps the colour and drops the travel.
- **The bench.** A faint dot lattice on the stage, strongest at the walls and masked out
at the centre, so nothing ever sits behind the effect itself.

The footer leads with the effect's channel number in the frozen 12 (`01`–`12`, mono, hidden
below `sm` so the readout keeps its room).

The effect sheet (`components/gallery/effect-sheet.tsx`) is the page an effect would
otherwise get, kept inside the single page as a native modal `<dialog>`: group badge, title,
description and install command, then four tabs — **Preview** (a large stage with a
Expand Down
73 changes: 46 additions & 27 deletions registry/hover/chase-border-card/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,65 @@
import { ChaseBorderCard } from "./chase-border-card";

/**
* The ring is left on `currentColor` — tonal, not accent. Two reasons. docs/DESIGN.md
* §Thesis keeps the page achromatic at rest, and the ring is visible at rest on any device
* without hover, so a charge-coloured ring would be a resting accent. And the tile this
* renders inside already warms its own border to `--charge` under the pointer
* (components/gallery/tile.tsx), so a second charge-coloured edge 24px away would read as
* one doubled response rather than two effects. Boldness is spent on the motion here, which
* is what DESIGN.md asks for.
* A release card — the one on a landing page that says "this just shipped". A slow turn
* suits it: something is live, and it is expensive enough not to hurry. The figures are the
* product's own (twelve effects, one file each, no dependencies), so the demo makes no
* claim the registry does not.
*
* The ring is left on `currentColor` — tonal, not accent. docs/DESIGN.md § Thesis keeps the
* page achromatic at rest, and the ring is visible at rest on any device without hover, so a
* charge-coloured ring would be a resting accent. The tile around it already lights its
* nearest edge under the pointer, so a second charge-coloured edge would read as one doubled
* response rather than two effects. Boldness is spent on the motion.
*
* The card carries a real link so the keyboard path (`:focus-visible`) is reachable by
* tabbing rather than only existing in the source.
*/
const figures: [string, string][] = [
["12", "effects"],
["1", "file each"],
["0", "dependencies"],
];

export default function Preview() {
return (
<ChaseBorderCard
// An INSET ring, not the outset default: Tailwind v4's `ring-*` paints a box-shadow
// outside the border box, while the annulus sits 1px inside it. The two would be
// contiguous but not coincident, giving a 2px two-toned edge that reads as a dark
// line travelling inside the border rather than as the border itself turning. Inset
// puts the static hairline in the same 1px band, so the chase replaces it as it
// passes.
// Column layout so the link sits on the bottom edge instead of trailing the copy with
// a dead third of the card beneath it. The extra height also lengthens the perimeter
// the chase runs, which is the effect.
className="flex min-h-[230px] w-full max-w-[400px] flex-col rounded-lg bg-[var(--surface)] p-5 inset-ring-1 inset-ring-[var(--rule)]"
// outside the border box, while the annulus sits 1px inside it. Inset puts the static
// hairline in the same 1px band, so the chase replaces it as it passes.
className="flex w-full max-w-[400px] flex-col rounded-xl bg-[var(--surface)] p-6 inset-ring-1 inset-ring-[var(--rule)]"
ringWidth={1}
>
<p className="font-mono text-[10px] uppercase tracking-widest text-[var(--mid)]">
Loop 08
</p>
<h4 className="mt-2 text-sm font-medium text-[var(--ink)]">Turning slowly</h4>
<p className="mt-1 text-xs leading-relaxed text-[var(--mid)]">
Seven seconds a revolution. It coasts to a stop rather than cutting.
<div className="flex items-baseline justify-between font-mono text-[10px] uppercase tracking-widest text-[var(--mid)]">
<span>Release</span>
<span className="tabular-nums">v1.0</span>
</div>
<p className="mt-3 font-display text-[26px] font-medium leading-[1.02] tracking-[-0.035em] text-[var(--ink)]">
The full set is out.
</p>

<dl className="mt-6 grid grid-cols-3 border-y border-[var(--rule)]">
{figures.map(([figure, label], i) => (
<div
key={label}
className={`flex flex-col-reverse py-3 ${i > 0 ? "border-l border-[var(--rule)] pl-4" : ""}`}
>
<dt className="mt-1 font-mono text-[10px] uppercase tracking-widest text-[var(--mid)]">
{label}
</dt>
<dd className="font-display text-[28px] font-medium leading-none tracking-[-0.04em] tabular-nums text-[var(--ink)]">
{figure}
</dd>
</div>
))}
</dl>

<a
href="#chase-border-card"
className={[
// mt-auto pins it to the bottom of the column; self-start keeps it shrink-to-fit,
// because a flex item is blockified and would otherwise stretch the underline and
// the focus ring across the full width of the card.
"mt-auto self-start rounded-sm font-mono text-[11px] text-[var(--ink)]",
// self-start keeps it shrink-to-fit; a flex item is blockified and would otherwise
// stretch the underline and the focus ring across the full width of the card.
"mt-5 self-start rounded-sm text-xs font-medium text-[var(--ink)]",
// G1/G2/G3 — every property named, project curve, inside the enter band.
// G4/G11 — transform sits on the BASE rule, not only under :active, or the
// release would have no transform in its property list and would snap.
Expand All @@ -52,7 +71,7 @@ export default function Preview() {
"focus-visible:text-[var(--charge)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--charge)]",
].join(" ")}
>
Watch it stop
Read the release notes
</a>
</ChaseBorderCard>
);
Expand Down
41 changes: 36 additions & 5 deletions registry/hover/reveal-card/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { RevealCard } from "./reveal-card";
export default function Preview() {
return (
<RevealCard
className="w-full max-w-[400px] rounded-lg border border-[var(--rule)] bg-[var(--surface)]"
className="w-full max-w-[400px] rounded-xl border border-[var(--rule)] bg-[var(--surface)]"
caption={
<div className="flex h-8 items-center gap-2.5 border-t border-[var(--rule)] bg-[var(--surface)] px-4">
<span className="shrink-0 font-mono text-[10px] uppercase tracking-widest text-[var(--mid)]">
Expand All @@ -44,21 +44,52 @@ export default function Preview() {
>
Chlorophyll assay
</a>
<span className="ml-auto shrink-0 font-mono text-[10px] tabular-nums text-[var(--mid)]">
2026
</span>
</div>
}
>
{/*
* A specimen under a reticle: the kind of plate a portfolio or case-study grid leads
* with. The reticle and its labels are part of the picture, drawn in the plate's own
* light ink, so they recede and desaturate with it — the whole image leaves, not just
* its background. Literal colour is correct here and nowhere else in the gallery; see
* the note at the top of this file.
*/}
<div
className="h-[228px] w-full"
className="relative h-[228px] w-full overflow-hidden"
style={{
backgroundColor: "#6f8f4f",
backgroundImage: [
"radial-gradient(130% 95% at 20% 12%, #b9cf92 0%, transparent 58%)",
"radial-gradient(95% 85% at 82% 88%, #33502c 0%, transparent 60%)",
"repeating-linear-gradient(90deg, rgba(20,21,15,0.08) 0 1px, transparent 1px 13px)",
"repeating-linear-gradient(0deg, rgba(20,21,15,0.08) 0 1px, transparent 1px 13px)",
"radial-gradient(circle, rgba(20,21,15,0.16) 0 1.5px, transparent 2px)",
].join(","),
backgroundSize: "auto, auto, 13px 13px",
}}
/>
>
<div
aria-hidden
className="absolute left-[64%] top-[46%] size-[148px] -translate-x-1/2 -translate-y-1/2 rounded-full border border-[rgba(236,237,232,0.55)]"
>
<span className="absolute inset-[22%] rounded-full border border-dashed border-[rgba(236,237,232,0.35)]" />
<span className="absolute -left-4 -right-4 top-1/2 h-px bg-[rgba(236,237,232,0.45)]" />
<span className="absolute -bottom-4 -top-4 left-1/2 w-px bg-[rgba(236,237,232,0.45)]" />
</div>
<span
aria-hidden
className="absolute left-4 top-3.5 font-mono text-[10px] uppercase tracking-widest text-[rgba(236,237,232,0.85)]"
>
Fig. 07
</span>
<span
aria-hidden
className="absolute right-4 top-3.5 font-mono text-[10px] tabular-nums tracking-widest text-[rgba(236,237,232,0.85)]"
>
×40
</span>
</div>
</RevealCard>
);
}
Loading
Loading