tailwindcss 0.0.0-insiders.ea80db2 → 0.0.0-insiders.eae2b7a

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 (213) hide show
  1. package/README.md +13 -9
  2. package/defaultTheme.d.ts +2 -1
  3. package/index.css +5 -0
  4. package/lib/cli/build/index.js +57 -0
  5. package/lib/cli/build/plugin.js +427 -0
  6. package/lib/cli/build/utils.js +88 -0
  7. package/lib/cli/build/watching.js +182 -0
  8. package/lib/cli/help/index.js +73 -0
  9. package/lib/cli/index.js +231 -0
  10. package/lib/cli/init/index.js +63 -0
  11. package/lib/cli.js +1 -759
  12. package/lib/corePluginList.js +12 -3
  13. package/lib/corePlugins.js +2308 -1739
  14. package/lib/css/preflight.css +13 -5
  15. package/lib/featureFlags.js +50 -25
  16. package/lib/index.js +1 -40
  17. package/lib/lib/cacheInvalidation.js +48 -25
  18. package/lib/lib/collapseAdjacentRules.js +17 -10
  19. package/lib/lib/collapseDuplicateDeclarations.js +13 -8
  20. package/lib/lib/content.js +207 -0
  21. package/lib/lib/defaultExtractor.js +232 -33
  22. package/lib/lib/detectNesting.js +21 -10
  23. package/lib/lib/evaluateTailwindFunctions.js +117 -50
  24. package/lib/lib/expandApplyAtRules.js +316 -215
  25. package/lib/lib/expandTailwindAtRules.js +167 -115
  26. package/lib/lib/findAtConfigPath.js +46 -0
  27. package/lib/lib/generateRules.js +444 -211
  28. package/lib/lib/getModuleDependencies.js +88 -37
  29. package/lib/lib/handleImportAtRules.js +50 -0
  30. package/lib/lib/load-config.js +42 -0
  31. package/lib/lib/normalizeTailwindDirectives.js +29 -39
  32. package/lib/lib/offsets.js +306 -0
  33. package/lib/lib/partitionApplyAtRules.js +13 -8
  34. package/lib/lib/regex.js +74 -0
  35. package/lib/lib/remap-bitfield.js +89 -0
  36. package/lib/lib/resolveDefaultsAtRules.js +96 -74
  37. package/lib/lib/setupContextUtils.js +672 -300
  38. package/lib/lib/setupTrackingContext.js +63 -68
  39. package/lib/lib/sharedState.js +44 -17
  40. package/lib/lib/substituteScreenAtRules.js +14 -10
  41. package/lib/plugin.js +160 -0
  42. package/lib/postcss-plugins/nesting/README.md +2 -2
  43. package/lib/postcss-plugins/nesting/index.js +10 -6
  44. package/lib/postcss-plugins/nesting/plugin.js +24 -20
  45. package/lib/processTailwindFeatures.js +34 -29
  46. package/lib/public/colors.js +272 -246
  47. package/lib/public/create-plugin.js +9 -5
  48. package/lib/public/default-config.js +10 -6
  49. package/lib/public/default-theme.js +10 -6
  50. package/lib/public/load-config.js +12 -0
  51. package/lib/public/resolve-config.js +11 -6
  52. package/lib/util/applyImportantSelector.js +36 -0
  53. package/lib/util/bigSign.js +6 -1
  54. package/lib/util/buildMediaQuery.js +13 -6
  55. package/lib/util/cloneDeep.js +9 -6
  56. package/lib/util/cloneNodes.js +12 -3
  57. package/lib/util/color.js +66 -50
  58. package/lib/util/colorNames.js +752 -0
  59. package/lib/util/configurePlugins.js +7 -2
  60. package/lib/util/createPlugin.js +8 -5
  61. package/lib/util/createUtilityPlugin.js +13 -9
  62. package/lib/util/dataTypes.js +182 -111
  63. package/lib/util/defaults.js +12 -7
  64. package/lib/util/escapeClassName.js +13 -8
  65. package/lib/util/escapeCommas.js +7 -2
  66. package/lib/util/flattenColorPalette.js +11 -10
  67. package/lib/util/formatVariantSelector.js +228 -151
  68. package/lib/util/getAllConfigs.js +33 -12
  69. package/lib/util/hashConfig.js +9 -4
  70. package/lib/util/isKeyframeRule.js +7 -2
  71. package/lib/util/isPlainObject.js +7 -2
  72. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
  73. package/lib/util/log.js +40 -13
  74. package/lib/util/nameClass.js +27 -10
  75. package/lib/util/negateValue.js +25 -8
  76. package/lib/util/normalizeConfig.js +155 -87
  77. package/lib/util/normalizeScreens.js +127 -8
  78. package/lib/util/parseAnimationValue.js +44 -40
  79. package/lib/util/parseBoxShadowValue.js +33 -62
  80. package/lib/util/parseDependency.js +39 -55
  81. package/lib/util/parseGlob.js +36 -0
  82. package/lib/util/parseObjectStyles.js +15 -10
  83. package/lib/util/pluginUtils.js +154 -59
  84. package/lib/util/prefixSelector.js +29 -10
  85. package/lib/util/pseudoElements.js +209 -0
  86. package/lib/util/removeAlphaVariables.js +31 -0
  87. package/lib/util/resolveConfig.js +96 -95
  88. package/lib/util/resolveConfigPath.js +29 -10
  89. package/lib/util/responsive.js +11 -6
  90. package/lib/util/splitAtTopLevelOnly.js +51 -0
  91. package/lib/util/tap.js +6 -1
  92. package/lib/util/toColorValue.js +7 -2
  93. package/lib/util/toPath.js +22 -4
  94. package/lib/util/transformThemeValue.js +40 -26
  95. package/lib/util/validateConfig.js +48 -0
  96. package/lib/util/validateFormalSyntax.js +26 -0
  97. package/lib/util/withAlphaVariable.js +27 -15
  98. package/lib/value-parser/LICENSE +22 -0
  99. package/lib/value-parser/README.md +3 -0
  100. package/lib/value-parser/index.d.js +2 -0
  101. package/lib/value-parser/index.js +22 -0
  102. package/lib/value-parser/parse.js +259 -0
  103. package/lib/value-parser/stringify.js +38 -0
  104. package/lib/value-parser/unit.js +86 -0
  105. package/lib/value-parser/walk.js +16 -0
  106. package/loadConfig.d.ts +4 -0
  107. package/loadConfig.js +2 -0
  108. package/package.json +54 -52
  109. package/plugin.d.ts +10 -5
  110. package/resolveConfig.d.ts +12 -0
  111. package/scripts/generate-types.js +53 -0
  112. package/scripts/release-channel.js +18 -0
  113. package/scripts/release-notes.js +21 -0
  114. package/scripts/type-utils.js +27 -0
  115. package/src/cli/build/index.js +53 -0
  116. package/src/cli/build/plugin.js +465 -0
  117. package/src/cli/build/utils.js +76 -0
  118. package/src/cli/build/watching.js +229 -0
  119. package/src/cli/help/index.js +70 -0
  120. package/src/cli/index.js +217 -0
  121. package/src/cli/init/index.js +79 -0
  122. package/src/cli.js +1 -836
  123. package/src/corePluginList.js +1 -1
  124. package/src/corePlugins.js +576 -106
  125. package/src/css/preflight.css +13 -5
  126. package/src/featureFlags.js +17 -3
  127. package/src/index.js +1 -42
  128. package/src/lib/collapseAdjacentRules.js +5 -1
  129. package/src/lib/content.js +240 -0
  130. package/src/lib/defaultExtractor.js +202 -35
  131. package/src/lib/detectNesting.js +9 -1
  132. package/src/lib/evaluateTailwindFunctions.js +82 -8
  133. package/src/lib/expandApplyAtRules.js +322 -189
  134. package/src/lib/expandTailwindAtRules.js +82 -59
  135. package/src/lib/findAtConfigPath.js +48 -0
  136. package/src/lib/generateRules.js +413 -132
  137. package/src/lib/getModuleDependencies.js +70 -30
  138. package/src/lib/handleImportAtRules.js +34 -0
  139. package/src/lib/load-config.ts +31 -0
  140. package/src/lib/normalizeTailwindDirectives.js +0 -27
  141. package/src/lib/offsets.js +373 -0
  142. package/src/lib/regex.js +74 -0
  143. package/src/lib/remap-bitfield.js +82 -0
  144. package/src/lib/resolveDefaultsAtRules.js +53 -36
  145. package/src/lib/setupContextUtils.js +570 -151
  146. package/src/lib/setupTrackingContext.js +44 -58
  147. package/src/lib/sharedState.js +13 -4
  148. package/src/plugin.js +128 -0
  149. package/src/postcss-plugins/nesting/README.md +2 -2
  150. package/src/public/colors.js +22 -0
  151. package/src/public/default-config.js +1 -1
  152. package/src/public/default-theme.js +2 -2
  153. package/src/public/load-config.js +2 -0
  154. package/src/util/applyImportantSelector.js +27 -0
  155. package/src/util/buildMediaQuery.js +5 -3
  156. package/src/util/cloneNodes.js +5 -1
  157. package/src/util/color.js +34 -17
  158. package/src/util/colorNames.js +150 -0
  159. package/src/util/dataTypes.js +67 -23
  160. package/src/util/formatVariantSelector.js +264 -144
  161. package/src/util/getAllConfigs.js +21 -2
  162. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  163. package/src/util/log.js +25 -1
  164. package/src/util/nameClass.js +4 -0
  165. package/src/util/negateValue.js +11 -3
  166. package/src/util/normalizeConfig.js +78 -20
  167. package/src/util/normalizeScreens.js +99 -4
  168. package/src/util/parseBoxShadowValue.js +3 -50
  169. package/src/util/parseDependency.js +37 -42
  170. package/src/util/parseGlob.js +24 -0
  171. package/src/util/pluginUtils.js +118 -23
  172. package/src/util/prefixSelector.js +28 -10
  173. package/src/util/pseudoElements.js +167 -0
  174. package/src/util/removeAlphaVariables.js +24 -0
  175. package/src/util/resolveConfig.js +70 -62
  176. package/src/util/resolveConfigPath.js +12 -1
  177. package/src/util/splitAtTopLevelOnly.js +52 -0
  178. package/src/util/toPath.js +1 -1
  179. package/src/util/transformThemeValue.js +13 -3
  180. package/src/util/validateConfig.js +36 -0
  181. package/src/util/validateFormalSyntax.js +34 -0
  182. package/src/util/withAlphaVariable.js +1 -1
  183. package/src/value-parser/LICENSE +22 -0
  184. package/src/value-parser/README.md +3 -0
  185. package/src/value-parser/index.d.ts +177 -0
  186. package/src/value-parser/index.js +28 -0
  187. package/src/value-parser/parse.js +303 -0
  188. package/src/value-parser/stringify.js +41 -0
  189. package/src/value-parser/unit.js +118 -0
  190. package/src/value-parser/walk.js +18 -0
  191. package/stubs/.gitignore +1 -0
  192. package/stubs/.prettierrc.json +6 -0
  193. package/stubs/{defaultConfig.stub.js → config.full.js} +215 -165
  194. package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -1
  195. package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
  196. package/stubs/postcss.config.js +5 -0
  197. package/stubs/tailwind.config.cjs +2 -0
  198. package/stubs/tailwind.config.js +2 -0
  199. package/stubs/tailwind.config.ts +3 -0
  200. package/types/config.d.ts +102 -56
  201. package/types/generated/colors.d.ts +22 -0
  202. package/types/generated/corePluginList.d.ts +1 -1
  203. package/types/generated/default-theme.d.ts +372 -0
  204. package/types/index.d.ts +7 -1
  205. package/CHANGELOG.md +0 -2099
  206. package/lib/cli-peer-dependencies.js +0 -15
  207. package/lib/constants.js +0 -37
  208. package/peers/index.js +0 -75156
  209. package/scripts/install-integrations.js +0 -27
  210. package/scripts/rebuildFixtures.js +0 -68
  211. package/src/cli-peer-dependencies.js +0 -9
  212. package/src/constants.js +0 -17
  213. package/types.d.ts +0 -1
