When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:
main {
max-width: 38rem;
padding: 2rem;
margin: auto;
}
export default scope => { | |
// match the filter on autofilled elements in Firefox | |
const mozFilterMatch = /^grayscale\(.+\) brightness\((1)?.*\) contrast\(.+\) invert\(.+\) sepia\(.+\) saturate\(.+\)$/ | |
scope.addEventListener('animationstart', onAnimationStart) | |
scope.addEventListener('input', onInput) | |
scope.addEventListener('transitionstart', onTransitionStart) | |
function onAnimationStart(event) { | |
// detect autofills in Chrome and Safari by: |
// Creates a new promise that automatically resolves after some timeout: | |
Promise.delay = function (time) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, time) | |
}) | |
} | |
// Throttle this promise to resolve no faster than the specified time: | |
Promise.prototype.takeAtLeast = function (time) { | |
return new Promise((resolve, reject) => { |
@mixin over($mobile-touch-class:false) { | |
html.no-touch & { | |
&:hover, | |
&:focus { | |
@content; | |
} | |
} | |
html.touch & { | |
@if $mobile-touch-class { | |
&.#{$mobile-touch-class} { |