tailwindcss 3.1.8 → 3.2.0

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 (112) hide show
  1. package/README.md +6 -5
  2. package/lib/cli/build/deps.js +54 -0
  3. package/lib/cli/build/index.js +44 -0
  4. package/lib/cli/build/plugin.js +335 -0
  5. package/lib/cli/build/utils.js +78 -0
  6. package/lib/cli/build/watching.js +113 -0
  7. package/lib/cli/help/index.js +71 -0
  8. package/lib/cli/index.js +18 -0
  9. package/lib/cli/init/index.js +46 -0
  10. package/lib/cli/shared.js +12 -0
  11. package/lib/cli.js +11 -590
  12. package/lib/corePlugins.js +332 -108
  13. package/lib/css/preflight.css +5 -0
  14. package/lib/featureFlags.js +7 -4
  15. package/lib/index.js +6 -1
  16. package/lib/lib/content.js +167 -0
  17. package/lib/lib/defaultExtractor.js +15 -10
  18. package/lib/lib/detectNesting.js +2 -2
  19. package/lib/lib/evaluateTailwindFunctions.js +17 -1
  20. package/lib/lib/expandApplyAtRules.js +66 -37
  21. package/lib/lib/expandTailwindAtRules.js +10 -42
  22. package/lib/lib/findAtConfigPath.js +44 -0
  23. package/lib/lib/generateRules.js +180 -93
  24. package/lib/lib/normalizeTailwindDirectives.js +1 -1
  25. package/lib/lib/offsets.js +217 -0
  26. package/lib/lib/regex.js +1 -1
  27. package/lib/lib/setupContextUtils.js +339 -100
  28. package/lib/lib/setupTrackingContext.js +5 -39
  29. package/lib/lib/sharedState.js +2 -0
  30. package/lib/public/colors.js +1 -1
  31. package/lib/util/buildMediaQuery.js +6 -3
  32. package/lib/util/configurePlugins.js +1 -1
  33. package/lib/util/dataTypes.js +15 -19
  34. package/lib/util/formatVariantSelector.js +92 -8
  35. package/lib/util/getAllConfigs.js +14 -3
  36. package/lib/util/isValidArbitraryValue.js +1 -1
  37. package/lib/util/nameClass.js +3 -0
  38. package/lib/util/negateValue.js +15 -2
  39. package/lib/util/normalizeConfig.js +17 -3
  40. package/lib/util/normalizeScreens.js +100 -3
  41. package/lib/util/parseAnimationValue.js +1 -1
  42. package/lib/util/parseBoxShadowValue.js +1 -1
  43. package/lib/util/parseDependency.js +33 -54
  44. package/lib/util/parseGlob.js +34 -0
  45. package/lib/util/parseObjectStyles.js +1 -1
  46. package/lib/util/pluginUtils.js +86 -17
  47. package/lib/util/resolveConfig.js +2 -2
  48. package/lib/util/splitAtTopLevelOnly.js +31 -81
  49. package/lib/util/transformThemeValue.js +9 -2
  50. package/lib/util/validateConfig.js +1 -1
  51. package/lib/util/validateFormalSyntax.js +24 -0
  52. package/package.json +13 -11
  53. package/peers/.DS_Store +0 -0
  54. package/peers/.svgo.yml +75 -0
  55. package/peers/index.js +3332 -2032
  56. package/peers/orders/concentric-css.json +299 -0
  57. package/peers/orders/smacss.json +299 -0
  58. package/peers/orders/source.json +295 -0
  59. package/plugin.d.ts +3 -3
  60. package/scripts/release-channel.js +18 -0
  61. package/scripts/release-notes.js +21 -0
  62. package/src/.DS_Store +0 -0
  63. package/src/cli/build/deps.js +56 -0
  64. package/src/cli/build/index.js +45 -0
  65. package/src/cli/build/plugin.js +397 -0
  66. package/src/cli/build/utils.js +76 -0
  67. package/src/cli/build/watching.js +134 -0
  68. package/src/cli/help/index.js +70 -0
  69. package/src/cli/index.js +3 -0
  70. package/src/cli/init/index.js +50 -0
  71. package/src/cli/shared.js +5 -0
  72. package/src/cli.js +4 -696
  73. package/src/corePlugins.js +262 -39
  74. package/src/css/preflight.css +5 -0
  75. package/src/featureFlags.js +12 -2
  76. package/src/index.js +5 -0
  77. package/src/lib/content.js +205 -0
  78. package/src/lib/defaultExtractor.js +3 -0
  79. package/src/lib/evaluateTailwindFunctions.js +22 -1
  80. package/src/lib/expandApplyAtRules.js +70 -29
  81. package/src/lib/expandTailwindAtRules.js +8 -46
  82. package/src/lib/findAtConfigPath.js +48 -0
  83. package/src/lib/generateRules.js +223 -101
  84. package/src/lib/offsets.js +270 -0
  85. package/src/lib/setupContextUtils.js +376 -89
  86. package/src/lib/setupTrackingContext.js +4 -45
  87. package/src/lib/sharedState.js +2 -0
  88. package/src/util/buildMediaQuery.js +5 -3
  89. package/src/util/dataTypes.js +15 -17
  90. package/src/util/formatVariantSelector.js +113 -9
  91. package/src/util/getAllConfigs.js +14 -2
  92. package/src/util/nameClass.js +4 -0
  93. package/src/util/negateValue.js +10 -2
  94. package/src/util/normalizeConfig.js +22 -2
  95. package/src/util/normalizeScreens.js +99 -4
  96. package/src/util/parseBoxShadowValue.js +1 -1
  97. package/src/util/parseDependency.js +37 -42
  98. package/src/util/parseGlob.js +24 -0
  99. package/src/util/pluginUtils.js +90 -14
  100. package/src/util/resolveConfig.js +1 -1
  101. package/src/util/splitAtTopLevelOnly.js +23 -49
  102. package/src/util/transformThemeValue.js +9 -1
  103. package/src/util/validateFormalSyntax.js +34 -0
  104. package/stubs/defaultConfig.stub.js +19 -3
  105. package/tmp.css +11 -0
  106. package/tmp.dependency-graph.js +2 -0
  107. package/tmp.in.css +3 -0
  108. package/tmp.js +0 -0
  109. package/tmp.out.css +524 -0
  110. package/types/config.d.ts +47 -13
  111. package/types/generated/default-theme.d.ts +11 -0
  112. package/CHANGELOG.md +0 -2231