@@ -12,15 +12,35 @@ 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')
@@ -60,14 +80,14 @@ export let variantPlugins = {
60
80
  })
61
81
  },
62
82
 
63
- pseudoClassVariants: ({ addVariant }) => {
83
+ pseudoClassVariants: ({ addVariant, matchVariant, config }) => {
64
84
  let pseudoVariants = [
65
85
  // Positional
66
- ['first', ':first-child'],
67
- ['last', ':last-child'],
68
- ['only', ':only-child'],
69
- ['odd', ':nth-child(odd)'],
70
- ['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)'],
71
91
  'first-of-type',
72
92
  'last-of-type',
73
93
  'only-of-type',
@@ -76,27 +96,17 @@ export let variantPlugins = {
76
96
  [
77
97
  'visited',
78
98
  ({ container }) => {
79
- let toRemove = ['--tw-text-opacity', '--tw-border-opacity', '--tw-bg-opacity']
80
-
81
- container.walkDecls((decl) => {
82
- if (toRemove.includes(decl.prop)) {
83
- decl.remove()
99
+ removeAlphaVariables(container, [
100
+ '--tw-text-opacity',
101
+ '--tw-border-opacity',
102
+ '--tw-bg-opacity',
103
+ ])
84
104
 
85
- return
86
- }
87
-
88
- for (const varName of toRemove) {
89
- if (decl.value.includes(`/ var(${varName})`)) {
90
- decl.value = decl.value.replace(`/ var(${varName})`, '')
91
- }
92
- }
93
- })
94
-
95
- return ':visited'
105
+ return '&:visited'
96
106
  },
97
107
  ],
98
108
  'target',
99
- ['open', '[open]'],
109
+ ['open', '&[open]'],
100
110
 
101
111
  // Forms
102
112
  'default',
@@ -104,6 +114,7 @@ export let variantPlugins = {
104
114
  'indeterminate',
105
115
  'placeholder-shown',
106
116
  'autofill',
117
+ 'optional',
107
118
  'required',
108
119
  'valid',
109
120
  'invalid',
@@ -116,57 +127,79 @@ export let variantPlugins = {
116
127
 
117
128
  // Interactive
118
129
  'focus-within',
119
- 'hover',
130
+ [
131
+ 'hover',
132
+ !flagEnabled(config(), 'hoverOnlyWhenSupported')
133
+ ? '&:hover'
134
+ : '@media (hover: hover) and (pointer: fine) { &:hover }',
135
+ ],
120
136
  'focus',
121
137
  'focus-visible',
122
138
  'active',
123
139
  'enabled',
124
140
  'disabled',
125
- ].map((variant) => (Array.isArray(variant) ? variant : [variant, `:${variant}`]))
141
+ ].map((variant) => (Array.isArray(variant) ? variant : [variant, `&:${variant}`]))
126
142
 
127
143
  for (let [variantName, state] of pseudoVariants) {
128
144
  addVariant(variantName, (ctx) => {
129
145
  let result = typeof state === 'function' ? state(ctx) : state
130
146
 
131
- return `&${result}`
147
+ return result
132
148
  })
133
149
  }
134
150
 
135
- for (let [variantName, state] of pseudoVariants) {
136
- addVariant(`group-${variantName}`, (ctx) => {
137
- let result = typeof state === 'function' ? state(ctx) : state
138
-
139
- return `:merge(.group)${result} &`
140
- })
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)`, ' ~ &'],
141
160
  }
142
161
 
143
- for (let [variantName, state] of pseudoVariants) {
144
- addVariant(`peer-${variantName}`, (ctx) => {
145
- 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
+ }
146
185
 
147
- return `:merge(.peer)${result} ~ &`
148
- })
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
+ )
149
197
  }
150
198
  },
151
199
 
152
200
  directionVariants: ({ addVariant }) => {
153
- addVariant('ltr', () => {
154
- log.warn('rtl-experimental', [
155
- 'The RTL features in Tailwind CSS are currently in preview.',
156
- 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
157
- ])
158
-
159
- return '[dir="ltr"] &'
160
- })
161
-
162
- addVariant('rtl', () => {
163
- log.warn('rtl-experimental', [
164
- 'The RTL features in Tailwind CSS are currently in preview.',
165
- 'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
166
- ])
167
-
168
- return '[dir="rtl"] &'
169
- })
201
+ addVariant('ltr', ':is([dir="ltr"] &)')
202
+ addVariant('rtl', ':is([dir="rtl"] &)')
170
203
  },
171
204
 
172
205
  reducedMotionVariants: ({ addVariant }) => {
@@ -187,7 +220,7 @@ export let variantPlugins = {
187
220
  }
188
221
 
189
222
  if (mode === 'class') {
190
- addVariant('dark', `${className} &`)
223
+ addVariant('dark', `:is(${className} &)`)
191
224
  } else if (mode === 'media') {
192
225
  addVariant('dark', '@media (prefers-color-scheme: dark)')
193
226
  }
@@ -197,18 +230,231 @@ export let variantPlugins = {
197
230
  addVariant('print', '@media print')
198
231
  },
199
232
 
200
- screenVariants: ({ theme, addVariant }) => {
201
- for (let screen of normalizeScreens(theme('screens'))) {
202
- 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([])
240
+
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
+ }
337
+ }
338
+
339
+ matchVariant('max', buildScreenVariant('max'), {
340
+ sort: maxSort,
341
+ values: areSimpleScreens ? buildScreenValues('max') : {},
342
+ })
203
343
 
204
- addVariant(screen.name, `@media ${query}`)
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
+ })
205
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
+ )
206
447
  },
207
448
 
208
449
  orientationVariants: ({ addVariant }) => {
209
450
  addVariant('portrait', '@media (orientation: portrait)')
210
451
  addVariant('landscape', '@media (orientation: landscape)')
211
452
  },
453
+
454
+ prefersContrastVariants: ({ addVariant }) => {
455
+ addVariant('contrast-more', '@media (prefers-contrast: more)')
456
+ addVariant('contrast-less', '@media (prefers-contrast: less)')
457
+ },
212
458
  }
213
459
 
214
460
  let cssTransformValue = [
@@ -382,6 +628,7 @@ export let corePlugins = {
382
628
  addUtilities({
383
629
  '.visible': { visibility: 'visible' },
384
630
  '.invisible': { visibility: 'hidden' },
631
+ '.collapse': { visibility: 'collapse' },
385
632
  })
386
633
  },
387
634
 
@@ -398,12 +645,14 @@ export let corePlugins = {
398
645
  inset: createUtilityPlugin(
399
646
  'inset',
400
647
  [
401
- ['inset', ['top', 'right', 'bottom', 'left']],
648
+ ['inset', ['inset']],
402
649
  [
403
650
  ['inset-x', ['left', 'right']],
404
651
  ['inset-y', ['top', 'bottom']],
405
652
  ],
406
653
  [
654
+ ['start', ['inset-inline-start']],
655
+ ['end', ['inset-inline-end']],
407
656
  ['top', ['top']],
408
657
  ['right', ['right']],
409
658
  ['bottom', ['bottom']],
@@ -455,6 +704,8 @@ export let corePlugins = {
455
704
  ['my', ['margin-top', 'margin-bottom']],
456
705
  ],
457
706
  [
707
+ ['ms', ['margin-inline-start']],
708
+ ['me', ['margin-inline-end']],
458
709
  ['mt', ['margin-top']],
459
710
  ['mr', ['margin-right']],
460
711
  ['mb', ['margin-bottom']],
@@ -471,6 +722,29 @@ export let corePlugins = {
471
722
  })
472
723
  },
473
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
+
474
748
  display: ({ addUtilities }) => {
475
749
  addUtilities({
476
750
  '.block': { display: 'block' },
@@ -525,6 +799,13 @@ export let corePlugins = {
525
799
  })
526
800
  },
527
801
 
802
+ captionSide: ({ addUtilities }) => {
803
+ addUtilities({
804
+ '.caption-top': { 'caption-side': 'top' },
805
+ '.caption-bottom': { 'caption-side': 'bottom' },
806
+ })
807
+ },
808
+
528
809
  borderCollapse: ({ addUtilities }) => {
529
810
  addUtilities({
530
811
  '.border-collapse': { 'border-collapse': 'collapse' },
@@ -803,6 +1084,8 @@ export let corePlugins = {
803
1084
  ['scroll-my', ['scroll-margin-top', 'scroll-margin-bottom']],
804
1085
  ],
805
1086
  [
1087
+ ['scroll-ms', ['scroll-margin-inline-start']],
1088
+ ['scroll-me', ['scroll-margin-inline-end']],
806
1089
  ['scroll-mt', ['scroll-margin-top']],
807
1090
  ['scroll-mr', ['scroll-margin-right']],
808
1091
  ['scroll-mb', ['scroll-margin-bottom']],
@@ -819,6 +1102,8 @@ export let corePlugins = {
819
1102
  ['scroll-py', ['scroll-padding-top', 'scroll-padding-bottom']],
820
1103
  ],
821
1104
  [
1105
+ ['scroll-ps', ['scroll-padding-inline-start']],
1106
+ ['scroll-pe', ['scroll-padding-inline-end']],
822
1107
  ['scroll-pt', ['scroll-padding-top']],
823
1108
  ['scroll-pr', ['scroll-padding-right']],
824
1109
  ['scroll-pb', ['scroll-padding-bottom']],
@@ -832,8 +1117,8 @@ export let corePlugins = {
832
1117
  '.list-outside': { 'list-style-position': 'outside' },
833
1118
  })
834
1119
  },
835
-
836
1120
  listStyleType: createUtilityPlugin('listStyleType', [['list', ['listStyleType']]]),
1121
+ listStyleImage: createUtilityPlugin('listStyleImage', [['list-image', ['listStyleImage']]]),
837
1122
 
838
1123
  appearance: ({ addUtilities }) => {
839
1124
  addUtilities({
@@ -884,6 +1169,7 @@ export let corePlugins = {
884
1169
  addUtilities({
885
1170
  '.grid-flow-row': { gridAutoFlow: 'row' },
886
1171
  '.grid-flow-col': { gridAutoFlow: 'column' },
1172
+ '.grid-flow-dense': { gridAutoFlow: 'dense' },
887
1173
  '.grid-flow-row-dense': { gridAutoFlow: 'row dense' },
888
1174
  '.grid-flow-col-dense': { gridAutoFlow: 'column dense' },
889
1175
  })
@@ -920,6 +1206,7 @@ export let corePlugins = {
920
1206
  '.place-content-between': { 'place-content': 'space-between' },
921
1207
  '.place-content-around': { 'place-content': 'space-around' },
922
1208
  '.place-content-evenly': { 'place-content': 'space-evenly' },
1209
+ '.place-content-baseline': { 'place-content': 'baseline' },
923
1210
  '.place-content-stretch': { 'place-content': 'stretch' },
924
1211
  })
925
1212
  },
@@ -929,18 +1216,22 @@ export let corePlugins = {
929
1216
  '.place-items-start': { 'place-items': 'start' },
930
1217
  '.place-items-end': { 'place-items': 'end' },
931
1218
  '.place-items-center': { 'place-items': 'center' },
1219
+ '.place-items-baseline': { 'place-items': 'baseline' },
932
1220
  '.place-items-stretch': { 'place-items': 'stretch' },
933
1221
  })
934
1222
  },
935
1223
 
936
1224
  alignContent: ({ addUtilities }) => {
937
1225
  addUtilities({
1226
+ '.content-normal': { 'align-content': 'normal' },
938
1227
  '.content-center': { 'align-content': 'center' },
939
1228
  '.content-start': { 'align-content': 'flex-start' },
940
1229
  '.content-end': { 'align-content': 'flex-end' },
941
1230
  '.content-between': { 'align-content': 'space-between' },
942
1231
  '.content-around': { 'align-content': 'space-around' },
943
1232
  '.content-evenly': { 'align-content': 'space-evenly' },
1233
+ '.content-baseline': { 'align-content': 'baseline' },
1234
+ '.content-stretch': { 'align-content': 'stretch' },
944
1235
  })
945
1236
  },
946
1237
 
@@ -956,12 +1247,14 @@ export let corePlugins = {
956
1247
 
957
1248
  justifyContent: ({ addUtilities }) => {
958
1249
  addUtilities({
1250
+ '.justify-normal': { 'justify-content': 'normal' },
959
1251
  '.justify-start': { 'justify-content': 'flex-start' },
960
1252
  '.justify-end': { 'justify-content': 'flex-end' },
961
1253
  '.justify-center': { 'justify-content': 'center' },
962
1254
  '.justify-between': { 'justify-content': 'space-between' },
963
1255
  '.justify-around': { 'justify-content': 'space-around' },
964
1256
  '.justify-evenly': { 'justify-content': 'space-evenly' },
1257
+ '.justify-stretch': { 'justify-content': 'stretch' },
965
1258
  })
966
1259
  },
967
1260
 
@@ -982,12 +1275,22 @@ export let corePlugins = {
982
1275
  ],
983
1276
  ]),
984
1277
 
985
- space: ({ matchUtilities, addUtilities, theme }) => {
1278
+ space: ({ matchUtilities, addUtilities, theme, config }) => {
986
1279
  matchUtilities(
987
1280
  {
988
1281
  'space-x': (value) => {
989
1282
  value = value === '0' ? '0px' : value
990
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
+
991
1294
  return {
992
1295
  '& > :not([hidden]) ~ :not([hidden])': {
993
1296
  '--tw-space-x-reverse': '0',
@@ -1017,12 +1320,23 @@ export let corePlugins = {
1017
1320
  })
1018
1321
  },
1019
1322
 
1020
- divideWidth: ({ matchUtilities, addUtilities, theme }) => {
1323
+ divideWidth: ({ matchUtilities, addUtilities, theme, config }) => {
1021
1324
  matchUtilities(
1022
1325
  {
1023
1326
  'divide-x': (value) => {
1024
1327
  value = value === '0' ? '0px' : value
1025
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
+
1026
1340
  return {
1027
1341
  '& > :not([hidden]) ~ :not([hidden])': {
1028
1342
  '@defaults border-width': {},
@@ -1045,7 +1359,7 @@ export let corePlugins = {
1045
1359
  }
1046
1360
  },
1047
1361
  },
1048
- { values: theme('divideWidth'), type: ['line-width', 'length'] }
1362
+ { values: theme('divideWidth'), type: ['line-width', 'length', 'any'] }
1049
1363
  )
1050
1364
 
1051
1365
  addUtilities({
@@ -1093,7 +1407,7 @@ export let corePlugins = {
1093
1407
  },
1094
1408
  {
1095
1409
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('divideColor'))),
1096
- type: 'color',
1410
+ type: ['color', 'any'],
1097
1411
  }
1098
1412
  )
1099
1413
  },
@@ -1190,6 +1504,14 @@ export let corePlugins = {
1190
1504
  })
1191
1505
  },
1192
1506
 
1507
+ hyphens: ({ addUtilities }) => {
1508
+ addUtilities({
1509
+ '.hyphens-none': { hyphens: 'none' },
1510
+ '.hyphens-manual': { hyphens: 'manual' },
1511
+ '.hyphens-auto': { hyphens: 'auto' },
1512
+ })
1513
+ },
1514
+
1193
1515
  whitespace: ({ addUtilities }) => {
1194
1516
  addUtilities({
1195
1517
  '.whitespace-normal': { 'white-space': 'normal' },
@@ -1197,6 +1519,15 @@ export let corePlugins = {
1197
1519
  '.whitespace-pre': { 'white-space': 'pre' },
1198
1520
  '.whitespace-pre-line': { 'white-space': 'pre-line' },
1199
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' },
1200
1531
  })
1201
1532
  },
1202
1533
 
@@ -1205,18 +1536,25 @@ export let corePlugins = {
1205
1536
  '.break-normal': { 'overflow-wrap': 'normal', 'word-break': 'normal' },
1206
1537
  '.break-words': { 'overflow-wrap': 'break-word' },
1207
1538
  '.break-all': { 'word-break': 'break-all' },
1539
+ '.break-keep': { 'word-break': 'keep-all' },
1208
1540
  })
1209
1541
  },
1210
1542
 
1211
1543
  borderRadius: createUtilityPlugin('borderRadius', [
1212
1544
  ['rounded', ['border-radius']],
1213
1545
  [
1546
+ ['rounded-s', ['border-start-start-radius', 'border-end-start-radius']],
1547
+ ['rounded-e', ['border-start-end-radius', 'border-end-end-radius']],
1214
1548
  ['rounded-t', ['border-top-left-radius', 'border-top-right-radius']],
1215
1549
  ['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']],
1216
1550
  ['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']],
1217
1551
  ['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']],
1218
1552
  ],
1219
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']],
1220
1558
  ['rounded-tl', ['border-top-left-radius']],
1221
1559
  ['rounded-tr', ['border-top-right-radius']],
1222
1560
  ['rounded-br', ['border-bottom-right-radius']],
@@ -1233,6 +1571,8 @@ export let corePlugins = {
1233
1571
  ['border-y', [['@defaults border-width', {}], 'border-top-width', 'border-bottom-width']],
1234
1572
  ],
1235
1573
  [
1574
+ ['border-s', [['@defaults border-width', {}], 'border-inline-start-width']],
1575
+ ['border-e', [['@defaults border-width', {}], 'border-inline-end-width']],
1236
1576
  ['border-t', [['@defaults border-width', {}], 'border-top-width']],
1237
1577
  ['border-r', [['@defaults border-width', {}], 'border-right-width']],
1238
1578
  ['border-b', [['@defaults border-width', {}], 'border-bottom-width']],
@@ -1272,7 +1612,7 @@ export let corePlugins = {
1272
1612
  },
1273
1613
  {
1274
1614
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1275
- type: ['color'],
1615
+ type: ['color', 'any'],
1276
1616
  }
1277
1617
  )
1278
1618
 
@@ -1309,12 +1649,38 @@ export let corePlugins = {
1309
1649
  },
1310
1650
  {
1311
1651
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1312
- type: 'color',
1652
+ type: ['color', 'any'],
1313
1653
  }
1314
1654
  )
1315
1655
 
1316
1656
  matchUtilities(
1317
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
+ },
1318
1684
  'border-t': (value) => {
1319
1685
  if (!corePlugins('borderOpacity')) {
1320
1686
  return {
@@ -1370,7 +1736,7 @@ export let corePlugins = {
1370
1736
  },
1371
1737
  {
1372
1738
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1373
- type: 'color',
1739
+ type: ['color', 'any'],
1374
1740
  }
1375
1741
  )
1376
1742
  },
@@ -1396,7 +1762,7 @@ export let corePlugins = {
1396
1762
  })
1397
1763
  },
1398
1764
  },
1399
- { values: flattenColorPalette(theme('backgroundColor')), type: 'color' }
1765
+ { values: flattenColorPalette(theme('backgroundColor')), type: ['color', 'any'] }
1400
1766
  )
1401
1767
  },
1402
1768
 
@@ -1411,44 +1777,98 @@ export let corePlugins = {
1411
1777
  return withAlphaValue(value, 0, 'rgb(255 255 255 / 0)')
1412
1778
  }
1413
1779
 
1414
- 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
+
1415
1787
  let options = {
1416
1788
  values: flattenColorPalette(theme('gradientColorStops')),
1417
1789
  type: ['color', 'any'],
1418
1790
  }
1419
1791
 
1792
+ let positionOptions = {
1793
+ values: theme('gradientColorStopPositions'),
1794
+ type: ['length', 'percentage'],
1795
+ }
1796
+
1420
1797
  matchUtilities(
1421
1798
  {
1422
1799
  from: (value) => {
1423
1800
  let transparentToValue = transparentTo(value)
1424
1801
 
1425
1802
  return {
1426
- '--tw-gradient-from': toColorValue(value, 'from'),
1427
- '--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)`,
1428
1807
  }
1429
1808
  },
1430
1809
  },
1431
1810
  options
1432
1811
  )
