tailwindcss 3.4.3 → 3.4.5
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/CHANGELOG.md +22 -1
- package/lib/corePlugins.js +41 -13
- package/lib/lib/defaultExtractor.js +22 -2
- package/lib/lib/load-config.js +4 -0
- package/lib/util/dataTypes.js +7 -1
- package/lib/util/normalizeConfig.js +1 -2
- package/lib/util/parseAnimationValue.js +1 -1
- package/lib/util/parseGlob.js +1 -2
- package/lib/util/pluginUtils.js +1 -1
- package/lib/util/resolveConfigPath.js +3 -1
- package/lib/util/splitAtTopLevelOnly.js +1 -5
- package/package.json +1 -1
- package/peers/index.js +2080 -1912
- package/src/corePlugins.js +54 -16
- package/src/lib/defaultExtractor.js +25 -3
- package/src/lib/load-config.ts +11 -0
- package/src/util/dataTypes.js +6 -0
- package/src/util/normalizeConfig.js +1 -3
- package/src/util/parseAnimationValue.js +1 -1
- package/src/util/parseGlob.js +1 -2
- package/src/util/pluginUtils.js +1 -1
- package/src/util/resolveConfigPath.js +2 -0
- package/src/util/splitAtTopLevelOnly.js +1 -5
- package/stubs/config.full.js +1 -1
package/src/corePlugins.js
CHANGED
|
@@ -412,7 +412,7 @@ export let variantPlugins = {
|
|
|
412
412
|
let check = normalize(value)
|
|
413
413
|
let isRaw = /^\w*\s*\(/.test(check)
|
|
414
414
|
|
|
415
|
-
// Chrome has a bug where `(
|
|
415
|
+
// Chrome has a bug where `(condition1)or(condition2)` is not valid
|
|
416
416
|
// But `(condition1) or (condition2)` is supported.
|
|
417
417
|
check = isRaw ? check.replace(/\b(and|or|not)\b/g, ' $1 ') : check
|
|
418
418
|
|
|
@@ -434,23 +434,40 @@ export let variantPlugins = {
|
|
|
434
434
|
)
|
|
435
435
|
},
|
|
436
436
|
|
|
437
|
-
hasVariants: ({ matchVariant }) => {
|
|
438
|
-
matchVariant('has', (value) => `&:has(${normalize(value)})`, {
|
|
437
|
+
hasVariants: ({ matchVariant, prefix }) => {
|
|
438
|
+
matchVariant('has', (value) => `&:has(${normalize(value)})`, {
|
|
439
|
+
values: {},
|
|
440
|
+
[INTERNAL_FEATURES]: {
|
|
441
|
+
respectPrefix: false,
|
|
442
|
+
},
|
|
443
|
+
})
|
|
444
|
+
|
|
439
445
|
matchVariant(
|
|
440
446
|
'group-has',
|
|
441
447
|
(value, { modifier }) =>
|
|
442
448
|
modifier
|
|
443
|
-
? `:merge(.group\\/${modifier}):has(${normalize(value)}) &`
|
|
444
|
-
: `:merge(.group):has(${normalize(value)}) &`,
|
|
445
|
-
{
|
|
449
|
+
? `:merge(${prefix('.group')}\\/${modifier}):has(${normalize(value)}) &`
|
|
450
|
+
: `:merge(${prefix('.group')}):has(${normalize(value)}) &`,
|
|
451
|
+
{
|
|
452
|
+
values: {},
|
|
453
|
+
[INTERNAL_FEATURES]: {
|
|
454
|
+
respectPrefix: false,
|
|
455
|
+
},
|
|
456
|
+
}
|
|
446
457
|
)
|
|
458
|
+
|
|
447
459
|
matchVariant(
|
|
448
460
|
'peer-has',
|
|
449
461
|
(value, { modifier }) =>
|
|
450
462
|
modifier
|
|
451
|
-
? `:merge(.peer\\/${modifier}):has(${normalize(value)}) ~ &`
|
|
452
|
-
: `:merge(.peer):has(${normalize(value)}) ~ &`,
|
|
453
|
-
{
|
|
463
|
+
? `:merge(${prefix('.peer')}\\/${modifier}):has(${normalize(value)}) ~ &`
|
|
464
|
+
: `:merge(${prefix('.peer')}):has(${normalize(value)}) ~ &`,
|
|
465
|
+
{
|
|
466
|
+
values: {},
|
|
467
|
+
[INTERNAL_FEATURES]: {
|
|
468
|
+
respectPrefix: false,
|
|
469
|
+
},
|
|
470
|
+
}
|
|
454
471
|
)
|
|
455
472
|
},
|
|
456
473
|
|
|
@@ -724,11 +741,19 @@ export let corePlugins = {
|
|
|
724
741
|
zIndex: createUtilityPlugin('zIndex', [['z', ['zIndex']]], { supportsNegativeValues: true }),
|
|
725
742
|
order: createUtilityPlugin('order', undefined, { supportsNegativeValues: true }),
|
|
726
743
|
gridColumn: createUtilityPlugin('gridColumn', [['col', ['gridColumn']]]),
|
|
727
|
-
gridColumnStart: createUtilityPlugin('gridColumnStart', [['col-start', ['gridColumnStart']]]
|
|
728
|
-
|
|
744
|
+
gridColumnStart: createUtilityPlugin('gridColumnStart', [['col-start', ['gridColumnStart']]], {
|
|
745
|
+
supportsNegativeValues: true,
|
|
746
|
+
}),
|
|
747
|
+
gridColumnEnd: createUtilityPlugin('gridColumnEnd', [['col-end', ['gridColumnEnd']]], {
|
|
748
|
+
supportsNegativeValues: true,
|
|
749
|
+
}),
|
|
729
750
|
gridRow: createUtilityPlugin('gridRow', [['row', ['gridRow']]]),
|
|
730
|
-
gridRowStart: createUtilityPlugin('gridRowStart', [['row-start', ['gridRowStart']]]
|
|
731
|
-
|
|
751
|
+
gridRowStart: createUtilityPlugin('gridRowStart', [['row-start', ['gridRowStart']]], {
|
|
752
|
+
supportsNegativeValues: true,
|
|
753
|
+
}),
|
|
754
|
+
gridRowEnd: createUtilityPlugin('gridRowEnd', [['row-end', ['gridRowEnd']]], {
|
|
755
|
+
supportsNegativeValues: true,
|
|
756
|
+
}),
|
|
732
757
|
|
|
733
758
|
float: ({ addUtilities }) => {
|
|
734
759
|
addUtilities({
|
|
@@ -2571,7 +2596,7 @@ export let corePlugins = {
|
|
|
2571
2596
|
{
|
|
2572
2597
|
blur: (value) => {
|
|
2573
2598
|
return {
|
|
2574
|
-
'--tw-blur': `blur(${value})`,
|
|
2599
|
+
'--tw-blur': value.trim() === '' ? ' ' : `blur(${value})`,
|
|
2575
2600
|
'@defaults filter': {},
|
|
2576
2601
|
filter: cssFilterValue,
|
|
2577
2602
|
}
|
|
@@ -2726,8 +2751,9 @@ export let corePlugins = {
|
|
|
2726
2751
|
{
|
|
2727
2752
|
'backdrop-blur': (value) => {
|
|
2728
2753
|
return {
|
|
2729
|
-
'--tw-backdrop-blur': `blur(${value})`,
|
|
2754
|
+
'--tw-backdrop-blur': value.trim() === '' ? ' ' : `blur(${value})`,
|
|
2730
2755
|
'@defaults backdrop-filter': {},
|
|
2756
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2731
2757
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2732
2758
|
}
|
|
2733
2759
|
},
|
|
@@ -2743,6 +2769,7 @@ export let corePlugins = {
|
|
|
2743
2769
|
return {
|
|
2744
2770
|
'--tw-backdrop-brightness': `brightness(${value})`,
|
|
2745
2771
|
'@defaults backdrop-filter': {},
|
|
2772
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2746
2773
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2747
2774
|
}
|
|
2748
2775
|
},
|
|
@@ -2758,6 +2785,7 @@ export let corePlugins = {
|
|
|
2758
2785
|
return {
|
|
2759
2786
|
'--tw-backdrop-contrast': `contrast(${value})`,
|
|
2760
2787
|
'@defaults backdrop-filter': {},
|
|
2788
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2761
2789
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2762
2790
|
}
|
|
2763
2791
|
},
|
|
@@ -2773,6 +2801,7 @@ export let corePlugins = {
|
|
|
2773
2801
|
return {
|
|
2774
2802
|
'--tw-backdrop-grayscale': `grayscale(${value})`,
|
|
2775
2803
|
'@defaults backdrop-filter': {},
|
|
2804
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2776
2805
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2777
2806
|
}
|
|
2778
2807
|
},
|
|
@@ -2788,6 +2817,7 @@ export let corePlugins = {
|
|
|
2788
2817
|
return {
|
|
2789
2818
|
'--tw-backdrop-hue-rotate': `hue-rotate(${value})`,
|
|
2790
2819
|
'@defaults backdrop-filter': {},
|
|
2820
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2791
2821
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2792
2822
|
}
|
|
2793
2823
|
},
|
|
@@ -2803,6 +2833,7 @@ export let corePlugins = {
|
|
|
2803
2833
|
return {
|
|
2804
2834
|
'--tw-backdrop-invert': `invert(${value})`,
|
|
2805
2835
|
'@defaults backdrop-filter': {},
|
|
2836
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2806
2837
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2807
2838
|
}
|
|
2808
2839
|
},
|
|
@@ -2818,6 +2849,7 @@ export let corePlugins = {
|
|
|
2818
2849
|
return {
|
|
2819
2850
|
'--tw-backdrop-opacity': `opacity(${value})`,
|
|
2820
2851
|
'@defaults backdrop-filter': {},
|
|
2852
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2821
2853
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2822
2854
|
}
|
|
2823
2855
|
},
|
|
@@ -2833,6 +2865,7 @@ export let corePlugins = {
|
|
|
2833
2865
|
return {
|
|
2834
2866
|
'--tw-backdrop-saturate': `saturate(${value})`,
|
|
2835
2867
|
'@defaults backdrop-filter': {},
|
|
2868
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2836
2869
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2837
2870
|
}
|
|
2838
2871
|
},
|
|
@@ -2848,6 +2881,7 @@ export let corePlugins = {
|
|
|
2848
2881
|
return {
|
|
2849
2882
|
'--tw-backdrop-sepia': `sepia(${value})`,
|
|
2850
2883
|
'@defaults backdrop-filter': {},
|
|
2884
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2851
2885
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2852
2886
|
}
|
|
2853
2887
|
},
|
|
@@ -2871,9 +2905,13 @@ export let corePlugins = {
|
|
|
2871
2905
|
addUtilities({
|
|
2872
2906
|
'.backdrop-filter': {
|
|
2873
2907
|
'@defaults backdrop-filter': {},
|
|
2908
|
+
'-webkit-backdrop-filter': cssBackdropFilterValue,
|
|
2874
2909
|
'backdrop-filter': cssBackdropFilterValue,
|
|
2875
2910
|
},
|
|
2876
|
-
'.backdrop-filter-none': {
|
|
2911
|
+
'.backdrop-filter-none': {
|
|
2912
|
+
'-webkit-backdrop-filter': 'none',
|
|
2913
|
+
'backdrop-filter': 'none',
|
|
2914
|
+
},
|
|
2877
2915
|
})
|
|
2878
2916
|
},
|
|
2879
2917
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as regex from './regex'
|
|
2
|
+
import { splitAtTopLevelOnly } from '../util/splitAtTopLevelOnly'
|
|
2
3
|
|
|
3
4
|
export function defaultExtractor(context) {
|
|
4
5
|
let patterns = Array.from(buildRegExps(context))
|
|
@@ -16,6 +17,30 @@ export function defaultExtractor(context) {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
// Extract any subclasses from languages like Slim and Pug, eg:
|
|
21
|
+
// div.flex.px-5.underline
|
|
22
|
+
for (let result of results.slice()) {
|
|
23
|
+
let segments = splitAtTopLevelOnly(result, '.')
|
|
24
|
+
|
|
25
|
+
for (let idx = 0; idx < segments.length; idx++) {
|
|
26
|
+
let segment = segments[idx]
|
|
27
|
+
if (idx >= segments.length - 1) {
|
|
28
|
+
results.push(segment)
|
|
29
|
+
continue
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// If the next segment is a number, discard both, for example seeing
|
|
33
|
+
// `px-1` and `5` means the real candidate was `px-1.5` which is already
|
|
34
|
+
// captured.
|
|
35
|
+
let next = parseInt(segments[idx + 1])
|
|
36
|
+
if (isNaN(next)) {
|
|
37
|
+
results.push(segment)
|
|
38
|
+
} else {
|
|
39
|
+
idx++
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
19
44
|
return results
|
|
20
45
|
}
|
|
21
46
|
}
|
|
@@ -127,9 +152,6 @@ function* buildRegExps(context) {
|
|
|
127
152
|
utility,
|
|
128
153
|
])
|
|
129
154
|
}
|
|
130
|
-
|
|
131
|
-
// 5. Inner matches
|
|
132
|
-
yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g
|
|
133
155
|
}
|
|
134
156
|
|
|
135
157
|
// We want to capture any "special" characters
|
package/src/lib/load-config.ts
CHANGED
|
@@ -33,6 +33,17 @@ function lazyJiti() {
|
|
|
33
33
|
|
|
34
34
|
export function loadConfig(path: string): Config {
|
|
35
35
|
let config = (function () {
|
|
36
|
+
// Always use jiti for ESM or TS files
|
|
37
|
+
if (
|
|
38
|
+
path &&
|
|
39
|
+
(path.endsWith('.mjs') ||
|
|
40
|
+
path.endsWith('.ts') ||
|
|
41
|
+
path.endsWith('.cts') ||
|
|
42
|
+
path.endsWith('.mts'))
|
|
43
|
+
) {
|
|
44
|
+
return lazyJiti()(path)
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
try {
|
|
37
48
|
return path ? require(path) : {}
|
|
38
49
|
} catch {
|
package/src/util/dataTypes.js
CHANGED
|
@@ -19,6 +19,7 @@ function isCSSFunction(value) {
|
|
|
19
19
|
// More info:
|
|
20
20
|
// - https://drafts.csswg.org/scroll-animations/#propdef-timeline-scope
|
|
21
21
|
// - https://developer.mozilla.org/en-US/docs/Web/CSS/timeline-scope#dashed-ident
|
|
22
|
+
// - https://www.w3.org/TR/css-anchor-position-1
|
|
22
23
|
//
|
|
23
24
|
const AUTO_VAR_INJECTION_EXCEPTIONS = new Set([
|
|
24
25
|
// Concrete properties
|
|
@@ -26,11 +27,16 @@ const AUTO_VAR_INJECTION_EXCEPTIONS = new Set([
|
|
|
26
27
|
'timeline-scope',
|
|
27
28
|
'view-timeline-name',
|
|
28
29
|
'font-palette',
|
|
30
|
+
'anchor-name',
|
|
31
|
+
'anchor-scope',
|
|
32
|
+
'position-anchor',
|
|
33
|
+
'position-try-options',
|
|
29
34
|
|
|
30
35
|
// Shorthand properties
|
|
31
36
|
'scroll-timeline',
|
|
32
37
|
'animation-timeline',
|
|
33
38
|
'view-timeline',
|
|
39
|
+
'position-try',
|
|
34
40
|
])
|
|
35
41
|
|
|
36
42
|
// This is not a data type, but rather a function that can normalize the
|
|
@@ -274,9 +274,7 @@ export function normalizeConfig(config) {
|
|
|
274
274
|
|
|
275
275
|
if (typeof transform === 'function') {
|
|
276
276
|
transformers.DEFAULT = transform
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (typeof transform === 'object' && transform !== null) {
|
|
277
|
+
} else if (typeof transform === 'object' && transform !== null) {
|
|
280
278
|
Object.assign(transformers, transform)
|
|
281
279
|
}
|
|
282
280
|
|
|
@@ -13,7 +13,7 @@ const TIMINGS = new Set([
|
|
|
13
13
|
])
|
|
14
14
|
const TIMING_FNS = ['cubic-bezier', 'steps']
|
|
15
15
|
|
|
16
|
-
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `
|
|
16
|
+
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubic-bezier(a, b, c)` these don't count.
|
|
17
17
|
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
18
18
|
const TIME = /^(-?[\d.]+m?s)$/
|
|
19
19
|
const DIGIT = /^(\d+)$/
|
package/src/util/parseGlob.js
CHANGED
package/src/util/pluginUtils.js
CHANGED
|
@@ -124,7 +124,7 @@ export function parseColorFormat(value) {
|
|
|
124
124
|
if (typeof value === 'string' && value.includes('<alpha-value>')) {
|
|
125
125
|
let oldValue = value
|
|
126
126
|
|
|
127
|
-
return ({ opacityValue = 1 }) => oldValue.replace(
|
|
127
|
+
return ({ opacityValue = 1 }) => oldValue.replace(/<alpha-value>/g, opacityValue)
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
return value
|
|
@@ -29,11 +29,7 @@ export function splitAtTopLevelOnly(input, separator) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
isEscaped = false
|
|
34
|
-
} else if (char === '\\') {
|
|
35
|
-
isEscaped = true
|
|
36
|
-
}
|
|
32
|
+
isEscaped = isEscaped ? false : char === '\\'
|
|
37
33
|
|
|
38
34
|
if (char === '(' || char === '[' || char === '{') {
|
|
39
35
|
stack.push(char)
|