tailwindcss 3.1.7 → 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.
- package/README.md +12 -8
- package/lib/cli/build/deps.js +54 -0
- package/lib/cli/build/index.js +44 -0
- package/lib/cli/build/plugin.js +335 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +113 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +18 -0
- package/lib/cli/init/index.js +46 -0
- package/lib/cli/shared.js +12 -0
- package/lib/cli.js +11 -590
- package/lib/corePlugins.js +332 -108
- package/lib/css/preflight.css +5 -0
- package/lib/featureFlags.js +7 -4
- package/lib/index.js +6 -1
- package/lib/lib/content.js +167 -0
- package/lib/lib/defaultExtractor.js +15 -10
- package/lib/lib/detectNesting.js +2 -2
- package/lib/lib/evaluateTailwindFunctions.js +17 -1
- package/lib/lib/expandApplyAtRules.js +71 -37
- package/lib/lib/expandTailwindAtRules.js +10 -42
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +181 -96
- package/lib/lib/normalizeTailwindDirectives.js +1 -1
- package/lib/lib/offsets.js +217 -0
- package/lib/lib/regex.js +1 -1
- package/lib/lib/setupContextUtils.js +339 -100
- package/lib/lib/setupTrackingContext.js +5 -39
- package/lib/lib/sharedState.js +2 -0
- package/lib/public/colors.js +1 -1
- package/lib/util/buildMediaQuery.js +6 -3
- package/lib/util/configurePlugins.js +1 -1
- package/lib/util/dataTypes.js +15 -19
- package/lib/util/formatVariantSelector.js +92 -8
- package/lib/util/getAllConfigs.js +14 -3
- package/lib/util/isValidArbitraryValue.js +1 -1
- package/lib/util/nameClass.js +3 -0
- package/lib/util/negateValue.js +15 -2
- package/lib/util/normalizeConfig.js +17 -3
- package/lib/util/normalizeScreens.js +100 -3
- package/lib/util/parseAnimationValue.js +1 -1
- package/lib/util/parseBoxShadowValue.js +1 -1
- package/lib/util/parseDependency.js +33 -54
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +1 -1
- package/lib/util/pluginUtils.js +86 -17
- package/lib/util/resolveConfig.js +3 -3
- package/lib/util/splitAtTopLevelOnly.js +31 -81
- package/lib/util/transformThemeValue.js +9 -2
- package/lib/util/validateConfig.js +1 -1
- package/lib/util/validateFormalSyntax.js +24 -0
- package/package.json +14 -12
- package/peers/.DS_Store +0 -0
- package/peers/.svgo.yml +75 -0
- package/peers/index.js +3690 -2274
- package/peers/orders/concentric-css.json +299 -0
- package/peers/orders/smacss.json +299 -0
- package/peers/orders/source.json +295 -0
- package/plugin.d.ts +3 -3
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/src/.DS_Store +0 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +45 -0
- package/src/cli/build/plugin.js +397 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +134 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +3 -0
- package/src/cli/init/index.js +50 -0
- package/src/cli/shared.js +5 -0
- package/src/cli.js +4 -696
- package/src/corePlugins.js +262 -39
- package/src/css/preflight.css +5 -0
- package/src/featureFlags.js +12 -2
- package/src/index.js +5 -0
- package/src/lib/content.js +205 -0
- package/src/lib/defaultExtractor.js +3 -0
- package/src/lib/evaluateTailwindFunctions.js +22 -1
- package/src/lib/expandApplyAtRules.js +76 -29
- package/src/lib/expandTailwindAtRules.js +8 -46
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +224 -105
- package/src/lib/offsets.js +270 -0
- package/src/lib/setupContextUtils.js +376 -89
- package/src/lib/setupTrackingContext.js +4 -45
- package/src/lib/sharedState.js +2 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/dataTypes.js +15 -17
- package/src/util/formatVariantSelector.js +113 -9
- package/src/util/getAllConfigs.js +14 -2
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +10 -2
- package/src/util/normalizeConfig.js +22 -2
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +1 -1
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +90 -14
- package/src/util/resolveConfig.js +2 -2
- package/src/util/splitAtTopLevelOnly.js +23 -49
- package/src/util/transformThemeValue.js +9 -1
- package/src/util/validateFormalSyntax.js +34 -0
- package/stubs/defaultConfig.stub.js +19 -3
- package/tmp.css +11 -0
- package/tmp.dependency-graph.js +2 -0
- package/tmp.in.css +3 -0
- package/tmp.js +0 -0
- package/tmp.out.css +524 -0
- package/types/config.d.ts +47 -13
- package/types/generated/default-theme.d.ts +11 -0
- package/CHANGELOG.md +0 -2222
package/src/corePlugins.js
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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 [
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
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
|
-
|
|
212
|
-
|
|
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
|
-
|
|
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:
|
|
1608
|
-
|
|
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
|
|
package/src/css/preflight.css
CHANGED
package/src/featureFlags.js
CHANGED
|
@@ -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: [
|
|
10
|
-
|
|
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') {
|