Add the Fluksio look, and make it the one a dashboard starts in

Two looks were somebody else's language spoken well, and neither was the
product's. A dashboard nobody has dressed yet should look like the rest
of the app, so there is now a third set that follows the root
DESIGN-GUIDELINES.md to the letter — `--card` surfaces told from the page
by a hairline and a low shadow rather than by colour, every control a
pill, 16px panels, frosted floating chrome, one slate-blue accent spent
on what a person can act on — and it is what `look` means when nothing
says otherwise.

That also turns the exemption the other way round. The dashboard is still
allowed to look unlike the product; it just no longer does so by default.
An existing dashboard, which has never named a look, lands on the design
it had before any of this.

Restraint is the style rather than an omission here: no ripple, no glow,
no lift, and a press answered by the colour changing. The one deliberate
departure is the selector, which holds its choice in `--primary` rather
than the `--accent` the segmented rule asks for — that is a decision
about the widget, not about the look, and a control must not change what
it signals when the drawing changes. All three sets hold it the same way.
This commit is contained in:
2026-08-24 14:25:13 +02:00
parent 856693110f
commit 3604e85efb
12 changed files with 1008 additions and 25 deletions
@@ -0,0 +1,182 @@
/**
* Fluksio: the surfaces.
*
* The house style. A widget is a `--card` told from the page by a hairline and
* a low shadow rather than by colour, floating chrome is frosted, and the one
* accent is spent on what a person can act on. Nothing here holds state: the
* behaviour is in `ui/core`.
*/
import { Link } from "@tanstack/react-router"
import { Lock } from "lucide-react"
import { motion } from "motion/react"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip"
import { cn } from "@/lib/utils"
import { ICONS } from "../../icons"
import type {
BackdropProps,
FrameProps,
NoticeProps,
RailProps,
} from "../core/contract"
import { TESTID } from "../core/contract"
import { LOOK } from "../core/motion"
/** The page colour is the ground; only an image is drawn over it. */
export function Backdrop({ image }: BackdropProps) {
if (!image) return null
return (
<div
aria-hidden
data-testid="canvas-ground"
className="pointer-events-none absolute inset-0 bg-cover bg-center"
style={{ backgroundImage: `url(${JSON.stringify(image)})` }}
/>
)
}
function Issue({ issue }: { issue: string }) {
return (
<Tooltip>
<TooltipTrigger asChild>
<span
role="img"
className="block size-2 shrink-0 rounded-full bg-destructive"
aria-label={issue}
data-testid={TESTID.issue}
/>
</TooltipTrigger>
<TooltipContent className="max-w-xs break-words">{issue}</TooltipContent>
</Tooltip>
)
}
export function Frame({
title,
issue,
grip,
scroll,
selected,
onClick,
children,
}: FrameProps) {
return (
// A card is not a control: the click only picks it in edit mode, and every
// interactive element inside keeps its own role and keyboard handling.
// biome-ignore lint/a11y/useKeyWithClickEvents: see above.
// biome-ignore lint/a11y/noStaticElementInteractions: see above.
<div
data-testid={TESTID.frame}
data-selected={selected ? "" : undefined}
className="dui-frame fx-frame"
onClick={onClick}
>
{title ? (
<div
className={cn(
"dui-frame-head fx-frame-title",
grip &&
`${TESTID.grip} -m-1 cursor-grab p-1 active:cursor-grabbing`,
)}
>
<span className="dui-frame-title">{title}</span>
{issue ? <Issue issue={issue} /> : null}
</div>
) : null}
<div className={cn("dui-frame-body", scroll && "dui-frame-scroll")}>
{children}
</div>
{/* No header to sit in, so the fault takes the corner instead — a widget
drawn without its title still says when it is mis-wired. */}
{!title && issue ? (
<div className="dui-frame-corner">
<Issue issue={issue} />
</div>
) : null}
{/* And the editor still needs something to drag it by. */}
{!title && grip ? (
<span
aria-hidden
className={cn(
TESTID.grip,
"absolute left-1/2 top-1 z-[2] h-1 w-8 -translate-x-1/2 cursor-grab rounded-full bg-current opacity-20 active:cursor-grabbing",
)}
/>
) : null}
</div>
)
}
/** Two letters off the title, so a rail of four reads as four different things. */
function initials(label: string): string {
const words = label.split(/[\s_-]+/).filter(Boolean)
if (words.length === 0) return "?"
if (words.length === 1) return words[0].slice(0, 2).toUpperCase()
return (words[0][0] + words[1][0]).toUpperCase()
}
export function Rail({ entries }: RailProps) {
return (
<nav
aria-label="Dashboards on this panel"
data-testid={TESTID.rail}
className={cn(
"fx-rail pointer-events-auto absolute left-3 top-1/2 z-10 flex max-h-[calc(100%-1.5rem)] w-12 -translate-y-1/2 flex-col items-center gap-1 p-1",
// As tall as what it carries, centred in the column it reserves: a
// rail of two stretched to the height of the panel is mostly empty
// pill. More dashboards than the panel is tall still scroll, but no
// bar is ever drawn — a wall panel is swiped, and there is no room.
"overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
)}
>
{entries.map((entry) => {
const Glyph = ICONS[entry.icon ?? ""]
return (
<Tooltip key={entry.name}>
<TooltipTrigger asChild>
<Link
{...entry.link}
aria-label={entry.label}
aria-current={entry.active ? "page" : undefined}
data-testid={`panel-rail-${entry.name}`}
className="fx-rail-item relative flex size-10 shrink-0 items-center justify-center text-xs font-medium"
>
{entry.active ? (
<motion.span
aria-hidden
layoutId="fx-rail-active"
transition={LOOK.fluksio.spring}
className="absolute inset-0 rounded-full bg-accent"
/>
) : null}
<span className="relative z-[1]">
{Glyph ? <Glyph className="size-5" /> : initials(entry.label)}
</span>
</Link>
</TooltipTrigger>
<TooltipContent side="right">{entry.label}</TooltipContent>
</Tooltip>
)
})}
</nav>
)
}
export function Notice({ children }: NoticeProps) {
return (
<div
// Announced rather than merely drawn: `locked` may be driven by a flow,
// so the state can change under someone already looking at the page.
aria-live="polite"
data-testid={TESTID.locked}
className="fx-notice pointer-events-none absolute bottom-0 right-0 flex items-center gap-1.5 px-3 py-1.5 text-sm"
>
<Lock className="size-4" aria-hidden />
{children}
</div>
)
}