Skip to content

Commit da0a865

Browse files
committed
feat(preset-wind4): add scrollbar gutter utilities
1 parent 8242100 commit da0a865

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎packages-presets/preset-wind4/src/rules/scrolls.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import type { Theme } from '../theme'
33
import { defineProperty, directionSize } from '../utils'
44

55
export const scrolls: Rule<Theme>[] = [
6+
['scrollbar-gutter-auto', { 'scrollbar-gutter': 'auto' }],
7+
['scrollbar-gutter-stable', { 'scrollbar-gutter': 'stable' }],
8+
['scrollbar-gutter-both', { 'scrollbar-gutter': 'stable both-edges' }],
9+
610
...['x', 'y', 'both'].map<StaticRule>(d => [
711
`snap-${d}`,
812
[

‎test/preset-wind4.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,27 @@ describe('preset-wind4', () => {
128128
await expect(css).toMatchFileSnapshot('./assets/output/preset-wind4-reset.css')
129129
})
130130

131+
it('scrollbar gutter utilities', async () => {
132+
const uno = await createGenerator({
133+
envMode: 'dev',
134+
presets: [
135+
presetWind4({ preflights: { reset: false } }),
136+
],
137+
})
138+
139+
const { css } = await uno.generate('scrollbar-gutter-auto scrollbar-gutter-stable scrollbar-gutter-both md:scrollbar-gutter-stable', { preflights: false })
140+
141+
expect(css).toMatchInlineSnapshot(`
142+
"/* layer: default */
143+
.scrollbar-gutter-auto{scrollbar-gutter:auto;}
144+
.scrollbar-gutter-stable{scrollbar-gutter:stable;}
145+
.scrollbar-gutter-both{scrollbar-gutter:stable both-edges;}
146+
@media (min-width: 48rem){
147+
.md\\:scrollbar-gutter-stable{scrollbar-gutter:stable;}
148+
}"
149+
`)
150+
})
151+
131152
it('fully theme prefight', async () => {
132153
const uno = await createGenerator({
133154
envMode: 'dev',

0 commit comments

Comments
 (0)