Add combinable touch-action support (#6115)
* add combinable `touch-action` support * update changelog
This commit is contained in:
parent
ef325ea35b
commit
03f9de9008
4 changed files with 71 additions and 9 deletions
|
|
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Add `placeholder` variant ([#6106](https://github.com/tailwindlabs/tailwindcss/pull/6106))
|
||||
- Add tuple syntax for configuring screens while guaranteeing order ([#5956](https://github.com/tailwindlabs/tailwindcss/pull/5956))
|
||||
- Add combinable `touch-action` support ([#6115](https://github.com/tailwindlabs/tailwindcss/pull/6115))
|
||||
|
||||
## [3.0.0-alpha.2] - 2021-11-08
|
||||
|
||||
|
|
|
|||
|
|
@ -602,17 +602,54 @@ export let corePlugins = {
|
|||
|
||||
cursor: createUtilityPlugin('cursor'),
|
||||
|
||||
touchAction: ({ addUtilities }) => {
|
||||
touchAction: ({ addBase, addUtilities }) => {
|
||||
addBase({
|
||||
'@defaults touch-action': {
|
||||
'--tw-pan-x': 'var(--tw-empty,/*!*/ /*!*/)',
|
||||
'--tw-pan-y': 'var(--tw-empty,/*!*/ /*!*/)',
|
||||
'--tw-pinch-zoom': 'var(--tw-empty,/*!*/ /*!*/)',
|
||||
'--tw-touch-action': 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)',
|
||||
},
|
||||
})
|
||||
|
||||
addUtilities({
|
||||
'.touch-auto': { 'touch-action': 'auto' },
|
||||
'.touch-none': { 'touch-action': 'none' },
|
||||
'.touch-pan-x': { 'touch-action': 'pan-x' },
|
||||
'.touch-pan-left': { 'touch-action': 'pan-left' },
|
||||
'.touch-pan-right': { 'touch-action': 'pan-right' },
|
||||
'.touch-pan-y': { 'touch-action': 'pan-y' },
|
||||
'.touch-pan-up': { 'touch-action': 'pan-up' },
|
||||
'.touch-pan-down': { 'touch-action': 'pan-down' },
|
||||
'.touch-pinch-zoom': { 'touch-action': 'pinch-zoom' },
|
||||
'.touch-pan-x': {
|
||||
'@defaults touch-action': {},
|
||||
'--tw-pan-x': 'pan-x',
|
||||
'touch-action': 'var(--tw-touch-action)',
|
||||
},
|
||||
'.touch-pan-left': {
|
||||
'@defaults touch-action': {},
|
||||
'--tw-pan-x': 'pan-left',
|
||||
'touch-action': 'var(--tw-touch-action)',
|
||||
},
|
||||
'.touch-pan-right': {
|
||||
'@defaults touch-action': {},
|
||||
'--tw-pan-x': 'pan-right',
|
||||
'touch-action': 'var(--tw-touch-action)',
|
||||
},
|
||||
'.touch-pan-y': {
|
||||
'@defaults touch-action': {},
|
||||
'--tw-pan-y': 'pan-y',
|
||||
'touch-action': 'var(--tw-touch-action)',
|
||||
},
|
||||
'.touch-pan-up': {
|
||||
'@defaults touch-action': {},
|
||||
'--tw-pan-y': 'pan-up',
|
||||
'touch-action': 'var(--tw-touch-action)',
|
||||
},
|
||||
'.touch-pan-down': {
|
||||
'@defaults touch-action': {},
|
||||
'--tw-pan-y': 'pan-down',
|
||||
'touch-action': 'var(--tw-touch-action)',
|
||||
},
|
||||
'.touch-pinch-zoom': {
|
||||
'@defaults touch-action': {},
|
||||
'--tw-pinch-zoom': 'pinch-zoom',
|
||||
'touch-action': 'var(--tw-touch-action)',
|
||||
},
|
||||
'.touch-manipulation': { 'touch-action': 'manipulation' },
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@
|
|||
scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
||||
}
|
||||
|
||||
.touch-pan-x,
|
||||
.touch-pan-y,
|
||||
.touch-pan-up,
|
||||
.touch-pinch-zoom {
|
||||
--tw-pan-x: var(--tw-empty, /*!*/ /*!*/);
|
||||
--tw-pan-y: var(--tw-empty, /*!*/ /*!*/);
|
||||
--tw-pinch-zoom: var(--tw-empty, /*!*/ /*!*/);
|
||||
--tw-touch-action: var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom);
|
||||
}
|
||||
|
||||
.snap-x {
|
||||
--tw-scroll-snap-strictness: proximity;
|
||||
}
|
||||
|
|
@ -374,8 +384,21 @@
|
|||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
.touch-pan-x {
|
||||
--tw-pan-x: pan-x;
|
||||
touch-action: var(--tw-touch-action);
|
||||
}
|
||||
.touch-pan-y {
|
||||
touch-action: pan-y;
|
||||
--tw-pan-y: pan-y;
|
||||
touch-action: var(--tw-touch-action);
|
||||
}
|
||||
.touch-pan-up {
|
||||
--tw-pan-y: pan-up;
|
||||
touch-action: var(--tw-touch-action);
|
||||
}
|
||||
.touch-pinch-zoom {
|
||||
--tw-pinch-zoom: pinch-zoom;
|
||||
touch-action: var(--tw-touch-action);
|
||||
}
|
||||
.touch-manipulation {
|
||||
touch-action: manipulation;
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@
|
|||
<div class="transition transition-all"></div>
|
||||
<div class="ease-in-out"></div>
|
||||
<div class="translate-x-5 -translate-x-4 translate-y-6 -translate-x-3"></div>
|
||||
<div class="touch-pan-up touch-pan-x touch-pinch-zoom"></div>
|
||||
<div class="select-none"></div>
|
||||
<div class="align-middle"></div>
|
||||
<div class="invisible"></div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue