@fishies/ui 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +60 -0
  3. package/dist/FishiesImg.d.ts +9 -0
  4. package/dist/FishiesImg.js +64 -0
  5. package/dist/Select.d.ts +22 -0
  6. package/dist/Select.js +95 -0
  7. package/dist/fx-image.d.ts +3 -0
  8. package/dist/fx-image.js +25 -0
  9. package/dist/icons.d.ts +28 -0
  10. package/dist/icons.generated.d.ts +5 -0
  11. package/dist/icons.generated.js +658 -0
  12. package/dist/icons.js +53 -0
  13. package/dist/index.d.ts +7 -0
  14. package/dist/index.js +7 -0
  15. package/dist/kit.css +267 -0
  16. package/dist/kit.d.ts +159 -0
  17. package/dist/kit.js +104 -0
  18. package/dist/loader.css +48 -0
  19. package/dist/loader.d.ts +17 -0
  20. package/dist/loader.js +27 -0
  21. package/dist/select-state.d.ts +34 -0
  22. package/dist/select-state.js +55 -0
  23. package/dist/select.css +87 -0
  24. package/dist/tokens.d.ts +17 -0
  25. package/dist/tokens.generated.css +97 -0
  26. package/dist/tokens.js +175 -0
  27. package/handbook/README.md +236 -0
  28. package/icons/add.png +0 -0
  29. package/icons/announce.png +0 -0
  30. package/icons/arrange.png +0 -0
  31. package/icons/bell.png +0 -0
  32. package/icons/block.png +0 -0
  33. package/icons/book.png +0 -0
  34. package/icons/bug.png +0 -0
  35. package/icons/camera.png +0 -0
  36. package/icons/cart-add.png +0 -0
  37. package/icons/cart.png +0 -0
  38. package/icons/chat.png +0 -0
  39. package/icons/check.png +0 -0
  40. package/icons/clean.png +0 -0
  41. package/icons/clock.png +0 -0
  42. package/icons/coin.png +0 -0
  43. package/icons/coral.png +0 -0
  44. package/icons/decorate.png +0 -0
  45. package/icons/download.png +0 -0
  46. package/icons/drop.png +0 -0
  47. package/icons/edit.png +0 -0
  48. package/icons/egg.png +0 -0
  49. package/icons/emote-food.png +0 -0
  50. package/icons/emote-heart.png +0 -0
  51. package/icons/emote-hello.png +0 -0
  52. package/icons/emote-music.png +0 -0
  53. package/icons/emote-question.png +0 -0
  54. package/icons/emote-sleep.png +0 -0
  55. package/icons/emote-sparkle.png +0 -0
  56. package/icons/emote-surprise.png +0 -0
  57. package/icons/exit.png +0 -0
  58. package/icons/explore.png +0 -0
  59. package/icons/external.png +0 -0
  60. package/icons/feed.png +0 -0
  61. package/icons/fish.png +0 -0
  62. package/icons/follow.png +0 -0
  63. package/icons/fullscreen.png +0 -0
  64. package/icons/gear.png +0 -0
  65. package/icons/gem.png +0 -0
  66. package/icons/gift.png +0 -0
  67. package/icons/globe.png +0 -0
  68. package/icons/growth.png +0 -0
  69. package/icons/heart.png +0 -0
  70. package/icons/help.png +0 -0
  71. package/icons/home.png +0 -0
  72. package/icons/idea.png +0 -0
  73. package/icons/inspect.png +0 -0
  74. package/icons/inventory.png +0 -0
  75. package/icons/keeper.png +0 -0
  76. package/icons/kelp.png +0 -0
  77. package/icons/keyboard.png +0 -0
  78. package/icons/level.png +0 -0
  79. package/icons/link.png +0 -0
  80. package/icons/lock.png +0 -0
  81. package/icons/mail.png +0 -0
  82. package/icons/map.png +0 -0
  83. package/icons/menu.png +0 -0
  84. package/icons/music.png +0 -0
  85. package/icons/mute.png +0 -0
  86. package/icons/net.png +0 -0
  87. package/icons/people.png +0 -0
  88. package/icons/pin.png +0 -0
  89. package/icons/quest.png +0 -0
  90. package/icons/quote.png +0 -0
  91. package/icons/remedy.png +0 -0
  92. package/icons/reply.png +0 -0
  93. package/icons/report.png +0 -0
  94. package/icons/search.png +0 -0
  95. package/icons/sell.png +0 -0
  96. package/icons/send.png +0 -0
  97. package/icons/share.png +0 -0
  98. package/icons/shell.png +0 -0
  99. package/icons/shop.png +0 -0
  100. package/icons/showcase.png +0 -0
  101. package/icons/smile.png +0 -0
  102. package/icons/solved.png +0 -0
  103. package/icons/sound.png +0 -0
  104. package/icons/staff.png +0 -0
  105. package/icons/star.png +0 -0
  106. package/icons/tank.png +0 -0
  107. package/icons/thermometer.png +0 -0
  108. package/icons/trash.png +0 -0
  109. package/icons/trophy.png +0 -0
  110. package/icons/updates.png +0 -0
  111. package/icons/upvote.png +0 -0
  112. package/icons/views.png +0 -0
  113. package/icons/warning.png +0 -0
  114. package/icons/wave.png +0 -0
  115. package/icons/whisper.png +0 -0
  116. package/package.json +66 -0
  117. package/src/FishiesImg.tsx +58 -0
  118. package/src/Select.tsx +119 -0
  119. package/src/css.d.ts +2 -0
  120. package/src/fx-image.ts +17 -0
  121. package/src/icons.generated.ts +658 -0
  122. package/src/icons.ts +74 -0
  123. package/src/index.ts +8 -0
  124. package/src/kit.css +267 -0
  125. package/src/kit.tsx +190 -0
  126. package/src/loader.css +48 -0
  127. package/src/loader.tsx +35 -0
  128. package/src/select-state.ts +59 -0
  129. package/src/select.css +87 -0
  130. package/src/tokens.generated.css +97 -0
  131. package/src/tokens.ts +196 -0