@@ -12,10 +12,16 @@ 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'
17
22
  import { removeAlphaVariables } from './util/removeAlphaVariables'
18
23
  import { flagEnabled } from './featureFlags'
24
+ import { normalize } from './util/dataTypes'
19
25
 
20
26
  export let variantPlugins = {
21
27
  pseudoElementVariants: ({ addVariant }) => {
@@ -74,7 +80,7 @@ export let variantPlugins = {
74
80
  })
75
81
  },
76
82
 
77
- pseudoClassVariants: ({ addVariant, config }) => {
83
+ pseudoClassVariants: ({ addVariant, matchVariant, config }) => {
78
84
  let pseudoVariants = [
79
85
  // Positional
80
86
  ['first', '&:first-child'],
@@ -142,20 +148,25 @@ export let variantPlugins = {
142
148
  })
143
149
  }
144
150
 
145
- for (let [variantName, state] of pseudoVariants) {
146
- addVariant(`group-${variantName}`, (ctx) => {
147
- let result = typeof state === 'function' ? state(ctx) : state
148
-
149
- return result.replace(/&(\S+)/, ':merge(.group)$1 &')
150
- })
151
+ let variants = {
152
+ group: (_, { modifier }) =>
153
+ modifier ? [`:merge(.group\\/${modifier})`, ' &'] : [`:merge(.group)`, ' &'],
154
+ peer: (_, { modifier }) =>
155
+ modifier ? [`:merge(.peer\\/${modifier})`, ' ~ &'] : [`:merge(.peer)`, ' ~ &'],
151
156
  }
152
157
 
153
- for (let [variantName, state] of pseudoVariants) {
154
- addVariant(`peer-${variantName}`, (ctx) => {
155
- let result = typeof state === 'function' ? state(ctx) : state
158
+ for (let [name, fn] of Object.entries(variants)) {
159
+ matchVariant(
160
+ name,
161
+ (value = '', extra) => {
162
+ let result = normalize(typeof value === 'function' ? value(extra) : value)
163
+ if (!result.includes('&')) result = '&' + result
156
164
 
157
- return result.replace(/&(\S+)/, ':merge(.peer)$1 ~ &')
158
- })
165
+ let [a, b] = fn('', extra)
166
+ return result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
167
+ },
168
+ { values: Object.fromEntries(pseudoVariants) }
169
+ )
159
170
  }
160
171
  },
161
172
 
@@ -207,12 +218,200 @@ export let variantPlugins = {
207
218
  addVariant('print', '@media print')
208
219
  },
209
220
 
210
- screenVariants: ({ theme, addVariant }) => {
211
- for (let screen of normalizeScreens(theme('screens'))) {
212
- let query = buildMediaQuery(screen)
221
+ screenVariants: ({ theme, addVariant, matchVariant }) => {
222
+ let rawScreens = theme('screens') ?? {}
223
+ let areSimpleScreens = Object.values(rawScreens).every((v) => typeof v === 'string')
224
+ let screens = normalizeScreens(theme('screens'))
225
+
226
+ /** @type {Set<string>} */
227
+ let unitCache = new Set([])
228
+
229
+ /** @param {string} value */
230
+ function units(value) {
231
+ return value.match(/(\D+)$/)?.[1] ?? '(none)'
232
+ }
233
+
234
+ /** @param {string} value */
235
+ function recordUnits(value) {
236
+ if (value !== undefined) {
237
+ unitCache.add(units(value))
238
+ }
239
+ }
240
+
241
+ /** @param {string} value */
242
+ function canUseUnits(value) {
243
+ recordUnits(value)
213
244
 
214
- addVariant(screen.name, `@media ${query}`)
245
+ // If the cache was empty it'll become 1 because we've just added the current unit
246
+ // If the cache was not empty and the units are the same the size doesn't change
247
+ // Otherwise, if the units are different from what is already known the size will always be > 1
248
+ return unitCache.size === 1
249
+ }
250
+
251
+ for (const screen of screens) {
252
+ for (const value of screen.values) {
253
+ recordUnits(value.min)
254
+ recordUnits(value.max)
255
+ }
256
+ }
257
+
258
+ let screensUseConsistentUnits = unitCache.size <= 1
259
+
260
+ /**
261
+ * @typedef {import('./util/normalizeScreens').Screen} Screen
262
+ */
263
+
264
+ /**
265
+ * @param {'min' | 'max'} type
266
+ * @returns {Record<string, Screen>}
267
+ */
268
+ function buildScreenValues(type) {
269
+ return Object.fromEntries(
270
+ screens
271
+ .filter((screen) => isScreenSortable(screen).result)
272
+ .map((screen) => {
273
+ let { min, max } = screen.values[0]
274
+
275
+ if (type === 'min' && min !== undefined) {
276
+ return screen
277
+ } else if (type === 'min' && max !== undefined) {
278
+ return { ...screen, not: !screen.not }
279
+ } else if (type === 'max' && max !== undefined) {
280
+ return screen
281
+ } else if (type === 'max' && min !== undefined) {
282
+ return { ...screen, not: !screen.not }
283
+ }
284
+ })
285
+ .map((screen) => [screen.name, screen])
286
+ )
287
+ }
288
+
289
+ /**
290
+ * @param {'min' | 'max'} type
291
+ * @returns {(a: { value: string | Screen }, z: { value: string | Screen }) => number}
292
+ */
293
+ function buildSort(type) {
294
+ return (a, z) => compareScreens(type, a.value, z.value)
295
+ }
296
+
297
+ let maxSort = buildSort('max')
298
+ let minSort = buildSort('min')
299
+
300
+ /** @param {'min'|'max'} type */
301
+ function buildScreenVariant(type) {
302
+ return (value) => {
303
+ if (!areSimpleScreens) {
304
+ log.warn('complex-screen-config', [
305
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing objects.',
306
+ ])
307
+
308
+ return []
309
+ } else if (!screensUseConsistentUnits) {
310
+ log.warn('mixed-screen-units', [
311
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
312
+ ])
313
+
314
+ return []
315
+ } else if (typeof value === 'string' && !canUseUnits(value)) {
316
+ log.warn('minmax-have-mixed-units', [
317
+ 'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
318
+ ])
319
+
320
+ return []
321
+ }
322
+
323
+ return [`@media ${buildMediaQuery(toScreen(value, type))}`]
324
+ }
325
+ }
326
+
327
+ matchVariant('max', buildScreenVariant('max'), {
328
+ sort: maxSort,
329
+ values: areSimpleScreens ? buildScreenValues('max') : {},
330
+ })
331
+
332
+ // screens and min-* are sorted together when they can be
333
+ let id = 'min-screens'
334
+ for (let screen of screens) {
335
+ addVariant(screen.name, `@media ${buildMediaQuery(screen)}`, {
336
+ id,
337
+ sort: areSimpleScreens && screensUseConsistentUnits ? minSort : undefined,
338
+ value: screen,
339
+ })
215
340
  }
341
+
342
+ matchVariant('min', buildScreenVariant('min'), {
343
+ id,
344
+ sort: minSort,
345
+ })
346
+ },
347
+
348
+ supportsVariants: ({ matchVariant, theme }) => {
349
+ matchVariant(
350
+ 'supports',
351
+ (value = '') => {
352
+ let check = normalize(value)
353
+ let isRaw = /^\w*\s*\(/.test(check)
354
+
355
+ // Chrome has a bug where `(condtion1)or(condition2)` is not valid
356
+ // But `(condition1) or (condition2)` is supported.
357
+ check = isRaw ? check.replace(/\b(and|or|not)\b/g, ' $1 ') : check
358
+
359
+ if (isRaw) {
360
+ return `@supports ${check}`
361
+ }
362
+
363
+ if (!check.includes(':')) {
364
+ check = `${check}: var(--tw)`
365
+ }
366
+
367
+ if (!(check.startsWith('(') && check.endsWith(')'))) {
368
+ check = `(${check})`
369
+ }
370
+
371
+ return `@supports ${check}`
372
+ },
373
+ { values: theme('supports') ?? {} }
374
+ )
375
+ },
376
+
377
+ ariaVariants: ({ matchVariant, theme }) => {
378
+ matchVariant('aria', (value) => `&[aria-${normalize(value)}]`, { values: theme('aria') ?? {} })
379
+ matchVariant(
380
+ 'group-aria',
381
+ (value, { modifier }) =>
382
+ modifier
383
+ ? `:merge(.group\\/${modifier})[aria-${normalize(value)}] &`
384
+ : `:merge(.group)[aria-${normalize(value)}] &`,
385
+ { values: theme('aria') ?? {} }
386
+ )
387
+ matchVariant(
388
+ 'peer-aria',
389
+ (value, { modifier }) =>
390
+ modifier
391
+ ? `:merge(.peer\\/${modifier})[aria-${normalize(value)}] ~ &`
392
+ : `:merge(.peer)[aria-${normalize(value)}] ~ &`,
393
+ { values: theme('aria') ?? {} }
394
+ )
395
+ },
396
+
397
+ dataVariants: ({ matchVariant, theme }) => {
398
+ matchVariant('data', (value) => `&[data-${normalize(value)}]`, { values: theme('data') ?? {} })
399
+ matchVariant(
400
+ 'group-data',
401
+ (value, { modifier }) =>
402
+ modifier
403
+ ? `:merge(.group\\/${modifier})[data-${normalize(value)}] &`
404
+ : `:merge(.group)[data-${normalize(value)}] &`,
405
+ { values: theme('data') ?? {} }
406
+ )
407
+ matchVariant(
408
+ 'peer-data',
409
+ (value, { modifier }) =>
410
+ modifier
411
+ ? `:merge(.peer\\/${modifier})[data-${normalize(value)}] ~ &`
412
+ : `:merge(.peer)[data-${normalize(value)}] ~ &`,
413
+ { values: theme('data') ?? {} }
414
+ )
216
415
  },
217
416
 
218
417
  orientationVariants: ({ addVariant }) => {
@@ -397,6 +596,7 @@ export let corePlugins = {
397
596
  addUtilities({
398
597
  '.visible': { visibility: 'visible' },
399
598
  '.invisible': { visibility: 'hidden' },
599
+ '.collapse': { visibility: 'collapse' },
400
600
  })
401
601
  },
402
602
 
@@ -936,6 +1136,7 @@ export let corePlugins = {
936
1136
  '.place-content-between': { 'place-content': 'space-between' },
937
1137
  '.place-content-around': { 'place-content': 'space-around' },
938
1138
  '.place-content-evenly': { 'place-content': 'space-evenly' },
1139
+ '.place-content-baseline': { 'place-content': 'baseline' },
939
1140
  '.place-content-stretch': { 'place-content': 'stretch' },
940
1141
  })
941
1142
  },
@@ -945,6 +1146,7 @@ export let corePlugins = {
945
1146
  '.place-items-start': { 'place-items': 'start' },
946
1147
  '.place-items-end': { 'place-items': 'end' },
947
1148
  '.place-items-center': { 'place-items': 'center' },
1149
+ '.place-items-baseline': { 'place-items': 'baseline' },
948
1150
  '.place-items-stretch': { 'place-items': 'stretch' },
949
1151
  })
950
1152
  },
@@ -957,6 +1159,7 @@ export let corePlugins = {
957
1159
  '.content-between': { 'align-content': 'space-between' },
958
1160
  '.content-around': { 'align-content': 'space-around' },
959
1161
  '.content-evenly': { 'align-content': 'space-evenly' },
1162
+ '.content-baseline': { 'align-content': 'baseline' },
960
1163
  })
961
1164
  },
