tailwindcss 3.0.0-alpha.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +59 -2
  2. package/colors.js +2 -1
  3. package/defaultConfig.js +2 -1
  4. package/defaultTheme.js +2 -1
  5. package/lib/cli.js +58 -58
  6. package/lib/corePluginList.js +3 -0
  7. package/lib/corePlugins.js +227 -172
  8. package/lib/css/preflight.css +5 -3
  9. package/lib/featureFlags.js +3 -1
  10. package/lib/lib/detectNesting.js +17 -2
  11. package/lib/lib/evaluateTailwindFunctions.js +6 -2
  12. package/lib/lib/expandApplyAtRules.js +23 -6
  13. package/lib/lib/expandTailwindAtRules.js +19 -1
  14. package/lib/lib/generateRules.js +54 -0
  15. package/lib/lib/resolveDefaultsAtRules.js +23 -9
  16. package/lib/lib/setupContextUtils.js +48 -71
  17. package/lib/lib/substituteScreenAtRules.js +7 -4
  18. package/lib/util/buildMediaQuery.js +13 -24
  19. package/lib/util/dataTypes.js +14 -3
  20. package/lib/util/defaults.js +6 -0
  21. package/lib/util/formatVariantSelector.js +88 -4
  22. package/lib/util/isValidArbitraryValue.js +64 -0
  23. package/lib/util/log.js +4 -0
  24. package/lib/util/nameClass.js +1 -0
  25. package/lib/util/normalizeConfig.js +34 -5
  26. package/lib/util/normalizeScreens.js +61 -0
  27. package/lib/util/resolveConfig.js +8 -8
  28. package/package.json +14 -13
  29. package/peers/index.js +3739 -3027
  30. package/plugin.js +2 -1
  31. package/resolveConfig.js +2 -1
  32. package/src/corePluginList.js +1 -1
  33. package/src/corePlugins.js +205 -165
  34. package/src/css/preflight.css +5 -3
  35. package/src/featureFlags.js +5 -1
  36. package/src/lib/detectNesting.js +22 -3
  37. package/src/lib/evaluateTailwindFunctions.js +5 -2
  38. package/src/lib/expandApplyAtRules.js +29 -2
  39. package/src/lib/expandTailwindAtRules.js +18 -0
  40. package/src/lib/generateRules.js +57 -0
  41. package/src/lib/resolveDefaultsAtRules.js +28 -7
  42. package/src/lib/setupContextUtils.js +45 -64
  43. package/src/lib/substituteScreenAtRules.js +6 -3
  44. package/src/util/buildMediaQuery.js +14 -18
  45. package/src/util/dataTypes.js +11 -6
  46. package/src/util/defaults.js +6 -0
  47. package/src/util/formatVariantSelector.js +92 -1
  48. package/src/util/isValidArbitraryValue.js +61 -0
  49. package/src/util/log.js +4 -0
  50. package/src/util/nameClass.js +1 -1
  51. package/src/util/normalizeConfig.js +14 -1
  52. package/src/util/normalizeScreens.js +45 -0
  53. package/stubs/defaultConfig.stub.js +17 -0
