tailwindcss 0.0.0-insiders.ed61821 → 0.0.0-insiders.ed8ff92

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 (222) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +15 -7
  3. package/colors.d.ts +3 -0
  4. package/colors.js +2 -304
  5. package/defaultConfig.d.ts +3 -0
  6. package/defaultConfig.js +2 -4
  7. package/defaultTheme.d.ts +4 -0
  8. package/defaultTheme.js +2 -4
  9. package/lib/cli/build/deps.js +54 -0
  10. package/lib/cli/build/index.js +48 -0
  11. package/lib/cli/build/plugin.js +367 -0
  12. package/lib/cli/build/utils.js +78 -0
  13. package/lib/cli/build/watching.js +178 -0
  14. package/lib/cli/help/index.js +71 -0
  15. package/lib/cli/index.js +239 -0
  16. package/lib/cli/init/index.js +46 -0
  17. package/lib/cli-peer-dependencies.js +20 -7
  18. package/lib/cli.js +4 -702
  19. package/lib/constants.js +27 -20
  20. package/lib/corePluginList.js +22 -4
  21. package/lib/corePlugins.js +2558 -1744
  22. package/lib/css/preflight.css +22 -9
  23. package/lib/featureFlags.js +39 -25
  24. package/lib/index.js +4 -30
  25. package/lib/lib/cacheInvalidation.js +90 -0
  26. package/lib/lib/collapseAdjacentRules.js +28 -10
  27. package/lib/lib/collapseDuplicateDeclarations.js +83 -0
  28. package/lib/lib/content.js +177 -0
  29. package/lib/lib/defaultExtractor.js +241 -0
  30. package/lib/lib/detectNesting.js +27 -3
  31. package/lib/lib/evaluateTailwindFunctions.js +117 -50
  32. package/lib/lib/expandApplyAtRules.js +457 -159
  33. package/lib/lib/expandTailwindAtRules.js +169 -153
  34. package/lib/lib/findAtConfigPath.js +44 -0
  35. package/lib/lib/generateRules.js +621 -105
  36. package/lib/lib/getModuleDependencies.js +11 -8
  37. package/lib/lib/normalizeTailwindDirectives.js +45 -33
  38. package/lib/lib/offsets.js +299 -0
  39. package/lib/lib/partitionApplyAtRules.js +56 -0
  40. package/lib/lib/regex.js +60 -0
  41. package/lib/lib/remap-bitfield.js +87 -0
  42. package/lib/lib/resolveDefaultsAtRules.js +114 -81
  43. package/lib/lib/setupContextUtils.js +839 -364
  44. package/lib/lib/setupTrackingContext.js +67 -71
  45. package/lib/lib/sharedState.js +63 -14
  46. package/lib/lib/substituteScreenAtRules.js +13 -8
  47. package/lib/oxide/cli/build/deps.js +81 -0
  48. package/lib/oxide/cli/build/index.js +47 -0
  49. package/lib/oxide/cli/build/plugin.js +364 -0
  50. package/lib/oxide/cli/build/utils.js +77 -0
  51. package/lib/oxide/cli/build/watching.js +177 -0
  52. package/lib/oxide/cli/help/index.js +70 -0
  53. package/lib/oxide/cli/index.js +220 -0
  54. package/lib/oxide/cli/init/index.js +35 -0
  55. package/lib/oxide/cli.js +5 -0
  56. package/lib/oxide/postcss-plugin.js +2 -0
  57. package/lib/plugin.js +48 -0
  58. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  59. package/lib/postcss-plugins/nesting/index.js +19 -0
  60. package/lib/postcss-plugins/nesting/plugin.js +87 -0
  61. package/lib/processTailwindFeatures.js +36 -21
  62. package/lib/public/colors.js +331 -0
  63. package/lib/public/create-plugin.js +15 -0
  64. package/lib/public/default-config.js +16 -0
  65. package/lib/public/default-theme.js +16 -0
  66. package/lib/public/resolve-config.js +22 -0
  67. package/lib/util/bigSign.js +4 -1
  68. package/lib/util/buildMediaQuery.js +18 -24
  69. package/lib/util/cloneDeep.js +7 -6
  70. package/lib/util/cloneNodes.js +21 -3
  71. package/lib/util/color.js +54 -40
  72. package/lib/util/configurePlugins.js +5 -2
  73. package/lib/util/createPlugin.js +6 -6
  74. package/lib/util/createUtilityPlugin.js +12 -14
  75. package/lib/util/dataTypes.js +164 -100
  76. package/lib/util/defaults.js +12 -3
  77. package/lib/util/escapeClassName.js +9 -6
  78. package/lib/util/escapeCommas.js +5 -2
  79. package/lib/util/flattenColorPalette.js +9 -12
  80. package/lib/util/formatVariantSelector.js +351 -0
  81. package/lib/util/getAllConfigs.js +29 -10
  82. package/lib/util/hashConfig.js +6 -3
  83. package/lib/util/isKeyframeRule.js +5 -2
  84. package/lib/util/isPlainObject.js +5 -2
  85. package/lib/util/isSyntacticallyValidPropertyValue.js +72 -0
  86. package/lib/util/log.js +44 -22
  87. package/lib/util/nameClass.js +20 -8
  88. package/lib/util/negateValue.js +24 -7
  89. package/lib/util/normalizeConfig.js +281 -0
  90. package/lib/util/normalizeScreens.js +170 -0
  91. package/lib/util/parseAnimationValue.js +47 -39
  92. package/lib/util/parseBoxShadowValue.js +84 -0
  93. package/lib/util/parseDependency.js +38 -53
  94. package/lib/util/parseGlob.js +34 -0
  95. package/lib/util/parseObjectStyles.js +11 -8
  96. package/lib/util/pluginUtils.js +186 -181
  97. package/lib/util/prefixSelector.js +27 -13
  98. package/lib/util/removeAlphaVariables.js +29 -0
  99. package/lib/util/resolveConfig.js +98 -137
  100. package/lib/util/resolveConfigPath.js +11 -9
  101. package/lib/util/responsive.js +8 -5
  102. package/lib/util/splitAtTopLevelOnly.js +43 -0
  103. package/lib/util/tap.js +4 -1
  104. package/lib/util/toColorValue.js +5 -3
  105. package/lib/util/toPath.js +24 -3
  106. package/lib/util/transformThemeValue.js +49 -31
  107. package/lib/util/validateConfig.js +24 -0
  108. package/lib/util/validateFormalSyntax.js +24 -0
  109. package/lib/util/withAlphaVariable.js +47 -24
  110. package/nesting/index.js +2 -12
  111. package/oxide-node-api-shim/index.js +21 -0
  112. package/oxide-node-api-shim/package.json +5 -0
  113. package/package.json +61 -52
  114. package/peers/index.js +76301 -84138
  115. package/plugin.d.ts +11 -0
  116. package/plugin.js +1 -2
  117. package/resolveConfig.d.ts +12 -0
  118. package/resolveConfig.js +2 -7
  119. package/scripts/create-plugin-list.js +2 -2
  120. package/scripts/generate-types.js +105 -0
  121. package/scripts/release-channel.js +18 -0
  122. package/scripts/release-notes.js +21 -0
  123. package/scripts/swap-engines.js +40 -0
  124. package/scripts/type-utils.js +27 -0
  125. package/src/cli/build/deps.js +56 -0
  126. package/src/cli/build/index.js +49 -0
  127. package/src/cli/build/plugin.js +439 -0
  128. package/src/cli/build/utils.js +76 -0
  129. package/src/cli/build/watching.js +227 -0
  130. package/src/cli/help/index.js +70 -0
  131. package/src/cli/index.js +234 -0
  132. package/src/cli/init/index.js +50 -0
  133. package/src/cli-peer-dependencies.js +7 -1
  134. package/src/cli.js +4 -756
  135. package/src/corePluginList.js +1 -1
  136. package/src/corePlugins.js +1087 -590
  137. package/src/css/preflight.css +22 -9
  138. package/src/featureFlags.js +26 -10
  139. package/src/index.js +4 -33
  140. package/src/lib/cacheInvalidation.js +52 -0
  141. package/src/lib/collapseAdjacentRules.js +21 -2
  142. package/src/lib/collapseDuplicateDeclarations.js +93 -0
  143. package/src/lib/content.js +208 -0
  144. package/src/lib/defaultExtractor.js +217 -0
  145. package/src/lib/detectNesting.js +30 -3
  146. package/src/lib/evaluateTailwindFunctions.js +84 -10
  147. package/src/lib/expandApplyAtRules.js +508 -153
  148. package/src/lib/expandTailwindAtRules.js +127 -108
  149. package/src/lib/findAtConfigPath.js +48 -0
  150. package/src/lib/generateRules.js +648 -69
  151. package/src/lib/normalizeTailwindDirectives.js +10 -3
  152. package/src/lib/offsets.js +367 -0
  153. package/src/lib/partitionApplyAtRules.js +52 -0
  154. package/src/lib/regex.js +74 -0
  155. package/src/lib/remap-bitfield.js +82 -0
  156. package/src/lib/resolveDefaultsAtRules.js +98 -60
  157. package/src/lib/setupContextUtils.js +814 -246
  158. package/src/lib/setupTrackingContext.js +50 -61
  159. package/src/lib/sharedState.js +60 -6
  160. package/src/lib/substituteScreenAtRules.js +6 -3
  161. package/src/oxide/cli/build/deps.ts +91 -0
  162. package/src/oxide/cli/build/index.ts +47 -0
  163. package/src/oxide/cli/build/plugin.ts +436 -0
  164. package/src/oxide/cli/build/utils.ts +74 -0
  165. package/src/oxide/cli/build/watching.ts +225 -0
  166. package/src/oxide/cli/help/index.ts +69 -0
  167. package/src/oxide/cli/index.ts +212 -0
  168. package/src/oxide/cli/init/index.ts +32 -0
  169. package/src/oxide/cli.ts +1 -0
  170. package/src/oxide/postcss-plugin.ts +1 -0
  171. package/src/plugin.js +47 -0
  172. package/src/postcss-plugins/nesting/README.md +42 -0
  173. package/src/postcss-plugins/nesting/index.js +13 -0
  174. package/src/postcss-plugins/nesting/plugin.js +80 -0
  175. package/src/processTailwindFeatures.js +18 -3
  176. package/src/public/colors.js +300 -0
  177. package/src/public/create-plugin.js +2 -0
  178. package/src/public/default-config.js +4 -0
  179. package/src/public/default-theme.js +4 -0
  180. package/src/public/resolve-config.js +7 -0
  181. package/src/util/buildMediaQuery.js +14 -16
  182. package/src/util/cloneNodes.js +19 -2
  183. package/src/util/color.js +31 -14
  184. package/src/util/createUtilityPlugin.js +2 -2
  185. package/src/util/dataTypes.js +86 -21
  186. package/src/util/defaults.js +6 -0
  187. package/src/util/formatVariantSelector.js +412 -0
  188. package/src/util/getAllConfigs.js +19 -0
  189. package/src/util/isSyntacticallyValidPropertyValue.js +61 -0
  190. package/src/util/log.js +23 -22
  191. package/src/util/nameClass.js +6 -2
  192. package/src/util/negateValue.js +15 -5
  193. package/src/util/normalizeConfig.js +300 -0
  194. package/src/util/normalizeScreens.js +140 -0
  195. package/src/util/parseAnimationValue.js +7 -1
  196. package/src/util/parseBoxShadowValue.js +72 -0
  197. package/src/util/parseDependency.js +37 -38
  198. package/src/util/parseGlob.js +24 -0
  199. package/src/util/pluginUtils.js +177 -143
  200. package/src/util/prefixSelector.js +30 -13
  201. package/src/util/removeAlphaVariables.js +24 -0
  202. package/src/util/resolveConfig.js +86 -91
  203. package/src/util/splitAtTopLevelOnly.js +45 -0
  204. package/src/util/toPath.js +23 -1
  205. package/src/util/transformThemeValue.js +33 -8
  206. package/src/util/validateConfig.js +13 -0
  207. package/src/util/validateFormalSyntax.js +34 -0
  208. package/src/util/withAlphaVariable.js +14 -9
  209. package/stubs/defaultConfig.stub.js +313 -241
  210. package/stubs/simpleConfig.stub.js +1 -1
  211. package/types/config.d.ts +367 -0
  212. package/types/generated/.gitkeep +0 -0
  213. package/types/generated/colors.d.ts +276 -0
  214. package/types/generated/corePluginList.d.ts +1 -0
  215. package/types/generated/default-theme.d.ts +345 -0
  216. package/types/index.d.ts +7 -0
  217. package/CHANGELOG.md +0 -1744
  218. package/lib/lib/setupWatchingContext.js +0 -284
  219. package/nesting/plugin.js +0 -41
  220. package/scripts/install-integrations.js +0 -27
  221. package/scripts/rebuildFixtures.js +0 -68
  222. package/src/lib/setupWatchingContext.js +0 -307
@@ -1,145 +1,113 @@
1
1
  import fs from 'fs'
2
+ import * as path from 'path'
2
3
  import postcss from 'postcss'
4
+ import { env } from './lib/sharedState'
3
5
  import createUtilityPlugin from './util/createUtilityPlugin'
4
6
  import buildMediaQuery from './util/buildMediaQuery'
5
- import prefixSelector from './util/prefixSelector'
7
+ import escapeClassName from './util/escapeClassName'
6
8
  import parseAnimationValue from './util/parseAnimationValue'
7
9
  import flattenColorPalette from './util/flattenColorPalette'
8
10
  import withAlphaVariable, { withAlphaValue } from './util/withAlphaVariable'
9
11
  import toColorValue from './util/toColorValue'
10
12
  import isPlainObject from './util/isPlainObject'
11
13
  import transformThemeValue from './util/transformThemeValue'
