@markmiro/hairy 0.0.0-stage → 0.1.0

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.
@@ -0,0 +1,1298 @@
1
+ /** Curves for the poof's rise and fall, from 0 to 1. Some overshoot, then come back. */
2
+ declare const eases: {
3
+ linear: (t: number) => number;
4
+ /** Speeds up steadily, like something dropping. */
5
+ gravity: (t: number) => number;
6
+ "ease-in": (t: number) => number;
7
+ "ease-out": (t: number) => number;
8
+ "ease-in-out": (t: number) => number;
9
+ "back-out": (t: number) => number;
10
+ "elastic-out": (t: number) => number;
11
+ };
12
+ type Ease = keyof typeof eases;
13
+ /** The choices for each setting that picks from a list, in the order the playground shows them. */
14
+ declare const settingChoices: {
15
+ /** Straight hairs follow one smooth curve; wavy ones ripple side to side; curly ones coil into loops; frizzy ones kink at random and fly away. */
16
+ readonly hairType: readonly ["straight", "wavy", "curly", "frizzy"];
17
+ /** Round tips end in a half circle; sharp ones narrow to a fine point; square ones are cut straight across. */
18
+ readonly tipShape: readonly ["round", "sharp", "square"];
19
+ /** Natural fur, or glitter, with sparkling flakes. */
20
+ readonly material: readonly ["natural", "glitter"];
21
+ /** A coat pattern, as on an animal: none, zebra stripes, tiger stripes, dalmatian spots, leopard rosettes or giraffe patches. */
22
+ readonly pattern: readonly ["none", "zebra", "tiger", "dalmatian", "leopard", "giraffe"];
23
+ /** The pattern's colors: the animal's own, or tints of the fur's color. */
24
+ readonly patternColors: readonly ["natural", "tinted"];
25
+ /** When the label gets a halo: "auto" only when a pattern needs one, or "always" or "never". */
26
+ readonly halo: readonly ["auto", "always", "never"];
27
+ };
28
+ type HairType = (typeof settingChoices.hairType)[number];
29
+ type TipShape = (typeof settingChoices.tipShape)[number];
30
+ type Material = (typeof settingChoices.material)[number];
31
+ type Pattern = (typeof settingChoices.pattern)[number];
32
+ type PatternColors = (typeof settingChoices.patternColors)[number];
33
+ type Halo = (typeof settingChoices.halo)[number];
34
+ type ChoiceSetting = keyof typeof settingChoices;
35
+ /**
36
+ * Every setting the fur has, at its defaults (the Plush preset). Each fur
37
+ * keeps its own copy. The ones marked "regrows" change the hairs themselves,
38
+ * so changing them grows the hairs again.
39
+ */
40
+ declare const defaultSettings: {
41
+ /** Palette: where its middle sits (L*, 0–1, from the color), how far it reaches below and above that. */
42
+ shift: number;
43
+ darker: number;
44
+ lighter: number;
45
+ /** Hairs per area (regrows). */
46
+ density: number;
47
+ /** Hair length. Changing it grows or shrinks the hairs with the hover spring. */
48
+ length: number;
49
+ thickness: number;
50
+ /** How much hairs curl (regrows). */
51
+ curl: number;
52
+ /** How much hairs droop under their weight. */
53
+ droop: number;
54
+ /** How much hair lengths vary, 0 all the same (regrows). */
55
+ lengthVariation: number;
56
+ /** How much hair directions vary from the combed flow (regrows). */
57
+ messiness: number;
58
+ /** How far hairs along the outline lean out, making the fuzzy edge (regrows). */
59
+ fuzz: number;
60
+ /**
61
+ * How far from the button's edge the fur starts, in px at scale 1 (regrows):
62
+ * above 0 the outline hairs and the fur's body sit out past the edge, below
63
+ * 0 they move in, eating into the button.
64
+ */
65
+ distance: number;
66
+ /** Tip width relative to the root. */
67
+ taper: number;
68
+ /**
69
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
70
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
71
+ * hair gets wider to hold the fade, so it costs a little more to draw.
72
+ */
73
+ softness: number;
74
+ /** The hairs' pattern: straight, wavy, curly or frizzy. */
75
+ hairType: HairType;
76
+ /** How strong the waves, curls or frizz are: 0 is straight, 1 the usual amount. */
77
+ typeAmount: number;
78
+ /** How many waves, turns or kinks fit along each hair: higher is tighter. */
79
+ tightness: number;
80
+ /** How each hair ends: round, sharp or square. */
81
+ tipShape: TipShape;
82
+ /** What the hair looks made of: natural or glitter. */
83
+ material: Material;
84
+ /** How bright glitter's flashes are. */
85
+ materialAmount: number;
86
+ /** Glitter: how many flakes there are, 1 the usual amount. */
87
+ glitterDensity: number;
88
+ /** Glitter: how big the flakes are, 1 the usual size. */
89
+ glitterSize: number;
90
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
91
+ glitterSizeVariation: number;
92
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
93
+ pattern: Pattern;
94
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
95
+ patternColors: PatternColors;
96
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
97
+ patternScale: number;
98
+ /**
99
+ * A soft glow behind the label, in the fur's base color, so it reads where
100
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
101
+ * adds it only when a pattern needs one, or "always" or "never".
102
+ */
103
+ halo: Halo;
104
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
105
+ haloShade: number;
106
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
107
+ haloSize: number;
108
+ /** How strong the halo is, 1 the usual; 0 has none. */
109
+ haloStrength: number;
110
+ /** How many hairs catch the light (regrows). */
111
+ sheen: number;
112
+ /** Where the band of shine sits, 0 at the top to 1 at the bottom, and how far it spreads (regrows). */
113
+ sheenPosition: number;
114
+ sheenSpread: number;
115
+ /** How dark the hairs along the top edge are, turned away from the light; also keeps the shine off it (regrows). */
116
+ edgeShadow: number;
117
+ /** On wide-gamut screens, how far colors move out toward the more vivid colors sRGB can't show (0 to 1). */
118
+ vividness: number;
119
+ /** How far the hairs stand at rest, with no hover: 0 is combed flat, 1 standing up. */
120
+ static: number;
121
+ /** How much further the hairs stand when hovered, on top of `static` (up to 1). */
122
+ hover: number;
123
+ /**
124
+ * The hover spring: how fast it moves (rad/s) and its damping ratio (lower
125
+ * bounces more, 1 doesn't overshoot). Hovering out and clicking move on
126
+ * springs like it.
127
+ */
128
+ hoverSpeed: number;
129
+ hoverDamping: number;
130
+ /** The hover-out spring (without a click playing), back down to rest: speed (rad/s) and damping ratio. */
131
+ leaveSpeed: number;
132
+ leaveDamping: number;
133
+ /** How much the hairs sway while hovered. */
134
+ sway: number;
135
+ /**
136
+ * How much longer the hairs grow as they rise to the hover lift: 0.5 makes
137
+ * them half as long again (regrows, to make room).
138
+ */
139
+ hoverStretch: number;
140
+ /** How much lighter the fur gets as it rises to the hover lift, in L* (0–1); below 0 darkens. */
141
+ hoverLight: number;
142
+ /**
143
+ * A click poofs the fur up by `poofHeight` on the rise spring, hangs there
144
+ * for `poofHold` seconds, then comes back down to where it rests (hovered,
145
+ * or flat if the pointer has left) on the fall spring, which also springs
146
+ * the click's stretch back. Speeds in rad/s, then damping ratios (lower
147
+ * bounces more, 1 doesn't overshoot).
148
+ */
149
+ clickRiseSpeed: number;
150
+ clickRiseDamping: number;
151
+ clickFallSpeed: number;
152
+ clickFallDamping: number;
153
+ poofHeight: number;
154
+ /** How much longer still the hairs grow at the top of a click, on top of `hoverStretch` (regrows). */
155
+ clickStretch: number;
156
+ /** How much lighter still a click makes the fur, on top of `hoverLight`, springing back with the click. */
157
+ clickLight: number;
158
+ /** Seconds the fur hangs at the top of the poof. */
159
+ poofHold: number;
160
+ /** How strongly the pointer brushes the hairs. */
161
+ brush: number;
162
+ /** How brushed hairs spring back: speed (rad/s) and damping ratio (lower bounces more). */
163
+ brushSpeed: number;
164
+ brushDamping: number;
165
+ };
166
+ type Widen<T> = {
167
+ -readonly [K in keyof T]: T[K] extends number ? number : T[K];
168
+ };
169
+ type FurSettings = Widen<typeof defaultSettings>;
170
+ /** Whether `value` can be `key`'s: a finite number for a number setting, or one of its choices. */
171
+ declare function isSettingValue(key: keyof FurSettings, value: unknown): boolean;
172
+ /** Settings that change the hairs themselves, so the fur is grown again when they change. */
173
+ declare const regrowSettings: ReadonlySet<keyof FurSettings>;
174
+ /** Named starting points for the settings, most related first. The first, Plush, is the default. */
175
+ declare const presetSettings: {
176
+ /** Dense, short, neat fur with a springy click. */
177
+ Plush: {
178
+ /** Palette: where its middle sits (L*, 0–1, from the color), how far it reaches below and above that. */
179
+ shift: number;
180
+ darker: number;
181
+ lighter: number;
182
+ /** Hairs per area (regrows). */
183
+ density: number;
184
+ /** Hair length. Changing it grows or shrinks the hairs with the hover spring. */
185
+ length: number;
186
+ thickness: number;
187
+ /** How much hairs curl (regrows). */
188
+ curl: number;
189
+ /** How much hairs droop under their weight. */
190
+ droop: number;
191
+ /** How much hair lengths vary, 0 all the same (regrows). */
192
+ lengthVariation: number;
193
+ /** How much hair directions vary from the combed flow (regrows). */
194
+ messiness: number;
195
+ /** How far hairs along the outline lean out, making the fuzzy edge (regrows). */
196
+ fuzz: number;
197
+ /**
198
+ * How far from the button's edge the fur starts, in px at scale 1 (regrows):
199
+ * above 0 the outline hairs and the fur's body sit out past the edge, below
200
+ * 0 they move in, eating into the button.
201
+ */
202
+ distance: number;
203
+ /** Tip width relative to the root. */
204
+ taper: number;
205
+ /**
206
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
207
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
208
+ * hair gets wider to hold the fade, so it costs a little more to draw.
209
+ */
210
+ softness: number;
211
+ /** The hairs' pattern: straight, wavy, curly or frizzy. */
212
+ hairType: HairType;
213
+ /** How strong the waves, curls or frizz are: 0 is straight, 1 the usual amount. */
214
+ typeAmount: number;
215
+ /** How many waves, turns or kinks fit along each hair: higher is tighter. */
216
+ tightness: number;
217
+ /** How each hair ends: round, sharp or square. */
218
+ tipShape: TipShape;
219
+ /** What the hair looks made of: natural or glitter. */
220
+ material: Material;
221
+ /** How bright glitter's flashes are. */
222
+ materialAmount: number;
223
+ /** Glitter: how many flakes there are, 1 the usual amount. */
224
+ glitterDensity: number;
225
+ /** Glitter: how big the flakes are, 1 the usual size. */
226
+ glitterSize: number;
227
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
228
+ glitterSizeVariation: number;
229
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
230
+ pattern: Pattern;
231
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
232
+ patternColors: PatternColors;
233
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
234
+ patternScale: number;
235
+ /**
236
+ * A soft glow behind the label, in the fur's base color, so it reads where
237
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
238
+ * adds it only when a pattern needs one, or "always" or "never".
239
+ */
240
+ halo: Halo;
241
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
242
+ haloShade: number;
243
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
244
+ haloSize: number;
245
+ /** How strong the halo is, 1 the usual; 0 has none. */
246
+ haloStrength: number;
247
+ /** How many hairs catch the light (regrows). */
248
+ sheen: number;
249
+ /** Where the band of shine sits, 0 at the top to 1 at the bottom, and how far it spreads (regrows). */
250
+ sheenPosition: number;
251
+ sheenSpread: number;
252
+ /** How dark the hairs along the top edge are, turned away from the light; also keeps the shine off it (regrows). */
253
+ edgeShadow: number;
254
+ /** On wide-gamut screens, how far colors move out toward the more vivid colors sRGB can't show (0 to 1). */
255
+ vividness: number;
256
+ /** How far the hairs stand at rest, with no hover: 0 is combed flat, 1 standing up. */
257
+ static: number;
258
+ /** How much further the hairs stand when hovered, on top of `static` (up to 1). */
259
+ hover: number;
260
+ /**
261
+ * The hover spring: how fast it moves (rad/s) and its damping ratio (lower
262
+ * bounces more, 1 doesn't overshoot). Hovering out and clicking move on
263
+ * springs like it.
264
+ */
265
+ hoverSpeed: number;
266
+ hoverDamping: number;
267
+ /** The hover-out spring (without a click playing), back down to rest: speed (rad/s) and damping ratio. */
268
+ leaveSpeed: number;
269
+ leaveDamping: number;
270
+ /** How much the hairs sway while hovered. */
271
+ sway: number;
272
+ /**
273
+ * How much longer the hairs grow as they rise to the hover lift: 0.5 makes
274
+ * them half as long again (regrows, to make room).
275
+ */
276
+ hoverStretch: number;
277
+ /** How much lighter the fur gets as it rises to the hover lift, in L* (0–1); below 0 darkens. */
278
+ hoverLight: number;
279
+ /**
280
+ * A click poofs the fur up by `poofHeight` on the rise spring, hangs there
281
+ * for `poofHold` seconds, then comes back down to where it rests (hovered,
282
+ * or flat if the pointer has left) on the fall spring, which also springs
283
+ * the click's stretch back. Speeds in rad/s, then damping ratios (lower
284
+ * bounces more, 1 doesn't overshoot).
285
+ */
286
+ clickRiseSpeed: number;
287
+ clickRiseDamping: number;
288
+ clickFallSpeed: number;
289
+ clickFallDamping: number;
290
+ poofHeight: number;
291
+ /** How much longer still the hairs grow at the top of a click, on top of `hoverStretch` (regrows). */
292
+ clickStretch: number;
293
+ /** How much lighter still a click makes the fur, on top of `hoverLight`, springing back with the click. */
294
+ clickLight: number;
295
+ /** Seconds the fur hangs at the top of the poof. */
296
+ poofHold: number;
297
+ /** How strongly the pointer brushes the hairs. */
298
+ brush: number;
299
+ /** How brushed hairs spring back: speed (rad/s) and damping ratio (lower bounces more). */
300
+ brushSpeed: number;
301
+ brushDamping: number;
302
+ };
303
+ /** Sparse, thick, glossy strands, with a smooth hover that brightens, a slight bounce as it leaves and a soft, bouncy click that darkens. */
304
+ Teddy: {
305
+ shift: number;
306
+ darker: number;
307
+ lighter: number;
308
+ density: number;
309
+ length: number;
310
+ thickness: number;
311
+ curl: number;
312
+ droop: number;
313
+ lengthVariation: number;
314
+ messiness: number;
315
+ fuzz: number;
316
+ distance: number;
317
+ taper: number;
318
+ sheen: number;
319
+ sheenPosition: number;
320
+ sheenSpread: number;
321
+ edgeShadow: number;
322
+ vividness: number;
323
+ static: number;
324
+ hover: number;
325
+ hoverSpeed: number;
326
+ hoverDamping: number;
327
+ leaveSpeed: number;
328
+ leaveDamping: number;
329
+ sway: number;
330
+ hoverStretch: number;
331
+ hoverLight: number;
332
+ poofHeight: number;
333
+ clickStretch: number;
334
+ clickLight: number;
335
+ clickRiseSpeed: number;
336
+ clickRiseDamping: number;
337
+ clickFallSpeed: number;
338
+ clickFallDamping: number;
339
+ poofHold: number;
340
+ brush: number;
341
+ brushSpeed: number;
342
+ brushDamping: number;
343
+ /**
344
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
345
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
346
+ * hair gets wider to hold the fade, so it costs a little more to draw.
347
+ */
348
+ softness: number;
349
+ /** The hairs' pattern: straight, wavy, curly or frizzy. */
350
+ hairType: HairType;
351
+ /** How strong the waves, curls or frizz are: 0 is straight, 1 the usual amount. */
352
+ typeAmount: number;
353
+ /** How many waves, turns or kinks fit along each hair: higher is tighter. */
354
+ tightness: number;
355
+ /** How each hair ends: round, sharp or square. */
356
+ tipShape: TipShape;
357
+ /** What the hair looks made of: natural or glitter. */
358
+ material: Material;
359
+ /** How bright glitter's flashes are. */
360
+ materialAmount: number;
361
+ /** Glitter: how many flakes there are, 1 the usual amount. */
362
+ glitterDensity: number;
363
+ /** Glitter: how big the flakes are, 1 the usual size. */
364
+ glitterSize: number;
365
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
366
+ glitterSizeVariation: number;
367
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
368
+ pattern: Pattern;
369
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
370
+ patternColors: PatternColors;
371
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
372
+ patternScale: number;
373
+ /**
374
+ * A soft glow behind the label, in the fur's base color, so it reads where
375
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
376
+ * adds it only when a pattern needs one, or "always" or "never".
377
+ */
378
+ halo: Halo;
379
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
380
+ haloShade: number;
381
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
382
+ haloSize: number;
383
+ /** How strong the halo is, 1 the usual; 0 has none. */
384
+ haloStrength: number;
385
+ };
386
+ /** Curly, messy fur that stands up on its own, with a springy, rippling hover and click. */
387
+ Fluffy: {
388
+ shift: number;
389
+ darker: number;
390
+ lighter: number;
391
+ density: number;
392
+ length: number;
393
+ thickness: number;
394
+ curl: number;
395
+ droop: number;
396
+ lengthVariation: number;
397
+ messiness: number;
398
+ fuzz: number;
399
+ distance: number;
400
+ taper: number;
401
+ sheen: number;
402
+ sheenPosition: number;
403
+ sheenSpread: number;
404
+ edgeShadow: number;
405
+ vividness: number;
406
+ static: number;
407
+ hover: number;
408
+ hoverSpeed: number;
409
+ hoverDamping: number;
410
+ leaveSpeed: number;
411
+ leaveDamping: number;
412
+ sway: number;
413
+ hoverStretch: number;
414
+ hoverLight: number;
415
+ poofHeight: number;
416
+ clickStretch: number;
417
+ clickLight: number;
418
+ clickRiseSpeed: number;
419
+ clickRiseDamping: number;
420
+ clickFallSpeed: number;
421
+ clickFallDamping: number;
422
+ poofHold: number;
423
+ brush: number;
424
+ brushSpeed: number;
425
+ brushDamping: number;
426
+ /**
427
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
428
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
429
+ * hair gets wider to hold the fade, so it costs a little more to draw.
430
+ */
431
+ softness: number;
432
+ /** The hairs' pattern: straight, wavy, curly or frizzy. */
433
+ hairType: HairType;
434
+ /** How strong the waves, curls or frizz are: 0 is straight, 1 the usual amount. */
435
+ typeAmount: number;
436
+ /** How many waves, turns or kinks fit along each hair: higher is tighter. */
437
+ tightness: number;
438
+ /** How each hair ends: round, sharp or square. */
439
+ tipShape: TipShape;
440
+ /** What the hair looks made of: natural or glitter. */
441
+ material: Material;
442
+ /** How bright glitter's flashes are. */
443
+ materialAmount: number;
444
+ /** Glitter: how many flakes there are, 1 the usual amount. */
445
+ glitterDensity: number;
446
+ /** Glitter: how big the flakes are, 1 the usual size. */
447
+ glitterSize: number;
448
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
449
+ glitterSizeVariation: number;
450
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
451
+ pattern: Pattern;
452
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
453
+ patternColors: PatternColors;
454
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
455
+ patternScale: number;
456
+ /**
457
+ * A soft glow behind the label, in the fur's base color, so it reads where
458
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
459
+ * adds it only when a pattern needs one, or "always" or "never".
460
+ */
461
+ halo: Halo;
462
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
463
+ haloShade: number;
464
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
465
+ haloSize: number;
466
+ /** How strong the halo is, 1 the usual; 0 has none. */
467
+ haloStrength: number;
468
+ };
469
+ /** Long, thick, curly, heavily drooping fur set deep into the button, with sharp tips, a little shine and a quick, bouncy hover that stretches it. */
470
+ Fuzzy: {
471
+ shift: number;
472
+ darker: number;
473
+ lighter: number;
474
+ density: number;
475
+ length: number;
476
+ thickness: number;
477
+ curl: number;
478
+ droop: number;
479
+ lengthVariation: number;
480
+ messiness: number;
481
+ fuzz: number;
482
+ distance: number;
483
+ taper: number;
484
+ hairType: string;
485
+ typeAmount: number;
486
+ tightness: number;
487
+ tipShape: string;
488
+ sheen: number;
489
+ sheenPosition: number;
490
+ sheenSpread: number;
491
+ edgeShadow: number;
492
+ vividness: number;
493
+ static: number;
494
+ hover: number;
495
+ hoverSpeed: number;
496
+ hoverDamping: number;
497
+ leaveSpeed: number;
498
+ leaveDamping: number;
499
+ sway: number;
500
+ hoverStretch: number;
501
+ hoverLight: number;
502
+ poofHeight: number;
503
+ clickStretch: number;
504
+ clickLight: number;
505
+ clickRiseSpeed: number;
506
+ clickRiseDamping: number;
507
+ clickFallSpeed: number;
508
+ clickFallDamping: number;
509
+ poofHold: number;
510
+ brush: number;
511
+ brushSpeed: number;
512
+ brushDamping: number;
513
+ /**
514
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
515
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
516
+ * hair gets wider to hold the fade, so it costs a little more to draw.
517
+ */
518
+ softness: number;
519
+ /** What the hair looks made of: natural or glitter. */
520
+ material: Material;
521
+ /** How bright glitter's flashes are. */
522
+ materialAmount: number;
523
+ /** Glitter: how many flakes there are, 1 the usual amount. */
524
+ glitterDensity: number;
525
+ /** Glitter: how big the flakes are, 1 the usual size. */
526
+ glitterSize: number;
527
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
528
+ glitterSizeVariation: number;
529
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
530
+ pattern: Pattern;
531
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
532
+ patternColors: PatternColors;
533
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
534
+ patternScale: number;
535
+ /**
536
+ * A soft glow behind the label, in the fur's base color, so it reads where
537
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
538
+ * adds it only when a pattern needs one, or "always" or "never".
539
+ */
540
+ halo: Halo;
541
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
542
+ haloShade: number;
543
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
544
+ haloSize: number;
545
+ /** How strong the halo is, 1 the usual; 0 has none. */
546
+ haloStrength: number;
547
+ };
548
+ /** Thin, long, curly, droopy hair with lots of shine and a softer click. */
549
+ Shaggy: {
550
+ shift: number;
551
+ darker: number;
552
+ lighter: number;
553
+ density: number;
554
+ length: number;
555
+ thickness: number;
556
+ curl: number;
557
+ droop: number;
558
+ lengthVariation: number;
559
+ messiness: number;
560
+ fuzz: number;
561
+ taper: number;
562
+ sheen: number;
563
+ sheenPosition: number;
564
+ sheenSpread: number;
565
+ edgeShadow: number;
566
+ static: number;
567
+ hover: number;
568
+ hoverSpeed: number;
569
+ hoverDamping: number;
570
+ leaveSpeed: number;
571
+ leaveDamping: number;
572
+ sway: number;
573
+ hoverStretch: number;
574
+ hoverLight: number;
575
+ poofHeight: number;
576
+ clickStretch: number;
577
+ clickRiseSpeed: number;
578
+ clickRiseDamping: number;
579
+ clickFallSpeed: number;
580
+ clickFallDamping: number;
581
+ poofHold: number;
582
+ brush: number;
583
+ brushSpeed: number;
584
+ brushDamping: number;
585
+ /**
586
+ * How far from the button's edge the fur starts, in px at scale 1 (regrows):
587
+ * above 0 the outline hairs and the fur's body sit out past the edge, below
588
+ * 0 they move in, eating into the button.
589
+ */
590
+ distance: number;
591
+ /**
592
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
593
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
594
+ * hair gets wider to hold the fade, so it costs a little more to draw.
595
+ */
596
+ softness: number;
597
+ /** The hairs' pattern: straight, wavy, curly or frizzy. */
598
+ hairType: HairType;
599
+ /** How strong the waves, curls or frizz are: 0 is straight, 1 the usual amount. */
600
+ typeAmount: number;
601
+ /** How many waves, turns or kinks fit along each hair: higher is tighter. */
602
+ tightness: number;
603
+ /** How each hair ends: round, sharp or square. */
604
+ tipShape: TipShape;
605
+ /** What the hair looks made of: natural or glitter. */
606
+ material: Material;
607
+ /** How bright glitter's flashes are. */
608
+ materialAmount: number;
609
+ /** Glitter: how many flakes there are, 1 the usual amount. */
610
+ glitterDensity: number;
611
+ /** Glitter: how big the flakes are, 1 the usual size. */
612
+ glitterSize: number;
613
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
614
+ glitterSizeVariation: number;
615
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
616
+ pattern: Pattern;
617
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
618
+ patternColors: PatternColors;
619
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
620
+ patternScale: number;
621
+ /**
622
+ * A soft glow behind the label, in the fur's base color, so it reads where
623
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
624
+ * adds it only when a pattern needs one, or "always" or "never".
625
+ */
626
+ halo: Halo;
627
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
628
+ haloShade: number;
629
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
630
+ haloSize: number;
631
+ /** How strong the halo is, 1 the usual; 0 has none. */
632
+ haloStrength: number;
633
+ /** On wide-gamut screens, how far colors move out toward the more vivid colors sRGB can't show (0 to 1). */
634
+ vividness: number;
635
+ /** How much lighter still a click makes the fur, on top of `hoverLight`, springing back with the click. */
636
+ clickLight: number;
637
+ };
638
+ /** Long, sparse, messy, gently wavy strands with a bright band of shine along the top, a bouncy hover, and barely react to a click. */
639
+ Mane: {
640
+ shift: number;
641
+ darker: number;
642
+ lighter: number;
643
+ density: number;
644
+ length: number;
645
+ thickness: number;
646
+ curl: number;
647
+ droop: number;
648
+ lengthVariation: number;
649
+ messiness: number;
650
+ fuzz: number;
651
+ taper: number;
652
+ hairType: string;
653
+ typeAmount: number;
654
+ tightness: number;
655
+ sheen: number;
656
+ sheenPosition: number;
657
+ sheenSpread: number;
658
+ edgeShadow: number;
659
+ vividness: number;
660
+ static: number;
661
+ hover: number;
662
+ hoverSpeed: number;
663
+ hoverDamping: number;
664
+ leaveSpeed: number;
665
+ leaveDamping: number;
666
+ sway: number;
667
+ hoverStretch: number;
668
+ hoverLight: number;
669
+ poofHeight: number;
670
+ clickStretch: number;
671
+ clickRiseSpeed: number;
672
+ clickRiseDamping: number;
673
+ clickFallSpeed: number;
674
+ clickFallDamping: number;
675
+ poofHold: number;
676
+ brush: number;
677
+ brushSpeed: number;
678
+ brushDamping: number;
679
+ /**
680
+ * How far from the button's edge the fur starts, in px at scale 1 (regrows):
681
+ * above 0 the outline hairs and the fur's body sit out past the edge, below
682
+ * 0 they move in, eating into the button.
683
+ */
684
+ distance: number;
685
+ /**
686
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
687
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
688
+ * hair gets wider to hold the fade, so it costs a little more to draw.
689
+ */
690
+ softness: number;
691
+ /** How each hair ends: round, sharp or square. */
692
+ tipShape: TipShape;
693
+ /** What the hair looks made of: natural or glitter. */
694
+ material: Material;
695
+ /** How bright glitter's flashes are. */
696
+ materialAmount: number;
697
+ /** Glitter: how many flakes there are, 1 the usual amount. */
698
+ glitterDensity: number;
699
+ /** Glitter: how big the flakes are, 1 the usual size. */
700
+ glitterSize: number;
701
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
702
+ glitterSizeVariation: number;
703
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
704
+ pattern: Pattern;
705
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
706
+ patternColors: PatternColors;
707
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
708
+ patternScale: number;
709
+ /**
710
+ * A soft glow behind the label, in the fur's base color, so it reads where
711
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
712
+ * adds it only when a pattern needs one, or "always" or "never".
713
+ */
714
+ halo: Halo;
715
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
716
+ haloShade: number;
717
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
718
+ haloSize: number;
719
+ /** How strong the halo is, 1 the usual; 0 has none. */
720
+ haloStrength: number;
721
+ /** How much lighter still a click makes the fur, on top of `hoverLight`, springing back with the click. */
722
+ clickLight: number;
723
+ };
724
+ /** Sparse, thick, very messy glittering curls with square ends set into the button, like tinsel, with slow, gentle motion that darkens on hover and click. */
725
+ Tinsel: {
726
+ shift: number;
727
+ darker: number;
728
+ lighter: number;
729
+ density: number;
730
+ length: number;
731
+ thickness: number;
732
+ curl: number;
733
+ droop: number;
734
+ lengthVariation: number;
735
+ messiness: number;
736
+ fuzz: number;
737
+ distance: number;
738
+ taper: number;
739
+ typeAmount: number;
740
+ tightness: number;
741
+ tipShape: string;
742
+ material: string;
743
+ materialAmount: number;
744
+ glitterDensity: number;
745
+ glitterSize: number;
746
+ glitterSizeVariation: number;
747
+ sheen: number;
748
+ sheenPosition: number;
749
+ sheenSpread: number;
750
+ edgeShadow: number;
751
+ vividness: number;
752
+ static: number;
753
+ hover: number;
754
+ hoverSpeed: number;
755
+ hoverDamping: number;
756
+ leaveSpeed: number;
757
+ leaveDamping: number;
758
+ sway: number;
759
+ hoverStretch: number;
760
+ hoverLight: number;
761
+ poofHeight: number;
762
+ clickStretch: number;
763
+ clickLight: number;
764
+ clickRiseSpeed: number;
765
+ clickRiseDamping: number;
766
+ clickFallSpeed: number;
767
+ clickFallDamping: number;
768
+ poofHold: number;
769
+ brush: number;
770
+ brushSpeed: number;
771
+ brushDamping: number;
772
+ /**
773
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
774
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
775
+ * hair gets wider to hold the fade, so it costs a little more to draw.
776
+ */
777
+ softness: number;
778
+ /** The hairs' pattern: straight, wavy, curly or frizzy. */
779
+ hairType: HairType;
780
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
781
+ pattern: Pattern;
782
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
783
+ patternColors: PatternColors;
784
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
785
+ patternScale: number;
786
+ /**
787
+ * A soft glow behind the label, in the fur's base color, so it reads where
788
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
789
+ * adds it only when a pattern needs one, or "always" or "never".
790
+ */
791
+ halo: Halo;
792
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
793
+ haloShade: number;
794
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
795
+ haloSize: number;
796
+ /** How strong the halo is, 1 the usual; 0 has none. */
797
+ haloStrength: number;
798
+ };
799
+ /** A few thick, tightly curled, pointed strands that spring up on hover and stretch out on a click. */
800
+ Coil: {
801
+ shift: number;
802
+ darker: number;
803
+ lighter: number;
804
+ density: number;
805
+ length: number;
806
+ thickness: number;
807
+ curl: number;
808
+ droop: number;
809
+ lengthVariation: number;
810
+ messiness: number;
811
+ fuzz: number;
812
+ distance: number;
813
+ taper: number;
814
+ sheen: number;
815
+ sheenPosition: number;
816
+ sheenSpread: number;
817
+ edgeShadow: number;
818
+ vividness: number;
819
+ static: number;
820
+ hover: number;
821
+ hoverSpeed: number;
822
+ hoverDamping: number;
823
+ leaveSpeed: number;
824
+ leaveDamping: number;
825
+ sway: number;
826
+ hoverStretch: number;
827
+ hoverLight: number;
828
+ poofHeight: number;
829
+ clickStretch: number;
830
+ clickLight: number;
831
+ clickRiseSpeed: number;
832
+ clickRiseDamping: number;
833
+ clickFallSpeed: number;
834
+ clickFallDamping: number;
835
+ poofHold: number;
836
+ brush: number;
837
+ brushSpeed: number;
838
+ brushDamping: number;
839
+ /**
840
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
841
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
842
+ * hair gets wider to hold the fade, so it costs a little more to draw.
843
+ */
844
+ softness: number;
845
+ /** The hairs' pattern: straight, wavy, curly or frizzy. */
846
+ hairType: HairType;
847
+ /** How strong the waves, curls or frizz are: 0 is straight, 1 the usual amount. */
848
+ typeAmount: number;
849
+ /** How many waves, turns or kinks fit along each hair: higher is tighter. */
850
+ tightness: number;
851
+ /** How each hair ends: round, sharp or square. */
852
+ tipShape: TipShape;
853
+ /** What the hair looks made of: natural or glitter. */
854
+ material: Material;
855
+ /** How bright glitter's flashes are. */
856
+ materialAmount: number;
857
+ /** Glitter: how many flakes there are, 1 the usual amount. */
858
+ glitterDensity: number;
859
+ /** Glitter: how big the flakes are, 1 the usual size. */
860
+ glitterSize: number;
861
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
862
+ glitterSizeVariation: number;
863
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
864
+ pattern: Pattern;
865
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
866
+ patternColors: PatternColors;
867
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
868
+ patternScale: number;
869
+ /**
870
+ * A soft glow behind the label, in the fur's base color, so it reads where
871
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
872
+ * adds it only when a pattern needs one, or "always" or "never".
873
+ */
874
+ halo: Halo;
875
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
876
+ haloShade: number;
877
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
878
+ haloSize: number;
879
+ /** How strong the halo is, 1 the usual; 0 has none. */
880
+ haloStrength: number;
881
+ };
882
+ /** Long, thin, glossy, loosely wavy hairs with sharp ends that droop heavily from just inside the button, with a quick, bouncy hover and click and a light brush. */
883
+ Mustache: {
884
+ shift: number;
885
+ darker: number;
886
+ lighter: number;
887
+ density: number;
888
+ length: number;
889
+ thickness: number;
890
+ curl: number;
891
+ droop: number;
892
+ lengthVariation: number;
893
+ messiness: number;
894
+ fuzz: number;
895
+ distance: number;
896
+ taper: number;
897
+ hairType: string;
898
+ typeAmount: number;
899
+ tightness: number;
900
+ tipShape: string;
901
+ materialAmount: number;
902
+ glitterSize: number;
903
+ glitterSizeVariation: number;
904
+ sheen: number;
905
+ sheenPosition: number;
906
+ sheenSpread: number;
907
+ edgeShadow: number;
908
+ vividness: number;
909
+ static: number;
910
+ hover: number;
911
+ hoverSpeed: number;
912
+ hoverDamping: number;
913
+ leaveSpeed: number;
914
+ leaveDamping: number;
915
+ sway: number;
916
+ hoverStretch: number;
917
+ hoverLight: number;
918
+ poofHeight: number;
919
+ clickStretch: number;
920
+ clickLight: number;
921
+ clickRiseSpeed: number;
922
+ clickRiseDamping: number;
923
+ clickFallSpeed: number;
924
+ clickFallDamping: number;
925
+ poofHold: number;
926
+ brush: number;
927
+ brushSpeed: number;
928
+ brushDamping: number;
929
+ /**
930
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
931
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
932
+ * hair gets wider to hold the fade, so it costs a little more to draw.
933
+ */
934
+ softness: number;
935
+ /** What the hair looks made of: natural or glitter. */
936
+ material: Material;
937
+ /** Glitter: how many flakes there are, 1 the usual amount. */
938
+ glitterDensity: number;
939
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
940
+ pattern: Pattern;
941
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
942
+ patternColors: PatternColors;
943
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
944
+ patternScale: number;
945
+ /**
946
+ * A soft glow behind the label, in the fur's base color, so it reads where
947
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
948
+ * adds it only when a pattern needs one, or "always" or "never".
949
+ */
950
+ halo: Halo;
951
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
952
+ haloShade: number;
953
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
954
+ haloSize: number;
955
+ /** How strong the halo is, 1 the usual; 0 has none. */
956
+ haloStrength: number;
957
+ };
958
+ /** Sparse, thick, drooping bristles with square ends that stand up on their own, a quick hover, a high, snappy click and a strong brush. */
959
+ Bristle: {
960
+ shift: number;
961
+ darker: number;
962
+ lighter: number;
963
+ density: number;
964
+ length: number;
965
+ thickness: number;
966
+ curl: number;
967
+ droop: number;
968
+ lengthVariation: number;
969
+ messiness: number;
970
+ fuzz: number;
971
+ distance: number;
972
+ taper: number;
973
+ typeAmount: number;
974
+ tightness: number;
975
+ tipShape: string;
976
+ sheen: number;
977
+ sheenPosition: number;
978
+ sheenSpread: number;
979
+ edgeShadow: number;
980
+ vividness: number;
981
+ static: number;
982
+ hover: number;
983
+ hoverSpeed: number;
984
+ hoverDamping: number;
985
+ leaveSpeed: number;
986
+ leaveDamping: number;
987
+ sway: number;
988
+ hoverStretch: number;
989
+ hoverLight: number;
990
+ poofHeight: number;
991
+ clickStretch: number;
992
+ clickLight: number;
993
+ clickRiseSpeed: number;
994
+ clickRiseDamping: number;
995
+ clickFallSpeed: number;
996
+ clickFallDamping: number;
997
+ poofHold: number;
998
+ brush: number;
999
+ brushSpeed: number;
1000
+ brushDamping: number;
1001
+ /**
1002
+ * How soft each hair's edge is, in px at scale 1: 0 is the crisp
1003
+ * pixel-wide edge, higher fades it out over that many more pixels, up to 2. Each
1004
+ * hair gets wider to hold the fade, so it costs a little more to draw.
1005
+ */
1006
+ softness: number;
1007
+ /** The hairs' pattern: straight, wavy, curly or frizzy. */
1008
+ hairType: HairType;
1009
+ /** What the hair looks made of: natural or glitter. */
1010
+ material: Material;
1011
+ /** How bright glitter's flashes are. */
1012
+ materialAmount: number;
1013
+ /** Glitter: how many flakes there are, 1 the usual amount. */
1014
+ glitterDensity: number;
1015
+ /** Glitter: how big the flakes are, 1 the usual size. */
1016
+ glitterSize: number;
1017
+ /** Glitter: how much flake sizes differ, 0 all the same; at 1 they range from half to twice the size. */
1018
+ glitterSizeVariation: number;
1019
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
1020
+ pattern: Pattern;
1021
+ /** The pattern's colors: "natural" takes the animal's own, "tinted" makes them from the fur's color. */
1022
+ patternColors: PatternColors;
1023
+ /** How big the pattern's stripes, spots or patches are, 1 the usual size. */
1024
+ patternScale: number;
1025
+ /**
1026
+ * A soft glow behind the label, in the fur's base color, so it reads where
1027
+ * the fur alone doesn't, as on a zebra's white and black at once: "auto"
1028
+ * adds it only when a pattern needs one, or "always" or "never".
1029
+ */
1030
+ halo: Halo;
1031
+ /** How far the halo's shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
1032
+ haloShade: number;
1033
+ /** How far the halo's glow spreads round the letters, 1 the usual size. */
1034
+ haloSize: number;
1035
+ /** How strong the halo is, 1 the usual; 0 has none. */
1036
+ haloStrength: number;
1037
+ };
1038
+ };
1039
+ type PresetName = Lowercase<keyof typeof presetSettings>;
1040
+ /** Named starting points for the settings, by id. The first, Plush, is the default. */
1041
+ declare const presets: Record<PresetName, Readonly<FurSettings>>;
1042
+ /** Each preset's display name, by id, in order. */
1043
+ declare const presetNames: Record<PresetName, string>;
1044
+
1045
+ /** Whether this screen can show wide-gamut (Display P3) color. */
1046
+ declare const supportsWideGamut: () => boolean;
1047
+ /** The label's lowest APCA contrast (unsigned Lc) over the shades most hairs take. */
1048
+ declare function labelContrast(label: string, color: string, S: FurSettings): number;
1049
+ /**
1050
+ * A label color that reads on `color`'s fur, by APCA, and its contrast: the
1051
+ * lowest Lc over the shades most hairs take, at rest and fully hovered. It
1052
+ * prefers a light or dark tint of the fur's own hue, when that reaches the
1053
+ * target Lc, and otherwise takes whichever of the tints, white or black reads
1054
+ * best. The target is Lc 60 for large or bold text and Lc 75 otherwise.
1055
+ */
1056
+ declare function autoLabel(color: string, S: FurSettings, text?: {
1057
+ size: number;
1058
+ weight: number;
1059
+ }): {
1060
+ label: string;
1061
+ lc: number;
1062
+ };
1063
+ type FurMotion = "hover" | "leave" | "click";
1064
+ interface FurLabel {
1065
+ color: string;
1066
+ /** Unsigned Lc: its lowest over the coat, or against the halo backing it. */
1067
+ contrast: number;
1068
+ /** Whether a halo backs it: always, never, or on auto, when a pattern needs one. */
1069
+ halo: boolean;
1070
+ }
1071
+
1072
+ /**
1073
+ * The public option names, by group, and the setting each one sets. The groups
1074
+ * follow the playground: how the fur is shaded, its shine, the hairs, and how
1075
+ * it moves at rest, on hover, on hover out, on click and when brushed.
1076
+ */
1077
+ declare const optionGroups: {
1078
+ readonly shade: {
1079
+ /** Moves the fur's middle shade lighter or darker than the color, in L* (0–1). */
1080
+ readonly lightness: "shift";
1081
+ /** How much darker the darkest hairs are than the middle shade. */
1082
+ readonly shadows: "darker";
1083
+ /** How much lighter the lightest hairs are than the middle shade. */
1084
+ readonly highlights: "lighter";
1085
+ /** On wide-gamut (P3) screens, how far colors move out toward the more vivid ones sRGB can't show (0 to 1). */
1086
+ readonly vividness: "vividness";
1087
+ };
1088
+ readonly shine: {
1089
+ /** How many glossy hairs catch the light. 0 is matte. */
1090
+ readonly amount: "sheen";
1091
+ /** Where the band of shine sits: 0 at the top, 1 at the bottom. */
1092
+ readonly position: "sheenPosition";
1093
+ /** How wide the band of shine is. */
1094
+ readonly spread: "sheenSpread";
1095
+ /** Darkens the hairs along the top edge, where the surface turns away from the light. */
1096
+ readonly edgeShadow: "edgeShadow";
1097
+ };
1098
+ readonly hair: {
1099
+ readonly density: "density";
1100
+ readonly length: "length";
1101
+ readonly thickness: "thickness";
1102
+ /** Tip width compared to the root. */
1103
+ readonly taper: "taper";
1104
+ /** How soft each hair's edge is, in px: 0 is crisp, higher fades it over more pixels, up to 2. */
1105
+ readonly softness: "softness";
1106
+ readonly curl: "curl";
1107
+ readonly droop: "droop";
1108
+ /** How much hair lengths differ. 0 makes them all the same. */
1109
+ readonly lengthVariation: "lengthVariation";
1110
+ /** How far hairs stray from the combed direction. */
1111
+ readonly messiness: "messiness";
1112
+ /** How far hairs along the outline lean out, softening the edge. */
1113
+ readonly fuzz: "fuzz";
1114
+ /** Where the fur starts from the element's edge, in px. Below 0 it eats into the element. */
1115
+ readonly distance: "distance";
1116
+ /** The hairs' pattern: "straight", "wavy", "curly" or "frizzy". */
1117
+ readonly type: "hairType";
1118
+ /** How strong the waves, curls or frizz are: 0 is straight, 1 the usual amount. */
1119
+ readonly typeAmount: "typeAmount";
1120
+ /** How many waves, turns or kinks fit along each hair: higher is tighter. */
1121
+ readonly tightness: "tightness";
1122
+ /** How each hair ends: "round", "sharp" or "square". */
1123
+ readonly end: "tipShape";
1124
+ };
1125
+ readonly material: {
1126
+ /** What the hair looks made of: "natural" or "glitter". */
1127
+ readonly type: "material";
1128
+ /** How bright glitter's flashes are. */
1129
+ readonly amount: "materialAmount";
1130
+ };
1131
+ readonly pattern: {
1132
+ /** A coat pattern, as on an animal: "none", "zebra", "tiger", "dalmatian", "leopard" or "giraffe". */
1133
+ readonly type: "pattern";
1134
+ /** "natural" takes the animal's own colors; "tinted" makes them from the fur's color. */
1135
+ readonly colors: "patternColors";
1136
+ /** How big the stripes, spots or patches are: 1 the usual size. */
1137
+ readonly scale: "patternScale";
1138
+ };
1139
+ readonly halo: {
1140
+ /** When the label gets a halo: "auto" only when a pattern needs one, or "always" or "never". */
1141
+ readonly when: "halo";
1142
+ /** How far its shade moves from the base color, away from the label's: darker under a light label, lighter under a dark one (L, 0–1). */
1143
+ readonly shade: "haloShade";
1144
+ /** How far the glow spreads round the letters: 1 the usual size. */
1145
+ readonly size: "haloSize";
1146
+ /** How strong it is: 1 the usual, 0 none. */
1147
+ readonly strength: "haloStrength";
1148
+ };
1149
+ readonly glitter: {
1150
+ /** How many flakes there are: 1 the usual amount, 0 none. */
1151
+ readonly density: "glitterDensity";
1152
+ /** How big the flakes are: 1 the usual size. */
1153
+ readonly size: "glitterSize";
1154
+ /** How much flake sizes differ: 0 all the same; at 1 they range from half to twice the size. */
1155
+ readonly sizeVariation: "glitterSizeVariation";
1156
+ };
1157
+ readonly rest: {
1158
+ /** How far the hairs stand up on their own: 0 lies combed flat, 1 stands straight up. */
1159
+ readonly static: "static";
1160
+ };
1161
+ readonly hover: {
1162
+ /** How much further the hairs stand up on hover, on top of the rest's static. */
1163
+ readonly static: "hover";
1164
+ /** How much longer the hairs grow as they rise. 1 doubles them. */
1165
+ readonly stretch: "hoverStretch";
1166
+ /** How much lighter the fur gets as it rises, in L*. Below 0 darkens. */
1167
+ readonly lightness: "hoverLight";
1168
+ /** How far each hair rocks from side to side while hovered. */
1169
+ readonly sway: "sway";
1170
+ /** How quickly the fur rises (rad/s). */
1171
+ readonly speed: "hoverSpeed";
1172
+ /** How much the rise bounces: lower overshoots, 1 doesn't. */
1173
+ readonly damping: "hoverDamping";
1174
+ };
1175
+ readonly leave: {
1176
+ /** How quickly the fur springs back to rest when the pointer leaves (rad/s). */
1177
+ readonly speed: "leaveSpeed";
1178
+ /** How much it bounces past rest: lower overshoots, 1 doesn't. */
1179
+ readonly damping: "leaveDamping";
1180
+ };
1181
+ readonly click: {
1182
+ /** How much further a click makes the fur stand up, on top of hovering. */
1183
+ readonly static: "poofHeight";
1184
+ /** How much longer still the hairs grow at the top of a click. */
1185
+ readonly stretch: "clickStretch";
1186
+ /** How much lighter still a click makes the fur, in L*. */
1187
+ readonly lightness: "clickLight";
1188
+ /** How quickly the fur poofs up (rad/s). */
1189
+ readonly riseSpeed: "clickRiseSpeed";
1190
+ /** How far the poof overshoots its peak: lower overshoots more, 1 doesn't. */
1191
+ readonly riseDamping: "clickRiseDamping";
1192
+ /** Seconds the fur hangs at the top. */
1193
+ readonly hold: "poofHold";
1194
+ /** How quickly the fur comes back down, and the stretch springs back (rad/s). */
1195
+ readonly fallSpeed: "clickFallSpeed";
1196
+ /** How much it bounces on the way down: lower bounces more, 1 doesn't. */
1197
+ readonly fallDamping: "clickFallDamping";
1198
+ };
1199
+ readonly brush: {
1200
+ /** How strongly moving the pointer across the fur pushes the hairs. 0 turns brushing off. */
1201
+ readonly amount: "brush";
1202
+ /** How quickly brushed hairs spring back. */
1203
+ readonly speed: "brushSpeed";
1204
+ /** How much brushed hairs wobble on the way back. */
1205
+ readonly damping: "brushDamping";
1206
+ };
1207
+ };
1208
+ type OptionGroup = keyof typeof optionGroups;
1209
+ type GroupOptions<G extends OptionGroup> = {
1210
+ [K in keyof (typeof optionGroups)[G]]?: (typeof optionGroups)[G][K] extends keyof FurSettings ? FurSettings[(typeof optionGroups)[G][K]] extends number ? number : FurSettings[(typeof optionGroups)[G][K]] : never;
1211
+ };
1212
+ /** The fur's look and motion, by group. Each value overrides the preset's. */
1213
+ type FurOptions = {
1214
+ [G in OptionGroup]?: GroupOptions<G>;
1215
+ };
1216
+ /** A hair size: a number (1 is the default size, in CSS px), or "<n>em" to follow the element's font size. */
1217
+ type HairScale = number | `${number}em`;
1218
+ interface HairyOptions extends FurOptions {
1219
+ /** The starting settings. Defaults to "plush". */
1220
+ preset?: PresetName;
1221
+ /** The fur's color, any CSS color. Defaults to the element's background color. */
1222
+ color?: string;
1223
+ /**
1224
+ * The label's color. "auto" picks a readable one for the fur by APCA
1225
+ * contrast; a CSS color sets it; leave it out to keep the element's own.
1226
+ */
1227
+ label?: "auto" | (string & {});
1228
+ /**
1229
+ * Hair size: at 2 the hairs are twice as long and thick, and fewer, so each
1230
+ * shows. In em ("1em", "1.5em"), it follows the element's font size, with
1231
+ * 16px as 1em, so the fur shrinks and grows with a responsive element.
1232
+ * Defaults to the element's `--hairy-scale` CSS variable (a number or an
1233
+ * em value), or 1.
1234
+ */
1235
+ scale?: HairScale;
1236
+ /**
1237
+ * Moves the fur down, in CSS px; below 0 moves it up. Hair combs down, so
1238
+ * it hangs further below the element than it reaches above it, and the
1239
+ * label can look high: a few px up (-4 or so) centers the fur on it.
1240
+ * Defaults to 0.
1241
+ */
1242
+ translate?: number;
1243
+ /** Draw in Display P3 on screens that support it. Defaults to true. */
1244
+ wideGamut?: boolean;
1245
+ /** Canvas pixels per CSS pixel. Defaults to the screen's, up to 2; set it higher to bake large images. */
1246
+ pixelRatio?: number;
1247
+ }
1248
+ /** The full settings for `options`: the preset's, with each grouped option on top. */
1249
+ declare function resolveSettings(options: FurOptions & {
1250
+ preset?: PresetName;
1251
+ }): FurSettings;
1252
+ /**
1253
+ * The grouped options that turn `preset` into `settings`: only the values
1254
+ * that differ, so they stay short. The inverse of `resolveSettings`.
1255
+ */
1256
+ declare function diffOptions(settings: FurSettings, preset?: PresetName): FurOptions;
1257
+
1258
+ /** Whether this browser can draw fur: WebGL2 on a real GPU. */
1259
+ declare const gpuSupported: () => boolean;
1260
+
1261
+ /**
1262
+ * APCA lightness contrast (Lc) of `text` on `background`, using the APCA-W3
1263
+ * 0.0.98G-4g constants. Positive for dark text on a lighter background,
1264
+ * negative for light text on a darker one. Black on white is about 106.
1265
+ */
1266
+ declare function apca(text: string, background: string): number;
1267
+
1268
+ interface Hairy {
1269
+ /**
1270
+ * Changes the options. Top-level options replace the old ones; each group
1271
+ * (`hair`, `hover`…) is merged into the old group, value by value.
1272
+ */
1273
+ update(options: HairyOptions): void;
1274
+ /** Replaces all the options, so anything left out goes back to its default. */
1275
+ set(options: HairyOptions): void;
1276
+ /** Plays a motion as if the pointer did it: "hover" in, "leave" (hover out), or a "click". */
1277
+ play(motion: FurMotion): void;
1278
+ /** The label color in use, its APCA contrast on the fur (unsigned Lc) and whether a halo backs it, when `label` is set. */
1279
+ readonly label: FurLabel | null;
1280
+ /** How far, in CSS px, the longest hairs can reach past the element's box, hovered, clicked or drooping. */
1281
+ readonly reach: number;
1282
+ /** Removes the fur, and puts back the element's own styles. */
1283
+ destroy(): void;
1284
+ }
1285
+ /**
1286
+ * Adds fur to an element you already have, usually a button. The fur is drawn
1287
+ * on a canvas behind the element's content, in `color` (or the element's own
1288
+ * background), and reacts to hover, click, keyboard focus and brushing.
1289
+ *
1290
+ * ```js
1291
+ * import { hairy } from "@markmiro/hairy";
1292
+ * const fur = hairy(document.querySelector("#adopt"), { preset: "plush", color: "#ff4d70", label: "auto" });
1293
+ * ```
1294
+ */
1295
+ declare function hairy(element: HTMLElement, options?: HairyOptions): Hairy;
1296
+
1297
+ export { apca, autoLabel, defaultSettings, diffOptions, eases, hairy, isSettingValue, labelContrast, optionGroups, presetNames, presets, regrowSettings, resolveSettings, settingChoices, gpuSupported as supportsFur, supportsWideGamut };
1298
+ export type { ChoiceSetting, Ease, FurLabel, FurMotion, FurOptions, FurSettings, HairScale, HairType, Hairy, HairyOptions, Halo, Material, OptionGroup, Pattern, PatternColors, PresetName, TipShape };