tailwindcss 3.1.3 → 3.1.4

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,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  - Nothing yet!
11
11
 
12
+ ## [3.1.4] - 2022-06-21
13
+
14
+ ### Fixed
15
+
16
+ - Provide default to `<alpha-value>` when using `theme()` ([#8652](https://github.com/tailwindlabs/tailwindcss/pull/8652))
17
+ - Detect arbitrary variants with quotes ([#8687](https://github.com/tailwindlabs/tailwindcss/pull/8687))
18
+ - Don’t add spaces around raw `/` that are preceded by numbers ([#8688](https://github.com/tailwindlabs/tailwindcss/pull/8688))
19
+
12
20
  ## [3.1.3] - 2022-06-14
13
21
 
14
22
  ### Fixed
@@ -1981,7 +1989,8 @@ No release notes
1981
1989
 
1982
1990
  - Everything!
1983
1991
 
1984
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.3...HEAD
1992
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.4...HEAD
1993
+ [3.1.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.3...v3.1.4
1985
1994
  [3.1.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.2...v3.1.3
1986
1995
  [3.1.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.1...v3.1.2
1987
1996
  [3.1.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.0...v3.1.1
@@ -93,9 +93,8 @@ function* buildRegExps(context) {
93
93
  ])),
94
94
  ]),
95
95
  ]);
96
- yield regex.pattern([
97
- // Variants
98
- "((?=((",
96
+ let variantPatterns = [
97
+ // Without quotes
99
98
  regex.any([
100
99
  regex.pattern([
101
100
  /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
@@ -105,25 +104,43 @@ function* buildRegExps(context) {
105
104
  /[^\s"'`\[\\]+/,
106
105
  separator
107
106
  ]),
108
- ], true),
109
- ")+))\\2)?",
110
- // Important (optional)
111
- /!?/,
112
- variantGroupingEnabled ? regex.any([
113
- // Or any of those things but grouped separated by commas
107
+ ]),
108
+ // With quotes allowed
109
+ regex.any([
114
110
  regex.pattern([
115
- /\(/,
116
- utility,
117
- regex.zeroOrMore([
118
- /,/,
119
- utility
120
- ]),
121
- /\)/
111
+ /([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
112
+ separator
122
113
  ]),
123
- // Arbitrary properties, constrained utilities, arbitrary values, etc…
124
- utility,
125
- ]) : utility,
126
- ]);
114
+ regex.pattern([
115
+ /[^\s`\[\\]+/,
116
+ separator
117
+ ]),
118
+ ]),
119
+ ];
120
+ for (const variantPattern of variantPatterns){
121
+ yield regex.pattern([
122
+ // Variants
123
+ "((?=((",
124
+ variantPattern,
125
+ ")+))\\2)?",
126
+ // Important (optional)
127
+ /!?/,
128
+ variantGroupingEnabled ? regex.any([
129
+ // Or any of those things but grouped separated by commas
130
+ regex.pattern([
131
+ /\(/,
132
+ utility,
133
+ regex.zeroOrMore([
134
+ /,/,
135
+ utility
136
+ ]),
137
+ /\)/
138
+ ]),
139
+ // Arbitrary properties, constrained utilities, arbitrary values, etc…
140
+ utility,
141
+ ]) : utility,
142
+ ]);
143
+ }
127
144
  // 5. Inner matches
128
145
  yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
129
146
  }
@@ -155,9 +155,13 @@ function _default({ tailwindConfig: config }) {
155
155
  if (!isValid) {
156
156
  throw node.error(error);
157
157
  }
158
- if (alpha !== undefined) {
159
- value = (0, _pluginUtils).parseColorFormat(value);
160
- value = (0, _withAlphaVariable).withAlphaValue(value, alpha, value);
158
+ let maybeColor = (0, _pluginUtils).parseColorFormat(value);
159
+ let isColorFunction = maybeColor !== undefined && typeof maybeColor === "function";
160
+ if (alpha !== undefined || isColorFunction) {
161
+ if (alpha === undefined) {
162
+ alpha = 1.0;
163
+ }
164
+ value = (0, _withAlphaVariable).withAlphaValue(maybeColor, alpha, maybeColor);
161
165
  }
162
166
  return value;
163
167
  },
@@ -51,9 +51,7 @@ function normalize(value, isRoot = true) {
51
51
  value = value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
52
52
  return match.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
53
53
  });
54
- // Add spaces around some operators not inside calc() that do not follow an operator
55
- // or '('.
56
- return value.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([\/])/g, "$1 $2 ");
54
+ return value;
57
55
  }
58
56
  function url(value) {
59
57
  return value.startsWith("url(");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -47,14 +47,14 @@
47
47
  "@swc/jest": "^0.2.21",
48
48
  "@swc/register": "^0.1.10",
49
49
  "autoprefixer": "^10.4.7",
50
- "cssnano": "^5.1.9",
51
- "esbuild": "^0.14.39",
50
+ "cssnano": "^5.1.11",
51
+ "esbuild": "^0.14.43",
52
52
  "eslint": "^8.16.0",
53
53
  "eslint-config-prettier": "^8.5.0",
54
54
  "eslint-plugin-prettier": "^4.0.0",
55
55
  "jest": "^28.1.1",
56
56
  "jest-diff": "^28.1.1",
57
- "prettier": "^2.6.2",
57
+ "prettier": "^2.7.1",
58
58
  "prettier-plugin-tailwindcss": "^0.1.11",
59
59
  "rimraf": "^3.0.0",
60
60
  "source-map-js": "^1.0.2"
package/peers/index.js CHANGED
@@ -25862,6 +25862,155 @@ var require_main = __commonJS({
25862
25862
  "background-attachment",
25863
25863
  "background-color"
25864
25864
  ],
25865
+ "columns": [
25866
+ "column-width",
25867
+ "column-count"
25868
+ ],
25869
+ "column-rule": [
25870
+ "column-rule-width",
25871
+ "column-rule-style",
25872
+ "column-rule-color"
25873
+ ],
25874
+ "flex": [
25875
+ "flex-grow",
25876
+ "flex-shrink",
25877
+ "flex-basis"
25878
+ ],
25879
+ "flex-flow": [
25880
+ "flex-direction",
25881
+ "flex-wrap"
25882
+ ],
25883
+ "font": [
25884
+ "font-style",
25885
+ "font-variant",
25886
+ "font-weight",
25887
+ "font-stretch",
25888
+ "font-size",
25889
+ "font-family",
25890
+ "line-height"
25891
+ ],
25892
+ "grid": [
25893
+ "grid-template-rows",
25894
+ "grid-template-columns",
25895
+ "grid-template-areas",
25896
+ "grid-auto-rows",
25897
+ "grid-auto-columns",
25898
+ "grid-auto-flow",
25899
+ "column-gap",
25900
+ "row-gap"
25901
+ ],
25902
+ "grid-area": [
25903
+ "grid-row-start",
25904
+ "grid-column-start",
25905
+ "grid-row-end",
25906
+ "grid-column-end"
25907
+ ],
25908
+ "grid-column": [
25909
+ "grid-column-start",
25910
+ "grid-column-end"
25911
+ ],
25912
+ "grid-row": [
25913
+ "grid-row-start",
25914
+ "grid-row-end"
25915
+ ],
25916
+ "grid-template": [
25917
+ "grid-template-columns",
25918
+ "grid-template-rows",
25919
+ "grid-template-areas"
25920
+ ],
25921
+ "list-style": [
25922
+ "list-style-type",
25923
+ "list-style-position",
25924
+ "list-style-image"
25925
+ ],
25926
+ "padding": [
25927
+ "padding-block",
25928
+ "padding-block-start",
25929
+ "padding-block-end",
25930
+ "padding-inline",
25931
+ "padding-inline-start",
25932
+ "padding-inline-end",
25933
+ "padding-top",
25934
+ "padding-right",
25935
+ "padding-bottom",
25936
+ "padding-left"
25937
+ ],
25938
+ "padding-block": [
25939
+ "padding-block-start",
25940
+ "padding-block-end",
25941
+ "padding-top",
25942
+ "padding-right",
25943
+ "padding-bottom",
25944
+ "padding-left"
25945
+ ],
25946
+ "padding-block-start": [
25947
+ "padding-top",
25948
+ "padding-right",
25949
+ "padding-left"
25950
+ ],
25951
+ "padding-block-end": [
25952
+ "padding-right",
25953
+ "padding-bottom",
25954
+ "padding-left"
25955
+ ],
25956
+ "padding-inline": [
25957
+ "padding-inline-start",
25958
+ "padding-inline-end",
25959
+ "padding-top",
25960
+ "padding-right",
25961
+ "padding-bottom",
25962
+ "padding-left"
25963
+ ],
25964
+ "padding-inline-start": [
25965
+ "padding-top",
25966
+ "padding-right",
25967
+ "padding-left"
25968
+ ],
25969
+ "padding-inline-end": [
25970
+ "padding-right",
25971
+ "padding-bottom",
25972
+ "padding-left"
25973
+ ],
25974
+ "margin": [
25975
+ "margin-block",
25976
+ "margin-block-start",
25977
+ "margin-block-end",
25978
+ "margin-inline",
25979
+ "margin-inline-start",
25980
+ "margin-inline-end",
25981
+ "margin-top",
25982
+ "margin-right",
25983
+ "margin-bottom",
25984
+ "margin-left"
25985
+ ],
25986
+ "margin-block": [
25987
+ "margin-block-start",
25988
+ "margin-block-end",
25989
+ "margin-top",
25990
+ "margin-right",
25991
+ "margin-bottom",
25992
+ "margin-left"
25993
+ ],
25994
+ "margin-inline": [
25995
+ "margin-inline-start",
25996
+ "margin-inline-end",
25997
+ "margin-top",
25998
+ "margin-right",
25999
+ "margin-bottom",
26000
+ "margin-left"
26001
+ ],
26002
+ "margin-inline-start": [
26003
+ "margin-top",
26004
+ "margin-right",
26005
+ "margin-bottom",
26006
+ "margin-left"
26007
+ ],
26008
+ "margin-inline-end": [
26009
+ "margin-top",
26010
+ "margin-right",
26011
+ "margin-bottom",
26012
+ "margin-left"
26013
+ ],
25865
26014
  "border": [
25866
26015
  "border-top",
25867
26016
  "border-right",
@@ -25881,7 +26030,19 @@ var require_main = __commonJS({
25881
26030
  "border-top-color",
25882
26031
  "border-right-color",
25883
26032
  "border-bottom-color",
25884
- "border-left-color"
26033
+ "border-left-color",
26034
+ "border-block",
26035
+ "border-block-start",
26036
+ "border-block-end",
26037
+ "border-block-width",
26038
+ "border-block-style",
26039
+ "border-block-color",
26040
+ "border-inline",
26041
+ "border-inline-start",
26042
+ "border-inline-end",
26043
+ "border-inline-width",
26044
+ "border-inline-style",
26045
+ "border-inline-color"
25885
26046
  ],
25886
26047
  "border-top": [
25887
26048
  "border-width",
@@ -25939,99 +26100,64 @@ var require_main = __commonJS({
25939
26100
  "border-bottom-right-radius",
25940
26101
  "border-bottom-left-radius"
25941
26102
  ],
26103
+ "border-block": [
26104
+ "border-block-start",
26105
+ "border-block-end",
26106
+ "border-block-width",
26107
+ "border-width",
26108
+ "border-block-style",
26109
+ "border-style",
26110
+ "border-block-color",
26111
+ "border-color"
26112
+ ],
25942
26113
  "border-block-start": [
25943
26114
  "border-block-start-width",
26115
+ "border-width",
25944
26116
  "border-block-start-style",
25945
- "border-block-start-color"
26117
+ "border-style",
26118
+ "border-block-start-color",
26119
+ "border-color"
25946
26120
  ],
25947
26121
  "border-block-end": [
25948
26122
  "border-block-end-width",
26123
+ "border-width",
25949
26124
  "border-block-end-style",
25950
- "border-block-end-color"
26125
+ "border-style",
26126
+ "border-block-end-color",
26127
+ "border-color"
25951
26128
  ],
25952
- "border-image": [
25953
- "border-image-source",
25954
- "border-image-slice",
25955
- "border-image-width",
25956
- "border-image-outset",
25957
- "border-image-repeat"
26129
+ "border-inline": [
26130
+ "border-inline-start",
26131
+ "border-inline-end",
26132
+ "border-inline-width",
26133
+ "border-width",
26134
+ "border-inline-style",
26135
+ "border-style",
26136
+ "border-inline-color",
26137
+ "border-color"
25958
26138
  ],
25959
26139
  "border-inline-start": [
25960
26140
  "border-inline-start-width",
26141
+ "border-width",
25961
26142
  "border-inline-start-style",
25962
- "border-inline-start-color"
26143
+ "border-style",
26144
+ "border-inline-start-color",
26145
+ "border-color"
25963
26146
  ],
25964
26147
  "border-inline-end": [
25965
26148
  "border-inline-end-width",
26149
+ "border-width",
25966
26150
  "border-inline-end-style",
25967
- "border-inline-end-color"
25968
- ],
25969
- "columns": [
25970
- "column-width",
25971
- "column-count"
25972
- ],
25973
- "column-rule": [
25974
- "column-rule-width",
25975
- "column-rule-style",
25976
- "column-rule-color"
25977
- ],
25978
- "flex": [
25979
- "flex-grow",
25980
- "flex-shrink",
25981
- "flex-basis"
25982
- ],
25983
- "flex-flow": [
25984
- "flex-direction",
25985
- "flex-wrap"
25986
- ],
25987
- "font": [
25988
- "font-style",
25989
- "font-variant",
25990
- "font-weight",
25991
- "font-stretch",
25992
- "font-size",
25993
- "font-family",
25994
- "line-height"
25995
- ],
25996
- "grid": [
25997
- "grid-template-rows",
25998
- "grid-template-columns",
25999
- "grid-template-areas",
26000
- "grid-auto-rows",
26001
- "grid-auto-columns",
26002
- "grid-auto-flow",
26003
- "column-gap",
26004
- "row-gap"
26005
- ],
26006
- "grid-area": [
26007
- "grid-row-start",
26008
- "grid-column-start",
26009
- "grid-row-end",
26010
- "grid-column-end"
26011
- ],
26012
- "grid-column": [
26013
- "grid-column-start",
26014
- "grid-column-end"
26015
- ],
26016
- "grid-row": [
26017
- "grid-row-start",
26018
- "grid-row-end"
26019
- ],
26020
- "grid-template": [
26021
- "grid-template-columns",
26022
- "grid-template-rows",
26023
- "grid-template-areas"
26024
- ],
26025
- "list-style": [
26026
- "list-style-type",
26027
- "list-style-position",
26028
- "list-style-image"
26151
+ "border-style",
26152
+ "border-inline-end-color",
26153
+ "border-color"
26029
26154
  ],
26030
- "margin": [
26031
- "margin-top",
26032
- "margin-right",
26033
- "margin-bottom",
26034
- "margin-left"
26155
+ "border-image": [
26156
+ "border-image-source",
26157
+ "border-image-slice",
26158
+ "border-image-width",
26159
+ "border-image-outset",
26160
+ "border-image-repeat"
26035
26161
  ],
26036
26162
  "mask": [
26037
26163
  "mask-image",
@@ -26043,6 +26169,50 @@ var require_main = __commonJS({
26043
26169
  "mask-clip",
26044
26170
  "mask-composite"
26045
26171
  ],
26172
+ "inline-size": [
26173
+ "width",
26174
+ "height"
26175
+ ],
26176
+ "block-size": [
26177
+ "width",
26178
+ "height"
26179
+ ],
26180
+ "max-inline-size": [
26181
+ "max-width",
26182
+ "max-height"
26183
+ ],
26184
+ "max-block-size": [
26185
+ "max-width",
26186
+ "max-height"
26187
+ ],
26188
+ "inset": [
26189
+ "inset-block",
26190
+ "inset-block-start",
26191
+ "inset-block-end",
26192
+ "inset-inline",
26193
+ "inset-inline-start",
26194
+ "inset-inline-end",
26195
+ "top",
26196
+ "right",
26197
+ "bottom",
26198
+ "left"
26199
+ ],
26200
+ "inset-block": [
26201
+ "inset-block-start",
26202
+ "inset-block-end",
26203
+ "top",
26204
+ "right",
26205
+ "bottom",
26206
+ "left"
26207
+ ],
26208
+ "inset-inline": [
26209
+ "inset-inline-start",
26210
+ "inset-inline-end",
26211
+ "top",
26212
+ "right",
26213
+ "bottom",
26214
+ "left"
26215
+ ],
26046
26216
  "outline": [
26047
26217
  "outline-color",
26048
26218
  "outline-style",
@@ -26052,28 +26222,6 @@ var require_main = __commonJS({
26052
26222
  "overflow-x",
26053
26223
  "overflow-y"
26054
26224
  ],
26055
- "padding": [
26056
- "padding-top",
26057
- "padding-right",
26058
- "padding-bottom",
26059
- "padding-left"
26060
- ],
26061
- "padding-inline": [
26062
- "padding-inline-start",
26063
- "padding-inline-end"
26064
- ],
26065
- "padding-inline-start": [
26066
- "padding-top",
26067
- "padding-right",
26068
- "padding-bottom",
26069
- "padding-left"
26070
- ],
26071
- "padding-inline-end": [
26072
- "padding-top",
26073
- "padding-right",
26074
- "padding-bottom",
26075
- "padding-left"
26076
- ],
26077
26225
  "place-content": [
26078
26226
  "align-content",
26079
26227
  "justify-content"
@@ -26355,6 +26503,7 @@ var require_main = __commonJS({
26355
26503
  "columns",
26356
26504
  "contain",
26357
26505
  "content",
26506
+ "content-visibility",
26358
26507
  "counter-increment",
26359
26508
  "counter-reset",
26360
26509
  "counter-set",
@@ -26413,6 +26562,7 @@ var require_main = __commonJS({
26413
26562
  "height",
26414
26563
  "hyphenate-character",
26415
26564
  "hyphens",
26565
+ "image-orientation",
26416
26566
  "image-rendering",
26417
26567
  "inline-size",
26418
26568
  "inset",
@@ -26699,6 +26849,7 @@ var require_main = __commonJS({
26699
26849
  "perspective-origin",
26700
26850
  "appearance",
26701
26851
  "visibility",
26852
+ "content-visibility",
26702
26853
  "opacity",
26703
26854
  "z-index",
26704
26855
  "paint-order",
@@ -26853,6 +27004,7 @@ var require_main = __commonJS({
26853
27004
  "padding-block",
26854
27005
  "padding-block-start",
26855
27006
  "padding-block-end",
27007
+ "image-orientation",
26856
27008
  "image-rendering",
26857
27009
  "aspect-ratio",
26858
27010
  "width",
@@ -27004,6 +27156,7 @@ var require_main = __commonJS({
27004
27156
  "display",
27005
27157
  "appearance",
27006
27158
  "visibility",
27159
+ "content-visibility",
27007
27160
  "z-index",
27008
27161
  "paint-order",
27009
27162
  "position",
@@ -27303,6 +27456,7 @@ var require_main = __commonJS({
27303
27456
  "cursor",
27304
27457
  "empty-cells",
27305
27458
  "filter",
27459
+ "image-orientation",
27306
27460
  "image-rendering",
27307
27461
  "mask",
27308
27462
  "mask-border",
@@ -27484,7 +27638,7 @@ var require_src2 = __commonJS({
27484
27638
  node.remove();
27485
27639
  return;
27486
27640
  }
27487
- if (node.raws.between) {
27641
+ if (typeof node.raws.between === "string") {
27488
27642
  node.raws.between = replaceComments(node.raws.between, list.space);
27489
27643
  }
27490
27644
  if (node.type === "decl") {
@@ -73219,7 +73373,7 @@ var require_src11 = __commonJS({
73219
73373
  if (node.type !== "function") {
73220
73374
  return false;
73221
73375
  }
73222
- return ["var", "env"].includes(node.value.toLowerCase());
73376
+ return ["var", "env", "constant"].includes(node.value.toLowerCase());
73223
73377
  }
73224
73378
  function shouldAbort(parsed) {
73225
73379
  let abort = false;
@@ -73386,15 +73540,17 @@ var require_src12 = __commonJS({
73386
73540
  }
73387
73541
  return;
73388
73542
  }
73389
- const uniques = /* @__PURE__ */ new Set();
73390
73543
  selector.walk((child) => {
73391
- if (child.type === "selector") {
73392
- const childStr = String(child);
73393
- if (!uniques.has(childStr)) {
73394
- uniques.add(childStr);
73395
- } else {
73396
- child.remove();
73397
- }
73544
+ if (child.type === "selector" && child.parent) {
73545
+ const uniques = /* @__PURE__ */ new Set();
73546
+ child.parent.each((sibling) => {
73547
+ const siblingStr = String(sibling);
73548
+ if (!uniques.has(siblingStr)) {
73549
+ uniques.add(siblingStr);
73550
+ } else {
73551
+ sibling.remove();
73552
+ }
73553
+ });
73398
73554
  }
73399
73555
  });
73400
73556
  if (pseudoElements.has(value)) {
@@ -76531,7 +76687,7 @@ var require_src22 = __commonJS({
76531
76687
  }
76532
76688
  function intersect(a, b, not) {
76533
76689
  return a.filter((c) => {
76534
- const index = ~indexOfDeclaration(b, c);
76690
+ const index = indexOfDeclaration(b, c) !== -1;
76535
76691
  return not ? !index : index;
76536
76692
  });
76537
76693
  }
@@ -76549,14 +76705,16 @@ var require_src22 = __commonJS({
76549
76705
  return false;
76550
76706
  }
76551
76707
  const parent = sameParent(ruleA, ruleB);
76552
- const { name } = ruleA.parent;
76553
- if (parent && name && name.includes("keyframes")) {
76708
+ if (parent && ruleA.parent && ruleA.parent.type === "atrule" && ruleA.parent.name.includes("keyframes")) {
76554
76709
  return false;
76555
76710
  }
76556
76711
  return parent && (selectors.every(noVendor) || sameVendor(a, b));
76557
76712
  }
76713
+ function isDeclaration(node) {
76714
+ return node.type === "decl";
76715
+ }
76558
76716
  function getDecls(rule) {
76559
- return rule.nodes.filter((node) => node.type === "decl");
76717
+ return rule.nodes.filter(isDeclaration);
76560
76718
  }
76561
76719
  var joinSelectors = (...rules) => rules.map((s) => s.selector).join();
76562
76720
  function ruleLength(...rules) {
@@ -76673,7 +76831,7 @@ var require_src22 = __commonJS({
76673
76831
  const secondClone = second.clone();
76674
76832
  function moveDecl(callback) {
76675
76833
  return (decl) => {
76676
- if (~indexOfDeclaration(intersection, decl)) {
76834
+ if (indexOfDeclaration(intersection, decl) !== -1) {
76677
76835
  callback.call(this, decl);
76678
76836
  }
76679
76837
  };
@@ -76722,12 +76880,12 @@ var require_src22 = __commonJS({
76722
76880
  }
76723
76881
  if (cache.selector === rule.selector) {
76724
76882
  const cached = getDecls(cache);
76725
- rule.walk((decl) => {
76726
- if (~indexOfDeclaration(cached, decl)) {
76727
- decl.remove();
76883
+ rule.walk((node) => {
76884
+ if (node.type === "decl" && indexOfDeclaration(cached, node) !== -1) {
76885
+ node.remove();
76728
76886
  return;
76729
76887
  }
76730
- cache.append(decl);
76888
+ cache.append(node);
76731
76889
  });
76732
76890
  rule.remove();
76733
76891
  return;
@@ -64,31 +64,41 @@ function* buildRegExps(context) {
64
64
  ]),
65
65
  ])
66
66
 
67
- yield regex.pattern([
68
- // Variants
69
- '((?=((',
70
- regex.any(
71
- [
72
- regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/, separator]),
73
- regex.pattern([/[^\s"'`\[\\]+/, separator]),
74
- ],
75
- true
76
- ),
77
- ')+))\\2)?',
78
-
79
- // Important (optional)
80
- /!?/,
81
-
82
- variantGroupingEnabled
83
- ? regex.any([
84
- // Or any of those things but grouped separated by commas
85
- regex.pattern([/\(/, utility, regex.zeroOrMore([/,/, utility]), /\)/]),
86
-
87
- // Arbitrary properties, constrained utilities, arbitrary values, etc…
88
- utility,
89
- ])
90
- : utility,
91
- ])
67
+ let variantPatterns = [
68
+ // Without quotes
69
+ regex.any([
70
+ regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/, separator]),
71
+ regex.pattern([/[^\s"'`\[\\]+/, separator]),
72
+ ]),
73
+
74
+ // With quotes allowed
75
+ regex.any([
76
+ regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s`]+\]/, separator]),
77
+ regex.pattern([/[^\s`\[\\]+/, separator]),
78
+ ]),
79
+ ]
80
+
81
+ for (const variantPattern of variantPatterns) {
82
+ yield regex.pattern([
83
+ // Variants
84
+ '((?=((',
85
+ variantPattern,
86
+ ')+))\\2)?',
87
+
88
+ // Important (optional)
89
+ /!?/,
90
+
91
+ variantGroupingEnabled
92
+ ? regex.any([
93
+ // Or any of those things but grouped separated by commas
94
+ regex.pattern([/\(/, utility, regex.zeroOrMore([/,/, utility]), /\)/]),
95
+
96
+ // Arbitrary properties, constrained utilities, arbitrary values, etc…
97
+ utility,
98
+ ])
99
+ : utility,
100
+ ])
101
+ }
92
102
 
93
103
  // 5. Inner matches
94
104
  yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g
@@ -183,9 +183,15 @@ export default function ({ tailwindConfig: config }) {
183
183
  throw node.error(error)
184
184
  }
185
185
 
186
- if (alpha !== undefined) {
187
- value = parseColorFormat(value)
188
- value = withAlphaValue(value, alpha, value)
186
+ let maybeColor = parseColorFormat(value)
187
+ let isColorFunction = maybeColor !== undefined && typeof maybeColor === 'function'
188
+
189
+ if (alpha !== undefined || isColorFunction) {
190
+ if (alpha === undefined) {
191
+ alpha = 1.0
192
+ }
193
+
194
+ value = withAlphaValue(maybeColor, alpha, maybeColor)
189
195
  }
190
196
 
191
197
  return value
@@ -49,9 +49,7 @@ export function normalize(value, isRoot = true) {
49
49
  )
50
50
  })
51
51
 
52
- // Add spaces around some operators not inside calc() that do not follow an operator
53
- // or '('.
54
- return value.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([\/])/g, '$1 $2 ')
52
+ return value
55
53
  }
56
54
 
57
55
  export function url(value) {