From 87da0a1266646a6b88808b0d37bebbebdb32670b Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 24 Sep 2021 16:55:24 +0200 Subject: [PATCH] simplify `inset` plugin --- src/corePlugins.js | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/src/corePlugins.js b/src/corePlugins.js index e801e4624e68..930b5433bb2e 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -520,35 +520,19 @@ export let position = ({ addUtilities }) => { }) } -export let inset = ({ matchUtilities, theme }) => { - let options = { - values: theme('inset'), - type: 'any', - } - - matchUtilities( - { inset: (value) => ({ top: value, right: value, bottom: value, left: value }) }, - options - ) - - matchUtilities( - { - 'inset-x': (value) => ({ left: value, right: value }), - 'inset-y': (value) => ({ top: value, bottom: value }), - }, - options - ) - - matchUtilities( - { - top: (top) => ({ top }), - right: (right) => ({ right }), - bottom: (bottom) => ({ bottom }), - left: (left) => ({ left }), - }, - options - ) -} +export let inset = createUtilityPlugin('inset', [ + ['inset', ['top', 'right', 'bottom', 'left']], + [ + ['inset-x', ['left', 'right']], + ['inset-y', ['top', 'bottom']], + ], + [ + ['top', ['top']], + ['right', ['right']], + ['bottom', ['bottom']], + ['left', ['left']], + ], +]) export let isolation = ({ addUtilities }) => { addUtilities({