962
1165
 
@@ -1061,7 +1264,7 @@ export let corePlugins = {
1061
1264
  }
1062
1265
  },
1063
1266
  },
1064
- { values: theme('divideWidth'), type: ['line-width', 'length'] }
1267
+ { values: theme('divideWidth'), type: ['line-width', 'length', 'any'] }
1065
1268
  )
1066
1269
 
1067
1270
  addUtilities({
@@ -1109,7 +1312,7 @@ export let corePlugins = {
1109
1312
  },
1110
1313
  {
1111
1314
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('divideColor'))),
1112
- type: 'color',
1315
+ type: ['color', 'any'],
1113
1316
  }
1114
1317
  )
1115
1318
  },
@@ -1221,6 +1424,7 @@ export let corePlugins = {
1221
1424
  '.break-normal': { 'overflow-wrap': 'normal', 'word-break': 'normal' },
1222
1425
  '.break-words': { 'overflow-wrap': 'break-word' },
1223
1426
  '.break-all': { 'word-break': 'break-all' },
1427
+ '.break-keep': { 'word-break': 'keep-all' },
1224
1428
  })
1225
1429
  },
1226
1430
 
@@ -1288,7 +1492,7 @@ export let corePlugins = {
1288
1492
  },
1289
1493
  {
1290
1494
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1291
- type: ['color'],
1495
+ type: ['color', 'any'],
1292
1496
  }
