Round faces: a bar as concentric arcs with a legend in the middle; larger title, gap line and face text; Read-only in the ring's gap; a round dashboard unpadded on a phone; reduced-motion ring assertion

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Melvin Strobl
2026-10-14 16:52:46 +02:00
co-authored by Claude Opus 5.5
parent f5412d2f7d
commit 541dbce584
9 changed files with 308 additions and 33 deletions
@@ -706,13 +706,13 @@
* A round dashboard (`data-shape="round"` on the canvas): one widget at a
* time, each the whole face (`RoundFace.tsx`). Its geometry is in `ring.ts`.
*
* The middle of a face is written at 15px and centred, and the bodies a face
* The middle of a face is written at 17px and centred, and the bodies a face
* borrows from its tile are sized for it here: a glyph — or the dash for none —
* at the size a reading has, a note or a notification as centred lines.
*/
.dui-face-body {
overflow: hidden;
font-size: 15px;
font-size: 17px;
line-height: 1.35;
}
@@ -741,7 +741,7 @@
height: 100%;
border-radius: 50%;
padding: 0 12px;
font-size: 15px;
font-size: 17px;
}
.dui-face-press > button > :last-child {
@@ -32,16 +32,16 @@ export const RING_READING = 10
export const RING_SETTLE_MS = 300
/** The gap's line — a slider's title and value, when what it reads is in
* the middle — centred this far above the bottom of the face, at this size,
* and at most this wide: inside the face at any size. */
* and at most this wide: clear of the ring's end caps at any size. */
export const GAP_RISE = 28
export const GAP_SIZE = 13
export const GAP_WIDTH = 160
export const GAP_SIZE = 15
export const GAP_WIDTH = 140
/** Every face's title: centred this far above the middle, at this size, and
* at most this wide. One place, so a face is read the same way whichever
* widget it is. */
export const TITLE_RISE = 80
export const TITLE_SIZE = 15
export const TITLE_SIZE = 18
export const TITLE_WIDTH = 200
/** What a face draws in its middle — a reading, a press, a few lines — fits
@@ -67,6 +67,44 @@ export const DOT = 6
export const DOT_PITCH = 16
export const DOTS_WIDTH = 128
/**
* A bar's face: an arc per row, concentric, the first outermost.
*
* The arcs share a band this thick from the ring's own outer edge inward, a
* constant gap apart, each as thick as the ring while that fits and thinner
* with more rows. Its legend's lines are as large as the middle allows.
*/
export const BAR_BAND = 64
export const BAR_GAP = 3
export function barArcs(size: number, rows: number) {
const stroke = Math.min(RING_STROKE, (BAR_BAND - BAR_GAP * (rows - 1)) / rows)
// The ring's track's outer edge, so up to three rows draw on the ring.
const outer = size / 2 - RING_INSET / 2 + RING_STROKE / 2
return {
stroke,
radii: Array.from(
{ length: rows },
(_, index) => outer - stroke / 2 - index * (stroke + BAR_GAP),
),
/** What is left inside the innermost arc. */
inner: outer - rows * stroke - (rows - 1) * BAR_GAP,
}
}
/** A legend line's text size and height, by how many rows share the middle. */
export const barLegend = (rows: number) =>
rows <= 5
? { size: 17, line: 22 }
: rows <= 7
? { size: 15, line: 18 }
: { size: 13, line: 16 }
/** How wide a line `rise` above or below the middle can be inside a disc of
* radius `inner`, less `margin`. */
export const chordWidth = (inner: number, rise: number, margin: number) =>
Math.floor(2 * Math.sqrt(Math.max(0, inner ** 2 - rise ** 2)) - margin)
/** A drag this long, mostly along one axis, is a swipe rather than a press. */
export const SWIPE = 40