@codefast/ui 0.5.0-canary.2 → 0.5.0-canary.4

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 (80) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/components/attachment.d.mts +136 -0
  3. package/dist/components/attachment.mjs +112 -0
  4. package/dist/components/avatar.mjs +1 -1
  5. package/dist/components/breadcrumb.d.mts +2 -4
  6. package/dist/components/bubble.d.mts +67 -0
  7. package/dist/components/bubble.mjs +58 -0
  8. package/dist/components/card.mjs +2 -2
  9. package/dist/components/carousel.mjs +12 -3
  10. package/dist/components/empty.mjs +1 -1
  11. package/dist/components/marker.d.mts +49 -0
  12. package/dist/components/marker.mjs +42 -0
  13. package/dist/components/message-scroller.d.mts +89 -0
  14. package/dist/components/message-scroller.mjs +77 -0
  15. package/dist/components/message.d.mts +86 -0
  16. package/dist/components/message.mjs +66 -0
  17. package/dist/components/progress-circle.d.mts +4 -4
  18. package/dist/components/progress-circle.mjs +7 -7
  19. package/dist/components/sidebar.mjs +6 -3
  20. package/dist/hooks/use-animated-value.d.mts +2 -2
  21. package/dist/hooks/use-animated-value.mjs +4 -4
  22. package/dist/hooks/use-message-scroller-commands.d.mts +39 -0
  23. package/dist/hooks/use-message-scroller-commands.mjs +165 -0
  24. package/dist/hooks/use-message-scroller-controller.d.mts +19 -0
  25. package/dist/hooks/use-message-scroller-controller.mjs +382 -0
  26. package/dist/hooks/use-message-scroller-refs.d.mts +60 -0
  27. package/dist/hooks/use-message-scroller-refs.mjs +77 -0
  28. package/dist/hooks/use-pagination.d.mts +4 -4
  29. package/dist/hooks/use-pagination.mjs +1 -1
  30. package/dist/index.d.mts +12 -2
  31. package/dist/index.mjs +11 -2
  32. package/dist/lib/message-scroller/geometry.d.mts +136 -0
  33. package/dist/lib/message-scroller/geometry.mjs +199 -0
  34. package/dist/lib/message-scroller/stores.d.mts +21 -0
  35. package/dist/lib/message-scroller/stores.mjs +52 -0
  36. package/dist/lib/message-scroller/types.d.mts +171 -0
  37. package/dist/lib/message-scroller/types.mjs +53 -0
  38. package/dist/lib/message-scroller/utils.d.mts +7 -0
  39. package/dist/lib/message-scroller/utils.mjs +12 -0
  40. package/dist/lib/use-render.d.mts +43 -0
  41. package/dist/lib/use-render.mjs +84 -0
  42. package/dist/primitives/message-scroller.d.mts +88 -0
  43. package/dist/primitives/message-scroller.mjs +240 -0
  44. package/dist/variants/attachment.d.mts +42 -0
  45. package/dist/variants/attachment.mjs +42 -0
  46. package/dist/variants/bubble.d.mts +45 -0
  47. package/dist/variants/bubble.mjs +45 -0
  48. package/dist/variants/marker.d.mts +21 -0
  49. package/dist/variants/marker.mjs +18 -0
  50. package/package.json +93 -7
  51. package/src/components/attachment.tsx +284 -0
  52. package/src/components/avatar.tsx +1 -1
  53. package/src/components/breadcrumb.tsx +2 -4
  54. package/src/components/bubble.tsx +116 -0
  55. package/src/components/card.tsx +2 -2
  56. package/src/components/carousel.tsx +12 -3
  57. package/src/components/empty.tsx +1 -1
  58. package/src/components/marker.tsx +94 -0
  59. package/src/components/message-scroller.tsx +213 -0
  60. package/src/components/message.tsx +173 -0
  61. package/src/components/progress-circle.tsx +11 -11
  62. package/src/components/sidebar.tsx +11 -4
  63. package/src/css/foundation/tokens.css +6 -18
  64. package/src/css/foundation/utilities.css +451 -0
  65. package/src/css/preset.css +2 -1
  66. package/src/hooks/use-animated-value.ts +4 -4
  67. package/src/hooks/use-message-scroller-commands.ts +311 -0
  68. package/src/hooks/use-message-scroller-controller.ts +650 -0
  69. package/src/hooks/use-message-scroller-refs.ts +167 -0
  70. package/src/hooks/use-pagination.ts +3 -3
  71. package/src/index.ts +73 -1
  72. package/src/lib/message-scroller/geometry.ts +397 -0
  73. package/src/lib/message-scroller/stores.ts +88 -0
  74. package/src/lib/message-scroller/types.ts +309 -0
  75. package/src/lib/message-scroller/utils.ts +14 -0
  76. package/src/lib/use-render.ts +201 -0
  77. package/src/primitives/message-scroller.tsx +403 -0
  78. package/src/variants/attachment.ts +73 -0
  79. package/src/variants/bubble.ts +81 -0
  80. package/src/variants/marker.ts +38 -0