@@ -0,0 +1,236 @@
1
+ # The Fishies Handbook
2
+
3
+ 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.
4
+
5
+ ## Brand
6
+
7
+ ### Brand
8
+
9
+ The five colours every store page, capsule, banner, the site and the Reef Journal sit on.
10
+
11
+ | Token | Value | Use |
12
+ | --- | --- | --- |
13
+ | `--fx-ground` | `#071a24` | The night-water ground behind the site, the Reef Journal and every brand picture. |
14
+ | `--fx-ground-ink` | `#edf5ed` | Words on the ground: headings and links on the site. |
15
+ | `--fx-gold` | `#ffc46b` | The one warm accent: the thing to press, the coin, the playhead, a focus ring. |
16
+ | `--fx-sea` | `#83cfbd` | Sea-green for links and quiet highlights on the ground. |
17
+ | `--fx-muted` | `#adc3c7` | Body copy on the ground, a step quieter than the headings. |
18
+
19
+ ### Gold
20
+
21
+ The toy gold of the HUD: a face, a rim and a darker foot that makes a button sit up.
22
+
23
+ | Token | Value | Use |
24
+ | --- | --- | --- |
25
+ | `--fx-gold-light` | `#ffe2a6` | Gold words on glass: window titles, the clock, numbers that matter. |
26
+ | `--fx-gold-face` | `#ffe4a8` | The lit top of a gold button. |
27
+ | `--fx-gold-deep` | `#e59a3e` | The far end of a gold fill: a progress bar, the played part of a video. |
28
+ | `--fx-gold-foot` | `#c88a3d` | The solid edge under a gold button, its toy thickness. |
29
+ | `--fx-gold-warm` | `#ff9a6b` | Gold leaning to coral, where a fill runs warm (sunrise, a streak). |
30
+ | `--fx-amber` | `#f4c656` | The landing’s amber: the wordmark’s gleam and the reel’s titles. |
31
+
32
+ ### Type
33
+
34
+ Baloo 2 for the game’s voice (numbers, labels, buttons, titles), Nunito for sentences; nothing under 12px.
35
+
36
+ | Token | Value | Use |
37
+ | --- | --- | --- |
38
+ | `--fx-font-display` | `var(--font-display), "Baloo 2", ui-rounded, sans-serif` | Titles, numbers, buttons, labels. |
39
+ | `--fx-font-ui` | `var(--font-ui), Nunito, ui-rounded, sans-serif` | Sentences and anything read as text. |
40
+ | `--fx-t-xs` | `12px` | The floor: units, captions, a badge’s count. |
41
+ | `--fx-t-sm` | `13px` | Chips, list details, helper lines. |
42
+ | `--fx-t-md` | `15px` | Buttons, list titles, body copy in the game. |
43
+ | `--fx-t-lg` | `19px` | A panel’s title. |
44
+ | `--fx-t-xl` | `24px` | A stat’s value, a window’s hero number. |
45
+ | `--fx-t-2xl` | `31px` | A page heading. |
46
+ | `--fx-t-3xl` | `40px` | A moment’s headline (level up, a new fish). |
47
+ | `--fx-track-tight` | `-.015em` | Display type at size. |
48
+ | `--fx-track-label` | `.14em` | Upper-case eyebrows above a group. |
49
+
50
+ ## UI
51
+
52
+ ### Water
53
+
54
+ The deep blues under the glass; each one is the water a few metres further down.
55
+
56
+ | Token | Value | Use |
57
+ | --- | --- | --- |
58
+ | `--fx-abyss` | `#04101b` | The deepest water: behind full-screen moments and the video frame. |
59
+ | `--fx-deep` | `#08202f` | A sunken well inside a panel: inputs, tracks, empty slots. |
60
+ | `--fx-deep-2` | `#0d2c3f` | A raised well: a hovered row, a chosen tab’s ground. |
61
+ | `--fx-deep-3` | `#14435c` | The lightest deep: dividers that need to show on glass. |
62
+ | `--fx-navy` | `#173d63` | The body of a round toy button (window controls, the player’s buttons). |
63
+
64
+ ### Ink
65
+
66
+ Words on glass, in three weights; the quietest still reads at 6.7:1 on a panel.
67
+
68
+ | Token | Value | Use |
69
+ | --- | --- | --- |
70
+ | `--fx-ink` | `#eef6ff` | Everything a player reads on glass: titles, values, labels. |
71
+ | `--fx-ink-2` | `rgb(238 246 255 / 80%)` | Sentences under a title. |
72
+ | `--fx-ink-3` | `rgb(238 246 255 / 62%)` | Captions, units and hints; never anything a player must act on. |
73
+ | `--fx-ink-blue` | `#a9c9ea` | Labels that name a value beside it (Level, Coins, Fish). |
74
+ | `--fx-ink-on-gold` | `#12304a` | Words on a gold button or a gold chip. |
75
+
76
+ ### Tones
77
+
78
+ Six hues that tell kinds apart (an app tile, a chip, a chart line) and two that mean good and bad.
79
+
80
+ | Token | Value | Use |
81
+ | --- | --- | --- |
82
+ | `--fx-tone-sky` | `#6cc8ff` | Sky blue: water, visits, anything about other keepers. |
83
+ | `--fx-tone-coral` | `#ff8f87` | Coral: reports, a count that wants you, the close button. |
84
+ | `--fx-tone-kelp` | `#7fdc8f` | Kelp green: live, online, growing. |
85
+ | `--fx-tone-violet` | `#b8a2ff` | Violet: rare things and night. |
86
+ | `--fx-tone-lagoon` | `#5cd8c6` | Lagoon: the landing’s shallow water. |
87
+ | `--fx-tone-mute` | `#8fa7b5` | Grey-blue: off, empty, not yet. |
88
+ | `--fx-good` | `#6fe3b0` | Done, fed, clean, saved. |
89
+ | `--fx-alarm` | `#ff8478` | Hungry, dirty, failed: what needs a hand now. |
90
+ | `--fx-pearl` | `#fff4d6` | Pearl: the warm white of a badge rim and the landing’s cream. |
91
+ | `--fx-cream` | `#f3dfb2` | Cream: the shaded side of a pearl knob, warm sand. |
92
+ | `--fx-plum` | `#36203f` | Plum: the landing’s deep warm shadow under cream. |
93
+
94
+ ### Glass
95
+
96
+ The one material everything floats on: tinted water glass with a sheen across its top.
97
+
98
+ | Token | Value | Use |
99
+ | --- | --- | --- |
100
+ | `--fx-glass-top` | `rgb(22 58 120 / 70%)` | The upper tint of glass. |
101
+ | `--fx-glass-bottom` | `rgb(8 26 66 / 88%)` | The lower tint of glass, darker so words sit on it. |
102
+ | `--fx-glass-quiet-top` | `rgb(22 58 120 / 62%)` | Glass over the live tank, a little thinner so the fish show through. |
103
+ | `--fx-glass-quiet-bottom` | `rgb(8 26 66 / 82%)` | The lower tint of quiet glass. |
104
+ | `--fx-glass-sheen` | `rgb(255 255 255 / 16%)` | The light across the top half of a pane. |
105
+ | `--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. |
106
+ | `--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. |
107
+ | `--fx-glass-well` | `rgb(4 16 30 / 55%)` | The darker water inside a window, under its title bar. |
108
+ | `--fx-glass-blur` | `blur(14px) saturate(1.2)` | What glass does to the reef behind it (backdrop-filter). |
109
+
110
+ ### Rims
111
+
112
+ A hairline of light round every pane; gold marks the panes that are yours to use.
113
+
114
+ | Token | Value | Use |
115
+ | --- | --- | --- |
116
+ | `--fx-rim` | `rgb(140 200 255 / 34%)` | The blue hairline round glass. |
117
+ | `--fx-rim-bright` | `rgb(140 200 255 / 55%)` | The hairline on hover. |
118
+ | `--fx-gold-rim` | `rgb(255 196 107 / 58%)` | The gold hairline round windows, the dock, tiles and the chosen tab. |
119
+ | `--fx-gold-rim-quiet` | `rgb(255 196 107 / 26%)` | Gold dividers: under a title bar, between dock groups. |
120
+ | `--fx-rim-light` | `inset 0 1px rgb(255 240 210 / 30%)` | The lit inner top edge of a gold-rimmed pane. |
121
+ | `--fx-ground-rim` | `#9ebfbe26` | Hairlines on the ground: card edges and rules between sections of the site. |
122
+
123
+ ### Depth
124
+
125
+ Soft lifts for panes over water, and the solid foot that makes a toy control look pressable.
126
+
127
+ | Token | Value | Use |
128
+ | --- | --- | --- |
129
+ | `--fx-lift-1` | `0 2px 10px rgb(2 10 18 / 34%)` | A chip or a small button just off the water. |
130
+ | `--fx-lift-2` | `0 10px 30px rgb(2 8 20 / 45%)` | A panel, the dock, a menu. |
131
+ | `--fx-lift-3` | `0 24px 60px rgb(2 8 20 / 60%)` | A window or a moment that takes the screen. |
132
+ | `--fx-foot` | `0 4px 0 rgb(4 18 34 / 55%)` | The toy foot under a glass button or tile; pressing sinks into it. |
133
+ | `--fx-foot-deep` | `0 6px 0 rgb(4 18 34 / 55%)` | The foot under a desktop tile, which stands taller. |
134
+ | `--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. |
135
+ | `--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. |
136
+
137
+ ### Radii
138
+
139
+ Round, never sharp: the smaller the thing, the rounder it reads.
140
+
141
+ | Token | Value | Use |
142
+ | --- | --- | --- |
143
+ | `--fx-r-sm` | `10px` | Rows, inputs, keys. |
144
+ | `--fx-r-md` | `14px` | Cards, menus, tooltips. |
145
+ | `--fx-r-lg` | `20px` | Panels and windows. |
146
+ | `--fx-r-xl` | `28px` | Desktop tiles and the dock. |
147
+ | `--fx-r-full` | `999px` | Buttons, chips, tabs, badges, tracks. |
148
+
149
+ ### Spacing
150
+
151
+ A 4px grid: every gap, padding and margin is one of these.
152
+
153
+ | Token | Value | Use |
154
+ | --- | --- | --- |
155
+ | `--fx-s-1` | `4px` | Inside a chip, between a value and its unit. |
156
+ | `--fx-s-2` | `8px` | Between an icon and its label, between chips. |
157
+ | `--fx-s-3` | `12px` | Inside a button, between rows. |
158
+ | `--fx-s-4` | `16px` | A card’s inset. |
159
+ | `--fx-s-5` | `24px` | A panel’s inset, between groups. |
160
+ | `--fx-s-6` | `32px` | Between sections of a page. |
161
+ | `--fx-s-7` | `48px` | Around a page’s hero. |
162
+
163
+ ### Layers
164
+
165
+ Named heights, so a toast never slides under a window and a tooltip never under a toast.
166
+
167
+ | Token | Value | Use |
168
+ | --- | --- | --- |
169
+ | `--fx-z-raised` | `10` | A card lifted above its siblings (a dragged tile). |
170
+ | `--fx-z-sticky` | `100` | Headers and rails that stay as the page scrolls. |
171
+ | `--fx-z-dock` | `900` | The menu bar and the dock. |
172
+ | `--fx-z-modal` | `1000` | A window or sheet that holds the screen, with its backdrop. |
173
+ | `--fx-z-toast` | `1100` | Toasts, above any window. |
174
+ | `--fx-z-tooltip` | `1200` | Tooltips and open menus, above everything. |
175
+
176
+ ### Motion
177
+
178
+ 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.
179
+
180
+ | Token | Value | Use |
181
+ | --- | --- | --- |
182
+ | `--m-quick` | `120ms` | A press, a hover, a check. |
183
+ | `--m-base` | `180ms` | A fade, a chip changing. |
184
+ | `--m-move` | `260ms` | Something travelling: a panel arriving, a row sliding. |
185
+ | `--m-show` | `400ms` | A moment: a window unfolding, a reward landing. |
186
+ | `--m-ease-out` | `cubic-bezier(.2, .8, .2, 1)` | Answers the hand: decelerates hard. |
187
+ | `--m-ease-spring` | `cubic-bezier(.34, 1.5, .64, 1)` | The reef-toy arrival: overshoots a little and settles. |
188
+ | `--m-ease-calm` | `cubic-bezier(.45, 0, .25, 1)` | Calm, symmetric: crossfades, drift. |
189
+ | `--m-ease-in` | `cubic-bezier(.4, 0, 1, 1)` | Leaving: accelerates away. |
190
+ | `--m-stagger` | `40ms` | Stagger step for lists. |
191
+
192
+ ### Components
193
+
194
+ - **SystemIcon** · A painted icon from the system set, by name, at one of the set's sizes.
195
+ - **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.
196
+ - **ButtonLink** · The same button as a link, for an action that goes somewhere.
197
+ - **RoundButton** · A round toy button for window controls, the video player and close; `label` is what it says to a screen reader.
198
+ - **Chip** · A small reading or choice: a dot of colour for a kind, an icon, or gold when chosen.
199
+ - **Badge** · A coral count bubble that sits on a tile, a dock item or a bell; a dot when the number does not matter.
200
+ - **Tag** · A gold-rimmed capsule for a small upper-case word beside a name (Beta, New, Admin).
201
+ - **Card** · A glass card: an optional eyebrow, a title and a few lines.
202
+ - **Panel** · A gold-rimmed glass panel with a title row (icon, title, actions) and a body.
203
+ - **Window** · A Keeper OS window frame: a title bar with round minimise and close buttons over a darker well.
204
+ - **Tabs** · A row of pill tabs in a sunken track; the chosen one is gold.
205
+ - **List** · A list of rows; each row has an icon, a title, a detail line and a value at its end.
206
+ - **ListRow** · One row of a list; a button when it does something, a link when it goes somewhere.
207
+ - **Field** · A labelled text field in a sunken pill, with an optional hint under it.
208
+ - **Toggle** · An on and off switch with a pearl knob; gold when on.
209
+ - **Tooltip** · A designed tooltip, never plain text: an icon and title, a line, and labelled values; it opens on hover and on keyboard focus.
210
+ - **Toast** · A notice that slides in at the edge: an icon in a coloured bubble, a title, a line and a close.
211
+ - **Stat** · A number a keeper reads at a glance: an icon, the value in gold with its unit, and what it counts.
212
+ - **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.
213
+ - **Dock** · A dock: a gold-rimmed glass shelf of icons; the app in front wears a gold bar, open ones a dot.
214
+ - **DockItem** · One icon on a dock.
215
+ - **Spinner** · The Fishies spinner for anything on its way: a glass porthole with a gold arc going round and bubbles rising.
216
+ - **Progress** · A progress bar: a glass channel filling with gold, a bubble riding its leading edge; with no value the gold sweeps.
217
+ - **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.
218
+ - **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.
219
+
220
+ ## World
221
+
222
+ ### Reef Journal
223
+
224
+ - [Open Water](https://fishies.lol/wiki/mechanics/open-water) · Swim out as one of your fish and meet other keepers.
225
+ - [Swimming in a friend's aquarium](https://fishies.lol/wiki/mechanics/swim-visits) · Join another keeper's aquarium as one of your own fish.
226
+
227
+ ### Places
228
+
229
+ - [Kelp Garden](https://fishies.lol/open-water/kelp-garden) · A coral garden that runs into a kelp forest. Room to roam.
230
+ - [Shipwreck](https://fishies.lol/open-water/shipwreck) · An old ship asleep on the sand, lanterns still lit. Swim through its ribs.
231
+
232
+ ### Catalogues
233
+
234
+ - [Species catalogue](https://fishies.lol/wiki/species) (102) · Every fish in the game with its growth time, unlock level, egg price and sale value.
235
+ - [Decorations catalogue](https://fishies.lol/wiki/decorations) (74) · Every plant and ornament, what it costs and how long it keeps algae away.
236
+ - [Equipment catalogue](https://fishies.lol/wiki/equipment) (9) · Every filter, auto-feeder and heater with its price, unlock level and what it does.
package/icons/add.png ADDED
Binary file
Binary file
Binary file
package/icons/bell.png ADDED
Binary file
Binary file
package/icons/book.png ADDED
Binary file
package/icons/bug.png ADDED
Binary file
Binary file
Binary file
package/icons/cart.png ADDED
Binary file
package/icons/chat.png ADDED
Binary file
Binary file
Binary file
Binary file
package/icons/coin.png ADDED
Binary file
Binary file
Binary file
Binary file
package/icons/drop.png ADDED
Binary file
package/icons/edit.png ADDED
Binary file
package/icons/egg.png ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/icons/exit.png ADDED
Binary file
Binary file
Binary file
package/icons/feed.png ADDED
Binary file
package/icons/fish.png ADDED
Binary file
Binary file
Binary file
package/icons/gear.png ADDED
Binary file
package/icons/gem.png ADDED
Binary file
package/icons/gift.png ADDED
Binary file
Binary file
Binary file
Binary file
package/icons/help.png ADDED
Binary file
package/icons/home.png ADDED
Binary file
package/icons/idea.png ADDED
Binary file
Binary file
Binary file
Binary file
package/icons/kelp.png ADDED
Binary file
Binary file
Binary file
package/icons/link.png ADDED
Binary file
package/icons/lock.png ADDED
Binary file
package/icons/mail.png ADDED
Binary file
package/icons/map.png ADDED
Binary file
package/icons/menu.png ADDED
Binary file
Binary file
package/icons/mute.png ADDED
Binary file
package/icons/net.png ADDED
Binary file
Binary file
package/icons/pin.png ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/icons/sell.png ADDED
Binary file
package/icons/send.png ADDED
Binary file
Binary file
Binary file
package/icons/shop.png ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/icons/star.png ADDED
Binary file
package/icons/tank.png ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/icons/wave.png ADDED
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@fishies/ui",
3
+ "version": "0.8.3",
4
+ "description": "The Fishies UI kit: reef-toy components, design tokens and the painted system icon set from the social aquarium game Fishies.",
5
+ "keywords": [
6
+ "fishies",
7
+ "ui-kit",
8
+ "design-tokens",
9
+ "react",
10
+ "components",
11
+ "icons",
12
+ "game-ui"
13
+ ],
14
+ "homepage": "https://fishies.lol/ui",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://git.crt.fyi/PlayFishies/fishies-ui.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://fishies.lol/community"
21
+ },
22
+ "license": "SEE LICENSE IN LICENSE",
23
+ "author": "Fishies <hi@crt.fyi>",
24
+ "type": "module",
25
+ "sideEffects": [
26
+ "**/*.css"
27
+ ],
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ },
35
+ "./tokens": {
36
+ "types": "./dist/tokens.d.ts",
37
+ "import": "./dist/tokens.js"
38
+ },
39
+ "./icons": {
40
+ "types": "./dist/icons.d.ts",
41
+ "import": "./dist/icons.js"
42
+ },
43
+ "./tokens.css": "./dist/tokens.generated.css",
44
+ "./kit.css": "./dist/kit.css",
45
+ "./loader.css": "./dist/loader.css",
46
+ "./select.css": "./dist/select.css",
47
+ "./icons/*": "./icons/*",
48
+ "./src/*": "./src/*",
49
+ "./package.json": "./package.json"
50
+ },
51
+ "files": [
52
+ "dist",
53
+ "src",
54
+ "icons",
55
+ "handbook",
56
+ "README.md",
57
+ "LICENSE"
58
+ ],
59
+ "peerDependencies": {
60
+ "react": ">=18",
61
+ "react-dom": ">=18"
62
+ },
63
+ "publishConfig": {
64
+ "access": "public"
65
+ }
66
+ }
@@ -0,0 +1,58 @@
1
+ 'use client'
2
+
3
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState, type ImgHTMLAttributes, type Ref } from 'react'
4
+ import { reveal } from './fx-image'
5
+ import './loader.css'
6
+
7
+ const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect
8
+
9
+ export default function FishiesImg({ ref, decoding, ...props }: ImgHTMLAttributes<HTMLImageElement> & { ref?: Ref<HTMLImageElement> }) {
10
+ const own = useRef<HTMLImageElement | null>(null)
11
+ const mounted = useRef(false)
12
+ const setRef = useCallback((node: HTMLImageElement | null) => {
13
+ own.current = node
14
+ if (typeof ref === 'function') ref(node)
15
+ else if (ref) ref.current = node
16
+ }, [ref])
17
+ useIsomorphicLayoutEffect(() => {
18
+ const img = own.current
19
+ if (!img) return
20
+
21
+ if (mounted.current) img.setAttribute('data-fx', 'wait')
22
+ const first = !mounted.current
23
+ mounted.current = true
24
+ reveal(img, first && img.complete)
25
+ const settle = () => reveal(img)
26
+ img.addEventListener('load', settle)
27
+ img.addEventListener('error', settle)
28
+ return () => { img.removeEventListener('load', settle); img.removeEventListener('error', settle) }
29
+ }, [props.src, props.srcSet])
30
+ return <img {...props} ref={setRef} decoding={decoding ?? 'async'} data-fx="wait" suppressHydrationWarning/>
31
+ }
32
+
33
+ export function useFxPoster(video: { current: HTMLVideoElement | null }, poster: string | null | undefined) {
34
+ const decoded = useDecodedUrl(poster)
35
+ useIsomorphicLayoutEffect(() => {
36
+ const element = video.current
37
+ if (!element || !poster) return
38
+ const show = () => { if (element.getAttribute('data-fx') === 'wait') element.setAttribute('data-fx', 'fade') }
39
+ if (decoded || element.readyState >= 2) { show(); return }
40
+ element.addEventListener('loadeddata', show)
41
+ return () => element.removeEventListener('loadeddata', show)
42
+ }, [video, poster, decoded])
43
+ }
44
+
45
+ export function useDecodedUrl(url: string | null | undefined): string | null {
46
+ const [ready, setReady] = useState<string | null>(null)
47
+ useEffect(() => {
48
+ if (!url) return
49
+ let live = true
50
+ const probe = new Image()
51
+ probe.decoding = 'async'
52
+ probe.src = url
53
+ const done = () => { if (live) setReady(url) }
54
+ ;(typeof probe.decode === 'function' ? probe.decode() : new Promise(resolve => { probe.onload = resolve })).then(done, done)
55
+ return () => { live = false }
56
+ }, [url])
57
+ return url && ready === url ? url : null
58
+ }