tailwindcss 0.0.0-insiders.ee945bb → 0.0.0-insiders.ef2ebb2

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 (215) hide show
  1. package/README.md +13 -9
  2. package/colors.d.ts +3 -0
  3. package/defaultConfig.d.ts +3 -0
  4. package/defaultTheme.d.ts +4 -0
  5. package/index.css +5 -0
  6. package/lib/cli/build/index.js +57 -0
  7. package/lib/cli/build/plugin.js +433 -0
  8. package/lib/cli/build/utils.js +88 -0
  9. package/lib/cli/build/watching.js +182 -0
  10. package/lib/cli/help/index.js +73 -0
  11. package/lib/cli/index.js +231 -0
  12. package/lib/cli/init/index.js +63 -0
  13. package/lib/cli.js +1 -751
  14. package/lib/corePluginList.js +13 -3
  15. package/lib/corePlugins.js +2323 -1720
  16. package/lib/css/preflight.css +13 -5
  17. package/lib/featureFlags.js +50 -25
  18. package/lib/index.js +1 -40
  19. package/lib/lib/cacheInvalidation.js +48 -25
  20. package/lib/lib/collapseAdjacentRules.js +17 -10
  21. package/lib/lib/collapseDuplicateDeclarations.js +13 -8
  22. package/lib/lib/content.js +207 -0
  23. package/lib/lib/defaultExtractor.js +232 -33
  24. package/lib/lib/detectNesting.js +21 -10
  25. package/lib/lib/evaluateTailwindFunctions.js +117 -50
  26. package/lib/lib/expandApplyAtRules.js +316 -215
  27. package/lib/lib/expandTailwindAtRules.js +167 -115
  28. package/lib/lib/findAtConfigPath.js +46 -0
  29. package/lib/lib/generateRules.js +454 -206
  30. package/lib/lib/getModuleDependencies.js +88 -37
  31. package/lib/lib/handleImportAtRules.js +50 -0
  32. package/lib/lib/load-config.js +42 -0
  33. package/lib/lib/normalizeTailwindDirectives.js +29 -39
  34. package/lib/lib/offsets.js +306 -0
  35. package/lib/lib/partitionApplyAtRules.js +13 -8
  36. package/lib/lib/regex.js +74 -0
  37. package/lib/lib/remap-bitfield.js +89 -0
  38. package/lib/lib/resolveDefaultsAtRules.js +96 -74
  39. package/lib/lib/setupContextUtils.js +687 -301
  40. package/lib/lib/setupTrackingContext.js +63 -68
  41. package/lib/lib/sharedState.js +44 -17
  42. package/lib/lib/substituteScreenAtRules.js +14 -10
  43. package/lib/plugin.js +166 -0
  44. package/lib/postcss-plugins/nesting/README.md +2 -2
  45. package/lib/postcss-plugins/nesting/index.js +10 -6
  46. package/lib/postcss-plugins/nesting/plugin.js +24 -20
  47. package/lib/processTailwindFeatures.js +34 -29
  48. package/lib/public/colors.js +272 -246
  49. package/lib/public/create-plugin.js +9 -5
  50. package/lib/public/default-config.js +10 -6
  51. package/lib/public/default-theme.js +10 -6
  52. package/lib/public/load-config.js +12 -0
  53. package/lib/public/resolve-config.js +11 -6
  54. package/lib/util/applyImportantSelector.js +36 -0
  55. package/lib/util/bigSign.js +6 -1
  56. package/lib/util/buildMediaQuery.js +13 -6
  57. package/lib/util/cloneDeep.js +9 -6
  58. package/lib/util/cloneNodes.js +12 -3
  59. package/lib/util/color.js +70 -53
  60. package/lib/util/colorNames.js +752 -0
  61. package/lib/util/configurePlugins.js +7 -2
  62. package/lib/util/createPlugin.js +8 -5
  63. package/lib/util/createUtilityPlugin.js +13 -9
  64. package/lib/util/dataTypes.js +182 -111
  65. package/lib/util/defaults.js +12 -7
  66. package/lib/util/escapeClassName.js +13 -8
  67. package/lib/util/escapeCommas.js +7 -2
  68. package/lib/util/flattenColorPalette.js +11 -10
  69. package/lib/util/formatVariantSelector.js +228 -151
  70. package/lib/util/getAllConfigs.js +33 -12
  71. package/lib/util/hashConfig.js +9 -4
  72. package/lib/util/isKeyframeRule.js +7 -2
  73. package/lib/util/isPlainObject.js +7 -2
  74. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
  75. package/lib/util/log.js +40 -13
  76. package/lib/util/nameClass.js +27 -10
  77. package/lib/util/negateValue.js +25 -8
  78. package/lib/util/normalizeConfig.js +155 -87
  79. package/lib/util/normalizeScreens.js +127 -8
  80. package/lib/util/parseAnimationValue.js +44 -40
  81. package/lib/util/parseBoxShadowValue.js +33 -62
  82. package/lib/util/parseDependency.js +39 -55
  83. package/lib/util/parseGlob.js +36 -0
  84. package/lib/util/parseObjectStyles.js +15 -10
  85. package/lib/util/pluginUtils.js +154 -59
  86. package/lib/util/prefixSelector.js +29 -10
  87. package/lib/util/pseudoElements.js +209 -0
  88. package/lib/util/removeAlphaVariables.js +31 -0
  89. package/lib/util/resolveConfig.js +96 -95
  90. package/lib/util/resolveConfigPath.js +29 -10
  91. package/lib/util/responsive.js +11 -6
  92. package/lib/util/splitAtTopLevelOnly.js +51 -0
  93. package/lib/util/tap.js +6 -1
  94. package/lib/util/toColorValue.js +7 -2
  95. package/lib/util/toPath.js +22 -4
  96. package/lib/util/transformThemeValue.js +40 -26
  97. package/lib/util/validateConfig.js +48 -0
  98. package/lib/util/validateFormalSyntax.js +26 -0
  99. package/lib/util/withAlphaVariable.js +27 -15
  100. package/lib/value-parser/LICENSE +22 -0
  101. package/lib/value-parser/README.md +3 -0
  102. package/lib/value-parser/index.d.js +2 -0
  103. package/lib/value-parser/index.js +22 -0
  104. package/lib/value-parser/parse.js +259 -0
  105. package/lib/value-parser/stringify.js +38 -0
  106. package/lib/value-parser/unit.js +86 -0
  107. package/lib/value-parser/walk.js +16 -0
  108. package/loadConfig.d.ts +4 -0
  109. package/loadConfig.js +2 -0
  110. package/package.json +59 -53
  111. package/plugin.d.ts +11 -0
  112. package/resolveConfig.d.ts +12 -0
  113. package/scripts/generate-types.js +105 -0
  114. package/scripts/release-channel.js +18 -0
  115. package/scripts/release-notes.js +21 -0
  116. package/scripts/type-utils.js +27 -0
  117. package/src/cli/build/index.js +53 -0
  118. package/src/cli/build/plugin.js +476 -0
  119. package/src/cli/build/utils.js +76 -0
  120. package/src/cli/build/watching.js +229 -0
  121. package/src/cli/help/index.js +70 -0
  122. package/src/cli/index.js +217 -0
  123. package/src/cli/init/index.js +79 -0
  124. package/src/cli.js +1 -825
  125. package/src/corePluginList.js +1 -1
  126. package/src/corePlugins.js +614 -106
  127. package/src/css/preflight.css +13 -5
  128. package/src/featureFlags.js +17 -3
  129. package/src/index.js +1 -42
  130. package/src/lib/collapseAdjacentRules.js +5 -1
  131. package/src/lib/content.js +240 -0
  132. package/src/lib/defaultExtractor.js +202 -35
  133. package/src/lib/detectNesting.js +9 -1
  134. package/src/lib/evaluateTailwindFunctions.js +82 -8
  135. package/src/lib/expandApplyAtRules.js +322 -189
  136. package/src/lib/expandTailwindAtRules.js +82 -59
  137. package/src/lib/findAtConfigPath.js +48 -0
  138. package/src/lib/generateRules.js +427 -127
  139. package/src/lib/getModuleDependencies.js +70 -30
  140. package/src/lib/handleImportAtRules.js +34 -0
  141. package/src/lib/load-config.ts +31 -0
  142. package/src/lib/normalizeTailwindDirectives.js +0 -27
  143. package/src/lib/offsets.js +373 -0
  144. package/src/lib/regex.js +74 -0
  145. package/src/lib/remap-bitfield.js +82 -0
  146. package/src/lib/resolveDefaultsAtRules.js +53 -36
  147. package/src/lib/setupContextUtils.js +591 -156
  148. package/src/lib/setupTrackingContext.js +44 -58
  149. package/src/lib/sharedState.js +13 -4
  150. package/src/plugin.js +141 -0
  151. package/src/postcss-plugins/nesting/README.md +2 -2
  152. package/src/public/colors.js +22 -0
  153. package/src/public/default-config.js +1 -1
  154. package/src/public/default-theme.js +2 -2
  155. package/src/public/load-config.js +2 -0
  156. package/src/util/applyImportantSelector.js +27 -0
  157. package/src/util/buildMediaQuery.js +5 -3
  158. package/src/util/cloneNodes.js +5 -1
  159. package/src/util/color.js +39 -20
  160. package/src/util/colorNames.js +150 -0
  161. package/src/util/dataTypes.js +67 -23
  162. package/src/util/formatVariantSelector.js +264 -144
  163. package/src/util/getAllConfigs.js +21 -2
  164. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  165. package/src/util/log.js +25 -1
  166. package/src/util/nameClass.js +4 -0
  167. package/src/util/negateValue.js +11 -3
  168. package/src/util/normalizeConfig.js +78 -20
  169. package/src/util/normalizeScreens.js +99 -4
  170. package/src/util/parseBoxShadowValue.js +3 -50
  171. package/src/util/parseDependency.js +37 -42
  172. package/src/util/parseGlob.js +24 -0
  173. package/src/util/pluginUtils.js +118 -23
  174. package/src/util/prefixSelector.js +28 -10
  175. package/src/util/pseudoElements.js +167 -0
  176. package/src/util/removeAlphaVariables.js +24 -0
  177. package/src/util/resolveConfig.js +70 -62
  178. package/src/util/resolveConfigPath.js +12 -1
  179. package/src/util/splitAtTopLevelOnly.js +52 -0
  180. package/src/util/toPath.js +1 -1
  181. package/src/util/transformThemeValue.js +13 -3
  182. package/src/util/validateConfig.js +36 -0
  183. package/src/util/validateFormalSyntax.js +34 -0
  184. package/src/util/withAlphaVariable.js +1 -1
  185. package/src/value-parser/LICENSE +22 -0
  186. package/src/value-parser/README.md +3 -0
  187. package/src/value-parser/index.d.ts +177 -0
  188. package/src/value-parser/index.js +28 -0
  189. package/src/value-parser/parse.js +303 -0
  190. package/src/value-parser/stringify.js +41 -0
  191. package/src/value-parser/unit.js +118 -0
  192. package/src/value-parser/walk.js +18 -0
  193. package/stubs/.gitignore +1 -0
  194. package/stubs/.prettierrc.json +6 -0
  195. package/stubs/{defaultConfig.stub.js → config.full.js} +218 -165
  196. package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -1
  197. package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
  198. package/stubs/postcss.config.js +5 -0
  199. package/stubs/tailwind.config.cjs +2 -0
  200. package/stubs/tailwind.config.js +2 -0
  201. package/stubs/tailwind.config.ts +3 -0
  202. package/types/config.d.ts +369 -0
  203. package/types/generated/.gitkeep +0 -0
  204. package/types/generated/colors.d.ts +298 -0
  205. package/types/generated/corePluginList.d.ts +1 -0
  206. package/types/generated/default-theme.d.ts +372 -0
  207. package/types/index.d.ts +7 -0
  208. package/CHANGELOG.md +0 -2090
  209. package/lib/cli-peer-dependencies.js +0 -15
  210. package/lib/constants.js +0 -37
  211. package/peers/index.js +0 -75077
  212. package/scripts/install-integrations.js +0 -27
  213. package/scripts/rebuildFixtures.js +0 -68
  214. package/src/cli-peer-dependencies.js +0 -9
  215. package/src/constants.js +0 -17
