tailwindcss 0.0.0-insiders.d3e754a → 0.0.0-insiders.d3f2221

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