Fishies 0.8.2

This commit is contained in:
CRTkafa 2026-10-07 22:32:19 +03:00
parent 004fbdc97e
commit 4d52068149
14 changed files with 42 additions and 184 deletions

View file

@ -4,9 +4,6 @@ How Fishies looks, reads, sounds and what its world holds, generated from the ga
## Brand ## Brand
- Brand palette is fixed to the site's five existing tokens (#071a24 ground, #edf5ed ink, #ffc46b accent, #83cfbd sea, #adc3c7 muted); no new blue/purple/gradient brand colour and no novel illustrated background per platform · Steam capsules, Play feature graphics and social banners all sit on #071a24 with the fish as the subject.
- Nothing in the game UI renders below 12px, weight 700 minimum, ink not grey; the display face (Baloo 2) carries every number/label/button while Nunito is reserved for sentences; text over live water is stroked (paint-order: stroke fill), never shadowed, because a shadow disappears over coral.
### Brand ### Brand
The five colours every store page, capsule, banner, the site and the Reef Journal sit on. The five colours every store page, capsule, banner, the site and the Reef Journal sit on.
@ -52,8 +49,6 @@ Baloo 2 for the game’s voice (numbers, labels, buttons, titles), Nunito for se
## UI ## UI
- One source per fact, no redundancy (owner, 1 October 2026: 'no complexity, disconnection, inconsistency, gaps, especially in the wiki, and above all no redundancy'): decisions live in the Atlas, player knowledge in the Reef Journal (generated from the catalogue where it can be), visual and component truth in fishies-ui's tokens and components. The bibles are not new texts: they are one Fishies Handbook in fishies-ui whose sections are generated from those sources (Brand and UI from the tokens and components, Art and Writing from the Atlas canon, World from the Reef Journal); anything that cannot be generated is merged into an existing source instead of copied.
### Water ### Water
The deep blues under the glass; each one is the water a few metres further down. The deep blues under the glass; each one is the water a few metres further down.
@ -222,31 +217,6 @@ Named slots the motion system fills (apps/web/app/motion/motion.css, where each
- **Select** · A dropdown that opens a dark panel with a gold check, driven from the keyboard like a native one and never clipped by its panel. - **Select** · A dropdown that opens a dark panel with a gold check, driven from the keyboard like a native one and never clipped by its panel.
- **Image** · The one way Fishies puts a picture on screen: a drop-in `<img>` that shows the Fishies spinner on a glass placeholder in its own box until the file is fully downloaded and decoded, then fades it in. - **Image** · The one way Fishies puts a picture on screen: a drop-in `<img>` that shows the Fishies spinner on a glass placeholder in its own box until the file is fully downloaded and decoded, then fades it in.
## Art
Authored target-size sprite art, layered sources, deterministic exports.
- Definitive-remaster non-negotiable checks for every species: the profile is recognisable at 1x before its colour is read; a mouth belongs to a head; the eye sits inside an implied skull and stays stable through a tail stroke; fins grow from opaque roots into visible rays with a restrained translucent edge; the body has a front, belly and peduncle beyond a colour ramp; the species stays legible over the real reef backdrop, the shop and the Reef Journal.
- Approved eye language: a warm socket, pale sclera, a deep pupil shifted toward the snout and one hard catchlight · a plain black bead is not an approved default for any Fishies species, including nocturnal ones.
- Fish keep their painted mouths.
- The floor has depth: decorations can sit at different depths rather than all standing on one line, which is what makes a reef read as a place instead of a shelf.
## Writing
- Middle dot "·", never an em dash.
- Owner, 30 September 2026: "rename Blue Glass to Lapis Lazuli. I want relatable names overall, not silly ones." Floor names are plain and recognisable: White Sand (was White Aragonite), Mossy Soil (was Planted Soil), Lapis Lazuli (was Blue Glass, repainted to match), Pearl Pebbles (was Black & White Pearl). Ids follow the names; nothing had shipped, so no migration.
- Fishies' lore direction (decision 78, owner decided 11 September 2026): Option B · a light fictional keeper-culture framing on top of real biology (an unnamed shared tradition like 'the Keeping', in-fiction framing for the level titles, an optional second 'Keeper's Note' paragraph beside each species' existing real-biology text), not real-world-only and not a full invented setting/faction/plot.
## Sound
Sound effects and the soundtrack.
- Fishies OST (owner, 13 September 2026): six original tracks released as an album; the album and in-game versions are the same recording. Tracks share one room (samples, mix chain, loudness) and must differ in key, meter, tempo, lead instrument and groove; no variations of an earlier track. A seventh waits until a place or moment in the game needs its own music.
- Home Tank (first shipped as Kelp Lullaby) is the main music (owner, 13 September 2026): it plays from its intro when the player enters the game, after the loading screen lifts, and Visitors follows it in the default rotation. Reef Room stays in the jukebox but only joins the rotation if the player ticks it.
- Every OST album master begins from 0.6 s of silence and a 1.8 s swell, and intros bring their layers in one at a time; the game fades a track in over 2 s on arrival (owner, 13 September 2026: the intros came in too fast).
- Places with their own music: on Auto, Open Water plays Open Water whether or not it is ticked; a track the player holds by hand still plays there; leaving hands back to the rotation (owner, 13 September 2026).
- Credit music to CRTkafa; the OST is free to use.
## World ## World
### Reef Journal ### Reef Journal

View file

@ -6,13 +6,6 @@ import './loader.css'
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect
/** The one way Fishies puts a picture on screen: a drop-in `<img>` that shows the Fishies
* spinner on a glass placeholder in its own box until the file is fully downloaded and
* decoded, then fades it in. Same element, same attributes, same box as the bare `<img>` it
* replaces, so no surface's selectors or layout move. See fx-image.ts for the states.
*
* Give it a size (width/height, or a CSS box) wherever you can: that box is the placeholder,
* and it is what keeps the layout still while the picture is on its way. */
export default function FishiesImg({ ref, decoding, ...props }: ImgHTMLAttributes<HTMLImageElement> & { ref?: Ref<HTMLImageElement> }) { export default function FishiesImg({ ref, decoding, ...props }: ImgHTMLAttributes<HTMLImageElement> & { ref?: Ref<HTMLImageElement> }) {
const own = useRef<HTMLImageElement | null>(null) const own = useRef<HTMLImageElement | null>(null)
const mounted = useRef(false) const mounted = useRef(false)
@ -24,8 +17,7 @@ export default function FishiesImg({ ref, decoding, ...props }: ImgHTMLAttribute
useIsomorphicLayoutEffect(() => { useIsomorphicLayoutEffect(() => {
const img = own.current const img = own.current
if (!img) return if (!img) return
// A new address waits again; the document's listener (FX_IMAGE_SCRIPT) or this effect
// reveals it. A picture already complete at first mount was in memory: no fade.
if (mounted.current) img.setAttribute('data-fx', 'wait') if (mounted.current) img.setAttribute('data-fx', 'wait')
const first = !mounted.current const first = !mounted.current
mounted.current = true mounted.current = true
@ -38,9 +30,6 @@ export default function FishiesImg({ ref, decoding, ...props }: ImgHTMLAttribute
return <img {...props} ref={setRef} decoding={decoding ?? 'async'} data-fx="wait" suppressHydrationWarning/> return <img {...props} ref={setRef} decoding={decoding ?? 'async'} data-fx="wait" suppressHydrationWarning/>
} }
/** A `<video>` with a poster: render it with `data-fx={poster ? 'wait' : undefined}` and
* `suppressHydrationWarning`, and pass its ref here. The same placeholder as FishiesImg holds
* its box until the poster is decoded (or the first frame arrives, whichever is first). */
export function useFxPoster(video: { current: HTMLVideoElement | null }, poster: string | null | undefined) { export function useFxPoster(video: { current: HTMLVideoElement | null }, poster: string | null | undefined) {
const decoded = useDecodedUrl(poster) const decoded = useDecodedUrl(poster)
useIsomorphicLayoutEffect(() => { useIsomorphicLayoutEffect(() => {
@ -53,8 +42,6 @@ export function useFxPoster(video: { current: HTMLVideoElement | null }, poster:
}, [video, poster, decoded]) }, [video, poster, decoded])
} }
/** For a picture drawn as a CSS background: the address once it is downloaded and decoded,
* `null` until then (show a FishiesSpinner meanwhile). */
export function useDecodedUrl(url: string | null | undefined): string | null { export function useDecodedUrl(url: string | null | undefined): string | null {
const [ready, setReady] = useState<string | null>(null) const [ready, setReady] = useState<string | null>(null)
useEffect(() => { useEffect(() => {

View file

@ -15,19 +15,15 @@ type Props = {
'aria-label'?: string 'aria-label'?: string
'aria-labelledby'?: string 'aria-labelledby'?: string
disabled?: boolean disabled?: boolean
/** Renders a hidden input so an enclosing form still submits the value. */
name?: string name?: string
className?: string className?: string
size?: 'regular' | 'compact' size?: 'regular' | 'compact'
autoFocus?: boolean autoFocus?: boolean
} }
/* The popup is portalled to <body> so no scrolling panel, backdrop-filter or overflow can clip
it. It leaves its surface's CSS scope behind, so the surface's tokens are read off the trigger
and carried over inline: one component that looks native to the site, the tank and admin. */
const TOKENS = ['--fs-select-ink', '--fs-select-muted', '--fs-select-line', '--fs-select-panel', '--fs-select-hover', '--fs-select-accent', '--fs-select-radius', '--fs-select-shadow', '--fs-select-font'] const TOKENS = ['--fs-select-ink', '--fs-select-muted', '--fs-select-line', '--fs-select-panel', '--fs-select-hover', '--fs-select-accent', '--fs-select-radius', '--fs-select-shadow', '--fs-select-font']
/** A dropdown that opens a dark panel with a gold check, driven from the keyboard like a native one and never clipped by its panel. */
export default function Select({ value, onChange, options, disabled, name, className, size = 'regular', autoFocus, ...aria }: Props) { export default function Select({ value, onChange, options, disabled, name, className, size = 'regular', autoFocus, ...aria }: Props) {
const id = useId() const id = useId()
const trigger = useRef<HTMLButtonElement>(null), list = useRef<HTMLUListElement>(null) const trigger = useRef<HTMLButtonElement>(null), list = useRef<HTMLUListElement>(null)
@ -54,7 +50,7 @@ export default function Select({ value, onChange, options, disabled, name, class
const choose = (next: string) => { if (next !== value) onChange(next) } const choose = (next: string) => { if (next !== value) onChange(next) }
useLayoutEffect(() => { if (open) place() }, [open, place]) useLayoutEffect(() => { if (open) place() }, [open, place])
// The popup grows to its longest label; keep that wider box inside the viewport too.
useLayoutEffect(() => { useLayoutEffect(() => {
const popup = list.current const popup = list.current
if (!popup || typeof style.left !== 'number') return if (!popup || typeof style.left !== 'number') return

View file

@ -1,24 +1,5 @@
/** Pictures that never paint half-loaded (owner, 1 October 2026: "never, ever should I see an
* image while it is loading").
*
* Every picture the site, the game and the launcher show is an `<img data-fx="wait">`
* (FishiesImg). loader.css keeps its pixels out of its own box while it waits, and shows the
* Fishies spinner on a glass placeholder of the same size in their place, so nothing moves.
* Once the file is complete *and* decoded (`img.decode()`), the state becomes `fade` (a short
* fade in) or, for a picture that was already in memory when it mounted, `ready` (no fade:
* a cached picture asking to fade in is theatre). A broken picture becomes `error`: the
* placeholder stays, the spinner stops.
*
* The same `reveal` runs twice over: as an inline script in the document head, listening for
* every image `load` in the capture phase, so a server-rendered picture appears as soon as it
* is decoded rather than when the page's JavaScript hydrates; and from FishiesImg's effect,
* for a picture that was already complete before anything was listening. Both are
* idempotent: only a picture still in `wait` for its current address changes state. */
export type FxState = 'wait' | 'fade' | 'ready' | 'error' export type FxState = 'wait' | 'fade' | 'ready' | 'error'
/** Self-contained on purpose: `FX_IMAGE_SCRIPT` inlines its source, so it may reference
* nothing outside its own body. */
export function reveal(img: HTMLImageElement, instant?: boolean): void { export function reveal(img: HTMLImageElement, instant?: boolean): void {
if (img.getAttribute('data-fx') !== 'wait' || !img.complete) return if (img.getAttribute('data-fx') !== 'wait' || !img.complete) return
const src = img.currentSrc || img.src const src = img.currentSrc || img.src
@ -31,8 +12,6 @@ export function reveal(img: HTMLImageElement, instant?: boolean): void {
img.decode().then(() => set('fade'), () => set(img.naturalWidth ? 'fade' : 'error')) img.decode().then(() => set('fade'), () => set(img.naturalWidth ? 'fade' : 'error'))
} }
/** The document-head half: catches `load`/`error` of every waiting picture, including the
* server-rendered ones that finish before hydration. */
export const FX_IMAGE_SCRIPT = `(function(){var r=${reveal.toString()};` + export const FX_IMAGE_SCRIPT = `(function(){var r=${reveal.toString()};` +
`function h(e){var t=e.target;if(t&&t.tagName==='IMG'&&t.hasAttribute('data-fx'))r(t)}` + `function h(e){var t=e.target;if(t&&t.tagName==='IMG'&&t.hasAttribute('data-fx'))r(t)}` +
`document.addEventListener('load',h,true);document.addEventListener('error',h,true)})()` `document.addEventListener('load',h,true);document.addEventListener('error',h,true)})()`

View file

@ -1,5 +1,3 @@
// GENERATED by tools/fishies-ui/build.ts from apps/web/app/ui/icons.ts and the picture files it names. Do not edit: change the source and run `bun tools/fishies-ui/build.ts`.
// px: the file's width in pixels. sharpTo: the largest CSS size it stays sharp at. usedBy: the parts of Fishies that draw it.
export const ICON_FACTS: Readonly<Record<string, { readonly px: number; readonly sharpTo: number; readonly usedBy: readonly string[] }>> = { export const ICON_FACTS: Readonly<Record<string, { readonly px: number; readonly sharpTo: number; readonly usedBy: readonly string[] }>> = {
"feed": { "feed": {
"px": 56, "px": 56,

View file

@ -1,12 +1,3 @@
/** The Fishies system icon set: the painted icons the game's dock and HUD, the Keeper OS desktop,
* the video player and the Reef Journal share, named and grouped like an operating system's icon
* set (owner, 1 October 2026; Atlas landing-site jzxy3e).
*
* Data only. Each picture is painted once (public/game/ui-icons, public/game/emotes, provenance in
* their PROVENANCE files) and exported at twice its largest display size. What each file measures
* and where the code uses it are not written here: `bun tools/fishies-ui/build.ts` reads them into
* icons.generated.ts, so this list cannot drift from the files. */
export type IconGroup = 'care' | 'places' | 'system' | 'things' | 'expressions' export type IconGroup = 'care' | 'places' | 'system' | 'things' | 'expressions'
export const ICON_GROUPS: readonly { readonly id: IconGroup; readonly title: string; readonly use: string }[] = [ export const ICON_GROUPS: readonly { readonly id: IconGroup; readonly title: string; readonly use: string }[] = [
@ -21,7 +12,7 @@ export type SystemIcon = {
readonly name: string readonly name: string
readonly file: string readonly file: string
readonly label: string readonly label: string
/** What it stands for, everywhere it appears. One meaning per icon, one icon per meaning. */
readonly meaning: string readonly meaning: string
readonly group: IconGroup readonly group: IconGroup
} }
@ -50,7 +41,7 @@ export const SYSTEM_ICONS = [
ui('chat', 'Chat', 'places', 'a conversation, replies, general talk'), ui('chat', 'Chat', 'places', 'a conversation, replies, general talk'),
ui('announce', 'Announcements', 'places', 'news from the team'), ui('updates', 'Updates', 'places', 'patch notes and what changed'), ui('announce', 'Announcements', 'places', 'news from the team'), ui('updates', 'Updates', 'places', 'patch notes and what changed'),
ui('bug', 'Bugs', 'places', 'something broken'), ui('idea', 'Ideas', 'places', 'a suggestion'), ui('bug', 'Bugs', 'places', 'something broken'), ui('idea', 'Ideas', 'places', 'a suggestion'),
// Wave 2, painted 2 October 2026 (tools/ui_icons.py; meanings from the 1 October icon audit).
ui('reply', 'Reply', 'system', 'answer this'), ui('quote', 'Quote', 'system', "repeat someone's words in yours"), ui('reply', 'Reply', 'system', 'answer this'), ui('quote', 'Quote', 'system', "repeat someone's words in yours"),
ui('clock', 'Time', 'system', 'when, how long, last activity, away'), ui('showcase', 'Showcase', 'places', 'show what you made'), ui('clock', 'Time', 'system', 'when, how long, last activity, away'), ui('showcase', 'Showcase', 'places', 'show what you made'),
ui('tank', 'Aquarium', 'things', 'an aquarium you own or buy'), ui('block', 'Block', 'system', 'block a keeper, ban'), ui('tank', 'Aquarium', 'things', 'an aquarium you own or buy'), ui('block', 'Block', 'system', 'block a keeper, ban'),
@ -72,14 +63,12 @@ export const SYSTEM_ICONS = [
export type SystemIconName = (typeof SYSTEM_ICONS)[number]['name'] export type SystemIconName = (typeof SYSTEM_ICONS)[number]['name']
/** The sizes the set is drawn at, in CSS pixels. A file stays sharp up to half its pixel width. */
export const ICON_SIZES = { xs: 16, sm: 20, md: 28, lg: 46, xl: 84 } as const export const ICON_SIZES = { xs: 16, sm: 20, md: 28, lg: 46, xl: 84 } as const
export type IconSize = keyof typeof ICON_SIZES export type IconSize = keyof typeof ICON_SIZES
export const iconByName = (name: string): SystemIcon | undefined => SYSTEM_ICONS.find(icon => icon.name === name) export const iconByName = (name: string): SystemIcon | undefined => SYSTEM_ICONS.find(icon => icon.name === name)
let resolveUrl = (icon: SystemIcon): string => icon.file let resolveUrl = (icon: SystemIcon): string => icon.file
/** Where the pictures are served from. In the game they sit at their `file` path; anywhere else,
* point this at a copy of the package's `icons/` folder (`icons/<name>.png`). */
export function configureIcons(options: { url: (icon: SystemIcon) => string }): void { resolveUrl = options.url } export function configureIcons(options: { url: (icon: SystemIcon) => string }): void { resolveUrl = options.url }
export const iconUrl = (icon: SystemIcon): string => resolveUrl(icon) export const iconUrl = (icon: SystemIcon): string => resolveUrl(icon)

View file

@ -1,18 +1,11 @@
/* fishies-ui components (kit.tsx). Reef toy (Atlas landing-site 3mk66d): round, plump, slightly 3D
controls on water glass with a gold rim, a bubble here and there. Every value is a token from
tokens.generated.css or a motion slot the motion system fills; nothing here picks its own colour.
In its own cascade layer, last of the layers, so a component beats the game's older layered
skins without !important, and a surface's own unlayered rules can still place it. The order is
restated here because whichever stylesheet the browser meets first fixes it. */
@layer base, skin, system, responsive, kit; @layer base, skin, system, responsive, kit;
@layer kit { @layer kit {
/* ── icon ────────────────────────────────────────────────────────────── */
.fx-icon { display: inline-grid; place-items: center; flex: none; line-height: 0; } .fx-icon { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.fx-icon img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; } .fx-icon img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; }
/* ── button ──────────────────────────────────────────────────────────── */
.fx-button { .fx-button {
position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: var(--fx-s-2); position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: var(--fx-s-2);
min-height: 46px; padding: 0 var(--fx-s-5); border: 1px solid var(--fx-rim); border-radius: var(--fx-r-full); min-height: 46px; padding: 0 var(--fx-s-5); border: 1px solid var(--fx-rim); border-radius: var(--fx-r-full);
@ -27,7 +20,7 @@
.fx-button:hover:not(:disabled) { transform: translateY(-2px); } .fx-button:hover:not(:disabled) { transform: translateY(-2px); }
.fx-button:active:not(:disabled) { transform: translateY(2px) scale(.98); } .fx-button:active:not(:disabled) { transform: translateY(2px) scale(.98); }
/* Glass: the everyday button. */
.fx-button, .fx-button.is-glass { .fx-button, .fx-button.is-glass {
background: var(--fx-glass); color: var(--fx-ink); background: var(--fx-glass); color: var(--fx-ink);
box-shadow: var(--fx-rim-light), var(--fx-foot); box-shadow: var(--fx-rim-light), var(--fx-foot);
@ -35,8 +28,7 @@
.fx-button.is-glass:hover:not(:disabled), .fx-button:not([class*='is-']):hover:not(:disabled) { border-color: var(--fx-rim-bright); } .fx-button.is-glass:hover:not(:disabled), .fx-button:not([class*='is-']):hover:not(:disabled) { border-color: var(--fx-rim-bright); }
.fx-button:active:not(:disabled) { box-shadow: var(--fx-rim-light), 0 1px 0 rgb(4 18 34 / 55%); } .fx-button:active:not(:disabled) { box-shadow: var(--fx-rim-light), 0 1px 0 rgb(4 18 34 / 55%); }
/* Gold: the one thing to press. `.gold-button` is the game's name for it, painted here so the
game has one gold button (the panels used to have a pearl one and the HUD a glowing one). */
:is(.fx-button.is-gold, .gold-button) { :is(.fx-button.is-gold, .gold-button) {
border-color: var(--fx-pearl); border-color: var(--fx-pearl);
background: radial-gradient(60% 46% at 30% 10%, rgb(255 255 255 / 55%), transparent 70%), linear-gradient(180deg, var(--fx-gold-face), var(--fx-gold)); background: radial-gradient(60% 46% at 30% 10%, rgb(255 255 255 / 55%), transparent 70%), linear-gradient(180deg, var(--fx-gold-face), var(--fx-gold));
@ -46,12 +38,12 @@
:is(.fx-button.is-gold, .gold-button):hover:not(:disabled) { filter: brightness(1.05) saturate(1.05); } :is(.fx-button.is-gold, .gold-button):hover:not(:disabled) { filter: brightness(1.05) saturate(1.05); }
:is(.fx-button.is-gold, .gold-button):active:not(:disabled) { box-shadow: inset 0 1px rgb(255 255 255 / 55%), inset 0 -2px 4px rgb(200 138 61 / 30%), 0 1px 0 var(--fx-gold-foot); } :is(.fx-button.is-gold, .gold-button):active:not(:disabled) { box-shadow: inset 0 1px rgb(255 255 255 / 55%), inset 0 -2px 4px rgb(200 138 61 / 30%), 0 1px 0 var(--fx-gold-foot); }
/* Ghost: a third choice that should not compete. */
.fx-button.is-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--fx-ink-2); } .fx-button.is-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--fx-ink-2); }
.fx-button.is-ghost:hover:not(:disabled) { background: rgb(255 255 255 / 8%); color: var(--fx-ink); transform: none; } .fx-button.is-ghost:hover:not(:disabled) { background: rgb(255 255 255 / 8%); color: var(--fx-ink); transform: none; }
.fx-button.is-ghost:active:not(:disabled) { box-shadow: none; } .fx-button.is-ghost:active:not(:disabled) { box-shadow: none; }
/* Danger: undo-less things (sell all, delete). */
.fx-button.is-danger { .fx-button.is-danger {
border-color: color-mix(in oklab, var(--fx-tone-coral), white 30%); border-color: color-mix(in oklab, var(--fx-tone-coral), white 30%);
background: radial-gradient(60% 46% at 30% 10%, rgb(255 255 255 / 34%), transparent 70%), linear-gradient(180deg, var(--fx-tone-coral), color-mix(in oklab, var(--fx-alarm), black 28%)); background: radial-gradient(60% 46% at 30% 10%, rgb(255 255 255 / 34%), transparent 70%), linear-gradient(180deg, var(--fx-tone-coral), color-mix(in oklab, var(--fx-alarm), black 28%));
@ -60,7 +52,7 @@
} }
.fx-button > .fx-icon { margin-left: calc(var(--fx-s-2) * -1); } .fx-button > .fx-icon { margin-left: calc(var(--fx-s-2) * -1); }
/* ── round button: window controls, the player, a close ──────────────── */
.fx-round { .fx-round {
display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0;
border: 1px solid var(--fx-rim); border-radius: 50%; color: var(--fx-ink); cursor: pointer; border: 1px solid var(--fx-rim); border-radius: 50%; color: var(--fx-ink); cursor: pointer;
@ -79,7 +71,7 @@
.fx-round.is-gold { border-color: var(--fx-pearl); color: var(--fx-ink-on-gold); background: radial-gradient(circle at 35% 28%, rgb(255 255 255 / 60%), transparent 52%), linear-gradient(180deg, var(--fx-gold-face), var(--fx-gold)); box-shadow: inset 0 -2px 4px rgb(200 138 61 / 35%), 0 2px 0 var(--fx-gold-foot); } .fx-round.is-gold { border-color: var(--fx-pearl); color: var(--fx-ink-on-gold); background: radial-gradient(circle at 35% 28%, rgb(255 255 255 / 60%), transparent 52%), linear-gradient(180deg, var(--fx-gold-face), var(--fx-gold)); box-shadow: inset 0 -2px 4px rgb(200 138 61 / 35%), 0 2px 0 var(--fx-gold-foot); }
.fx-round[aria-pressed='true'] { border-color: var(--fx-gold-rim); box-shadow: inset 0 0 0 2px rgb(255 196 107 / 40%), 0 2px 0 rgb(2 10 24 / 50%); } .fx-round[aria-pressed='true'] { border-color: var(--fx-gold-rim); box-shadow: inset 0 0 0 2px rgb(255 196 107 / 40%), 0 2px 0 rgb(2 10 24 / 50%); }
/* ── chip ────────────────────────────────────────────────────────────── */
.fx-chip { .fx-chip {
display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--fx-s-3); display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--fx-s-3);
border: 1px solid var(--fx-rim); border-radius: var(--fx-r-full); background: rgb(255 255 255 / 6%); color: var(--fx-ink); border: 1px solid var(--fx-rim); border-radius: var(--fx-r-full); background: rgb(255 255 255 / 6%); color: var(--fx-ink);
@ -97,7 +89,7 @@
background: linear-gradient(180deg, var(--fx-gold-face), var(--fx-gold)); box-shadow: inset 0 1px rgb(255 255 255 / 55%), 0 2px 0 var(--fx-gold-foot); background: linear-gradient(180deg, var(--fx-gold-face), var(--fx-gold)); box-shadow: inset 0 1px rgb(255 255 255 / 55%), 0 2px 0 var(--fx-gold-foot);
} }
/* ── badge and tag ───────────────────────────────────────────────────── */
.fx-badge { .fx-badge {
display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border: 2px solid var(--fx-pearl); border-radius: var(--fx-r-full); display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border: 2px solid var(--fx-pearl); border-radius: var(--fx-r-full);
background: linear-gradient(180deg, var(--fx-tone-coral), color-mix(in oklab, var(--fx-alarm), black 22%)); background: linear-gradient(180deg, var(--fx-tone-coral), color-mix(in oklab, var(--fx-alarm), black 22%));
@ -110,7 +102,7 @@
} }
.fx-eyebrow { display: block; color: var(--fx-gold); font: 900 var(--fx-t-xs)/1 var(--fx-font-ui); letter-spacing: var(--fx-track-label); text-transform: uppercase; } .fx-eyebrow { display: block; color: var(--fx-gold); font: 900 var(--fx-t-xs)/1 var(--fx-font-ui); letter-spacing: var(--fx-track-label); text-transform: uppercase; }
/* ── surfaces: card, panel, window ───────────────────────────────────── */
.fx-card, .fx-panel, .fx-window, .fx-dock, .fx-toast, .fx-tooltip, .fx-stat { .fx-card, .fx-panel, .fx-window, .fx-dock, .fx-toast, .fx-tooltip, .fx-stat {
border: 1px solid var(--fx-rim); background: var(--fx-glass); color: var(--fx-ink); border: 1px solid var(--fx-rim); background: var(--fx-glass); color: var(--fx-ink);
-webkit-backdrop-filter: var(--fx-glass-blur); backdrop-filter: var(--fx-glass-blur); -webkit-backdrop-filter: var(--fx-glass-blur); backdrop-filter: var(--fx-glass-blur);
@ -132,7 +124,7 @@
.fx-window-buttons { display: flex; gap: 6px; } .fx-window-buttons { display: flex; gap: 6px; }
.fx-window-body { flex: 1; min-height: 0; overflow: auto; padding: var(--fx-s-4); background: var(--fx-glass-well); scrollbar-width: thin; } .fx-window-body { flex: 1; min-height: 0; overflow: auto; padding: var(--fx-s-4); background: var(--fx-glass-well); scrollbar-width: thin; }
/* ── tabs ────────────────────────────────────────────────────────────── */
.fx-tabs { display: inline-flex; gap: 4px; max-width: 100%; padding: 4px; overflow-x: auto; border: 1px solid var(--fx-rim); border-radius: var(--fx-r-full); background: var(--fx-deep); box-shadow: inset 0 2px 6px rgb(0 0 0 / 40%); scrollbar-width: none; } .fx-tabs { display: inline-flex; gap: 4px; max-width: 100%; padding: 4px; overflow-x: auto; border: 1px solid var(--fx-rim); border-radius: var(--fx-r-full); background: var(--fx-deep); box-shadow: inset 0 2px 6px rgb(0 0 0 / 40%); scrollbar-width: none; }
.fx-tab { .fx-tab {
display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 var(--fx-s-4); border: 1px solid transparent; border-radius: var(--fx-r-full); display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 var(--fx-s-4); border: 1px solid transparent; border-radius: var(--fx-r-full);
@ -148,7 +140,7 @@
background: linear-gradient(180deg, var(--fx-gold-face), var(--fx-gold)); box-shadow: inset 0 1px rgb(255 255 255 / 55%), 0 2px 0 var(--fx-gold-foot); background: linear-gradient(180deg, var(--fx-gold-face), var(--fx-gold)); box-shadow: inset 0 1px rgb(255 255 255 / 55%), 0 2px 0 var(--fx-gold-foot);
} }
/* ── list ────────────────────────────────────────────────────────────── */
.fx-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; } .fx-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.fx-row { .fx-row {
display: flex; align-items: center; gap: var(--fx-s-3); width: 100%; min-height: 56px; padding: var(--fx-s-2) var(--fx-s-3); display: flex; align-items: center; gap: var(--fx-s-3); width: 100%; min-height: 56px; padding: var(--fx-s-2) var(--fx-s-3);
@ -164,7 +156,7 @@
.fx-row-text small { overflow: hidden; color: var(--fx-ink-3); font: 700 var(--fx-t-sm)/1.25 var(--fx-font-ui); text-overflow: ellipsis; white-space: nowrap; } .fx-row-text small { overflow: hidden; color: var(--fx-ink-3); font: 700 var(--fx-t-sm)/1.25 var(--fx-font-ui); text-overflow: ellipsis; white-space: nowrap; }
.fx-row-end { flex: none; color: var(--fx-gold-light); font: 800 var(--fx-t-md)/1 var(--fx-font-display); font-variant-numeric: tabular-nums; } .fx-row-end { flex: none; color: var(--fx-gold-light); font: 800 var(--fx-t-md)/1 var(--fx-font-display); font-variant-numeric: tabular-nums; }
/* ── field, toggle ───────────────────────────────────────────────────── */
.fx-field { display: grid; gap: 6px; min-width: 0; } .fx-field { display: grid; gap: 6px; min-width: 0; }
.fx-field > span { color: var(--fx-ink-blue); font: 800 var(--fx-t-xs)/1 var(--fx-font-ui); letter-spacing: var(--fx-track-label); text-transform: uppercase; } .fx-field > span { color: var(--fx-ink-blue); font: 800 var(--fx-t-xs)/1 var(--fx-font-ui); letter-spacing: var(--fx-track-label); text-transform: uppercase; }
.fx-field > small { color: var(--fx-ink-3); font: 600 var(--fx-t-sm)/1.35 var(--fx-font-ui); } .fx-field > small { color: var(--fx-ink-3); font: 600 var(--fx-t-sm)/1.35 var(--fx-font-ui); }
@ -185,7 +177,7 @@
background: var(--fx-deep); box-shadow: inset 0 2px 6px rgb(0 0 0 / 50%); background: var(--fx-deep); box-shadow: inset 0 2px 6px rgb(0 0 0 / 50%);
transition: background var(--m-base) var(--m-ease-out), border-color var(--m-base) var(--m-ease-out); transition: background var(--m-base) var(--m-ease-out), border-color var(--m-base) var(--m-ease-out);
} }
/* The knob is a pearl: lit from the top left, a little shadow under it. */
.fx-toggle > i::after { .fx-toggle > i::after {
content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
background: radial-gradient(circle at 34% 28%, white, var(--fx-pearl) 55%, var(--fx-cream)); background: radial-gradient(circle at 34% 28%, white, var(--fx-pearl) 55%, var(--fx-cream));
@ -197,7 +189,7 @@
.fx-toggle > input:focus-visible + i { outline: 3px solid var(--fx-gold); outline-offset: 3px; } .fx-toggle > input:focus-visible + i { outline: 3px solid var(--fx-gold); outline-offset: 3px; }
.fx-toggle > input:disabled + i { filter: saturate(.3); opacity: .6; } .fx-toggle > input:disabled + i { filter: saturate(.3); opacity: .6; }
/* ── tooltip ─────────────────────────────────────────────────────────── */
.fx-tip { position: relative; display: inline-flex; } .fx-tip { position: relative; display: inline-flex; }
.fx-tooltip { .fx-tooltip {
position: absolute; z-index: var(--fx-z-tooltip); left: 50%; bottom: calc(100% + 12px); width: max-content; min-width: 180px; max-width: 280px; position: absolute; z-index: var(--fx-z-tooltip); left: 50%; bottom: calc(100% + 12px); width: max-content; min-width: 180px; max-width: 280px;
@ -216,7 +208,7 @@
.fx-tooltip dt { color: var(--fx-ink-blue); font: 800 var(--fx-t-sm)/1.2 var(--fx-font-ui); } .fx-tooltip dt { color: var(--fx-ink-blue); font: 800 var(--fx-t-sm)/1.2 var(--fx-font-ui); }
.fx-tooltip dd { margin: 0; font: 800 var(--fx-t-sm)/1.2 var(--fx-font-display); font-variant-numeric: tabular-nums; } .fx-tooltip dd { margin: 0; font: 800 var(--fx-t-sm)/1.2 var(--fx-font-display); font-variant-numeric: tabular-nums; }
/* ── toast ───────────────────────────────────────────────────────────── */
.fx-toast { .fx-toast {
position: relative; display: flex; align-items: center; gap: var(--fx-s-3); width: min(380px, 100%); padding: var(--fx-s-3) var(--fx-s-3) var(--fx-s-3) var(--fx-s-3); position: relative; display: flex; align-items: center; gap: var(--fx-s-3); width: min(380px, 100%); padding: var(--fx-s-3) var(--fx-s-3) var(--fx-s-3) var(--fx-s-3);
border-radius: var(--fx-r-lg); box-shadow: var(--fx-rim-light), var(--fx-lift-2); overflow: hidden; border-radius: var(--fx-r-lg); box-shadow: var(--fx-rim-light), var(--fx-lift-2); overflow: hidden;
@ -228,7 +220,7 @@
.fx-toast-text b { font: 800 var(--fx-t-md)/1.2 var(--fx-font-display); } .fx-toast-text b { font: 800 var(--fx-t-md)/1.2 var(--fx-font-display); }
.fx-toast-text span { color: var(--fx-ink-2); font: 600 var(--fx-t-sm)/1.35 var(--fx-font-ui); } .fx-toast-text span { color: var(--fx-ink-2); font: 600 var(--fx-t-sm)/1.35 var(--fx-font-ui); }
/* ── stat ────────────────────────────────────────────────────────────── */
.fx-stats { display: flex; flex-wrap: wrap; gap: 10px; } .fx-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.fx-stat { display: inline-flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 16px 8px 10px; border-radius: 18px; box-shadow: var(--fx-rim-light), var(--fx-foot); } .fx-stat { display: inline-flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 16px 8px 10px; border-radius: 18px; box-shadow: var(--fx-rim-light), var(--fx-foot); }
.fx-stat > .fx-icon { width: 38px; height: 38px; filter: drop-shadow(0 3px 3px rgb(0 0 0 / 35%)); } .fx-stat > .fx-icon { width: 38px; height: 38px; filter: drop-shadow(0 3px 3px rgb(0 0 0 / 35%)); }
@ -236,7 +228,7 @@
.fx-stat b small { margin-left: 3px; color: var(--fx-ink-3); font-size: var(--fx-t-sm); } .fx-stat b small { margin-left: 3px; color: var(--fx-ink-3); font-size: var(--fx-t-sm); }
.fx-stat > span > span { color: var(--fx-ink-3); font: 700 var(--fx-t-sm)/1.3 var(--fx-font-ui); } .fx-stat > span > span { color: var(--fx-ink-3); font: 700 var(--fx-t-sm)/1.3 var(--fx-font-ui); }
/* ── desktop tile and dock ───────────────────────────────────────────── */
.fx-tile { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 118px; padding: 0; border: 0; background: none; color: var(--fx-ink); font: inherit; cursor: pointer; } .fx-tile { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 118px; padding: 0; border: 0; background: none; color: var(--fx-ink); font: inherit; cursor: pointer; }
.fx-tile-glass { .fx-tile-glass {
position: relative; display: grid; place-items: center; aspect-ratio: 1; border: 1.5px solid var(--fx-gold-rim); border-radius: var(--fx-r-xl); position: relative; display: grid; place-items: center; aspect-ratio: 1; border: 1.5px solid var(--fx-gold-rim); border-radius: var(--fx-r-xl);

View file

@ -5,13 +5,9 @@ import FishiesImg from './FishiesImg'
import { ICON_SIZES, iconByName, iconUrl, type IconSize, type SystemIconName } from './icons' import { ICON_SIZES, iconByName, iconUrl, type IconSize, type SystemIconName } from './icons'
import './kit.css' import './kit.css'
/* fishies-ui components. Each export's first doc sentence is its Handbook entry (the build reads
them), so a component is described once, here, next to the code that draws it. */
const cx = (...names: (string | false | null | undefined)[]) => names.filter(Boolean).join(' ') const cx = (...names: (string | false | null | undefined)[]) => names.filter(Boolean).join(' ')
const px = (size: IconSize | number) => typeof size === 'number' ? size : ICON_SIZES[size] const px = (size: IconSize | number) => typeof size === 'number' ? size : ICON_SIZES[size]
/** A painted icon from the system set, by name, at one of the set's sizes. */
export function SystemIcon({ name, size = 'md', fallback, className }: { name: SystemIconName; size?: IconSize | number; fallback?: ReactNode; className?: string }) { export function SystemIcon({ name, size = 'md', fallback, className }: { name: SystemIconName; size?: IconSize | number; fallback?: ReactNode; className?: string }) {
const [failed, setFailed] = useState(false) const [failed, setFailed] = useState(false)
const icon = iconByName(name) const icon = iconByName(name)
@ -55,14 +51,12 @@ export function Chip({ tone, icon, selected, onClick, children, className }: { t
: <span className={cx('fx-chip', selected && 'is-on', className)} style={style}>{inner}</span> : <span className={cx('fx-chip', selected && 'is-on', className)} style={style}>{inner}</span>
} }
/** A coral count bubble that sits on a tile, a dock item or a bell; a dot when the number does not matter. */
export function Badge({ count, label }: { count?: number; label?: string }) { export function Badge({ count, label }: { count?: number; label?: string }) {
return count === undefined return count === undefined
? <span className="fx-badge is-dot" role="status" aria-label={label}/> ? <span className="fx-badge is-dot" role="status" aria-label={label}/>
: <span className="fx-badge" role="status" aria-label={label}>{count > 99 ? '99+' : count}</span> : <span className="fx-badge" role="status" aria-label={label}>{count > 99 ? '99+' : count}</span>
} }
/** A gold-rimmed capsule for a small upper-case word beside a name (Beta, New, Admin). */
export function Tag({ children }: { children: ReactNode }) { export function Tag({ children }: { children: ReactNode }) {
return <span className="fx-tag">{children}</span> return <span className="fx-tag">{children}</span>
} }
@ -76,7 +70,6 @@ export function Card({ eyebrow, title, children, className }: { eyebrow?: string
</article> </article>
} }
/** A gold-rimmed glass panel with a title row (icon, title, actions) and a body. */
export function Panel({ title, icon, actions, children, className, style }: { title: ReactNode; icon?: SystemIconName; actions?: ReactNode; children?: ReactNode; className?: string; style?: CSSProperties }) { export function Panel({ title, icon, actions, children, className, style }: { title: ReactNode; icon?: SystemIconName; actions?: ReactNode; children?: ReactNode; className?: string; style?: CSSProperties }) {
return <section className={cx('fx-panel', className)} style={style}> return <section className={cx('fx-panel', className)} style={style}>
<header className="fx-panel-head">{icon && <SystemIcon name={icon} size={30}/>}<h2>{title}</h2>{actions}</header> <header className="fx-panel-head">{icon && <SystemIcon name={icon} size={30}/>}<h2>{title}</h2>{actions}</header>
@ -104,7 +97,6 @@ export function Window({ title, icon, onClose, onMinimize, closeLabel = 'Close',
export type TabItem = { id: string; label: string; icon?: SystemIconName } export type TabItem = { id: string; label: string; icon?: SystemIconName }
/** A row of pill tabs in a sunken track; the chosen one is gold. */
export function Tabs({ items, value, onChange, label }: { items: readonly TabItem[]; value: string; onChange: (id: string) => void; label: string }) { export function Tabs({ items, value, onChange, label }: { items: readonly TabItem[]; value: string; onChange: (id: string) => void; label: string }) {
const move = (from: number, step: number) => onChange(items[(from + step + items.length) % items.length]!.id) const move = (from: number, step: number) => onChange(items[(from + step + items.length) % items.length]!.id)
return <div className="fx-tabs" role="tablist" aria-label={label}> return <div className="fx-tabs" role="tablist" aria-label={label}>
@ -120,7 +112,6 @@ export function List({ children, label }: { children: ReactNode; label?: string
return <ul className="fx-list" aria-label={label}>{children}</ul> return <ul className="fx-list" aria-label={label}>{children}</ul>
} }
/** One row of a list; a button when it does something, a link when it goes somewhere. */
export function ListRow({ icon, title, detail, end, onClick, href, selected }: { icon?: SystemIconName; title: ReactNode; detail?: ReactNode; end?: ReactNode; onClick?: () => void; href?: string; selected?: boolean }) { export function ListRow({ icon, title, detail, end, onClick, href, selected }: { icon?: SystemIconName; title: ReactNode; detail?: ReactNode; end?: ReactNode; onClick?: () => void; href?: string; selected?: boolean }) {
const inner = <>{icon && <SystemIcon name={icon} size={36}/>}<span className="fx-row-text"><b>{title}</b>{detail && <small>{detail}</small>}</span>{end !== undefined && <span className="fx-row-end">{end}</span>}</> const inner = <>{icon && <SystemIcon name={icon} size={36}/>}<span className="fx-row-text"><b>{title}</b>{detail && <small>{detail}</small>}</span>{end !== undefined && <span className="fx-row-end">{end}</span>}</>
return <li>{href ? <a className={cx('fx-row', selected && 'is-on')} href={href}>{inner}</a> return <li>{href ? <a className={cx('fx-row', selected && 'is-on')} href={href}>{inner}</a>
@ -128,7 +119,6 @@ export function ListRow({ icon, title, detail, end, onClick, href, selected }: {
: <div className={cx('fx-row', selected && 'is-on')}>{inner}</div>}</li> : <div className={cx('fx-row', selected && 'is-on')}>{inner}</div>}</li>
} }
/** A labelled text field in a sunken pill, with an optional hint under it. */
export function Field({ label, hint, className, ...input }: { label: string; hint?: string } & InputHTMLAttributes<HTMLInputElement>) { export function Field({ label, hint, className, ...input }: { label: string; hint?: string } & InputHTMLAttributes<HTMLInputElement>) {
const id = useId() const id = useId()
return <label className={cx('fx-field', className)} htmlFor={id}> return <label className={cx('fx-field', className)} htmlFor={id}>
@ -138,7 +128,6 @@ export function Field({ label, hint, className, ...input }: { label: string; hin
</label> </label>
} }
/** An on and off switch with a pearl knob; gold when on. */
export function Toggle({ label, checked, onChange, disabled }: { label: ReactNode; checked: boolean; onChange: (checked: boolean) => void; disabled?: boolean }) { export function Toggle({ label, checked, onChange, disabled }: { label: ReactNode; checked: boolean; onChange: (checked: boolean) => void; disabled?: boolean }) {
return <label className="fx-toggle"> return <label className="fx-toggle">
<input type="checkbox" role="switch" checked={checked} disabled={disabled} onChange={event => onChange(event.target.checked)}/> <input type="checkbox" role="switch" checked={checked} disabled={disabled} onChange={event => onChange(event.target.checked)}/>
@ -161,7 +150,6 @@ export function Tooltip({ title, icon, text, rows, children, open }: { title: Re
</span> </span>
} }
/** A notice that slides in at the edge: an icon in a coloured bubble, a title, a line and a close. */
export function Toast({ title, children, icon, tone, onClose, closeLabel = 'Close' }: { title: ReactNode; children?: ReactNode; icon?: SystemIconName; tone?: string; onClose?: () => void; closeLabel?: string }) { export function Toast({ title, children, icon, tone, onClose, closeLabel = 'Close' }: { title: ReactNode; children?: ReactNode; icon?: SystemIconName; tone?: string; onClose?: () => void; closeLabel?: string }) {
return <div className="fx-toast" role="status" style={tone ? { '--tone': tone } as CSSProperties : undefined}> return <div className="fx-toast" role="status" style={tone ? { '--tone': tone } as CSSProperties : undefined}>
{icon && <span className="fx-toast-art"><SystemIcon name={icon} size={32}/></span>} {icon && <span className="fx-toast-art"><SystemIcon name={icon} size={32}/></span>}
@ -186,7 +174,6 @@ export function DockTile({ icon, title, hue, badge, open, onClick }: { icon: Sys
</button> </button>
} }
/** A dock: a gold-rimmed glass shelf of icons; the app in front wears a gold bar, open ones a dot. */
export function Dock({ children, label }: { children: ReactNode; label: string }) { export function Dock({ children, label }: { children: ReactNode; label: string }) {
return <nav className="fx-dock" aria-label={label}>{children}</nav> return <nav className="fx-dock" aria-label={label}>{children}</nav>
} }

View file

@ -1,7 +1,3 @@
/* The Fishies loader: spinner, progress bar, and pictures that never paint half-loaded.
Unlayered on purpose, so a surface's own layered image rules cannot put a waiting picture's
pixels back on screen. See fx-image.ts and FishiesLoader.tsx. */
.fx-spinner { .fx-spinner {
display: inline-grid; place-items: center; flex: none; display: inline-grid; place-items: center; flex: none;
width: var(--fx-size, 32px); height: var(--fx-size, 32px); width: var(--fx-size, 32px); height: var(--fx-size, 32px);
@ -24,7 +20,7 @@
box-shadow: 0 0 8px var(--fx-gold-rim); box-shadow: 0 0 8px var(--fx-gold-rim);
transition: width 320ms cubic-bezier(.2, .8, .2, 1); transition: width 320ms cubic-bezier(.2, .8, .2, 1);
} }
/* The bubble riding the gold's leading edge. */
.fx-progress > i::after { .fx-progress > i::after {
content: ''; position: absolute; top: 50%; right: 1px; width: 6px; height: 6px; margin-top: -3px; content: ''; position: absolute; top: 50%; right: 1px; width: 6px; height: 6px; margin-top: -3px;
border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, rgb(255 255 255 / 35%) 70%); border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, rgb(255 255 255 / 35%) 70%);
@ -32,8 +28,6 @@
.fx-progress[data-indeterminate] > i { width: 34%; animation: fx-sweep 1.4s cubic-bezier(.45, 0, .55, 1) infinite; } .fx-progress[data-indeterminate] > i { width: 34%; animation: fx-sweep 1.4s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes fx-sweep { from { transform: translateX(-105%); } to { transform: translateX(300%); } } @keyframes fx-sweep { from { transform: translateX(-105%); } to { transform: translateX(300%); } }
/* A waiting picture keeps its box, draws its pixels outside it (clipped, so never seen, however
the file arrives), and shows the spinner on glass in their place. */
:is(img, video)[data-fx='wait'], img[data-fx='error'] { object-position: -99999px -99999px !important; } :is(img, video)[data-fx='wait'], img[data-fx='error'] { object-position: -99999px -99999px !important; }
:is(img, video)[data-fx='wait'] { :is(img, video)[data-fx='wait'] {
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cstyle%3E.a%7Btransform-origin:24px 24px;animation:s 1.1s linear infinite%7D.b%7Bopacity:0;animation:u 1.8s ease-in infinite%7D.c%7Banimation-delay:.6s%7D.d%7Banimation-delay:1.2s%7D@keyframes s%7Bto%7Btransform:rotate(360deg)%7D%7D@keyframes u%7B0%25%7Bopacity:0;transform:translateY(7px)%7D30%25%7Bopacity:.95%7D100%25%7Bopacity:0;transform:translateY(-9px)%7D%7D@media (prefers-reduced-motion:reduce)%7B.a%7Banimation-duration:3.6s%7D.b%7Banimation:none;opacity:.8%7D%7D%3C/style%3E%3Ccircle cx='24' cy='24' r='21' fill='%230b2a3c' fill-opacity='.74' stroke='%23c4ecfa' stroke-opacity='.24'/%3E%3Ccircle cx='24' cy='24' r='16' fill='none' stroke='%23c4ecfa' stroke-opacity='.13' stroke-width='3'/%3E%3Ccircle class='a' cx='24' cy='24' r='16' fill='none' stroke='%23ffc46b' stroke-width='3' stroke-linecap='round' stroke-dasharray='25 76'/%3E%3Cg fill='%23dff6ff' fill-opacity='.16' stroke='%23dff6ff' stroke-width='1.1'%3E%3Ccircle class='b' cx='21.5' cy='26' r='2.7'/%3E%3Ccircle class='b c' cx='27' cy='27.5' r='1.9'/%3E%3Ccircle class='b d' cx='23.5' cy='30' r='1.3'/%3E%3C/g%3E%3C/svg%3E") center / clamp(12px, 36%, 40px) no-repeat, background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cstyle%3E.a%7Btransform-origin:24px 24px;animation:s 1.1s linear infinite%7D.b%7Bopacity:0;animation:u 1.8s ease-in infinite%7D.c%7Banimation-delay:.6s%7D.d%7Banimation-delay:1.2s%7D@keyframes s%7Bto%7Btransform:rotate(360deg)%7D%7D@keyframes u%7B0%25%7Bopacity:0;transform:translateY(7px)%7D30%25%7Bopacity:.95%7D100%25%7Bopacity:0;transform:translateY(-9px)%7D%7D@media (prefers-reduced-motion:reduce)%7B.a%7Banimation-duration:3.6s%7D.b%7Banimation:none;opacity:.8%7D%7D%3C/style%3E%3Ccircle cx='24' cy='24' r='21' fill='%230b2a3c' fill-opacity='.74' stroke='%23c4ecfa' stroke-opacity='.24'/%3E%3Ccircle cx='24' cy='24' r='16' fill='none' stroke='%23c4ecfa' stroke-opacity='.13' stroke-width='3'/%3E%3Ccircle class='a' cx='24' cy='24' r='16' fill='none' stroke='%23ffc46b' stroke-width='3' stroke-linecap='round' stroke-dasharray='25 76'/%3E%3Cg fill='%23dff6ff' fill-opacity='.16' stroke='%23dff6ff' stroke-width='1.1'%3E%3Ccircle class='b' cx='21.5' cy='26' r='2.7'/%3E%3Ccircle class='b c' cx='27' cy='27.5' r='1.9'/%3E%3Ccircle class='b d' cx='23.5' cy='30' r='1.3'/%3E%3C/g%3E%3C/svg%3E") center / clamp(12px, 36%, 40px) no-repeat,

View file

@ -3,12 +3,6 @@
import type { CSSProperties } from 'react' import type { CSSProperties } from 'react'
import './loader.css' import './loader.css'
/** The Fishies spinner: a glass porthole in the HUD's navy, a gold arc going round its rim and
* three bubbles rising through it. Drawn in code (no picture to wait for), so it is on screen
* from the first paint. Under reduced motion the bubbles hold still and the arc turns slowly.
*
* loader.css carries this exact drawing as the placeholder of every waiting picture
* (`svgDataUri` below; loader.test.ts keeps the two in step). */
export const SPINNER_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">' + export const SPINNER_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">' +
'<style>.a{transform-origin:24px 24px;animation:s 1.1s linear infinite}' + '<style>.a{transform-origin:24px 24px;animation:s 1.1s linear infinite}' +
'.b{opacity:0;animation:u 1.8s ease-in infinite}.c{animation-delay:.6s}.d{animation-delay:1.2s}' + '.b{opacity:0;animation:u 1.8s ease-in infinite}.c{animation-delay:.6s}.d{animation-delay:1.2s}' +
@ -22,12 +16,10 @@ export const SPINNER_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0
'<circle class="b" cx="21.5" cy="26" r="2.7"/><circle class="b c" cx="27" cy="27.5" r="1.9"/><circle class="b d" cx="23.5" cy="30" r="1.3"/>' + '<circle class="b" cx="21.5" cy="26" r="2.7"/><circle class="b c" cx="27" cy="27.5" r="1.9"/><circle class="b d" cx="23.5" cy="30" r="1.3"/>' +
'</g></svg>' '</g></svg>'
/** The drawing above as a CSS `url()` value. */
export function svgDataUri(svg: string) { export function svgDataUri(svg: string) {
return `url("data:image/svg+xml,${svg.replace(/"/g, "'").replace(/[<>#%{}]/g, c => encodeURIComponent(c))}")` return `url("data:image/svg+xml,${svg.replace(/"/g, "'").replace(/[<>#%{}]/g, c => encodeURIComponent(c))}")`
} }
/** The Fishies spinner for anything on its way: a glass porthole with a gold arc going round and bubbles rising. */
export function Spinner({ size = 32, label = 'Loading', className, style }: { size?: number; label?: string; className?: string; style?: CSSProperties }) { export function Spinner({ size = 32, label = 'Loading', className, style }: { size?: number; label?: string; className?: string; style?: CSSProperties }) {
return <span className={`fx-spinner${className ? ` ${className}` : ''}`} role="status" aria-label={label} return <span className={`fx-spinner${className ? ` ${className}` : ''}`} role="status" aria-label={label}
style={{ '--fx-size': `${size}px`, ...style } as CSSProperties} dangerouslySetInnerHTML={{ __html: SPINNER_SVG.replace('<svg ', '<svg aria-hidden="true" focusable="false" ') }}/> style={{ '--fx-size': `${size}px`, ...style } as CSSProperties} dangerouslySetInnerHTML={{ __html: SPINNER_SVG.replace('<svg ', '<svg aria-hidden="true" focusable="false" ') }}/>

View file

@ -1,5 +1,3 @@
/** Keyboard and selection logic for the shared <Select>, kept pure so it can be tested without a DOM. */
export type SelectOptionState = { value: string; label: string; disabled?: boolean } export type SelectOptionState = { value: string; label: string; disabled?: boolean }
export type SelectState = { open: boolean; active: number } export type SelectState = { open: boolean; active: number }
export type SelectKeyResult = SelectState & { choose?: string; close?: 'focus' | 'blur'; handled: boolean } export type SelectKeyResult = SelectState & { choose?: string; close?: 'focus' | 'blur'; handled: boolean }
@ -11,13 +9,11 @@ export function selectedIndex(options: readonly SelectOptionState[], value: stri
return index >= 0 && !options[index]!.disabled ? index : enabled(options)[0] ?? -1 return index >= 0 && !options[index]!.disabled ? index : enabled(options)[0] ?? -1
} }
/** The next enabled option from `from` in `step` direction; the list ends where it ends. */
export function moveActive(options: readonly SelectOptionState[], from: number, step: 1 | -1) { export function moveActive(options: readonly SelectOptionState[], from: number, step: 1 | -1) {
for (let index = from + step; index >= 0 && index < options.length; index += step) if (!options[index]!.disabled) return index for (let index = from + step; index >= 0 && index < options.length; index += step) if (!options[index]!.disabled) return index
return from return from
} }
/** The next enabled option after `from` whose label starts with `key`, wrapping around. */
export function typeahead(options: readonly SelectOptionState[], from: number, key: string) { export function typeahead(options: readonly SelectOptionState[], from: number, key: string) {
const needle = key.toLocaleLowerCase() const needle = key.toLocaleLowerCase()
for (let offset = 1; offset <= options.length; offset++) { for (let offset = 1; offset <= options.length; offset++) {
@ -53,7 +49,6 @@ export function selectKey(state: SelectState, key: string, options: readonly Sel
return { ...state, handled: false } return { ...state, handled: false }
} }
/** Where the popup goes: below the trigger unless there is more room above, always inside the viewport. */
export function placePopup(rect: { top: number; bottom: number; left: number; width: number }, viewport: { width: number; height: number }, wanted: number, gap = 6, margin = 8) { export function placePopup(rect: { top: number; bottom: number; left: number; width: number }, viewport: { width: number; height: number }, wanted: number, gap = 6, margin = 8) {
const below = viewport.height - rect.bottom - gap - margin, above = rect.top - gap - margin const below = viewport.height - rect.bottom - gap - margin, above = rect.top - gap - margin
const up = below < Math.min(wanted, 180) && above > below const up = below < Math.min(wanted, 180) && above > below

View file

@ -1,7 +1,3 @@
/* The shared dropdown (app/ui/Select.tsx), in the language menu's family: a quiet pill that opens a
dark panel with a gold checkmark. Each surface only sets the --fs-select-* tokens below; the
component copies the resolved tokens onto the portalled popup, so it matches wherever it opens. */
:root { :root {
--fs-select-ink: var(--fx-ground-ink); --fs-select-ink: var(--fx-ground-ink);
--fs-select-muted: var(--fx-muted); --fs-select-muted: var(--fx-muted);
@ -45,7 +41,6 @@
--fs-select-accent: var(--env-accent, #ffc46b); --fs-select-accent: var(--env-accent, #ffc46b);
} }
/* Doubled class: beats surface-wide `button` rules (admin, site) without !important. */
.fs-select.fs-select { .fs-select.fs-select {
display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px;
min-width: 0; max-width: 100%; min-height: 40px; margin: 0; padding: 8px 12px; min-width: 0; max-width: 100%; min-height: 40px; margin: 0; padding: 8px 12px;

View file

@ -1,31 +1,30 @@
/* GENERATED by tools/fishies-ui/build.ts from apps/web/app/ui/tokens.ts. Do not edit: change the source and run `bun tools/fishies-ui/build.ts`. */
:root { :root {
/* Brand */
--fx-ground: #071a24; --fx-ground: #071a24;
--fx-ground-ink: #edf5ed; --fx-ground-ink: #edf5ed;
--fx-gold: #ffc46b; --fx-gold: #ffc46b;
--fx-sea: #83cfbd; --fx-sea: #83cfbd;
--fx-muted: #adc3c7; --fx-muted: #adc3c7;
/* Water */
--fx-abyss: #04101b; --fx-abyss: #04101b;
--fx-deep: #08202f; --fx-deep: #08202f;
--fx-deep-2: #0d2c3f; --fx-deep-2: #0d2c3f;
--fx-deep-3: #14435c; --fx-deep-3: #14435c;
--fx-navy: #173d63; --fx-navy: #173d63;
/* Ink */
--fx-ink: #eef6ff; --fx-ink: #eef6ff;
--fx-ink-2: rgb(238 246 255 / 80%); --fx-ink-2: rgb(238 246 255 / 80%);
--fx-ink-3: rgb(238 246 255 / 62%); --fx-ink-3: rgb(238 246 255 / 62%);
--fx-ink-blue: #a9c9ea; --fx-ink-blue: #a9c9ea;
--fx-ink-on-gold: #12304a; --fx-ink-on-gold: #12304a;
/* Gold */
--fx-gold-light: #ffe2a6; --fx-gold-light: #ffe2a6;
--fx-gold-face: #ffe4a8; --fx-gold-face: #ffe4a8;
--fx-gold-deep: #e59a3e; --fx-gold-deep: #e59a3e;
--fx-gold-foot: #c88a3d; --fx-gold-foot: #c88a3d;
--fx-gold-warm: #ff9a6b; --fx-gold-warm: #ff9a6b;
--fx-amber: #f4c656; --fx-amber: #f4c656;
/* Tones */
--fx-tone-sky: #6cc8ff; --fx-tone-sky: #6cc8ff;
--fx-tone-coral: #ff8f87; --fx-tone-coral: #ff8f87;
--fx-tone-kelp: #7fdc8f; --fx-tone-kelp: #7fdc8f;
@ -37,7 +36,7 @@
--fx-pearl: #fff4d6; --fx-pearl: #fff4d6;
--fx-cream: #f3dfb2; --fx-cream: #f3dfb2;
--fx-plum: #36203f; --fx-plum: #36203f;
/* Glass */
--fx-glass-top: rgb(22 58 120 / 70%); --fx-glass-top: rgb(22 58 120 / 70%);
--fx-glass-bottom: rgb(8 26 66 / 88%); --fx-glass-bottom: rgb(8 26 66 / 88%);
--fx-glass-quiet-top: rgb(22 58 120 / 62%); --fx-glass-quiet-top: rgb(22 58 120 / 62%);
@ -47,14 +46,14 @@
--fx-glass-quiet: linear-gradient(180deg, var(--fx-glass-sheen), transparent 46%), linear-gradient(180deg, var(--fx-glass-quiet-top), var(--fx-glass-quiet-bottom)); --fx-glass-quiet: linear-gradient(180deg, var(--fx-glass-sheen), transparent 46%), linear-gradient(180deg, var(--fx-glass-quiet-top), var(--fx-glass-quiet-bottom));
--fx-glass-well: rgb(4 16 30 / 55%); --fx-glass-well: rgb(4 16 30 / 55%);
--fx-glass-blur: blur(14px) saturate(1.2); --fx-glass-blur: blur(14px) saturate(1.2);
/* Rims */
--fx-rim: rgb(140 200 255 / 34%); --fx-rim: rgb(140 200 255 / 34%);
--fx-rim-bright: rgb(140 200 255 / 55%); --fx-rim-bright: rgb(140 200 255 / 55%);
--fx-gold-rim: rgb(255 196 107 / 58%); --fx-gold-rim: rgb(255 196 107 / 58%);
--fx-gold-rim-quiet: rgb(255 196 107 / 26%); --fx-gold-rim-quiet: rgb(255 196 107 / 26%);
--fx-rim-light: inset 0 1px rgb(255 240 210 / 30%); --fx-rim-light: inset 0 1px rgb(255 240 210 / 30%);
--fx-ground-rim: #9ebfbe26; --fx-ground-rim: #9ebfbe26;
/* Depth */
--fx-lift-1: 0 2px 10px rgb(2 10 18 / 34%); --fx-lift-1: 0 2px 10px rgb(2 10 18 / 34%);
--fx-lift-2: 0 10px 30px rgb(2 8 20 / 45%); --fx-lift-2: 0 10px 30px rgb(2 8 20 / 45%);
--fx-lift-3: 0 24px 60px rgb(2 8 20 / 60%); --fx-lift-3: 0 24px 60px rgb(2 8 20 / 60%);
@ -62,7 +61,7 @@
--fx-foot-deep: 0 6px 0 rgb(4 18 34 / 55%); --fx-foot-deep: 0 6px 0 rgb(4 18 34 / 55%);
--fx-plump: inset 0 2px rgb(255 255 255 / 40%), inset 0 -6px 12px rgb(0 0 0 / 28%); --fx-plump: inset 0 2px rgb(255 255 255 / 40%), inset 0 -6px 12px rgb(0 0 0 / 28%);
--fx-on-water: 0 1px 2px #020c1a, 0 4px 16px rgb(2 12 26 / 80%); --fx-on-water: 0 1px 2px #020c1a, 0 4px 16px rgb(2 12 26 / 80%);
/* Type */
--fx-font-display: var(--font-display), "Baloo 2", ui-rounded, sans-serif; --fx-font-display: var(--font-display), "Baloo 2", ui-rounded, sans-serif;
--fx-font-ui: var(--font-ui), Nunito, ui-rounded, sans-serif; --fx-font-ui: var(--font-ui), Nunito, ui-rounded, sans-serif;
--fx-t-xs: 12px; --fx-t-xs: 12px;
@ -74,13 +73,13 @@
--fx-t-3xl: 40px; --fx-t-3xl: 40px;
--fx-track-tight: -.015em; --fx-track-tight: -.015em;
--fx-track-label: .14em; --fx-track-label: .14em;
/* Radii */
--fx-r-sm: 10px; --fx-r-sm: 10px;
--fx-r-md: 14px; --fx-r-md: 14px;
--fx-r-lg: 20px; --fx-r-lg: 20px;
--fx-r-xl: 28px; --fx-r-xl: 28px;
--fx-r-full: 999px; --fx-r-full: 999px;
/* Spacing */
--fx-s-1: 4px; --fx-s-1: 4px;
--fx-s-2: 8px; --fx-s-2: 8px;
--fx-s-3: 12px; --fx-s-3: 12px;
@ -88,7 +87,7 @@
--fx-s-5: 24px; --fx-s-5: 24px;
--fx-s-6: 32px; --fx-s-6: 32px;
--fx-s-7: 48px; --fx-s-7: 48px;
/* Layers */
--fx-z-raised: 10; --fx-z-raised: 10;
--fx-z-sticky: 100; --fx-z-sticky: 100;
--fx-z-dock: 900; --fx-z-dock: 900;

View file

@ -1,21 +1,9 @@
/** fishies-ui design tokens: the one source of every colour, size, surface and layer the game, the
* site, the Reef Journal and the Keeper OS draw with (Atlas landing-site 3mk66d, m2olue).
*
* Data only. `bun tools/fishies-ui/build.ts` writes tokens.generated.css (`:root` custom
* properties) and the Handbook's Brand and UI sections from it; kit.test.ts fails when either is
* stale. A surface that still has its own names for these (`--hud-gold`, `--site-ink`, `--accent`)
* points them here; it never repeats a value.
*
* Motion is a slot, not a value: the names below are filled by the motion system
* (apps/web/app/motion/motion.css, Atlas interface 3ll72y), so a duration lives in one place. */
export type Token = { export type Token = {
/** The CSS custom property. */
readonly name: `--${string}` readonly name: `--${string}`
/** The value written into tokens.generated.css. A slot has none: another file fills it. */
readonly value?: string readonly value?: string
/** One line: what it is for. The Handbook prints this; nowhere else repeats it. A slot's line
* lives with its value, in the stylesheet that fills it. */
readonly use?: string readonly use?: string
} }
@ -23,9 +11,9 @@ export type TokenGroup = {
readonly id: 'brand' | 'water' | 'ink' | 'gold' | 'tone' | 'glass' | 'rim' | 'depth' | 'type' | 'radius' | 'space' | 'layer' | 'motion' readonly id: 'brand' | 'water' | 'ink' | 'gold' | 'tone' | 'glass' | 'rim' | 'depth' | 'type' | 'radius' | 'space' | 'layer' | 'motion'
readonly title: string readonly title: string
readonly use: string readonly use: string
/** How the showcase draws a sample of each token. */
readonly swatch: 'colour' | 'surface' | 'shadow' | 'text' | 'radius' | 'space' | 'layer' | 'motion' | 'font' readonly swatch: 'colour' | 'surface' | 'shadow' | 'text' | 'radius' | 'space' | 'layer' | 'motion' | 'font'
/** Filled by another stylesheet (named in `use`); tokens.generated.css leaves these out. */
readonly slot?: true readonly slot?: true
readonly tokens: readonly Token[] readonly tokens: readonly Token[]
} }
@ -193,13 +181,10 @@ export const TOKEN_GROUPS: readonly TokenGroup[] = [
}, },
] ]
/** Every token by name. */
export const TOKENS: ReadonlyMap<string, Token> = new Map(TOKEN_GROUPS.flatMap(group => group.tokens.map(token => [token.name, token] as const))) export const TOKENS: ReadonlyMap<string, Token> = new Map(TOKEN_GROUPS.flatMap(group => group.tokens.map(token => [token.name, token] as const)))
/** A token's `var()`, checked: a typo is a type error rather than a silently missing colour. */
export const fx = (name: Token['name']) => `var(${name})` export const fx = (name: Token['name']) => `var(${name})`
/** The stylesheet tokens.generated.css holds (motion slots are left to the motion system). */
export function tokensCss(): string { export function tokensCss(): string {
const lines: string[] = [] const lines: string[] = []
for (const group of TOKEN_GROUPS) { for (const group of TOKEN_GROUPS) {