1293
1497
  )
1294
1498
 
@@ -1325,7 +1529,7 @@ export let corePlugins = {
1325
1529
  },
1326
1530
  {
1327
1531
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1328
- type: 'color',
1532
+ type: ['color', 'any'],
1329
1533
  }
1330
1534
  )
1331
1535
 
@@ -1386,7 +1590,7 @@ export let corePlugins = {
1386
1590
  },
1387
1591
  {
1388
1592
  values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('borderColor'))),
1389
- type: 'color',
1593
+ type: ['color', 'any'],
1390
1594
  }
1391
1595
  )
1392
1596
  },
@@ -1412,7 +1616,7 @@ export let corePlugins = {
1412
1616
  })
1413
1617
  },
1414
1618
  },
1415
- { values: flattenColorPalette(theme('backgroundColor')), type: 'color' }
1619
+ { values: flattenColorPalette(theme('backgroundColor')), type: ['color', 'any'] }
1416
1620
  )
1417
1621
  },
1418
1622
 
@@ -1480,7 +1684,7 @@ export let corePlugins = {
1480
1684
  },
1481
1685
 
1482
1686
  backgroundSize: createUtilityPlugin('backgroundSize', [['bg', ['background-size']]], {
1483
- type: ['lookup', 'length', 'percentage'],
1687
+ type: ['lookup', 'length', 'percentage', 'size'],
1484
1688
  }),
