Replace special handling of 'default' with 'DEFAULT'

This commit is contained in:
Adam Wathan 2020-10-15 16:26:34 -04:00
parent ddd017cb38
commit e897e40189
17 changed files with 27 additions and 27 deletions

View File

@ -217,7 +217,7 @@ test('responsive horizontal padding can be included by default', () => {
},
container: {
padding: {
default: '1rem',
DEFAULT: '1rem',
sm: '2rem',
lg: '4rem',
xl: '5rem',

View File

@ -8,7 +8,7 @@ test('it flattens nested color objects', () => {
25: 'rgba(255,255,255,.25)',
50: 'rgba(255,255,255,.5)',
75: 'rgba(255,255,255,.75)',
default: '#fff',
DEFAULT: '#fff',
},
red: {
1: 'rgb(33,0,0)',

View File

@ -2,13 +2,13 @@ import _ from 'lodash'
import escapeClassName from '../../src/util/escapeClassName'
import plugin from '../../src/plugins/boxShadow'
test('box shadow can use default keyword and negative prefix syntax', () => {
test('box shadow can use DEFAULT keyword and negative prefix syntax', () => {
const addedUtilities = []
const config = {
theme: {
boxShadow: {
default: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
DEFAULT: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
'-': 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)',
'-md': '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',

View File

@ -5,7 +5,7 @@ test('generating divide width utilities', () => {
const config = {
theme: {
divideWidth: {
default: '1px',
DEFAULT: '1px',
'0': '0',
'2': '2px',
'4': '4px',

View File

@ -20,7 +20,7 @@ export default function() {
}
const utilities = _.fromPairs(
_.map(_.omit(colors, 'default'), (value, modifier) => {
_.map(_.omit(colors, 'DEFAULT'), (value, modifier) => {
return [`.${e(`border-${modifier}`)}`, getProperties(value)]
})
)

View File

@ -34,7 +34,7 @@ export default function() {
const utilities = _.flatMap(generators, generator => {
return _.flatMap(theme('borderRadius'), (value, modifier) => {
return generator(value, modifier === 'default' ? '' : `-${modifier}`)
return generator(value, modifier === 'DEFAULT' ? '' : `-${modifier}`)
})
})

View File

@ -16,7 +16,7 @@ export default function() {
const utilities = _.flatMap(generators, generator => {
return _.flatMap(theme('borderWidth'), (value, modifier) => {
return generator(value, modifier === 'default' ? '' : `-${modifier}`)
return generator(value, modifier === 'DEFAULT' ? '' : `-${modifier}`)
})
})

View File

@ -6,7 +6,7 @@ export default function() {
const utilities = _.fromPairs(
_.map(theme('boxShadow'), (value, modifier) => {
const className =
modifier === 'default' ? 'shadow' : `${e(prefixNegativeModifiers('shadow', modifier))}`
modifier === 'DEFAULT' ? 'shadow' : `${e(prefixNegativeModifiers('shadow', modifier))}`
return [
`.${className}`,
{

View File

@ -30,7 +30,7 @@ function mapMinWidthsToPadding(minWidths, screens, paddings) {
if (!_.isObject(paddings)) {
return [
{
screen: 'default',
screen: 'DEFAULT',
minWidth: 0,
padding: paddings,
},
@ -39,11 +39,11 @@ function mapMinWidthsToPadding(minWidths, screens, paddings) {
const mapping = []
if (paddings.default) {
if (paddings.DEFAULT) {
mapping.push({
screen: 'default',
screen: 'DEFAULT',
minWidth: 0,
padding: paddings.default,
padding: paddings.DEFAULT,
})
}

View File

@ -99,7 +99,7 @@ html {
box-sizing: border-box; /* 1 */
border-width: 0; /* 2 */
border-style: solid; /* 2 */
border-color: theme('borderColor.default', currentColor); /* 2 */
border-color: theme('borderColor.DEFAULT', currentColor); /* 2 */
}
/*

View File

@ -20,7 +20,7 @@ export default function() {
}
const utilities = _.fromPairs(
_.map(_.omit(colors, 'default'), (value, modifier) => {
_.map(_.omit(colors, 'DEFAULT'), (value, modifier) => {
return [
`.${e(`divide-${modifier}`)} > :not(template) ~ :not(template)`,
getProperties(value),

View File

@ -24,7 +24,7 @@ export default function() {
const utilities = _.flatMap(generators, generator => {
return [
..._.flatMap(theme('divideWidth'), (value, modifier) => {
return generator(value, modifier === 'default' ? '' : `-${modifier}`)
return generator(value, modifier === 'DEFAULT' ? '' : `-${modifier}`)
}),
{
'.divide-y-reverse > :not(template) ~ :not(template)': {

View File

@ -5,7 +5,7 @@ export default function() {
addUtilities(
_.fromPairs(
_.map(theme('flexGrow'), (value, modifier) => {
const className = modifier === 'default' ? 'flex-grow' : `flex-grow-${modifier}`
const className = modifier === 'DEFAULT' ? 'flex-grow' : `flex-grow-${modifier}`
return [
`.${e(className)}`,
{

View File

@ -5,7 +5,7 @@ export default function() {
addUtilities(
_.fromPairs(
_.map(theme('flexShrink'), (value, modifier) => {
const className = modifier === 'default' ? 'flex-shrink' : `flex-shrink-${modifier}`
const className = modifier === 'DEFAULT' ? 'flex-shrink' : `flex-shrink-${modifier}`
return [
`.${e(className)}`,
{

View File

@ -4,7 +4,7 @@ import toPairs from 'lodash/toPairs'
import castArray from 'lodash/castArray'
function className(classPrefix, key) {
if (key === 'default') {
if (key === 'DEFAULT') {
return classPrefix
}

View File

@ -8,7 +8,7 @@ export default function flattenColorPalette(colors) {
}
return _.map(color, (value, key) => {
const suffix = key === 'default' ? '' : `-${key}`
const suffix = key === 'DEFAULT' ? '' : `-${key}`
return [`${name}${suffix}`, value]
})
})

View File

@ -182,13 +182,13 @@ module.exports = {
},
borderColor: theme => ({
...theme('colors'),
default: theme('colors.gray.300', 'currentColor'),
DEFAULT: theme('colors.gray.300', 'currentColor'),
}),
borderOpacity: theme => theme('opacity'),
borderRadius: {
none: '0',
sm: '0.125rem',
default: '0.25rem',
DEFAULT: '0.25rem',
md: '0.375rem',
lg: '0.5rem',
xl: '0.75rem',
@ -197,7 +197,7 @@ module.exports = {
full: '9999px',
},
borderWidth: {
default: '1px',
DEFAULT: '1px',
'0': '0',
'2': '2px',
'4': '4px',
@ -206,7 +206,7 @@ module.exports = {
boxShadow: {
xs: '0 0 0 1px rgba(0, 0, 0, 0.05)',
sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
default: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
DEFAULT: '0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
md: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
@ -239,11 +239,11 @@ module.exports = {
},
flexGrow: {
'0': '0',
default: '1',
DEFAULT: '1',
},
flexShrink: {
'0': '0',
default: '1',
DEFAULT: '1',
},
fontFamily: {
sans: [
@ -638,7 +638,7 @@ module.exports = {
transitionProperty: {
none: 'none',
all: 'all',
default: 'background-color, border-color, color, fill, stroke, opacity, box-shadow, transform',
DEFAULT: 'background-color, border-color, color, fill, stroke, opacity, box-shadow, transform',
colors: 'background-color, border-color, color, fill, stroke',
opacity: 'opacity',
shadow: 'box-shadow',