Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Generator for scroll snap #569

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions __tests__/fixtures/tailwind-output.css
Original file line number Diff line number Diff line change
Expand Up @@ -4791,6 +4791,30 @@ table {
box-shadow: none;
}

.snap-x {
scroll-snap-type: x mandatory;
}

.snap-y {
scroll-snap-type: y mandatory;
}

.snap-xy {
scroll-snap-type: both mandatory;
}

.snap-start {
scroll-snap-align: start;
}

.snap-end {
scroll-snap-align: end;
}

.snap-center {
scroll-snap-align: center;
}

.fill-current {
fill: currentColor;
}
Expand Down Expand Up @@ -10368,6 +10392,30 @@ table {
box-shadow: none;
}

.sm\:snap-x {
scroll-snap-type: x mandatory;
}

.sm\:snap-y {
scroll-snap-type: y mandatory;
}

.sm\:snap-xy {
scroll-snap-type: both mandatory;
}

.sm\:snap-start {
scroll-snap-align: start;
}

.sm\:snap-end {
scroll-snap-align: end;
}

.sm\:snap-center {
scroll-snap-align: center;
}

.sm\:table-auto {
table-layout: auto;
}
Expand Down Expand Up @@ -15938,6 +15986,30 @@ table {
box-shadow: none;
}

.md\:snap-x {
scroll-snap-type: x mandatory;
}

.md\:snap-y {
scroll-snap-type: y mandatory;
}

.md\:snap-xy {
scroll-snap-type: both mandatory;
}

.md\:snap-start {
scroll-snap-align: start;
}

.md\:snap-end {
scroll-snap-align: end;
}

.md\:snap-center {
scroll-snap-align: center;
}

.md\:table-auto {
table-layout: auto;
}
Expand Down Expand Up @@ -21508,6 +21580,30 @@ table {
box-shadow: none;
}

.lg\:snap-x {
scroll-snap-type: x mandatory;
}

.lg\:snap-y {
scroll-snap-type: y mandatory;
}

.lg\:snap-xy {
scroll-snap-type: both mandatory;
}

.lg\:snap-start {
scroll-snap-align: start;
}

.lg\:snap-end {
scroll-snap-align: end;
}

.lg\:snap-center {
scroll-snap-align: center;
}

.lg\:table-auto {
table-layout: auto;
}
Expand Down Expand Up @@ -27078,6 +27174,30 @@ table {
box-shadow: none;
}

.xl\:snap-x {
scroll-snap-type: x mandatory;
}

.xl\:snap-y {
scroll-snap-type: y mandatory;
}

.xl\:snap-xy {
scroll-snap-type: both mandatory;
}

.xl\:snap-start {
scroll-snap-align: start;
}

.xl\:snap-end {
scroll-snap-align: end;
}

.xl\:snap-center {
scroll-snap-align: center;
}

.xl\:table-auto {
table-layout: auto;
}
Expand Down
1 change: 1 addition & 0 deletions defaultConfig.stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ module.exports = {
position: ['responsive'],
resize: ['responsive'],
shadows: ['responsive', 'hover', 'focus'],
snap: ['responsive'],
svgFill: [],
svgStroke: [],
tableLayout: ['responsive'],
Expand Down
12 changes: 12 additions & 0 deletions src/generators/snap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import defineClasses from '../util/defineClasses'

export default function() {
return defineClasses({
'snap-x': { 'scroll-snap-type': 'x mandatory' },
'snap-y': { 'scroll-snap-type': 'y mandatory' },
'snap-xy': { 'scroll-snap-type': 'both mandatory' },
'snap-start': { 'scroll-snap-align': 'start' },
'snap-end': { 'scroll-snap-align': 'end' },
'snap-center': { 'scroll-snap-align': 'center' },
})
}
2 changes: 2 additions & 0 deletions src/utilityModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import pointerEvents from './generators/pointerEvents'
import position from './generators/position'
import resize from './generators/resize'
import shadows from './generators/shadows'
import snap from './generators/snap'
import svgFill from './generators/svgFill'
import svgStroke from './generators/svgStroke'
import tableLayout from './generators/tableLayout'
Expand Down Expand Up @@ -82,6 +83,7 @@ export default [
{ name: 'position', generator: position },
{ name: 'resize', generator: resize },
{ name: 'shadows', generator: shadows },
{ name: 'snap', generator: snap },
{ name: 'svgFill', generator: svgFill },
{ name: 'svgStroke', generator: svgStroke },
{ name: 'tableLayout', generator: tableLayout },
Expand Down