1485
1689
 
1486
1690
  backgroundAttachment: ({ addUtilities }) => {
@@ -1501,7 +1705,7 @@ export let corePlugins = {
1501
1705
  },
1502
1706
 
1503
1707
  backgroundPosition: createUtilityPlugin('backgroundPosition', [['bg', ['background-position']]], {
1504
- type: ['lookup', 'position'],
1708
+ type: ['lookup', ['position', { preferOnConflict: true }]],
1505
1709
  }),
1506
1710
 
1507
1711
  backgroundRepeat: ({ addUtilities }) => {
@@ -1541,7 +1745,7 @@ export let corePlugins = {
1541
1745
  return { stroke: toColorValue(value) }
1542
1746
  },
1543
1747
  },
1544
- { values: flattenColorPalette(theme('stroke')), type: ['color', 'url'] }
1748
+ { values: flattenColorPalette(theme('stroke')), type: ['color', 'url', 'any'] }
1545
1749
  )
1546
1750
  },
1547
1751
 
@@ -1604,9 +1808,28 @@ export let corePlugins = {
1604
1808
  matchUtilities({ align: (value) => ({ 'vertical-align': value }) })
1605
1809
  },
1606
1810
 
1607
- fontFamily: createUtilityPlugin('fontFamily', [['font', ['fontFamily']]], {
1608
- type: ['lookup', 'generic-name', 'family-name'],
1609
- }),
1811
+ fontFamily: ({ matchUtilities, theme }) => {
1812
+ matchUtilities(
1813
+ {
1814
+ font: (value) => {
1815
+ let [families, options = {}] =
1816
+ Array.isArray(value) && isPlainObject(value[1]) ? value : [value]
1817
+ let { fontFeatureSettings } = options
1818
+
1819
+ return {
1820
+ 'font-family': Array.isArray(families) ? families.join(', ') : families,
1821
+ ...(fontFeatureSettings === undefined
1822
+ ? {}
1823
+ : { 'font-feature-settings': fontFeatureSettings }),
1824
+ }
1825
+ },
1826
+ },
1827
+ {
1828
+ values: theme('fontFamily'),
1829
+ type: ['lookup', 'generic-name', 'family-name'],
1830
+ }
1831
+ )
1832
+ },
1610
1833
 