@@ -0,0 +1,451 @@
1
+ /* -------------------------------------------------------------------------
2
+ * Utilities
3
+ *
4
+ * Scroll-aware edge fades and text shimmer, shared by the chat components
5
+ * (attachment, message, message-scroller) and usable on any scroller.
6
+ *
7
+ * `scroll-fade*` masks the content edges and tracks scroll position via
8
+ * `animation-timeline: scroll()`, degrading to a static fade where the
9
+ * feature is unsupported. `shimmer` clips a moving highlight to text for
10
+ * loading states. Both mirror in RTL.
11
+ *
12
+ * Vendored from an external Tailwind preset (scroll-fade, shimmer). Keep
13
+ * faithful so upstream fixes re-apply mechanically.
14
+ * ------------------------------------------------------------------------- */
15
+
16
+ /* scroll-fade */
17
+ @property --scroll-fade-t {
18
+ syntax: "<length-percentage>";
19
+ inherits: false;
20
+ initial-value: 0px;
21
+ }
22
+ @property --scroll-fade-b {
23
+ syntax: "<length-percentage>";
24
+ inherits: false;
25
+ initial-value: 0px;
26
+ }
27
+ @property --scroll-fade-s {
28
+ syntax: "<length-percentage>";
29
+ inherits: false;
30
+ initial-value: 0px;
31
+ }
32
+ @property --scroll-fade-e {
33
+ syntax: "<length-percentage>";
34
+ inherits: false;
35
+ initial-value: 0px;
36
+ }
37
+ @property --scroll-fade-mask {
38
+ syntax: "*";
39
+ inherits: false;
40
+ }
41
+
42
+ @theme inline {
43
+ @keyframes scroll-fade-reveal-t {
44
+ from {
45
+ --scroll-fade-t: 0px;
46
+ }
47
+ to {
48
+ --scroll-fade-t: var(--_scroll-fade-size-t, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
49
+ }
50
+ }
51
+ @keyframes scroll-fade-reveal-b {
52
+ from {
53
+ --scroll-fade-b: var(--_scroll-fade-size-b, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
54
+ }
55
+ to {
56
+ --scroll-fade-b: 0px;
57
+ }
58
+ }
59
+ @keyframes scroll-fade-reveal-s {
60
+ from {
61
+ --scroll-fade-s: 0px;
62
+ }
63
+ to {
64
+ --scroll-fade-s: var(--_scroll-fade-size-s, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
65
+ }
66
+ }
67
+ @keyframes scroll-fade-reveal-e {
68
+ from {
69
+ --scroll-fade-e: var(--_scroll-fade-size-e, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
70
+ }
71
+ to {
72
+ --scroll-fade-e: 0px;
73
+ }
74
+ }
75
+ }
76
+
77
+ @utility scroll-fade {
78
+ --_scroll-fade-size-t: var(--scroll-fade-t-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
79
+ --_scroll-fade-size-b: var(--scroll-fade-b-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
80
+ --scroll-fade-block: linear-gradient(
81
+ to bottom,
82
+ transparent 0,
83
+ #000 var(--scroll-fade-t, 0px),
84
+ #000 calc(100% - var(--scroll-fade-b, 0px)),
85
+ transparent 100%
86
+ );
87
+ -webkit-mask-image: var(--scroll-fade-mask, var(--scroll-fade-block));
88
+ mask-image: var(--scroll-fade-mask, var(--scroll-fade-block));
89
+ -webkit-mask-composite: source-in;
90
+ mask-composite: intersect;
91
+ -webkit-mask-repeat: no-repeat;
92
+ mask-repeat: no-repeat;
93
+
94
+ @supports (animation-timeline: scroll()) {
95
+ animation:
96
+ scroll-fade-reveal-t 1ms ease-in-out,
97
+ scroll-fade-reveal-b 1ms ease-in-out;
98
+ animation-timeline: scroll(self y), scroll(self y);
99
+ animation-range:
100
+ 0 var(--scroll-fade-reveal, calc(var(--spacing) * 24)),
101
+ calc(100% - var(--scroll-fade-reveal, calc(var(--spacing) * 24))) 100%;
102
+ animation-fill-mode: both;
103
+ }
104
+
105
+ @supports not (animation-timeline: scroll()) {
106
+ --scroll-fade-t: var(--_scroll-fade-size-t);
107
+ --scroll-fade-b: var(--_scroll-fade-size-b);
108
+ }
109
+ }
110
+
111
+ @utility scroll-fade-y {
112
+ --_scroll-fade-size-t: var(--scroll-fade-t-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
113
+ --_scroll-fade-size-b: var(--scroll-fade-b-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
114
+ --scroll-fade-block: linear-gradient(
115
+ to bottom,
116
+ transparent 0,
117
+ #000 var(--scroll-fade-t, 0px),
118
+ #000 calc(100% - var(--scroll-fade-b, 0px)),
119
+ transparent 100%
120
+ );
121
+ -webkit-mask-image: var(--scroll-fade-mask, var(--scroll-fade-block));
122
+ mask-image: var(--scroll-fade-mask, var(--scroll-fade-block));
123
+ -webkit-mask-composite: source-in;
124
+ mask-composite: intersect;
125
+ -webkit-mask-repeat: no-repeat;
126
+ mask-repeat: no-repeat;
127
+
128
+ @supports (animation-timeline: scroll()) {
129
+ animation:
130
+ scroll-fade-reveal-t 1ms ease-in-out,
131
+ scroll-fade-reveal-b 1ms ease-in-out;
132
+ animation-timeline: scroll(self y), scroll(self y);
133
+ animation-range:
134
+ 0 var(--scroll-fade-reveal, calc(var(--spacing) * 24)),
135
+ calc(100% - var(--scroll-fade-reveal, calc(var(--spacing) * 24))) 100%;
136
+ animation-fill-mode: both;
137
+ }
138
+
139
+ @supports not (animation-timeline: scroll()) {
140
+ --scroll-fade-t: var(--_scroll-fade-size-t);
141
+ --scroll-fade-b: var(--_scroll-fade-size-b);
142
+ }
143
+ }
144
+
145
+ @utility scroll-fade-x {
146
+ --_scroll-fade-size-s: var(--scroll-fade-s-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
147
+ --_scroll-fade-size-e: var(--scroll-fade-e-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
148
+ --scroll-fade-inline: linear-gradient(
149
+ to right,
150
+ transparent 0,
151
+ #000 var(--scroll-fade-s, 0px),
152
+ #000 calc(100% - var(--scroll-fade-e, 0px)),
153
+ transparent 100%
154
+ );
155
+ &:where([dir="rtl"], [dir="rtl"] *) {
156
+ --scroll-fade-inline: linear-gradient(
157
+ to left,
158
+ transparent 0,
159
+ #000 var(--scroll-fade-s, 0px),
160
+ #000 calc(100% - var(--scroll-fade-e, 0px)),
161
+ transparent 100%
162
+ );
163
+ }
164
+ -webkit-mask-image: var(--scroll-fade-mask, var(--scroll-fade-inline));
165
+ mask-image: var(--scroll-fade-mask, var(--scroll-fade-inline));
166
+ -webkit-mask-composite: source-in;
167
+ mask-composite: intersect;
168
+ -webkit-mask-repeat: no-repeat;
169
+ mask-repeat: no-repeat;
170
+
171
+ @supports (animation-timeline: scroll()) {
172
+ animation:
173
+ scroll-fade-reveal-s 1ms ease-in-out,
174
+ scroll-fade-reveal-e 1ms ease-in-out;
175
+ animation-timeline: scroll(self inline), scroll(self inline);
176
+ animation-range:
177
+ 0 var(--scroll-fade-reveal, calc(var(--spacing) * 24)),
178
+ calc(100% - var(--scroll-fade-reveal, calc(var(--spacing) * 24))) 100%;
179
+ animation-fill-mode: both;
180
+ }
181
+
182
+ @supports not (animation-timeline: scroll()) {
183
+ --scroll-fade-s: var(--_scroll-fade-size-s);
184
+ --scroll-fade-e: var(--_scroll-fade-size-e);
185
+ }
186
+ }
187
+
188
+ @utility scroll-fade-t {
189
+ --_scroll-fade-size-t: var(--scroll-fade-t-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
190
+ --scroll-fade-mask: linear-gradient(to bottom, transparent 0, #000 var(--scroll-fade-t, 0px), #000 100%);
191
+ -webkit-mask-image: var(--scroll-fade-mask);
192
+ mask-image: var(--scroll-fade-mask);
193
+ -webkit-mask-composite: source-in;
194
+ mask-composite: intersect;
195
+ -webkit-mask-repeat: no-repeat;
196
+ mask-repeat: no-repeat;
197
+
198
+ @supports (animation-timeline: scroll()) {
199
+ animation: scroll-fade-reveal-t 1ms ease-in-out;
200
+ animation-timeline: scroll(self y);
201
+ animation-range: 0 var(--scroll-fade-reveal, calc(var(--spacing) * 24));
202
+ animation-fill-mode: both;
203
+ }
204
+
205
+ @supports not (animation-timeline: scroll()) {
206
+ --scroll-fade-t: var(--_scroll-fade-size-t);
207
+ }
208
+ }
209
+
210
+ @utility scroll-fade-b {
211
+ --_scroll-fade-size-b: var(--scroll-fade-b-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
212
+ --scroll-fade-mask: linear-gradient(to bottom, #000 0, #000 calc(100% - var(--scroll-fade-b, 0px)), transparent 100%);
213
+ -webkit-mask-image: var(--scroll-fade-mask);
214
+ mask-image: var(--scroll-fade-mask);
215
+ -webkit-mask-composite: source-in;
216
+ mask-composite: intersect;
217
+ -webkit-mask-repeat: no-repeat;
218
+ mask-repeat: no-repeat;
219
+
220
+ @supports (animation-timeline: scroll()) {
221
+ animation: scroll-fade-reveal-b 1ms ease-in-out;
222
+ animation-timeline: scroll(self y);
223
+ animation-range: calc(100% - var(--scroll-fade-reveal, calc(var(--spacing) * 24))) 100%;
224
+ animation-fill-mode: both;
225
+ }
226
+
227
+ @supports not (animation-timeline: scroll()) {
228
+ --scroll-fade-b: var(--_scroll-fade-size-b);
229
+ }
230
+ }
231
+
232
+ @utility scroll-fade-l {
233
+ --_scroll-fade-size-s: var(--scroll-fade-s-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
234
+ --scroll-fade-mask: linear-gradient(to right, transparent 0, #000 var(--scroll-fade-s, 0px), #000 100%);
235
+ -webkit-mask-image: var(--scroll-fade-mask);
236
+ mask-image: var(--scroll-fade-mask);
237
+ -webkit-mask-composite: source-in;
238
+ mask-composite: intersect;
239
+ -webkit-mask-repeat: no-repeat;
240
+ mask-repeat: no-repeat;
241
+
242
+ @supports (animation-timeline: scroll()) {
243
+ animation: scroll-fade-reveal-s 1ms ease-in-out;
244
+ animation-timeline: scroll(self x);
245
+ animation-range: 0 var(--scroll-fade-reveal, calc(var(--spacing) * 24));
246
+ animation-fill-mode: both;
247
+ }
248
+
249
+ @supports not (animation-timeline: scroll()) {
250
+ --scroll-fade-s: var(--_scroll-fade-size-s);
251
+ }
252
+ }
253
+
254
+ @utility scroll-fade-r {
255
+ --_scroll-fade-size-e: var(--scroll-fade-e-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
256
+ --scroll-fade-mask: linear-gradient(to right, #000 0, #000 calc(100% - var(--scroll-fade-e, 0px)), transparent 100%);
257
+ -webkit-mask-image: var(--scroll-fade-mask);
258
+ mask-image: var(--scroll-fade-mask);
259
+ -webkit-mask-composite: source-in;
260
+ mask-composite: intersect;
261
+ -webkit-mask-repeat: no-repeat;
262
+ mask-repeat: no-repeat;
263
+
264
+ @supports (animation-timeline: scroll()) {
265
+ animation: scroll-fade-reveal-e 1ms ease-in-out;
266
+ animation-timeline: scroll(self x);
267
+ animation-range: calc(100% - var(--scroll-fade-reveal, calc(var(--spacing) * 24))) 100%;
268
+ animation-fill-mode: both;
269
+ }
270
+
271
+ @supports not (animation-timeline: scroll()) {
272
+ --scroll-fade-e: var(--_scroll-fade-size-e);
273
+ }
274
+ }
275
+
276
+ @utility scroll-fade-s {
277
+ --_scroll-fade-size-s: var(--scroll-fade-s-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
278
+ --scroll-fade-mask: linear-gradient(to right, transparent 0, #000 var(--scroll-fade-s, 0px), #000 100%);
279
+ &:where([dir="rtl"], [dir="rtl"] *) {
280
+ --scroll-fade-mask: linear-gradient(to left, transparent 0, #000 var(--scroll-fade-s, 0px), #000 100%);
281
+ }
282
+ -webkit-mask-image: var(--scroll-fade-mask);
283
+ mask-image: var(--scroll-fade-mask);
284
+ -webkit-mask-composite: source-in;
285
+ mask-composite: intersect;
286
+ -webkit-mask-repeat: no-repeat;
287
+ mask-repeat: no-repeat;
288
+
289
+ @supports (animation-timeline: scroll()) {
290
+ animation: scroll-fade-reveal-s 1ms ease-in-out;
291
+ animation-timeline: scroll(self inline);
292
+ animation-range: 0 var(--scroll-fade-reveal, calc(var(--spacing) * 24));
293
+ animation-fill-mode: both;
294
+ }
295
+
296
+ @supports not (animation-timeline: scroll()) {
297
+ --scroll-fade-s: var(--_scroll-fade-size-s);
298
+ }
299
+ }
300
+
301
+ @utility scroll-fade-e {
302
+ --_scroll-fade-size-e: var(--scroll-fade-e-size, var(--scroll-fade-size, min(12%, calc(var(--spacing) * 10))));
303
+ --scroll-fade-mask: linear-gradient(to right, #000 0, #000 calc(100% - var(--scroll-fade-e, 0px)), transparent 100%);
304
+ &:where([dir="rtl"], [dir="rtl"] *) {
305
+ --scroll-fade-mask: linear-gradient(to left, #000 0, #000 calc(100% - var(--scroll-fade-e, 0px)), transparent 100%);
306
+ }
307
+ -webkit-mask-image: var(--scroll-fade-mask);
308
+ mask-image: var(--scroll-fade-mask);
309
+ -webkit-mask-composite: source-in;
310
+ mask-composite: intersect;
311
+ -webkit-mask-repeat: no-repeat;
312
+ mask-repeat: no-repeat;
313
+
314
+ @supports (animation-timeline: scroll()) {
315
+ animation: scroll-fade-reveal-e 1ms ease-in-out;
316
+ animation-timeline: scroll(self inline);
317
+ animation-range: calc(100% - var(--scroll-fade-reveal, calc(var(--spacing) * 24))) 100%;
318
+ animation-fill-mode: both;
319
+ }
320
+
321
+ @supports not (animation-timeline: scroll()) {
322
+ --scroll-fade-e: var(--_scroll-fade-size-e);
323
+ }
324
+ }
325
+
326
+ @utility scroll-fade-* {
327
+ --scroll-fade-size: calc(var(--spacing) * --value(integer));
328
+ --scroll-fade-size: --value([length], [percentage]);
329
+ }
330
+
331
+ @utility scroll-fade-t-* {
332
+ --scroll-fade-t-size: calc(var(--spacing) * --value(integer));
333
+ --scroll-fade-t-size: --value([length], [percentage]);
334
+ }
335
+
336
+ @utility scroll-fade-b-* {
337
+ --scroll-fade-b-size: calc(var(--spacing) * --value(integer));
338
+ --scroll-fade-b-size: --value([length], [percentage]);
339
+ }
340
+
341
+ @utility scroll-fade-s-* {
342
+ --scroll-fade-s-size: calc(var(--spacing) * --value(integer));
343
+ --scroll-fade-s-size: --value([length], [percentage]);
344
+ }
345
+
346
+ @utility scroll-fade-e-* {
347
+ --scroll-fade-e-size: calc(var(--spacing) * --value(integer));
348
+ --scroll-fade-e-size: --value([length], [percentage]);
349
+ }
350
+
351
+ @utility scroll-fade-none {
352
+ --scroll-fade-mask: none;
353
+ }
354
+
355
+ /* shimmer */
356
+ @property --shimmer-angle {
357
+ syntax: "<angle>";
358
+ inherits: true;
359
+ initial-value: 20deg;
360
+ }
361
+ @property --shimmer-image {
362
+ syntax: "*";
363
+ inherits: false;
364
+ }
365
+ @property --shimmer-text-fill {
366
+ syntax: "*";
367
+ inherits: false;
368
+ }
369
+
370
+ @theme inline {
371
+ @keyframes tw-shimmer {
372
+ from {
373
+ background-position: 100% 0;
374
+ }
375
+ to {
376
+ background-position: 0 0;
377
+ }
378
+ }
379
+ }
380
+
381
+ @utility shimmer {
382
+ --_spread: var(--shimmer-spread, calc(3ch + 40px));
383
+ --_base: currentColor;
384
+ --_highlight: var(--shimmer-color, oklch(from currentColor l c h / calc(alpha * 0.2)));
385
+
386
+ background-image: var(
387
+ --shimmer-image,
388
+ linear-gradient(
389
+ calc(90deg + var(--shimmer-angle)),
390
+ var(--_base) calc(50% - var(--_spread)),
391
+ color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% - var(--_spread) * 0.5),
392
+ var(--_highlight) 50%,
393
+ color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% + var(--_spread) * 0.5),
394
+ var(--_base) calc(50% + var(--_spread))
395
+ )
396
+ );
397
+ background-repeat: no-repeat;
398
+ background-size: calc(200% + var(--_spread) * 2) 100%;
399
+ background-position: 0 0;
400
+ background-clip: text;
401
+ -webkit-background-clip: text;
402
+ -webkit-text-fill-color: var(--shimmer-text-fill, transparent);
403
+ animation: tw-shimmer var(--shimmer-duration, 2s) linear infinite;
404
+
405
+ @variant dark {
406
+ --_highlight: var(--shimmer-color, oklch(from currentColor max(0.8, calc(l + 0.4)) c h / calc(alpha + 0.4)));
407
+ }
408
+
409
+ &:where([dir="rtl"], [dir="rtl"] *) {
410
+ animation-direction: reverse;
411
+ }
412
+ }
413
+
414
+ @utility shimmer-once {
415
+ animation-iteration-count: 1;
416
+ }
417
+
418
+ @utility shimmer-reverse {
419
+ animation-direction: reverse;
420
+ }
421
+
422
+ @utility shimmer-none {
423
+ --shimmer-image: none;
424
+ --shimmer-text-fill: currentColor;
425
+ }
426
+
427
+ @utility shimmer-color-* {
428
+ --shimmer-color: --value(--color, [color]);
429
+ --shimmer-color: color-mix(in oklch, --value(--color, [color]) calc(--modifier(integer) * 1%), transparent);
430
+ }
431
+
432
+ @utility shimmer-duration-* {
433
+ --shimmer-duration: calc(--value(integer) * 1ms);
434
+ }
435
+
436
+ @utility shimmer-spread-* {
437
+ --shimmer-spread: calc(var(--spacing) * --value(integer));
438
+ --shimmer-spread: --value([length], [percentage]);
439
+ }
440
+
441
+ @utility shimmer-angle-* {
442
+ --shimmer-angle: calc(--value(integer) * 1deg);
443
+ }
444
+
445
+ @media (prefers-reduced-motion: reduce) {
446
+ .shimmer {
447
+ animation: none;
448
+ background-image: none;
449
+ -webkit-text-fill-color: currentColor;
450
+ }
451
+ }
@@ -3,11 +3,12 @@
3
3
  *
4
4
  * Aggregates the foundation layers in cascade order. Import this from an app
5
5
  * after `tailwindcss` and a theme to pull in @codefast/ui's variants, tokens,
6
- * motion, and base styles.
6
+ * motion, utilities, and base styles.
7
7
  * ------------------------------------------------------------------------- */
8
8
 
9
9
  @import "./foundation/source.css";
10
10
  @import "./foundation/variants.css";
11
11
  @import "./foundation/tokens.css";
12
12
  @import "./foundation/motion.css";
13
+ @import "./foundation/utilities.css";
13
14
  @import "./foundation/base.css";
@@ -8,7 +8,7 @@ import { useEffect, useRef, useState } from "react";
8
8
  *
9
9
  * @param targetValue - Target number to animate toward; null resolves to 0.
10
10
  * @param duration - Animation duration in milliseconds.
11
- * @param animate - When false, bypasses animation and sets the value directly.
11
+ * @param animated - When false, bypasses animation and sets the value directly.
12
12
  * @returns The current (rounded) animated value.
13
13
  *
14
14
  * @example
@@ -19,7 +19,7 @@ import { useEffect, useRef, useState } from "react";
19
19
  *
20
20
  * @since 0.3.16-canary.0
21
21
  */
22
- export function useAnimatedValue(targetValue: null | number, duration: number, animate?: boolean): number {
22
+ export function useAnimatedValue(targetValue: null | number, duration: number, animated?: boolean): number {
23
23
  // Default to 0 when targetValue is null
24
24
  const actualTargetValue = targetValue ?? 0;
25
25
 
@@ -34,7 +34,7 @@ export function useAnimatedValue(targetValue: null | number, duration: number, a
34
34
  }, [animatedValue]);
35
35
 
36
36
  useEffect(() => {
37
- if (!animate) {
37
+ if (!animated) {
38
38
  setAnimatedValue(actualTargetValue);
39
39
 
40
40
  return;
@@ -85,7 +85,7 @@ export function useAnimatedValue(targetValue: null | number, duration: number, a
85
85
  return (): void => {
86
86
  cancelAnimationFrame(animationFrame);
87
87
  };
88
- }, [actualTargetValue, duration, animate]);
88
+ }, [actualTargetValue, duration, animated]);
89
89
 
90
90
  return Math.round(animatedValue);
91
91
  }