Skip to content

Commit e40079a

Browse files
committed
Fix cascading shadow/ring bug, ensure default ring color
1 parent 5e50367 commit e40079a

8 files changed

+78
-1727
lines changed

__tests__/fixtures/tailwind-output-flagged.css

+10-429
Large diffs are not rendered by default.

__tests__/fixtures/tailwind-output-important.css

+13-432
Large diffs are not rendered by default.

__tests__/fixtures/tailwind-output-no-color-opacity.css

+10-429
Large diffs are not rendered by default.

__tests__/fixtures/tailwind-output.css

+10-429
Large diffs are not rendered by default.

__tests__/plugins/boxShadow.test.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,25 @@ test('box shadow can use DEFAULT keyword and negative prefix syntax', () => {
3131

3232
return getConfigValue(`variants.${path}`, defaultValue)
3333
},
34-
addUtilities(utilities, variants) {
34+
addUtilities(utilities, options) {
3535
addedUtilities.push({
3636
utilities,
37-
variants,
37+
options,
3838
})
3939
},
4040
}
4141

4242
plugin()(pluginApi)
4343

4444
expect(addedUtilities).toEqual([
45+
{
46+
utilities: {
47+
'*': {
48+
'--tw-shadow': '0 0 #0000',
49+
},
50+
},
51+
options: { respectImportant: false },
52+
},
4553
{
4654
utilities: {
4755
'.shadow': {
@@ -65,7 +73,7 @@ test('box shadow can use DEFAULT keyword and negative prefix syntax', () => {
6573
'var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)',
6674
},
6775
},
68-
variants: ['responsive'],
76+
options: ['responsive'],
6977
},
7078
])
7179
})

src/plugins/boxShadow.js

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ import nameClass from '../util/nameClass'
33

44
export default function () {
55
return function ({ addUtilities, theme, variants }) {
6+
addUtilities(
7+
{
8+
'*': {
9+
'--tw-shadow': '0 0 #0000',
10+
},
11+
},
12+
{ respectImportant: false }
13+
)
14+
615
const utilities = _.fromPairs(
716
_.map(theme('boxShadow'), (value, modifier) => {
817
return [

src/plugins/ringWidth.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,25 @@ export default function () {
1616
return `rgba(${r}, ${g}, ${b}, ${theme('ringOpacity.DEFAULT', '0.5')})`
1717
})(safeCall(() => toRgba(theme('ringColor.DEFAULT')), ['147', '197', '253']))
1818

19+
addUtilities(
20+
{
21+
'*': {
22+
'--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
23+
'--tw-ring-offset-width': '0px',
24+
'--tw-ring-offset-color': '#fff',
25+
'--tw-ring-color': ringColorDefault,
26+
'--tw-ring-offset-shadow': '0 0 #0000',
27+
'--tw-ring-shadow': '0 0 #0000',
28+
},
29+
},
30+
{ respectImportant: false }
31+
)
32+
1933
const utilities = _.fromPairs(
2034
_.map(theme('ringWidth'), (value, modifier) => {
2135
return [
2236
nameClass('ring', modifier),
2337
{
24-
'--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
25-
'--tw-ring-offset-width': '0px',
26-
'--tw-ring-offset-color': '#fff',
27-
'--tw-ring-color': ringColorDefault,
2838
'--tw-ring-offset-shadow': `var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)`,
2939
'--tw-ring-shadow': `var(--tw-ring-inset) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color)`,
3040
'box-shadow': [

stubs/defaultConfig.stub.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ module.exports = {
535535
placeholderColor: (theme) => theme('colors'),
536536
placeholderOpacity: (theme) => theme('opacity'),
537537
ringColor: (theme) => ({
538-
DEFAULT: theme('colors.blue.500'),
538+
DEFAULT: theme('colors.blue.500', '#3b82f6'),
539539
...theme('colors'),
540540
}),
541541
ringOffsetColor: (theme) => theme('colors'),

0 commit comments

Comments
 (0)