1611
1834
  fontSize: ({ matchUtilities, theme }) => {
1612
1835
  matchUtilities(
@@ -1633,7 +1856,7 @@ export let corePlugins = {
1633
1856
  },
1634
1857
 
1635
1858
  fontWeight: createUtilityPlugin('fontWeight', [['font', ['fontWeight']]], {
1636
- type: ['lookup', 'number'],
1859
+ type: ['lookup', 'number', 'any'],
1637
1860
  }),
1638
1861
 
1639
1862
  textTransform: ({ addUtilities }) => {
@@ -1729,7 +1952,7 @@ export let corePlugins = {
1729
1952
  })
1730
1953
  },
1731
1954
  },
1732
- { values: flattenColorPalette(theme('textColor')), type: 'color' }
1955
+ { values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
1733
1956
  )
1734
1957
  },
1735
1958
 
@@ -1751,7 +1974,7 @@ export let corePlugins = {
1751
1974
  return { 'text-decoration-color': toColorValue(value) }
1752
1975
  },
1753
1976
  },
1754
- { values: flattenColorPalette(theme('textDecorationColor')), type: ['color'] }
1977
+ { values: flattenColorPalette(theme('textDecorationColor')), type: ['color', 'any'] }
1755
1978
  )
1756
1979
  },
1757
1980
 
@@ -1774,7 +1997,7 @@ export let corePlugins = {
1774
1997
  textUnderlineOffset: createUtilityPlugin(
1775
1998
  'textUnderlineOffset',
1776
1999
  [['underline-offset', ['text-underline-offset']]],
1777
- { type: ['length', 'percentage'] }
2000
+ { type: ['length', 'percentage', 'any'] }
1778
2001
  ),
1779
2002
 
1780
2003
  fontSmoothing: ({ addUtilities }) => {
@@ -1947,7 +2170,7 @@ export let corePlugins = {
1947
2170
  }
1948
2171
  },
1949
2172
  },
1950
- { values: flattenColorPalette(theme('boxShadowColor')), type: ['color'] }
2173
+ { values: flattenColorPalette(theme('boxShadowColor')), type: ['color', 'any'] }
1951
2174
  )
1952
2175
  },
1953
2176
 
