diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2025-11-24 20:54:57 +0100 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2025-11-24 20:57:48 +0100 |
| commit | b1e2c8fd5cb5dfa46bc440a12eafaf56cd844b1c (patch) | |
| tree | 49d360fd6cbc6a2754efe93524ac47ff0fbe0f7d /node_modules/tailwindcss/lib/util/createUtilityPlugin.js | |
Docs
Diffstat (limited to 'node_modules/tailwindcss/lib/util/createUtilityPlugin.js')
| -rw-r--r-- | node_modules/tailwindcss/lib/util/createUtilityPlugin.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/node_modules/tailwindcss/lib/util/createUtilityPlugin.js b/node_modules/tailwindcss/lib/util/createUtilityPlugin.js new file mode 100644 index 0000000..5483e13 --- /dev/null +++ b/node_modules/tailwindcss/lib/util/createUtilityPlugin.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function() { + return createUtilityPlugin; + } +}); +const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("./transformThemeValue")); +function _interop_require_default(obj) { + return obj && obj.__esModule ? obj : { + default: obj + }; +} +function createUtilityPlugin(themeKey, utilityVariations = [ + [ + themeKey, + [ + themeKey + ] + ] +], { filterDefault =false , ...options } = {}) { + let transformValue = (0, _transformThemeValue.default)(themeKey); + return function({ matchUtilities , theme }) { + for (let utilityVariation of utilityVariations){ + let group = Array.isArray(utilityVariation[0]) ? utilityVariation : [ + utilityVariation + ]; + var _theme; + matchUtilities(group.reduce((obj, [classPrefix, properties])=>{ + return Object.assign(obj, { + [classPrefix]: (value)=>{ + return properties.reduce((obj, name)=>{ + if (Array.isArray(name)) { + return Object.assign(obj, { + [name[0]]: name[1] + }); + } + return Object.assign(obj, { + [name]: transformValue(value) + }); + }, {}); + } + }); + }, {}), { + ...options, + values: filterDefault ? Object.fromEntries(Object.entries((_theme = theme(themeKey)) !== null && _theme !== void 0 ? _theme : {}).filter(([modifier])=>modifier !== "DEFAULT")) : theme(themeKey) + }); + } + }; +} |