package/plugin.js CHANGED
@@ -1 +1,2 @@
1
- module.exports = require('./lib/public/create-plugin').default
1
+ let createPlugin = require('./lib/public/create-plugin')
2
+ module.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default
package/resolveConfig.js CHANGED
@@ -1 +1,2 @@
1
- module.exports = require('./lib/public/resolve-config').default
1
+ let resolveConfig = require('./lib/public/resolve-config')
2
+ module.exports = (resolveConfig.__esModule ? resolveConfig : { default: resolveConfig }).default
@@ -1 +1 @@
1
- export default ["preflight","container","accessibility","pointerEvents","visibility","position","inset","isolation","zIndex","order","gridColumn","gridColumnStart","gridColumnEnd","gridRow","gridRowStart","gridRowEnd","float","clear","margin","boxSizing","display","aspectRatio","height","maxHeight","minHeight","width","minWidth","maxWidth","flex","flexShrink","flexGrow","flexBasis","tableLayout","borderCollapse","transformOrigin","translate","rotate","skew","scale","transform","animation","cursor","touchAction","userSelect","resize","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollMargin","scrollPadding","listStylePosition","listStyleType","appearance","columns","breakBefore","breakInside","breakAfter","gridAutoColumns","gridAutoFlow","gridAutoRows","gridTemplateColumns","gridTemplateRows","flexDirection","flexWrap","placeContent","placeItems","alignContent","alignItems","justifyContent","justifyItems","gap","space","divideWidth","divideStyle","divideColor","divideOpacity","placeSelf","alignSelf","justifySelf","overflow","overscrollBehavior","scrollBehavior","textOverflow","whitespace","wordBreak","borderRadius","borderWidth","borderStyle","borderColor","borderOpacity","backgroundColor","backgroundOpacity","backgroundImage","gradientColorStops","boxDecorationBreak","backgroundSize","backgroundAttachment","backgroundClip","backgroundPosition","backgroundRepeat","backgroundOrigin","fill","stroke","strokeWidth","objectFit","objectPosition","padding","textAlign","textIndent","verticalAlign","fontFamily","fontSize","fontWeight","textTransform","fontStyle","fontVariantNumeric","lineHeight","letterSpacing","textColor","textOpacity","textDecoration","textDecorationColor","fontSmoothing","placeholderColor","placeholderOpacity","caretColor","accentColor","opacity","backgroundBlendMode","mixBlendMode","boxShadow","boxShadowColor","outlineStyle","outlineWidth","outlineOffset","outlineColor","ringWidth","ringColor","ringOpacity","ringOffsetWidth","ringOffsetColor","blur","brightness","contrast","dropShadow","grayscale","hueRotate","invert","saturate","sepia","filter","backdropBlur","backdropBrightness","backdropContrast","backdropGrayscale","backdropHueRotate","backdropInvert","backdropOpacity","backdropSaturate","backdropSepia","backdropFilter","transitionProperty","transitionDelay","transitionDuration","transitionTimingFunction","willChange","content"]
1
+ export default ["preflight","container","accessibility","pointerEvents","visibility","position","inset","isolation","zIndex","order","gridColumn","gridColumnStart","gridColumnEnd","gridRow","gridRowStart","gridRowEnd","float","clear","margin","boxSizing","display","aspectRatio","height","maxHeight","minHeight","width","minWidth","maxWidth","flex","flexShrink","flexGrow","flexBasis","tableLayout","borderCollapse","transformOrigin","translate","rotate","skew","scale","transform","animation","cursor","touchAction","userSelect","resize","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollMargin","scrollPadding","listStylePosition","listStyleType","appearance","columns","breakBefore","breakInside","breakAfter","gridAutoColumns","gridAutoFlow","gridAutoRows","gridTemplateColumns","gridTemplateRows","flexDirection","flexWrap","placeContent","placeItems","alignContent","alignItems","justifyContent","justifyItems","gap","space","divideWidth","divideStyle","divideColor","divideOpacity","placeSelf","alignSelf","justifySelf","overflow","overscrollBehavior","scrollBehavior","textOverflow","whitespace","wordBreak","borderRadius","borderWidth","borderStyle","borderColor","borderOpacity","backgroundColor","backgroundOpacity","backgroundImage","gradientColorStops","boxDecorationBreak","backgroundSize","backgroundAttachment","backgroundClip","backgroundPosition","backgroundRepeat","backgroundOrigin","fill","stroke","strokeWidth","objectFit","objectPosition","padding","textAlign","textIndent","verticalAlign","fontFamily","fontSize","fontWeight","textTransform","fontStyle","fontVariantNumeric","lineHeight","letterSpacing","textColor","textOpacity","textDecoration","textDecorationColor","textDecorationStyle","textDecorationThickness","textUnderlineOffset","fontSmoothing","placeholderColor","placeholderOpacity","caretColor","accentColor","opacity","backgroundBlendMode","mixBlendMode","boxShadow","boxShadowColor","outlineStyle","outlineWidth","outlineOffset","outlineColor","ringWidth","ringColor","ringOpacity","ringOffsetWidth","ringOffsetColor","blur","brightness","contrast","dropShadow","grayscale","hueRotate","invert","saturate","sepia","filter","backdropBlur","backdropBrightness","backdropContrast","backdropGrayscale","backdropHueRotate","backdropInvert","backdropOpacity","backdropSaturate","backdropSepia","backdropFilter","transitionProperty","transitionDelay","transitionDuration","transitionTimingFunction","willChange","content"]
@@ -11,6 +11,7 @@ import isPlainObject from './util/isPlainObject'
11
11
  import transformThemeValue from './util/transformThemeValue'
12
12
  import { version as tailwindVersion } from '../package.json'
13
13
  import log from './util/log'
14
+ import { normalizeScreens } from './util/normalizeScreens'
14
15
  import { formatBoxShadowValue, parseBoxShadowValue } from './util/parseBoxShadowValue'
