-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,508 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import plugin from 'tailwindcss/plugin'; | ||
import type { OptionalConfig } from 'tailwindcss/types/config'; | ||
|
||
export const plugins = [ | ||
plugin(({ addUtilities, matchUtilities, theme }) => { | ||
addUtilities({ | ||
'.scrollbar-thin': { | ||
'scrollbar-width': 'thin', | ||
}, | ||
}); | ||
|
||
matchUtilities( | ||
{ | ||
scrollbar: (value: string) => ({ | ||
scrollbarColor: value, | ||
}), | ||
}, | ||
{ values: theme('colors') ?? {} } | ||
); | ||
|
||
matchUtilities( | ||
{ | ||
'scrollbar-w': (value: string) => ({ | ||
'&::-webkit-scrollbar': { | ||
width: value, | ||
}, | ||
}), | ||
}, | ||
{ values: theme('spacing') ?? {} } | ||
); | ||
|
||
matchUtilities( | ||
{ | ||
'scrollbar-track': (value: string) => ({ | ||
'&::-webkit-scrollbar-track': { | ||
background: value, | ||
}, | ||
}), | ||
}, | ||
{ values: theme('colors') ?? {} } | ||
); | ||
|
||
matchUtilities( | ||
{ | ||
'scrollbar-thumb': (value: string) => ({ | ||
'&::-webkit-scrollbar-thumb': { | ||
backgroundColor: value, | ||
}, | ||
}), | ||
}, | ||
{ values: theme('colors') ?? {} } | ||
); | ||
|
||
matchUtilities( | ||
{ | ||
'scrollbar-thumb-border': (value: string) => ({ | ||
'&::-webkit-scrollbar-thumb': { | ||
borderRadius: value, | ||
}, | ||
}), | ||
}, | ||
{ values: theme('borderRadius') ?? {} } | ||
); | ||
|
||
matchUtilities( | ||
{ | ||
'scrollbar-thumb-border': (value: string) => ({ | ||
'&::-webkit-scrollbar-thumb': { | ||
borderWidth: value, | ||
}, | ||
}), | ||
}, | ||
{ values: theme('borderWidth') ?? {} } | ||
); | ||
|
||
matchUtilities( | ||
{ | ||
'scrollbar-thumb-border': (value: string) => ({ | ||
'&::-webkit-scrollbar-thumb': { | ||
borderColor: value, | ||
}, | ||
}), | ||
}, | ||
{ values: theme('borderColor') ?? {} } | ||
); | ||
}), | ||
] satisfies OptionalConfig['plugins']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { useUniqueId } from '$lib'; | ||
|
||
describe('useUniqueId', () => { | ||
it('should return a unique ID with the default prefix', () => { | ||
const first = useUniqueId(); | ||
const second = useUniqueId(); | ||
const third = useUniqueId(); | ||
|
||
expect(first.includes('uid_')).toBeTruthy(); | ||
expect(second.includes('uid_')).toBeTruthy(); | ||
expect(third.includes('uid_')).toBeTruthy(); | ||
|
||
expect(new Set([first, second, third]).size).toBe(3); | ||
}); | ||
|
||
it('should return a unique ID with the passed prefix', () => { | ||
const first = useUniqueId('test'); | ||
const second = useUniqueId('test'); | ||
const third = useUniqueId('test'); | ||
|
||
expect(first.includes('test_')).toBeTruthy(); | ||
expect(second.includes('test_')).toBeTruthy(); | ||
expect(third.includes('test_')).toBeTruthy(); | ||
|
||
expect(new Set([first, second, third]).size).toBe(3); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.