diff --git a/src/corePlugins.js b/src/corePlugins.js index 913f4226524c..44759d73cc93 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -1790,17 +1790,36 @@ export let corePlugins = { } })(), - outline: ({ matchUtilities, theme }) => { + outlineStyle: ({ addUtilities }) => { + addUtilities({ + '.outline-none': { + outline: '2px solid transparent', + 'outline-offset': '2px', + }, + '.outline': { 'outline-style': 'solid' }, + '.outline-dashed': { 'outline-style': 'dashed' }, + '.outline-dotted': { 'outline-style': 'dotted' }, + '.outline-double': { 'outline-style': 'double' }, + '.outline-hidden': { 'outline-style': 'hidden' }, + }) + }, + + outlineWidth: createUtilityPlugin('outlineWidth', [['outline', ['outline-width']]], { + type: ['length', 'number', 'percentage'], + }), + + outlineOffset: createUtilityPlugin('outlineOffset', [['outline-offset', ['outline-offset']]], { + type: ['length', 'number', 'percentage'], + }), + + outlineColor: ({ matchUtilities, theme }) => { matchUtilities( { outline: (value) => { - value = Array.isArray(value) ? value : value.split(',') - let [outline, outlineOffset = '0'] = Array.isArray(value) ? value : [value] - - return { outline, 'outline-offset': outlineOffset } + return { 'outline-color': toColorValue(value) } }, }, - { values: theme('outline') } + { values: flattenColorPalette(theme('outlineColor')), type: ['color'] } ) }, diff --git a/stubs/defaultConfig.stub.js b/stubs/defaultConfig.stub.js index 00257df22ff3..fb86c38e95f8 100644 --- a/stubs/defaultConfig.stub.js +++ b/stubs/defaultConfig.stub.js @@ -697,14 +697,24 @@ module.exports = { 11: '11', 12: '12', }, - outline: { - none: ['2px solid transparent', '2px'], - white: ['2px dotted white', '2px'], - black: ['2px dotted black', '2px'], - }, padding: ({ theme }) => theme('spacing'), placeholderColor: ({ theme }) => theme('colors'), placeholderOpacity: ({ theme }) => theme('opacity'), + outlineColor: ({ theme }) => theme('colors'), + outlineOffset: { + 0: '0px', + 1: '1px', + 2: '2px', + 4: '4px', + 8: '8px', + }, + outlineWidth: { + 0: '0px', + 1: '1px', + 2: '2px', + 4: '4px', + 8: '8px', + }, ringColor: ({ theme }) => ({ DEFAULT: theme('colors.blue.500', '#3b82f6'), ...theme('colors'), diff --git a/tests/arbitrary-values.test.css b/tests/arbitrary-values.test.css index 0ecb0c57e4de..8267ef0f2549 100644 --- a/tests/arbitrary-values.test.css +++ b/tests/arbitrary-values.test.css @@ -859,25 +859,20 @@ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); } -.outline-\[2px_solid_black\] { - outline: 2px solid black; - outline-offset: 0; +.outline-\[10px\] { + outline-width: 10px; } -.outline-\[2px_solid_black\2c 2px\] { - outline: 2px solid black; - outline-offset: 2px; +.outline-\[length\:var\(--outline\)\] { + outline-width: var(--outline); } -.outline-\[var\(--outline\)\] { - outline: var(--outline); - outline-offset: 0; +.outline-offset-\[10px\] { + outline-offset: 10px; } -.outline-\[var\(--outline\)\2c 3px\] { - outline: var(--outline); - outline-offset: 3px; +.outline-\[black\] { + outline-color: black; } -.outline-\[2px_solid_black\2c var\(--outline-offset\)\] { - outline: 2px solid black; - outline-offset: var(--outline-offset); +.outline-\[color\:var\(--outline\)\] { + outline-color: var(--outline); } .ring-\[10px\] { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) diff --git a/tests/arbitrary-values.test.html b/tests/arbitrary-values.test.html index 910de55262d4..75b42c813883 100644 --- a/tests/arbitrary-values.test.html +++ b/tests/arbitrary-values.test.html @@ -321,11 +321,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/tests/basic-usage.test.css b/tests/basic-usage.test.css index 93db9310ff6b..a1b78fc5f8b3 100644 --- a/tests/basic-usage.test.css +++ b/tests/basic-usage.test.css @@ -825,10 +825,21 @@ outline: 2px solid transparent; outline-offset: 2px; } -.outline-black { - outline: 2px dotted black; +.outline { + outline-style: solid; +} +.outline-dashed { + outline-style: dashed; +} +.outline-4 { + outline-width: 4px; +} +.outline-offset-2 { outline-offset: 2px; } +.outline-black { + outline-color: #000; +} .ring { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); diff --git a/tests/basic-usage.test.html b/tests/basic-usage.test.html index 5d580909cec2..61d22dcf5d71 100644 --- a/tests/basic-usage.test.html +++ b/tests/basic-usage.test.html @@ -97,7 +97,7 @@
-
+
diff --git a/tests/raw-content.test.css b/tests/raw-content.test.css index 79c3cb495749..f9b921d50c61 100644 --- a/tests/raw-content.test.css +++ b/tests/raw-content.test.css @@ -595,14 +595,6 @@ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); } -.outline-none { - outline: 2px solid transparent; - outline-offset: 2px; -} -.outline-black { - outline: 2px dotted black; - outline-offset: 2px; -} .ring { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); diff --git a/tests/raw-content.test.html b/tests/raw-content.test.html index 2cb65ed46810..e6d71b137aed 100644 --- a/tests/raw-content.test.html +++ b/tests/raw-content.test.html @@ -93,7 +93,6 @@
-