@@ -1961,7 +2184,6 @@ export let corePlugins = {
1961
2184
  '.outline-dashed': { 'outline-style': 'dashed' },
1962
2185
  '.outline-dotted': { 'outline-style': 'dotted' },
1963
2186
  '.outline-double': { 'outline-style': 'double' },
1964
- '.outline-hidden': { 'outline-style': 'hidden' },
1965
2187
  })
1966
2188
  },
1967
2189
 
@@ -1970,7 +2192,8 @@ export let corePlugins = {
1970
2192
  }),
1971
2193
 
1972
2194
  outlineOffset: createUtilityPlugin('outlineOffset', [['outline-offset', ['outline-offset']]], {
1973
- type: ['length', 'number', 'percentage'],
2195
+ type: ['length', 'number', 'percentage', 'any'],
2196
+ supportsNegativeValues: true,
1974
2197
  }),
1975
2198
 
1976
2199
  outlineColor: ({ matchUtilities, theme }) => {
@@ -1980,7 +2203,7 @@ export let corePlugins = {
1980
2203
  return { 'outline-color': toColorValue(value) }
1981
2204
  },
1982
2205
  },
1983
- { values: flattenColorPalette(theme('outlineColor')), type: ['color'] }
2206
+ { values: flattenColorPalette(theme('outlineColor')), type: ['color', 'any'] }
1984
2207
  )
1985
2208
  },
1986
2209
 
@@ -2060,7 +2283,7 @@ export let corePlugins = {
2060
2283
  ([modifier]) => modifier !== 'DEFAULT'
2061
2284
  )
2062
2285
  ),
2063
- type: 'color',
2286
+ type: ['color', 'any'],
2064
2287
  }
2065
2288
  )
2066
2289
  },
@@ -2087,7 +2310,7 @@ export let corePlugins = {
2087
2310
  }
2088
2311
  },
2089
2312
  },
2090
- { values: flattenColorPalette(theme('ringOffsetColor')), type: 'color' }
2313
+ { values: flattenColorPalette(theme('ringOffsetColor')), type: ['color', 'any'] }
2091
2314
  )
2092
2315
  },
2093
2316
 
@@ -358,3 +358,8 @@ video {
358
358
  max-width: 100%;
359
359
  height: auto;
360
360
  }
361
+
362
+ /* Make elements with the HTML hidden attribute stay hidden by default */
363
+ [hidden] {
364
+ display: none;
365
+ }
@@ -3,11 +3,21 @@ import log from './util/log'
3
3
 
4
4
  let defaults = {
5
5
  optimizeUniversalDefaults: false,
6
+ generalizedModifiers: true,
6
7
  }
7
8
 
8
9
  let featureFlags = {
9
- future: ['hoverOnlyWhenSupported', 'respectDefaultRingColorOpacity'],
10
- experimental: ['optimizeUniversalDefaults', 'matchVariant' /* , 'variantGrouping' */],
10
+ future: [
11
+ 'hoverOnlyWhenSupported',
12
+ 'respectDefaultRingColorOpacity',
13
+ 'disableColorOpacityUtilitiesByDefault',
14
+ 'relativeContentPathsByDefault',
15
+ ],
16
+ experimental: [
17
+ 'optimizeUniversalDefaults',
18
+ 'generalizedModifiers',
19
+ // 'variantGrouping',
20
+ ],
11
21
  }
12
22
 
13
23
  export function flagEnabled(config, flag) {
package/src/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import setupTrackingContext from './lib/setupTrackingContext'
2
2
  import processTailwindFeatures from './processTailwindFeatures'
3
3
  import { env } from './lib/sharedState'
4
+ import { findAtConfigPath } from './lib/findAtConfigPath'
4
5
 
5
6
  module.exports = function tailwindcss(configOrPath) {
6
7
  return {
@@ -13,6 +14,10 @@ module.exports = function tailwindcss(configOrPath) {
13
14
  return root
14
15
  },
15
16
  function (root, result) {
17
+ // Use the path for the `@config` directive if it exists, otherwise use the
18
+ // path for the file being processed
19
+ configOrPath = findAtConfigPath(root, result) ?? configOrPath
20
+
16
21
  let context = setupTrackingContext(configOrPath)
17
22
 
18
23
  if (root.type === 'document') {