@codefast/ui 0.5.0-canary.1 → 0.5.0-canary.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.
- package/CHANGELOG.md +39 -0
- package/dist/components/attachment.d.mts +136 -0
- package/dist/components/attachment.mjs +112 -0
- package/dist/components/avatar.mjs +1 -1
- package/dist/components/bubble.d.mts +67 -0
- package/dist/components/bubble.mjs +58 -0
- package/dist/components/card.mjs +2 -2
- package/dist/components/carousel.mjs +12 -3
- package/dist/components/chart.mjs +2 -1
- package/dist/components/empty.mjs +1 -1
- package/dist/components/form.mjs +2 -1
- package/dist/components/marker.d.mts +49 -0
- package/dist/components/marker.mjs +42 -0
- package/dist/components/message-scroller.d.mts +89 -0
- package/dist/components/message-scroller.mjs +77 -0
- package/dist/components/message.d.mts +86 -0
- package/dist/components/message.mjs +66 -0
- package/dist/components/sidebar.mjs +6 -3
- package/dist/hooks/use-animated-value.mjs +3 -1
- package/dist/hooks/use-message-scroller-commands.d.mts +39 -0
- package/dist/hooks/use-message-scroller-commands.mjs +165 -0
- package/dist/hooks/use-message-scroller-controller.d.mts +19 -0
- package/dist/hooks/use-message-scroller-controller.mjs +382 -0
- package/dist/hooks/use-message-scroller-refs.d.mts +60 -0
- package/dist/hooks/use-message-scroller-refs.mjs +77 -0
- package/dist/hooks/use-pagination.mjs +18 -12
- package/dist/index.d.mts +11 -1
- package/dist/index.mjs +11 -2
- package/dist/lib/message-scroller/geometry.d.mts +136 -0
- package/dist/lib/message-scroller/geometry.mjs +199 -0
- package/dist/lib/message-scroller/stores.d.mts +21 -0
- package/dist/lib/message-scroller/stores.mjs +52 -0
- package/dist/lib/message-scroller/types.d.mts +171 -0
- package/dist/lib/message-scroller/types.mjs +53 -0
- package/dist/lib/message-scroller/utils.d.mts +7 -0
- package/dist/lib/message-scroller/utils.mjs +12 -0
- package/dist/lib/use-render.d.mts +43 -0
- package/dist/lib/use-render.mjs +84 -0
- package/dist/primitives/checkbox-group.mjs +20 -10
- package/dist/primitives/message-scroller.d.mts +88 -0
- package/dist/primitives/message-scroller.mjs +240 -0
- package/dist/variants/attachment.d.mts +42 -0
- package/dist/variants/attachment.mjs +42 -0
- package/dist/variants/bubble.d.mts +45 -0
- package/dist/variants/bubble.mjs +45 -0
- package/dist/variants/marker.d.mts +21 -0
- package/dist/variants/marker.mjs +18 -0
- package/package.json +57 -11
- package/src/components/attachment.tsx +284 -0
- package/src/components/avatar.tsx +1 -1
- package/src/components/bubble.tsx +116 -0
- package/src/components/card.tsx +2 -2
- package/src/components/carousel.tsx +12 -3
- package/src/components/empty.tsx +1 -1
- package/src/components/marker.tsx +94 -0
- package/src/components/message-scroller.tsx +213 -0
- package/src/components/message.tsx +173 -0
- package/src/components/sidebar.tsx +11 -4
- package/src/css/foundation/tokens.css +6 -18
- package/src/css/foundation/utilities.css +451 -0
- package/src/css/preset.css +2 -1
- package/src/hooks/use-message-scroller-commands.ts +312 -0
- package/src/hooks/use-message-scroller-controller.ts +651 -0
- package/src/hooks/use-message-scroller-refs.ts +168 -0
- package/src/index.ts +72 -0
- package/src/lib/message-scroller/geometry.ts +398 -0
- package/src/lib/message-scroller/stores.ts +89 -0
- package/src/lib/message-scroller/types.ts +310 -0
- package/src/lib/message-scroller/utils.ts +15 -0
- package/src/lib/use-render.ts +202 -0
- package/src/primitives/message-scroller.tsx +399 -0
- package/src/variants/attachment.ts +73 -0
- package/src/variants/bubble.ts +81 -0
- package/src/variants/marker.ts +38 -0
|
@@ -2,7 +2,7 @@ import { PanelLeftIcon } from "lucide-react";
|
|
|
2
2
|
import { Slot } from "radix-ui";
|
|
3
3
|
import { Context } from "radix-ui/internal";
|
|
4
4
|
import type { ComponentProps, CSSProperties, Dispatch, JSX, SetStateAction } from "react";
|
|
5
|
-
import { useCallback, useEffect, useState } from "react";
|
|
5
|
+
import { useCallback, useEffect, useId, useState } from "react";
|
|
6
6
|
|
|
7
7
|
import { Button } from "#/components/button";
|
|
8
8
|
import { Input } from "#/components/input";
|
|
@@ -310,7 +310,7 @@ function SidebarRail({ className, ...props }: SidebarRailProps): JSX.Element {
|
|
|
310
310
|
return (
|
|
311
311
|
<button
|
|
312
312
|
className={cn(
|
|
313
|
-
"absolute inset-y-0 z-20 hidden w-4 transition-all ease-gentle group-data-[collapsible=offcanvas]:translate-x-0 group-data-side-right:left-0 group-data-side-left:-right-4 after:absolute after:inset-y-0 after:inset-s-1/2 after:w-0.5 group-data-[collapsible=offcanvas]:after:
|
|
313
|
+
"absolute inset-y-0 z-20 hidden w-4 transition-all ease-gentle group-data-[collapsible=offcanvas]:translate-x-0 group-data-side-right:left-0 group-data-side-left:-right-4 after:absolute after:inset-y-0 after:inset-s-1/2 after:w-0.5 group-data-[collapsible=offcanvas]:after:start-full hover:group-data-[collapsible=offcanvas]:bg-sidebar hover:after:bg-sidebar-border in-data-side-right:cursor-e-resize in-data-side-left:cursor-w-resize sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2 rtl:group-data-[collapsible=offcanvas]:translate-x-0 rtl:in-data-side-right:cursor-w-resize rtl:in-data-side-left:cursor-e-resize [[data-side=left][data-collapsible=offcanvas]_&]:-right-2 [[data-side=left][data-state=collapsed]_&]:cursor-e-resize rtl:[[data-side=left][data-state=collapsed]_&]:cursor-w-resize [[data-side=right][data-collapsible=offcanvas]_&]:-left-2 [[data-side=right][data-state=collapsed]_&]:cursor-w-resize rtl:[[data-side=right][data-state=collapsed]_&]:cursor-e-resize",
|
|
314
314
|
className,
|
|
315
315
|
)}
|
|
316
316
|
data-sidebar="rail"
|
|
@@ -756,8 +756,15 @@ interface SidebarMenuSkeletonProps extends ComponentProps<"div"> {
|
|
|
756
756
|
* @since 0.3.16-canary.0
|
|
757
757
|
*/
|
|
758
758
|
function SidebarMenuSkeleton({ className, showIcon = false, ...props }: SidebarMenuSkeletonProps): JSX.Element {
|
|
759
|
-
//
|
|
760
|
-
const
|
|
759
|
+
// Varied width in 50–90%, derived from a stable useId so it matches across SSR and client (no hydration mismatch).
|
|
760
|
+
const id = useId();
|
|
761
|
+
let sum = 0;
|
|
762
|
+
|
|
763
|
+
for (const char of id) {
|
|
764
|
+
sum += char.codePointAt(0) ?? 0;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
const width = `${String((sum % 41) + 50)}%`;
|
|
761
768
|
|
|
762
769
|
return (
|
|
763
770
|
<div
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
* Typography
|
|
16
16
|
* ---------------------------------------------------------------------- */
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
/* Bridge the app-owned raw vars into the font-* utilities; fall back to sane
|
|
19
|
+
stacks so a consumer that forgets one degrades gracefully instead of
|
|
20
|
+
silently inheriting the sans font. */
|
|
21
|
+
--font-sans: var(--font-sans, ui-sans-serif, system-ui, sans-serif);
|
|
22
|
+
--font-heading: var(--font-heading, var(--font-sans, ui-sans-serif, system-ui, sans-serif));
|
|
23
|
+
--font-mono: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
|
|
21
24
|
|
|
22
25
|
/* ----------------------------------------------------------------------
|
|
23
26
|
* Surfaces & semantic colors
|
|
@@ -77,21 +80,6 @@
|
|
|
77
80
|
--color-chart-4: var(--chart-4);
|
|
78
81
|
--color-chart-5: var(--chart-5);
|
|
79
82
|
|
|
80
|
-
/* ----------------------------------------------------------------------
|
|
81
|
-
* Code & selection
|
|
82
|
-
* ---------------------------------------------------------------------- */
|
|
83
|
-
|
|
84
|
-
--color-surface: var(--surface);
|
|
85
|
-
--color-surface-foreground: var(--surface-foreground);
|
|
86
|
-
|
|
87
|
-
--color-code: var(--code);
|
|
88
|
-
--color-code-foreground: var(--code-foreground);
|
|
89
|
-
--color-code-highlight: var(--code-highlight);
|
|
90
|
-
--color-code-number: var(--code-number);
|
|
91
|
-
|
|
92
|
-
--color-selection: var(--selection);
|
|
93
|
-
--color-selection-foreground: var(--selection-foreground);
|
|
94
|
-
|
|
95
83
|
/* ----------------------------------------------------------------------
|
|
96
84
|
* Radius scale — derived from --radius (6 = base unit)
|
|
97
85
|
* ---------------------------------------------------------------------- */
|
|
@@ -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 shadcn-ui/ui packages/shadcn/src/tailwind.css (scroll-fade,
|
|
13
|
+
* shimmer). Keep 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
|
+
}
|
package/src/css/preset.css
CHANGED
|
@@ -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";
|