12
- import {
13
- applyPseudoToMarker,
14
- updateLastClasses,
15
- updateAllClasses,
16
- transformAllSelectors,
17
- transformAllClasses,
18
- transformLastClasses,
19
- } from './util/pluginUtils'
20
- import packageJson from '../package.json'
14
+ import { version as tailwindVersion } from '../package.json'
21
15
  import log from './util/log'
22
-
23
- export default {
24
- // Variant plugins
25
- pseudoElementVariants: ({ config, addVariant }) => {
26
- addVariant(
27
- 'first-letter',
28
- transformAllSelectors((selector) => {
29
- return updateAllClasses(selector, (className, { withPseudo }) => {
30
- return withPseudo(`first-letter${config('separator')}${className}`, '::first-letter')
31
- })
32
- })
33
- )
34
-
35
- addVariant(
36
- 'first-line',
37
- transformAllSelectors((selector) => {
38
- return updateAllClasses(selector, (className, { withPseudo }) => {
39
- return withPseudo(`first-line${config('separator')}${className}`, '::first-line')
40
- })
41
- })
42
- )
16
+ import {
17
+ normalizeScreens,
18
+ isScreenSortable,
19
+ compareScreens,
20
+ toScreen,
21
+ } from './util/normalizeScreens'
22
+ import { formatBoxShadowValue, parseBoxShadowValue } from './util/parseBoxShadowValue'
23
+ import { removeAlphaVariables } from './util/removeAlphaVariables'
24
+ import { flagEnabled } from './featureFlags'
25
+ import { normalize } from './util/dataTypes'
26
+
27
+ export let variantPlugins = {
28
+ pseudoElementVariants: ({ addVariant }) => {
29
+ addVariant('first-letter', '&::first-letter')
30
+ addVariant('first-line', '&::first-line')
43
31
 
44
32
  addVariant('marker', [
45
- transformAllSelectors((selector) => {
46
- let variantSelector = updateAllClasses(selector, (className) => {
47
- return `marker${config('separator')}${className}`
48
- })
33
+ ({ container }) => {
34
+ removeAlphaVariables(container, ['--tw-text-opacity'])
49
35
 
50
- return `${variantSelector} *::marker`
51
- }),
52
- transformAllSelectors((selector) => {
53
- return updateAllClasses(selector, (className, { withPseudo }) => {
54
- return withPseudo(`marker${config('separator')}${className}`, '::marker')
55
- })
56
- }),
36
+ return '& *::marker'
37
+ },
38
+ ({ container }) => {
39
+ removeAlphaVariables(container, ['--tw-text-opacity'])
40
+
41
+ return '&::marker'
42
+ },
57
43
  ])
58
44
 
59
- addVariant('selection', [
60
- transformAllSelectors((selector) => {
61
- let variantSelector = updateAllClasses(selector, (className) => {
62
- return `selection${config('separator')}${className}`
63
- })
45
+ addVariant('selection', ['& *::selection', '&::selection'])
64
46
 
65
- return `${variantSelector} *::selection`
66
- }),
67
- transformAllSelectors((selector) => {
68
- return updateAllClasses(selector, (className, { withPseudo }) => {
69
- return withPseudo(`selection${config('separator')}${className}`, '::selection')
70
- })
71
- }),
72
- ])
47
+ addVariant('file', '&::file-selector-button')
48
+
49
+ addVariant('placeholder', '&::placeholder')
73
50
 
74
- addVariant(
75
- 'file',
76
- transformAllSelectors((selector) => {
77
- return updateAllClasses(selector, (className, { withPseudo }) => {
78
- return withPseudo(`file${config('separator')}${className}`, '::file-selector-button')
51
+ addVariant('backdrop', '&::backdrop')
52
+
53
+ addVariant('before', ({ container }) => {
54
+ container.walkRules((rule) => {
55
+ let foundContent = false
56
+ rule.walkDecls('content', () => {
57
+ foundContent = true
79
58
  })
80
- })
81
- )
82
59
 
83
- addVariant(
84
- 'before',
85
- transformAllSelectors(
86
- (selector) => {
87
- return updateAllClasses(selector, (className, { withPseudo }) => {
88
- return withPseudo(`before${config('separator')}${className}`, '::before')
89
- })
90
- },
91
- {
92
- withRule: (rule) => {
93
- let foundContent = false
94
- rule.walkDecls('content', () => {
95
- foundContent = true
96
- })
97
- if (!foundContent) {
98
- rule.prepend(postcss.decl({ prop: 'content', value: '""' }))
99
- }
100
- },
60
+ if (!foundContent) {
61
+ rule.prepend(postcss.decl({ prop: 'content', value: 'var(--tw-content)' }))
101
62
  }
102
- )
103
- )
63
+ })
104
64
 
105
- addVariant(
106
- 'after',
107
- transformAllSelectors(
108
- (selector) => {
109
- return updateAllClasses(selector, (className, { withPseudo }) => {
110
- return withPseudo(`after${config('separator')}${className}`, '::after')
111
- })
112
- },
113
- {
114
- withRule: (rule) => {
115
- let foundContent = false
116
- rule.walkDecls('content', () => {
117
- foundContent = true
118
- })
119
- if (!foundContent) {
120
- rule.prepend(postcss.decl({ prop: 'content', value: '""' }))
121
- }
122
- },
65
+ return '&::before'
66
+ })
67
+
68
+ addVariant('after', ({ container }) => {
69
+ container.walkRules((rule) => {
70
+ let foundContent = false
71
+ rule.walkDecls('content', () => {
72
+ foundContent = true
73
+ })
74
+
75
+ if (!foundContent) {
76
+ rule.prepend(postcss.decl({ prop: 'content', value: 'var(--tw-content)' }))
123
77
  }
124
- )
125
- )
78
+ })
79
+
80
+ return '&::after'
81
+ })
126
82
  },
127
83
 
128
- pseudoClassVariants: ({ config, addVariant }) => {
84
+ pseudoClassVariants: ({ addVariant, matchVariant, config }) => {
129
85
  let pseudoVariants = [
130
86
  // Positional
131
- ['first', 'first-child'],
132
- ['last', 'last-child'],
133
- ['only', 'only-child'],
134
- ['odd', 'nth-child(odd)'],
135
- ['even', 'nth-child(even)'],
87
+ ['first', '&:first-child'],
88
+ ['last', '&:last-child'],
89
+ ['only', '&:only-child'],
90
+ ['odd', '&:nth-child(odd)'],
91
+ ['even', '&:nth-child(even)'],
136
92
  'first-of-type',
137
93
  'last-of-type',
138
94
  'only-of-type',
139
95
 
140
96
  // State
141
- 'visited',
97
+ [
98
+ 'visited',
99
+ ({ container }) => {
100
+ removeAlphaVariables(container, [
101
+ '--tw-text-opacity',
102
+ '--tw-border-opacity',
103
+ '--tw-bg-opacity',
104
+ ])
105
+
106
+ return '&:visited'
107
+ },
108
+ ],
142
109
  'target',
110
+ ['open', '&[open]'],
143
111
 
144
112
  // Forms
145
113
  'default',
@@ -147,6 +115,7 @@ export default {
147
115
  'indeterminate',
148
116
  'placeholder-shown',
149
117
  'autofill',
118
+ 'optional',
150
119
  'required',
151
120
  'valid',
152
121
  'invalid',
@@ -159,228 +128,360 @@ export default {
159
128
 
160
129
  // Interactive
161
130
  'focus-within',
162
- 'hover',
131
+ [
132
+ 'hover',
133
+ !flagEnabled(config(), 'hoverOnlyWhenSupported')
134
+ ? '&:hover'
135
+ : '@media (hover: hover) and (pointer: fine) { &:hover }',
136
+ ],
163
137
  'focus',
164
138
  'focus-visible',
165
139
  'active',
140
+ 'enabled',
166
141
  'disabled',
167
- ]
142
+ ].map((variant) => (Array.isArray(variant) ? variant : [variant, `&:${variant}`]))
168
143
 
169
- for (let variant of pseudoVariants) {
170
- let [variantName, state] = Array.isArray(variant) ? variant : [variant, variant]
144
+ for (let [variantName, state] of pseudoVariants) {
145
+ addVariant(variantName, (ctx) => {
146
+ let result = typeof state === 'function' ? state(ctx) : state
171
147
 
172
- addVariant(
173
- variantName,
174
- transformAllClasses((className, { withPseudo }) => {
175
- return withPseudo(`${variantName}${config('separator')}${className}`, `:${state}`)
176
- })
177
- )
148
+ return result
149
+ })
178
150
  }
179
151
 
180
- let groupMarker = prefixSelector(config('prefix'), '.group')
181
- for (let variant of pseudoVariants) {
182
- let [variantName, state] = Array.isArray(variant) ? variant : [variant, variant]
183
- let groupVariantName = `group-${variantName}`
184
-
185
- addVariant(
186
- groupVariantName,
187
- transformAllSelectors((selector) => {
188
- let variantSelector = updateAllClasses(selector, (className) => {
189
- if (`.${className}` === groupMarker) return className
190
- return `${groupVariantName}${config('separator')}${className}`
191
- })
192
-
193
- if (variantSelector === selector) {
194
- return null
195
- }
196
-
197
- return applyPseudoToMarker(
198
- variantSelector,
199
- groupMarker,
200
- state,
201
- (marker, selector) => `${marker} ${selector}`
202
- )
203
- })
204
- )
152
+ let variants = {
153
+ group: (_, { modifier }) =>
154
+ modifier
155
+ ? [`:merge(.group\\/${escapeClassName(modifier)})`, ' &']
156
+ : [`:merge(.group)`, ' &'],
157
+ peer: (_, { modifier }) =>
158
+ modifier
159
+ ? [`:merge(.peer\\/${escapeClassName(modifier)})`, ' ~ &']
160
+ : [`:merge(.peer)`, ' ~ &'],
205
161
  }
206
162
 
207
- let peerMarker = prefixSelector(config('prefix'), '.peer')
208
- for (let variant of pseudoVariants) {
209
- let [variantName, state] = Array.isArray(variant) ? variant : [variant, variant]
210
- let peerVariantName = `peer-${variantName}`
211
-
212
- addVariant(
213
- peerVariantName,
214
- transformAllSelectors((selector) => {
215
- let variantSelector = updateAllClasses(selector, (className) => {
216
- if (`.${className}` === peerMarker) return className
217
- return `${peerVariantName}${config('separator')}${className}`
218
- })
219
-
220
- if (variantSelector === selector) {
221
- return null
222
- }
163
+ for (let [name, fn] of Object.entries(variants)) {
164
+ matchVariant(
165
+ name,
166
+ (value = '', extra) => {
167
+ let result = normalize(typeof value === 'function' ? value(extra) : value)
168
+ if (!result.includes('&')) result = '&' + result
223
169
 
224
- return applyPseudoToMarker(variantSelector, peerMarker, state, (marker, selector) =>
225
- selector.trim().startsWith('~') ? `${marker}${selector}` : `${marker} ~ ${selector}`
226
- )
227
- })
170
+ let [a, b] = fn('', extra)
171
+ return result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
172
+ },
173
+ { values: Object.fromEntries(pseudoVariants) }
228
174
  )
229
175
  }
230
176
  },
231
177
 
232
- directionVariants: ({ config, addVariant }) => {
233
- addVariant(
234
- 'ltr',
235
- transformAllSelectors(
236
- (selector) =>
237
- `[dir="ltr"] ${updateAllClasses(
238
- selector,
239
- (className) => `ltr${config('separator')}${className}`
240
- )}`
241
- )
242
- )
178
+ directionVariants: ({ addVariant }) => {
179
+ addVariant('ltr', () => {
180
+ log.warn('rtl-experimental', [
181
+ 'The RTL features in Tailwind CSS are currently in preview.',
182
+ 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
183
+ ])
243
184
 
244
- addVariant(
245
- 'rtl',
246
- transformAllSelectors(
247
- (selector) =>
248
- `[dir="rtl"] ${updateAllClasses(
249
- selector,
250
- (className) => `rtl${config('separator')}${className}`
251
- )}`
252
- )
253
- )
254
- },
185
+ return '[dir="ltr"] &'
186
+ })
255
187
 
256
- reducedMotionVariants: ({ config, addVariant }) => {
257
- addVariant(
258
- 'motion-safe',
259
- transformLastClasses(
260
- (className) => {
261
- return `motion-safe${config('separator')}${className}`
262
- },
263
- {
264
- wrap: () =>
265
- postcss.atRule({
266
- name: 'media',
267
- params: '(prefers-reduced-motion: no-preference)',
268
- }),
269
- }
270
- )
271
- )
188
+ addVariant('rtl', () => {
189
+ log.warn('rtl-experimental', [
190
+ 'The RTL features in Tailwind CSS are currently in preview.',
191
+ 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
192
+ ])
272
193
 
273
- addVariant(
274
- 'motion-reduce',
275
- transformLastClasses(
276
- (className) => {
277
- return `motion-reduce${config('separator')}${className}`
278
- },
279
- {
280
- wrap: () =>
281
- postcss.atRule({
282
- name: 'media',
283
- params: '(prefers-reduced-motion: reduce)',
284
- }),
285
- }
286
- )
287
- )
194
+ return '[dir="rtl"] &'
195
+ })
196
+ },
197
+
198
+ reducedMotionVariants: ({ addVariant }) => {
199
+ addVariant('motion-safe', '@media (prefers-reduced-motion: no-preference)')
200
+ addVariant('motion-reduce', '@media (prefers-reduced-motion: reduce)')
288
201
  },
289
202
 
290
203
  darkVariants: ({ config, addVariant }) => {
291
- let mode = config('darkMode', 'media')
204
+ let [mode, className = '.dark'] = [].concat(config('darkMode', 'media'))
205
+
292
206
  if (mode === false) {
293
207
  mode = 'media'
294
- log.warn([
295
- '`darkMode` is set to `false` in your config.',
296
- 'This will behave just like the `media` value.',
208
+ log.warn('darkmode-false', [
209
+ 'The `darkMode` option in your Tailwind CSS configuration is set to `false`, which now behaves the same as `media`.',
210
+ 'Change `darkMode` to `media` or remove it entirely.',
211
+ 'https://tailwindcss.com/docs/upgrade-guide#remove-dark-mode-configuration',
297
212
  ])
298
213
  }
299
214
 
300
215
  if (mode === 'class') {
301
- addVariant(
302
- 'dark',
303
- transformAllSelectors((selector) => {
304
- let variantSelector = updateLastClasses(selector, (className) => {
305
- return `dark${config('separator')}${className}`
306
- })
216
+ addVariant('dark', `${className} &`)
217
+ } else if (mode === 'media') {
218
+ addVariant('dark', '@media (prefers-color-scheme: dark)')
219
+ }
220
+ },
307
221
 
308
- if (variantSelector === selector) {
309
- return null
310
- }
222
+ printVariant: ({ addVariant }) => {
223
+ addVariant('print', '@media print')
224
+ },
311
225
 
312
- let darkSelector = prefixSelector(config('prefix'), `.dark`)
226
+ screenVariants: ({ theme, addVariant, matchVariant }) => {
227
+ let rawScreens = theme('screens') ?? {}
228
+ let areSimpleScreens = Object.values(rawScreens).every((v) => typeof v === 'string')
229
+ let screens = normalizeScreens(theme('screens'))
313
230
 
314
- return `${darkSelector} ${variantSelector}`
315
- })
316
- )
317
- } else if (mode === 'media') {
318
- addVariant(
319
- 'dark',
320
- transformLastClasses(
321
- (className) => {
322
- return `dark${config('separator')}${className}`
323
- },
324
- {
325
- wrap: () =>
326
- postcss.atRule({
327
- name: 'media',
328
- params: '(prefers-color-scheme: dark)',
329
- }),
330
- }
331
- )
332
- )
231
+ /** @type {Set<string>} */
232
+ let unitCache = new Set([])
233
+
234
+ /** @param {string} value */
235
+ function units(value) {
236
+ return value.match(/(\D+)$/)?.[1] ?? '(none)'
333
237
  }
334
- },
335
238
 
336
- screenVariants: ({ config, theme, addVariant }) => {
337
- for (let screen in theme('screens')) {
338
- let size = theme('screens')[screen]
339
- let query = buildMediaQuery(size)
239
+ /** @param {string} value */
240
+ function recordUnits(value) {
241
+ if (value !== undefined) {
242
+ unitCache.add(units(value))
243
+ }
244
+ }
340
245
 
341
- addVariant(
342
- screen,
343
- transformLastClasses(
344
- (className) => {
345
- return `${screen}${config('separator')}${className}`
346
- },
347
- { wrap: () => postcss.atRule({ name: 'media', params: query }) }
348
- )
246
+ /** @param {string} value */
247
+ function canUseUnits(value) {
248
+ recordUnits(value)
249
+
250
+ // If the cache was empty it'll become 1 because we've just added the current unit
251
+ // If the cache was not empty and the units are the same the size doesn't change
252
+ // Otherwise, if the units are different from what is already known the size will always be > 1
253
+ return unitCache.size === 1
254
+ }
255
+
256
+ for (const screen of screens) {
257
+ for (const value of screen.values) {
258
+ recordUnits(value.min)
259
+ recordUnits(value.max)
260
+ }
261
+ }
262
+
263
+ let screensUseConsistentUnits = unitCache.size <= 1
264
+
265
+ /**
266
+ * @typedef {import('./util/normalizeScreens').Screen} Screen
267
+ */
268
+
269
+ /**
270
+ * @param {'min' | 'max'} type
271
+ * @returns {Record<string, Screen>}
272
+ */
273
+ function buildScreenValues(type) {
274
+ return Object.fromEntries(
275
+ screens
276
+ .filter((screen) => isScreenSortable(screen).result)
277
+ .map((screen) => {
278
+ let { min, max } = screen.values[0]
279
+
280
+ if (type === 'min' && min !== undefined) {
281
+ return screen
282
+ } else if (type === 'min' && max !== undefined) {
283
+ return { ...screen, not: !screen.not }
284
+ } else if (type === 'max' && max !== undefined) {
285
+ return screen
286
+ } else if (type === 'max' && min !== undefined) {
287
+ return { ...screen, not: !screen.not }
288
+ }
289
+ })
290
+ .map((screen) => [screen.name, screen])
349
291
  )
350
292
  }
293
+
294
+ /**
295
+ * @param {'min' | 'max'} type
296
+ * @returns {(a: { value: string | Screen }, z: { value: string | Screen }) => number}
297
+ */
298
+ function buildSort(type) {
299
+ return (a, z) => compareScreens(type, a.value, z.value)
300
+ }
301
+
302
+ let maxSort = buildSort('max')
303
+ let minSort = buildSort('min')
304
+
305
+ /** @param {'min'|'max'} type */
306
+ function buildScreenVariant(type) {
307
+ return (value) => {
308
+ if (!areSimpleScreens) {
309
+ log.warn('complex-screen-config', [
310
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing objects.',
311
+ ])
312
+
313
+ return []
314
+ } else if (!screensUseConsistentUnits) {
315
+ log.warn('mixed-screen-units', [
316
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
317
+ ])
318
+
319
+ return []
320
+ } else if (typeof value === 'string' && !canUseUnits(value)) {
321
+ log.warn('minmax-have-mixed-units', [
322
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
323
+ ])
324
+
325
+ return []
326
+ }
327
+
328
+ return [`@media ${buildMediaQuery(toScreen(value, type))}`]
329
+ }
330
+ }
331
+
332
+ matchVariant('max', buildScreenVariant('max'), {
333
+ sort: maxSort,
334
+ values: areSimpleScreens ? buildScreenValues('max') : {},
335
+ })
336
+
337
+ // screens and min-* are sorted together when they can be
338
+ let id = 'min-screens'
339
+ for (let screen of screens) {
340
+ addVariant(screen.name, `@media ${buildMediaQuery(screen)}`, {
341
+ id,
342
+ sort: areSimpleScreens && screensUseConsistentUnits ? minSort : undefined,
343
+ value: screen,
344
+ })
345
+ }
346
+
347
+ matchVariant('min', buildScreenVariant('min'), {
348
+ id,
349
+ sort: minSort,
350
+ })
351
+ },
352
+
353
+ supportsVariants: ({ matchVariant, theme }) => {
354
+ matchVariant(
355
+ 'supports',
356
+ (value = '') => {
357
+ let check = normalize(value)
358
+ let isRaw = /^\w*\s*\(/.test(check)
359
+
360
+ // Chrome has a bug where `(condtion1)or(condition2)` is not valid
361
+ // But `(condition1) or (condition2)` is supported.
362
+ check = isRaw ? check.replace(/\b(and|or|not)\b/g, ' $1 ') : check
363
+
364
+ if (isRaw) {
365
+ return `@supports ${check}`
366
+ }
367
+
368
+ if (!check.includes(':')) {
369
+ check = `${check}: var(--tw)`
370
+ }
371
+
372
+ if (!(check.startsWith('(') && check.endsWith(')'))) {
373
+ check = `(${check})`
374
+ }
375
+
376
+ return `@supports ${check}`
377
+ },
378
+ { values: theme('supports') ?? {} }
379
+ )
380
+ },
381
+
382
+ ariaVariants: ({ matchVariant, theme }) => {
383
+ matchVariant('aria', (value) => `&[aria-${normalize(value)}]`, { values: theme('aria') ?? {} })
384
+ matchVariant(
385
+ 'group-aria',
386
+ (value, { modifier }) =>
387
+ modifier
388
+ ? `:merge(.group\\/${modifier})[aria-${normalize(value)}] &`
389
+ : `:merge(.group)[aria-${normalize(value)}] &`,
390
+ { values: theme('aria') ?? {} }
391
+ )
392
+ matchVariant(
393
+ 'peer-aria',
394
+ (value, { modifier }) =>
395
+ modifier
396
+ ? `:merge(.peer\\/${modifier})[aria-${normalize(value)}] ~ &`
397
+ : `:merge(.peer)[aria-${normalize(value)}] ~ &`,
398
+ { values: theme('aria') ?? {} }
399
+ )
400
+ },
401
+
402
+ dataVariants: ({ matchVariant, theme }) => {
403
+ matchVariant('data', (value) => `&[data-${normalize(value)}]`, { values: theme('data') ?? {} })
404
+ matchVariant(
405
+ 'group-data',
406
+ (value, { modifier }) =>
407
+ modifier
408
+ ? `:merge(.group\\/${modifier})[data-${normalize(value)}] &`
409
+ : `:merge(.group)[data-${normalize(value)}] &`,
410
+ { values: theme('data') ?? {} }
411
+ )
412
+ matchVariant(
413
+ 'peer-data',
414
+ (value, { modifier }) =>
415
+ modifier
416
+ ? `:merge(.peer\\/${modifier})[data-${normalize(value)}] ~ &`
417
+ : `:merge(.peer)[data-${normalize(value)}] ~ &`,
418
+ { values: theme('data') ?? {} }
419
+ )
351
420
  },
352
421
 
353
- // Actual plugins
422
+ orientationVariants: ({ addVariant }) => {
423
+ addVariant('portrait', '@media (orientation: portrait)')
424
+ addVariant('landscape', '@media (orientation: landscape)')
425
+ },
426
+
427
+ prefersContrastVariants: ({ addVariant }) => {
428
+ addVariant('contrast-more', '@media (prefers-contrast: more)')
429
+ addVariant('contrast-less', '@media (prefers-contrast: less)')
430
+ },
431
+ }
432
+
433
+ let cssTransformValue = [
434
+ 'translate(var(--tw-translate-x), var(--tw-translate-y))',
435
+ 'rotate(var(--tw-rotate))',
436
+ 'skewX(var(--tw-skew-x))',
437
+ 'skewY(var(--tw-skew-y))',
438
+ 'scaleX(var(--tw-scale-x))',
439
+ 'scaleY(var(--tw-scale-y))',
440
+ ].join(' ')
441
+
442
+ let cssFilterValue = [
443
+ 'var(--tw-blur)',
444
+ 'var(--tw-brightness)',
445
+ 'var(--tw-contrast)',
446
+ 'var(--tw-grayscale)',
447
+ 'var(--tw-hue-rotate)',
448
+ 'var(--tw-invert)',
449
+ 'var(--tw-saturate)',
450
+ 'var(--tw-sepia)',
451
+ 'var(--tw-drop-shadow)',
452
+ ].join(' ')
453
+
454
+ let cssBackdropFilterValue = [
455
+ 'var(--tw-backdrop-blur)',
456
+ 'var(--tw-backdrop-brightness)',
457
+ 'var(--tw-backdrop-contrast)',
458
+ 'var(--tw-backdrop-grayscale)',
459
+ 'var(--tw-backdrop-hue-rotate)',
460
+ 'var(--tw-backdrop-invert)',
461
+ 'var(--tw-backdrop-opacity)',
462
+ 'var(--tw-backdrop-saturate)',
463
+ 'var(--tw-backdrop-sepia)',
464
+ ].join(' ')
465
+
466
+ export let corePlugins = {
354
467
  preflight: ({ addBase }) => {
355
- let preflightStyles = postcss.parse(fs.readFileSync(`${__dirname}/css/preflight.css`, 'utf8'))
468
+ let preflightStyles = postcss.parse(
469
+ fs.readFileSync(path.join(__dirname, './css/preflight.css'), 'utf8')
470
+ )
356
471
 
357
472
  addBase([
358
473
  postcss.comment({
359
- text: `! tailwindcss v${packageJson.version} | MIT License | https://tailwindcss.com`,
474
+ text: `! tailwindcss v${tailwindVersion} | MIT License | https://tailwindcss.com`,
360
475
  }),
361
476
  ...preflightStyles.nodes,
362
477
  ])
363
478
  },
364
479
 
365
480
  container: (() => {
366
- function extractMinWidths(breakpoints) {
367
- return Object.values(breakpoints ?? {}).flatMap((breakpoints) => {
368
- if (typeof breakpoints === 'string') {
369
- breakpoints = { min: breakpoints }
370
- }
371
-
372
- if (!Array.isArray(breakpoints)) {
373
- breakpoints = [breakpoints]
374
- }
375
-
376
- return breakpoints
377
- .filter((breakpoint) => {
378
- return breakpoint?.hasOwnProperty?.('min') || breakpoint?.hasOwnProperty('min-width')
379
- })
380
- .map((breakpoint) => {
381
- return breakpoint['min-width'] ?? breakpoint.min
382
- })
383
- })
481
+ function extractMinWidths(breakpoints = []) {
482
+ return breakpoints
483
+ .flatMap((breakpoint) => breakpoint.values.map((breakpoint) => breakpoint.min))
484
+ .filter((v) => v !== undefined)
384
485
  }
385
486
 
386
487
  function mapMinWidthsToPadding(minWidths, screens, paddings) {
@@ -409,16 +510,11 @@ export default {
409
510
  }
410
511
 
411
512
  for (let minWidth of minWidths) {
412
- for (let [screen, value] of Object.entries(screens)) {
413
- let screenMinWidth =
414
- typeof value === 'object' && value !== null ? value.min || value['min-width'] : value
415
-
416
- if (`${screenMinWidth}` === `${minWidth}`) {
417
- mapping.push({
418
- screen,
419
- minWidth,
420
- padding: paddings[screen],
421
- })
513
+ for (let screen of screens) {
514
+ for (let { min } of screen.values) {
515
+ if (min === minWidth) {
516
+ mapping.push({ minWidth, padding: paddings[screen.name] })
517
+ }
422
518
  }
423
519
  }
424
520
  }
@@ -427,12 +523,12 @@ export default {
427
523
  }
428
524
 
429
525
  return function ({ addComponents, theme }) {
430
- let screens = theme('container.screens', theme('screens'))
526
+ let screens = normalizeScreens(theme('container.screens', theme('screens')))
431
527
  let minWidths = extractMinWidths(screens)
432
528
  let paddings = mapMinWidthsToPadding(minWidths, screens, theme('container.padding'))
433
529
 
434
530
  let generatePaddingFor = (minWidth) => {
435
- let paddingConfig = paddings.find((padding) => `${padding.minWidth}` === `${minWidth}`)
531
+ let paddingConfig = paddings.find((padding) => padding.minWidth === minWidth)
436
532
 
437
533
  if (!paddingConfig) {
438
534
  return {}
@@ -505,6 +601,7 @@ export default {
505
601
  addUtilities({
506
602
  '.visible': { visibility: 'visible' },
507
603
  '.invisible': { visibility: 'hidden' },
604
+ '.collapse': { visibility: 'collapse' },
508
605
  })
509
606
  },
510
607
 
@@ -518,19 +615,25 @@ export default {
518
615
  })
519
616
  },
520
617
 
521
- inset: createUtilityPlugin('inset', [
522
- ['inset', ['top', 'right', 'bottom', 'left']],
618
+ inset: createUtilityPlugin(
619
+ 'inset',
523
620
  [
524
- ['inset-x', ['left', 'right']],
525
- ['inset-y', ['top', 'bottom']],
526
- ],
527
- [
528
- ['top', ['top']],
529
- ['right', ['right']],
530
- ['bottom', ['bottom']],
531
- ['left', ['left']],
621
+ ['inset', ['top', 'right', 'bottom', 'left']],
622
+ [
623
+ ['inset-x', ['left', 'right']],
624
+ ['inset-y', ['top', 'bottom']],
625
+ ],
626
+ [
627
+ ['start', ['inset-inline-start']],
628
+ ['end', ['inset-inline-end']],
629
+ ['top', ['top']],
630
+ ['right', ['right']],
631
+ ['bottom', ['bottom']],
632
+ ['left', ['left']],
633
+ ],
532
634
  ],
533
- ]),
635
+ { supportsNegativeValues: true }
636
+ ),
534
637
 
535
638
  isolation: ({ addUtilities }) => {
536
639
  addUtilities({
@@ -539,8 +642,8 @@ export default {
539
642
  })
540
643
  },
541
644
 
542
- zIndex: createUtilityPlugin('zIndex', [['z', ['zIndex']]]),
543
- order: createUtilityPlugin('order'),
645
+ zIndex: createUtilityPlugin('zIndex', [['z', ['zIndex']]], { supportsNegativeValues: true }),
646
+ order: createUtilityPlugin('order', undefined, { supportsNegativeValues: true }),
544
647
  gridColumn: createUtilityPlugin('gridColumn', [['col', ['gridColumn']]]),
545
648
  gridColumnStart: createUtilityPlugin('gridColumnStart', [['col-start', ['gridColumnStart']]]),
546
649
  gridColumnEnd: createUtilityPlugin('gridColumnEnd', [['col-end', ['gridColumnEnd']]]),
@@ -565,19 +668,25 @@ export default {
565
668
  })
566
669
  },
567
670
 
568
- margin: createUtilityPlugin('margin', [
569
- ['m', ['margin']],
570
- [
571
- ['mx', ['margin-left', 'margin-right']],
572
- ['my', ['margin-top', 'margin-bottom']],
573
- ],
671
+ margin: createUtilityPlugin(
672
+ 'margin',
574
673
  [
575
- ['mt', ['margin-top']],
576
- ['mr', ['margin-right']],
577
- ['mb', ['margin-bottom']],
578
- ['ml', ['margin-left']],
674
+ ['m', ['margin']],
675
+ [
676
+ ['mx', ['margin-left', 'margin-right']],
677
+ ['my', ['margin-top', 'margin-bottom']],
678
+ ],
679
+ [
680
+ ['ms', ['margin-inline-start']],
681
+ ['me', ['margin-inline-end']],
682
+ ['mt', ['margin-top']],
683
+ ['mr', ['margin-right']],
684
+ ['mb', ['margin-bottom']],
685
+ ['ml', ['margin-left']],
686
+ ],
579
687
  ],
580
- ]),
688
+ { supportsNegativeValues: true }
689
+ ),
581
690
 
582
691
  boxSizing: ({ addUtilities }) => {
583
692
  addUtilities({
@@ -623,8 +732,15 @@ export default {
623
732
  maxWidth: createUtilityPlugin('maxWidth', [['max-w', ['maxWidth']]]),
624
733
 
625
734
  flex: createUtilityPlugin('flex'),
626
- flexShrink: createUtilityPlugin('flexShrink', [['flex-shrink', ['flex-shrink']]]),
627
- flexGrow: createUtilityPlugin('flexGrow', [['flex-grow', ['flex-grow']]]),
735
+ flexShrink: createUtilityPlugin('flexShrink', [
736
+ ['flex-shrink', ['flex-shrink']], // Deprecated
737
+ ['shrink', ['flex-shrink']],
738
+ ]),
739
+ flexGrow: createUtilityPlugin('flexGrow', [
740
+ ['flex-grow', ['flex-grow']], // Deprecated
741
+ ['grow', ['flex-grow']],
742
+ ]),
743
+ flexBasis: createUtilityPlugin('flexBasis', [['basis', ['flex-basis']]]),
628
744
 
629
745
  tableLayout: ({ addUtilities }) => {
630
746
  addUtilities({
@@ -640,133 +756,151 @@ export default {
640
756
  })
641
757
  },
642
758
 
759
+ borderSpacing: ({ addDefaults, matchUtilities, theme }) => {
760
+ addDefaults('border-spacing', {
761
+ '--tw-border-spacing-x': 0,
762
+ '--tw-border-spacing-y': 0,
763
+ })
764
+
765
+ matchUtilities(
766
+ {
767
+ 'border-spacing': (value) => {
768
+ return {
769
+ '--tw-border-spacing-x': value,
770
+ '--tw-border-spacing-y': value,
771
+ '@defaults border-spacing': {},
772
+ 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
773
+ }
774
+ },
775
+ 'border-spacing-x': (value) => {
776
+ return {
777
+ '--tw-border-spacing-x': value,
778
+ '@defaults border-spacing': {},
779
+ 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
780
+ }
781
+ },
782
+ 'border-spacing-y': (value) => {
783
+ return {
784
+ '--tw-border-spacing-y': value,
785
+ '@defaults border-spacing': {},
786
+ 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
787
+ }
788
+ },
789
+ },
790
+ { values: theme('borderSpacing') }
791
+ )
792
+ },
793
+
643
794
  transformOrigin: createUtilityPlugin('transformOrigin', [['origin', ['transformOrigin']]]),
644
- translate: createUtilityPlugin('translate', [
795
+ translate: createUtilityPlugin(
796
+ 'translate',
645
797
  [
646
798
  [
647
- 'translate-x',
648
- [['@defaults transform', {}], '--tw-translate-x', ['transform', 'var(--tw-transform)']],
649
- ],
650
- [
651
- 'translate-y',
652
- [['@defaults transform', {}], '--tw-translate-y', ['transform', 'var(--tw-transform)']],
799
+ [
800
+ 'translate-x',
801
+ [['@defaults transform', {}], '--tw-translate-x', ['transform', cssTransformValue]],
802
+ ],
803
+ [
804
+ 'translate-y',
805
+ [['@defaults transform', {}], '--tw-translate-y', ['transform', cssTransformValue]],
806
+ ],
653
807
  ],
654
808
  ],
655
- ]),
656
- rotate: createUtilityPlugin('rotate', [
657
- ['rotate', [['@defaults transform', {}], '--tw-rotate', ['transform', 'var(--tw-transform)']]],
658
- ]),
659
- skew: createUtilityPlugin('skew', [
660
- [
661
- [
662
- 'skew-x',
663
- [['@defaults transform', {}], '--tw-skew-x', ['transform', 'var(--tw-transform)']],
664
- ],
665
- [
666
- 'skew-y',
667
- [['@defaults transform', {}], '--tw-skew-y', ['transform', 'var(--tw-transform)']],
668
- ],
669
- ],
670
- ]),
671
- scale: createUtilityPlugin('scale', [
809
+ { supportsNegativeValues: true }
810
+ ),
811
+ rotate: createUtilityPlugin(
812
+ 'rotate',
813
+ [['rotate', [['@defaults transform', {}], '--tw-rotate', ['transform', cssTransformValue]]]],
814
+ { supportsNegativeValues: true }
815
+ ),
816
+ skew: createUtilityPlugin(
817
+ 'skew',
672
818
  [
673
- 'scale',
674
819
  [
675
- ['@defaults transform', {}],
676
- '--tw-scale-x',
677
- '--tw-scale-y',
678
- ['transform', 'var(--tw-transform)'],
820
+ ['skew-x', [['@defaults transform', {}], '--tw-skew-x', ['transform', cssTransformValue]]],
821
+ ['skew-y', [['@defaults transform', {}], '--tw-skew-y', ['transform', cssTransformValue]]],
679
822
  ],
680
823
  ],
824
+ { supportsNegativeValues: true }
825
+ ),
826
+ scale: createUtilityPlugin(
827
+ 'scale',
681
828
  [
682
829
  [
683
- 'scale-x',
684
- [['@defaults transform', {}], '--tw-scale-x', ['transform', 'var(--tw-transform)']],
830
+ 'scale',
831
+ [
832
+ ['@defaults transform', {}],
833
+ '--tw-scale-x',
834
+ '--tw-scale-y',
835
+ ['transform', cssTransformValue],
836
+ ],
685
837
  ],
686
838
  [
687
- 'scale-y',
688
- [['@defaults transform', {}], '--tw-scale-y', ['transform', 'var(--tw-transform)']],
839
+ [
840
+ 'scale-x',
841
+ [['@defaults transform', {}], '--tw-scale-x', ['transform', cssTransformValue]],
842
+ ],
843
+ [
844
+ 'scale-y',
845
+ [['@defaults transform', {}], '--tw-scale-y', ['transform', cssTransformValue]],
846
+ ],
689
847
  ],
690
848
  ],
691
- ]),
849
+ { supportsNegativeValues: true }
850
+ ),
851
+
852
+ transform: ({ addDefaults, addUtilities }) => {
853
+ addDefaults('transform', {
854
+ '--tw-translate-x': '0',
855
+ '--tw-translate-y': '0',
856
+ '--tw-rotate': '0',
857
+ '--tw-skew-x': '0',
858
+ '--tw-skew-y': '0',
859
+ '--tw-scale-x': '1',
860
+ '--tw-scale-y': '1',
861
+ })
692
862
 
693
- transform: ({ addBase, addUtilities }) => {
694
- addBase({
695
- '@defaults transform': {
696
- '--tw-translate-x': '0',
697
- '--tw-translate-y': '0',
698
- '--tw-rotate': '0',
699
- '--tw-skew-x': '0',
700
- '--tw-skew-y': '0',
701
- '--tw-scale-x': '1',
702
- '--tw-scale-y': '1',
703
- '--tw-transform': [
704
- 'translateX(var(--tw-translate-x))',
705
- 'translateY(var(--tw-translate-y))',
706
- 'rotate(var(--tw-rotate))',
707
- 'skewX(var(--tw-skew-x))',
708
- 'skewY(var(--tw-skew-y))',
709
- 'scaleX(var(--tw-scale-x))',
710
- 'scaleY(var(--tw-scale-y))',
711
- ].join(' '),
712
- },
713
- })
714
- addUtilities({
715
- '.transform': { '@defaults transform': {}, transform: 'var(--tw-transform)' },
863
+ addUtilities({
864
+ '.transform': { '@defaults transform': {}, transform: cssTransformValue },
716
865
  '.transform-cpu': {
717
- '--tw-transform': [
718
- 'translateX(var(--tw-translate-x))',
719
- 'translateY(var(--tw-translate-y))',
720
- 'rotate(var(--tw-rotate))',
721
- 'skewX(var(--tw-skew-x))',
722
- 'skewY(var(--tw-skew-y))',
723
- 'scaleX(var(--tw-scale-x))',
724
- 'scaleY(var(--tw-scale-y))',
725
- ].join(' '),
866
+ transform: cssTransformValue,
726
867
  },
727
868
  '.transform-gpu': {
728
- '--tw-transform': [
729
- 'translate3d(var(--tw-translate-x), var(--tw-translate-y), 0)',
730
- 'rotate(var(--tw-rotate))',
731
- 'skewX(var(--tw-skew-x))',
732
- 'skewY(var(--tw-skew-y))',
733
- 'scaleX(var(--tw-scale-x))',
734
- 'scaleY(var(--tw-scale-y))',
735
- ].join(' '),
869
+ transform: cssTransformValue.replace(
870
+ 'translate(var(--tw-translate-x), var(--tw-translate-y))',
871
+ 'translate3d(var(--tw-translate-x), var(--tw-translate-y), 0)'
872
+ ),
736
873
  },
737
874
  '.transform-none': { transform: 'none' },
738
875
  })
739
876
  },
740
877
 
741
- animation: ({ matchUtilities, theme, prefix }) => {
742
- let prefixName = (name) => prefix(`.${name}`).slice(1)
878
+ animation: ({ matchUtilities, theme, config }) => {
879
+ let prefixName = (name) => `${config('prefix')}${escapeClassName(name)}`
743
880
  let keyframes = Object.fromEntries(
744
881
  Object.entries(theme('keyframes') ?? {}).map(([key, value]) => {
745
- return [key, [{ [`@keyframes ${prefixName(key)}`]: value }]]
882
+ return [key, { [`@keyframes ${prefixName(key)}`]: value }]
746
883
  })
747
884
  )
748
885
 
749
886
  matchUtilities(
750
887
  {
751
- animate: (value, { includeRules }) => {
888
+ animate: (value) => {
752
889
  let animations = parseAnimationValue(value)
753
890
 
754
- for (let { name } of animations) {
755
- if (keyframes[name] !== undefined) {
756
- includeRules(keyframes[name], { respectImportant: false })
757
- }
758
- }
759
-
760
- return {
761
- animation: animations
762
- .map(({ name, value }) => {
763
- if (name === undefined || keyframes[name] === undefined) {
764
- return value
765
- }
766
- return value.replace(name, prefixName(name))
767
- })
768
- .join(', '),
769
- }
891
+ return [
892
+ ...animations.flatMap((animation) => keyframes[animation.name]),
893
+ {
894
+ animation: animations
895
+ .map(({ name, value }) => {
896
+ if (name === undefined || keyframes[name] === undefined) {
897
+ return value
898
+ }
899
+ return value.replace(name, prefixName(name))
900
+ })
901
+ .join(', '),
902
+ },
903
+ ]
770
904
  },
771
905
  },
772
906
  { values: theme('animation') }
@@ -775,6 +909,57 @@ export default {
775
909
 
776
910
  cursor: createUtilityPlugin('cursor'),
777
911
 
912
+ touchAction: ({ addDefaults, addUtilities }) => {
913
+ addDefaults('touch-action', {
914
+ '--tw-pan-x': ' ',
915
+ '--tw-pan-y': ' ',
916
+ '--tw-pinch-zoom': ' ',
917
+ })
918
+
919
+ let cssTouchActionValue = 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)'
920
+
921
+ addUtilities({
922
+ '.touch-auto': { 'touch-action': 'auto' },
923
+ '.touch-none': { 'touch-action': 'none' },
924
+ '.touch-pan-x': {
925
+ '@defaults touch-action': {},
926
+ '--tw-pan-x': 'pan-x',
927
+ 'touch-action': cssTouchActionValue,
928
+ },
929
+ '.touch-pan-left': {
930
+ '@defaults touch-action': {},
931
+ '--tw-pan-x': 'pan-left',
932
+ 'touch-action': cssTouchActionValue,
933
+ },
934
+ '.touch-pan-right': {
935
+ '@defaults touch-action': {},
936
+ '--tw-pan-x': 'pan-right',
937
+ 'touch-action': cssTouchActionValue,
938
+ },
939
+ '.touch-pan-y': {
940
+ '@defaults touch-action': {},
941
+ '--tw-pan-y': 'pan-y',
942
+ 'touch-action': cssTouchActionValue,
943
+ },
944
+ '.touch-pan-up': {
945
+ '@defaults touch-action': {},
946
+ '--tw-pan-y': 'pan-up',
947
+ 'touch-action': cssTouchActionValue,
948
+ },
949
+ '.touch-pan-down': {
950
+ '@defaults touch-action': {},
951
+ '--tw-pan-y': 'pan-down',
952
+ 'touch-action': cssTouchActionValue,
953
+ },
954
+ '.touch-pinch-zoom': {
955
+ '@defaults touch-action': {},
956
+ '--tw-pinch-zoom': 'pinch-zoom',
957
+ 'touch-action': cssTouchActionValue,
958
+ },
959
+ '.touch-manipulation': { 'touch-action': 'manipulation' },
960
+ })
961
+ },
962
+
778
963
  userSelect: ({ addUtilities }) => {
779
964
  addUtilities({
780
965
  '.select-none': { 'user-select': 'none' },
@@ -793,6 +978,82 @@ export default {
793
978
  })
794
979
  },
795
980
 
981
+ scrollSnapType: ({ addDefaults, addUtilities }) => {
982
+ addDefaults('scroll-snap-type', {
983
+ '--tw-scroll-snap-strictness': 'proximity',
984
+ })
985
+
986
+ addUtilities({
987
+ '.snap-none': { 'scroll-snap-type': 'none' },
988
+ '.snap-x': {
989
+ '@defaults scroll-snap-type': {},
990
+ 'scroll-snap-type': 'x var(--tw-scroll-snap-strictness)',
991
+ },
992
+ '.snap-y': {
993
+ '@defaults scroll-snap-type': {},
994
+ 'scroll-snap-type': 'y var(--tw-scroll-snap-strictness)',
995
+ },
996
+ '.snap-both': {
997
+ '@defaults scroll-snap-type': {},
998
+ 'scroll-snap-type': 'both var(--tw-scroll-snap-strictness)',
999
+ },
1000
+ '.snap-mandatory': { '--tw-scroll-snap-strictness': 'mandatory' },
1001
+ '.snap-proximity': { '--tw-scroll-snap-strictness': 'proximity' },
1002
+ })
1003
+ },
1004
+
1005
+ scrollSnapAlign: ({ addUtilities }) => {
1006
+ addUtilities({
1007
+ '.snap-start': { 'scroll-snap-align': 'start' },
1008
+ '.snap-end': { 'scroll-snap-align': 'end' },
1009
+ '.snap-center': { 'scroll-snap-align': 'center' },
1010
+ '.snap-align-none': { 'scroll-snap-align': 'none' },
1011
+ })
1012
+ },
1013
+
1014
+ scrollSnapStop: ({ addUtilities }) => {
1015
+ addUtilities({
1016
+ '.snap-normal': { 'scroll-snap-stop': 'normal' },
1017
+ '.snap-always': { 'scroll-snap-stop': 'always' },
1018
+ })
1019
+ },
1020
+
1021
+ scrollMargin: createUtilityPlugin(
1022
+ 'scrollMargin',
1023
+ [
1024
+ ['scroll-m', ['scroll-margin']],
1025
+ [
1026
+ ['scroll-mx', ['scroll-margin-left', 'scroll-margin-right']],
1027
+ ['scroll-my', ['scroll-margin-top', 'scroll-margin-bottom']],
1028
+ ],
1029
+ [
1030
+ ['scroll-ms', ['scroll-margin-inline-start']],
1031
+ ['scroll-me', ['scroll-margin-inline-end']],
1032
+ ['scroll-mt', ['scroll-margin-top']],
1033
+ ['scroll-mr', ['scroll-margin-right']],
1034
+ ['scroll-mb', ['scroll-margin-bottom']],
1035
+ ['scroll-ml', ['scroll-margin-left']],
1036
+ ],
1037
+ ],
1038
+ { supportsNegativeValues: true }
1039
+ ),
1040
+
1041
+ scrollPadding: createUtilityPlugin('scrollPadding', [
1042
+ ['scroll-p', ['scroll-padding']],
1043
+ [
1044
+ ['scroll-px', ['scroll-padding-left', 'scroll-padding-right']],
1045
+ ['scroll-py', ['scroll-padding-top', 'scroll-padding-bottom']],
1046
+ ],
1047
+ [
1048
+ ['scroll-ps', ['scroll-padding-inline-start']],
1049
+ ['scroll-pe', ['scroll-padding-inline-end']],
1050
+ ['scroll-pt', ['scroll-padding-top']],
1051
+ ['scroll-pr', ['scroll-padding-right']],
1052
+ ['scroll-pb', ['scroll-padding-bottom']],
1053
+ ['scroll-pl', ['scroll-padding-left']],
1054
+ ],
1055
+ ]),
1056
+
796
1057
  listStylePosition: ({ addUtilities }) => {
797
1058
  addUtilities({
798
1059
  '.list-inside': { 'list-style-position': 'inside' },
@@ -851,6 +1112,7 @@ export default {
851
1112
  addUtilities({
852
1113
  '.grid-flow-row': { gridAutoFlow: 'row' },
853
1114
  '.grid-flow-col': { gridAutoFlow: 'column' },
1115
+ '.grid-flow-dense': { gridAutoFlow: 'dense' },
854
1116
  '.grid-flow-row-dense': { gridAutoFlow: 'row dense' },
855
1117
  '.grid-flow-col-dense': { gridAutoFlow: 'column dense' },
856
1118
  })
@@ -887,6 +1149,7 @@ export default {
887
1149
  '.place-content-between': { 'place-content': 'space-between' },
888
1150
  '.place-content-around': { 'place-content': 'space-around' },
889
1151
  '.place-content-evenly': { 'place-content': 'space-evenly' },
1152
+ '.place-content-baseline': { 'place-content': 'baseline' },
890
1153
  '.place-content-stretch': { 'place-content': 'stretch' },
891
1154
  })
892
1155
  },
@@ -896,6 +1159,7 @@ export default {
896
1159
  '.place-items-start': { 'place-items': 'start' },
897
1160
  '.place-items-end': { 'place-items': 'end' },
898
1161
  '.place-items-center': { 'place-items': 'center' },
1162
+ '.place-items-baseline': { 'place-items': 'baseline' },
899
1163
  '.place-items-stretch': { 'place-items': 'stretch' },
900
1164
  })
901
1165
  },
@@ -908,6 +1172,7 @@ export default {
908
1172
  '.content-between': { 'align-content': 'space-between' },
909
1173
  '.content-around': { 'align-content': 'space-around' },
910
1174
  '.content-evenly': { 'align-content': 'space-evenly' },
1175
+ '.content-baseline': { 'align-content': 'baseline' },
911
1176
  })
912
1177
  },
913
1178
 
@@ -955,6 +1220,16 @@ export default {
955
1220
  'space-x': (value) => {
956
1221
  value = value === '0' ? '0px' : value
957
1222
 
1223
+ if (env.OXIDE) {
1224
+ return {
1225
+ '& > :not([hidden]) ~ :not([hidden])': {
1226
+ '--tw-space-x-reverse': '0',
1227
+ 'margin-inline-end': `calc(${value} * var(--tw-space-x-reverse))`,
1228
+ 'margin-inline-start': `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`,
1229
+ },
1230
+ }
1231
+ }
1232
+
958
1233
  return {
959
1234
  '& > :not([hidden]) ~ :not([hidden])': {
960
1235
  '--tw-space-x-reverse': '0',
@@ -975,7 +1250,7 @@ export default {
975
1250
  }
976
1251
  },
977
1252
  },
978
- { values: theme('space') }
1253
+ { values: theme('space'), supportsNegativeValues: true }
979
1254
  )
980
1255
 
981
1256
  addUtilities({
@@ -990,6 +1265,17 @@ export default {
990
1265
  'divide-x': (value) => {
991
1266
  value = value === '0' ? '0px' : value
992
1267
 
1268
+ if (env.OXIDE) {
1269
+ return {
1270
+ '& > :not([hidden]) ~ :not([hidden])': {
1271
+ '@defaults border-width': {},
1272
+ '--tw-divide-x-reverse': '0',
1273
+ 'border-inline-end-width': `calc(${value} * var(--tw-divide-x-reverse))`,
1274
+ 'border-inline-start-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
1275
+ },
1276
+ }
1277
+ }
1278
+
993
1279
  return {
994
1280
  '& > :not([hidden]) ~ :not([hidden])': {
995
1281
  '@defaults border-width': {},
@@ -1012,7 +1298,7 @@ export default {
1012
1298
  }
1013
1299
  },
1014
1300
  },
1015
- { values: theme('divideWidth'), type: ['line-width', 'length'] }
1301
+ { values: theme('divideWidth'), type: ['line-width', 'length', 'any'] }
1016
1302
  )
1017
1303
 
1018
1304
  addUtilities({
@@ -1060,7 +1346,7 @@ export default {
1060
1346
  },
1061
1347
  {
1062
1348
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('divideColor'))),
1063
- type: 'color',
1349
+ type: ['color', 'any'],
1064
1350
  }
1065
1351
  )
1066
1352
  },
@@ -1111,12 +1397,15 @@ export default {
1111
1397
  addUtilities({
1112
1398
  '.overflow-auto': { overflow: 'auto' },
1113
1399
  '.overflow-hidden': { overflow: 'hidden' },
1400
+ '.overflow-clip': { overflow: 'clip' },
1114
1401
  '.overflow-visible': { overflow: 'visible' },
1115
1402
  '.overflow-scroll': { overflow: 'scroll' },
1116
1403
  '.overflow-x-auto': { 'overflow-x': 'auto' },
1117
1404
  '.overflow-y-auto': { 'overflow-y': 'auto' },
1118
1405
  '.overflow-x-hidden': { 'overflow-x': 'hidden' },
1119
1406
  '.overflow-y-hidden': { 'overflow-y': 'hidden' },
1407
+ '.overflow-x-clip': { 'overflow-x': 'clip' },
1408
+ '.overflow-y-clip': { 'overflow-y': 'clip' },
1120
1409
  '.overflow-x-visible': { 'overflow-x': 'visible' },
1121
1410
  '.overflow-y-visible': { 'overflow-y': 'visible' },
1122
1411
  '.overflow-x-scroll': { 'overflow-x': 'scroll' },
@@ -1148,8 +1437,9 @@ export default {
1148
1437
  textOverflow: ({ addUtilities }) => {
1149
1438
  addUtilities({
1150
1439
  '.truncate': { overflow: 'hidden', 'text-overflow': 'ellipsis', 'white-space': 'nowrap' },
1151
- '.overflow-ellipsis': { 'text-overflow': 'ellipsis' },
1152
- '.overflow-clip': { 'text-overflow': 'clip' },
1440
+ '.overflow-ellipsis': { 'text-overflow': 'ellipsis' }, // Deprecated
1441
+ '.text-ellipsis': { 'text-overflow': 'ellipsis' },
1442
+ '.text-clip': { 'text-overflow': 'clip' },
1153
1443
  })
1154
1444
  },
1155
1445
 
@@ -1168,18 +1458,25 @@ export default {
1168
1458
  '.break-normal': { 'overflow-wrap': 'normal', 'word-break': 'normal' },
1169
1459
  '.break-words': { 'overflow-wrap': 'break-word' },
1170
1460
  '.break-all': { 'word-break': 'break-all' },
1461
+ '.break-keep': { 'word-break': 'keep-all' },
1171
1462
  })
1172
1463
  },
1173
1464
 
1174
1465
  borderRadius: createUtilityPlugin('borderRadius', [
1175
1466
  ['rounded', ['border-radius']],
1176
1467
  [
1468
+ ['rounded-s', ['border-start-start-radius', 'border-end-start-radius']],
1469
+ ['rounded-e', ['border-start-end-radius', 'border-end-end-radius']],
1177
1470
  ['rounded-t', ['border-top-left-radius', 'border-top-right-radius']],
1178
1471
  ['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']],
1179
1472
  ['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']],
1180
1473
  ['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']],
1181
1474
  ],
1182
1475
  [
1476
+ ['rounded-ss', ['border-start-start-radius']],
1477
+ ['rounded-se', ['border-start-end-radius']],
1478
+ ['rounded-ee', ['border-end-end-radius']],
1479
+ ['rounded-es', ['border-end-start-radius']],
1183
1480
  ['rounded-tl', ['border-top-left-radius']],
1184
1481
  ['rounded-tr', ['border-top-right-radius']],
1185
1482
  ['rounded-br', ['border-bottom-right-radius']],
@@ -1192,6 +1489,12 @@ export default {
1192
1489
  [
1193
1490
  ['border', [['@defaults border-width', {}], 'border-width']],
1194
1491
  [
1492
+ ['border-x', [['@defaults border-width', {}], 'border-left-width', 'border-right-width']],
1493
+ ['border-y', [['@defaults border-width', {}], 'border-top-width', 'border-bottom-width']],
1494
+ ],
1495
+ [
1496
+ ['border-s', [['@defaults border-width', {}], 'border-inline-start-width']],
1497
+ ['border-e', [['@defaults border-width', {}], 'border-inline-end-width']],
1195
1498
  ['border-t', [['@defaults border-width', {}], 'border-top-width']],
1196
1499
  ['border-r', [['@defaults border-width', {}], 'border-right-width']],
1197
1500
  ['border-b', [['@defaults border-width', {}], 'border-bottom-width']],
@@ -1212,24 +1515,7 @@ export default {
1212
1515
  })
1213
1516
  },
1214
1517
 
1215
- borderColor: ({ addBase, matchUtilities, theme, corePlugins }) => {
1216
- if (!corePlugins('borderOpacity')) {
1217
- let value = theme('borderColor.DEFAULT', 'currentColor')
1218
- addBase({
1219
- '@defaults border-width': {
1220
- 'border-color': toColorValue(value),
1221
- },
1222
- })
1223
- } else {
1224
- addBase({
1225
- '@defaults border-width': withAlphaVariable({
1226
- color: theme('borderColor.DEFAULT', 'currentColor'),
1227
- property: 'border-color',
1228
- variable: '--tw-border-opacity',
1229
- }),
1230
- })
1231
- }
1232
-
1518
+ borderColor: ({ matchUtilities, theme, corePlugins }) => {
1233
1519
  matchUtilities(
1234
1520
  {
1235
1521
  border: (value) => {
@@ -1248,12 +1534,75 @@ export default {
1248
1534
  },
1249
1535
  {
1250
1536
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1251
- type: ['color'],
1537
+ type: ['color', 'any'],
1252
1538
  }
1253
1539
  )
1254
1540
 
1255
1541
  matchUtilities(
1256
1542
  {
1543
+ 'border-x': (value) => {
1544
+ if (!corePlugins('borderOpacity')) {
1545
+ return {
1546
+ 'border-left-color': toColorValue(value),
1547
+ 'border-right-color': toColorValue(value),
1548
+ }
1549
+ }
1550
+
1551
+ return withAlphaVariable({
1552
+ color: value,
1553
+ property: ['border-left-color', 'border-right-color'],
1554
+ variable: '--tw-border-opacity',
1555
+ })
1556
+ },
1557
+ 'border-y': (value) => {
1558
+ if (!corePlugins('borderOpacity')) {
1559
+ return {
1560
+ 'border-top-color': toColorValue(value),
1561
+ 'border-bottom-color': toColorValue(value),
1562
+ }
1563
+ }
1564
+
1565
+ return withAlphaVariable({
1566
+ color: value,
1567
+ property: ['border-top-color', 'border-bottom-color'],
1568
+ variable: '--tw-border-opacity',
1569
+ })
1570
+ },
1571
+ },
1572
+ {
1573
+ values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1574
+ type: ['color', 'any'],
1575
+ }
1576
+ )
1577
+
1578
+ matchUtilities(
1579
+ {
1580
+ 'border-s': (value) => {
1581
+ if (!corePlugins('borderOpacity')) {
1582
+ return {
1583
+ 'border-inline-start-color': toColorValue(value),
1584
+ }
1585
+ }
1586
+
1587
+ return withAlphaVariable({
1588
+ color: value,
1589
+ property: 'border-inline-start-color',
1590
+ variable: '--tw-border-opacity',
1591
+ })
1592
+ },
1593
+ 'border-e': (value) => {
1594
+ if (!corePlugins('borderOpacity')) {
1595
+ return {
1596
+ 'border-inline-end-color': toColorValue(value),
1597
+ }
1598
+ }
1599
+
1600
+ return withAlphaVariable({
1601
+ color: value,
1602
+ property: 'border-inline-end-color',
1603
+ variable: '--tw-border-opacity',
1604
+ })
1605
+ },
1257
1606
  'border-t': (value) => {
1258
1607
  if (!corePlugins('borderOpacity')) {
1259
1608
  return {
@@ -1309,7 +1658,7 @@ export default {
1309
1658
  },
1310
1659
  {
1311
1660
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1312
- type: 'color',
1661
+ type: ['color', 'any'],
1313
1662
  }
1314
1663
  )
1315
1664
  },
@@ -1335,7 +1684,7 @@ export default {
1335
1684
  })
1336
1685
  },
1337
1686
  },
1338
- { values: flattenColorPalette(theme('backgroundColor')), type: 'color' }
1687
+ { values: flattenColorPalette(theme('backgroundColor')), type: ['color', 'any'] }
1339
1688
  )
1340
1689
  },
1341
1690
 
@@ -1363,7 +1712,8 @@ export default {
1363
1712
 
1364
1713
  return {
1365
1714
  '--tw-gradient-from': toColorValue(value, 'from'),
1366
- '--tw-gradient-stops': `var(--tw-gradient-from), var(--tw-gradient-to, ${transparentToValue})`,
1715
+ '--tw-gradient-to': transparentToValue,
1716
+ '--tw-gradient-stops': `var(--tw-gradient-from), var(--tw-gradient-to)`,
1367
1717
  }
1368
1718
  },
1369
1719
  },
@@ -1375,10 +1725,11 @@ export default {
1375
1725
  let transparentToValue = transparentTo(value)
1376
1726
 
1377
1727
  return {
1728
+ '--tw-gradient-to': transparentToValue,
1378
1729
  '--tw-gradient-stops': `var(--tw-gradient-from), ${toColorValue(
1379
1730
  value,
1380
1731
  'via'
1381
- )}, var(--tw-gradient-to, ${transparentToValue})`,
1732
+ )}, var(--tw-gradient-to)`,
1382
1733
  }
1383
1734
  },
1384
1735
  },
@@ -1393,13 +1744,15 @@ export default {
1393
1744
 
1394
1745
  boxDecorationBreak: ({ addUtilities }) => {
1395
1746
  addUtilities({
1396
- '.decoration-slice': { 'box-decoration-break': 'slice' },
1397
- '.decoration-clone': { 'box-decoration-break': 'clone' },
1747
+ '.decoration-slice': { 'box-decoration-break': 'slice' }, // Deprecated
1748
+ '.decoration-clone': { 'box-decoration-break': 'clone' }, // Deprecated
1749
+ '.box-decoration-slice': { 'box-decoration-break': 'slice' },
1750
+ '.box-decoration-clone': { 'box-decoration-break': 'clone' },
1398
1751
  })
1399
1752
  },
1400
1753
 
1401
1754
  backgroundSize: createUtilityPlugin('backgroundSize', [['bg', ['background-size']]], {
1402
- type: ['lookup', 'length', 'percentage'],
1755
+ type: ['lookup', 'length', 'percentage', 'size'],
1403
1756
  }),
1404
1757
 
1405
1758
  backgroundAttachment: ({ addUtilities }) => {
@@ -1420,7 +1773,7 @@ export default {
1420
1773
  },
1421
1774
 
1422
1775
  backgroundPosition: createUtilityPlugin('backgroundPosition', [['bg', ['background-position']]], {
1423
- type: ['lookup', 'position'],
1776
+ type: ['lookup', ['position', { preferOnConflict: true }]],
1424
1777
  }),
1425
1778
 
1426
1779
  backgroundRepeat: ({ addUtilities }) => {
@@ -1460,7 +1813,7 @@ export default {
1460
1813
  return { stroke: toColorValue(value) }
1461
1814
  },
1462
1815
  },
1463
- { values: flattenColorPalette(theme('stroke')), type: ['color', 'url'] }
1816
+ { values: flattenColorPalette(theme('stroke')), type: ['color', 'url', 'any'] }
1464
1817
  )
1465
1818
  },
1466
1819
 
@@ -1486,6 +1839,8 @@ export default {
1486
1839
  ['py', ['padding-top', 'padding-bottom']],
1487
1840
  ],
1488
1841
  [
1842
+ ['ps', ['padding-inline-start']],
1843
+ ['pe', ['padding-inline-end']],
1489
1844
  ['pt', ['padding-top']],
1490
1845
  ['pr', ['padding-right']],
1491
1846
  ['pb', ['padding-bottom']],
@@ -1499,10 +1854,14 @@ export default {
1499
1854
  '.text-center': { 'text-align': 'center' },
1500
1855
  '.text-right': { 'text-align': 'right' },
1501
1856
  '.text-justify': { 'text-align': 'justify' },
1857
+ '.text-start': { 'text-align': 'start' },
1858
+ '.text-end': { 'text-align': 'end' },
1502
1859
  })
1503
1860
  },
1504
1861
 
1505
- textIndent: createUtilityPlugin('textIndent', [['indent', ['text-indent']]]),
1862
+ textIndent: createUtilityPlugin('textIndent', [['indent', ['text-indent']]], {
1863
+ supportsNegativeValues: true,
1864
+ }),
1506
1865
 
1507
1866
  verticalAlign: ({ addUtilities, matchUtilities }) => {
1508
1867
  addUtilities({
@@ -1519,16 +1878,43 @@ export default {
1519
1878
  matchUtilities({ align: (value) => ({ 'vertical-align': value }) })
1520
1879
  },
1521
1880
 
1522
- fontFamily: createUtilityPlugin('fontFamily', [['font', ['fontFamily']]], {
1523
- type: ['lookup', 'generic-name', 'family-name'],
1524
- }),
1881
+ fontFamily: ({ matchUtilities, theme }) => {
1882
+ matchUtilities(
1883
+ {
1884
+ font: (value) => {
1885
+ let [families, options = {}] =
1886
+ Array.isArray(value) && isPlainObject(value[1]) ? value : [value]
1887
+ let { fontFeatureSettings } = options
1888
+
1889
+ return {
1890
+ 'font-family': Array.isArray(families) ? families.join(', ') : families,
1891
+ ...(fontFeatureSettings === undefined
1892
+ ? {}
1893
+ : { 'font-feature-settings': fontFeatureSettings }),
1894
+ }
1895
+ },
1896
+ },
1897
+ {
1898
+ values: theme('fontFamily'),
1899
+ type: ['lookup', 'generic-name', 'family-name'],
1900
+ }
1901
+ )
1902
+ },
1525
1903
 
1526
1904
  fontSize: ({ matchUtilities, theme }) => {
1527
1905
  matchUtilities(
1528
1906
  {
1529
- text: (value) => {
1907
+ text: (value, { modifier }) => {
1530
1908
  let [fontSize, options] = Array.isArray(value) ? value : [value]
1531
- let { lineHeight, letterSpacing } = isPlainObject(options)
1909
+
1910
+ if (modifier) {
1911
+ return {
1912
+ 'font-size': fontSize,
1913
+ 'line-height': modifier,
1914
+ }
1915
+ }
1916
+
1917
+ let { lineHeight, letterSpacing, fontWeight } = isPlainObject(options)
1532
1918
  ? options
1533
1919
  : { lineHeight: options }
1534
1920
 
@@ -1536,18 +1922,20 @@ export default {
1536
1922
  'font-size': fontSize,
1537
1923
  ...(lineHeight === undefined ? {} : { 'line-height': lineHeight }),
1538
1924
  ...(letterSpacing === undefined ? {} : { 'letter-spacing': letterSpacing }),
1925
+ ...(fontWeight === undefined ? {} : { 'font-weight': fontWeight }),
1539
1926
  }
1540
1927
  },
1541
1928
  },
1542
1929
  {
1543
1930
  values: theme('fontSize'),
1931
+ modifiers: theme('lineHeight'),
1544
1932
  type: ['absolute-size', 'relative-size', 'length', 'percentage'],
1545
1933
  }
1546
1934
  )
1547
1935
  },
1548
1936
 
1549
1937
  fontWeight: createUtilityPlugin('fontWeight', [['font', ['fontWeight']]], {
1550
- type: ['lookup', 'number'],
1938
+ type: ['lookup', 'number', 'any'],
1551
1939
  }),
1552
1940
 
1553
1941
  textTransform: ({ addUtilities }) => {
@@ -1566,32 +1954,67 @@ export default {
1566
1954
  })
1567
1955
  },
1568
1956
 
1569
- fontVariantNumeric: ({ addUtilities }) => {
1957
+ fontVariantNumeric: ({ addDefaults, addUtilities }) => {
1958
+ let cssFontVariantNumericValue =
1959
+ 'var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)'
1960
+
1961
+ addDefaults('font-variant-numeric', {
1962
+ '--tw-ordinal': ' ',
1963
+ '--tw-slashed-zero': ' ',
1964
+ '--tw-numeric-figure': ' ',
1965
+ '--tw-numeric-spacing': ' ',
1966
+ '--tw-numeric-fraction': ' ',
1967
+ })
1968
+
1570
1969
  addUtilities({
1571
- '.ordinal, .slashed-zero, .lining-nums, .oldstyle-nums, .proportional-nums, .tabular-nums, .diagonal-fractions, .stacked-fractions':
1572
- {
1573
- '--tw-ordinal': 'var(--tw-empty,/*!*/ /*!*/)',
1574
- '--tw-slashed-zero': 'var(--tw-empty,/*!*/ /*!*/)',
1575
- '--tw-numeric-figure': 'var(--tw-empty,/*!*/ /*!*/)',
1576
- '--tw-numeric-spacing': 'var(--tw-empty,/*!*/ /*!*/)',
1577
- '--tw-numeric-fraction': 'var(--tw-empty,/*!*/ /*!*/)',
1578
- 'font-variant-numeric':
1579
- 'var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)',
1580
- },
1581
1970
  '.normal-nums': { 'font-variant-numeric': 'normal' },
1582
- '.ordinal': { '--tw-ordinal': 'ordinal' },
1583
- '.slashed-zero': { '--tw-slashed-zero': 'slashed-zero' },
1584
- '.lining-nums': { '--tw-numeric-figure': 'lining-nums' },
1585
- '.oldstyle-nums': { '--tw-numeric-figure': 'oldstyle-nums' },
1586
- '.proportional-nums': { '--tw-numeric-spacing': 'proportional-nums' },
1587
- '.tabular-nums': { '--tw-numeric-spacing': 'tabular-nums' },
1588
- '.diagonal-fractions': { '--tw-numeric-fraction': 'diagonal-fractions' },
1589
- '.stacked-fractions': { '--tw-numeric-fraction': 'stacked-fractions' },
1971
+ '.ordinal': {
1972
+ '@defaults font-variant-numeric': {},
1973
+ '--tw-ordinal': 'ordinal',
1974
+ 'font-variant-numeric': cssFontVariantNumericValue,
1975
+ },
1976
+ '.slashed-zero': {
1977
+ '@defaults font-variant-numeric': {},
1978
+ '--tw-slashed-zero': 'slashed-zero',
1979
+ 'font-variant-numeric': cssFontVariantNumericValue,
1980
+ },
1981
+ '.lining-nums': {
1982
+ '@defaults font-variant-numeric': {},
1983
+ '--tw-numeric-figure': 'lining-nums',
1984
+ 'font-variant-numeric': cssFontVariantNumericValue,
1985
+ },
1986
+ '.oldstyle-nums': {
1987
+ '@defaults font-variant-numeric': {},
1988
+ '--tw-numeric-figure': 'oldstyle-nums',
1989
+ 'font-variant-numeric': cssFontVariantNumericValue,
1990
+ },
1991
+ '.proportional-nums': {
1992
+ '@defaults font-variant-numeric': {},
1993
+ '--tw-numeric-spacing': 'proportional-nums',
1994
+ 'font-variant-numeric': cssFontVariantNumericValue,
1995
+ },
1996
+ '.tabular-nums': {
1997
+ '@defaults font-variant-numeric': {},
1998
+ '--tw-numeric-spacing': 'tabular-nums',
1999
+ 'font-variant-numeric': cssFontVariantNumericValue,
2000
+ },
2001
+ '.diagonal-fractions': {
2002
+ '@defaults font-variant-numeric': {},
2003
+ '--tw-numeric-fraction': 'diagonal-fractions',
2004
+ 'font-variant-numeric': cssFontVariantNumericValue,
2005
+ },
2006
+ '.stacked-fractions': {
2007
+ '@defaults font-variant-numeric': {},
2008
+ '--tw-numeric-fraction': 'stacked-fractions',
2009
+ 'font-variant-numeric': cssFontVariantNumericValue,
2010
+ },
1590
2011
  })
1591
2012
  },
1592
2013
 
1593
2014
  lineHeight: createUtilityPlugin('lineHeight', [['leading', ['lineHeight']]]),
1594
- letterSpacing: createUtilityPlugin('letterSpacing', [['tracking', ['letterSpacing']]]),
2015
+ letterSpacing: createUtilityPlugin('letterSpacing', [['tracking', ['letterSpacing']]], {
2016
+ supportsNegativeValues: true,
2017
+ }),
1595
2018
 
1596
2019
  textColor: ({ matchUtilities, theme, corePlugins }) => {
1597
2020
  matchUtilities(
@@ -1608,7 +2031,7 @@ export default {
1608
2031
  })
1609
2032
  },
1610
2033
  },
1611
- { values: flattenColorPalette(theme('textColor')), type: 'color' }
2034
+ { values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
1612
2035
  )
1613
2036
  },
1614
2037
 
@@ -1616,12 +2039,46 @@ export default {
1616
2039
 
1617
2040
  textDecoration: ({ addUtilities }) => {
1618
2041
  addUtilities({
1619
- '.underline': { 'text-decoration': 'underline' },
1620
- '.line-through': { 'text-decoration': 'line-through' },
1621
- '.no-underline': { 'text-decoration': 'none' },
2042
+ '.underline': { 'text-decoration-line': 'underline' },
2043
+ '.overline': { 'text-decoration-line': 'overline' },
2044
+ '.line-through': { 'text-decoration-line': 'line-through' },
2045
+ '.no-underline': { 'text-decoration-line': 'none' },
1622
2046
  })
1623
2047
  },
1624
2048
 
2049
+ textDecorationColor: ({ matchUtilities, theme }) => {
2050
+ matchUtilities(
2051
+ {
2052
+ decoration: (value) => {
2053
+ return { 'text-decoration-color': toColorValue(value) }
2054
+ },
2055
+ },
2056
+ { values: flattenColorPalette(theme('textDecorationColor')), type: ['color', 'any'] }
2057
+ )
2058
+ },
2059
+
2060
+ textDecorationStyle: ({ addUtilities }) => {
2061
+ addUtilities({
2062
+ '.decoration-solid': { 'text-decoration-style': 'solid' },
2063
+ '.decoration-double': { 'text-decoration-style': 'double' },
2064
+ '.decoration-dotted': { 'text-decoration-style': 'dotted' },
2065
+ '.decoration-dashed': { 'text-decoration-style': 'dashed' },
2066
+ '.decoration-wavy': { 'text-decoration-style': 'wavy' },
2067
+ })
2068
+ },
2069
+
2070
+ textDecorationThickness: createUtilityPlugin(
2071
+ 'textDecorationThickness',
2072
+ [['decoration', ['text-decoration-thickness']]],
2073
+ { type: ['length', 'percentage'] }
2074
+ ),
2075
+
2076
+ textUnderlineOffset: createUtilityPlugin(
2077
+ 'textUnderlineOffset',
2078
+ [['underline-offset', ['text-underline-offset']]],
2079
+ { type: ['length', 'percentage', 'any'] }
2080
+ ),
2081
+
1625
2082
  fontSmoothing: ({ addUtilities }) => {
1626
2083
  addUtilities({
1627
2084
  '.antialiased': {
@@ -1734,6 +2191,7 @@ export default {
1734
2191
  '.mix-blend-saturation': { 'mix-blend-mode': 'saturation' },
1735
2192
  '.mix-blend-color': { 'mix-blend-mode': 'color' },
1736
2193
  '.mix-blend-luminosity': { 'mix-blend-mode': 'luminosity' },
2194
+ '.mix-blend-plus-lighter': { 'mix-blend-mode': 'plus-lighter' },
1737
2195
  })
1738
2196
  },
1739
2197
 
@@ -1745,13 +2203,12 @@ export default {
1745
2203
  `var(--tw-shadow)`,
1746
2204
  ].join(', ')
1747
2205
 
1748
- return function ({ matchUtilities, addBase, theme }) {
1749
- addBase({
1750
- '@defaults box-shadow': {
1751
- '--tw-ring-offset-shadow': '0 0 #0000',
1752
- '--tw-ring-shadow': '0 0 #0000',
1753
- '--tw-shadow': '0 0 #0000',
1754
- },
2206
+ return function ({ matchUtilities, addDefaults, theme }) {
2207
+ addDefaults(' box-shadow', {
2208
+ '--tw-ring-offset-shadow': '0 0 #0000',
2209
+ '--tw-ring-shadow': '0 0 #0000',
2210
+ '--tw-shadow': '0 0 #0000',
2211
+ '--tw-shadow-colored': '0 0 #0000',
1755
2212
  })
1756
2213
 
1757
2214
  matchUtilities(
@@ -1759,50 +2216,104 @@ export default {
1759
2216
  shadow: (value) => {
1760
2217
  value = transformValue(value)
1761
2218
 
2219
+ let ast = parseBoxShadowValue(value)
2220
+ for (let shadow of ast) {
2221
+ // Don't override color if the whole shadow is a variable
2222
+ if (!shadow.valid) {
2223
+ continue
2224
+ }
2225
+
2226
+ shadow.color = 'var(--tw-shadow-color)'
2227
+ }
2228
+
1762
2229
  return {
1763
2230
  '@defaults box-shadow': {},
1764
2231
  '--tw-shadow': value === 'none' ? '0 0 #0000' : value,
2232
+ '--tw-shadow-colored': value === 'none' ? '0 0 #0000' : formatBoxShadowValue(ast),
1765
2233
  'box-shadow': defaultBoxShadow,
1766
2234
  }
1767
2235
  },
1768
2236
  },
1769
- { values: theme('boxShadow') }
2237
+ { values: theme('boxShadow'), type: ['shadow'] }
1770
2238
  )
1771
2239
  }
1772
2240
  })(),
1773
2241
 
1774
- outline: ({ matchUtilities, theme }) => {
2242
+ boxShadowColor: ({ matchUtilities, theme }) => {
1775
2243
  matchUtilities(
1776
2244
  {
1777
- outline: (value) => {
1778
- value = Array.isArray(value) ? value : value.split(',')
1779
- let [outline, outlineOffset = '0'] = Array.isArray(value) ? value : [value]
1780
-
1781
- return { outline, 'outline-offset': outlineOffset }
2245
+ shadow: (value) => {
2246
+ return {
2247
+ '--tw-shadow-color': toColorValue(value),
2248
+ '--tw-shadow': 'var(--tw-shadow-colored)',
2249
+ }
1782
2250
  },
1783
2251
  },
1784
- { values: theme('outline') }
2252
+ { values: flattenColorPalette(theme('boxShadowColor')), type: ['color', 'any'] }
1785
2253
  )
1786
2254
  },
1787
2255
 
1788
- ringWidth: ({ matchUtilities, addBase, addUtilities, theme }) => {
1789
- let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5')
1790
- let ringColorDefault = withAlphaValue(
1791
- theme('ringColor.DEFAULT'),
1792
- ringOpacityDefault,
1793
- `rgb(147 197 253 / ${ringOpacityDefault})`
1794
- )
2256
+ outlineStyle: ({ addUtilities }) => {
2257
+ addUtilities({
2258
+ '.outline-none': {
2259
+ outline: '2px solid transparent',
2260
+ 'outline-offset': '2px',
2261
+ },
2262
+ '.outline': { 'outline-style': 'solid' },
2263
+ '.outline-dashed': { 'outline-style': 'dashed' },
2264
+ '.outline-dotted': { 'outline-style': 'dotted' },
2265
+ '.outline-double': { 'outline-style': 'double' },
2266
+ })
2267
+ },
1795
2268
 
1796
- addBase({
1797
- '@defaults ring-width': {
1798
- '--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
1799
- '--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
1800
- '--tw-ring-offset-color': theme('ringOffsetColor.DEFAULT', '#fff'),
1801
- '--tw-ring-color': ringColorDefault,
1802
- '--tw-ring-offset-shadow': '0 0 #0000',
1803
- '--tw-ring-shadow': '0 0 #0000',
1804
- '--tw-shadow': '0 0 #0000',
2269
+ outlineWidth: createUtilityPlugin('outlineWidth', [['outline', ['outline-width']]], {
2270
+ type: ['length', 'number', 'percentage'],
2271
+ }),
2272
+
2273
+ outlineOffset: createUtilityPlugin('outlineOffset', [['outline-offset', ['outline-offset']]], {
2274
+ type: ['length', 'number', 'percentage', 'any'],
2275
+ supportsNegativeValues: true,
2276
+ }),
2277
+
2278
+ outlineColor: ({ matchUtilities, theme }) => {
2279
+ matchUtilities(
2280
+ {
2281
+ outline: (value) => {
2282
+ return { 'outline-color': toColorValue(value) }
2283
+ },
1805
2284
  },
2285
+ { values: flattenColorPalette(theme('outlineColor')), type: ['color', 'any'] }
2286
+ )
2287
+ },
2288
+
2289
+ ringWidth: ({ matchUtilities, addDefaults, addUtilities, theme, config }) => {
2290
+ let ringColorDefault = (() => {
2291
+ if (flagEnabled(config(), 'respectDefaultRingColorOpacity')) {
2292
+ return theme('ringColor.DEFAULT')
2293
+ }
2294
+
2295
+ let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5')
2296
+
2297
+ if (!theme('ringColor')?.DEFAULT) {
2298
+ return `rgb(147 197 253 / ${ringOpacityDefault})`
2299
+ }
2300
+
2301
+ return withAlphaValue(
2302
+ theme('ringColor')?.DEFAULT,
2303
+ ringOpacityDefault,
2304
+ `rgb(147 197 253 / ${ringOpacityDefault})`
2305
+ )
2306
+ })()
2307
+
2308
+ addDefaults('ring-width', {
2309
+ '--tw-ring-inset': ' ',
2310
+ '--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
2311
+ '--tw-ring-offset-color': theme('ringOffsetColor.DEFAULT', '#fff'),
2312
+ '--tw-ring-color': ringColorDefault,
2313
+ '--tw-ring-offset-shadow': '0 0 #0000',
2314
+ '--tw-ring-shadow': '0 0 #0000',
2315
+ '--tw-shadow': '0 0 #0000',
2316
+ '--tw-shadow-colored': '0 0 #0000',
1806
2317
  })
1807
2318
 
1808
2319
  matchUtilities(
@@ -1828,10 +2339,16 @@ export default {
1828
2339
  })
1829
2340
  },
1830
2341
 
1831
- ringColor: ({ matchUtilities, theme }) => {
2342
+ ringColor: ({ matchUtilities, theme, corePlugins }) => {
1832
2343
  matchUtilities(
1833
2344
  {
1834
2345
  ring: (value) => {
2346
+ if (!corePlugins('ringOpacity')) {
2347
+ return {
2348
+ '--tw-ring-color': toColorValue(value),
2349
+ }
2350
+ }
2351
+
1835
2352
  return withAlphaVariable({
1836
2353
  color: value,
1837
2354
  property: '--tw-ring-color',
@@ -1845,14 +2362,18 @@ export default {
1845
2362
  ([modifier]) => modifier !== 'DEFAULT'
1846
2363
  )
1847
2364
  ),
1848
- type: 'color',
2365
+ type: ['color', 'any'],
1849
2366
  }
1850
2367
  )
1851
2368
  },
1852
2369
 
1853
- ringOpacity: createUtilityPlugin('ringOpacity', [['ring-opacity', ['--tw-ring-opacity']]], {
1854
- filterDefault: true,
1855
- }),
2370
+ ringOpacity: (helpers) => {
2371
+ let { config } = helpers
2372
+
2373
+ return createUtilityPlugin('ringOpacity', [['ring-opacity', ['--tw-ring-opacity']]], {
2374
+ filterDefault: !flagEnabled(config(), 'respectDefaultRingColorOpacity'),
2375
+ })(helpers)
2376
+ },
1856
2377
  ringOffsetWidth: createUtilityPlugin(
1857
2378
  'ringOffsetWidth',
1858
2379
  [['ring-offset', ['--tw-ring-offset-width']]],
@@ -1868,7 +2389,7 @@ export default {
1868
2389
  }
1869
2390
  },
1870
2391
  },
1871
- { values: flattenColorPalette(theme('ringOffsetColor')), type: 'color' }
2392
+ { values: flattenColorPalette(theme('ringOffsetColor')), type: ['color', 'any'] }
1872
2393
  )
1873
2394
  },
1874
2395
 
@@ -1879,7 +2400,7 @@ export default {
1879
2400
  return {
1880
2401
  '--tw-blur': `blur(${value})`,
1881
2402
  '@defaults filter': {},
1882
- filter: 'var(--tw-filter)',
2403
+ filter: cssFilterValue,
1883
2404
  }
1884
2405
  },
1885
2406
  },
@@ -1894,7 +2415,7 @@ export default {
1894
2415
  return {
1895
2416
  '--tw-brightness': `brightness(${value})`,
1896
2417
  '@defaults filter': {},
1897
- filter: 'var(--tw-filter)',
2418
+ filter: cssFilterValue,
1898
2419
  }
1899
2420
  },
1900
2421
  },
@@ -1909,7 +2430,7 @@ export default {
1909
2430
  return {
1910
2431
  '--tw-contrast': `contrast(${value})`,
1911
2432
  '@defaults filter': {},
1912
- filter: 'var(--tw-filter)',
2433
+ filter: cssFilterValue,
1913
2434
  }
1914
2435
  },
1915
2436
  },
@@ -1926,7 +2447,7 @@ export default {
1926
2447
  ? value.map((v) => `drop-shadow(${v})`).join(' ')
1927
2448
  : `drop-shadow(${value})`,
1928
2449
  '@defaults filter': {},
1929
- filter: 'var(--tw-filter)',
2450
+ filter: cssFilterValue,
1930
2451
  }
1931
2452
  },
1932
2453
  },
@@ -1941,7 +2462,7 @@ export default {
1941
2462
  return {
1942
2463
  '--tw-grayscale': `grayscale(${value})`,
1943
2464
  '@defaults filter': {},
1944
- filter: 'var(--tw-filter)',
2465
+ filter: cssFilterValue,
1945
2466
  }
1946
2467
  },
1947
2468
  },
@@ -1956,11 +2477,11 @@ export default {
1956
2477
  return {
1957
2478
  '--tw-hue-rotate': `hue-rotate(${value})`,
1958
2479
  '@defaults filter': {},
1959
- filter: 'var(--tw-filter)',
2480
+ filter: cssFilterValue,
1960
2481
  }
1961
2482
  },
1962
2483
  },
1963
- { values: theme('hueRotate') }
2484
+ { values: theme('hueRotate'), supportsNegativeValues: true }
1964
2485
  )
1965
2486
  },
1966
2487
 
@@ -1971,7 +2492,7 @@ export default {
1971
2492
  return {
1972
2493
  '--tw-invert': `invert(${value})`,
1973
2494
  '@defaults filter': {},
1974
- filter: 'var(--tw-filter)',
2495
+ filter: cssFilterValue,
1975
2496
  }
1976
2497
  },
1977
2498
  },
@@ -1986,7 +2507,7 @@ export default {
1986
2507
  return {
1987
2508
  '--tw-saturate': `saturate(${value})`,
1988
2509
  '@defaults filter': {},
1989
- filter: 'var(--tw-filter)',
2510
+ filter: cssFilterValue,
1990
2511
  }
1991
2512
  },
1992
2513
  },
@@ -2001,7 +2522,7 @@ export default {
2001
2522
  return {
2002
2523
  '--tw-sepia': `sepia(${value})`,
2003
2524
  '@defaults filter': {},
2004
- filter: 'var(--tw-filter)',
2525
+ filter: cssFilterValue,
2005
2526
  }
2006
2527
  },
2007
2528
  },
@@ -2009,33 +2530,20 @@ export default {
2009
2530
  )
2010
2531
  },
2011
2532
 
2012
- filter: ({ addBase, addUtilities }) => {
2013
- addBase({
2014
- '@defaults filter': {
2015
- '--tw-blur': 'var(--tw-empty,/*!*/ /*!*/)',
2016
- '--tw-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
2017
- '--tw-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
2018
- '--tw-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
2019
- '--tw-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
2020
- '--tw-invert': 'var(--tw-empty,/*!*/ /*!*/)',
2021
- '--tw-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
2022
- '--tw-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
2023
- '--tw-drop-shadow': 'var(--tw-empty,/*!*/ /*!*/)',
2024
- '--tw-filter': [
2025
- 'var(--tw-blur)',
2026
- 'var(--tw-brightness)',
2027
- 'var(--tw-contrast)',
2028
- 'var(--tw-grayscale)',
2029
- 'var(--tw-hue-rotate)',
2030
- 'var(--tw-invert)',
2031
- 'var(--tw-saturate)',
2032
- 'var(--tw-sepia)',
2033
- 'var(--tw-drop-shadow)',
2034
- ].join(' '),
2035
- },
2036
- })
2037
- addUtilities({
2038
- '.filter': { '@defaults filter': {}, filter: 'var(--tw-filter)' },
2533
+ filter: ({ addDefaults, addUtilities }) => {
2534
+ addDefaults('filter', {
2535
+ '--tw-blur': ' ',
2536
+ '--tw-brightness': ' ',
2537
+ '--tw-contrast': ' ',
2538
+ '--tw-grayscale': ' ',
2539
+ '--tw-hue-rotate': ' ',
2540
+ '--tw-invert': ' ',
2541
+ '--tw-saturate': ' ',
2542
+ '--tw-sepia': ' ',
2543
+ '--tw-drop-shadow': ' ',
2544
+ })
2545
+ addUtilities({
2546
+ '.filter': { '@defaults filter': {}, filter: cssFilterValue },
2039
2547
  '.filter-none': { filter: 'none' },
2040
2548
  })
2041
2549
  },
@@ -2047,7 +2555,7 @@ export default {
2047
2555
  return {
2048
2556
  '--tw-backdrop-blur': `blur(${value})`,
2049
2557
  '@defaults backdrop-filter': {},
2050
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2558
+ 'backdrop-filter': cssBackdropFilterValue,
2051
2559
  }
2052
2560
  },
2053
2561
  },
@@ -2062,7 +2570,7 @@ export default {
2062
2570
  return {
2063
2571
  '--tw-backdrop-brightness': `brightness(${value})`,
2064
2572
  '@defaults backdrop-filter': {},
2065
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2573
+ 'backdrop-filter': cssBackdropFilterValue,
2066
2574
  }
2067
2575
  },
2068
2576
  },
@@ -2077,7 +2585,7 @@ export default {
2077
2585
  return {
2078
2586
  '--tw-backdrop-contrast': `contrast(${value})`,
2079
2587
  '@defaults backdrop-filter': {},
2080
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2588
+ 'backdrop-filter': cssBackdropFilterValue,
2081
2589
  }
2082
2590
  },
2083
2591
  },
@@ -2092,7 +2600,7 @@ export default {
2092
2600
  return {
2093
2601
  '--tw-backdrop-grayscale': `grayscale(${value})`,
2094
2602
  '@defaults backdrop-filter': {},
2095
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2603
+ 'backdrop-filter': cssBackdropFilterValue,
2096
2604
  }
2097
2605
  },
2098
2606
  },
@@ -2107,11 +2615,11 @@ export default {
2107
2615
  return {
2108
2616
  '--tw-backdrop-hue-rotate': `hue-rotate(${value})`,
2109
2617
  '@defaults backdrop-filter': {},
2110
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2618
+ 'backdrop-filter': cssBackdropFilterValue,
2111
2619
  }
2112
2620
  },
2113
2621
  },
2114
- { values: theme('backdropHueRotate') }
2622
+ { values: theme('backdropHueRotate'), supportsNegativeValues: true }
2115
2623
  )
2116
2624
  },
2117
2625
 
@@ -2122,7 +2630,7 @@ export default {
2122
2630
  return {
2123
2631
  '--tw-backdrop-invert': `invert(${value})`,
2124
2632
  '@defaults backdrop-filter': {},
2125
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2633
+ 'backdrop-filter': cssBackdropFilterValue,
2126
2634
  }
2127
2635
  },
2128
2636
  },
@@ -2137,7 +2645,7 @@ export default {
2137
2645
  return {
2138
2646
  '--tw-backdrop-opacity': `opacity(${value})`,
2139
2647
  '@defaults backdrop-filter': {},
2140
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2648
+ 'backdrop-filter': cssBackdropFilterValue,
2141
2649
  }
2142
2650
  },
2143
2651
  },
@@ -2152,7 +2660,7 @@ export default {
2152
2660
  return {
2153
2661
  '--tw-backdrop-saturate': `saturate(${value})`,
2154
2662
  '@defaults backdrop-filter': {},
2155
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2663
+ 'backdrop-filter': cssBackdropFilterValue,
2156
2664
  }
2157
2665
  },
2158
2666
  },
@@ -2167,7 +2675,7 @@ export default {
2167
2675
  return {
2168
2676
  '--tw-backdrop-sepia': `sepia(${value})`,
2169
2677
  '@defaults backdrop-filter': {},
2170
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2678
+ 'backdrop-filter': cssBackdropFilterValue,
2171
2679
  }
2172
2680
  },
2173
2681
  },
@@ -2175,35 +2683,22 @@ export default {
2175
2683
  )
2176
2684
  },
2177
2685
 
2178
- backdropFilter: ({ addBase, addUtilities }) => {
2179
- addBase({
2180
- '@defaults backdrop-filter': {
2181
- '--tw-backdrop-blur': 'var(--tw-empty,/*!*/ /*!*/)',
2182
- '--tw-backdrop-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
2183
- '--tw-backdrop-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
2184
- '--tw-backdrop-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
2185
- '--tw-backdrop-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
2186
- '--tw-backdrop-invert': 'var(--tw-empty,/*!*/ /*!*/)',
2187
- '--tw-backdrop-opacity': 'var(--tw-empty,/*!*/ /*!*/)',
2188
- '--tw-backdrop-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
2189
- '--tw-backdrop-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
2190
- '--tw-backdrop-filter': [
2191
- 'var(--tw-backdrop-blur)',
2192
- 'var(--tw-backdrop-brightness)',
2193
- 'var(--tw-backdrop-contrast)',
2194
- 'var(--tw-backdrop-grayscale)',
2195
- 'var(--tw-backdrop-hue-rotate)',
2196
- 'var(--tw-backdrop-invert)',
2197
- 'var(--tw-backdrop-opacity)',
2198
- 'var(--tw-backdrop-saturate)',
2199
- 'var(--tw-backdrop-sepia)',
2200
- ].join(' '),
2201
- },
2686
+ backdropFilter: ({ addDefaults, addUtilities }) => {
2687
+ addDefaults('backdrop-filter', {
2688
+ '--tw-backdrop-blur': ' ',
2689
+ '--tw-backdrop-brightness': ' ',
2690
+ '--tw-backdrop-contrast': ' ',
2691
+ '--tw-backdrop-grayscale': ' ',
2692
+ '--tw-backdrop-hue-rotate': ' ',
2693
+ '--tw-backdrop-invert': ' ',
2694
+ '--tw-backdrop-opacity': ' ',
2695
+ '--tw-backdrop-saturate': ' ',
2696
+ '--tw-backdrop-sepia': ' ',
2202
2697
  })
2203
2698
  addUtilities({
2204
2699
  '.backdrop-filter': {
2205
2700
  '@defaults backdrop-filter': {},
2206
- 'backdrop-filter': 'var(--tw-backdrop-filter)',
2701
+ 'backdrop-filter': cssBackdropFilterValue,
2207
2702
  },
2208
2703
  '.backdrop-filter-none': { 'backdrop-filter': 'none' },
2209
2704
  })
@@ -2243,5 +2738,7 @@ export default {
2243
2738
  { filterDefault: true }
2244
2739
  ),
2245
2740
  willChange: createUtilityPlugin('willChange', [['will-change', ['will-change']]]),
2246
- content: createUtilityPlugin('content'),
2741
+ content: createUtilityPlugin('content', [
2742
+ ['content', ['--tw-content', ['content', 'var(--tw-content)']]],
2743
+ ]),
2247
2744
  }