tailwindcss 0.0.0-insiders.429fe07 → 0.0.0-insiders.49f76ed

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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,65 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Fixed
11
11
 
12
+ - Reduce specificity of `abbr` rule in preflight ([#6671](https://github.com/tailwindlabs/tailwindcss/pull/6671))
13
+ - Support HSL with hue units in arbitrary values ([#6726](https://github.com/tailwindlabs/tailwindcss/pull/6726))
14
+ - Add `node16-linux-arm64` target for standalone CLI ([#6693](https://github.com/tailwindlabs/tailwindcss/pull/6693))
15
+
16
+ ## [3.0.7] - 2021-12-17
17
+
18
+ ### Fixed
19
+
20
+ - Don't mutate custom color palette when overriding per-plugin colors ([#6546](https://github.com/tailwindlabs/tailwindcss/pull/6546))
21
+ - Improve circular dependency detection when using `@apply` ([#6588](https://github.com/tailwindlabs/tailwindcss/pull/6588))
22
+ - Only generate variants for non-`user` layers ([#6589](https://github.com/tailwindlabs/tailwindcss/pull/6589))
23
+ - Properly extract classes with arbitrary values in arrays and classes followed by escaped quotes ([#6590](https://github.com/tailwindlabs/tailwindcss/pull/6590))
24
+ - Improve jsx interpolation candidate matching ([#6593](https://github.com/tailwindlabs/tailwindcss/pull/6593))
25
+ - Ensure `@apply` of a rule inside an AtRule works ([#6594](https://github.com/tailwindlabs/tailwindcss/pull/6594))
26
+
27
+ ## [3.0.6] - 2021-12-16
28
+
29
+ ### Fixed
30
+
31
+ - Support square bracket notation in paths ([#6519](https://github.com/tailwindlabs/tailwindcss/pull/6519))
32
+ - Ensure all plugins are executed for a given candidate ([#6540](https://github.com/tailwindlabs/tailwindcss/pull/6540))
33
+
34
+ ## [3.0.5] - 2021-12-15
35
+
36
+ ### Fixed
37
+
38
+ - Revert: add `li` to list-style reset ([9777562d](https://github.com/tailwindlabs/tailwindcss/commit/9777562da37ee631bbf77374c0d14825f09ef9af))
39
+
40
+ ## [3.0.4] - 2021-12-15
41
+
42
+ ### Fixed
43
+
44
+ - Insert always-on defaults layer in correct spot ([#6526](https://github.com/tailwindlabs/tailwindcss/pull/6526))
45
+
46
+ ## [3.0.3] - 2021-12-15
47
+
48
+ ### Added
49
+
50
+ - Warn about invalid globs in `content` ([#6449](https://github.com/tailwindlabs/tailwindcss/pull/6449))
51
+ - Add standalone tailwindcss CLI ([#6506](https://github.com/tailwindlabs/tailwindcss/pull/6506))
52
+ - Add `li` to list-style reset ([00f60e6](https://github.com/tailwindlabs/tailwindcss/commit/00f60e61013c6e4e3419e4b699371a13eb30b75d))
53
+
54
+ ### Fixed
55
+
56
+ - Don't output unparsable values ([#6469](https://github.com/tailwindlabs/tailwindcss/pull/6469))
57
+ - Fix text decoration utilities from overriding the new text decoration color/style/thickness utilities when used with a modifier ([#6378](https://github.com/tailwindlabs/tailwindcss/pull/6378))
58
+ - Move defaults to their own always-on layer ([#6500](https://github.com/tailwindlabs/tailwindcss/pull/6500))
59
+ - Support negative values in safelist patterns ([#6480](https://github.com/tailwindlabs/tailwindcss/pull/6480))
60
+
61
+ ## [3.0.2] - 2021-12-13
62
+
63
+ ### Fixed
64
+
65
+ - Temporarily disable optimize universal defaults, fixes issue with transforms/filters/rings not being `@apply`-able in CSS modules/Svelte components/Vue components ([#6461](https://github.com/tailwindlabs/tailwindcss/pull/6461))
66
+
67
+ ## [3.0.1] - 2021-12-10
68
+
69
+ ### Fixed
70
+
12
71
  - Ensure complex variants with multiple classes work ([#6311](https://github.com/tailwindlabs/tailwindcss/pull/6311))
13
72
  - Re-add `default` interop to public available functions ([#6348](https://github.com/tailwindlabs/tailwindcss/pull/6348))
14
73
  - Detect circular dependencies when using `@apply` ([#6365](https://github.com/tailwindlabs/tailwindcss/pull/6365))
@@ -1686,7 +1745,14 @@ No release notes
1686
1745
 
1687
1746
  - Everything!
1688
1747
 
1689
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0...HEAD
1748
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.7...HEAD
1749
+ [3.0.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.6...v3.0.7
1750
+ [3.0.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.5...v3.0.6
1751
+ [3.0.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.4...v3.0.5
1752
+ [3.0.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.3...v3.0.4
1753
+ [3.0.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.2...v3.0.3
1754
+ [3.0.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.1...v3.0.2
1755
+ [3.0.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0...v3.0.1
1690
1756
  [3.0.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.2...v3.0.0
1691
1757
  [3.0.0-alpha.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.0-alpha.1...v3.0.0-alpha.2
1692
1758
  [3.0.0-alpha.1]: https://github.com/tailwindlabs/tailwindcss/compare/v2.2.19...v3.0.0-alpha.1
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  <p>
2
- <a href="https://tailwindcss.com/" target="_blank">
3
- <img alt="Tailwind CSS" width="350" src="https://refactoringui.nyc3.cdn.digitaloceanspaces.com/tailwind-logo-sticker.svg">
4
- </a><br>
5
- A utility-first CSS framework for rapidly building custom user interfaces.
2
+ <a href="https://tailwindcss.com/#gh-light-mode-only" target="_blank">
3
+ <img src="./.github/logo-light.svg" alt="Tailwind CSS" width="350" height="70">
4
+ </a>
5
+ <a href="https://tailwindcss.com/#gh-dark-mode-only" target="_blank">
6
+ <img src="./.github/logo-dark.svg" alt="Tailwind CSS" width="350" height="70">
7
+ </a>
6
8
  </p>
7
9
 
10
+ A utility-first CSS framework for rapidly building custom user interfaces.
11
+
8
12
  <p>
9
13
  <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/workflow/status/tailwindlabs/tailwindcss/Node.js%20CI" alt="Build Status"></a>
10
14
  <a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
@@ -914,26 +914,24 @@ let corePlugins = {
914
914
  ], {
915
915
  supportsNegativeValues: true
916
916
  }),
917
- transform: ({ addBase , addUtilities })=>{
918
- addBase({
919
- '@defaults transform': {
920
- '--tw-translate-x': '0',
921
- '--tw-translate-y': '0',
922
- '--tw-rotate': '0',
923
- '--tw-skew-x': '0',
924
- '--tw-skew-y': '0',
925
- '--tw-scale-x': '1',
926
- '--tw-scale-y': '1',
927
- '--tw-transform': [
928
- 'translateX(var(--tw-translate-x))',
929
- 'translateY(var(--tw-translate-y))',
930
- 'rotate(var(--tw-rotate))',
931
- 'skewX(var(--tw-skew-x))',
932
- 'skewY(var(--tw-skew-y))',
933
- 'scaleX(var(--tw-scale-x))',
934
- 'scaleY(var(--tw-scale-y))',
935
- ].join(' ')
936
- }
917
+ transform: ({ addDefaults , addUtilities })=>{
918
+ addDefaults('transform', {
919
+ '--tw-translate-x': '0',
920
+ '--tw-translate-y': '0',
921
+ '--tw-rotate': '0',
922
+ '--tw-skew-x': '0',
923
+ '--tw-skew-y': '0',
924
+ '--tw-scale-x': '1',
925
+ '--tw-scale-y': '1',
926
+ '--tw-transform': [
927
+ 'translateX(var(--tw-translate-x))',
928
+ 'translateY(var(--tw-translate-y))',
929
+ 'rotate(var(--tw-rotate))',
930
+ 'skewX(var(--tw-skew-x))',
931
+ 'skewY(var(--tw-skew-y))',
932
+ 'scaleX(var(--tw-scale-x))',
933
+ 'scaleY(var(--tw-scale-y))',
934
+ ].join(' ')
937
935
  });
938
936
  addUtilities({
939
937
  '.transform': {
@@ -1001,14 +999,12 @@ let corePlugins = {
1001
999
  });
1002
1000
  },
1003
1001
  cursor: (0, _createUtilityPlugin).default('cursor'),
1004
- touchAction: ({ addBase , addUtilities })=>{
1005
- addBase({
1006
- '@defaults touch-action': {
1007
- '--tw-pan-x': 'var(--tw-empty,/*!*/ /*!*/)',
1008
- '--tw-pan-y': 'var(--tw-empty,/*!*/ /*!*/)',
1009
- '--tw-pinch-zoom': 'var(--tw-empty,/*!*/ /*!*/)',
1010
- '--tw-touch-action': 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)'
1011
- }
1002
+ touchAction: ({ addDefaults , addUtilities })=>{
1003
+ addDefaults('touch-action', {
1004
+ '--tw-pan-x': 'var(--tw-empty,/*!*/ /*!*/)',
1005
+ '--tw-pan-y': 'var(--tw-empty,/*!*/ /*!*/)',
1006
+ '--tw-pinch-zoom': 'var(--tw-empty,/*!*/ /*!*/)',
1007
+ '--tw-touch-action': 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)'
1012
1008
  });
1013
1009
  addUtilities({
1014
1010
  '.touch-auto': {
@@ -1096,11 +1092,9 @@ let corePlugins = {
1096
1092
  }
1097
1093
  });
1098
1094
  },
1099
- scrollSnapType: ({ addUtilities , addBase })=>{
1100
- addBase({
1101
- '@defaults scroll-snap-type': {
1102
- '--tw-scroll-snap-strictness': 'proximity'
1103
- }
1095
+ scrollSnapType: ({ addDefaults , addUtilities })=>{
1096
+ addDefaults('scroll-snap-type', {
1097
+ '--tw-scroll-snap-strictness': 'proximity'
1104
1098
  });
1105
1099
  addUtilities({
1106
1100
  '.snap-none': {
@@ -2095,22 +2089,18 @@ let corePlugins = {
2095
2089
  }
2096
2090
  });
2097
2091
  },
2098
- borderColor: ({ addBase , matchUtilities , theme , corePlugins: corePlugins2 })=>{
2092
+ borderColor: ({ addDefaults , matchUtilities , theme , corePlugins: corePlugins2 })=>{
2099
2093
  if (!corePlugins2('borderOpacity')) {
2100
2094
  let value = theme('borderColor.DEFAULT', 'currentColor');
2101
- addBase({
2102
- '@defaults border-width': {
2103
- 'border-color': (0, _toColorValue).default(value)
2104
- }
2095
+ addDefaults('border-width', {
2096
+ 'border-color': (0, _toColorValue).default(value)
2105
2097
  });
2106
2098
  } else {
2107
- addBase({
2108
- '@defaults border-width': (0, _withAlphaVariable).default({
2109
- color: theme('borderColor.DEFAULT', 'currentColor'),
2110
- property: 'border-color',
2111
- variable: '--tw-border-opacity'
2112
- })
2113
- });
2099
+ addDefaults('border-width', (0, _withAlphaVariable).default({
2100
+ color: theme('borderColor.DEFAULT', 'currentColor'),
2101
+ property: 'border-color',
2102
+ variable: '--tw-border-opacity'
2103
+ }));
2114
2104
  }
2115
2105
  matchUtilities({
2116
2106
  border: (value)=>{
@@ -2792,16 +2782,16 @@ let corePlugins = {
2792
2782
  textDecoration: ({ addUtilities })=>{
2793
2783
  addUtilities({
2794
2784
  '.underline': {
2795
- 'text-decoration': 'underline'
2785
+ 'text-decoration-line': 'underline'
2796
2786
  },
2797
2787
  '.overline': {
2798
- 'text-decoration': 'overline'
2788
+ 'text-decoration-line': 'overline'
2799
2789
  },
2800
2790
  '.line-through': {
2801
- 'text-decoration': 'line-through'
2791
+ 'text-decoration-line': 'line-through'
2802
2792
  },
2803
2793
  '.no-underline': {
2804
- 'text-decoration': 'none'
2794
+ 'text-decoration-line': 'none'
2805
2795
  }
2806
2796
  });
2807
2797
  },
@@ -3064,14 +3054,12 @@ let corePlugins = {
3064
3054
  `var(--tw-ring-shadow, 0 0 #0000)`,
3065
3055
  `var(--tw-shadow)`,
3066
3056
  ].join(', ');
3067
- return function({ matchUtilities , addBase , theme }) {
3068
- addBase({
3069
- '@defaults box-shadow': {
3070
- '--tw-ring-offset-shadow': '0 0 #0000',
3071
- '--tw-ring-shadow': '0 0 #0000',
3072
- '--tw-shadow': '0 0 #0000',
3073
- '--tw-shadow-colored': '0 0 #0000'
3074
- }
3057
+ return function({ matchUtilities , addDefaults , theme }) {
3058
+ addDefaults(' box-shadow', {
3059
+ '--tw-ring-offset-shadow': '0 0 #0000',
3060
+ '--tw-ring-shadow': '0 0 #0000',
3061
+ '--tw-shadow': '0 0 #0000',
3062
+ '--tw-shadow-colored': '0 0 #0000'
3075
3063
  });
3076
3064
  matchUtilities({
3077
3065
  shadow: (value)=>{
@@ -3180,20 +3168,18 @@ let corePlugins = {
3180
3168
  ]
3181
3169
  });
3182
3170
  },
3183
- ringWidth: ({ matchUtilities , addBase , addUtilities , theme })=>{
3171
+ ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme })=>{
3184
3172
  let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5');
3185
3173
  let ringColorDefault = (0, _withAlphaVariable).withAlphaValue(theme('ringColor.DEFAULT'), ringOpacityDefault, `rgb(147 197 253 / ${ringOpacityDefault})`);
3186
- addBase({
3187
- '@defaults ring-width': {
3188
- '--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
3189
- '--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
3190
- '--tw-ring-offset-color': theme('ringOffsetColor.DEFAULT', '#fff'),
3191
- '--tw-ring-color': ringColorDefault,
3192
- '--tw-ring-offset-shadow': '0 0 #0000',
3193
- '--tw-ring-shadow': '0 0 #0000',
3194
- '--tw-shadow': '0 0 #0000',
3195
- '--tw-shadow-colored': '0 0 #0000'
3196
- }
3174
+ addDefaults('ring-width', {
3175
+ '--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
3176
+ '--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
3177
+ '--tw-ring-offset-color': theme('ringOffsetColor.DEFAULT', '#fff'),
3178
+ '--tw-ring-color': ringColorDefault,
3179
+ '--tw-ring-offset-shadow': '0 0 #0000',
3180
+ '--tw-ring-shadow': '0 0 #0000',
3181
+ '--tw-shadow': '0 0 #0000',
3182
+ '--tw-shadow-colored': '0 0 #0000'
3197
3183
  });
3198
3184
  matchUtilities({
3199
3185
  ring: (value)=>{
@@ -3396,30 +3382,28 @@ let corePlugins = {
3396
3382
  values: theme('sepia')
3397
3383
  });
3398
3384
  },
3399
- filter: ({ addBase , addUtilities })=>{
3400
- addBase({
3401
- '@defaults filter': {
3402
- '--tw-blur': 'var(--tw-empty,/*!*/ /*!*/)',
3403
- '--tw-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
3404
- '--tw-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
3405
- '--tw-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
3406
- '--tw-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
3407
- '--tw-invert': 'var(--tw-empty,/*!*/ /*!*/)',
3408
- '--tw-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
3409
- '--tw-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
3410
- '--tw-drop-shadow': 'var(--tw-empty,/*!*/ /*!*/)',
3411
- '--tw-filter': [
3412
- 'var(--tw-blur)',
3413
- 'var(--tw-brightness)',
3414
- 'var(--tw-contrast)',
3415
- 'var(--tw-grayscale)',
3416
- 'var(--tw-hue-rotate)',
3417
- 'var(--tw-invert)',
3418
- 'var(--tw-saturate)',
3419
- 'var(--tw-sepia)',
3420
- 'var(--tw-drop-shadow)',
3421
- ].join(' ')
3422
- }
3385
+ filter: ({ addDefaults , addUtilities })=>{
3386
+ addDefaults('filter', {
3387
+ '--tw-blur': 'var(--tw-empty,/*!*/ /*!*/)',
3388
+ '--tw-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
3389
+ '--tw-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
3390
+ '--tw-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
3391
+ '--tw-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
3392
+ '--tw-invert': 'var(--tw-empty,/*!*/ /*!*/)',
3393
+ '--tw-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
3394
+ '--tw-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
3395
+ '--tw-drop-shadow': 'var(--tw-empty,/*!*/ /*!*/)',
3396
+ '--tw-filter': [
3397
+ 'var(--tw-blur)',
3398
+ 'var(--tw-brightness)',
3399
+ 'var(--tw-contrast)',
3400
+ 'var(--tw-grayscale)',
3401
+ 'var(--tw-hue-rotate)',
3402
+ 'var(--tw-invert)',
3403
+ 'var(--tw-saturate)',
3404
+ 'var(--tw-sepia)',
3405
+ 'var(--tw-drop-shadow)',
3406
+ ].join(' ')
3423
3407
  });
3424
3408
  addUtilities({
3425
3409
  '.filter': {
@@ -3559,30 +3543,28 @@ let corePlugins = {
3559
3543
  values: theme('backdropSepia')
3560
3544
  });
3561
3545
  },
3562
- backdropFilter: ({ addBase , addUtilities })=>{
3563
- addBase({
3564
- '@defaults backdrop-filter': {
3565
- '--tw-backdrop-blur': 'var(--tw-empty,/*!*/ /*!*/)',
3566
- '--tw-backdrop-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
3567
- '--tw-backdrop-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
3568
- '--tw-backdrop-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
3569
- '--tw-backdrop-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
3570
- '--tw-backdrop-invert': 'var(--tw-empty,/*!*/ /*!*/)',
3571
- '--tw-backdrop-opacity': 'var(--tw-empty,/*!*/ /*!*/)',
3572
- '--tw-backdrop-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
3573
- '--tw-backdrop-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
3574
- '--tw-backdrop-filter': [
3575
- 'var(--tw-backdrop-blur)',
3576
- 'var(--tw-backdrop-brightness)',
3577
- 'var(--tw-backdrop-contrast)',
3578
- 'var(--tw-backdrop-grayscale)',
3579
- 'var(--tw-backdrop-hue-rotate)',
3580
- 'var(--tw-backdrop-invert)',
3581
- 'var(--tw-backdrop-opacity)',
3582
- 'var(--tw-backdrop-saturate)',
3583
- 'var(--tw-backdrop-sepia)',
3584
- ].join(' ')
3585
- }
3546
+ backdropFilter: ({ addDefaults , addUtilities })=>{
3547
+ addDefaults('backdrop-filter', {
3548
+ '--tw-backdrop-blur': 'var(--tw-empty,/*!*/ /*!*/)',
3549
+ '--tw-backdrop-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
3550
+ '--tw-backdrop-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
3551
+ '--tw-backdrop-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
3552
+ '--tw-backdrop-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
3553
+ '--tw-backdrop-invert': 'var(--tw-empty,/*!*/ /*!*/)',
3554
+ '--tw-backdrop-opacity': 'var(--tw-empty,/*!*/ /*!*/)',
3555
+ '--tw-backdrop-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
3556
+ '--tw-backdrop-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
3557
+ '--tw-backdrop-filter': [
3558
+ 'var(--tw-backdrop-blur)',
3559
+ 'var(--tw-backdrop-brightness)',
3560
+ 'var(--tw-backdrop-contrast)',
3561
+ 'var(--tw-backdrop-grayscale)',
3562
+ 'var(--tw-backdrop-hue-rotate)',
3563
+ 'var(--tw-backdrop-invert)',
3564
+ 'var(--tw-backdrop-opacity)',
3565
+ 'var(--tw-backdrop-saturate)',
3566
+ 'var(--tw-backdrop-sepia)',
3567
+ ].join(' ')
3586
3568
  });
3587
3569
  addUtilities({
3588
3570
  '.backdrop-filter': {
@@ -58,7 +58,7 @@ hr {
58
58
  Add the correct text decoration in Chrome, Edge, and Safari.
59
59
  */
60
60
 
61
- abbr[title] {
61
+ abbr:where([title]) {
62
62
  text-decoration: underline dotted;
63
63
  }
64
64
 
@@ -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
  /*
@@ -310,7 +310,7 @@ textarea {
310
310
 
311
311
  input::placeholder,
312
312
  textarea::placeholder {
313
- opacity: 1; /* 1 */
313
+ opacity: 1; /* 1 */
314
314
  color: theme('colors.gray.400', #9ca3af); /* 2 */
315
315
  }
316
316
 
@@ -13,7 +13,9 @@ function _interopRequireDefault(obj) {
13
13
  };
14
14
  }
15
15
  let defaults = {
16
- optimizeUniversalDefaults: true
16
+ // TODO: Drop this once we can safely rely on optimizeUniversalDefaults being
17
+ // the default.
18
+ optimizeUniversalDefaults: process.env.NODE_ENV === 'test' ? true : false
17
19
  };
18
20
  let featureFlags = {
19
21
  future: [],
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.defaultExtractor = defaultExtractor;
6
+ const PATTERNS = [
7
+ /(?:\['([^'\s]+[^<>"'`\s:\\])')/.source,
8
+ /(?:\["([^"\s]+[^<>"'`\s:\\])")/.source,
9
+ /(?:\[`([^`\s]+[^<>"'`\s:\\])`)/.source,
10
+ /([^<>"'`\s]*\[\w*'[^"`\s]*'?\])/.source,
11
+ /([^<>"'`\s]*\[\w*"[^'`\s]*"?\])/.source,
12
+ /([^<>"'`\s]*\[\w*\('[^"'`\s]*'\)\])/.source,
13
+ /([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source,
14
+ /([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source,
15
+ /([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
16
+ /([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
17
+ /([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
18
+ /([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source,
19
+ /([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source,
20
+ /([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source,
21
+ /([^<>"'`\s]*[^"'`\s:\\])/.source,
22
+ ].join('|');
23
+ const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
24
+ const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
25
+ function defaultExtractor(content) {
26
+ let broadMatches = content.matchAll(BROAD_MATCH_GLOBAL_REGEXP);
27
+ let innerMatches = content.match(INNER_MATCH_GLOBAL_REGEXP) || [];
28
+ let results = [
29
+ ...broadMatches,
30
+ ...innerMatches
31
+ ].flat().filter((v)=>v !== undefined
32
+ );
33
+ return results;
34
+ } // Regular utilities
35
+ // {{modifier}:}*{namespace}{-{suffix}}*{/{opacityModifier}}?
36
+ // Arbitrary values
37
+ // {{modifier}:}*{namespace}-[{arbitraryValue}]{/{opacityModifier}}?
38
+ // arbitraryValue: no whitespace, balanced quotes unless within quotes, balanced brackets unless within quotes
39
+ // Arbitrary properties
40
+ // {{modifier}:}*[{validCssPropertyName}:{arbitraryValue}]
@@ -43,7 +43,7 @@ function listKeys(obj) {
43
43
  function validatePath(config, path, defaultValue) {
44
44
  const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+/g, '').replace(/['"]+$/g, '');
45
45
  const pathSegments = Array.isArray(path) ? path : (0, _toPath).toPath(pathString);
46
- const value = (0, _dlv).default(config.theme, pathString, defaultValue);
46
+ const value = (0, _dlv).default(config.theme, pathSegments, defaultValue);
47
47
  if (value === undefined) {
48
48
  let error = `'${pathString}' does not exist in your theme config.`;
49
49
  const parentSegments = pathSegments.slice(0, -1);
@@ -13,17 +13,28 @@ function _interopRequireDefault(obj) {
13
13
  default: obj
14
14
  };
15
15
  }
16
- function containsBase(selector, classCandidateBase, separator) {
17
- return (0, _postcssSelectorParser).default((selectors)=>{
18
- let contains = false;
19
- selectors.walkClasses((classSelector)=>{
20
- if (classSelector.value.split(separator).pop() === classCandidateBase) {
21
- contains = true;
22
- return false;
23
- }
24
- });
25
- return contains;
26
- }).transformSync(selector);
16
+ function extractClasses(node) {
17
+ let classes = new Set();
18
+ let container = _postcss.default.root({
19
+ nodes: [
20
+ node.clone()
21
+ ]
22
+ });
23
+ container.walkRules((rule)=>{
24
+ (0, _postcssSelectorParser).default((selectors)=>{
25
+ selectors.walkClasses((classSelector)=>{
26
+ classes.add(classSelector.value);
27
+ });
28
+ }).processSync(rule.selector);
29
+ });
30
+ return Array.from(classes);
31
+ }
32
+ function extractBaseCandidates(candidates, separator) {
33
+ let baseClasses = new Set();
34
+ for (let candidate of candidates){
35
+ baseClasses.add(candidate.split(separator).pop());
36
+ }
37
+ return Array.from(baseClasses);
27
38
  }
28
39
  function prefix(context, selector) {
29
40
  let prefix1 = context.tailwindConfig.prefix;
@@ -186,10 +197,36 @@ function processApply(root, context) {
186
197
  for (const [parent, candidates] of perParentApplies){
187
198
  let siblings = [];
188
199
  for (let [applyCandidate, important, rules] of candidates){
189
- let base = applyCandidate.split(context.tailwindConfig.separator).pop();
190
200
  for (let [meta, node] of rules){
191
- if (containsBase(parent.selector, base, context.tailwindConfig.separator) && containsBase(node.selector, base, context.tailwindConfig.separator)) {
192
- throw node.error(`Circular dependency detected when using: \`@apply ${applyCandidate}\``);
201
+ let parentClasses = extractClasses(parent);
202
+ let nodeClasses = extractClasses(node);
203
+ // Add base utility classes from the @apply node to the list of
204
+ // classes to check whether it intersects and therefore results in a
205
+ // circular dependency or not.
206
+ //
207
+ // E.g.:
208
+ // .foo {
209
+ // @apply hover:a; // This applies "a" but with a modifier
210
+ // }
211
+ //
212
+ // We only have to do that with base classes of the `node`, not of the `parent`
213
+ // E.g.:
214
+ // .hover\:foo {
215
+ // @apply bar;
216
+ // }
217
+ // .bar {
218
+ // @apply foo;
219
+ // }
220
+ //
221
+ // This should not result in a circular dependency because we are
222
+ // just applying `.foo` and the rule above is `.hover\:foo` which is
223
+ // unrelated. However, if we were to apply `hover:foo` then we _did_
224
+ // have to include this one.
225
+ nodeClasses = nodeClasses.concat(extractBaseCandidates(nodeClasses, context.tailwindConfig.separator));
226
+ let intersects = parentClasses.some((selector)=>nodeClasses.includes(selector)
227
+ );
228
+ if (intersects) {
229
+ throw node.error(`You cannot \`@apply\` the \`${applyCandidate}\` utility here because it creates a circular dependency.`);
193
230
  }
194
231
  let root = _postcss.default.root({
195
232
  nodes: [
@@ -199,6 +236,42 @@ function processApply(root, context) {
199
236
  let canRewriteSelector = node.type !== 'atrule' || node.type === 'atrule' && node.name !== 'keyframes';
200
237
  if (canRewriteSelector) {
201
238
  root.walkRules((rule)=>{
239
+ // Let's imagine you have the following structure:
240
+ //
241
+ // .foo {
242
+ // @apply bar;
243
+ // }
244
+ //
245
+ // @supports (a: b) {
246
+ // .bar {
247
+ // color: blue
248
+ // }
249
+ //
250
+ // .something-unrelated {}
251
+ // }
252
+ //
253
+ // In this case we want to apply `.bar` but it happens to be in
254
+ // an atrule node. We clone that node instead of the nested one
255
+ // because we still want that @supports rule to be there once we
256
+ // applied everything.
257
+ //
258
+ // However it happens to be that the `.something-unrelated` is
259
+ // also in that same shared @supports atrule. This is not good,
260
+ // and this should not be there. The good part is that this is
261
+ // a clone already and it can be safely removed. The question is
262
+ // how do we know we can remove it. Basically what we can do is
263
+ // match it against the applyCandidate that you want to apply. If
264
+ // it doesn't match the we can safely delete it.
265
+ //
266
+ // If we didn't do this, then the `replaceSelector` function
267
+ // would have replaced this with something that didn't exist and
268
+ // therefore it removed the selector altogether. In this specific
269
+ // case it would result in `{}` instead of `.something-unrelated {}`
270
+ if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate
271
+ )) {
272
+ rule.remove();
273
+ return;
274
+ }
202
275
  rule.selector = replaceSelector(parent.selector, rule.selector, applyCandidate);
203
276
  rule.walkDecls((d)=>{
204
277
  d.important = meta.important || important;
@@ -220,7 +293,6 @@ function processApply(root, context) {
220
293
  let nodes = siblings.sort(([a], [z])=>(0, _bigSign).default(a.sort - z.sort)
221
294
  ).map((s)=>s[1]
222
295
  );
223
- // console.log(parent)
224
296
  // `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
225
297
  parent.after(nodes);
226
298
  }