15
16
 
16
17
  export let variantPlugins = {
@@ -23,6 +24,8 @@ export let variantPlugins = {
23
24
 
24
25
  addVariant('file', '&::file-selector-button')
25
26
 
27
+ addVariant('placeholder', '&::placeholder')
28
+
26
29
  addVariant('before', ({ container }) => {
27
30
  container.walkRules((rule) => {
28
31
  let foundContent = false
@@ -156,13 +159,17 @@ export let variantPlugins = {
156
159
  },
157
160
 
158
161
  screenVariants: ({ theme, addVariant }) => {
159
- for (let screen in theme('screens')) {
160
- let size = theme('screens')[screen]
161
- let query = buildMediaQuery(size)
162
+ for (let screen of normalizeScreens(theme('screens'))) {
163
+ let query = buildMediaQuery(screen)
162
164
 
163
- addVariant(screen, `@media ${query}`)
165
+ addVariant(screen.name, `@media ${query}`)
164
166
  }
165
167
  },
168
+
169
+ orientationVariants: ({ addVariant }) => {
170
+ addVariant('portrait', '@media (orientation: portrait)')
171
+ addVariant('landscape', '@media (orientation: landscape)')
172
+ },
166
173
  }
167
174
 
168
175
  export let corePlugins = {
@@ -180,24 +187,10 @@ export let corePlugins = {
180
187
  },
181
188
 
182
189
  container: (() => {
183
- function extractMinWidths(breakpoints) {
184
- return Object.values(breakpoints ?? {}).flatMap((breakpoints) => {
185
- if (typeof breakpoints === 'string') {
186
- breakpoints = { min: breakpoints }
187
- }
188
-
189
- if (!Array.isArray(breakpoints)) {
190
- breakpoints = [breakpoints]
191
- }
192
-
193
- return breakpoints
194
- .filter((breakpoint) => {
195
- return breakpoint?.hasOwnProperty?.('min') || breakpoint?.hasOwnProperty('min-width')
196
- })
197
- .map((breakpoint) => {
198
- return breakpoint['min-width'] ?? breakpoint.min
199
- })
200
- })
190
+ function extractMinWidths(breakpoints = []) {
191
+ return breakpoints
192
+ .flatMap((breakpoint) => breakpoint.values.map((breakpoint) => breakpoint.min))
193
+ .filter((v) => v !== undefined)
201
194
  }
202
195
 
203
196
  function mapMinWidthsToPadding(minWidths, screens, paddings) {
@@ -226,16 +219,11 @@ export let corePlugins = {
226
219
  }
227
220
 
228
221
  for (let minWidth of minWidths) {
229
- for (let [screen, value] of Object.entries(screens)) {
230
- let screenMinWidth =
231
- typeof value === 'object' && value !== null ? value.min || value['min-width'] : value
232
-
233
- if (`${screenMinWidth}` === `${minWidth}`) {
234
- mapping.push({
235
- screen,
236
- minWidth,
237
- padding: paddings[screen],
238
- })
222
+ for (let screen of screens) {
223
+ for (let { min } of screen.values) {
224
+ if (min === minWidth) {
225
+ mapping.push({ minWidth, padding: paddings[screen.name] })
226
+ }
239
227
  }
240
228
  }
241
229
  }
@@ -244,12 +232,12 @@ export let corePlugins = {
244
232
  }
245
233
 
246
234
  return function ({ addComponents, theme }) {
247
- let screens = theme('container.screens', theme('screens'))
235
+ let screens = normalizeScreens(theme('container.screens', theme('screens')))
248
236
  let minWidths = extractMinWidths(screens)
249
237
  let paddings = mapMinWidthsToPadding(minWidths, screens, theme('container.padding'))
250
238
 
251
239
  let generatePaddingFor = (minWidth) => {
252
- let paddingConfig = paddings.find((padding) => `${padding.minWidth}` === `${minWidth}`)
240
+ let paddingConfig = paddings.find((padding) => padding.minWidth === minWidth)
253
241
 
254
242
  if (!paddingConfig) {
255
243
  return {}
@@ -515,49 +503,52 @@ export let corePlugins = {
515
503
  ],
516
504
  { supportsNegativeValues: true }
517
505
  ),
518
- scale: createUtilityPlugin('scale', [
519
- [
520
- 'scale',
521
- [
522
- ['@defaults transform', {}],
523
- '--tw-scale-x',
524
- '--tw-scale-y',
525
- ['transform', 'var(--tw-transform)'],
526
- ],
527
- ],
506
+ scale: createUtilityPlugin(
507
+ 'scale',
528
508
  [
529
509
  [
530
- 'scale-x',
531
- [['@defaults transform', {}], '--tw-scale-x', ['transform', 'var(--tw-transform)']],
510
+ 'scale',
511
+ [
512
+ ['@defaults transform', {}],
513
+ '--tw-scale-x',
514
+ '--tw-scale-y',
515
+ ['transform', 'var(--tw-transform)'],
516
+ ],
532
517
  ],
533
518
  [
534
- 'scale-y',
535
- [['@defaults transform', {}], '--tw-scale-y', ['transform', 'var(--tw-transform)']],
519
+ [
520
+ 'scale-x',
521
+ [['@defaults transform', {}], '--tw-scale-x', ['transform', 'var(--tw-transform)']],
522
+ ],
523
+ [
524
+ 'scale-y',
525
+ [['@defaults transform', {}], '--tw-scale-y', ['transform', 'var(--tw-transform)']],
526
+ ],
536
527
  ],
537
528
  ],
538
- ]),
529
+ { supportsNegativeValues: true }
530
+ ),
539
531
 
540
- transform: ({ addBase, addUtilities }) => {
541
- addBase({
542
- '@defaults transform': {
543
- '--tw-translate-x': '0',
544
- '--tw-translate-y': '0',
545
- '--tw-rotate': '0',
546
- '--tw-skew-x': '0',
547
- '--tw-skew-y': '0',
548
- '--tw-scale-x': '1',
549
- '--tw-scale-y': '1',
550
- '--tw-transform': [
551
- 'translateX(var(--tw-translate-x))',
552
- 'translateY(var(--tw-translate-y))',
553
- 'rotate(var(--tw-rotate))',
554
- 'skewX(var(--tw-skew-x))',
555
- 'skewY(var(--tw-skew-y))',
556
- 'scaleX(var(--tw-scale-x))',
557
- 'scaleY(var(--tw-scale-y))',
558
- ].join(' '),
559
- },
532
+ transform: ({ addDefaults, addUtilities }) => {
533
+ addDefaults('transform', {
534
+ '--tw-translate-x': '0',
535
+ '--tw-translate-y': '0',
536
+ '--tw-rotate': '0',
537
+ '--tw-skew-x': '0',
538
+ '--tw-skew-y': '0',
539
+ '--tw-scale-x': '1',
540
+ '--tw-scale-y': '1',
541
+ '--tw-transform': [
542
+ 'translateX(var(--tw-translate-x))',
543
+ 'translateY(var(--tw-translate-y))',
544
+ 'rotate(var(--tw-rotate))',
545
+ 'skewX(var(--tw-skew-x))',
546
+ 'skewY(var(--tw-skew-y))',
547
+ 'scaleX(var(--tw-scale-x))',
548
+ 'scaleY(var(--tw-scale-y))',
549
+ ].join(' '),
560
550
  })
551
+
561
552
  addUtilities({
562
553
  '.transform': { '@defaults transform': {}, transform: 'var(--tw-transform)' },
563
554
  '.transform-cpu': {
@@ -619,17 +610,52 @@ export let corePlugins = {
619
610
 
620
611
  cursor: createUtilityPlugin('cursor'),
621
612
 
622
- touchAction: ({ addUtilities }) => {
613
+ touchAction: ({ addDefaults, addUtilities }) => {
614
+ addDefaults('touch-action', {
615
+ '--tw-pan-x': 'var(--tw-empty,/*!*/ /*!*/)',
616
+ '--tw-pan-y': 'var(--tw-empty,/*!*/ /*!*/)',
617
+ '--tw-pinch-zoom': 'var(--tw-empty,/*!*/ /*!*/)',
618
+ '--tw-touch-action': 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)',
619
+ })
620
+
623
621
  addUtilities({
624
622
  '.touch-auto': { 'touch-action': 'auto' },
625
623
  '.touch-none': { 'touch-action': 'none' },
626
- '.touch-pan-x': { 'touch-action': 'pan-x' },
627
- '.touch-pan-left': { 'touch-action': 'pan-left' },
628
- '.touch-pan-right': { 'touch-action': 'pan-right' },
629
- '.touch-pan-y': { 'touch-action': 'pan-y' },
630
- '.touch-pan-up': { 'touch-action': 'pan-up' },
631
- '.touch-pan-down': { 'touch-action': 'pan-down' },
632
- '.touch-pinch-zoom': { 'touch-action': 'pinch-zoom' },
624
+ '.touch-pan-x': {
625
+ '@defaults touch-action': {},
626
+ '--tw-pan-x': 'pan-x',
627
+ 'touch-action': 'var(--tw-touch-action)',
628
+ },
629
+ '.touch-pan-left': {
630
+ '@defaults touch-action': {},
631
+ '--tw-pan-x': 'pan-left',
632
+ 'touch-action': 'var(--tw-touch-action)',
633
+ },
634
+ '.touch-pan-right': {
635
+ '@defaults touch-action': {},
636
+ '--tw-pan-x': 'pan-right',
637
+ 'touch-action': 'var(--tw-touch-action)',
638
+ },
639
+ '.touch-pan-y': {
640
+ '@defaults touch-action': {},
641
+ '--tw-pan-y': 'pan-y',
642
+ 'touch-action': 'var(--tw-touch-action)',
643
+ },
644
+ '.touch-pan-up': {
645
+ '@defaults touch-action': {},
646
+ '--tw-pan-y': 'pan-up',
647
+ 'touch-action': 'var(--tw-touch-action)',
648
+ },
649
+ '.touch-pan-down': {
650
+ '@defaults touch-action': {},
651
+ '--tw-pan-y': 'pan-down',
652
+ 'touch-action': 'var(--tw-touch-action)',
653
+ },
654
+ '.touch-pinch-zoom': {
655
+ '@defaults touch-action': {},
656
+ '--tw-pinch-zoom': 'pinch-zoom',
657
+ 'touch-action': 'var(--tw-touch-action)',
658
+ },
633
659
  '.touch-manipulation': { 'touch-action': 'manipulation' },
634
660
  })
635
661
  },
@@ -652,11 +678,9 @@ export let corePlugins = {
652
678
  })
653
679
  },
654
680
 
655
- scrollSnapType: ({ addUtilities, addBase }) => {
656
- addBase({
657
- '@defaults scroll-snap-type': {
658
- '--tw-scroll-snap-strictness': 'proximity',
659
- },
681
+ scrollSnapType: ({ addDefaults, addUtilities }) => {
682
+ addDefaults('scroll-snap-type', {
683
+ '--tw-scroll-snap-strictness': 'proximity',
660
684
  })
661
685
 
662
686
  addUtilities({
@@ -1153,22 +1177,21 @@ export let corePlugins = {
1153
1177
  })
1154
1178
  },
1155
1179
 
1156
- borderColor: ({ addBase, matchUtilities, theme, corePlugins }) => {
1180
+ borderColor: ({ addDefaults, matchUtilities, theme, corePlugins }) => {
1157
1181
  if (!corePlugins('borderOpacity')) {
1158
1182
  let value = theme('borderColor.DEFAULT', 'currentColor')
1159
- addBase({
1160
- '@defaults border-width': {
1161
- 'border-color': toColorValue(value),
1162
- },
1183
+ addDefaults('border-width', {
1184
+ 'border-color': toColorValue(value),
1163
1185
  })
1164
1186
  } else {
1165
- addBase({
1166
- '@defaults border-width': withAlphaVariable({
1187
+ addDefaults(
1188
+ 'border-width',
1189
+ withAlphaVariable({
1167
1190
  color: theme('borderColor.DEFAULT', 'currentColor'),
1168
1191
  property: 'border-color',
1169
1192
  variable: '--tw-border-opacity',
1170
- }),
1171
- })
1193
+ })
1194
+ )
1172
1195
  }
1173
1196
 
1174
1197
  matchUtilities(
@@ -1371,8 +1394,10 @@ export let corePlugins = {
1371
1394
 
1372
1395
  boxDecorationBreak: ({ addUtilities }) => {
1373
1396
  addUtilities({
1374
- '.decoration-slice': { 'box-decoration-break': 'slice' },
1375
- '.decoration-clone': { 'box-decoration-break': 'clone' },
1397
+ '.decoration-slice': { 'box-decoration-break': 'slice' }, // Deprecated
1398
+ '.decoration-clone': { 'box-decoration-break': 'clone' }, // Deprecated
1399
+ '.box-decoration-slice': { 'box-decoration-break': 'slice' },
1400
+ '.box-decoration-clone': { 'box-decoration-break': 'clone' },
1376
1401
  })
1377
1402
  },
1378
1403
 
@@ -1629,9 +1654,10 @@ export let corePlugins = {
1629
1654
 
1630
1655
  textDecoration: ({ addUtilities }) => {
1631
1656
  addUtilities({
1632
- '.underline': { 'text-decoration': 'underline' },
1633
- '.line-through': { 'text-decoration': 'line-through' },
1634
- '.no-underline': { 'text-decoration': 'none' },
1657
+ '.underline': { 'text-decoration-line': 'underline' },
1658
+ '.overline': { 'text-decoration-line': 'overline' },
1659
+ '.line-through': { 'text-decoration-line': 'line-through' },
1660
+ '.no-underline': { 'text-decoration-line': 'none' },
1635
1661
  })
1636
1662
  },
1637
1663
 
@@ -1642,10 +1668,32 @@ export let corePlugins = {
1642
1668
  return { 'text-decoration-color': toColorValue(value) }
1643
1669
  },
1644
1670
  },
1645
- { values: flattenColorPalette(theme('textDecorationColor')), type: ['color', 'any'] }
1671
+ { values: flattenColorPalette(theme('textDecorationColor')), type: ['color'] }
1646
1672
  )
1647
1673
  },
1648
1674
 
1675
+ textDecorationStyle: ({ addUtilities }) => {
1676
+ addUtilities({
1677
+ '.decoration-solid': { 'text-decoration-style': 'solid' },
1678
+ '.decoration-double': { 'text-decoration-style': 'double' },
1679
+ '.decoration-dotted': { 'text-decoration-style': 'dotted' },
1680
+ '.decoration-dashed': { 'text-decoration-style': 'dashed' },
1681
+ '.decoration-wavy': { 'text-decoration-style': 'wavy' },
1682
+ })
1683
+ },
1684
+
1685
+ textDecorationThickness: createUtilityPlugin(
1686
+ 'textDecorationThickness',
1687
+ [['decoration', ['text-decoration-thickness']]],
1688
+ { type: ['length', 'percentage'] }
1689
+ ),
1690
+
1691
+ textUnderlineOffset: createUtilityPlugin(
1692
+ 'textUnderlineOffset',
1693
+ [['underline-offset', ['text-underline-offset']]],
1694
+ { type: ['length', 'percentage'] }
1695
+ ),
1696
+
1649
1697
  fontSmoothing: ({ addUtilities }) => {
1650
1698
  addUtilities({
1651
1699
  '.antialiased': {
@@ -1769,14 +1817,12 @@ export let corePlugins = {
1769
1817
  `var(--tw-shadow)`,
1770
1818
  ].join(', ')
1771
1819
 
1772
- return function ({ matchUtilities, addBase, theme }) {
1773
- addBase({
1774
- '@defaults box-shadow': {
1775
- '--tw-ring-offset-shadow': '0 0 #0000',
1776
- '--tw-ring-shadow': '0 0 #0000',
1777
- '--tw-shadow': '0 0 #0000',
1778
- '--tw-shadow-colored': '0 0 #0000',
1779
- },
1820
+ return function ({ matchUtilities, addDefaults, theme }) {
1821
+ addDefaults(' box-shadow', {
1822
+ '--tw-ring-offset-shadow': '0 0 #0000',
1823
+ '--tw-ring-shadow': '0 0 #0000',
1824
+ '--tw-shadow': '0 0 #0000',
1825
+ '--tw-shadow-colored': '0 0 #0000',
1780
1826
  })
1781
1827
 
1782
1828
  matchUtilities(
@@ -1854,7 +1900,7 @@ export let corePlugins = {
1854
1900
  )
1855
1901
  },
1856
1902
 
1857
- ringWidth: ({ matchUtilities, addBase, addUtilities, theme }) => {
1903
+ ringWidth: ({ matchUtilities, addDefaults, addUtilities, theme }) => {
1858
1904
  let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5')
1859
1905
  let ringColorDefault = withAlphaValue(
1860
1906
  theme('ringColor.DEFAULT'),
@@ -1862,17 +1908,15 @@ export let corePlugins = {
1862
1908
  `rgb(147 197 253 / ${ringOpacityDefault})`
1863
1909
  )
1864
1910
 
1865
- addBase({
1866
- '@defaults ring-width': {
1867
- '--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
1868
- '--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
1869
- '--tw-ring-offset-color': theme('ringOffsetColor.DEFAULT', '#fff'),
1870
- '--tw-ring-color': ringColorDefault,
1871
- '--tw-ring-offset-shadow': '0 0 #0000',
1872
- '--tw-ring-shadow': '0 0 #0000',
1873
- '--tw-shadow': '0 0 #0000',
1874
- '--tw-shadow-colored': '0 0 #0000',
1875
- },
1911
+ addDefaults('ring-width', {
1912
+ '--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
1913
+ '--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
1914
+ '--tw-ring-offset-color': theme('ringOffsetColor.DEFAULT', '#fff'),
1915
+ '--tw-ring-color': ringColorDefault,
1916
+ '--tw-ring-offset-shadow': '0 0 #0000',
1917
+ '--tw-ring-shadow': '0 0 #0000',
1918
+ '--tw-shadow': '0 0 #0000',
1919
+ '--tw-shadow-colored': '0 0 #0000',
1876
1920
  })
1877
1921
 
1878
1922
  matchUtilities(
@@ -2079,30 +2123,28 @@ export let corePlugins = {
2079
2123
  )
2080
2124
  },
2081
2125
 
2082
- filter: ({ addBase, addUtilities }) => {
2083
- addBase({
2084
- '@defaults filter': {
2085
- '--tw-blur': 'var(--tw-empty,/*!*/ /*!*/)',
2086
- '--tw-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
2087
- '--tw-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
2088
- '--tw-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
2089
- '--tw-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
2090
- '--tw-invert': 'var(--tw-empty,/*!*/ /*!*/)',
2091
- '--tw-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
2092
- '--tw-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
2093
- '--tw-drop-shadow': 'var(--tw-empty,/*!*/ /*!*/)',
2094
- '--tw-filter': [
2095
- 'var(--tw-blur)',
2096
- 'var(--tw-brightness)',
2097
- 'var(--tw-contrast)',
2098
- 'var(--tw-grayscale)',
2099
- 'var(--tw-hue-rotate)',
2100
- 'var(--tw-invert)',
2101
- 'var(--tw-saturate)',
2102
- 'var(--tw-sepia)',
2103
- 'var(--tw-drop-shadow)',
2104
- ].join(' '),
2105
- },
2126
+ filter: ({ addDefaults, addUtilities }) => {
2127
+ addDefaults('filter', {
2128
+ '--tw-blur': 'var(--tw-empty,/*!*/ /*!*/)',
2129
+ '--tw-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
2130
+ '--tw-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
2131
+ '--tw-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
2132
+ '--tw-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
2133
+ '--tw-invert': 'var(--tw-empty,/*!*/ /*!*/)',
2134
+ '--tw-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
2135
+ '--tw-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
2136
+ '--tw-drop-shadow': 'var(--tw-empty,/*!*/ /*!*/)',
2137
+ '--tw-filter': [
2138
+ 'var(--tw-blur)',
2139
+ 'var(--tw-brightness)',
2140
+ 'var(--tw-contrast)',
2141
+ 'var(--tw-grayscale)',
2142
+ 'var(--tw-hue-rotate)',
2143
+ 'var(--tw-invert)',
2144
+ 'var(--tw-saturate)',
2145
+ 'var(--tw-sepia)',
2146
+ 'var(--tw-drop-shadow)',
2147
+ ].join(' '),
2106
2148
  })
2107
2149
  addUtilities({
2108
2150
  '.filter': { '@defaults filter': {}, filter: 'var(--tw-filter)' },
@@ -2245,30 +2287,28 @@ export let corePlugins = {
2245
2287
  )
2246
2288
  },
2247
2289
 
2248
- backdropFilter: ({ addBase, addUtilities }) => {
2249
- addBase({
2250
- '@defaults backdrop-filter': {
2251
- '--tw-backdrop-blur': 'var(--tw-empty,/*!*/ /*!*/)',
2252
- '--tw-backdrop-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
2253
- '--tw-backdrop-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
2254
- '--tw-backdrop-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
2255
- '--tw-backdrop-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
2256
- '--tw-backdrop-invert': 'var(--tw-empty,/*!*/ /*!*/)',
2257
- '--tw-backdrop-opacity': 'var(--tw-empty,/*!*/ /*!*/)',
2258
- '--tw-backdrop-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
2259
- '--tw-backdrop-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
2260
- '--tw-backdrop-filter': [
2261
- 'var(--tw-backdrop-blur)',
2262
- 'var(--tw-backdrop-brightness)',
2263
- 'var(--tw-backdrop-contrast)',
2264
- 'var(--tw-backdrop-grayscale)',
2265
- 'var(--tw-backdrop-hue-rotate)',
2266
- 'var(--tw-backdrop-invert)',
2267
- 'var(--tw-backdrop-opacity)',
2268
- 'var(--tw-backdrop-saturate)',
2269
- 'var(--tw-backdrop-sepia)',
2270
- ].join(' '),
2271
- },
2290
+ backdropFilter: ({ addDefaults, addUtilities }) => {
2291
+ addDefaults('backdrop-filter', {
2292
+ '--tw-backdrop-blur': 'var(--tw-empty,/*!*/ /*!*/)',
2293
+ '--tw-backdrop-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
2294
+ '--tw-backdrop-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
2295
+ '--tw-backdrop-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
2296
+ '--tw-backdrop-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
2297
+ '--tw-backdrop-invert': 'var(--tw-empty,/*!*/ /*!*/)',
2298
+ '--tw-backdrop-opacity': 'var(--tw-empty,/*!*/ /*!*/)',
2299
+ '--tw-backdrop-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
2300
+ '--tw-backdrop-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
2301
+ '--tw-backdrop-filter': [
2302
+ 'var(--tw-backdrop-blur)',
2303
+ 'var(--tw-backdrop-brightness)',
2304
+ 'var(--tw-backdrop-contrast)',
2305
+ 'var(--tw-backdrop-grayscale)',
2306
+ 'var(--tw-backdrop-hue-rotate)',
2307
+ 'var(--tw-backdrop-invert)',
2308
+ 'var(--tw-backdrop-opacity)',
2309
+ 'var(--tw-backdrop-saturate)',
2310
+ 'var(--tw-backdrop-sepia)',
2311
+ ].join(' '),
2272
2312
  })
2273
2313
  addUtilities({
2274
2314
  '.backdrop-filter': {
@@ -144,7 +144,7 @@ sup {
144
144
  table {
145
145
  text-indent: 0; /* 1 */
146
146
  border-color: inherit; /* 2 */
147
- border-collapse: collapse; /* 3 */
147
+ border-collapse: collapse; /* 3 */
148
148
  }
149
149
 
150
150
  /*
@@ -288,7 +288,9 @@ legend {
288
288
  }
289
289
 
290
290
  ol,
291
- ul {
291
+ ul,
292
+ li,
293
+ menu {
292
294
  list-style: none;
293
295
  margin: 0;
294
296
  padding: 0;
@@ -309,7 +311,7 @@ textarea {
309
311
 
310
312
  input::placeholder,
311
313
  textarea::placeholder {
312
- opacity: 1; /* 1 */
314
+ opacity: 1; /* 1 */
313
315
  color: theme('colors.gray.400', #9ca3af); /* 2 */
314
316
  }
315
317
 
@@ -2,7 +2,11 @@ import chalk from 'chalk'
2
2
  import log from './util/log'
3
3
 
4
4
  let defaults = {
5
- optimizeUniversalDefaults: true,
5
+ // TODO: Drop this once we can safely rely on optimizeUniversalDefaults being
6
+ // the default.
7
+ optimizeUniversalDefaults: process.env.NODE_ENV === 'test' ? true : false,
8
+
9
+ // optimizeUniversalDefaults: true
6
10
  }
7
11
 
8
12
  let featureFlags = {
@@ -2,6 +2,23 @@ export default function (_context) {
2
2
  return (root, result) => {
3
3
  let found = false
4
4
 
5
+ root.walkAtRules('tailwind', (node) => {
6
+ if (found) return false
7
+
8
+ if (node.parent && node.parent.type !== 'root') {
9
+ found = true
10
+ node.warn(
11
+ result,
12
+ [
13
+ 'Nested @tailwind rules were detected, but are not supported.',
14
+ "Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
15
+ 'Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy',
16
+ ].join('\n')
17
+ )
18
+ return false
19
+ }
20
+ })
21
+
5
22
  root.walkRules((rule) => {
6
23
  if (found) return false
7
24
 
@@ -9,10 +26,12 @@ export default function (_context) {
9
26
  found = true
10
27
  nestedRule.warn(
11
28
  result,
12
- // TODO: Improve this warning message
13
- 'Nested CSS detected, checkout the docs on how to support nesting: https://tailwindcss.com/docs/using-with-preprocessors#nesting'
29
+ [
30
+ 'Nested CSS was detected, but CSS nesting has not been configured correctly.',
31
+ 'Please enable a CSS nesting plugin *before* Tailwind in your configuration.',
32
+ 'See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting',
33
+ ].join('\n')
14
34
  )
15
-
16
35
  return false
17
36
  })
18
37
  })