commit faaba9b2f323f5625ad9090f5b406b4c0076d8a3 Author: CRTkafa Date: Thu Oct 1 05:41:30 2026 +0000 Fishies 0.8.1 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..070f74d --- /dev/null +++ b/LICENSE @@ -0,0 +1,26 @@ +The code in this package (everything under src/ and dist/) is under the MIT License: + +MIT License + +Copyright (c) 2026 Fishies + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +The icons (everything under icons/) and the Fishies name and marks are +© 2026 Fishies. All rights reserved. diff --git a/README.md b/README.md new file mode 100644 index 0000000..24e7ffc --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# @fishies/ui + +The kit the social aquarium game [Fishies](https://fishies.lol) is drawn with: reef-toy React +components, design tokens as CSS variables and as data, and the painted system icon set. See every +piece live, with the Fishies Handbook, at **https://fishies.lol/ui**. + +```sh +npm i @fishies/ui +``` + +## Use it + +```tsx +import '@fishies/ui/tokens.css' // the --fx-* custom properties +import '@fishies/ui/kit.css' // the components +import { Button, Panel, configureIcons } from '@fishies/ui' + +// The icons ship in this package under icons/. Serve that folder, or point at a CDN copy: +configureIcons({ url: icon => `https://cdn.jsdelivr.net/npm/@fishies/ui@0.8.1/icons/${icon.name}.png` }) + +export function Shop() { + return + + +} +``` + +React 18 or newer is a peer dependency. Each component is its own module, so a bundler keeps only +what you import. `Select` and the loader carry their own stylesheets (`@fishies/ui/select.css`, +`@fishies/ui/loader.css`). + +The motion tokens (`--m-quick`, `--m-ease-spring` and the rest) are slots: set them, or load a +stylesheet that does, and every component animates with them; leave them out and nothing moves. + +## What is in it + +| Folder | Holds | +| --- | --- | +| `dist/` | ES modules with type declarations, and the stylesheets | +| `src/` | the same components and tokens as TypeScript source | +| `icons/` | the painted icon set, one PNG per name, each twice its largest display size | +| `handbook/` | the Fishies Handbook as Markdown | + +Version 0.8.1 matches the Fishies release it was taken from. diff --git a/handbook/README.md b/handbook/README.md new file mode 100644 index 0000000..27e6b23 --- /dev/null +++ b/handbook/README.md @@ -0,0 +1,266 @@ +# The Fishies Handbook + +How Fishies looks, reads, sounds and what its world holds, generated from the game's own sources. The living version, with every component drawn, is at https://fishies.lol/ui. + +## 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 + +The five colours every store page, capsule, banner, the site and the Field Guide sit on. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-ground` | `#071a24` | The night-water ground behind the site, the Field Guide and every brand picture. | +| `--fx-ground-ink` | `#edf5ed` | Words on the ground: headings and links on the site. | +| `--fx-gold` | `#ffc46b` | The one warm accent: the thing to press, the coin, the playhead, a focus ring. | +| `--fx-sea` | `#83cfbd` | Sea-green for links and quiet highlights on the ground. | +| `--fx-muted` | `#adc3c7` | Body copy on the ground, a step quieter than the headings. | + +### Gold + +The toy gold of the HUD: a face, a rim and a darker foot that makes a button sit up. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-gold-light` | `#ffe2a6` | Gold words on glass: window titles, the clock, numbers that matter. | +| `--fx-gold-face` | `#ffe4a8` | The lit top of a gold button. | +| `--fx-gold-deep` | `#e59a3e` | The far end of a gold fill: a progress bar, the played part of a video. | +| `--fx-gold-foot` | `#c88a3d` | The solid edge under a gold button, its toy thickness. | +| `--fx-gold-warm` | `#ff9a6b` | Gold leaning to coral, where a fill runs warm (sunrise, a streak). | +| `--fx-amber` | `#f4c656` | The landing’s amber: the wordmark’s gleam and the reel’s titles. | + +### Type + +Baloo 2 for the game’s voice (numbers, labels, buttons, titles), Nunito for sentences; nothing under 12px. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-font-display` | `var(--font-display), "Baloo 2", ui-rounded, sans-serif` | Titles, numbers, buttons, labels. | +| `--fx-font-ui` | `var(--font-ui), Nunito, ui-rounded, sans-serif` | Sentences and anything read as text. | +| `--fx-t-xs` | `12px` | The floor: units, captions, a badge’s count. | +| `--fx-t-sm` | `13px` | Chips, list details, helper lines. | +| `--fx-t-md` | `15px` | Buttons, list titles, body copy in the game. | +| `--fx-t-lg` | `19px` | A panel’s title. | +| `--fx-t-xl` | `24px` | A stat’s value, a window’s hero number. | +| `--fx-t-2xl` | `31px` | A page heading. | +| `--fx-t-3xl` | `40px` | A moment’s headline (level up, a new fish). | +| `--fx-track-tight` | `-.015em` | Display type at size. | +| `--fx-track-label` | `.14em` | Upper-case eyebrows above a group. | + +## 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 Field Guide (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 Field Guide); anything that cannot be generated is merged into an existing source instead of copied. + +### Water + +The deep blues under the glass; each one is the water a few metres further down. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-abyss` | `#04101b` | The deepest water: behind full-screen moments and the video frame. | +| `--fx-deep` | `#08202f` | A sunken well inside a panel: inputs, tracks, empty slots. | +| `--fx-deep-2` | `#0d2c3f` | A raised well: a hovered row, a chosen tab’s ground. | +| `--fx-deep-3` | `#14435c` | The lightest deep: dividers that need to show on glass. | +| `--fx-navy` | `#173d63` | The body of a round toy button (window controls, the player’s buttons). | + +### Ink + +Words on glass, in three weights; the quietest still reads at 6.7:1 on a panel. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-ink` | `#eef6ff` | Everything a player reads on glass: titles, values, labels. | +| `--fx-ink-2` | `rgb(238 246 255 / 80%)` | Sentences under a title. | +| `--fx-ink-3` | `rgb(238 246 255 / 62%)` | Captions, units and hints; never anything a player must act on. | +| `--fx-ink-blue` | `#a9c9ea` | Labels that name a value beside it (Level, Coins, Fish). | +| `--fx-ink-on-gold` | `#12304a` | Words on a gold button or a gold chip. | + +### Tones + +Six hues that tell kinds apart (an app tile, a chip, a chart line) and two that mean good and bad. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-tone-sky` | `#6cc8ff` | Sky blue: water, visits, anything about other keepers. | +| `--fx-tone-coral` | `#ff8f87` | Coral: reports, a count that wants you, the close button. | +| `--fx-tone-kelp` | `#7fdc8f` | Kelp green: live, online, growing. | +| `--fx-tone-violet` | `#b8a2ff` | Violet: rare things and night. | +| `--fx-tone-lagoon` | `#5cd8c6` | Lagoon: the landing’s shallow water. | +| `--fx-tone-mute` | `#8fa7b5` | Grey-blue: off, empty, not yet. | +| `--fx-good` | `#6fe3b0` | Done, fed, clean, saved. | +| `--fx-alarm` | `#ff8478` | Hungry, dirty, failed: what needs a hand now. | +| `--fx-pearl` | `#fff4d6` | Pearl: the warm white of a badge rim and the landing’s cream. | +| `--fx-cream` | `#f3dfb2` | Cream: the shaded side of a pearl knob, warm sand. | +| `--fx-plum` | `#36203f` | Plum: the landing’s deep warm shadow under cream. | + +### Glass + +The one material everything floats on: tinted water glass with a sheen across its top. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-glass-top` | `rgb(22 58 120 / 70%)` | The upper tint of glass. | +| `--fx-glass-bottom` | `rgb(8 26 66 / 88%)` | The lower tint of glass, darker so words sit on it. | +| `--fx-glass-quiet-top` | `rgb(22 58 120 / 62%)` | Glass over the live tank, a little thinner so the fish show through. | +| `--fx-glass-quiet-bottom` | `rgb(8 26 66 / 82%)` | The lower tint of quiet glass. | +| `--fx-glass-sheen` | `rgb(255 255 255 / 16%)` | The light across the top half of a pane. | +| `--fx-glass` | `linear-gradient(180deg, var(--fx-glass-sheen), transparent 46%), linear-gradient(180deg, var(--fx-glass-top), var(--fx-glass-bottom))` | A pane: windows, panels, menus, the dock. | +| `--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))` | A pane over the tank: HUD capsules, the fish card. | +| `--fx-glass-well` | `rgb(4 16 30 / 55%)` | The darker water inside a window, under its title bar. | +| `--fx-glass-blur` | `blur(14px) saturate(1.2)` | What glass does to the reef behind it (backdrop-filter). | + +### Rims + +A hairline of light round every pane; gold marks the panes that are yours to use. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-rim` | `rgb(140 200 255 / 34%)` | The blue hairline round glass. | +| `--fx-rim-bright` | `rgb(140 200 255 / 55%)` | The hairline on hover. | +| `--fx-gold-rim` | `rgb(255 196 107 / 58%)` | The gold hairline round windows, the dock, tiles and the chosen tab. | +| `--fx-gold-rim-quiet` | `rgb(255 196 107 / 26%)` | Gold dividers: under a title bar, between dock groups. | +| `--fx-rim-light` | `inset 0 1px rgb(255 240 210 / 30%)` | The lit inner top edge of a gold-rimmed pane. | +| `--fx-ground-rim` | `#9ebfbe26` | Hairlines on the ground: card edges and rules between sections of the site. | + +### Depth + +Soft lifts for panes over water, and the solid foot that makes a toy control look pressable. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-lift-1` | `0 2px 10px rgb(2 10 18 / 34%)` | A chip or a small button just off the water. | +| `--fx-lift-2` | `0 10px 30px rgb(2 8 20 / 45%)` | A panel, the dock, a menu. | +| `--fx-lift-3` | `0 24px 60px rgb(2 8 20 / 60%)` | A window or a moment that takes the screen. | +| `--fx-foot` | `0 4px 0 rgb(4 18 34 / 55%)` | The toy foot under a glass button or tile; pressing sinks into it. | +| `--fx-foot-deep` | `0 6px 0 rgb(4 18 34 / 55%)` | The foot under a desktop tile, which stands taller. | +| `--fx-plump` | `inset 0 2px rgb(255 255 255 / 40%), inset 0 -6px 12px rgb(0 0 0 / 28%)` | The lit top and shaded belly that make a tile round. | +| `--fx-on-water` | `0 1px 2px #020c1a, 0 4px 16px rgb(2 12 26 / 80%)` | The shadow under words that sit straight on the water. | + +### Radii + +Round, never sharp: the smaller the thing, the rounder it reads. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-r-sm` | `10px` | Rows, inputs, keys. | +| `--fx-r-md` | `14px` | Cards, menus, tooltips. | +| `--fx-r-lg` | `20px` | Panels and windows. | +| `--fx-r-xl` | `28px` | Desktop tiles and the dock. | +| `--fx-r-full` | `999px` | Buttons, chips, tabs, badges, tracks. | + +### Spacing + +A 4px grid: every gap, padding and margin is one of these. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-s-1` | `4px` | Inside a chip, between a value and its unit. | +| `--fx-s-2` | `8px` | Between an icon and its label, between chips. | +| `--fx-s-3` | `12px` | Inside a button, between rows. | +| `--fx-s-4` | `16px` | A card’s inset. | +| `--fx-s-5` | `24px` | A panel’s inset, between groups. | +| `--fx-s-6` | `32px` | Between sections of a page. | +| `--fx-s-7` | `48px` | Around a page’s hero. | + +### Layers + +Named heights, so a toast never slides under a window and a tooltip never under a toast. + +| Token | Value | Use | +| --- | --- | --- | +| `--fx-z-raised` | `10` | A card lifted above its siblings (a dragged tile). | +| `--fx-z-sticky` | `100` | Headers and rails that stay as the page scrolls. | +| `--fx-z-dock` | `900` | The menu bar and the dock. | +| `--fx-z-modal` | `1000` | A window or sheet that holds the screen, with its backdrop. | +| `--fx-z-toast` | `1100` | Toasts, above any window. | +| `--fx-z-tooltip` | `1200` | Tooltips and open menus, above everything. | + +### Motion + +Named slots the motion system fills (apps/web/app/motion/motion.css, where each one is described): arrivals overshoot a little and settle, presses squash, exits get out of the way. + +| Token | Value | Use | +| --- | --- | --- | +| `--m-quick` | `120ms` | A press, a hover, a check. | +| `--m-base` | `180ms` | A fade, a chip changing. | +| `--m-move` | `260ms` | Something travelling: a panel arriving, a row sliding. | +| `--m-show` | `400ms` | A moment: a window unfolding, a reward landing. | +| `--m-ease-out` | `cubic-bezier(.2, .8, .2, 1)` | Answers the hand: decelerates hard. | +| `--m-ease-spring` | `cubic-bezier(.34, 1.5, .64, 1)` | The reef-toy arrival: overshoots a little and settles. | +| `--m-ease-calm` | `cubic-bezier(.45, 0, .25, 1)` | Calm, symmetric: crossfades, drift. | +| `--m-ease-in` | `cubic-bezier(.4, 0, 1, 1)` | Leaving: accelerates away. | +| `--m-stagger` | `40ms` | Stagger step for lists. | + +### Components + +- **SystemIcon** · A painted icon from the system set, by name, at one of the set's sizes. +- **Button** · A plump toy button: glass for everyday actions, gold for the one thing to press, ghost for a quiet third choice, danger for what cannot be undone. +- **ButtonLink** · The same button as a link, for an action that goes somewhere. +- **RoundButton** · A round toy button for window controls, the video player and close; `label` is what it says to a screen reader. +- **Chip** · A small reading or choice: a dot of colour for a kind, an icon, or gold when chosen. +- **Badge** · A coral count bubble that sits on a tile, a dock item or a bell; a dot when the number does not matter. +- **Tag** · A gold-rimmed capsule for a small upper-case word beside a name (Beta, New, Admin). +- **Card** · A glass card: an optional eyebrow, a title and a few lines. +- **Panel** · A gold-rimmed glass panel with a title row (icon, title, actions) and a body. +- **Window** · A Keeper OS window frame: a title bar with round minimise and close buttons over a darker well. +- **Tabs** · A row of pill tabs in a sunken track; the chosen one is gold. +- **List** · A list of rows; each row has an icon, a title, a detail line and a value at its end. +- **ListRow** · One row of a list; a button when it does something, a link when it goes somewhere. +- **Field** · A labelled text field in a sunken pill, with an optional hint under it. +- **Toggle** · An on and off switch with a pearl knob; gold when on. +- **Tooltip** · A designed tooltip, never plain text: an icon and title, a line, and labelled values; it opens on hover and on keyboard focus. +- **Toast** · A notice that slides in at the edge: an icon in a coloured bubble, a title, a line and a close. +- **Stat** · A number a keeper reads at a glance: an icon, the value in gold with its unit, and what it counts. +- **DockTile** · A desktop tile: a plump glass square in its own hue holding an icon, a title under it, a badge and an open mark. +- **Dock** · A dock: a gold-rimmed glass shelf of icons; the app in front wears a gold bar, open ones a dot. +- **DockItem** · One icon on a dock. +- **Spinner** · The Fishies spinner for anything on its way: a glass porthole with a gold arc going round and bubbles rising. +- **Progress** · A progress bar: a glass channel filling with gold, a bubble riding its leading edge; with no value the gold sweeps. +- **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 `` 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 Field Guide. +- 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 + +### Field Guide + +- [Open Water](https://fishies.lol/wiki/mechanics/open-water) · Swim out as one of your fish and meet other keepers. +- [Swimming in a friend's aquarium](https://fishies.lol/wiki/mechanics/swim-visits) · Join another keeper's aquarium as one of your own fish. + +### Places + +- [Kelp Garden](https://fishies.lol/open-water/kelp-garden) · A coral garden that runs into a kelp forest. Room to roam. +- [Shipwreck](https://fishies.lol/open-water/shipwreck) · An old ship asleep on the sand, lanterns still lit. Swim through its ribs. + +### Catalogues + +- [Species catalogue](https://fishies.lol/wiki/species) (102) · Every fish in the game with its growth time, unlock level, egg price and sale value. +- [Decorations catalogue](https://fishies.lol/wiki/decorations) (74) · Every plant and ornament, what it costs and how long it keeps algae away. +- [Equipment catalogue](https://fishies.lol/wiki/equipment) (9) · Every filter, auto-feeder and heater with its price, unlock level and what it does. diff --git a/icons/announce.png b/icons/announce.png new file mode 100644 index 0000000..111dea7 Binary files /dev/null and b/icons/announce.png differ diff --git a/icons/arrange.png b/icons/arrange.png new file mode 100644 index 0000000..1d25c37 Binary files /dev/null and b/icons/arrange.png differ diff --git a/icons/bell.png b/icons/bell.png new file mode 100644 index 0000000..9b4cfca Binary files /dev/null and b/icons/bell.png differ diff --git a/icons/book.png b/icons/book.png new file mode 100644 index 0000000..81680f0 Binary files /dev/null and b/icons/book.png differ diff --git a/icons/bug.png b/icons/bug.png new file mode 100644 index 0000000..74d7408 Binary files /dev/null and b/icons/bug.png differ diff --git a/icons/camera.png b/icons/camera.png new file mode 100644 index 0000000..5a7e55d Binary files /dev/null and b/icons/camera.png differ diff --git a/icons/cart-add.png b/icons/cart-add.png new file mode 100644 index 0000000..0c9fdf5 Binary files /dev/null and b/icons/cart-add.png differ diff --git a/icons/cart.png b/icons/cart.png new file mode 100644 index 0000000..514a268 Binary files /dev/null and b/icons/cart.png differ diff --git a/icons/chat.png b/icons/chat.png new file mode 100644 index 0000000..02f1ad9 Binary files /dev/null and b/icons/chat.png differ diff --git a/icons/clean.png b/icons/clean.png new file mode 100644 index 0000000..806b072 Binary files /dev/null and b/icons/clean.png differ diff --git a/icons/coin.png b/icons/coin.png new file mode 100644 index 0000000..87cbfcd Binary files /dev/null and b/icons/coin.png differ diff --git a/icons/coral.png b/icons/coral.png new file mode 100644 index 0000000..cbf89a2 Binary files /dev/null and b/icons/coral.png differ diff --git a/icons/decorate.png b/icons/decorate.png new file mode 100644 index 0000000..4007409 Binary files /dev/null and b/icons/decorate.png differ diff --git a/icons/edit.png b/icons/edit.png new file mode 100644 index 0000000..2acd921 Binary files /dev/null and b/icons/edit.png differ diff --git a/icons/egg.png b/icons/egg.png new file mode 100644 index 0000000..ed35edc Binary files /dev/null and b/icons/egg.png differ diff --git a/icons/emote-food.png b/icons/emote-food.png new file mode 100644 index 0000000..805482a Binary files /dev/null and b/icons/emote-food.png differ diff --git a/icons/emote-heart.png b/icons/emote-heart.png new file mode 100644 index 0000000..df499cd Binary files /dev/null and b/icons/emote-heart.png differ diff --git a/icons/emote-hello.png b/icons/emote-hello.png new file mode 100644 index 0000000..30071de Binary files /dev/null and b/icons/emote-hello.png differ diff --git a/icons/emote-music.png b/icons/emote-music.png new file mode 100644 index 0000000..d9280fc Binary files /dev/null and b/icons/emote-music.png differ diff --git a/icons/emote-question.png b/icons/emote-question.png new file mode 100644 index 0000000..96a6d12 Binary files /dev/null and b/icons/emote-question.png differ diff --git a/icons/emote-sleep.png b/icons/emote-sleep.png new file mode 100644 index 0000000..478ce14 Binary files /dev/null and b/icons/emote-sleep.png differ diff --git a/icons/emote-sparkle.png b/icons/emote-sparkle.png new file mode 100644 index 0000000..2bb2580 Binary files /dev/null and b/icons/emote-sparkle.png differ diff --git a/icons/emote-surprise.png b/icons/emote-surprise.png new file mode 100644 index 0000000..9145d93 Binary files /dev/null and b/icons/emote-surprise.png differ diff --git a/icons/explore.png b/icons/explore.png new file mode 100644 index 0000000..f94e629 Binary files /dev/null and b/icons/explore.png differ diff --git a/icons/feed.png b/icons/feed.png new file mode 100644 index 0000000..981c7be Binary files /dev/null and b/icons/feed.png differ diff --git a/icons/fish.png b/icons/fish.png new file mode 100644 index 0000000..84eba85 Binary files /dev/null and b/icons/fish.png differ diff --git a/icons/follow.png b/icons/follow.png new file mode 100644 index 0000000..447fc8c Binary files /dev/null and b/icons/follow.png differ diff --git a/icons/fullscreen.png b/icons/fullscreen.png new file mode 100644 index 0000000..198b794 Binary files /dev/null and b/icons/fullscreen.png differ diff --git a/icons/gear.png b/icons/gear.png new file mode 100644 index 0000000..a3299c0 Binary files /dev/null and b/icons/gear.png differ diff --git a/icons/growth.png b/icons/growth.png new file mode 100644 index 0000000..31637ab Binary files /dev/null and b/icons/growth.png differ diff --git a/icons/heart.png b/icons/heart.png new file mode 100644 index 0000000..8c2859f Binary files /dev/null and b/icons/heart.png differ diff --git a/icons/help.png b/icons/help.png new file mode 100644 index 0000000..6d8e36b Binary files /dev/null and b/icons/help.png differ diff --git a/icons/home.png b/icons/home.png new file mode 100644 index 0000000..77b100e Binary files /dev/null and b/icons/home.png differ diff --git a/icons/idea.png b/icons/idea.png new file mode 100644 index 0000000..22b76f6 Binary files /dev/null and b/icons/idea.png differ diff --git a/icons/inspect.png b/icons/inspect.png new file mode 100644 index 0000000..8000951 Binary files /dev/null and b/icons/inspect.png differ diff --git a/icons/inventory.png b/icons/inventory.png new file mode 100644 index 0000000..942938d Binary files /dev/null and b/icons/inventory.png differ diff --git a/icons/kelp.png b/icons/kelp.png new file mode 100644 index 0000000..ed77425 Binary files /dev/null and b/icons/kelp.png differ diff --git a/icons/lock.png b/icons/lock.png new file mode 100644 index 0000000..eb8a069 Binary files /dev/null and b/icons/lock.png differ diff --git a/icons/map.png b/icons/map.png new file mode 100644 index 0000000..5365090 Binary files /dev/null and b/icons/map.png differ diff --git a/icons/menu.png b/icons/menu.png new file mode 100644 index 0000000..c17a425 Binary files /dev/null and b/icons/menu.png differ diff --git a/icons/music.png b/icons/music.png new file mode 100644 index 0000000..6b7719c Binary files /dev/null and b/icons/music.png differ diff --git a/icons/mute.png b/icons/mute.png new file mode 100644 index 0000000..3f3c834 Binary files /dev/null and b/icons/mute.png differ diff --git a/icons/net.png b/icons/net.png new file mode 100644 index 0000000..84a21c3 Binary files /dev/null and b/icons/net.png differ diff --git a/icons/people.png b/icons/people.png new file mode 100644 index 0000000..b83fe77 Binary files /dev/null and b/icons/people.png differ diff --git a/icons/pin.png b/icons/pin.png new file mode 100644 index 0000000..eca161c Binary files /dev/null and b/icons/pin.png differ diff --git a/icons/remedy.png b/icons/remedy.png new file mode 100644 index 0000000..040822b Binary files /dev/null and b/icons/remedy.png differ diff --git a/icons/report.png b/icons/report.png new file mode 100644 index 0000000..38d1232 Binary files /dev/null and b/icons/report.png differ diff --git a/icons/share.png b/icons/share.png new file mode 100644 index 0000000..bbc5626 Binary files /dev/null and b/icons/share.png differ diff --git a/icons/shell.png b/icons/shell.png new file mode 100644 index 0000000..878bbdc Binary files /dev/null and b/icons/shell.png differ diff --git a/icons/shop.png b/icons/shop.png new file mode 100644 index 0000000..52d9dd0 Binary files /dev/null and b/icons/shop.png differ diff --git a/icons/solved.png b/icons/solved.png new file mode 100644 index 0000000..69e458b Binary files /dev/null and b/icons/solved.png differ diff --git a/icons/sound.png b/icons/sound.png new file mode 100644 index 0000000..3f24a23 Binary files /dev/null and b/icons/sound.png differ diff --git a/icons/staff.png b/icons/staff.png new file mode 100644 index 0000000..300b31a Binary files /dev/null and b/icons/staff.png differ diff --git a/icons/star.png b/icons/star.png new file mode 100644 index 0000000..049ff2f Binary files /dev/null and b/icons/star.png differ diff --git a/icons/updates.png b/icons/updates.png new file mode 100644 index 0000000..4fbec20 Binary files /dev/null and b/icons/updates.png differ diff --git a/icons/upvote.png b/icons/upvote.png new file mode 100644 index 0000000..ff45bc9 Binary files /dev/null and b/icons/upvote.png differ diff --git a/icons/views.png b/icons/views.png new file mode 100644 index 0000000..9875b4c Binary files /dev/null and b/icons/views.png differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..e95c10e --- /dev/null +++ b/package.json @@ -0,0 +1,66 @@ +{ + "name": "@fishies/ui", + "version": "0.8.1", + "description": "The Fishies UI kit: reef-toy components, design tokens and the painted system icon set from the social aquarium game Fishies.", + "keywords": [ + "fishies", + "ui-kit", + "design-tokens", + "react", + "components", + "icons", + "game-ui" + ], + "homepage": "https://fishies.lol/ui", + "repository": { + "type": "git", + "url": "https://git.crt.fyi/PlayFishies/fishies-ui.git" + }, + "bugs": { + "url": "https://fishies.lol/community" + }, + "license": "SEE LICENSE IN LICENSE", + "author": "Fishies ", + "type": "module", + "sideEffects": [ + "**/*.css" + ], + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + }, + "./tokens": { + "types": "./dist/tokens.d.ts", + "import": "./dist/tokens.js" + }, + "./icons": { + "types": "./dist/icons.d.ts", + "import": "./dist/icons.js" + }, + "./tokens.css": "./dist/tokens.generated.css", + "./kit.css": "./dist/kit.css", + "./loader.css": "./dist/loader.css", + "./select.css": "./dist/select.css", + "./icons/*": "./icons/*", + "./src/*": "./src/*", + "./package.json": "./package.json" + }, + "files": [ + "dist", + "src", + "icons", + "handbook", + "README.md", + "LICENSE" + ], + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/src/FishiesImg.tsx b/src/FishiesImg.tsx new file mode 100644 index 0000000..befb3c1 --- /dev/null +++ b/src/FishiesImg.tsx @@ -0,0 +1,71 @@ +'use client' + +import { useCallback, useEffect, useLayoutEffect, useRef, useState, type ImgHTMLAttributes, type Ref } from 'react' +import { reveal } from './fx-image' +import './loader.css' + +const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect + +/** The one way Fishies puts a picture on screen: a drop-in `` 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 `` 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 & { ref?: Ref }) { + const own = useRef(null) + const mounted = useRef(false) + const setRef = useCallback((node: HTMLImageElement | null) => { + own.current = node + if (typeof ref === 'function') ref(node) + else if (ref) ref.current = node + }, [ref]) + useIsomorphicLayoutEffect(() => { + const img = own.current + 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') + const first = !mounted.current + mounted.current = true + reveal(img, first && img.complete) + const settle = () => reveal(img) + img.addEventListener('load', settle) + img.addEventListener('error', settle) + return () => { img.removeEventListener('load', settle); img.removeEventListener('error', settle) } + }, [props.src, props.srcSet]) + return +} + +/** A `