Round dashboards: one face at a time, a face per widget type, paged by swipe, dots and keys; slider reading; face row in the editor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Melvin Strobl
2026-10-14 15:24:25 +02:00
co-authored by Claude Opus 5.5
parent 8b8cb5cda9
commit 84071ee106
20 changed files with 1238 additions and 604 deletions
@@ -544,13 +544,62 @@
}
/*
* A round dashboard (`data-shape="round"` on the canvas).
* 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`.
*
* A circle has no corners for a card to sit in, so a tile drops the surface
* its look paints and keeps only what it shows: no fill, no border, no shadow,
* a smaller muted title and half the padding. A face is read about its
* vertical axis, so a title and a single reading are centred on it. Arranging,
* a dashed hairline still says where each tile is.
* The middle of a face is written at 15px 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;
line-height: 1.35;
}
.dui-face-body .dui-clock {
font-size: 72px;
line-height: 1;
}
.dui-face-body .dui-glyph {
width: 96px;
}
/* A notification's title is a row in its tile; centred lines here, its
warning sign leading the first. */
.dui-face-body p {
display: block;
}
.dui-face-body p > span[aria-hidden] {
margin-inline-end: 0.375em;
}
/* A switch's or a button's one round press, in the look's own paint. */
.dui-face-press > button {
width: 100%;
height: 100%;
border-radius: 50%;
padding: 0 12px;
font-size: 15px;
}
.dui-face-press > button > :last-child {
overflow: visible;
white-space: normal;
}
.dui-face-label {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
/*
* A type with no face of its own keeps its body, but a circle has no corners
* for a card to sit in: the frame drops the surface its look paints.
*/
[data-shape="round"] .dui-frame {
border-color: transparent;
@@ -558,7 +607,7 @@
box-shadow: none;
backdrop-filter: none;
-webkit-backdrop-filter: none;
padding: 0.5rem;
padding: 0;
}
/* Glass's light along the pane's top edge, which has no pane to fall on. */
@@ -566,24 +615,10 @@
content: none;
}
[data-shape="round"] .dui-frame-head,
[data-shape="round"] .dui-frame-body > [data-testid="readout"] {
justify-content: center;
}
[data-shape="round"] .dui-frame-title {
font-size: 0.75rem;
}
[data-shape="round"][data-arranging] .dui-frame {
border: 1px dashed
color-mix(in srgb, var(--muted-foreground) 40%, transparent);
}
/*
* The ring along a round face's edge (`RingWidget.tsx`). Its geometry is in
* `ring.ts`; each look paints the track, the reading and the handle.
* Only the band itself takes a pointer, so the tiles inside stay pressable.
* Only the band itself takes a pointer, so the face inside stays swipeable.
*/
.dui-ring {
overflow: visible;
@@ -614,10 +649,8 @@
fill: var(--muted-foreground);
}
/* Page dots in the ring's gap, where a rect dashboard has its rail. */
/* Page dots, one per face, in the ring's gap. */
.dui-dot-mark {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--muted-foreground);
opacity: 0.5;
@@ -1,5 +1,6 @@
/**
* A round dashboard's ring: where it runs, and what turning it does.
* A round dashboard's face: where its ring runs, where each face puts its
* title and its reading, and what turning the ring does.
*
* Everything is in canvas pixels on a face whose diameter `size` is the
* canvas width, and scales with the canvas as the grid's gap does. Angles are
@@ -11,7 +12,7 @@ import { useEffect, useRef, useState } from "react"
import { arcPath } from "./arc"
/** The band along the face's edge the ring takes; the grid is inset by it. */
/** The band along the face's edge the ring takes. */
export const RING_INSET = 40
/** Where the sweep begins: the lower left. */
export const RING_START = 120
@@ -25,10 +26,60 @@ export const RING_HANDLE = 28
export const RING_MARK = 6
/** How long the ring waits after the last notch before it publishes. */
export const RING_SETTLE_MS = 300
/** The gap's line — title, then the reading — centred this far above the
* bottom of the face, at this size. */
export const RING_TITLE_RISE = 28
export const RING_TITLE_SIZE = 13
/** 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. */
export const GAP_RISE = 28
export const GAP_SIZE = 13
export const GAP_WIDTH = 160
/** 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_WIDTH = 200
/** What a face draws in its middle — a reading, a press, a few lines — fits
* this box, centred on the middle of the face. */
export const BODY_WIDTH = 240
export const BODY_HEIGHT = 128
/** A reading written large in the middle, a selector's label, a colour's
* swatch; a long reading shrinks to fit the body's width, down to the floor. */
export const CENTRE_VALUE = 72
export const CENTRE_LABEL = 36
export const CENTRE_SWATCH = 96
export const CENTRE_FLOOR = 24
/** A switch's or a button's disc, as a diameter. */
export const PRESS = 128
/** The page dots, one per face: centred this far above the bottom of the
* face, a dot of this size per target of this pitch — closer where more
* than fit this width, which is about the face's own there. */
export const DOTS_RISE = 12
export const DOT = 6
export const DOT_PITCH = 16
export const DOTS_WIDTH = 128
/** A drag this long, mostly along one axis, is a swipe rather than a press. */
export const SWIPE = 40
/** How long a change of dashboard shows which one it landed on. */
export const ANNOUNCE_MS = 1000
/**
* The size a centre reading is written at: `max`, or smaller where it would
* not fit the body's width at about 0.6 em a character, but never below the
* floor. Counted rather than measured, so a device without a browser's text
* layout comes out at the same size.
*/
export const fitSize = (written: string, max: number) =>
Math.max(
CENTRE_FLOOR,
Math.min(max, Math.floor(BODY_WIDTH / (0.6 * Math.max(1, written.length)))),
)
/** The ring's centre line, on a face of diameter `size`. */
export const ringRadius = (size: number) => size / 2 - RING_INSET / 2