oficina / docs Public

Docs: press in, with rastrillo's touch, instead of the ripple

Paul, from the press lab: press in is best, with the touch rastrillo
has, a mark like a finger on metal that fades after release.

- brand/light.css sets rastrillo's day-theme press strengths (a
  selector and a media query for dark: light-dark() takes only
  colours), which turns on its buttons' own press spot and wash.
- Docs' controls read the same way: --docs-press (registered, 1 at
  once while held, fading over 0.7s) and --docs-spot, a 70px mark at
  the press (pointer.js writes --rst-px/--rst-py), on the toolbar's
  buttons, the list's rows, menu items and a shelf page's paper.
- Pressed, a control gives (toolbar 0.92, rastrillo buttons 0.965,
  shelf page 0.97, row 0.992) and springs back with a slight
  overshoot. Not under reduced motion.
- The ripple and its layer are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev f55ca7ab4827daa4b11c32913724778d8c5eb264 parent 83b0bc6
4 files changed, +94 −88
  • internal/docs/brand/light.css +61 −35
  • internal/docs/brand/pointer.js +13 −46
  • internal/docs/views/list.html +15 −3
  • internal/docs/views/show.html +5 −4

CI passed — run details

diff --git a/internal/docs/brand/light.css b/internal/docs/brand/light.css
index 9f36a58..e59f241 100644
--- a/internal/docs/brand/light.css
+++ b/internal/docs/brand/light.css
@@ -10,50 +10,76 @@
--rst-sheen-plain: light-dark(color-mix(in srgb, var(--rst-accent) 10%, transparent), rgba(255, 255, 255, 0.05));
--rst-light-rim: light-dark(color-mix(in srgb, var(--rst-accent) 38%, var(--rst-line)), color-mix(in srgb, var(--rst-accent) 40%, #505050));
--rst-light-wash: light-dark(color-mix(in srgb, var(--rst-accent) 4%, transparent), rgba(255, 255, 255, 0.025));
+ /* A press: rastrillo's strengths (its day theme), which light up its
+ own buttons' press spot and wash, and which Docs' controls below
+ read the same way. */
+ --rst-press-wash: 0.08;
+ --rst-press-spot: 0.16;
+ --rst-press-wash-plain: 0.04;
+ --rst-press-spot-plain: 0.07;
/* The pool of light a pointer casts on the control it is over. */
--docs-light-tint: light-dark(color-mix(in srgb, var(--rst-accent) 10%, transparent), color-mix(in srgb, var(--rst-accent) 16%, transparent));
}
+/* Dark, as rastrillo's day theme has it: numbers, so a selector and a
+ media query rather than light-dark(), which takes only colours. */
+:root[data-theme="dark"] { --rst-press-wash: 0.18; --rst-press-spot: 0.30; --rst-press-wash-plain: 0.18; --rst-press-spot-plain: 0.30; }
+@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --rst-press-wash: 0.18; --rst-press-spot: 0.30; --rst-press-wash-plain: 0.18; --rst-press-spot-plain: 0.30; } }
+
+/* A press, on Docs' own controls, the way rastrillo presses its
+ buttons: --docs-press is 1 while held, at once, and fades to 0 over
+ 0.7s after release, which is what a registered number can transition;
+ --docs-spot is the mark it leaves, darkest where the press landed
+ (pointer.js writes --rst-px/--rst-py), drawn as a background layer by
+ each control's own rule. And the control gives a little under the
+ press and springs back on release, overshooting slightly.
+ Inherited, so a shelf page's paper can read its tile's press. */
+@property --docs-press {
+ syntax: "<number>";
+ inherits: true;
+ initial-value: 0;
+}
+:root {
+ --docs-spot: radial-gradient(70px circle at var(--rst-px, 50%) var(--rst-py, 50%), rgb(0 0 0 / calc(var(--docs-press, 0) * var(--rst-press-spot-plain, 0))), transparent 75%);
+ --docs-release: --docs-press 0.7s cubic-bezier(0.2, 0.6, 0.3, 1), scale 0.42s cubic-bezier(0.3, 1.6, 0.5, 1);
+}
+[docs-tool],
+[docs-tile],
+[docs-list] [rst-row],
+[estilo-menu-item] {
+ transition: var(--docs-release);
+}
+[docs-tool]:active:not(:disabled),
+[docs-tile]:active,
+[docs-list] [rst-row]:active,
+[estilo-menu-item]:active:not(:disabled) {
+ --docs-press: 1;
+ transition: scale 90ms ease-out;
+}
+[docs-tool]:active:not(:disabled) { scale: 0.92; }
+[docs-list] [rst-row]:active { scale: 0.992; }
+[estilo-menu-item]:not(:disabled) {
+ background-image: var(--docs-spot);
+}
+/* rastrillo's buttons already draw the spot and the fade; they give
+ under the press the same way, keeping their own transitions. */
+[rst-btn] {
+ transition: --rst-press 0.7s cubic-bezier(0.2, 0.6, 0.3, 1), translate 0.3s ease-out, scale 0.42s cubic-bezier(0.3, 1.6, 0.5, 1);
+}
+[rst-btn]:active:not(:disabled):not([aria-busy="true"]) {
+ scale: 0.965;
+ transition: scale 90ms ease-out;
+}
+@media (prefers-reduced-motion: reduce) {
+ [docs-tool]:active, [docs-list] [rst-row]:active, [rst-btn]:active { scale: none; }
+}
+
@media (hover: hover) {
/* A menu's rows: the hover fill estilo draws, with the light on it. */
[estilo-menu-item]:hover:not(:disabled) {
- background-image: radial-gradient(120px circle at var(--rst-mx, 50%) var(--rst-my, 50%), var(--docs-light-tint), transparent 70%);
+ background-image: var(--docs-spot), radial-gradient(120px circle at var(--rst-mx, 50%) var(--rst-my, 50%), var(--docs-light-tint), transparent 70%);
}
}
-/* The ripple a press sends out (pointer.js): a layer over everything
- that takes no pointer; in it, a frame laid over the pressed control
- that clips to its shape, and in that, one faint ring of the accent's
- light, soft at both edges. Sized and placed there, coloured here. */
-[docs-ripples] {
- position: fixed;
- inset: 0;
- z-index: 2147483647;
- pointer-events: none;
- overflow: hidden;
-}
-[docs-ripples] > span {
- position: absolute;
- overflow: hidden;
-}
-[docs-ripples] > span > i {
- position: absolute;
- border-radius: 50%;
- background: radial-gradient(circle closest-side,
- color-mix(in srgb, var(--rst-accent) 1.1%, transparent) 0%,
- color-mix(in srgb, var(--rst-accent) 1.1%, transparent) 60%,
- color-mix(in srgb, var(--rst-accent) 3.8%, transparent) 85%,
- transparent 100%);
- will-change: transform, opacity;
-}
-/* On a filled button the accent's own light would vanish into it: the
- ripple there is white, as faintly. */
-[docs-ripples] > span[data-on="fill"] > i {
- background: radial-gradient(circle closest-side,
- rgb(255 255 255 / 0.018) 0%,
- rgb(255 255 255 / 0.018) 60%,
- rgb(255 255 255 / 0.06) 85%,
- transparent 100%);
-}
/* The menu bar's titles take the pointer, as every other control on the
page does (Paul, 2026-11-07). estilo's menu.css gives them the arrow
on purpose, after desktop menu bars; this is Docs leading, and the
diff --git a/internal/docs/brand/pointer.js b/internal/docs/brand/pointer.js
index 9e8d876..1ec1d6d 100644
--- a/internal/docs/brand/pointer.js
+++ b/internal/docs/brand/pointer.js
@@ -12,14 +12,10 @@
pointer leaves, and every property has a default in the stylesheet,
so deleting this file and its tag leaves the still design.
- A press sends a faint ripple of the same light out from where it
- landed, kept inside the control: a frame laid exactly over it, with
- its rounded corners, clips a ring that grows to the control's far
- corner and fades, slowly, as a ripple on water does. The frame sits in a layer of its own over the page,
- so the control's DOM and layout are never touched; it is animated
- once with the Web Animations API and removed when it ends. On a shelf
- page the ripple stays on the paper. Pressing a rastrillo button
- ripples too.
+ A press writes where it landed as --rst-px and --rst-py on the
+ control, light.js's names again, and the stylesheet darkens the
+ control most there while it is held, like a finger on metal, fading
+ the mark after release (brand/light.css, --docs-press).
It never runs for touch, under reduced motion or forced colours, or
without a hovering pointer; one animation frame per move at most. */
@@ -30,8 +26,7 @@
var PROPS = ["--rst-mx", "--rst-my", "--docs-tx", "--docs-ty"];
var quiet = [matchMedia("(prefers-reduced-motion: reduce)"), matchMedia("(forced-colors: active)")];
var hover = matchMedia("(hover: hover)");
- var PRESSED = LIT + ",[rst-btn]";
- var lit = null, pending = null, raf = 0, listening = false, layer = null;
+ var lit = null, pending = null, raf = 0, listening = false;
function clear() {
if (!lit) return;
@@ -63,41 +58,13 @@
function out(e) {
if (!e.relatedTarget) clear();
}
- function ripple(e) {
+ function press(e) {
if (e.button !== 0 || (e.pointerType && e.pointerType !== "mouse" && e.pointerType !== "pen")) return;
- var el = e.target && e.target.closest ? e.target.closest(PRESSED) : null;
- if (!el || el.disabled || !document.body.animate) return;
- var surface = el.hasAttribute("docs-tile") ? el.querySelector("[docs-thumb]") || el : el;
- var r = surface.getBoundingClientRect();
- if (!r.width || !r.height) return;
- if (!layer || !layer.isConnected) {
- layer = document.createElement("div");
- layer.setAttribute("docs-ripples", "");
- layer.setAttribute("aria-hidden", "true");
- document.body.appendChild(layer);
- }
- var frame = document.createElement("span");
- frame.style.left = r.left + "px";
- frame.style.top = r.top + "px";
- frame.style.width = r.width + "px";
- frame.style.height = r.height + "px";
- frame.style.borderRadius = getComputedStyle(surface).borderRadius;
- if (el.matches('[rst-btn~="primary"],[rst-btn~="danger"]')) frame.setAttribute("data-on", "fill");
- var x = e.clientX - r.left, y = e.clientY - r.top;
- var reach = Math.hypot(Math.max(x, r.width - x), Math.max(y, r.height - y));
- var ring = document.createElement("i");
- ring.style.left = x - reach + "px";
- ring.style.top = y - reach + "px";
- ring.style.width = ring.style.height = reach * 2 + "px";
- frame.appendChild(ring);
- layer.appendChild(frame);
- ring.animate([
- { transform: "scale(0.1)", opacity: 0.85 },
- { transform: "scale(1)", opacity: 0 },
- ], { duration: 1800, easing: "cubic-bezier(.2, .45, .3, 1)" }).onfinish = remove(frame);
- }
- function remove(dot) {
- return function () { dot.remove(); };
+ var el = e.target && e.target.closest ? e.target.closest(LIT) : null;
+ if (!el || el.disabled) return;
+ var r = el.getBoundingClientRect();
+ el.style.setProperty("--rst-px", (e.clientX - r.left).toFixed(0) + "px");
+ el.style.setProperty("--rst-py", (e.clientY - r.top).toFixed(0) + "px");
}
function sync() {
var want = hover.matches && !quiet[0].matches && !quiet[1].matches;
@@ -106,11 +73,11 @@
if (want) {
document.addEventListener("pointermove", move, { passive: true });
document.addEventListener("pointerout", out, { passive: true });
- document.addEventListener("pointerdown", ripple, { passive: true });
+ document.addEventListener("pointerdown", press, { passive: true });
} else {
document.removeEventListener("pointermove", move);
document.removeEventListener("pointerout", out);
- document.removeEventListener("pointerdown", ripple);
+ document.removeEventListener("pointerdown", press);
clear();
}
}
diff --git a/internal/docs/views/list.html b/internal/docs/views/list.html
index ec3972a..173ca25 100644
--- a/internal/docs/views/list.html
+++ b/internal/docs/views/list.html
@@ -320,7 +320,6 @@
0 0 0 1px light-dark(rgb(23 32 60 / 0.07), rgb(255 255 255 / 0.06)),
0 1px 2px rgb(23 32 60 / 0.08),
0 10px 24px -12px light-dark(rgb(23 32 60 / 0.28), rgb(0 0 0 / 0.7));
- transition: transform 180ms cubic-bezier(.2, .7, .2, 1), box-shadow 180ms ease;
}
/* Picking a page up: it lifts toward the reader, a little larger,
and takes the accent's edge, and while
@@ -337,7 +336,9 @@
content: "";
position: absolute;
inset: 0;
- background: radial-gradient(180px circle at var(--rst-mx, 50%) var(--rst-my, 0%), var(--docs-light-tint), transparent 70%);
+ background:
+ var(--docs-spot),
+ radial-gradient(180px circle at var(--rst-mx, 50%) var(--rst-my, 0%), var(--docs-light-tint), transparent 70%);
opacity: 0;
transition: opacity 200ms ease;
pointer-events: none;
@@ -359,10 +360,21 @@
[docs-tile]:hover [docs-tile-title] {
color: var(--rst-accent);
}
+ /* Pressed, the page gives under the finger and springs back. */
+ [docs-tile] [docs-thumb] {
+ transition: transform 180ms cubic-bezier(.2, .7, .2, 1), box-shadow 180ms ease, scale 0.42s cubic-bezier(0.3, 1.6, 0.5, 1);
+ }
+ [docs-tile]:active [docs-thumb] {
+ scale: 0.97;
+ transition: transform 180ms cubic-bezier(.2, .7, .2, 1), box-shadow 180ms ease, scale 90ms ease-out;
+ }
@media (prefers-reduced-motion: reduce) {
[docs-tile] [docs-thumb] {
transition: none;
}
+ [docs-tile]:active [docs-thumb] {
+ scale: none;
+ }
[docs-tile]:hover [docs-thumb],
[docs-tile]:focus-visible [docs-thumb] {
transform: none;
@@ -385,7 +397,7 @@
the accent's light following the pointer along it. */
@media (hover: hover) {
[docs-list] [rst-row]:hover {
- background-image: radial-gradient(280px circle at var(--rst-mx, 50%) var(--rst-my, 50%), var(--docs-light-tint), transparent 70%);
+ background-image: var(--docs-spot), radial-gradient(280px circle at var(--rst-mx, 50%) var(--rst-my, 50%), var(--docs-light-tint), transparent 70%);
}
}
/* Big enough to read the page's shape, its headings and paragraphs,
diff --git a/internal/docs/views/show.html b/internal/docs/views/show.html
index 1858861..f0511f6 100644
--- a/internal/docs/views/show.html
+++ b/internal/docs/views/show.html
@@ -951,8 +951,8 @@
in a full-width strip; inside a rounded bar a square highlight
reads as a mistake. */
border-radius: var(--rst-radius-sm);
- transition: background-color 120ms ease, color 120ms ease;
background: transparent;
+ background-image: var(--docs-spot);
color: var(--rst-text);
font: inherit;
line-height: 1;
@@ -961,9 +961,10 @@
/* Hovered, a button lights where the pointer is on it (brand/
pointer.js writes --rst-mx/--rst-my; centred without it). */
[docs-tool]:hover:not(:disabled) {
- background:
- radial-gradient(40px circle at var(--rst-mx, 50%) var(--rst-my, 50%), color-mix(in srgb, var(--rst-accent) 18%, transparent), transparent 75%),
- var(--rst-surface-2);
+ background-color: var(--rst-surface-2);
+ background-image:
+ var(--docs-spot),
+ radial-gradient(40px circle at var(--rst-mx, 50%) var(--rst-my, 50%), color-mix(in srgb, var(--rst-accent) 18%, transparent), transparent 75%);
}
/* aria-pressed is the state, and colour is not allowed to be the only
thing that shows it (§10.3, and AGENTS.md's "no exemptions").