const _ = require("lodash");

const plugin = require("tailwindcss/plugin");

module.exports = plugin(function ({
  addUtilities,
  e,
  theme,
  variants
}) {
  const textShadow = theme("textShadow", {});

  const utilities = _.fromPairs(_.map(textShadow, (value, modifier) => {
    const className = modifier.toUpperCase() === "DEFAULT" ? "text-shadow" : `${e(`text-shadow-${modifier}`)}`;
    return [`.${className}`, {
      "text-shadow": value
    }];
  }));

  addUtilities([utilities], variants("textShadow"));
});