1812
+
1813
+ matchUtilities(
1814
+ {
1815
+ from: (value) => {
1816
+ return {
1817
+ '--tw-gradient-from-position': value,
1818
+ }
1819
+ },
1820
+ },
1821
+ positionOptions
1822
+ )
1823
+
1433
1824
  matchUtilities(
1434
1825
  {
1435
1826
  via: (value) => {
1436
1827
  let transparentToValue = transparentTo(value)
1437
1828
 
1438
1829
  return {
1830
+ '@defaults gradient-color-stops': {},
1831
+ '--tw-gradient-to': `${transparentToValue} var(--tw-gradient-to-position)`,
1439
1832
  '--tw-gradient-stops': `var(--tw-gradient-from), ${toColorValue(
1440
- value,
1441
- 'via'
1442
- )}, var(--tw-gradient-to, ${transparentToValue})`,
1833
+ value
1834
+ )} var(--tw-gradient-via-position), var(--tw-gradient-to)`,
1443
1835
  }
1444
1836
  },
1445
1837
  },
1446
1838
  options
1447
1839
  )
1840
+
1841
+ matchUtilities(
1842
+ {
1843
+ via: (value) => {
1844
+ return {
1845
+ '--tw-gradient-via-position': value,
1846
+ }
1847
+ },
1848
+ },
1849
+ positionOptions
1850
+ )
1851
+
1448
1852
  matchUtilities(
1449
- { to: (value) => ({ '--tw-gradient-to': toColorValue(value, 'to') }) },
1853
+ {
1854
+ to: (value) => ({
1855
+ '@defaults gradient-color-stops': {},
1856
+ '--tw-gradient-to': `${toColorValue(value)} var(--tw-gradient-to-position)`,
1857
+ }),
1858
+ },
1450
1859
  options
1451
1860
  )
1861
+
1862
+ matchUtilities(
1863
+ {
1864
+ to: (value) => {
1865
+ return {
1866
+ '--tw-gradient-to-position': value,
1867
+ }
1868
+ },
1869
+ },
1870
+ positionOptions
1871
+ )
1452
1872
  }
1453
1873
  })(),
1454
1874
 
@@ -1462,7 +1882,7 @@ export let corePlugins = {
1462
1882
  },
1463
1883
 
1464
1884
  backgroundSize: createUtilityPlugin('backgroundSize', [['bg', ['background-size']]], {
1465
- type: ['lookup', 'length', 'percentage'],
1885
+ type: ['lookup', 'length', 'percentage', 'size'],
1466
1886
  }),
1467
1887
 
1468
1888
  backgroundAttachment: ({ addUtilities }) => {
@@ -1483,7 +1903,7 @@ export let corePlugins = {
1483
1903
  },
1484
1904
 
1485
1905
  backgroundPosition: createUtilityPlugin('backgroundPosition', [['bg', ['background-position']]], {
1486
- type: ['lookup', 'position'],
1906
+ type: ['lookup', ['position', { preferOnConflict: true }]],
1487
1907
  }),
1488
1908
 
1489
1909
  backgroundRepeat: ({ addUtilities }) => {
@@ -1523,7 +1943,7 @@ export let corePlugins = {
1523
1943
  return { stroke: toColorValue(value) }
1524
1944
  },
1525
1945
  },
1526
- { values: flattenColorPalette(theme('stroke')), type: ['color', 'url'] }
1946
+ { values: flattenColorPalette(theme('stroke')), type: ['color', 'url', 'any'] }
1527
1947
  )
1528
1948
  },
1529
1949
 
@@ -1549,6 +1969,8 @@ export let corePlugins = {
1549
1969
  ['py', ['padding-top', 'padding-bottom']],
1550
1970
  ],
1551
1971
  [
1972
+ ['ps', ['padding-inline-start']],
1973
+ ['pe', ['padding-inline-end']],
1552
1974
  ['pt', ['padding-top']],
1553
1975
  ['pr', ['padding-right']],
1554
1976
  ['pb', ['padding-bottom']],
@@ -1586,16 +2008,46 @@ export let corePlugins = {
1586
2008
  matchUtilities({ align: (value) => ({ 'vertical-align': value }) })
1587
2009
  },
1588
2010
 
1589
- fontFamily: createUtilityPlugin('fontFamily', [['font', ['fontFamily']]], {
1590
- type: ['lookup', 'generic-name', 'family-name'],
1591
- }),
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
+ },
1592
2036
 
1593
2037
  fontSize: ({ matchUtilities, theme }) => {
1594
2038
  matchUtilities(
1595
2039
  {
1596
- text: (value) => {
2040
+ text: (value, { modifier }) => {
1597
2041
  let [fontSize, options] = Array.isArray(value) ? value : [value]
1598
- 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)
1599
2051
  ? options
1600
2052
  : { lineHeight: options }
1601
2053
 
@@ -1603,18 +2055,20 @@ export let corePlugins = {
1603
2055
  'font-size': fontSize,
1604
2056
  ...(lineHeight === undefined ? {} : { 'line-height': lineHeight }),
1605
2057
  ...(letterSpacing === undefined ? {} : { 'letter-spacing': letterSpacing }),
2058
+ ...(fontWeight === undefined ? {} : { 'font-weight': fontWeight }),
1606
2059
  }
1607
2060
  },
1608
2061
  },
1609
2062
  {
1610
2063
  values: theme('fontSize'),
2064
+ modifiers: theme('lineHeight'),
1611
2065
  type: ['absolute-size', 'relative-size', 'length', 'percentage'],
1612
2066
  }
1613
2067
  )
1614
2068
  },
1615
2069
 
1616
2070
  fontWeight: createUtilityPlugin('fontWeight', [['font', ['fontWeight']]], {
1617
- type: ['lookup', 'number'],
2071
+ type: ['lookup', 'number', 'any'],
1618
2072
  }),
1619
2073
 
1620
2074
  textTransform: ({ addUtilities }) => {
@@ -1710,7 +2164,7 @@ export let corePlugins = {
1710
2164
  })
1711
2165
  },
1712
2166
  },
1713
- { values: flattenColorPalette(theme('textColor')), type: 'color' }
2167
+ { values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
1714
2168
  )
1715
2169
  },
1716
2170
 
@@ -1732,7 +2186,7 @@ export let corePlugins = {
1732
2186
  return { 'text-decoration-color': toColorValue(value) }
1733
2187
  },
1734
2188
  },
1735
- { values: flattenColorPalette(theme('textDecorationColor')), type: ['color'] }
2189
+ { values: flattenColorPalette(theme('textDecorationColor')), type: ['color', 'any'] }
1736
2190
  )
1737
2191
  },
1738
2192
 
@@ -1755,7 +2209,7 @@ export let corePlugins = {
1755
2209
  textUnderlineOffset: createUtilityPlugin(
1756
2210
  'textUnderlineOffset',
1757
2211
  [['underline-offset', ['text-underline-offset']]],
1758
- { type: ['length', 'percentage'] }
2212
+ { type: ['length', 'percentage', 'any'] }
1759
2213
  ),
1760
2214
 
1761
2215
  fontSmoothing: ({ addUtilities }) => {
@@ -1870,6 +2324,7 @@ export let corePlugins = {
1870
2324
  '.mix-blend-saturation': { 'mix-blend-mode': 'saturation' },
1871
2325
  '.mix-blend-color': { 'mix-blend-mode': 'color' },
1872
2326
  '.mix-blend-luminosity': { 'mix-blend-mode': 'luminosity' },
2327
+ '.mix-blend-plus-lighter': { 'mix-blend-mode': 'plus-lighter' },
1873
2328
  })
1874
2329
  },
1875
2330
 
@@ -1927,7 +2382,7 @@ export let corePlugins = {
1927
2382
  }
1928
2383
  },
1929
2384
  },
1930
- { values: flattenColorPalette(theme('boxShadowColor')), type: ['color'] }
2385
+ { values: flattenColorPalette(theme('boxShadowColor')), type: ['color', 'any'] }
1931
2386
  )
1932
2387
  },
1933
2388
 
@@ -1941,7 +2396,6 @@ export let corePlugins = {
1941
2396
  '.outline-dashed': { 'outline-style': 'dashed' },
1942
2397
  '.outline-dotted': { 'outline-style': 'dotted' },
1943
2398
  '.outline-double': { 'outline-style': 'double' },
1944
- '.outline-hidden': { 'outline-style': 'hidden' },
1945
2399
  })
1946
2400
  },
1947
2401
 
@@ -1950,7 +2404,8 @@ export let corePlugins = {
1950
2404
  }),
1951
2405
 
1952
2406
  outlineOffset: createUtilityPlugin('outlineOffset', [['outline-offset', ['outline-offset']]], {
1953
- type: ['length', 'number', 'percentage'],
2407
+ type: ['length', 'number', 'percentage', 'any'],
2408
+ supportsNegativeValues: true,
1954
2409
  }),
1955
2410
 
1956
2411
  outlineColor: ({ matchUtilities, theme }) => {
@@ -1960,17 +2415,28 @@ export let corePlugins = {
1960
2415
  return { 'outline-color': toColorValue(value) }
1961
2416
  },
1962
2417
  },
1963
- { values: flattenColorPalette(theme('outlineColor')), type: ['color'] }
2418
+ { values: flattenColorPalette(theme('outlineColor')), type: ['color', 'any'] }
1964
2419
  )
1965
2420
  },
1966
2421
 
1967
- ringWidth: ({ matchUtilities, addDefaults, addUtilities, theme }) => {
1968
- let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5')
1969
- let ringColorDefault = withAlphaValue(
1970
- theme('ringColor')?.DEFAULT,
1971
- ringOpacityDefault,
1972
- `rgb(147 197 253 / ${ringOpacityDefault})`
1973
- )
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
+ })()
1974
2440
 
1975
2441
  addDefaults('ring-width', {
1976
2442
  '--tw-ring-inset': ' ',
@@ -2029,14 +2495,18 @@ export let corePlugins = {
2029
2495
  ([modifier]) => modifier !== 'DEFAULT'
2030
2496
  )
2031
2497
  ),
2032
- type: 'color',
2498
+ type: ['color', 'any'],
2033
2499
  }
2034
2500
  )
2035
2501
  },
2036
2502
 
2037
- ringOpacity: createUtilityPlugin('ringOpacity', [['ring-opacity', ['--tw-ring-opacity']]], {
2038
- filterDefault: true,
2039
- }),
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
+ },
2040
2510
  ringOffsetWidth: createUtilityPlugin(
2041
2511
  'ringOffsetWidth',
2042
2512
  [['ring-offset', ['--tw-ring-offset-width']]],
@@ -2052,7 +2522,7 @@ export let corePlugins = {
2052
2522
  }
2053
2523
  },
2054
2524
  },
2055
- { values: flattenColorPalette(theme('ringOffsetColor')), type: 'color' }
2525
+ { values: flattenColorPalette(theme('ringOffsetColor')), type: ['color', 'any'] }
2056
2526
  )
2057
2527
  },
2058
2528