@@ -201,6 +201,7 @@ const config: Config = {
201201 } )
202202 } ) ,
203203 tailwindMediaHover ( ) ,
204+ scrollStartPlugin ( ) ,
204205 browserPlugin ,
205206 ] ,
206207 darkMode : [ "class" , 'html[class~="dark"]' ] ,
@@ -214,3 +215,82 @@ function tailwindMediaHover() {
214215 addVariant ( "hover-none" , "@media (hover: none)" )
215216 } )
216217}
218+
219+ function scrollStartPlugin ( ) {
220+ return plugin ( ( { addBase, matchUtilities, theme } ) => {
221+ addBase ( {
222+ "@keyframes --scroll-start-snap-y" : {
223+ to : { width : "0" } ,
224+ } ,
225+ "@keyframes --scroll-start-snap-x" : {
226+ to : { height : "0" } ,
227+ } ,
228+ } )
229+
230+ addBase ( {
231+ ".scroll-start-y" : {
232+ position : "absolute" ,
233+ width : "1px" ,
234+ top : "var(--scroll-start-y)" ,
235+ containerType : "size" ,
236+ visibility : "hidden" ,
237+ animation : "--scroll-start-snap-y 0.01s both" ,
238+ } ,
239+ ".scroll-start-y::before" : {
240+ content : '""' ,
241+ height : "1px" ,
242+ display : "block" ,
243+ } ,
244+ "@container (width: 1px)" : {
245+ ".scroll-start-y::before" : {
246+ scrollSnapAlign : "start" ,
247+ } ,
248+ } ,
249+ } )
250+
251+ addBase ( {
252+ ".scroll-start-x" : {
253+ position : "absolute" ,
254+ height : "1px" ,
255+ left : "var(--scroll-start-x)" ,
256+ containerType : "size" ,
257+ visibility : "hidden" ,
258+ animation : "--scroll-start-snap-x 0.01s both" ,
259+ } ,
260+ ".scroll-start-x::before" : {
261+ content : '""' ,
262+ width : "1px" ,
263+ display : "block" ,
264+ } ,
265+ "@container (height: 1px)" : {
266+ ".scroll-start-x::before" : {
267+ scrollSnapAlign : "start" ,
268+ } ,
269+ } ,
270+ } )
271+
272+ matchUtilities (
273+ {
274+ "scroll-start-y" : value => ( {
275+ "--scroll-start-y" : value ,
276+ } ) ,
277+ } ,
278+ {
279+ values : theme ( "spacing" ) ,
280+ type : [ "length" , "percentage" ] ,
281+ } ,
282+ )
283+
284+ matchUtilities (
285+ {
286+ "scroll-start-x" : value => ( {
287+ "--scroll-start-x" : value ,
288+ } ) ,
289+ } ,
290+ {
291+ values : theme ( "spacing" ) ,
292+ type : [ "length" , "percentage" ] ,
293+ } ,
294+ )
295+ } )
296+ }
0 commit comments