@@ -12,21 +12,43 @@ import isPlainObject from './util/isPlainObject'
12
12
  import transformThemeValue from './util/transformThemeValue'
13
13
  import { version as tailwindVersion } from '../package.json'
14
14
  import log from './util/log'
15
- import { normalizeScreens } from './util/normalizeScreens'
15
+ import {
16
+ normalizeScreens,
17
+ isScreenSortable,
18
+ compareScreens,
19
+ toScreen,
20
+ } from './util/normalizeScreens'
16
21
  import { formatBoxShadowValue, parseBoxShadowValue } from './util/parseBoxShadowValue'
22
+ import { removeAlphaVariables } from './util/removeAlphaVariables'
23
+ import { flagEnabled } from './featureFlags'
24
+ import { normalize } from './util/dataTypes'
17
25
 
18
26
  export let variantPlugins = {
19
27
  pseudoElementVariants: ({ addVariant }) => {
20
28
  addVariant('first-letter', '&::first-letter')
21
29
  addVariant('first-line', '&::first-line')
22
30
 
23
- addVariant('marker', ['& *::marker', '&::marker'])
31
+ addVariant('marker', [
32
+ ({ container }) => {
33
+ removeAlphaVariables(container, ['--tw-text-opacity'])
34
+
35
+ return '& *::marker'
36
+ },
37
+ ({ container }) => {
38
+ removeAlphaVariables(container, ['--tw-text-opacity'])
39
+
40
+ return '&::marker'
41
+ },
42
+ ])
43
+
24
44
  addVariant('selection', ['& *::selection', '&::selection'])
25
45
 
26
46
  addVariant('file', '&::file-selector-button')
27
47
 
28
48
  addVariant('placeholder', '&::placeholder')
29
49
 
50
+ addVariant('backdrop', '&::backdrop')
51
+
30
52
  addVariant('before', ({ container }) => {
31
53
  container.walkRules((rule) => {
32
54
  let foundContent = false
@@ -58,14 +80,14 @@ export let variantPlugins = {
58
80
  })
59
81
  },
60
82
 
61
- pseudoClassVariants: ({ addVariant }) => {
83
+ pseudoClassVariants: ({ addVariant, matchVariant, config }) => {
62
84
  let pseudoVariants = [
63
85
  // Positional
64
- ['first', ':first-child'],
65
- ['last', ':last-child'],
66
- ['only', ':only-child'],
67
- ['odd', ':nth-child(odd)'],
68
- ['even', ':nth-child(even)'],
86
+ ['first', '&:first-child'],
87
+ ['last', '&:last-child'],
88
+ ['only', '&:only-child'],
89
+ ['odd', '&:nth-child(odd)'],
90
+ ['even', '&:nth-child(even)'],
69
91
  'first-of-type',
70
92
  'last-of-type',
71
93
  'only-of-type',
@@ -74,27 +96,17 @@ export let variantPlugins = {
74
96
  [
75
97
  'visited',
76
98
  ({ container }) => {
77
- let toRemove = ['--tw-text-opacity', '--tw-border-opacity', '--tw-bg-opacity']
78
-
79
- container.walkDecls((decl) => {
80
- if (toRemove.includes(decl.prop)) {
81
- decl.remove()
99
+ removeAlphaVariables(container, [
100
+ '--tw-text-opacity',
101
+ '--tw-border-opacity',
102
+ '--tw-bg-opacity',
103
+ ])
82
104
 
83
- return
84
- }
85
-
86
- for (const varName of toRemove) {
87
- if (decl.value.includes(`/ var(${varName})`)) {
88
- decl.value = decl.value.replace(`/ var(${varName})`, '')
89
- }
90
- }
91
- })
92
-
93
- return ':visited'
105
+ return '&:visited'
94
106
  },
95
107
  ],
96
108
  'target',
97
- ['open', '[open]'],
109
+ ['open', '&[open]'],
98
110
 
99
111
  // Forms
100
112
  'default',
@@ -102,6 +114,7 @@ export let variantPlugins = {
102
114
  'indeterminate',
103
115
  'placeholder-shown',
104
116
  'autofill',
117
+ 'optional',
105
118
  'required',
106
119
  'valid',
107
120
  'invalid',
@@ -114,56 +127,79 @@ export let variantPlugins = {
114
127
 
115
128
  // Interactive
116
129
  'focus-within',
117
- 'hover',
130
+ [
131
+ 'hover',
132
+ !flagEnabled(config(), 'hoverOnlyWhenSupported')
133
+ ? '&:hover'
134
+ : '@media (hover: hover) and (pointer: fine) { &:hover }',
135
+ ],
118
136
  'focus',
119
137
  'focus-visible',
120
138
  'active',
139
+ 'enabled',
121
140
  'disabled',
122
- ].map((variant) => (Array.isArray(variant) ? variant : [variant, `:${variant}`]))
141
+ ].map((variant) => (Array.isArray(variant) ? variant : [variant, `&:${variant}`]))
123
142
 
124
143
  for (let [variantName, state] of pseudoVariants) {
125
144
  addVariant(variantName, (ctx) => {
126
145
  let result = typeof state === 'function' ? state(ctx) : state
127
146
 
128
- return `&${result}`
147
+ return result
129
148
  })
130
149
  }
131
150
 
132
- for (let [variantName, state] of pseudoVariants) {
133
- addVariant(`group-${variantName}`, (ctx) => {
134
- let result = typeof state === 'function' ? state(ctx) : state
135
-
136
- return `:merge(.group)${result} &`
137
- })
151
+ let variants = {
152
+ group: (_, { modifier }) =>
153
+ modifier
154
+ ? [`:merge(.group\\/${escapeClassName(modifier)})`, ' &']
155
+ : [`:merge(.group)`, ' &'],
156
+ peer: (_, { modifier }) =>
157
+ modifier
158
+ ? [`:merge(.peer\\/${escapeClassName(modifier)})`, ' ~ &']
159
+ : [`:merge(.peer)`, ' ~ &'],
138
160
  }
139
161
 
140
- for (let [variantName, state] of pseudoVariants) {
141
- addVariant(`peer-${variantName}`, (ctx) => {
142
- let result = typeof state === 'function' ? state(ctx) : state
162
+ for (let [name, fn] of Object.entries(variants)) {
163
+ matchVariant(
164
+ name,
165
+ (value = '', extra) => {
166
+ let result = normalize(typeof value === 'function' ? value(extra) : value)
167
+ if (!result.includes('&')) result = '&' + result
168
+
169
+ let [a, b] = fn('', extra)
170
+
171
+ let start = null
172
+ let end = null
173
+ let quotes = 0
174
+
175
+ for (let i = 0; i < result.length; ++i) {
176
+ let c = result[i]
177
+ if (c === '&') {
178
+ start = i
179
+ } else if (c === "'" || c === '"') {
180
+ quotes += 1
181
+ } else if (start !== null && c === ' ' && !quotes) {
182
+ end = i
183
+ }
184
+ }
143
185
 
144
- return `:merge(.peer)${result} ~ &`
145
- })
186
+ if (start !== null && end === null) {
187
+ end = result.length
188
+ }
189
+
190
+ // Basically this but can handle quotes:
191
+ // result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
192
+
193
+ return result.slice(0, start) + a + result.slice(start + 1, end) + b + result.slice(end)
194
+ },
195
+ { values: Object.fromEntries(pseudoVariants) }
196
+ )
146
197
  }
147
198
  },
148
199
 
149
200
  directionVariants: ({ addVariant }) => {
150
- addVariant('ltr', () => {
151
- log.warn('rtl-experimental', [
152
- 'The RTL features in Tailwind CSS are currently in preview.',
153
- 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
154
- ])
155
-
156
- return '[dir="ltr"] &'
157
- })
158
-
159
- addVariant('rtl', () => {
160
- log.warn('rtl-experimental', [
161
- 'The RTL features in Tailwind CSS are currently in preview.',
162
- 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
163
- ])
164
-
165
- return '[dir="rtl"] &'
166
- })
201
+ addVariant('ltr', ':is([dir="ltr"] &)')
202
+ addVariant('rtl', ':is([dir="rtl"] &)')
167
203
  },
168
204
 
169
205
  reducedMotionVariants: ({ addVariant }) => {
@@ -184,7 +220,7 @@ export let variantPlugins = {
184
220
  }
185
221
 
186
222
  if (mode === 'class') {
187
- addVariant('dark', `${className} &`)
223
+ addVariant('dark', `:is(${className} &)`)
188
224
  } else if (mode === 'media') {
189
225
  addVariant('dark', '@media (prefers-color-scheme: dark)')
190
226
  }
@@ -194,18 +230,231 @@ export let variantPlugins = {
194
230
  addVariant('print', '@media print')
195
231
  },
196
232
 
197
- screenVariants: ({ theme, addVariant }) => {
198
- for (let screen of normalizeScreens(theme('screens'))) {
199
- let query = buildMediaQuery(screen)
233
+ screenVariants: ({ theme, addVariant, matchVariant }) => {
234
+ let rawScreens = theme('screens') ?? {}
235
+ let areSimpleScreens = Object.values(rawScreens).every((v) => typeof v === 'string')
236
+ let screens = normalizeScreens(theme('screens'))
237
+
238
+ /** @type {Set<string>} */
239
+ let unitCache = new Set([])
200
240
 
201
- addVariant(screen.name, `@media ${query}`)
241
+ /** @param {string} value */
242
+ function units(value) {
243
+ return value.match(/(\D+)$/)?.[1] ?? '(none)'
244
+ }
245
+
246
+ /** @param {string} value */
247
+ function recordUnits(value) {
248
+ if (value !== undefined) {
249
+ unitCache.add(units(value))
250
+ }
251
+ }
252
+
253
+ /** @param {string} value */
254
+ function canUseUnits(value) {
255
+ recordUnits(value)
256
+
257
+ // If the cache was empty it'll become 1 because we've just added the current unit
258
+ // If the cache was not empty and the units are the same the size doesn't change
259
+ // Otherwise, if the units are different from what is already known the size will always be > 1
260
+ return unitCache.size === 1
261
+ }
262
+
263
+ for (const screen of screens) {
264
+ for (const value of screen.values) {
265
+ recordUnits(value.min)
266
+ recordUnits(value.max)
267
+ }
268
+ }
269
+
270
+ let screensUseConsistentUnits = unitCache.size <= 1
271
+
272
+ /**
273
+ * @typedef {import('./util/normalizeScreens').Screen} Screen
274
+ */
275
+
276
+ /**
277
+ * @param {'min' | 'max'} type
278
+ * @returns {Record<string, Screen>}
279
+ */
280
+ function buildScreenValues(type) {
281
+ return Object.fromEntries(
282
+ screens
283
+ .filter((screen) => isScreenSortable(screen).result)
284
+ .map((screen) => {
285
+ let { min, max } = screen.values[0]
286
+
287
+ if (type === 'min' && min !== undefined) {
288
+ return screen
289
+ } else if (type === 'min' && max !== undefined) {
290
+ return { ...screen, not: !screen.not }
291
+ } else if (type === 'max' && max !== undefined) {
292
+ return screen
293
+ } else if (type === 'max' && min !== undefined) {
294
+ return { ...screen, not: !screen.not }
295
+ }
296
+ })
297
+ .map((screen) => [screen.name, screen])
298
+ )
299
+ }
300
+
301
+ /**
302
+ * @param {'min' | 'max'} type
303
+ * @returns {(a: { value: string | Screen }, z: { value: string | Screen }) => number}
304
+ */
305
+ function buildSort(type) {
306
+ return (a, z) => compareScreens(type, a.value, z.value)
307
+ }
308
+
309
+ let maxSort = buildSort('max')
310
+ let minSort = buildSort('min')
311
+
312
+ /** @param {'min'|'max'} type */
313
+ function buildScreenVariant(type) {
314
+ return (value) => {
315
+ if (!areSimpleScreens) {
316
+ log.warn('complex-screen-config', [
317
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing objects.',
318
+ ])
319
+
320
+ return []
321
+ } else if (!screensUseConsistentUnits) {
322
+ log.warn('mixed-screen-units', [
323
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
324
+ ])
325
+
326
+ return []
327
+ } else if (typeof value === 'string' && !canUseUnits(value)) {
328
+ log.warn('minmax-have-mixed-units', [
329
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
330
+ ])
331
+
332
+ return []
333
+ }
334
+
335
+ return [`@media ${buildMediaQuery(toScreen(value, type))}`]
336
+ }
202
337
  }
338
+
339
+ matchVariant('max', buildScreenVariant('max'), {
340
+ sort: maxSort,
341
+ values: areSimpleScreens ? buildScreenValues('max') : {},
342
+ })
343
+
344
+ // screens and min-* are sorted together when they can be
345
+ let id = 'min-screens'
346
+ for (let screen of screens) {
347
+ addVariant(screen.name, `@media ${buildMediaQuery(screen)}`, {
348
+ id,
349
+ sort: areSimpleScreens && screensUseConsistentUnits ? minSort : undefined,
350
+ value: screen,
351
+ })
352
+ }
353
+
354
+ matchVariant('min', buildScreenVariant('min'), {
355
+ id,
356
+ sort: minSort,
357
+ })
358
+ },
359
+
360
+ supportsVariants: ({ matchVariant, theme }) => {
361
+ matchVariant(
362
+ 'supports',
363
+ (value = '') => {
364
+ let check = normalize(value)
365
+ let isRaw = /^\w*\s*\(/.test(check)
366
+
367
+ // Chrome has a bug where `(condtion1)or(condition2)` is not valid
368
+ // But `(condition1) or (condition2)` is supported.
369
+ check = isRaw ? check.replace(/\b(and|or|not)\b/g, ' $1 ') : check
370
+
371
+ if (isRaw) {
372
+ return `@supports ${check}`
373
+ }
374
+
375
+ if (!check.includes(':')) {
376
+ check = `${check}: var(--tw)`
377
+ }
378
+
379
+ if (!(check.startsWith('(') && check.endsWith(')'))) {
380
+ check = `(${check})`
381
+ }
382
+
383
+ return `@supports ${check}`
384
+ },
385
+ { values: theme('supports') ?? {} }
386
+ )
387
+ },
388
+
389
+ hasVariants: ({ matchVariant }) => {
390
+ matchVariant('has', (value) => `&:has(${normalize(value)})`, { values: {} })
391
+ matchVariant(
392
+ 'group-has',
393
+ (value, { modifier }) =>
394
+ modifier
395
+ ? `:merge(.group\\/${modifier}):has(${normalize(value)}) &`
396
+ : `:merge(.group):has(${normalize(value)}) &`,
397
+ { values: {} }
398
+ )
399
+ matchVariant(
400
+ 'peer-has',
401
+ (value, { modifier }) =>
402
+ modifier
403
+ ? `:merge(.peer\\/${modifier}):has(${normalize(value)}) ~ &`
404
+ : `:merge(.peer):has(${normalize(value)}) ~ &`,
405
+ { values: {} }
406
+ )
407
+ },
408
+
409
+ ariaVariants: ({ matchVariant, theme }) => {
410
+ matchVariant('aria', (value) => `&[aria-${normalize(value)}]`, { values: theme('aria') ?? {} })
411
+ matchVariant(
412
+ 'group-aria',
413
+ (value, { modifier }) =>
414
+ modifier
415
+ ? `:merge(.group\\/${modifier})[aria-${normalize(value)}] &`
416
+ : `:merge(.group)[aria-${normalize(value)}] &`,
417
+ { values: theme('aria') ?? {} }
418
+ )
419
+ matchVariant(
420
+ 'peer-aria',
421
+ (value, { modifier }) =>
422
+ modifier
423
+ ? `:merge(.peer\\/${modifier})[aria-${normalize(value)}] ~ &`
424
+ : `:merge(.peer)[aria-${normalize(value)}] ~ &`,
425
+ { values: theme('aria') ?? {} }
426
+ )
427
+ },
428
+
429
+ dataVariants: ({ matchVariant, theme }) => {
430
+ matchVariant('data', (value) => `&[data-${normalize(value)}]`, { values: theme('data') ?? {} })
431
+ matchVariant(
432
+ 'group-data',
433
+ (value, { modifier }) =>
434
+ modifier
435
+ ? `:merge(.group\\/${modifier})[data-${normalize(value)}] &`
436
+ : `:merge(.group)[data-${normalize(value)}] &`,
437
+ { values: theme('data') ?? {} }
438
+ )
439
+ matchVariant(
440
+ 'peer-data',
441
+ (value, { modifier }) =>
442
+ modifier
443
+ ? `:merge(.peer\\/${modifier})[data-${normalize(value)}] ~ &`
444
+ : `:merge(.peer)[data-${normalize(value)}] ~ &`,
445
+ { values: theme('data') ?? {} }
446
+ )
203
447
  },
204
448
 
205
449
  orientationVariants: ({ addVariant }) => {
206
450
  addVariant('portrait', '@media (orientation: portrait)')
207
451
  addVariant('landscape', '@media (orientation: landscape)')
208
452
  },
453
+
454
+ prefersContrastVariants: ({ addVariant }) => {
455
+ addVariant('contrast-more', '@media (prefers-contrast: more)')
456
+ addVariant('contrast-less', '@media (prefers-contrast: less)')
457
+ },
209
458
  }
210
459
 
211
460
  let cssTransformValue = [
@@ -379,6 +628,7 @@ export let corePlugins = {
379
628
  addUtilities({
380
629
  '.visible': { visibility: 'visible' },
381
630
  '.invisible': { visibility: 'hidden' },
631
+ '.collapse': { visibility: 'collapse' },
382
632
  })
383
633
  },
384
634
 
@@ -395,12 +645,14 @@ export let corePlugins = {
395
645
  inset: createUtilityPlugin(
396
646
  'inset',
397
647
  [
398
- ['inset', ['top', 'right', 'bottom', 'left']],
648
+ ['inset', ['inset']],
399
649
  [
400
650
  ['inset-x', ['left', 'right']],
401
651
  ['inset-y', ['top', 'bottom']],
402
652
  ],
403
653
  [
654
+ ['start', ['inset-inline-start']],
655
+ ['end', ['inset-inline-end']],
404
656
  ['top', ['top']],
405
657
  ['right', ['right']],
406
658
  ['bottom', ['bottom']],
@@ -452,6 +704,8 @@ export let corePlugins = {
452
704
  ['my', ['margin-top', 'margin-bottom']],
453
705
  ],
454
706
  [
707
+ ['ms', ['margin-inline-start']],
708
+ ['me', ['margin-inline-end']],
455
709
  ['mt', ['margin-top']],
456
710
  ['mr', ['margin-right']],
457
711
  ['mb', ['margin-bottom']],
@@ -468,6 +722,29 @@ export let corePlugins = {
468
722
  })
469
723
  },
470
724
 
725
+ lineClamp: ({ matchUtilities, addUtilities, theme }) => {
726
+ matchUtilities(
727
+ {
728
+ 'line-clamp': (value) => ({
729
+ overflow: 'hidden',
730
+ display: '-webkit-box',
731
+ '-webkit-box-orient': 'vertical',
732
+ '-webkit-line-clamp': `${value}`,
733
+ }),
734
+ },
735
+ { values: theme('lineClamp') }
736
+ )
737
+
738
+ addUtilities({
739
+ '.line-clamp-none': {
740
+ overflow: 'visible',
741
+ display: 'block',
742
+ '-webkit-box-orient': 'horizontal',
743
+ '-webkit-line-clamp': 'none',
744
+ },
745
+ })
746
+ },
747
+
471
748
  display: ({ addUtilities }) => {
472
749
  addUtilities({
473
750
  '.block': { display: 'block' },
@@ -522,6 +799,13 @@ export let corePlugins = {
522
799
  })
523
800
  },
524
801
 
802
+ captionSide: ({ addUtilities }) => {
803
+ addUtilities({
804
+ '.caption-top': { 'caption-side': 'top' },
805
+ '.caption-bottom': { 'caption-side': 'bottom' },
806
+ })
807
+ },
808
+
525
809
  borderCollapse: ({ addUtilities }) => {
526
810
  addUtilities({
527
811
  '.border-collapse': { 'border-collapse': 'collapse' },
@@ -529,6 +813,41 @@ export let corePlugins = {
529
813
  })
530
814
  },
531
815
 
816
+ borderSpacing: ({ addDefaults, matchUtilities, theme }) => {
817
+ addDefaults('border-spacing', {
818
+ '--tw-border-spacing-x': 0,
819
+ '--tw-border-spacing-y': 0,
820
+ })
821
+
822
+ matchUtilities(
823
+ {
824
+ 'border-spacing': (value) => {
825
+ return {
826
+ '--tw-border-spacing-x': value,
827
+ '--tw-border-spacing-y': value,
828
+ '@defaults border-spacing': {},
829
+ 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
830
+ }
831
+ },
832
+ 'border-spacing-x': (value) => {
833
+ return {
834
+ '--tw-border-spacing-x': value,
835
+ '@defaults border-spacing': {},
836
+ 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
837
+ }
838
+ },
839
+ 'border-spacing-y': (value) => {
840
+ return {
841
+ '--tw-border-spacing-y': value,
842
+ '@defaults border-spacing': {},
843
+ 'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)',
844
+ }
845
+ },
846
+ },
847
+ { values: theme('borderSpacing') }
848
+ )
849
+ },
850
+
532
851
  transformOrigin: createUtilityPlugin('transformOrigin', [['origin', ['transformOrigin']]]),
533
852
  translate: createUtilityPlugin(
534
853
  'translate',
@@ -765,6 +1084,8 @@ export let corePlugins = {
765
1084
  ['scroll-my', ['scroll-margin-top', 'scroll-margin-bottom']],
766
1085
  ],
767
1086
  [
1087
+ ['scroll-ms', ['scroll-margin-inline-start']],
1088
+ ['scroll-me', ['scroll-margin-inline-end']],
768
1089
  ['scroll-mt', ['scroll-margin-top']],
769
1090
  ['scroll-mr', ['scroll-margin-right']],
770
1091
  ['scroll-mb', ['scroll-margin-bottom']],
@@ -781,6 +1102,8 @@ export let corePlugins = {
781
1102
  ['scroll-py', ['scroll-padding-top', 'scroll-padding-bottom']],
782
1103
  ],
783
1104
  [
1105
+ ['scroll-ps', ['scroll-padding-inline-start']],
1106
+ ['scroll-pe', ['scroll-padding-inline-end']],
784
1107
  ['scroll-pt', ['scroll-padding-top']],
785
1108
  ['scroll-pr', ['scroll-padding-right']],
786
1109
  ['scroll-pb', ['scroll-padding-bottom']],
@@ -794,8 +1117,8 @@ export let corePlugins = {
794
1117
  '.list-outside': { 'list-style-position': 'outside' },
795
1118
  })
796
1119
  },
797
-
798
1120
  listStyleType: createUtilityPlugin('listStyleType', [['list', ['listStyleType']]]),
1121
+ listStyleImage: createUtilityPlugin('listStyleImage', [['list-image', ['listStyleImage']]]),
799
1122
 
800
1123
  appearance: ({ addUtilities }) => {
801
1124
  addUtilities({
@@ -846,6 +1169,7 @@ export let corePlugins = {
846
1169
  addUtilities({
847
1170
  '.grid-flow-row': { gridAutoFlow: 'row' },
848
1171
  '.grid-flow-col': { gridAutoFlow: 'column' },
1172
+ '.grid-flow-dense': { gridAutoFlow: 'dense' },
849
1173
  '.grid-flow-row-dense': { gridAutoFlow: 'row dense' },
850
1174
  '.grid-flow-col-dense': { gridAutoFlow: 'column dense' },
851
1175
  })
@@ -882,6 +1206,7 @@ export let corePlugins = {
882
1206
  '.place-content-between': { 'place-content': 'space-between' },
883
1207
  '.place-content-around': { 'place-content': 'space-around' },
884
1208
  '.place-content-evenly': { 'place-content': 'space-evenly' },
1209
+ '.place-content-baseline': { 'place-content': 'baseline' },
885
1210
  '.place-content-stretch': { 'place-content': 'stretch' },
886
1211
  })
887
1212
  },
@@ -891,18 +1216,22 @@ export let corePlugins = {
891
1216
  '.place-items-start': { 'place-items': 'start' },
892
1217
  '.place-items-end': { 'place-items': 'end' },
893
1218
  '.place-items-center': { 'place-items': 'center' },
1219
+ '.place-items-baseline': { 'place-items': 'baseline' },
894
1220
  '.place-items-stretch': { 'place-items': 'stretch' },
895
1221
  })
896
1222
  },
897
1223
 
898
1224
  alignContent: ({ addUtilities }) => {
899
1225
  addUtilities({
1226
+ '.content-normal': { 'align-content': 'normal' },
900
1227
  '.content-center': { 'align-content': 'center' },
901
1228
  '.content-start': { 'align-content': 'flex-start' },
902
1229
  '.content-end': { 'align-content': 'flex-end' },
903
1230
  '.content-between': { 'align-content': 'space-between' },
904
1231
  '.content-around': { 'align-content': 'space-around' },
905
1232
  '.content-evenly': { 'align-content': 'space-evenly' },
1233
+ '.content-baseline': { 'align-content': 'baseline' },
1234
+ '.content-stretch': { 'align-content': 'stretch' },
906
1235
  })
907
1236
  },
908
1237
 
@@ -918,12 +1247,14 @@ export let corePlugins = {
918
1247
 
919
1248
  justifyContent: ({ addUtilities }) => {
920
1249
  addUtilities({
1250
+ '.justify-normal': { 'justify-content': 'normal' },
921
1251
  '.justify-start': { 'justify-content': 'flex-start' },
922
1252
  '.justify-end': { 'justify-content': 'flex-end' },
923
1253
  '.justify-center': { 'justify-content': 'center' },
924
1254
  '.justify-between': { 'justify-content': 'space-between' },
925
1255
  '.justify-around': { 'justify-content': 'space-around' },
926
1256
  '.justify-evenly': { 'justify-content': 'space-evenly' },
1257
+ '.justify-stretch': { 'justify-content': 'stretch' },
927
1258
  })
928
1259
  },
929
1260
 
@@ -944,12 +1275,22 @@ export let corePlugins = {
944
1275
  ],
945
1276
  ]),
946
1277
 
947
- space: ({ matchUtilities, addUtilities, theme }) => {
1278
+ space: ({ matchUtilities, addUtilities, theme, config }) => {
948
1279
  matchUtilities(
949
1280
  {
950
1281
  'space-x': (value) => {
951
1282
  value = value === '0' ? '0px' : value
952
1283
 
1284
+ if (flagEnabled(config(), 'logicalSiblingUtilities')) {
1285
+ return {
1286
+ '& > :not([hidden]) ~ :not([hidden])': {
1287
+ '--tw-space-x-reverse': '0',
1288
+ 'margin-inline-end': `calc(${value} * var(--tw-space-x-reverse))`,
1289
+ 'margin-inline-start': `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`,
1290
+ },
1291
+ }
1292
+ }
1293
+
953
1294
  return {
954
1295
  '& > :not([hidden]) ~ :not([hidden])': {
955
1296
  '--tw-space-x-reverse': '0',
@@ -979,12 +1320,23 @@ export let corePlugins = {
979
1320
  })
980
1321
  },
981
1322
 
982
- divideWidth: ({ matchUtilities, addUtilities, theme }) => {
1323
+ divideWidth: ({ matchUtilities, addUtilities, theme, config }) => {
983
1324
  matchUtilities(
984
1325
  {
985
1326
  'divide-x': (value) => {
986
1327
  value = value === '0' ? '0px' : value
987
1328
 
1329
+ if (flagEnabled(config(), 'logicalSiblingUtilities')) {
1330
+ return {
1331
+ '& > :not([hidden]) ~ :not([hidden])': {
1332
+ '@defaults border-width': {},
1333
+ '--tw-divide-x-reverse': '0',
1334
+ 'border-inline-end-width': `calc(${value} * var(--tw-divide-x-reverse))`,
1335
+ 'border-inline-start-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
1336
+ },
1337
+ }
1338
+ }
1339
+
988
1340
  return {
989
1341
  '& > :not([hidden]) ~ :not([hidden])': {
990
1342
  '@defaults border-width': {},
@@ -1007,7 +1359,7 @@ export let corePlugins = {
1007
1359
  }
1008
1360
  },
1009
1361
  },
1010
- { values: theme('divideWidth'), type: ['line-width', 'length'] }
1362
+ { values: theme('divideWidth'), type: ['line-width', 'length', 'any'] }
1011
1363
  )
1012
1364
 
1013
1365
  addUtilities({
@@ -1055,7 +1407,7 @@ export let corePlugins = {
1055
1407
  },
1056
1408
  {
1057
1409
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('divideColor'))),
1058
- type: 'color',
1410
+ type: ['color', 'any'],
1059
1411
  }
1060
1412
  )
1061
1413
  },
@@ -1152,6 +1504,14 @@ export let corePlugins = {
1152
1504
  })
1153
1505
  },
1154
1506
 
1507
+ hyphens: ({ addUtilities }) => {
1508
+ addUtilities({
1509
+ '.hyphens-none': { hyphens: 'none' },
1510
+ '.hyphens-manual': { hyphens: 'manual' },
1511
+ '.hyphens-auto': { hyphens: 'auto' },
1512
+ })
1513
+ },
1514
+
1155
1515
  whitespace: ({ addUtilities }) => {
1156
1516
  addUtilities({
1157
1517
  '.whitespace-normal': { 'white-space': 'normal' },
@@ -1159,6 +1519,15 @@ export let corePlugins = {
1159
1519
  '.whitespace-pre': { 'white-space': 'pre' },
1160
1520
  '.whitespace-pre-line': { 'white-space': 'pre-line' },
1161
1521
  '.whitespace-pre-wrap': { 'white-space': 'pre-wrap' },
1522
+ '.whitespace-break-spaces': { 'white-space': 'break-spaces' },
1523
+ })
1524
+ },
1525
+
1526
+ textWrap: ({ addUtilities }) => {
1527
+ addUtilities({
1528
+ '.text-wrap': { 'text-wrap': 'wrap' },
1529
+ '.text-nowrap': { 'text-wrap': 'nowrap' },
1530
+ '.text-balance': { 'text-wrap': 'balance' },
1162
1531
  })
1163
1532
  },
1164
1533
 
@@ -1167,18 +1536,25 @@ export let corePlugins = {
1167
1536
  '.break-normal': { 'overflow-wrap': 'normal', 'word-break': 'normal' },
1168
1537
  '.break-words': { 'overflow-wrap': 'break-word' },
1169
1538
  '.break-all': { 'word-break': 'break-all' },
1539
+ '.break-keep': { 'word-break': 'keep-all' },
1170
1540
  })
1171
1541
  },
1172
1542
 
1173
1543
  borderRadius: createUtilityPlugin('borderRadius', [
1174
1544
  ['rounded', ['border-radius']],
1175
1545
  [
1546
+ ['rounded-s', ['border-start-start-radius', 'border-end-start-radius']],
1547
+ ['rounded-e', ['border-start-end-radius', 'border-end-end-radius']],
1176
1548
  ['rounded-t', ['border-top-left-radius', 'border-top-right-radius']],
1177
1549
  ['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']],
1178
1550
  ['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']],
1179
1551
  ['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']],
1180
1552
  ],
1181
1553
  [
1554
+ ['rounded-ss', ['border-start-start-radius']],
1555
+ ['rounded-se', ['border-start-end-radius']],
1556
+ ['rounded-ee', ['border-end-end-radius']],
1557
+ ['rounded-es', ['border-end-start-radius']],
1182
1558
  ['rounded-tl', ['border-top-left-radius']],
1183
1559
  ['rounded-tr', ['border-top-right-radius']],
1184
1560
  ['rounded-br', ['border-bottom-right-radius']],
@@ -1195,6 +1571,8 @@ export let corePlugins = {
1195
1571
  ['border-y', [['@defaults border-width', {}], 'border-top-width', 'border-bottom-width']],
1196
1572
  ],
1197
1573
  [
1574
+ ['border-s', [['@defaults border-width', {}], 'border-inline-start-width']],
1575
+ ['border-e', [['@defaults border-width', {}], 'border-inline-end-width']],
1198
1576
  ['border-t', [['@defaults border-width', {}], 'border-top-width']],
1199
1577
  ['border-r', [['@defaults border-width', {}], 'border-right-width']],
1200
1578
  ['border-b', [['@defaults border-width', {}], 'border-bottom-width']],
@@ -1234,7 +1612,7 @@ export let corePlugins = {
1234
1612
  },
1235
1613
  {
1236
1614
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1237
- type: ['color'],
1615
+ type: ['color', 'any'],
1238
1616
  }
1239
1617
  )
1240
1618
 
@@ -1271,12 +1649,38 @@ export let corePlugins = {
1271
1649
  },
1272
1650
  {
1273
1651
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1274
- type: 'color',
1652
+ type: ['color', 'any'],
1275
1653
  }
1276
1654
  )
1277
1655
 
1278
1656
  matchUtilities(
1279
1657
  {
1658
+ 'border-s': (value) => {
1659
+ if (!corePlugins('borderOpacity')) {
1660
+ return {
1661
+ 'border-inline-start-color': toColorValue(value),
1662
+ }
1663
+ }
1664
+
1665
+ return withAlphaVariable({
1666
+ color: value,
1667
+ property: 'border-inline-start-color',
1668
+ variable: '--tw-border-opacity',
1669
+ })
1670
+ },
1671
+ 'border-e': (value) => {
1672
+ if (!corePlugins('borderOpacity')) {
1673
+ return {
1674
+ 'border-inline-end-color': toColorValue(value),
1675
+ }
1676
+ }
1677
+
1678
+ return withAlphaVariable({
1679
+ color: value,
1680
+ property: 'border-inline-end-color',
1681
+ variable: '--tw-border-opacity',
1682
+ })
1683
+ },
1280
1684
  'border-t': (value) => {
1281
1685
  if (!corePlugins('borderOpacity')) {
1282
1686
  return {
@@ -1332,7 +1736,7 @@ export let corePlugins = {
1332
1736
  },
1333
1737
  {
1334
1738
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1335
- type: 'color',
1739
+ type: ['color', 'any'],
1336
1740
  }
1337
1741
  )
1338
1742
  },
@@ -1358,7 +1762,7 @@ export let corePlugins = {
1358
1762
  })
1359
1763
  },
1360
1764
  },
1361
- { values: flattenColorPalette(theme('backgroundColor')), type: 'color' }
1765
+ { values: flattenColorPalette(theme('backgroundColor')), type: ['color', 'any'] }
1362
1766
  )
1363
1767
  },
1364
1768
 
@@ -1373,44 +1777,98 @@ export let corePlugins = {
1373
1777
  return withAlphaValue(value, 0, 'rgb(255 255 255 / 0)')
1374
1778
  }
1375
1779
 
1376
- return function ({ matchUtilities, theme }) {
1780
+ return function ({ matchUtilities, theme, addDefaults }) {
1781
+ addDefaults('gradient-color-stops', {
1782
+ '--tw-gradient-from-position': ' ',
1783
+ '--tw-gradient-via-position': ' ',
1784
+ '--tw-gradient-to-position': ' ',
1785
+ })
1786
+
1377
1787
  let options = {
1378
1788
  values: flattenColorPalette(theme('gradientColorStops')),
1379
1789
  type: ['color', 'any'],
1380
1790
  }
1381
1791
 
1792
+ let positionOptions = {
1793
+ values: theme('gradientColorStopPositions'),
1794
+ type: ['length', 'percentage'],
1795
+ }
1796
+
1382
1797
  matchUtilities(
1383
1798
  {
1384
1799
  from: (value) => {
1385
1800
  let transparentToValue = transparentTo(value)
1386
1801
 
1387
1802
  return {
1388
- '--tw-gradient-from': toColorValue(value, 'from'),
1389
- '--tw-gradient-stops': `var(--tw-gradient-from), var(--tw-gradient-to, ${transparentToValue})`,
1803
+ '@defaults gradient-color-stops': {},
1804
+ '--tw-gradient-from': `${toColorValue(value)} var(--tw-gradient-from-position)`,
1805
+ '--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
1806
+ '--tw-gradient-stops': `var(--tw-gradient-from), var(--tw-gradient-to)`,
1390
1807
  }
1391
1808
  },
1392
1809
  },
1393
1810
  options
1394
1811
  )
1812
+
1813
+ matchUtilities(
1814
+ {
1815
+ from: (value) => {
1816
+ return {
1817
+ '--tw-gradient-from-position': value,
1818
+ }
1819
+ },
1820
+ },
1821
+ positionOptions
1822
+ )
1823
+
1395
1824
  matchUtilities(
1396
1825
  {
1397
1826
  via: (value) => {
1398
1827
  let transparentToValue = transparentTo(value)
1399
1828
 
1400
1829
  return {
1830
+ '@defaults gradient-color-stops': {},
1831
+ '--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
1401
1832
  '--tw-gradient-stops': `var(--tw-gradient-from), ${toColorValue(
1402
- value,
1403
- 'via'
1404
- )}, var(--tw-gradient-to, ${transparentToValue})`,
1833
+ value
1834
+ )} var(--tw-gradient-via-position), var(--tw-gradient-to)`,
1405
1835
  }
1406
1836
  },
1407
1837
  },
1408
1838
  options
1409
1839
  )
1840
+
1410
1841
  matchUtilities(
1411
- { to: (value) => ({ '--tw-gradient-to': toColorValue(value, 'to') }) },
1842
+ {
1843
+ via: (value) => {
1844
+ return {
1845
+ '--tw-gradient-via-position': value,
1846
+ }
1847
+ },
1848
+ },
1849
+ positionOptions
1850
+ )
1851
+
1852
+ matchUtilities(
1853
+ {
1854
+ to: (value) => ({
1855
+ '@defaults gradient-color-stops': {},
1856
+ '--tw-gradient-to': `${toColorValue(value)} var(--tw-gradient-to-position)`,
1857
+ }),
1858
+ },
1412
1859
  options
1413
1860
  )
1861
+
1862
+ matchUtilities(
1863
+ {
1864
+ to: (value) => {
1865
+ return {
1866
+ '--tw-gradient-to-position': value,
1867
+ }
1868
+ },
1869
+ },
1870
+ positionOptions
1871
+ )
1414
1872
  }
1415
1873
  })(),
1416
1874
 
@@ -1424,7 +1882,7 @@ export let corePlugins = {
1424
1882
  },
1425
1883
 
1426
1884
  backgroundSize: createUtilityPlugin('backgroundSize', [['bg', ['background-size']]], {
1427
- type: ['lookup', 'length', 'percentage'],
1885
+ type: ['lookup', 'length', 'percentage', 'size'],
1428
1886
  }),
1429
1887
 
1430
1888
  backgroundAttachment: ({ addUtilities }) => {
@@ -1445,7 +1903,7 @@ export let corePlugins = {
1445
1903
  },
1446
1904
 
1447
1905
  backgroundPosition: createUtilityPlugin('backgroundPosition', [['bg', ['background-position']]], {
1448
- type: ['lookup', 'position'],
1906
+ type: ['lookup', ['position', { preferOnConflict: true }]],
1449
1907
  }),
1450
1908
 
1451
1909
  backgroundRepeat: ({ addUtilities }) => {
@@ -1485,7 +1943,7 @@ export let corePlugins = {
1485
1943
  return { stroke: toColorValue(value) }
1486
1944
  },
1487
1945
  },
1488
- { values: flattenColorPalette(theme('stroke')), type: ['color', 'url'] }
1946
+ { values: flattenColorPalette(theme('stroke')), type: ['color', 'url', 'any'] }
1489
1947
  )
1490
1948
  },
1491
1949
 
@@ -1511,6 +1969,8 @@ export let corePlugins = {
1511
1969
  ['py', ['padding-top', 'padding-bottom']],
1512
1970
  ],
1513
1971
  [
1972
+ ['ps', ['padding-inline-start']],
1973
+ ['pe', ['padding-inline-end']],
1514
1974
  ['pt', ['padding-top']],
1515
1975
  ['pr', ['padding-right']],
1516
1976
  ['pb', ['padding-bottom']],
@@ -1548,16 +2008,46 @@ export let corePlugins = {
1548
2008
  matchUtilities({ align: (value) => ({ 'vertical-align': value }) })
1549
2009
  },
1550
2010
 
1551
- fontFamily: createUtilityPlugin('fontFamily', [['font', ['fontFamily']]], {
1552
- type: ['lookup', 'generic-name', 'family-name'],
1553
- }),
2011
+ fontFamily: ({ matchUtilities, theme }) => {
2012
+ matchUtilities(
2013
+ {
2014
+ font: (value) => {
2015
+ let [families, options = {}] =
2016
+ Array.isArray(value) && isPlainObject(value[1]) ? value : [value]
2017
+ let { fontFeatureSettings, fontVariationSettings } = options
2018
+
2019
+ return {
2020
+ 'font-family': Array.isArray(families) ? families.join(', ') : families,
2021
+ ...(fontFeatureSettings === undefined
2022
+ ? {}
2023
+ : { 'font-feature-settings': fontFeatureSettings }),
2024
+ ...(fontVariationSettings === undefined
2025
+ ? {}
2026
+ : { 'font-variation-settings': fontVariationSettings }),
2027
+ }
2028
+ },
2029
+ },
2030
+ {
2031
+ values: theme('fontFamily'),
2032
+ type: ['lookup', 'generic-name', 'family-name'],
2033
+ }
2034
+ )
2035
+ },
1554
2036
 
1555
2037
  fontSize: ({ matchUtilities, theme }) => {
1556
2038
  matchUtilities(
1557
2039
  {
1558
- text: (value) => {
2040
+ text: (value, { modifier }) => {
1559
2041
  let [fontSize, options] = Array.isArray(value) ? value : [value]
1560
- let { lineHeight, letterSpacing } = isPlainObject(options)
2042
+
2043
+ if (modifier) {
2044
+ return {
2045
+ 'font-size': fontSize,
2046
+ 'line-height': modifier,
2047
+ }
2048
+ }
2049
+
2050
+ let { lineHeight, letterSpacing, fontWeight } = isPlainObject(options)
1561
2051
  ? options
1562
2052
  : { lineHeight: options }
1563
2053
 
@@ -1565,18 +2055,20 @@ export let corePlugins = {
1565
2055
  'font-size': fontSize,
1566
2056
  ...(lineHeight === undefined ? {} : { 'line-height': lineHeight }),
1567
2057
  ...(letterSpacing === undefined ? {} : { 'letter-spacing': letterSpacing }),
2058
+ ...(fontWeight === undefined ? {} : { 'font-weight': fontWeight }),
1568
2059
  }
1569
2060
  },
1570
2061
  },
1571
2062
  {
1572
2063
  values: theme('fontSize'),
2064
+ modifiers: theme('lineHeight'),
1573
2065
  type: ['absolute-size', 'relative-size', 'length', 'percentage'],
1574
2066
  }
1575
2067
  )
1576
2068
  },
1577
2069
 
1578
2070
  fontWeight: createUtilityPlugin('fontWeight', [['font', ['fontWeight']]], {
1579
- type: ['lookup', 'number'],
2071
+ type: ['lookup', 'number', 'any'],
1580
2072
  }),
1581
2073
 
1582
2074
  textTransform: ({ addUtilities }) => {
@@ -1672,7 +2164,7 @@ export let corePlugins = {
1672
2164
  })
1673
2165
  },
1674
2166
  },
1675
- { values: flattenColorPalette(theme('textColor')), type: 'color' }
2167
+ { values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
1676
2168
  )
1677
2169
  },
1678
2170
 
@@ -1694,7 +2186,7 @@ export let corePlugins = {
1694
2186
  return { 'text-decoration-color': toColorValue(value) }
1695
2187
  },
1696
2188
  },
1697
- { values: flattenColorPalette(theme('textDecorationColor')), type: ['color'] }
2189
+ { values: flattenColorPalette(theme('textDecorationColor')), type: ['color', 'any'] }
1698
2190
  )
1699
2191
  },
1700
2192
 
@@ -1717,7 +2209,7 @@ export let corePlugins = {
1717
2209
  textUnderlineOffset: createUtilityPlugin(
1718
2210
  'textUnderlineOffset',
1719
2211
  [['underline-offset', ['text-underline-offset']]],
1720
- { type: ['length', 'percentage'] }
2212
+ { type: ['length', 'percentage', 'any'] }
1721
2213
  ),
1722
2214
 
1723
2215
  fontSmoothing: ({ addUtilities }) => {
@@ -1832,6 +2324,7 @@ export let corePlugins = {
1832
2324
  '.mix-blend-saturation': { 'mix-blend-mode': 'saturation' },
1833
2325
  '.mix-blend-color': { 'mix-blend-mode': 'color' },
1834
2326
  '.mix-blend-luminosity': { 'mix-blend-mode': 'luminosity' },
2327
+ '.mix-blend-plus-lighter': { 'mix-blend-mode': 'plus-lighter' },
1835
2328
  })
1836
2329
  },
1837
2330
 
@@ -1889,7 +2382,7 @@ export let corePlugins = {
1889
2382
  }
1890
2383
  },
1891
2384
  },
1892
- { values: flattenColorPalette(theme('boxShadowColor')), type: ['color'] }
2385
+ { values: flattenColorPalette(theme('boxShadowColor')), type: ['color', 'any'] }
1893
2386
  )
1894
2387
  },
1895
2388
 
@@ -1903,7 +2396,6 @@ export let corePlugins = {
1903
2396
  '.outline-dashed': { 'outline-style': 'dashed' },
1904
2397
  '.outline-dotted': { 'outline-style': 'dotted' },
1905
2398
  '.outline-double': { 'outline-style': 'double' },
1906
- '.outline-hidden': { 'outline-style': 'hidden' },
1907
2399
  })
1908
2400
  },
1909
2401
 
@@ -1912,7 +2404,8 @@ export let corePlugins = {
1912
2404
  }),
1913
2405
 
1914
2406
  outlineOffset: createUtilityPlugin('outlineOffset', [['outline-offset', ['outline-offset']]], {
1915
- type: ['length', 'number', 'percentage'],
2407
+ type: ['length', 'number', 'percentage', 'any'],
2408
+ supportsNegativeValues: true,
1916
2409
  }),
1917
2410
 
1918
2411
  outlineColor: ({ matchUtilities, theme }) => {
@@ -1922,17 +2415,28 @@ export let corePlugins = {
1922
2415
  return { 'outline-color': toColorValue(value) }
1923
2416
  },
1924
2417
  },
1925
- { values: flattenColorPalette(theme('outlineColor')), type: ['color'] }
2418
+ { values: flattenColorPalette(theme('outlineColor')), type: ['color', 'any'] }
1926
2419
  )
1927
2420
  },
1928
2421
 
1929
- ringWidth: ({ matchUtilities, addDefaults, addUtilities, theme }) => {
1930
- let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5')
1931
- let ringColorDefault = withAlphaValue(
1932
- theme('ringColor')?.DEFAULT,
1933
- ringOpacityDefault,
1934
- `rgb(147 197 253 / ${ringOpacityDefault})`
1935
- )
2422
+ ringWidth: ({ matchUtilities, addDefaults, addUtilities, theme, config }) => {
2423
+ let ringColorDefault = (() => {
2424
+ if (flagEnabled(config(), 'respectDefaultRingColorOpacity')) {
2425
+ return theme('ringColor.DEFAULT')
2426
+ }
2427
+
2428
+ let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5')
2429
+
2430
+ if (!theme('ringColor')?.DEFAULT) {
2431
+ return `rgb(147 197 253 / ${ringOpacityDefault})`
2432
+ }
2433
+
2434
+ return withAlphaValue(
2435
+ theme('ringColor')?.DEFAULT,
2436
+ ringOpacityDefault,
2437
+ `rgb(147 197 253 / ${ringOpacityDefault})`
2438
+ )
2439
+ })()
1936
2440
 
1937
2441
  addDefaults('ring-width', {
1938
2442
  '--tw-ring-inset': ' ',
@@ -1991,14 +2495,18 @@ export let corePlugins = {
1991
2495
  ([modifier]) => modifier !== 'DEFAULT'
1992
2496
  )
1993
2497
  ),
1994
- type: 'color',
2498
+ type: ['color', 'any'],
1995
2499
  }
1996
2500
  )
1997
2501
  },
1998
2502
 
1999
- ringOpacity: createUtilityPlugin('ringOpacity', [['ring-opacity', ['--tw-ring-opacity']]], {
2000
- filterDefault: true,
2001
- }),
2503
+ ringOpacity: (helpers) => {
2504
+ let { config } = helpers
2505
+
2506
+ return createUtilityPlugin('ringOpacity', [['ring-opacity', ['--tw-ring-opacity']]], {
2507
+ filterDefault: !flagEnabled(config(), 'respectDefaultRingColorOpacity'),
2508
+ })(helpers)
2509
+ },
2002
2510
  ringOffsetWidth: createUtilityPlugin(
2003
2511
  'ringOffsetWidth',
2004
2512
  [['ring-offset', ['--tw-ring-offset-width']]],
@@ -2014,7 +2522,7 @@ export let corePlugins = {
2014
2522
  }
2015
2523
  },
2016
2524
  },
2017
- { values: flattenColorPalette(theme('ringOffsetColor')), type: 'color' }
2525
+ { values: flattenColorPalette(theme('ringOffsetColor')), type: ['color', 'any'] }
2018
2526
  )
2019
2527
  },
2020
2528