This commit is contained in:
Aevann1 2021-12-13 22:28:32 +00:00
parent 628618df89
commit e031240dff
3749 changed files with 1120848 additions and 1 deletions

20
node_modules/tailwindcss/lib/cli-peer-dependencies.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.lazyAutoprefixer = lazyAutoprefixer;
exports.lazyCssnano = lazyCssnano;
exports.postcss = void 0;
let postcss = require('postcss');
exports.postcss = postcss;
function lazyAutoprefixer() {
return require('autoprefixer');
}
function lazyCssnano() {
return require('cssnano');
}

798
node_modules/tailwindcss/lib/cli.js generated vendored Executable file
View file

@ -0,0 +1,798 @@
#!/usr/bin/env node
"use strict";
var _index = require("../peers/index.js");
var _chokidar = _interopRequireDefault(require("chokidar"));
var _path = _interopRequireDefault(require("path"));
var _arg = _interopRequireDefault(require("arg"));
var _fs = _interopRequireDefault(require("fs"));
var _postcssLoadConfig = _interopRequireDefault(require("postcss-load-config"));
var _cosmiconfig = require("cosmiconfig");
var _plugins = _interopRequireDefault(require("postcss-load-config/src/plugins"));
var _processTailwindFeatures = _interopRequireDefault(require("./jit/processTailwindFeatures"));
var _processTailwindFeatures2 = _interopRequireDefault(require("./processTailwindFeatures"));
var _resolveConfig = _interopRequireDefault(require("../resolveConfig"));
var _fastGlob = _interopRequireDefault(require("fast-glob"));
var _getModuleDependencies = _interopRequireDefault(require("./lib/getModuleDependencies"));
var _package = _interopRequireDefault(require("../package.json"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Little bit scary, looking at private/internal API
let env = {
DEBUG: process.env.DEBUG !== undefined
}; // ---
function indentRecursive(node, indent = 0) {
node.each && node.each((child, i) => {
if (!child.raws.before || !child.raws.before.trim() || child.raws.before.includes('\n')) {
child.raws.before = `\n${node.type !== 'rule' && i > 0 ? '\n' : ''}${' '.repeat(indent)}`;
}
child.raws.after = `\n${' '.repeat(indent)}`;
indentRecursive(child, indent + 1);
});
}
function formatNodes(root) {
indentRecursive(root);
if (root.first) {
root.first.raws.before = '';
}
}
function help({
message,
usage,
commands,
options
}) {
let indent = 2; // Render header
console.log();
console.log(`${_package.default.name} v${_package.default.version}`); // Render message
if (message) {
console.log();
for (let msg of message.split('\n')) {
console.log(msg);
}
} // Render usage
if (usage && usage.length > 0) {
console.log();
console.log('Usage:');
for (let example of usage) {
console.log(' '.repeat(indent), example);
}
} // Render commands
if (commands && commands.length > 0) {
console.log();
console.log('Commands:');
for (let command of commands) {
console.log(' '.repeat(indent), command);
}
} // Render options
if (options) {
let groupedOptions = {};
for (let [key, value] of Object.entries(options)) {
if (typeof value === 'object') {
groupedOptions[key] = { ...value,
flags: [key]
};
} else {
groupedOptions[value].flags.push(key);
}
}
console.log();
console.log('Options:');
for (let {
flags,
description
} of Object.values(groupedOptions)) {
if (flags.length === 1) {
console.log(' '.repeat(indent + 4
/* 4 = "-i, ".length */
), flags.slice().reverse().join(', ').padEnd(20, ' '), description);
} else {
console.log(' '.repeat(indent), flags.slice().reverse().join(', ').padEnd(24, ' '), description);
}
}
}
console.log();
}
function oneOf(...options) {
return Object.assign((value = true) => {
for (let option of options) {
let parsed = option(value);
if (parsed === value) {
return parsed;
}
}
throw new Error('...');
}, {
manualParsing: true
});
}
let commands = {
init: {
run: init,
args: {
'--jit': {
type: Boolean,
description: 'Initialize for JIT mode'
},
'--full': {
type: Boolean,
description: 'Initialize a full `tailwind.config.js` file'
},
'--postcss': {
type: Boolean,
description: 'Initialize a `postcss.config.js` file'
},
'-f': '--full',
'-p': '--postcss'
}
},
build: {
run: build,
args: {
'--input': {
type: String,
description: 'Input file'
},
'--output': {
type: String,
description: 'Output file'
},
'--watch': {
type: Boolean,
description: 'Watch for changes and rebuild as needed'
},
'--jit': {
type: Boolean,
description: 'Build using JIT mode'
},
'--purge': {
type: String,
description: 'Content paths to use for removing unused classes'
},
'--postcss': {
type: oneOf(String, Boolean),
description: 'Load custom PostCSS configuration'
},
'--minify': {
type: Boolean,
description: 'Minify the output'
},
'--config': {
type: String,
description: 'Path to a custom config file'
},
'--no-autoprefixer': {
type: Boolean,
description: 'Disable autoprefixer'
},
'-c': '--config',
'-i': '--input',
'-o': '--output',
'-m': '--minify',
'-w': '--watch'
}
}
};
let sharedFlags = {
'--help': {
type: Boolean,
description: 'Display usage information'
},
'-h': '--help'
};
if (process.stdout.isTTY
/* Detect redirecting output to a file */
&& (process.argv[2] === undefined || process.argv.slice(2).every(flag => sharedFlags[flag] !== undefined))) {
help({
usage: ['tailwindcss [--input input.css] [--output output.css] [--watch] [options...]', 'tailwindcss init [--full] [--postcss] [options...]'],
commands: Object.keys(commands).filter(command => command !== 'build').map(command => `${command} [options]`),
options: { ...commands.build.args,
...sharedFlags
}
});
process.exit(0);
}
let command = ((arg = '') => arg.startsWith('-') ? undefined : arg)(process.argv[2]) || 'build';
if (commands[command] === undefined) {
if (_fs.default.existsSync(_path.default.resolve(command))) {
// TODO: Deprecate this in future versions
// Check if non-existing command, might be a file.
command = 'build';
} else {
help({
message: `Invalid command: ${command}`,
usage: ['tailwindcss <command> [options]'],
commands: Object.keys(commands).filter(command => command !== 'build').map(command => `${command} [options]`),
options: sharedFlags
});
process.exit(1);
}
} // Execute command
let {
args: flags,
run
} = commands[command];
let args = (() => {
try {
let result = (0, _arg.default)(Object.fromEntries(Object.entries({ ...flags,
...sharedFlags
}).filter(([_key, value]) => {
var _value$type;
return !(value !== null && value !== void 0 && (_value$type = value.type) !== null && _value$type !== void 0 && _value$type.manualParsing);
}).map(([key, value]) => [key, typeof value === 'object' ? value.type : value])), {
permissive: true
}); // Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
for (let i = result['_'].length - 1; i >= 0; --i) {
let flag = result['_'][i];
if (!flag.startsWith('-')) continue;
let flagName = flag;
let handler = flags[flag]; // Resolve flagName & handler
while (typeof handler === 'string') {
flagName = handler;
handler = flags[handler];
}
if (!handler) continue;
let args = [];
let offset = i + 1; // Parse args for current flag
while (result['_'][offset] && !result['_'][offset].startsWith('-')) {
args.push(result['_'][offset++]);
} // Cleanup manually parsed flags + args
result['_'].splice(i, 1 + args.length); // Set the resolved value in the `result` object
result[flagName] = handler.type(args.length === 0 ? undefined : args.length === 1 ? args[0] : args, flagName);
} // Ensure that the `command` is always the first argument in the `args`.
// This is important so that we don't have to check if a default command
// (build) was used or not from within each plugin.
//
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
if (result['_'][0] !== command) {
result['_'].unshift(command);
}
return result;
} catch (err) {
if (err.code === 'ARG_UNKNOWN_OPTION') {
help({
message: err.message,
usage: ['tailwindcss <command> [options]'],
options: sharedFlags
});
process.exit(1);
}
throw err;
}
})();
if (args['--help']) {
help({
options: { ...flags,
...sharedFlags
},
usage: [`tailwindcss ${command} [options]`]
});
process.exit(0);
}
run(); // ---
function init() {
var _args$_$;
let messages = [];
let tailwindConfigLocation = _path.default.resolve((_args$_$ = args['_'][1]) !== null && _args$_$ !== void 0 ? _args$_$ : './tailwind.config.js');
if (_fs.default.existsSync(tailwindConfigLocation)) {
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
} else {
let stubFile = _fs.default.readFileSync(args['--full'] ? _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js') : _path.default.resolve(__dirname, '../stubs/simpleConfig.stub.js'), 'utf8'); // Change colors import
stubFile = stubFile.replace('../colors', 'tailwindcss/colors'); // --jit mode
if (args['--jit']) {
// Add jit mode
stubFile = stubFile.replace('module.exports = {', "module.exports = {\n mode: 'jit',"); // Deleting variants
stubFile = stubFile.replace(/variants: {(.*)},\n /gs, '');
}
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, 'utf8');
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
}
if (args['--postcss']) {
let postcssConfigLocation = _path.default.resolve('./postcss.config.js');
if (_fs.default.existsSync(postcssConfigLocation)) {
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
} else {
let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, '../stubs/defaultPostCssConfig.stub.js'), 'utf8');
_fs.default.writeFileSync(postcssConfigLocation, stubFile, 'utf8');
messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
}
}
if (messages.length > 0) {
console.log();
for (let message of messages) {
console.log(message);
}
}
}
async function build() {
let input = args['--input'];
let output = args['--output'];
let shouldWatch = args['--watch'];
let includePostCss = args['--postcss']; // TODO: Deprecate this in future versions
if (!input && args['_'][1]) {
console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
input = args['--input'] = args['_'][1];
}
if (input && !_fs.default.existsSync(input = _path.default.resolve(input))) {
console.error(`Specified input file ${args['--input']} does not exist.`);
process.exit(9);
}
if (args['--config'] && !_fs.default.existsSync(args['--config'] = _path.default.resolve(args['--config']))) {
console.error(`Specified config file ${args['--config']} does not exist.`);
process.exit(9);
}
let configPath = args['--config'] ? args['--config'] : (defaultPath => _fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve('./tailwind.config.js'));
async function loadPostCssPlugins() {
let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined;
let {
plugins: configPlugins
} = customPostCssPath ? await (async () => {
let file = _path.default.resolve(customPostCssPath); // Implementation, see: https://unpkg.com/browse/postcss-load-config@3.0.1/src/index.js
let {
config = {}
} = await (0, _cosmiconfig.cosmiconfig)('postcss').load(file);
if (typeof config === 'function') {
config = config();
} else {
config = Object.assign({}, config);
}
if (!config.plugins) {
config.plugins = [];
}
return {
plugins: (0, _plugins.default)(config, file)
};
})() : await (0, _postcssLoadConfig.default)();
let configPluginTailwindIdx = configPlugins.findIndex(plugin => {
if (typeof plugin === 'function' && plugin.name === 'tailwindcss') {
return true;
}
if (typeof plugin === 'object' && plugin !== null && plugin.postcssPlugin === 'tailwindcss') {
return true;
}
return false;
});
let beforePlugins = configPluginTailwindIdx === -1 ? [] : configPlugins.slice(0, configPluginTailwindIdx);
let afterPlugins = configPluginTailwindIdx === -1 ? configPlugins : configPlugins.slice(configPluginTailwindIdx + 1);
return [beforePlugins, afterPlugins];
}
function resolveConfig() {
let config = configPath ? require(configPath) : {};
let resolvedConfig = (0, _resolveConfig.default)(config);
if (args['--purge']) {
resolvedConfig.purge = {
enabled: true,
content: args['--purge'].split(/(?<!{[^}]+),/)
};
}
if (args['--jit']) {
resolvedConfig.mode = 'jit';
}
return resolvedConfig;
}
function extractContent(config) {
var _config$purge$safelis, _config$purge;
let content = Array.isArray(config.purge) ? config.purge : config.purge.content;
return content.concat(((_config$purge$safelis = (_config$purge = config.purge) === null || _config$purge === void 0 ? void 0 : _config$purge.safelist) !== null && _config$purge$safelis !== void 0 ? _config$purge$safelis : []).map(content => {
if (typeof content === 'string') {
return {
raw: content,
extension: 'html'
};
}
if (content instanceof RegExp) {
throw new Error("Values inside 'purge.safelist' can only be of type 'string', found 'regex'.");
}
throw new Error(`Values inside 'purge.safelist' can only be of type 'string', found '${typeof content}'.`);
}));
}
function extractFileGlobs(config) {
return extractContent(config).filter(file => {
// Strings in this case are files / globs. If it is something else,
// like an object it's probably a raw content object. But this object
// is not watchable, so let's remove it.
return typeof file === 'string';
});
}
function extractRawContent(config) {
return extractContent(config).filter(file => {
return typeof file === 'object' && file !== null;
});
}
function getChangedContent(config) {
let changedContent = []; // Resolve globs from the purge config
let globs = extractFileGlobs(config);
let files = _fastGlob.default.sync(globs);
for (let file of files) {
changedContent.push({
content: _fs.default.readFileSync(_path.default.resolve(file), 'utf8'),
extension: _path.default.extname(file)
});
} // Resolve raw content in the tailwind config
for (let {
raw: content,
extension = 'html'
} of extractRawContent(config)) {
changedContent.push({
content,
extension
});
}
return changedContent;
}
async function buildOnce() {
let config = resolveConfig();
let changedContent = getChangedContent(config);
let tailwindPlugin = config.mode === 'jit' ? () => {
return {
postcssPlugin: 'tailwindcss',
Once(root, {
result
}) {
(0, _processTailwindFeatures.default)(({
createContext
}) => {
return () => {
return createContext(config, changedContent);
};
})(root, result);
}
};
} : () => {
return {
postcssPlugin: 'tailwindcss',
plugins: [(0, _processTailwindFeatures2.default)(() => config, configPath)]
};
};
tailwindPlugin.postcss = true;
let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : [[], []];
let plugins = [...beforePlugins, tailwindPlugin, !args['--minify'] && formatNodes, ...afterPlugins, !args['--no-autoprefixer'] && (() => {
// Try to load a local `autoprefixer` version first
try {
return require('autoprefixer');
} catch {}
return (0, _index.lazyAutoprefixer)();
})(), args['--minify'] && (() => {
let options = {
preset: ['default', {
cssDeclarationSorter: false
}]
}; // Try to load a local `cssnano` version first
try {
return require('cssnano');
} catch {}
return (0, _index.lazyCssnano)()(options);
})()].filter(Boolean);
let processor = (0, _index.postcss)(plugins);
function processCSS(css) {
let start = process.hrtime.bigint();
return Promise.resolve().then(() => output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
recursive: true
}) : null).then(() => processor.process(css, {
from: input,
to: output
})).then(result => {
if (!output) {
return process.stdout.write(result.css);
}
return Promise.all([_fs.default.promises.writeFile(output, result.css, () => true), result.map && _fs.default.writeFile(output + '.map', result.map.toString(), () => true)].filter(Boolean));
}).then(() => {
let end = process.hrtime.bigint();
console.error();
console.error('Done in', (end - start) / BigInt(1e6) + 'ms.');
});
}
let css = input ? _fs.default.readFileSync(_path.default.resolve(input), 'utf8') : '@tailwind base; @tailwind components; @tailwind utilities';
return processCSS(css);
}
let context = null;
async function startWatcher() {
let changedContent = [];
let configDependencies = [];
let contextDependencies = new Set();
let watcher = null;
function refreshConfig() {
env.DEBUG && console.time('Module dependencies');
for (let file of configDependencies) {
delete require.cache[require.resolve(file)];
}
if (configPath) {
configDependencies = (0, _getModuleDependencies.default)(configPath).map(({
file
}) => file);
for (let dependency of configDependencies) {
contextDependencies.add(dependency);
}
}
env.DEBUG && console.timeEnd('Module dependencies');
return resolveConfig();
}
let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : [[], []];
let plugins = [...beforePlugins, '__TAILWIND_PLUGIN_POSITION__', !args['--minify'] && formatNodes, ...afterPlugins, !args['--no-autoprefixer'] && (() => {
// Try to load a local `autoprefixer` version first
try {
return require('autoprefixer');
} catch {}
return (0, _index.lazyAutoprefixer)();
})(), args['--minify'] && (() => {
let options = {
preset: ['default', {
cssDeclarationSorter: false
}]
}; // Try to load a local `cssnano` version first
try {
return require('cssnano');
} catch {}
return (0, _index.lazyCssnano)()(options);
})()].filter(Boolean);
async function rebuild(config) {
env.DEBUG && console.time('Finished in');
let tailwindPlugin = config.mode === 'jit' ? () => {
return {
postcssPlugin: 'tailwindcss',
Once(root, {
result
}) {
env.DEBUG && console.time('Compiling CSS');
(0, _processTailwindFeatures.default)(({
createContext
}) => {
console.error();
console.error('Rebuilding...');
return () => {
if (context !== null) {
context.changedContent = changedContent.splice(0);
return context;
}
env.DEBUG && console.time('Creating context');
context = createContext(config, changedContent.splice(0));
env.DEBUG && console.timeEnd('Creating context');
return context;
};
})(root, result);
env.DEBUG && console.timeEnd('Compiling CSS');
}
};
} : () => {
return {
postcssPlugin: 'tailwindcss',
plugins: [(0, _processTailwindFeatures2.default)(() => config, configPath)]
};
};
tailwindPlugin.postcss = true;
let tailwindPluginIdx = plugins.indexOf('__TAILWIND_PLUGIN_POSITION__');
let copy = plugins.slice();
copy.splice(tailwindPluginIdx, 1, tailwindPlugin);
let processor = (0, _index.postcss)(copy);
function processCSS(css) {
let start = process.hrtime.bigint();
return Promise.resolve().then(() => output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
recursive: true
}) : null).then(() => processor.process(css, {
from: input,
to: output
})).then(async result => {
for (let message of result.messages) {
if (message.type === 'dependency') {
contextDependencies.add(message.file);
}
}
watcher.add([...contextDependencies]);
if (!output) {
return process.stdout.write(result.css);
}
await Promise.all([_fs.default.promises.writeFile(output, result.css, () => true), result.map && _fs.default.writeFile(output + '.map', result.map.toString(), () => true)].filter(Boolean));
}).then(() => {
let end = process.hrtime.bigint();
console.error('Done in', (end - start) / BigInt(1e6) + 'ms.');
}).catch(err => {
if (err.name === 'CssSyntaxError') {
console.error(err.toString());
} else {
console.error(err);
}
});
}
let css = input ? _fs.default.readFileSync(_path.default.resolve(input), 'utf8') : '@tailwind base; @tailwind components; @tailwind utilities';
let result = await processCSS(css);
env.DEBUG && console.timeEnd('Finished in');
return result;
}
let config = refreshConfig(configPath);
if (input) {
contextDependencies.add(_path.default.resolve(input));
}
watcher = _chokidar.default.watch([...contextDependencies, ...extractFileGlobs(config)], {
ignoreInitial: true,
awaitWriteFinish: process.platform === 'win32' ? {
stabilityThreshold: 50,
pollInterval: 10
} : false
});
let chain = Promise.resolve();
watcher.on('change', async file => {
if (contextDependencies.has(file)) {
env.DEBUG && console.time('Resolve config');
context = null;
config = refreshConfig(configPath);
env.DEBUG && console.timeEnd('Resolve config');
env.DEBUG && console.time('Watch new files');
let globs = extractFileGlobs(config);
watcher.add(configDependencies);
watcher.add(globs);
env.DEBUG && console.timeEnd('Watch new files');
chain = chain.then(async () => {
changedContent.push(...getChangedContent(config));
await rebuild(config);
});
} else {
chain = chain.then(async () => {
changedContent.push({
content: _fs.default.readFileSync(_path.default.resolve(file), 'utf8'),
extension: _path.default.extname(file)
});
await rebuild(config);
});
}
});
watcher.on('add', async file => {
chain = chain.then(async () => {
changedContent.push({
content: _fs.default.readFileSync(_path.default.resolve(file), 'utf8'),
extension: _path.default.extname(file)
});
await rebuild(config);
});
});
chain = chain.then(() => {
changedContent.push(...getChangedContent(config));
return rebuild(config);
});
}
if (shouldWatch) {
/* Abort the watcher if stdin is closed to avoid zombie processes */
process.stdin.on('end', () => process.exit(0));
process.stdin.resume();
startWatcher();
} else {
buildOnce();
}
}

37
node_modules/tailwindcss/lib/constants.js generated vendored Normal file
View file

@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.defaultPostCssConfigStubFile = exports.simpleConfigStubFile = exports.defaultConfigStubFile = exports.supportedPostCssConfigFile = exports.supportedConfigFiles = exports.cjsPostCssConfigFile = exports.cjsConfigFile = exports.defaultPostCssConfigFile = exports.defaultConfigFile = exports.cli = void 0;
var _path = _interopRequireDefault(require("path"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const cli = 'tailwind';
exports.cli = cli;
const defaultConfigFile = './tailwind.config.js';
exports.defaultConfigFile = defaultConfigFile;
const defaultPostCssConfigFile = './postcss.config.js';
exports.defaultPostCssConfigFile = defaultPostCssConfigFile;
const cjsConfigFile = './tailwind.config.cjs';
exports.cjsConfigFile = cjsConfigFile;
const cjsPostCssConfigFile = './postcss.config.cjs';
exports.cjsPostCssConfigFile = cjsPostCssConfigFile;
const supportedConfigFiles = [cjsConfigFile, defaultConfigFile];
exports.supportedConfigFiles = supportedConfigFiles;
const supportedPostCssConfigFile = [cjsPostCssConfigFile, defaultPostCssConfigFile];
exports.supportedPostCssConfigFile = supportedPostCssConfigFile;
const defaultConfigStubFile = _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js');
exports.defaultConfigStubFile = defaultConfigStubFile;
const simpleConfigStubFile = _path.default.resolve(__dirname, '../stubs/simpleConfig.stub.js');
exports.simpleConfigStubFile = simpleConfigStubFile;
const defaultPostCssConfigStubFile = _path.default.resolve(__dirname, '../stubs/defaultPostCssConfig.stub.js');
exports.defaultPostCssConfigStubFile = defaultPostCssConfigStubFile;

8
node_modules/tailwindcss/lib/corePluginList.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = ["preflight", "container", "accessibility", "pointerEvents", "visibility", "position", "inset", "isolation", "zIndex", "order", "gridColumn", "gridColumnStart", "gridColumnEnd", "gridRow", "gridRowStart", "gridRowEnd", "float", "clear", "margin", "boxSizing", "display", "height", "maxHeight", "minHeight", "width", "minWidth", "maxWidth", "flex", "flexShrink", "flexGrow", "tableLayout", "borderCollapse", "transformOrigin", "translate", "rotate", "skew", "scale", "transform", "animation", "cursor", "userSelect", "resize", "listStylePosition", "listStyleType", "appearance", "gridAutoColumns", "gridAutoFlow", "gridAutoRows", "gridTemplateColumns", "gridTemplateRows", "flexDirection", "flexWrap", "placeContent", "placeItems", "alignContent", "alignItems", "justifyContent", "justifyItems", "gap", "space", "divideWidth", "divideStyle", "divideColor", "divideOpacity", "placeSelf", "alignSelf", "justifySelf", "overflow", "overscrollBehavior", "textOverflow", "whitespace", "wordBreak", "borderRadius", "borderWidth", "borderStyle", "borderColor", "borderOpacity", "backgroundColor", "backgroundOpacity", "backgroundImage", "gradientColorStops", "boxDecorationBreak", "backgroundSize", "backgroundAttachment", "backgroundClip", "backgroundPosition", "backgroundRepeat", "backgroundOrigin", "fill", "stroke", "strokeWidth", "objectFit", "objectPosition", "padding", "textAlign", "verticalAlign", "fontFamily", "fontSize", "fontWeight", "textTransform", "fontStyle", "fontVariantNumeric", "lineHeight", "letterSpacing", "textColor", "textOpacity", "textDecoration", "fontSmoothing", "placeholderColor", "placeholderOpacity", "caretColor", "opacity", "backgroundBlendMode", "mixBlendMode", "boxShadow", "outline", "ringWidth", "ringColor", "ringOpacity", "ringOffsetWidth", "ringOffsetColor", "blur", "brightness", "contrast", "dropShadow", "grayscale", "hueRotate", "invert", "saturate", "sepia", "filter", "backdropBlur", "backdropBrightness", "backdropContrast", "backdropGrayscale", "backdropHueRotate", "backdropInvert", "backdropOpacity", "backdropSaturate", "backdropSepia", "backdropFilter", "transitionProperty", "transitionDelay", "transitionDuration", "transitionTimingFunction", "content"];
exports.default = _default;

52
node_modules/tailwindcss/lib/corePlugins.js generated vendored Normal file
View file

@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var plugins = _interopRequireWildcard(require("./plugins/index.js"));
var _configurePlugins = _interopRequireDefault(require("./util/configurePlugins"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function move(items, item, befores) {
let lowestBefore = -1;
for (let before of befores) {
let index = items.indexOf(before);
if (index >= 0 && (index < lowestBefore || lowestBefore === -1)) {
lowestBefore = index;
}
}
if (items.indexOf(item) === -1 || lowestBefore === -1) {
return items;
}
items = [...items];
let fromIndex = items.indexOf(item);
let toIndex = lowestBefore;
items.splice(fromIndex, 1);
items.splice(toIndex, 0, item);
return items;
}
function _default({
corePlugins: corePluginConfig
}) {
let pluginOrder = Object.keys(plugins);
pluginOrder = (0, _configurePlugins.default)(corePluginConfig, pluginOrder);
pluginOrder = move(pluginOrder, 'transform', ['translate', 'rotate', 'skew', 'scale']);
pluginOrder = move(pluginOrder, 'filter', ['blur', 'brightness', 'contrast', 'dropShadow', 'grayscale', 'hueRotate', 'invert', 'saturate', 'sepia']);
pluginOrder = move(pluginOrder, 'backdropFilter', ['backdropBlur', 'backdropBrightness', 'backdropContrast', 'backdropGrayscale', 'backdropHueRotate', 'backdropInvert', 'backdropOpacity', 'backdropSaturate', 'backdropSepia']);
return pluginOrder.map(pluginName => {
return plugins[pluginName]();
});
}

56
node_modules/tailwindcss/lib/featureFlags.js generated vendored Normal file
View file

@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.flagEnabled = flagEnabled;
exports.issueFlagNotices = issueFlagNotices;
exports.default = void 0;
var _lodash = _interopRequireDefault(require("lodash"));
var _chalk = _interopRequireDefault(require("chalk"));
var _log = _interopRequireDefault(require("./util/log"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const featureFlags = {
future: [],
experimental: ['optimizeUniversalDefaults']
};
function flagEnabled(config, flag) {
if (featureFlags.future.includes(flag)) {
return config.future === 'all' || _lodash.default.get(config, ['future', flag], false);
}
if (featureFlags.experimental.includes(flag)) {
return config.experimental === 'all' || _lodash.default.get(config, ['experimental', flag], false);
}
return false;
}
function experimentalFlagsEnabled(config) {
if (config.experimental === 'all') {
return featureFlags.experimental;
}
return Object.keys(_lodash.default.get(config, 'experimental', {})).filter(flag => featureFlags.experimental.includes(flag) && config.experimental[flag]);
}
function issueFlagNotices(config) {
if (process.env.JEST_WORKER_ID !== undefined) {
return;
}
if (experimentalFlagsEnabled(config).length > 0) {
const changes = experimentalFlagsEnabled(config).map(s => _chalk.default.yellow(s)).join(', ');
_log.default.warn([`You have enabled experimental features: ${changes}`, 'Experimental features are not covered by semver, may introduce breaking changes, and can change at any time.']);
}
}
var _default = featureFlags;
exports.default = _default;

117
node_modules/tailwindcss/lib/index.js generated vendored Normal file
View file

@ -0,0 +1,117 @@
"use strict";
var _path = _interopRequireDefault(require("path"));
var _fs = _interopRequireDefault(require("fs"));
var _lodash = _interopRequireDefault(require("lodash"));
var _getModuleDependencies = _interopRequireDefault(require("./lib/getModuleDependencies"));
var _registerConfigAsDependency = _interopRequireDefault(require("./lib/registerConfigAsDependency"));
var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
var _formatCSS = _interopRequireDefault(require("./lib/formatCSS"));
var _resolveConfig = _interopRequireDefault(require("./util/resolveConfig"));
var _getAllConfigs = _interopRequireDefault(require("./util/getAllConfigs"));
var _constants = require("./constants");
var _defaultConfigStub = _interopRequireDefault(require("../stubs/defaultConfig.stub.js"));
var _jit = _interopRequireDefault(require("./jit"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function resolveConfigPath(filePath) {
// require('tailwindcss')({ theme: ..., variants: ... })
if (_lodash.default.isObject(filePath) && !_lodash.default.has(filePath, 'config') && !_lodash.default.isEmpty(filePath)) {
return undefined;
} // require('tailwindcss')({ config: 'custom-config.js' })
if (_lodash.default.isObject(filePath) && _lodash.default.has(filePath, 'config') && _lodash.default.isString(filePath.config)) {
return _path.default.resolve(filePath.config);
} // require('tailwindcss')({ config: { theme: ..., variants: ... } })
if (_lodash.default.isObject(filePath) && _lodash.default.has(filePath, 'config') && _lodash.default.isObject(filePath.config)) {
return undefined;
} // require('tailwindcss')('custom-config.js')
if (_lodash.default.isString(filePath)) {
return _path.default.resolve(filePath);
} // require('tailwindcss')
for (const configFile of _constants.supportedConfigFiles) {
try {
const configPath = _path.default.resolve(configFile);
_fs.default.accessSync(configPath);
return configPath;
} catch (err) {}
}
return undefined;
}
const getConfigFunction = config => () => {
if (_lodash.default.isUndefined(config)) {
return (0, _resolveConfig.default)([...(0, _getAllConfigs.default)(_defaultConfigStub.default), {
corePlugins: {
caretColor: false,
content: false
}
}]);
} // Skip this if Jest is running: https://github.com/facebook/jest/pull/9841#issuecomment-621417584
if (process.env.JEST_WORKER_ID === undefined) {
if (!_lodash.default.isObject(config)) {
(0, _getModuleDependencies.default)(config).forEach(mdl => {
delete require.cache[require.resolve(mdl.file)];
});
}
}
const configObject = _lodash.default.isObject(config) ? _lodash.default.get(config, 'config', config) : require(config);
return (0, _resolveConfig.default)([...(0, _getAllConfigs.default)(configObject), {
corePlugins: {
caretColor: false,
content: false
}
}]);
};
module.exports = function tailwindcss(config) {
const resolvedConfigPath = resolveConfigPath(config);
const getConfig = getConfigFunction(resolvedConfigPath || config);
const mode = _lodash.default.get(getConfig(), 'mode', 'aot');
if (mode === 'jit') {
return {
postcssPlugin: 'tailwindcss',
plugins: (0, _jit.default)(config)
};
}
const plugins = [];
if (!_lodash.default.isUndefined(resolvedConfigPath)) {
plugins.push((0, _registerConfigAsDependency.default)(resolvedConfigPath));
}
return {
postcssPlugin: 'tailwindcss',
plugins: [...plugins, (0, _processTailwindFeatures.default)(getConfig), _formatCSS.default]
};
};
module.exports.postcss = true;

103
node_modules/tailwindcss/lib/index.postcss7.js generated vendored Normal file
View file

@ -0,0 +1,103 @@
"use strict";
var _path = _interopRequireDefault(require("path"));
var _fs = _interopRequireDefault(require("fs"));
var _lodash = _interopRequireDefault(require("lodash"));
var _postcss = _interopRequireDefault(require("postcss"));
var _getModuleDependencies = _interopRequireDefault(require("./lib/getModuleDependencies"));
var _registerConfigAsDependency = _interopRequireDefault(require("./lib/registerConfigAsDependency"));
var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
var _formatCSS = _interopRequireDefault(require("./lib/formatCSS"));
var _resolveConfig = _interopRequireDefault(require("./util/resolveConfig"));
var _getAllConfigs = _interopRequireDefault(require("./util/getAllConfigs"));
var _constants = require("./constants");
var _defaultConfigStub = _interopRequireDefault(require("../stubs/defaultConfig.stub.js"));
var _jit = _interopRequireDefault(require("./jit"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function resolveConfigPath(filePath) {
// require('tailwindcss')({ theme: ..., variants: ... })
if (_lodash.default.isObject(filePath) && !_lodash.default.has(filePath, 'config') && !_lodash.default.isEmpty(filePath)) {
return undefined;
} // require('tailwindcss')({ config: 'custom-config.js' })
if (_lodash.default.isObject(filePath) && _lodash.default.has(filePath, 'config') && _lodash.default.isString(filePath.config)) {
return _path.default.resolve(filePath.config);
} // require('tailwindcss')({ config: { theme: ..., variants: ... } })
if (_lodash.default.isObject(filePath) && _lodash.default.has(filePath, 'config') && _lodash.default.isObject(filePath.config)) {
return undefined;
} // require('tailwindcss')('custom-config.js')
if (_lodash.default.isString(filePath)) {
return _path.default.resolve(filePath);
} // require('tailwindcss')
for (const configFile of _constants.supportedConfigFiles) {
try {
const configPath = _path.default.resolve(configFile);
_fs.default.accessSync(configPath);
return configPath;
} catch (err) {}
}
return undefined;
}
const getConfigFunction = config => () => {
if (_lodash.default.isUndefined(config)) {
return (0, _resolveConfig.default)([...(0, _getAllConfigs.default)(_defaultConfigStub.default)]);
} // Skip this if Jest is running: https://github.com/facebook/jest/pull/9841#issuecomment-621417584
if (process.env.JEST_WORKER_ID === undefined) {
if (!_lodash.default.isObject(config)) {
(0, _getModuleDependencies.default)(config).forEach(mdl => {
delete require.cache[require.resolve(mdl.file)];
});
}
}
const configObject = _lodash.default.isObject(config) ? _lodash.default.get(config, 'config', config) : require(config);
return (0, _resolveConfig.default)([...(0, _getAllConfigs.default)(configObject)]);
};
const plugin = _postcss.default.plugin('tailwindcss', config => {
const resolvedConfigPath = resolveConfigPath(config);
const getConfig = getConfigFunction(resolvedConfigPath || config);
const mode = _lodash.default.get(getConfig(), 'mode', 'aot');
if (mode === 'jit') {
return (0, _postcss.default)((0, _jit.default)(config));
}
const plugins = [];
if (!_lodash.default.isUndefined(resolvedConfigPath)) {
plugins.push((0, _registerConfigAsDependency.default)(resolvedConfigPath));
}
return (0, _postcss.default)([...plugins, (0, _processTailwindFeatures.default)(getConfig), _formatCSS.default]);
});
module.exports = plugin;

246
node_modules/tailwindcss/lib/jit/corePlugins.js generated vendored Normal file
View file

@ -0,0 +1,246 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _postcss = _interopRequireDefault(require("postcss"));
var corePlugins = _interopRequireWildcard(require("../plugins"));
var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
var _pluginUtils = require("../util/pluginUtils");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
pseudoElementVariants: function ({
config,
addVariant
}) {
addVariant('first-letter', (0, _pluginUtils.transformAllSelectors)(selector => {
return (0, _pluginUtils.updateAllClasses)(selector, (className, {
withPseudo
}) => {
return withPseudo(`first-letter${config('separator')}${className}`, '::first-letter');
});
}));
addVariant('first-line', (0, _pluginUtils.transformAllSelectors)(selector => {
return (0, _pluginUtils.updateAllClasses)(selector, (className, {
withPseudo
}) => {
return withPseudo(`first-line${config('separator')}${className}`, '::first-line');
});
}));
addVariant('marker', [(0, _pluginUtils.transformAllSelectors)(selector => {
let variantSelector = (0, _pluginUtils.updateAllClasses)(selector, className => {
return `marker${config('separator')}${className}`;
});
return `${variantSelector} *::marker`;
}), (0, _pluginUtils.transformAllSelectors)(selector => {
return (0, _pluginUtils.updateAllClasses)(selector, (className, {
withPseudo
}) => {
return withPseudo(`marker${config('separator')}${className}`, '::marker');
});
})]);
addVariant('selection', [(0, _pluginUtils.transformAllSelectors)(selector => {
let variantSelector = (0, _pluginUtils.updateAllClasses)(selector, className => {
return `selection${config('separator')}${className}`;
});
return `${variantSelector} *::selection`;
}), (0, _pluginUtils.transformAllSelectors)(selector => {
return (0, _pluginUtils.updateAllClasses)(selector, (className, {
withPseudo
}) => {
return withPseudo(`selection${config('separator')}${className}`, '::selection');
});
})]);
addVariant('before', (0, _pluginUtils.transformAllSelectors)(selector => {
return (0, _pluginUtils.updateAllClasses)(selector, (className, {
withPseudo
}) => {
return withPseudo(`before${config('separator')}${className}`, '::before');
});
}, {
withRule: rule => {
let foundContent = false;
rule.walkDecls('content', () => {
foundContent = true;
});
if (!foundContent) {
rule.prepend(_postcss.default.decl({
prop: 'content',
value: '""'
}));
}
}
}));
addVariant('after', (0, _pluginUtils.transformAllSelectors)(selector => {
return (0, _pluginUtils.updateAllClasses)(selector, (className, {
withPseudo
}) => {
return withPseudo(`after${config('separator')}${className}`, '::after');
});
}, {
withRule: rule => {
let foundContent = false;
rule.walkDecls('content', () => {
foundContent = true;
});
if (!foundContent) {
rule.prepend(_postcss.default.decl({
prop: 'content',
value: '""'
}));
}
}
}));
},
pseudoClassVariants: function ({
config,
addVariant
}) {
let pseudoVariants = [// Positional
['first', 'first-child'], ['last', 'last-child'], ['only', 'only-child'], ['odd', 'nth-child(odd)'], ['even', 'nth-child(even)'], 'first-of-type', 'last-of-type', 'only-of-type', // State
'visited', 'target', // Forms
'default', 'checked', 'indeterminate', 'placeholder-shown', 'autofill', 'required', 'valid', 'invalid', 'in-range', 'out-of-range', 'read-only', // Content
'empty', // Interactive
'focus-within', 'hover', 'focus', 'focus-visible', 'active', 'disabled'];
for (let variant of pseudoVariants) {
let [variantName, state] = Array.isArray(variant) ? variant : [variant, variant];
addVariant(variantName, (0, _pluginUtils.transformAllClasses)((className, {
withPseudo
}) => {
return withPseudo(`${variantName}${config('separator')}${className}`, `:${state}`);
}));
}
let groupMarker = (0, _prefixSelector.default)(config('prefix'), '.group');
for (let variant of pseudoVariants) {
let [variantName, state] = Array.isArray(variant) ? variant : [variant, variant];
let groupVariantName = `group-${variantName}`;
addVariant(groupVariantName, (0, _pluginUtils.transformAllSelectors)(selector => {
let variantSelector = (0, _pluginUtils.updateAllClasses)(selector, className => {
if (`.${className}` === groupMarker) return className;
return `${groupVariantName}${config('separator')}${className}`;
});
if (variantSelector === selector) {
return null;
}
return (0, _pluginUtils.applyPseudoToMarker)(variantSelector, groupMarker, state, (marker, selector) => `${marker} ${selector}`);
}));
}
let peerMarker = (0, _prefixSelector.default)(config('prefix'), '.peer');
for (let variant of pseudoVariants) {
let [variantName, state] = Array.isArray(variant) ? variant : [variant, variant];
let peerVariantName = `peer-${variantName}`;
addVariant(peerVariantName, (0, _pluginUtils.transformAllSelectors)(selector => {
let variantSelector = (0, _pluginUtils.updateAllClasses)(selector, className => {
if (`.${className}` === peerMarker) return className;
return `${peerVariantName}${config('separator')}${className}`;
});
if (variantSelector === selector) {
return null;
}
return (0, _pluginUtils.applyPseudoToMarker)(variantSelector, peerMarker, state, (marker, selector) => selector.trim().startsWith('~') ? `${marker}${selector}` : `${marker} ~ ${selector}`);
}));
}
},
directionVariants: function ({
config,
addVariant
}) {
addVariant('ltr', (0, _pluginUtils.transformAllSelectors)(selector => `[dir="ltr"] ${(0, _pluginUtils.updateAllClasses)(selector, className => `ltr${config('separator')}${className}`)}`));
addVariant('rtl', (0, _pluginUtils.transformAllSelectors)(selector => `[dir="rtl"] ${(0, _pluginUtils.updateAllClasses)(selector, className => `rtl${config('separator')}${className}`)}`));
},
reducedMotionVariants: function ({
config,
addVariant
}) {
addVariant('motion-safe', (0, _pluginUtils.transformLastClasses)(className => {
return `motion-safe${config('separator')}${className}`;
}, {
wrap: () => _postcss.default.atRule({
name: 'media',
params: '(prefers-reduced-motion: no-preference)'
})
}));
addVariant('motion-reduce', (0, _pluginUtils.transformLastClasses)(className => {
return `motion-reduce${config('separator')}${className}`;
}, {
wrap: () => _postcss.default.atRule({
name: 'media',
params: '(prefers-reduced-motion: reduce)'
})
}));
},
darkVariants: function ({
config,
addVariant
}) {
if (config('darkMode') === 'class') {
addVariant('dark', (0, _pluginUtils.transformAllSelectors)(selector => {
let variantSelector = (0, _pluginUtils.updateLastClasses)(selector, className => {
return `dark${config('separator')}${className}`;
});
if (variantSelector === selector) {
return null;
}
let darkSelector = (0, _prefixSelector.default)(config('prefix'), `.dark`);
return `${darkSelector} ${variantSelector}`;
}));
} else if (config('darkMode') === 'media') {
addVariant('dark', (0, _pluginUtils.transformLastClasses)(className => {
return `dark${config('separator')}${className}`;
}, {
wrap: () => _postcss.default.atRule({
name: 'media',
params: '(prefers-color-scheme: dark)'
})
}));
}
},
screenVariants: function ({
config,
theme,
addVariant
}) {
for (let screen in theme('screens')) {
let size = theme('screens')[screen];
let query = (0, _buildMediaQuery.default)(size);
addVariant(screen, (0, _pluginUtils.transformLastClasses)(className => {
return `${screen}${config('separator')}${className}`;
}, {
wrap: () => _postcss.default.atRule({
name: 'media',
params: query
})
}));
}
},
...Object.fromEntries(Object.entries(corePlugins).map(([pluginName, plugin]) => {
return [pluginName, plugin()];
}))
};
exports.default = _default;

31
node_modules/tailwindcss/lib/jit/index.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _setupTrackingContext = _interopRequireDefault(require("./lib/setupTrackingContext"));
var _setupWatchingContext = _interopRequireDefault(require("./lib/setupWatchingContext"));
var _sharedState = require("./lib/sharedState");
var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(configOrPath = {}) {
return [_sharedState.env.DEBUG && function (root) {
console.log('\n');
console.time('JIT TOTAL');
return root;
}, function (root, result) {
let setupContext = _sharedState.env.TAILWIND_MODE === 'watch' ? (0, _setupWatchingContext.default)(configOrPath) : (0, _setupTrackingContext.default)(configOrPath);
(0, _processTailwindFeatures.default)(setupContext)(root, result);
}, _sharedState.env.DEBUG && function (root) {
console.timeEnd('JIT TOTAL');
console.log('\n');
return root;
}].filter(Boolean);
}

View file

@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = collapseAdjacentRules;
let comparisonMap = {
atrule: ['name', 'params'],
rule: ['selector']
};
let types = new Set(Object.keys(comparisonMap));
function collapseAdjacentRules() {
return root => {
let currentRule = null;
root.each(node => {
if (!types.has(node.type)) {
currentRule = null;
return;
}
if (currentRule === null) {
currentRule = node;
return;
}
let properties = comparisonMap[node.type];
if (node.type === 'atrule' && node.name === 'font-face') {
currentRule = node;
} else if (properties.every(property => {
var _node$property, _currentRule$property;
return ((_node$property = node[property]) !== null && _node$property !== void 0 ? _node$property : '').replace(/\s+/g, ' ') === ((_currentRule$property = currentRule[property]) !== null && _currentRule$property !== void 0 ? _currentRule$property : '').replace(/\s+/g, ' ');
})) {
currentRule.append(node.nodes);
node.remove();
} else {
currentRule = node;
}
});
};
}

View file

@ -0,0 +1,231 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = expandApplyAtRules;
var _postcss = _interopRequireDefault(require("postcss"));
var _generateRules = require("./generateRules");
var _bigSign = _interopRequireDefault(require("../../util/bigSign"));
var _escapeClassName = _interopRequireDefault(require("../../util/escapeClassName"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function buildApplyCache(applyCandidates, context) {
for (let candidate of applyCandidates) {
if (context.notClassCache.has(candidate) || context.applyClassCache.has(candidate)) {
continue;
}
if (context.classCache.has(candidate)) {
context.applyClassCache.set(candidate, context.classCache.get(candidate).map(([meta, rule]) => [meta, rule.clone()]));
continue;
}
let matches = Array.from((0, _generateRules.resolveMatches)(candidate, context));
if (matches.length === 0) {
context.notClassCache.add(candidate);
continue;
}
context.applyClassCache.set(candidate, matches);
}
return context.applyClassCache;
}
function extractApplyCandidates(params) {
let candidates = params.split(/[\s\t\n]+/g);
if (candidates[candidates.length - 1] === '!important') {
return [candidates.slice(0, -1), true];
}
return [candidates, false];
}
function partitionApplyParents(root) {
let applyParents = new Set();
root.walkAtRules('apply', rule => {
applyParents.add(rule.parent);
});
for (let rule of applyParents) {
let nodeGroups = [];
let lastGroup = [];
for (let node of rule.nodes) {
if (node.type === 'atrule' && node.name === 'apply') {
if (lastGroup.length > 0) {
nodeGroups.push(lastGroup);
lastGroup = [];
}
nodeGroups.push([node]);
} else {
lastGroup.push(node);
}
}
if (lastGroup.length > 0) {
nodeGroups.push(lastGroup);
}
if (nodeGroups.length === 1) {
continue;
}
for (let group of [...nodeGroups].reverse()) {
let newParent = rule.clone({
nodes: []
});
newParent.append(group);
rule.after(newParent);
}
rule.remove();
}
}
function processApply(root, context) {
let applyCandidates = new Set(); // Collect all @apply rules and candidates
let applies = [];
root.walkAtRules('apply', rule => {
let [candidates] = extractApplyCandidates(rule.params);
for (let util of candidates) {
applyCandidates.add(util);
}
applies.push(rule);
}); // Start the @apply process if we have rules with @apply in them
if (applies.length > 0) {
// Fill up some caches!
let applyClassCache = buildApplyCache(applyCandidates, context);
/**
* When we have an apply like this:
*
* .abc {
* @apply hover:font-bold;
* }
*
* What we essentially will do is resolve to this:
*
* .abc {
* @apply .hover\:font-bold:hover {
* font-weight: 500;
* }
* }
*
* Notice that the to-be-applied class is `.hover\:font-bold:hover` and that the utility candidate was `hover:font-bold`.
* What happens in this function is that we prepend a `.` and escape the candidate.
* This will result in `.hover\:font-bold`
* Which means that we can replace `.hover\:font-bold` with `.abc` in `.hover\:font-bold:hover` resulting in `.abc:hover`
*/
// TODO: Should we use postcss-selector-parser for this instead?
function replaceSelector(selector, utilitySelectors, candidate) {
let needle = `.${(0, _escapeClassName.default)(candidate)}`;
let utilitySelectorsList = utilitySelectors.split(/\s*,\s*/g);
return selector.split(/\s*,\s*/g).map(s => {
let replaced = [];
for (let utilitySelector of utilitySelectorsList) {
let replacedSelector = utilitySelector.replace(needle, s);
if (replacedSelector === utilitySelector) {
continue;
}
replaced.push(replacedSelector);
}
return replaced.join(', ');
}).join(', ');
}
let perParentApplies = new Map(); // Collect all apply candidates and their rules
for (let apply of applies) {
let candidates = perParentApplies.get(apply.parent) || [];
perParentApplies.set(apply.parent, candidates);
let [applyCandidates, important] = extractApplyCandidates(apply.params);
if (apply.parent.type === 'atrule') {
if (apply.parent.name === 'screen') {
const screenType = apply.parent.params;
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${applyCandidates.map(c => `${screenType}:${c}`).join(' ')} instead.`);
}
throw apply.error(`@apply is not supported within nested at-rules like @${apply.parent.name}. You can fix this by un-nesting @${apply.parent.name}.`);
}
for (let applyCandidate of applyCandidates) {
if (!applyClassCache.has(applyCandidate)) {
throw apply.error(`The \`${applyCandidate}\` class does not exist. If \`${applyCandidate}\` is a custom class, make sure it is defined within a \`@layer\` directive.`);
}
let rules = applyClassCache.get(applyCandidate);
candidates.push([applyCandidate, important, rules]);
}
}
for (const [parent, candidates] of perParentApplies) {
let siblings = [];
for (let [applyCandidate, important, rules] of candidates) {
for (let [meta, node] of rules) {
let root = _postcss.default.root({
nodes: [node.clone()]
});
let canRewriteSelector = node.type !== 'atrule' || node.type === 'atrule' && node.name !== 'keyframes';
if (canRewriteSelector) {
root.walkRules(rule => {
rule.selector = replaceSelector(parent.selector, rule.selector, applyCandidate);
rule.walkDecls(d => {
d.important = meta.important || important;
});
});
}
siblings.push([meta, root.nodes[0]]);
}
} // Inject the rules, sorted, correctly
let nodes = siblings.sort(([a], [z]) => (0, _bigSign.default)(a.sort - z.sort)).map(s => s[1]); // console.log(parent)
// `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
parent.after(nodes);
}
for (let apply of applies) {
// If there are left-over declarations, just remove the @apply
if (apply.parent.nodes.length > 1) {
apply.remove();
} else {
// The node is empty, drop the full node
apply.parent.remove();
}
} // Do it again, in case we have other `@apply` rules
processApply(root, context);
}
}
function expandApplyAtRules(context) {
return root => {
partitionApplyParents(root);
processApply(root, context);
};
}

View file

@ -0,0 +1,246 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = expandTailwindAtRules;
var sharedState = _interopRequireWildcard(require("./sharedState"));
var _generateRules = require("./generateRules");
var _bigSign = _interopRequireDefault(require("../../util/bigSign"));
var _cloneNodes = _interopRequireDefault(require("../../util/cloneNodes"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
let env = sharedState.env;
let contentMatchCache = sharedState.contentMatchCache;
const PATTERNS = ["([^<>\"'`\\s]*\\['[^<>\"'`\\s]*'\\])", // `content-['hello']` but not `content-['hello']']`
'([^<>"\'`\\s]*\\["[^<>"\'`\\s]*"\\])', // `content-["hello"]` but not `content-["hello"]"]`
'([^<>"\'`\\s]*\\[[^<>"\'`\\s]+\\])', // `fill-[#bada55]`
'([^<>"\'`\\s]*[^<>"\'`\\s:])' // `px-1.5`, `uppercase` but not `uppercase:`
].join('|');
const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/g;
const builtInExtractors = {
DEFAULT: content => {
let broadMatches = content.match(BROAD_MATCH_GLOBAL_REGEXP) || [];
let innerMatches = content.match(INNER_MATCH_GLOBAL_REGEXP) || [];
return [...broadMatches, ...innerMatches];
}
};
const builtInTransformers = {
DEFAULT: content => content,
svelte: content => content.replace(/(?:^|\s)class:/g, ' ')
};
function getExtractor(tailwindConfig, fileExtension) {
let extractors = tailwindConfig && tailwindConfig.purge && tailwindConfig.purge.extract || {};
const purgeOptions = tailwindConfig && tailwindConfig.purge && tailwindConfig.purge.options || {};
if (typeof extractors === 'function') {
extractors = {
DEFAULT: extractors
};
}
if (purgeOptions.defaultExtractor) {
extractors.DEFAULT = purgeOptions.defaultExtractor;
}
for (let {
extensions,
extractor
} of purgeOptions.extractors || []) {
for (let extension of extensions) {
extractors[extension] = extractor;
}
}
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || builtInExtractors.DEFAULT;
}
function getTransformer(tailwindConfig, fileExtension) {
let transformers = tailwindConfig && tailwindConfig.purge && tailwindConfig.purge.transform || {};
if (typeof transformers === 'function') {
transformers = {
DEFAULT: transformers
};
}
return transformers[fileExtension] || transformers.DEFAULT || builtInTransformers[fileExtension] || builtInTransformers.DEFAULT;
} // Scans template contents for possible classes. This is a hot path on initial build but
// not too important for subsequent builds. The faster the better though — if we can speed
// up these regexes by 50% that could cut initial build time by like 20%.
function getClassCandidates(content, extractor, contentMatchCache, candidates, seen) {
for (let line of content.split('\n')) {
line = line.trim();
if (seen.has(line)) {
continue;
}
seen.add(line);
if (contentMatchCache.has(line)) {
for (let match of contentMatchCache.get(line)) {
candidates.add(match);
}
} else {
let extractorMatches = extractor(line).filter(s => s !== '!*');
let lineMatchesSet = new Set(extractorMatches);
for (let match of lineMatchesSet) {
candidates.add(match);
}
contentMatchCache.set(line, lineMatchesSet);
}
}
}
function buildStylesheet(rules, context) {
let sortedRules = rules.sort(([a], [z]) => (0, _bigSign.default)(a - z));
let returnValue = {
base: new Set(),
components: new Set(),
utilities: new Set(),
variants: new Set()
};
for (let [sort, rule] of sortedRules) {
if (sort >= context.minimumScreen) {
returnValue.variants.add(rule);
continue;
}
if (sort & context.layerOrder.base) {
returnValue.base.add(rule);
continue;
}
if (sort & context.layerOrder.components) {
returnValue.components.add(rule);
continue;
}
if (sort & context.layerOrder.utilities) {
returnValue.utilities.add(rule);
continue;
}
}
return returnValue;
}
function expandTailwindAtRules(context) {
return root => {
let layerNodes = {
base: null,
components: null,
utilities: null,
variants: null
}; // Make sure this file contains Tailwind directives. If not, we can save
// a lot of work and bail early. Also we don't have to register our touch
// file as a dependency since the output of this CSS does not depend on
// the source of any templates. Think Vue <style> blocks for example.
root.walkAtRules('tailwind', rule => {
if (Object.keys(layerNodes).includes(rule.params)) {
layerNodes[rule.params] = rule;
}
});
if (Object.values(layerNodes).every(n => n === null)) {
return root;
} // ---
// Find potential rules in changed files
let candidates = new Set(['*']);
let seen = new Set();
env.DEBUG && console.time('Reading changed files');
for (let {
content,
extension
} of context.changedContent) {
let transformer = getTransformer(context.tailwindConfig, extension);
let extractor = getExtractor(context.tailwindConfig, extension);
getClassCandidates(transformer(content), extractor, contentMatchCache, candidates, seen);
} // ---
// Generate the actual CSS
let classCacheCount = context.classCache.size;
env.DEBUG && console.time('Generate rules');
let rules = (0, _generateRules.generateRules)(candidates, context);
env.DEBUG && console.timeEnd('Generate rules'); // We only ever add to the classCache, so if it didn't grow, there is nothing new.
env.DEBUG && console.time('Build stylesheet');
if (context.stylesheetCache === null || context.classCache.size !== classCacheCount) {
for (let rule of rules) {
context.ruleCache.add(rule);
}
context.stylesheetCache = buildStylesheet([...context.ruleCache], context);
}
env.DEBUG && console.timeEnd('Build stylesheet');
let {
base: baseNodes,
components: componentNodes,
utilities: utilityNodes,
variants: screenNodes
} = context.stylesheetCache; // ---
// Replace any Tailwind directives with generated CSS
if (layerNodes.base) {
layerNodes.base.before((0, _cloneNodes.default)([...baseNodes], layerNodes.base.source));
layerNodes.base.remove();
}
if (layerNodes.components) {
layerNodes.components.before((0, _cloneNodes.default)([...componentNodes], layerNodes.components.source));
layerNodes.components.remove();
}
if (layerNodes.utilities) {
layerNodes.utilities.before((0, _cloneNodes.default)([...utilityNodes], layerNodes.utilities.source));
layerNodes.utilities.remove();
}
if (layerNodes.variants) {
layerNodes.variants.before((0, _cloneNodes.default)([...screenNodes], layerNodes.variants.source));
layerNodes.variants.remove();
} else {
root.append((0, _cloneNodes.default)([...screenNodes], root.source));
} // ---
if (env.DEBUG) {
console.log('Potential classes: ', candidates.size);
console.log('Active contexts: ', sharedState.contextSourcesMap.size);
console.log('Content match entries', contentMatchCache.size);
} // Clear the cache for the changed files
context.changedContent = []; // Cleanup any leftover @layer atrules
root.walkAtRules('layer', rule => {
if (Object.keys(layerNodes).includes(rule.params)) {
rule.remove();
}
});
};
}

362
node_modules/tailwindcss/lib/jit/lib/generateRules.js generated vendored Normal file
View file

@ -0,0 +1,362 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.resolveMatches = resolveMatches;
exports.generateRules = generateRules;
var _postcss = _interopRequireDefault(require("postcss"));
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
var _parseObjectStyles = _interopRequireDefault(require("../../util/parseObjectStyles"));
var _isPlainObject = _interopRequireDefault(require("../../util/isPlainObject"));
var _prefixSelector = _interopRequireDefault(require("../../util/prefixSelector"));
var _pluginUtils = require("../../util/pluginUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let classNameParser = (0, _postcssSelectorParser.default)(selectors => {
return selectors.first.filter(({
type
}) => type === 'class').pop().value;
});
function getClassNameFromSelector(selector) {
return classNameParser.transformSync(selector);
} // Generate match permutations for a class candidate, like:
// ['ring-offset-blue', '100']
// ['ring-offset', 'blue-100']
// ['ring', 'offset-blue-100']
// Example with dynamic classes:
// ['grid-cols', '[[linename],1fr,auto]']
// ['grid', 'cols-[[linename],1fr,auto]']
function* candidatePermutations(candidate, lastIndex = Infinity) {
if (lastIndex < 0) {
return;
}
let dashIdx;
if (lastIndex === Infinity && candidate.endsWith(']')) {
let bracketIdx = candidate.indexOf('['); // If character before `[` isn't a dash or a slash, this isn't a dynamic class
// eg. string[]
dashIdx = ['-', '/'].includes(candidate[bracketIdx - 1]) ? bracketIdx - 1 : -1;
} else {
dashIdx = candidate.lastIndexOf('-', lastIndex);
}
if (dashIdx < 0) {
return;
}
let prefix = candidate.slice(0, dashIdx);
let modifier = candidate.slice(dashIdx + 1);
yield [prefix, modifier];
yield* candidatePermutations(candidate, dashIdx - 1);
}
function applyPrefix(matches, context) {
if (matches.length === 0 || context.tailwindConfig.prefix === '') {
return matches;
}
for (let match of matches) {
let [meta] = match;
if (meta.options.respectPrefix) {
let container = _postcss.default.root({
nodes: [match[1].clone()]
});
container.walkRules(r => {
r.selector = (0, _prefixSelector.default)(context.tailwindConfig.prefix, r.selector);
});
match[1] = container.nodes[0];
}
}
return matches;
}
function applyImportant(matches) {
if (matches.length === 0) {
return matches;
}
let result = [];
for (let [meta, rule] of matches) {
let container = _postcss.default.root({
nodes: [rule.clone()]
});
container.walkRules(r => {
r.selector = (0, _pluginUtils.updateAllClasses)(r.selector, className => {
return `!${className}`;
});
r.walkDecls(d => d.important = true);
});
result.push([{ ...meta,
important: true
}, container.nodes[0]]);
}
return result;
} // Takes a list of rule tuples and applies a variant like `hover`, sm`,
// whatever to it. We used to do some extra caching here to avoid generating
// a variant of the same rule more than once, but this was never hit because
// we cache at the entire selector level further up the tree.
//
// Technically you can get a cache hit if you have `hover:focus:text-center`
// and `focus:hover:text-center` in the same project, but it doesn't feel
// worth the complexity for that case.
function applyVariant(variant, matches, context) {
if (matches.length === 0) {
return matches;
}
if (context.variantMap.has(variant)) {
let variantFunctionTuples = context.variantMap.get(variant);
let result = [];
for (let [meta, rule] of matches) {
if (meta.options.respectVariants === false) {
result.push([meta, rule]);
continue;
}
let container = _postcss.default.root({
nodes: [rule.clone()]
});
for (let [variantSort, variantFunction] of variantFunctionTuples) {
let clone = container.clone();
function modifySelectors(modifierFunction) {
clone.each(rule => {
if (rule.type !== 'rule') {
return;
}
rule.selectors = rule.selectors.map(selector => {
return modifierFunction({
get className() {
return getClassNameFromSelector(selector);
},
selector
});
});
});
return clone;
}
let ruleWithVariant = variantFunction({
container: clone,
separator: context.tailwindConfig.separator,
modifySelectors
});
if (ruleWithVariant === null) {
continue;
}
let withOffset = [{ ...meta,
sort: variantSort | meta.sort
}, clone.nodes[0]];
result.push(withOffset);
}
}
return result;
}
return [];
}
function parseRules(rule, cache, options = {}) {
// PostCSS node
if (!(0, _isPlainObject.default)(rule) && !Array.isArray(rule)) {
return [[rule], options];
} // Tuple
if (Array.isArray(rule)) {
return parseRules(rule[0], cache, rule[1]);
} // Simple object
if (!cache.has(rule)) {
cache.set(rule, (0, _parseObjectStyles.default)(rule));
}
return [cache.get(rule), options];
}
function* resolveMatchedPlugins(classCandidate, context) {
if (context.candidateRuleMap.has(classCandidate)) {
yield [context.candidateRuleMap.get(classCandidate), 'DEFAULT'];
}
let candidatePrefix = classCandidate;
let negative = false;
const twConfigPrefix = context.tailwindConfig.prefix || '';
const twConfigPrefixLen = twConfigPrefix.length;
if (candidatePrefix[twConfigPrefixLen] === '-') {
negative = true;
candidatePrefix = twConfigPrefix + candidatePrefix.slice(twConfigPrefixLen + 1);
}
for (let [prefix, modifier] of candidatePermutations(candidatePrefix)) {
if (context.candidateRuleMap.has(prefix)) {
yield [context.candidateRuleMap.get(prefix), negative ? `-${modifier}` : modifier];
return;
}
}
}
function splitWithSeparator(input, separator) {
return input.split(new RegExp(`\\${separator}(?![^[]*\\])`, 'g'));
}
function* resolveMatches(candidate, context) {
let separator = context.tailwindConfig.separator;
let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse();
let important = false;
if (classCandidate.startsWith('!')) {
important = true;
classCandidate = classCandidate.slice(1);
} // TODO: Reintroduce this in ways that doesn't break on false positives
// function sortAgainst(toSort, against) {
// return toSort.slice().sort((a, z) => {
// return bigSign(against.get(a)[0] - against.get(z)[0])
// })
// }
// let sorted = sortAgainst(variants, context.variantMap)
// if (sorted.toString() !== variants.toString()) {
// let corrected = sorted.reverse().concat(classCandidate).join(':')
// throw new Error(`Class ${candidate} should be written as ${corrected}`)
// }
for (let matchedPlugins of resolveMatchedPlugins(classCandidate, context)) {
let matches = [];
let [plugins, modifier] = matchedPlugins;
for (let [sort, plugin] of plugins) {
if (typeof plugin === 'function') {
for (let ruleSet of [].concat(plugin(modifier))) {
let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
for (let rule of rules) {
matches.push([{ ...sort,
options: { ...sort.options,
...options
}
}, rule]);
}
}
} // Only process static plugins on exact matches
else if (modifier === 'DEFAULT') {
let ruleSet = plugin;
let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
for (let rule of rules) {
matches.push([{ ...sort,
options: { ...sort.options,
...options
}
}, rule]);
}
}
}
matches = applyPrefix(matches, context);
if (important) {
matches = applyImportant(matches, context);
}
for (let variant of variants) {
matches = applyVariant(variant, matches, context);
}
for (let match of matches) {
yield match;
}
}
}
function inKeyframes(rule) {
return rule.parent && rule.parent.type === 'atrule' && rule.parent.name === 'keyframes';
}
function generateRules(candidates, context) {
let allRules = [];
for (let candidate of candidates) {
if (context.notClassCache.has(candidate)) {
continue;
}
if (context.classCache.has(candidate)) {
allRules.push(context.classCache.get(candidate));
continue;
}
let matches = Array.from(resolveMatches(candidate, context));
if (matches.length === 0) {
context.notClassCache.add(candidate);
continue;
}
context.classCache.set(candidate, matches);
allRules.push(matches);
}
return allRules.flat(1).map(([{
sort,
layer,
options
}, rule]) => {
if (options.respectImportant) {
if (context.tailwindConfig.important === true) {
rule.walkDecls(d => {
if (d.parent.type === 'rule' && !inKeyframes(d.parent)) {
d.important = true;
}
});
} else if (typeof context.tailwindConfig.important === 'string') {
let container = _postcss.default.root({
nodes: [rule.clone()]
});
container.walkRules(r => {
if (inKeyframes(r)) {
return;
}
r.selectors = r.selectors.map(selector => {
return `${context.tailwindConfig.important} ${selector}`;
});
});
rule = container.nodes[0];
}
}
return [sort | context.layerOrder[layer], rule];
});
}

View file

@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = normalizeTailwindDirectives;
function normalizeTailwindDirectives(root) {
let tailwindDirectives = new Set();
let layerDirectives = new Set();
root.walkAtRules(atRule => {
if (atRule.name === 'import') {
if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
atRule.name = 'tailwind';
atRule.params = 'base';
} else if (atRule.params === '"tailwindcss/components"' || atRule.params === "'tailwindcss/components'") {
atRule.name = 'tailwind';
atRule.params = 'components';
} else if (atRule.params === '"tailwindcss/utilities"' || atRule.params === "'tailwindcss/utilities'") {
atRule.name = 'tailwind';
atRule.params = 'utilities';
} else if (atRule.params === '"tailwindcss/screens"' || atRule.params === "'tailwindcss/screens'" || atRule.params === '"tailwindcss/variants"' || atRule.params === "'tailwindcss/variants'") {
atRule.name = 'tailwind';
atRule.params = 'variants';
}
}
if (atRule.name === 'tailwind') {
if (atRule.params === 'screens') {
atRule.params = 'variants';
}
tailwindDirectives.add(atRule.params);
}
if (['layer', 'responsive', 'variants'].includes(atRule.name)) {
layerDirectives.add(atRule);
}
});
if (!tailwindDirectives.has('base') || !tailwindDirectives.has('components') || !tailwindDirectives.has('utilities')) {
for (let rule of layerDirectives) {
if (rule.name === 'layer' && ['base', 'components', 'utilities'].includes(rule.params)) {
if (!tailwindDirectives.has(rule.params)) {
throw rule.error(`\`@layer ${rule.params}\` is used but no matching \`@tailwind ${rule.params}\` directive is present.`);
}
} else if (rule.name === 'responsive') {
if (!tailwindDirectives.has('utilities')) {
throw rule.error('`@responsive` is used but `@tailwind utilities` is missing.');
}
} else if (rule.name === 'variants') {
if (!tailwindDirectives.has('utilities')) {
throw rule.error('`@variants` is used but `@tailwind utilities` is missing.');
}
}
}
}
return tailwindDirectives;
}

View file

@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = resolveDefaultsAtRules;
var _postcss = _interopRequireDefault(require("postcss"));
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
var _featureFlags = require("../../featureFlags");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function minimumImpactSelector(nodes) {
let pseudos = nodes.filter(n => n.type === 'pseudo');
let [bestNode] = nodes;
for (let [type, getNode = n => n] of [['class'], ['id', n => _postcssSelectorParser.default.attribute({
attribute: 'id',
operator: '=',
value: n.value,
quoteMark: '"'
})], ['attribute']]) {
let match = nodes.find(n => n.type === type);
if (match) {
bestNode = getNode(match);
break;
}
}
return [bestNode, ...pseudos].join('').trim();
}
let elementSelectorParser = (0, _postcssSelectorParser.default)(selectors => {
return selectors.map(s => {
let nodes = s.split(n => n.type === 'combinator').pop().filter(n => n.type !== 'pseudo' || n.value.startsWith('::'));
return minimumImpactSelector(nodes);
});
});
let cache = new Map();
function extractElementSelector(selector) {
if (!cache.has(selector)) {
cache.set(selector, elementSelectorParser.transformSync(selector));
}
return cache.get(selector);
}
function resolveDefaultsAtRules({
tailwindConfig
}) {
return root => {
let variableNodeMap = new Map();
let universals = new Set();
root.walkAtRules('defaults', rule => {
if (rule.nodes && rule.nodes.length > 0) {
universals.add(rule);
return;
}
let variable = rule.params;
if (!variableNodeMap.has(variable)) {
variableNodeMap.set(variable, new Set());
}
variableNodeMap.get(variable).add(rule.parent);
rule.remove();
});
for (let universal of universals) {
var _variableNodeMap$get;
let selectors = new Set();
let rules = (_variableNodeMap$get = variableNodeMap.get(universal.params)) !== null && _variableNodeMap$get !== void 0 ? _variableNodeMap$get : [];
for (let rule of rules) {
for (let selector of extractElementSelector(rule.selector)) {
selectors.add(selector);
}
}
if (selectors.size === 0) {
universal.remove();
continue;
}
let universalRule = _postcss.default.rule();
if ((0, _featureFlags.flagEnabled)(tailwindConfig, 'optimizeUniversalDefaults')) {
universalRule.selectors = [...selectors];
} else {
universalRule.selectors = ['*', '::before', '::after'];
}
universalRule.append(universal.nodes);
universal.before(universalRule);
universal.remove();
}
};
}

View file

@ -0,0 +1,657 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getFileModifiedMap = getFileModifiedMap;
exports.createContext = createContext;
exports.getContext = getContext;
var _fs = _interopRequireDefault(require("fs"));
var _url = _interopRequireDefault(require("url"));
var _postcss = _interopRequireDefault(require("postcss"));
var _dlv = _interopRequireDefault(require("dlv"));
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
var _transformThemeValue = _interopRequireDefault(require("../../util/transformThemeValue"));
var _parseObjectStyles = _interopRequireDefault(require("../../util/parseObjectStyles"));
var _prefixSelector = _interopRequireDefault(require("../../util/prefixSelector"));
var _isPlainObject = _interopRequireDefault(require("../../util/isPlainObject"));
var _escapeClassName = _interopRequireDefault(require("../../util/escapeClassName"));
var _nameClass = _interopRequireDefault(require("../../util/nameClass"));
var _pluginUtils = require("../../util/pluginUtils");
var _bigSign = _interopRequireDefault(require("../../util/bigSign"));
var _corePlugins = _interopRequireDefault(require("../corePlugins"));
var sharedState = _interopRequireWildcard(require("./sharedState"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toPath(value) {
if (Array.isArray(value)) {
return value;
}
let inBrackets = false;
let parts = [];
let chunk = '';
for (let i = 0; i < value.length; i++) {
let char = value[i];
if (char === '[') {
inBrackets = true;
parts.push(chunk);
chunk = '';
continue;
}
if (char === ']' && inBrackets) {
inBrackets = false;
parts.push(chunk);
chunk = '';
continue;
}
if (char === '.' && !inBrackets && chunk.length > 0) {
parts.push(chunk);
chunk = '';
continue;
}
chunk = chunk + char;
}
if (chunk.length > 0) {
parts.push(chunk);
}
return parts;
}
function insertInto(list, value, {
before = []
} = {}) {
before = [].concat(before);
if (before.length <= 0) {
list.push(value);
return;
}
let idx = list.length - 1;
for (let other of before) {
let iidx = list.indexOf(other);
if (iidx === -1) continue;
idx = Math.min(idx, iidx);
}
list.splice(idx, 0, value);
}
function parseStyles(styles) {
if (!Array.isArray(styles)) {
return parseStyles([styles]);
}
return styles.flatMap(style => {
let isNode = !Array.isArray(style) && !(0, _isPlainObject.default)(style);
return isNode ? style : (0, _parseObjectStyles.default)(style);
});
}
function getClasses(selector) {
let parser = (0, _postcssSelectorParser.default)(selectors => {
let allClasses = [];
selectors.walkClasses(classNode => {
allClasses.push(classNode.value);
});
return allClasses;
});
return parser.transformSync(selector);
}
function extractCandidates(node) {
let classes = node.type === 'rule' ? getClasses(node.selector) : [];
if (node.type === 'atrule') {
node.walkRules(rule => {
classes = [...classes, ...getClasses(rule.selector)];
});
}
return classes;
}
function withIdentifiers(styles) {
return parseStyles(styles).flatMap(node => {
let nodeMap = new Map();
let candidates = extractCandidates(node); // If this isn't "on-demandable", assign it a universal candidate.
if (candidates.length === 0) {
return [['*', node]];
}
return candidates.map(c => {
if (!nodeMap.has(node)) {
nodeMap.set(node, node);
}
return [c, nodeMap.get(node)];
});
});
}
let matchingBrackets = new Map([['{', '}'], ['[', ']'], ['(', ')']]);
let inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v]) => [v, k]));
let quotes = new Set(['"', "'", '`']); // Arbitrary values must contain balanced brackets (), [] and {}. Escaped
// values don't count, and brackets inside quotes also don't count.
//
// E.g.: w-[this-is]w-[weird-and-invalid]
// E.g.: w-[this-is\\]w-\\[weird-but-valid]
// E.g.: content-['this-is-also-valid]-weirdly-enough']
function isValidArbitraryValue(value) {
let stack = [];
let inQuotes = false;
for (let i = 0; i < value.length; i++) {
let char = value[i]; // Non-escaped quotes allow us to "allow" anything in between
if (quotes.has(char) && value[i - 1] !== '\\') {
inQuotes = !inQuotes;
}
if (inQuotes) continue;
if (value[i - 1] === '\\') continue; // Escaped
if (matchingBrackets.has(char)) {
stack.push(char);
} else if (inverseMatchingBrackets.has(char)) {
let inverse = inverseMatchingBrackets.get(char); // Nothing to pop from, therefore it is unbalanced
if (stack.length <= 0) {
return false;
} // Popped value must match the inverse value, otherwise it is unbalanced
if (stack.pop() !== inverse) {
return false;
}
}
} // If there is still something on the stack, it is also unbalanced
if (stack.length > 0) {
return false;
} // All good, totally balanced!
return true;
}
function buildPluginApi(tailwindConfig, context, {
variantList,
variantMap,
offsets
}) {
function getConfigValue(path, defaultValue) {
return path ? (0, _dlv.default)(tailwindConfig, path, defaultValue) : tailwindConfig;
}
function applyConfiguredPrefix(selector) {
return (0, _prefixSelector.default)(tailwindConfig.prefix, selector);
}
function prefixIdentifier(identifier, options) {
if (identifier === '*') {
return '*';
}
if (!options.respectPrefix) {
return identifier;
}
if (typeof context.tailwindConfig.prefix === 'function') {
return (0, _prefixSelector.default)(context.tailwindConfig.prefix, `.${identifier}`).substr(1);
}
return context.tailwindConfig.prefix + identifier;
}
return {
addVariant(variantName, variantFunctions, options = {}) {
variantFunctions = [].concat(variantFunctions);
insertInto(variantList, variantName, options);
variantMap.set(variantName, variantFunctions);
},
postcss: _postcss.default,
prefix: applyConfiguredPrefix,
e: _escapeClassName.default,
config: getConfigValue,
theme(path, defaultValue) {
const [pathRoot, ...subPaths] = toPath(path);
const value = getConfigValue(['theme', pathRoot, ...subPaths], defaultValue);
return (0, _transformThemeValue.default)(pathRoot)(value);
},
corePlugins: path => {
if (Array.isArray(tailwindConfig.corePlugins)) {
return tailwindConfig.corePlugins.includes(path);
}
return getConfigValue(['corePlugins', path], true);
},
variants: (path, defaultValue) => {
if (Array.isArray(tailwindConfig.variants)) {
return tailwindConfig.variants;
}
return getConfigValue(['variants', path], defaultValue);
},
addBase(base) {
for (let [identifier, rule] of withIdentifiers(base)) {
let prefixedIdentifier = prefixIdentifier(identifier, {});
let offset = offsets.base++;
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
context.candidateRuleMap.set(prefixedIdentifier, []);
}
context.candidateRuleMap.get(prefixedIdentifier).push([{
sort: offset,
layer: 'base'
}, rule]);
}
},
addComponents(components, options) {
let defaultOptions = {
variants: [],
respectPrefix: true,
respectImportant: false,
respectVariants: true
};
options = Object.assign({}, defaultOptions, Array.isArray(options) ? {
variants: options
} : options);
for (let [identifier, rule] of withIdentifiers(components)) {
let prefixedIdentifier = prefixIdentifier(identifier, options);
let offset = offsets.components++;
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
context.candidateRuleMap.set(prefixedIdentifier, []);
}
context.candidateRuleMap.get(prefixedIdentifier).push([{
sort: offset,
layer: 'components',
options
}, rule]);
}
},
addUtilities(utilities, options) {
let defaultOptions = {
variants: [],
respectPrefix: true,
respectImportant: true,
respectVariants: true
};
options = Object.assign({}, defaultOptions, Array.isArray(options) ? {
variants: options
} : options);
for (let [identifier, rule] of withIdentifiers(utilities)) {
let prefixedIdentifier = prefixIdentifier(identifier, options);
let offset = offsets.utilities++;
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
context.candidateRuleMap.set(prefixedIdentifier, []);
}
context.candidateRuleMap.get(prefixedIdentifier).push([{
sort: offset,
layer: 'utilities',
options
}, rule]);
}
},
matchUtilities: function (utilities, options) {
let defaultOptions = {
variants: [],
respectPrefix: true,
respectImportant: true,
respectVariants: true
};
options = { ...defaultOptions,
...options
};
let offset = offsets.utilities++;
for (let identifier in utilities) {
let prefixedIdentifier = prefixIdentifier(identifier, options);
let rule = utilities[identifier];
function wrapped(modifier) {
let {
type = 'any'
} = options;
type = [].concat(type);
let [value, coercedType] = (0, _pluginUtils.coerceValue)(type, modifier, options.values, tailwindConfig);
if (!type.includes(coercedType) || value === undefined) {
return [];
}
if (!isValidArbitraryValue(value)) {
return [];
}
let includedRules = [];
let ruleSets = [].concat(rule(value, {
includeRules(rules) {
includedRules.push(...rules);
}
})).filter(Boolean).map(declaration => ({
[(0, _nameClass.default)(identifier, modifier)]: declaration
}));
return [...includedRules, ...ruleSets];
}
let withOffsets = [{
sort: offset,
layer: 'utilities',
options
}, wrapped];
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
context.candidateRuleMap.set(prefixedIdentifier, []);
}
context.candidateRuleMap.get(prefixedIdentifier).push(withOffsets);
}
}
};
}
let fileModifiedMapCache = new WeakMap();
function getFileModifiedMap(context) {
if (!fileModifiedMapCache.has(context)) {
fileModifiedMapCache.set(context, new Map());
}
return fileModifiedMapCache.get(context);
}
function trackModified(files, fileModifiedMap) {
let changed = false;
for (let file of files) {
if (!file) continue;
let parsed = _url.default.parse(file);
let pathname = parsed.hash ? parsed.href.replace(parsed.hash, '') : parsed.href;
pathname = parsed.search ? pathname.replace(parsed.search, '') : pathname;
let newModified = _fs.default.statSync(decodeURIComponent(pathname)).mtimeMs;
if (!fileModifiedMap.has(file) || newModified > fileModifiedMap.get(file)) {
changed = true;
}
fileModifiedMap.set(file, newModified);
}
return changed;
}
function extractVariantAtRules(node) {
node.walkAtRules(atRule => {
if (['responsive', 'variants'].includes(atRule.name)) {
extractVariantAtRules(atRule);
atRule.before(atRule.nodes);
atRule.remove();
}
});
}
function collectLayerPlugins(root) {
let layerPlugins = [];
root.each(node => {
if (node.type === 'atrule' && ['responsive', 'variants'].includes(node.name)) {
node.name = 'layer';
node.params = 'utilities';
}
}); // Walk @layer rules and treat them like plugins
root.walkAtRules('layer', layerRule => {
extractVariantAtRules(layerRule);
if (layerRule.params === 'base') {
for (let node of layerRule.nodes) {
layerPlugins.push(function ({
addBase
}) {
addBase(node, {
respectPrefix: false
});
});
}
layerRule.remove();
} else if (layerRule.params === 'components') {
for (let node of layerRule.nodes) {
layerPlugins.push(function ({
addComponents
}) {
addComponents(node, {
respectPrefix: false
});
});
}
layerRule.remove();
} else if (layerRule.params === 'utilities') {
for (let node of layerRule.nodes) {
layerPlugins.push(function ({
addUtilities
}) {
addUtilities(node, {
respectPrefix: false
});
});
}
layerRule.remove();
}
});
return layerPlugins;
}
function resolvePlugins(context, tailwindDirectives, root) {
let corePluginList = Object.entries(_corePlugins.default).map(([name, plugin]) => {
if (!context.tailwindConfig.corePlugins.includes(name)) {
return null;
}
return plugin;
}).filter(Boolean);
let userPlugins = context.tailwindConfig.plugins.map(plugin => {
if (plugin.__isOptionsFunction) {
plugin = plugin();
}
return typeof plugin === 'function' ? plugin : plugin.handler;
});
let layerPlugins = collectLayerPlugins(root, tailwindDirectives); // TODO: This is a workaround for backwards compatibility, since custom variants
// were historically sorted before screen/stackable variants.
let beforeVariants = [_corePlugins.default['pseudoElementVariants'], _corePlugins.default['pseudoClassVariants']];
let afterVariants = [_corePlugins.default['directionVariants'], _corePlugins.default['reducedMotionVariants'], _corePlugins.default['darkVariants'], _corePlugins.default['screenVariants']];
return [...corePluginList, ...beforeVariants, ...userPlugins, ...afterVariants, ...layerPlugins];
}
function registerPlugins(plugins, context) {
let variantList = [];
let variantMap = new Map();
let offsets = {
base: 0n,
components: 0n,
utilities: 0n
};
let pluginApi = buildPluginApi(context.tailwindConfig, context, {
variantList,
variantMap,
offsets
});
for (let plugin of plugins) {
if (Array.isArray(plugin)) {
for (let pluginItem of plugin) {
pluginItem(pluginApi);
}
} else {
plugin(pluginApi);
}
}
let highestOffset = (args => args.reduce((m, e) => e > m ? e : m))([offsets.base, offsets.components, offsets.utilities]);
let reservedBits = BigInt(highestOffset.toString(2).length);
context.layerOrder = {
base: 1n << reservedBits << 0n,
components: 1n << reservedBits << 1n,
utilities: 1n << reservedBits << 2n
};
reservedBits += 3n;
let offset = 0;
context.variantOrder = new Map(variantList.map((variant, i) => {
let variantFunctions = variantMap.get(variant).length;
let bits = 1n << BigInt(i + offset) << reservedBits;
offset += variantFunctions - 1;
return [variant, bits];
}).sort(([, a], [, z]) => (0, _bigSign.default)(a - z)));
context.minimumScreen = [...context.variantOrder.values()].shift(); // Build variantMap
for (let [variantName, variantFunctions] of variantMap.entries()) {
let sort = context.variantOrder.get(variantName);
context.variantMap.set(variantName, variantFunctions.map((variantFunction, idx) => [sort << BigInt(idx), variantFunction]));
}
}
function createContext(tailwindConfig, changedContent = [], tailwindDirectives = new Set(), root = _postcss.default.root()) {
let context = {
disposables: [],
ruleCache: new Set(),
classCache: new Map(),
applyClassCache: new Map(),
notClassCache: new Set(),
postCssNodeCache: new Map(),
candidateRuleMap: new Map(),
tailwindConfig,
changedContent: changedContent,
variantMap: new Map(),
stylesheetCache: null
};
let resolvedPlugins = resolvePlugins(context, tailwindDirectives, root);
registerPlugins(resolvedPlugins, context);
return context;
}
let contextMap = sharedState.contextMap;
let configContextMap = sharedState.configContextMap;
let contextSourcesMap = sharedState.contextSourcesMap;
function getContext(tailwindDirectives, root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies) {
let sourcePath = result.opts.from;
let isConfigFile = userConfigPath !== null;
sharedState.env.DEBUG && console.log('Source path:', sourcePath);
let existingContext;
if (isConfigFile && contextMap.has(sourcePath)) {
existingContext = contextMap.get(sourcePath);
} else if (configContextMap.has(tailwindConfigHash)) {
let context = configContextMap.get(tailwindConfigHash);
contextSourcesMap.get(context).add(sourcePath);
contextMap.set(sourcePath, context);
existingContext = context;
} // If there's already a context in the cache and we don't need to
// reset the context, return the cached context.
if (existingContext) {
let contextDependenciesChanged = trackModified([...contextDependencies], getFileModifiedMap(existingContext));
if (!contextDependenciesChanged) {
return [existingContext, false];
}
} // If this source is in the context map, get the old context.
// Remove this source from the context sources for the old context,
// and clean up that context if no one else is using it. This can be
// called by many processes in rapid succession, so we check for presence
// first because the first process to run this code will wipe it out first.
if (contextMap.has(sourcePath)) {
let oldContext = contextMap.get(sourcePath);
if (contextSourcesMap.has(oldContext)) {
contextSourcesMap.get(oldContext).delete(sourcePath);
if (contextSourcesMap.get(oldContext).size === 0) {
contextSourcesMap.delete(oldContext);
for (let [tailwindConfigHash, context] of configContextMap) {
if (context === oldContext) {
configContextMap.delete(tailwindConfigHash);
}
}
for (let disposable of oldContext.disposables.splice(0)) {
disposable(oldContext);
}
}
}
}
sharedState.env.DEBUG && console.log('Setting up new context...');
let context = createContext(tailwindConfig, [], tailwindDirectives, root);
trackModified([...contextDependencies], getFileModifiedMap(context)); // ---
// Update all context tracking state
configContextMap.set(tailwindConfigHash, context);
contextMap.set(sourcePath, context);
if (!contextSourcesMap.has(context)) {
contextSourcesMap.set(context, new Set());
}
contextSourcesMap.get(context).add(sourcePath);
return [context, true];
}

View file

@ -0,0 +1,206 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = setupTrackingContext;
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
var _fastGlob = _interopRequireDefault(require("fast-glob"));
var _quickLru = _interopRequireDefault(require("quick-lru"));
var _normalizePath = _interopRequireDefault(require("normalize-path"));
var _hashConfig = _interopRequireDefault(require("../../util/hashConfig"));
var _getModuleDependencies = _interopRequireDefault(require("../../lib/getModuleDependencies"));
var _resolveConfig = _interopRequireDefault(require("../../../resolveConfig"));
var _resolveConfigPath = _interopRequireDefault(require("../../util/resolveConfigPath"));
var _sharedState = require("./sharedState");
var _setupContextUtils = require("./setupContextUtils");
var _parseDependency = _interopRequireDefault(require("../../util/parseDependency"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let configPathCache = new _quickLru.default({
maxSize: 100
});
let candidateFilesCache = new WeakMap();
function getCandidateFiles(context, tailwindConfig) {
if (candidateFilesCache.has(context)) {
return candidateFilesCache.get(context);
}
let purgeContent = Array.isArray(tailwindConfig.purge) ? tailwindConfig.purge : tailwindConfig.purge.content;
let candidateFiles = purgeContent.filter(item => typeof item === 'string').map(purgePath => (0, _normalizePath.default)(_path.default.resolve(purgePath)));
return candidateFilesCache.set(context, candidateFiles).get(context);
} // Get the config object based on a path
function getTailwindConfig(configOrPath) {
let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
if (userConfigPath !== null) {
let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
let newDeps = (0, _getModuleDependencies.default)(userConfigPath).map(dep => dep.file);
let modified = false;
let newModified = new Map();
for (let file of newDeps) {
let time = _fs.default.statSync(file).mtimeMs;
newModified.set(file, time);
if (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) {
modified = true;
}
} // It hasn't changed (based on timestamps)
if (!modified) {
return [prevConfig, userConfigPath, prevConfigHash, prevDeps];
} // It has changed (based on timestamps), or first run
for (let file of newDeps) {
delete require.cache[file];
}
let newConfig = (0, _resolveConfig.default)(require(userConfigPath));
let newHash = (0, _hashConfig.default)(newConfig);
configPathCache.set(userConfigPath, [newConfig, newHash, newDeps, newModified]);
return [newConfig, userConfigPath, newHash, newDeps];
} // It's a plain object, not a path
let newConfig = (0, _resolveConfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
return [newConfig, null, (0, _hashConfig.default)(newConfig), []];
}
function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
var _context$tailwindConf, _context$tailwindConf2;
let changedContent = (Array.isArray(context.tailwindConfig.purge) ? context.tailwindConfig.purge : context.tailwindConfig.purge.content).filter(item => typeof item.raw === 'string').concat(((_context$tailwindConf = (_context$tailwindConf2 = context.tailwindConfig.purge) === null || _context$tailwindConf2 === void 0 ? void 0 : _context$tailwindConf2.safelist) !== null && _context$tailwindConf !== void 0 ? _context$tailwindConf : []).map(content => {
if (typeof content === 'string') {
return {
raw: content,
extension: 'html'
};
}
if (content instanceof RegExp) {
throw new Error("Values inside 'purge.safelist' can only be of type 'string', found 'regex'.");
}
throw new Error(`Values inside 'purge.safelist' can only be of type 'string', found '${typeof content}'.`);
})).map(({
raw,
extension
}) => ({
content: raw,
extension
}));
for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)) {
let content = _fs.default.readFileSync(changedFile, 'utf8');
let extension = _path.default.extname(changedFile).slice(1);
changedContent.push({
content,
extension
});
}
return changedContent;
}
function resolveChangedFiles(candidateFiles, fileModifiedMap) {
let changedFiles = new Set();
_sharedState.env.DEBUG && console.time('Finding changed files');
let files = _fastGlob.default.sync(candidateFiles);
for (let file of files) {
let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
let modified = _fs.default.statSync(file).mtimeMs;
if (modified > prevModified) {
changedFiles.add(file);
fileModifiedMap.set(file, modified);
}
}
_sharedState.env.DEBUG && console.timeEnd('Finding changed files');
return changedFiles;
} // DISABLE_TOUCH = TRUE
// Retrieve an existing context from cache if possible (since contexts are unique per
// source path), or set up a new one (including setting up watchers and registering
// plugins) then return it
function setupTrackingContext(configOrPath) {
return ({
tailwindDirectives,
registerDependency
}) => {
return (root, result) => {
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
let contextDependencies = new Set(configDependencies); // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
// to be dependencies of the context. Can reuse the context even if they change.
// We may want to think about `@layer` being part of this trigger too, but it's tough
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
// in another file since independent sources are effectively isolated.
if (tailwindDirectives.size > 0) {
// Add current css file as a context dependencies.
contextDependencies.add(result.opts.from); // Add all css @import dependencies as context dependencies.
for (let message of result.messages) {
if (message.type === 'dependency') {
contextDependencies.add(message.file);
}
}
}
let [context] = (0, _setupContextUtils.getContext)(tailwindDirectives, root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
let candidateFiles = getCandidateFiles(context, tailwindConfig); // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
// to be dependencies of the context. Can reuse the context even if they change.
// We may want to think about `@layer` being part of this trigger too, but it's tough
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
// in another file since independent sources are effectively isolated.
if (tailwindDirectives.size > 0) {
let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context); // Add template paths as postcss dependencies.
for (let fileOrGlob of candidateFiles) {
registerDependency((0, _parseDependency.default)(fileOrGlob));
}
for (let changedContent of resolvedChangedContent(context, candidateFiles, fileModifiedMap)) {
context.changedContent.push(changedContent);
}
}
for (let file of configDependencies) {
registerDependency({
type: 'dependency',
file
});
}
return context;
};
};
}

View file

@ -0,0 +1,351 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = setupWatchingContext;
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
var _tmp = _interopRequireDefault(require("tmp"));
var _chokidar = _interopRequireDefault(require("chokidar"));
var _fastGlob = _interopRequireDefault(require("fast-glob"));
var _quickLru = _interopRequireDefault(require("quick-lru"));
var _normalizePath = _interopRequireDefault(require("normalize-path"));
var _hashConfig = _interopRequireDefault(require("../../util/hashConfig"));
var _log = _interopRequireDefault(require("../../util/log"));
var _getModuleDependencies = _interopRequireDefault(require("../../lib/getModuleDependencies"));
var _resolveConfig = _interopRequireDefault(require("../../../resolveConfig"));
var _resolveConfigPath = _interopRequireDefault(require("../../util/resolveConfigPath"));
var _setupContextUtils = require("./setupContextUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// This is used to trigger rebuilds. Just updating the timestamp
// is significantly faster than actually writing to the file (10x).
function touch(filename) {
let time = new Date();
try {
_fs.default.utimesSync(filename, time, time);
} catch (err) {
_fs.default.closeSync(_fs.default.openSync(filename, 'w'));
}
}
let watchers = new WeakMap();
function getWatcher(context) {
if (watchers.has(context)) {
return watchers.get(context);
}
return null;
}
function setWatcher(context, watcher) {
return watchers.set(context, watcher);
}
let touchFiles = new WeakMap();
function getTouchFile(context) {
if (touchFiles.has(context)) {
return touchFiles.get(context);
}
return null;
}
function setTouchFile(context, touchFile) {
return touchFiles.set(context, touchFile);
}
let configPaths = new WeakMap();
function getConfigPath(context, configOrPath) {
if (!configPaths.has(context)) {
configPaths.set(context, (0, _resolveConfigPath.default)(configOrPath));
}
return configPaths.get(context);
}
function rebootWatcher(context, configPath, configDependencies, candidateFiles) {
let touchFile = getTouchFile(context);
if (touchFile === null) {
touchFile = _tmp.default.fileSync().name;
setTouchFile(context, touchFile);
touch(touchFile);
}
let watcher = getWatcher(context);
Promise.resolve(watcher ? watcher.close() : null).then(() => {
_log.default.info(['Tailwind CSS is watching for changes...', 'https://tailwindcss.com/docs/just-in-time-mode#watch-mode-and-one-off-builds']);
watcher = _chokidar.default.watch([...candidateFiles, ...configDependencies], {
ignoreInitial: true,
awaitWriteFinish: process.platform === 'win32' ? {
stabilityThreshold: 50,
pollInterval: 10
} : false
});
setWatcher(context, watcher);
watcher.on('add', file => {
let changedFile = _path.default.resolve('.', file);
let content = _fs.default.readFileSync(changedFile, 'utf8');
let extension = _path.default.extname(changedFile).slice(1);
context.changedContent.push({
content,
extension
});
touch(touchFile);
});
watcher.on('change', file => {
// If it was a config dependency, touch the config file to trigger a new context.
// This is not really that clean of a solution but it's the fastest, because we
// can do a very quick check on each build to see if the config has changed instead
// of having to get all of the module dependencies and check every timestamp each
// time.
if (configDependencies.has(file)) {
for (let dependency of configDependencies) {
delete require.cache[require.resolve(dependency)];
}
touch(configPath);
} else {
let changedFile = _path.default.resolve('.', file);
let content = _fs.default.readFileSync(changedFile, 'utf8');
let extension = _path.default.extname(changedFile).slice(1);
context.changedContent.push({
content,
extension
});
touch(touchFile);
}
});
watcher.on('unlink', file => {
// Touch the config file if any of the dependencies are deleted.
if (configDependencies.has(file)) {
for (let dependency of configDependencies) {
delete require.cache[require.resolve(dependency)];
}
touch(configPath);
}
});
});
}
let configPathCache = new _quickLru.default({
maxSize: 100
});
let configDependenciesCache = new WeakMap();
function getConfigDependencies(context) {
if (!configDependenciesCache.has(context)) {
configDependenciesCache.set(context, new Set());
}
return configDependenciesCache.get(context);
}
let candidateFilesCache = new WeakMap();
function getCandidateFiles(context, tailwindConfig) {
if (candidateFilesCache.has(context)) {
return candidateFilesCache.get(context);
}
let purgeContent = Array.isArray(tailwindConfig.purge) ? tailwindConfig.purge : tailwindConfig.purge.content;
let candidateFiles = purgeContent.filter(item => typeof item === 'string').map(purgePath => (0, _normalizePath.default)(_path.default.resolve(purgePath)));
return candidateFilesCache.set(context, candidateFiles).get(context);
} // Get the config object based on a path
function getTailwindConfig(configOrPath) {
let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
if (userConfigPath !== null) {
let [prevConfig, prevModified = -Infinity, prevConfigHash] = configPathCache.get(userConfigPath) || [];
let modified = _fs.default.statSync(userConfigPath).mtimeMs; // It hasn't changed (based on timestamp)
if (modified <= prevModified) {
return [prevConfig, userConfigPath, prevConfigHash, [userConfigPath]];
} // It has changed (based on timestamp), or first run
delete require.cache[userConfigPath];
let newConfig = (0, _resolveConfig.default)(require(userConfigPath));
let newHash = (0, _hashConfig.default)(newConfig);
configPathCache.set(userConfigPath, [newConfig, modified, newHash]);
return [newConfig, userConfigPath, newHash, [userConfigPath]];
} // It's a plain object, not a path
let newConfig = (0, _resolveConfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
return [newConfig, null, (0, _hashConfig.default)(newConfig), []];
}
function resolvedChangedContent(context, candidateFiles) {
var _context$tailwindConf, _context$tailwindConf2;
let changedContent = (Array.isArray(context.tailwindConfig.purge) ? context.tailwindConfig.purge : context.tailwindConfig.purge.content).filter(item => typeof item.raw === 'string').concat(((_context$tailwindConf = (_context$tailwindConf2 = context.tailwindConfig.purge) === null || _context$tailwindConf2 === void 0 ? void 0 : _context$tailwindConf2.safelist) !== null && _context$tailwindConf !== void 0 ? _context$tailwindConf : []).map(content => {
if (typeof content === 'string') {
return {
raw: content,
extension: 'html'
};
}
if (content instanceof RegExp) {
throw new Error("Values inside 'purge.safelist' can only be of type 'string', found 'regex'.");
}
throw new Error(`Values inside 'purge.safelist' can only be of type 'string', found '${typeof content}'.`);
})).map(({
raw,
extension
}) => ({
content: raw,
extension
}));
for (let changedFile of resolveChangedFiles(context, candidateFiles)) {
let content = _fs.default.readFileSync(changedFile, 'utf8');
let extension = _path.default.extname(changedFile).slice(1);
changedContent.push({
content,
extension
});
}
return changedContent;
}
let scannedContentCache = new WeakMap();
function resolveChangedFiles(context, candidateFiles) {
let changedFiles = new Set(); // If we're not set up and watching files ourselves, we need to do
// the work of grabbing all of the template files for candidate
// detection.
if (!scannedContentCache.has(context)) {
let files = _fastGlob.default.sync(candidateFiles);
for (let file of files) {
changedFiles.add(file);
}
scannedContentCache.set(context, true);
}
return changedFiles;
} // DISABLE_TOUCH = FALSE
// Retrieve an existing context from cache if possible (since contexts are unique per
// source path), or set up a new one (including setting up watchers and registering
// plugins) then return it
function setupWatchingContext(configOrPath) {
return ({
tailwindDirectives,
registerDependency
}) => {
return (root, result) => {
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
let contextDependencies = new Set(configDependencies); // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
// to be dependencies of the context. Can reuse the context even if they change.
// We may want to think about `@layer` being part of this trigger too, but it's tough
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
// in another file since independent sources are effectively isolated.
if (tailwindDirectives.size > 0) {
// Add current css file as a context dependencies.
contextDependencies.add(result.opts.from); // Add all css @import dependencies as context dependencies.
for (let message of result.messages) {
if (message.type === 'dependency') {
contextDependencies.add(message.file);
}
}
}
let [context, isNewContext] = (0, _setupContextUtils.getContext)(tailwindDirectives, root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
let candidateFiles = getCandidateFiles(context, tailwindConfig);
let contextConfigDependencies = getConfigDependencies(context);
for (let file of configDependencies) {
registerDependency({
type: 'dependency',
file
});
}
context.disposables.push(oldContext => {
let watcher = getWatcher(oldContext);
if (watcher !== null) {
watcher.close();
}
});
let configPath = getConfigPath(context, configOrPath);
if (configPath !== null) {
for (let dependency of (0, _getModuleDependencies.default)(configPath)) {
if (dependency.file === configPath) {
continue;
}
contextConfigDependencies.add(dependency.file);
}
}
if (isNewContext) {
rebootWatcher(context, configPath, contextConfigDependencies, candidateFiles);
} // Register our temp file as a dependency — we write to this file
// to trigger rebuilds.
let touchFile = getTouchFile(context);
if (touchFile) {
registerDependency({
type: 'dependency',
file: touchFile
});
}
if (tailwindDirectives.size > 0) {
for (let changedContent of resolvedChangedContent(context, candidateFiles)) {
context.changedContent.push(changedContent);
}
}
return context;
};
};
}

29
node_modules/tailwindcss/lib/jit/lib/sharedState.js generated vendored Normal file
View file

@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.contentMatchCache = exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
var _quickLru = _interopRequireDefault(require("quick-lru"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const env = {
TAILWIND_MODE: process.env.TAILWIND_MODE,
NODE_ENV: process.env.NODE_ENV,
DEBUG: process.env.DEBUG !== undefined,
TAILWIND_DISABLE_TOUCH: process.env.TAILWIND_DISABLE_TOUCH !== undefined,
TAILWIND_TOUCH_DIR: process.env.TAILWIND_TOUCH_DIR
};
exports.env = env;
const contextMap = new Map();
exports.contextMap = contextMap;
const configContextMap = new Map();
exports.configContextMap = configContextMap;
const contextSourcesMap = new Map();
exports.contextSourcesMap = contextSourcesMap;
const contentMatchCache = new _quickLru.default({
maxSize: 25000
});
exports.contentMatchCache = contentMatchCache;

View file

@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = processTailwindFeatures;
var _normalizeTailwindDirectives = _interopRequireDefault(require("./lib/normalizeTailwindDirectives"));
var _expandTailwindAtRules = _interopRequireDefault(require("./lib/expandTailwindAtRules"));
var _expandApplyAtRules = _interopRequireDefault(require("./lib/expandApplyAtRules"));
var _evaluateTailwindFunctions = _interopRequireDefault(require("../lib/evaluateTailwindFunctions"));
var _substituteScreenAtRules = _interopRequireDefault(require("../lib/substituteScreenAtRules"));
var _resolveDefaultsAtRules = _interopRequireDefault(require("./lib/resolveDefaultsAtRules"));
var _collapseAdjacentRules = _interopRequireDefault(require("./lib/collapseAdjacentRules"));
var _setupContextUtils = require("./lib/setupContextUtils");
var _log = _interopRequireDefault(require("../util/log"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let warned = false;
function processTailwindFeatures(setupContext) {
return function (root, result) {
if (!warned) {
_log.default.warn([`You have enabled the JIT engine which is currently in preview.`, 'Preview features are not covered by semver, may introduce breaking changes, and can change at any time.']);
warned = true;
}
let tailwindDirectives = (0, _normalizeTailwindDirectives.default)(root);
let context = setupContext({
tailwindDirectives,
registerDependency(dependency) {
result.messages.push({
plugin: 'tailwindcss',
parent: result.opts.from,
...dependency
});
},
createContext(tailwindConfig, changedContent) {
return (0, _setupContextUtils.createContext)(tailwindConfig, changedContent, tailwindDirectives, root);
}
})(root, result);
if (context.tailwindConfig.separator === '-') {
throw new Error("The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead.");
}
(0, _expandTailwindAtRules.default)(context)(root, result);
(0, _expandApplyAtRules.default)(context)(root, result);
(0, _evaluateTailwindFunctions.default)(context)(root, result);
(0, _substituteScreenAtRules.default)(context)(root, result);
(0, _resolveDefaultsAtRules.default)(context)(root, result);
(0, _collapseAdjacentRules.default)(context)(root, result);
};
}

View file

@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = applyImportantConfiguration;
function applyImportantConfiguration(_config) {
return function (css) {
css.walkRules(rule => {
const important = rule.__tailwind ? rule.__tailwind.important : false;
if (!important) {
return;
}
if (typeof important === 'string') {
rule.selectors = rule.selectors.map(selector => {
return `${rule.__tailwind.important} ${selector}`;
});
} else {
rule.walkDecls(decl => decl.important = true);
}
});
};
}

View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = convertLayerAtRulesToControlComments;
var _postcss = _interopRequireDefault(require("postcss"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function convertLayerAtRulesToControlComments() {
return function (css) {
css.walkAtRules('layer', atRule => {
const layer = atRule.params;
if (!['base', 'components', 'utilities'].includes(layer)) {
return;
}
atRule.before(_postcss.default.comment({
text: `tailwind start ${layer}`
}));
atRule.before(atRule.nodes);
atRule.before(_postcss.default.comment({
text: `tailwind end ${layer}`
}));
atRule.remove();
});
};
}

View file

@ -0,0 +1,188 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _lodash = _interopRequireDefault(require("lodash"));
var _didyoumean = _interopRequireDefault(require("didyoumean"));
var _transformThemeValue = _interopRequireDefault(require("../util/transformThemeValue"));
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function findClosestExistingPath(theme, path) {
const parts = _lodash.default.toPath(path);
do {
parts.pop();
if (_lodash.default.hasIn(theme, parts)) break;
} while (parts.length);
return parts.length ? parts : undefined;
}
function pathToString(path) {
if (typeof path === 'string') return path;
return path.reduce((acc, cur, i) => {
if (cur.includes('.')) return `${acc}[${cur}]`;
return i === 0 ? cur : `${acc}.${cur}`;
}, '');
}
function list(items) {
return items.map(key => `'${key}'`).join(', ');
}
function listKeys(obj) {
return list(Object.keys(obj));
}
function validatePath(config, path, defaultValue) {
const pathString = Array.isArray(path) ? pathToString(path) : _lodash.default.trim(path, `'"`);
const pathSegments = Array.isArray(path) ? path : _lodash.default.toPath(pathString);
const value = _lodash.default.get(config.theme, pathString, defaultValue);
if (typeof value === 'undefined') {
let error = `'${pathString}' does not exist in your theme config.`;
const parentSegments = pathSegments.slice(0, -1);
const parentValue = _lodash.default.get(config.theme, parentSegments);
if (_lodash.default.isObject(parentValue)) {
const validKeys = Object.keys(parentValue).filter(key => validatePath(config, [...parentSegments, key]).isValid);
const suggestion = (0, _didyoumean.default)(_lodash.default.last(pathSegments), validKeys);
if (suggestion) {
error += ` Did you mean '${pathToString([...parentSegments, suggestion])}'?`;
} else if (validKeys.length > 0) {
error += ` '${pathToString(parentSegments)}' has the following valid keys: ${list(validKeys)}`;
}
} else {
const closestPath = findClosestExistingPath(config.theme, pathString);
if (closestPath) {
const closestValue = _lodash.default.get(config.theme, closestPath);
if (_lodash.default.isObject(closestValue)) {
error += ` '${pathToString(closestPath)}' has the following keys: ${listKeys(closestValue)}`;
} else {
error += ` '${pathToString(closestPath)}' is not an object.`;
}
} else {
error += ` Your theme has the following top-level keys: ${listKeys(config.theme)}`;
}
}
return {
isValid: false,
error
};
}
if (!(typeof value === 'string' || typeof value === 'number' || typeof value === 'function' || value instanceof String || value instanceof Number || Array.isArray(value))) {
let error = `'${pathString}' was found but does not resolve to a string.`;
if (_lodash.default.isObject(value)) {
let validKeys = Object.keys(value).filter(key => validatePath(config, [...pathSegments, key]).isValid);
if (validKeys.length) {
error += ` Did you mean something like '${pathToString([...pathSegments, validKeys[0]])}'?`;
}
}
return {
isValid: false,
error
};
}
const [themeSection] = pathSegments;
return {
isValid: true,
value: (0, _transformThemeValue.default)(themeSection)(value)
};
}
function extractArgs(node, vNodes, functions) {
vNodes = vNodes.map(vNode => resolveVNode(node, vNode, functions));
let args = [''];
for (let vNode of vNodes) {
if (vNode.type === 'div' && vNode.value === ',') {
args.push('');
} else {
args[args.length - 1] += _postcssValueParser.default.stringify(vNode);
}
}
return args;
}
function resolveVNode(node, vNode, functions) {
if (vNode.type === 'function' && functions[vNode.value] !== undefined) {
let args = extractArgs(node, vNode.nodes, functions);
vNode.type = 'word';
vNode.value = functions[vNode.value](node, ...args);
}
return vNode;
}
function resolveFunctions(node, input, functions) {
return (0, _postcssValueParser.default)(input).walk(vNode => {
resolveVNode(node, vNode, functions);
}).toString();
}
let nodeTypePropertyMap = {
atrule: 'params',
decl: 'value'
};
function _default({
tailwindConfig: config
}) {
let functions = {
theme: (node, path, ...defaultValue) => {
const {
isValid,
value,
error
} = validatePath(config, path, defaultValue.length ? defaultValue : undefined);
if (!isValid) {
throw node.error(error);
}
return value;
},
screen: (node, screen) => {
screen = _lodash.default.trim(screen, `'"`);
if (config.theme.screens[screen] === undefined) {
throw node.error(`The '${screen}' screen does not exist in your theme.`);
}
return (0, _buildMediaQuery.default)(config.theme.screens[screen]);
}
};
return root => {
root.walk(node => {
let property = nodeTypePropertyMap[node.type];
if (property === undefined) {
return;
}
node[property] = resolveFunctions(node, node[property], functions);
});
};
}

25
node_modules/tailwindcss/lib/lib/formatCSS.js generated vendored Normal file
View file

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = formatNodes;
function indentRecursive(node, indent = 0) {
node.each && node.each((child, i) => {
if (!child.raws.before || child.raws.before.includes('\n')) {
child.raws.before = `\n${node.type !== 'rule' && i > 0 ? '\n' : ''}${' '.repeat(indent)}`;
}
child.raws.after = `\n${' '.repeat(indent)}`;
indentRecursive(child, indent + 1);
});
}
function formatNodes(root) {
indentRecursive(root);
if (root.first) {
root.first.raws.before = '';
}
}

View file

@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getModuleDependencies;
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
var _resolve = _interopRequireDefault(require("resolve"));
var _detective = _interopRequireDefault(require("detective"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createModule(file) {
const source = _fs.default.readFileSync(file, 'utf-8');
const requires = (0, _detective.default)(source);
return {
file,
requires
};
}
function getModuleDependencies(entryFile) {
const rootModule = createModule(entryFile);
const modules = [rootModule]; // Iterate over the modules, even when new
// ones are being added
for (const mdl of modules) {
mdl.requires.filter(dep => {
// Only track local modules, not node_modules
return dep.startsWith('./') || dep.startsWith('../');
}).forEach(dep => {
try {
const basedir = _path.default.dirname(mdl.file);
const depPath = _resolve.default.sync(dep, {
basedir
});
const depModule = createModule(depPath);
modules.push(depModule);
} catch (_err) {// eslint-disable-next-line no-empty
}
});
}
return modules;
}

236
node_modules/tailwindcss/lib/lib/purgeUnusedStyles.js generated vendored Normal file
View file

@ -0,0 +1,236 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.tailwindExtractor = tailwindExtractor;
exports.default = purgeUnusedUtilities;
var _lodash = _interopRequireDefault(require("lodash"));
var _postcss = _interopRequireDefault(require("postcss"));
var _purgecss = _interopRequireWildcard(require("purgecss"));
var _log = _interopRequireDefault(require("../util/log"));
var _htmlTags = _interopRequireDefault(require("html-tags"));
var _path = _interopRequireDefault(require("path"));
var _parseDependency = _interopRequireDefault(require("../util/parseDependency"));
var _normalizePath = _interopRequireDefault(require("normalize-path"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function removeTailwindMarkers(css) {
css.walkAtRules('tailwind', rule => rule.remove());
css.walkComments(comment => {
switch (comment.text.trim()) {
case 'tailwind start base':
case 'tailwind end base':
case 'tailwind start components':
case 'tailwind start utilities':
case 'tailwind end components':
case 'tailwind end utilities':
comment.remove();
break;
default:
break;
}
});
}
function tailwindExtractor(content) {
// Capture as liberally as possible, including things like `h-(screen-1.5)`
const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || [];
const broadMatchesWithoutTrailingSlash = broadMatches.map(match => _lodash.default.trimEnd(match, '\\')); // Capture classes within other delimiters like .block(class="w-1/2") in Pug
const innerMatches = content.match(/[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/g) || [];
return broadMatches.concat(broadMatchesWithoutTrailingSlash).concat(innerMatches);
}
function getTransformer(config, fileExtension) {
let transformers = config.purge && config.purge.transform || {};
if (typeof transformers === 'function') {
transformers = {
DEFAULT: transformers
};
}
return transformers[fileExtension] || transformers.DEFAULT || (content => content);
}
function purgeUnusedUtilities(config, configChanged, registerDependency) {
var _config$purge;
const purgeEnabled = _lodash.default.get(config, 'purge.enabled', config.purge !== false && config.purge !== undefined && process.env.NODE_ENV === 'production');
if (!purgeEnabled) {
return removeTailwindMarkers;
} // Skip if `purge: []` since that's part of the default config
if (Array.isArray(config.purge) && config.purge.length === 0) {
if (configChanged) {
_log.default.warn(['Tailwind is not purging unused styles because no template paths have been provided.', 'If you have manually configured PurgeCSS outside of Tailwind or are deliberately not removing unused styles, set `purge: false` in your Tailwind config file to silence this warning.', 'https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css']);
}
return removeTailwindMarkers;
}
const extractors = config.purge.extract || {};
const transformers = config.purge.transform || {};
let {
defaultExtractor: originalDefaultExtractor,
...purgeOptions
} = config.purge.options || {};
if ((_config$purge = config.purge) !== null && _config$purge !== void 0 && _config$purge.safelist && !purgeOptions.hasOwnProperty('safelist')) {
purgeOptions.safelist = config.purge.safelist;
}
if (!originalDefaultExtractor) {
originalDefaultExtractor = typeof extractors === 'function' ? extractors : extractors.DEFAULT || tailwindExtractor;
}
const defaultExtractor = content => {
const preserved = originalDefaultExtractor(content);
if (_lodash.default.get(config, 'purge.preserveHtmlElements', true)) {
preserved.push(..._htmlTags.default);
}
return preserved;
}; // If `extractors` is a function then we don't have any file-specific extractors,
// only a default one.
let fileSpecificExtractors = typeof extractors === 'function' ? {} : extractors; // PurgeCSS doesn't support "transformers," so we implement those using extractors.
// If we have a custom transformer for an extension, but not a matching extractor,
// then we need to create an extractor that we can augment later.
if (typeof transformers !== 'function') {
for (let [extension] of Object.entries(transformers)) {
if (!fileSpecificExtractors[extension]) {
fileSpecificExtractors[extension] = defaultExtractor;
}
}
} // Augment file-specific extractors by running the transformer before we extract classes.
fileSpecificExtractors = Object.entries(fileSpecificExtractors).map(([extension, extractor]) => {
return {
extensions: [extension],
extractor: content => {
const transformer = getTransformer(config, extension);
return extractor(transformer(content));
}
};
});
let content = (Array.isArray(config.purge) ? config.purge : config.purge.content || purgeOptions.content || []).map(item => {
if (typeof item === 'string') {
return (0, _normalizePath.default)(_path.default.resolve(item));
}
return item;
});
for (let fileOrGlob of content.filter(item => typeof item === 'string')) {
registerDependency((0, _parseDependency.default)(fileOrGlob));
}
let hasLayers = false;
const mode = _lodash.default.get(config, 'purge.mode', 'layers');
return (0, _postcss.default)([function (css) {
if (!['all', 'layers'].includes(mode)) {
throw new Error('Purge `mode` must be one of `layers` or `all`.');
}
if (mode === 'all') {
return;
}
const layers = _lodash.default.get(config, 'purge.layers', ['base', 'components', 'utilities']);
css.walkComments(comment => {
switch (comment.text.trim()) {
case `purgecss start ignore`:
comment.before(_postcss.default.comment({
text: 'purgecss end ignore'
}));
break;
case `purgecss end ignore`:
comment.before(_postcss.default.comment({
text: 'purgecss end ignore'
}));
comment.text = 'purgecss start ignore';
break;
default:
break;
}
layers.forEach(layer => {
switch (comment.text.trim()) {
case `tailwind start ${layer}`:
comment.text = 'purgecss end ignore';
hasLayers = true;
break;
case `tailwind end ${layer}`:
comment.text = 'purgecss start ignore';
break;
default:
break;
}
});
});
css.prepend(_postcss.default.comment({
text: 'purgecss start ignore'
}));
css.append(_postcss.default.comment({
text: 'purgecss end ignore'
}));
}, removeTailwindMarkers, async function (css) {
if (mode === 'layers' && !hasLayers) {
return;
}
const purgeCSS = new _purgecss.default();
purgeCSS.options = { ..._purgecss.defaultOptions,
defaultExtractor: content => {
const transformer = getTransformer(config);
return defaultExtractor(transformer(content));
},
extractors: fileSpecificExtractors,
...purgeOptions,
safelist: (0, _purgecss.standardizeSafelist)(purgeOptions.safelist)
};
if (purgeCSS.options.variables) {
purgeCSS.variablesStructure.safelist = purgeCSS.options.safelist.variables || [];
}
const fileFormatContents = content.filter(o => typeof o === 'string');
const rawFormatContents = content.filter(o => typeof o === 'object');
const cssFileSelectors = await purgeCSS.extractSelectorsFromFiles(fileFormatContents, purgeCSS.options.extractors);
const cssRawSelectors = await purgeCSS.extractSelectorsFromString(rawFormatContents, purgeCSS.options.extractors);
const cssSelectors = (0, _purgecss.mergeExtractorSelectors)(cssFileSelectors, cssRawSelectors);
purgeCSS.walkThroughCSS(css, cssSelectors);
if (purgeCSS.options.fontFace) purgeCSS.removeUnusedFontFaces();
if (purgeCSS.options.keyframes) purgeCSS.removeUnusedKeyframes();
if (purgeCSS.options.variables) purgeCSS.removeUnusedCSSVariables();
}]);
}

View file

@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _fs = _interopRequireDefault(require("fs"));
var _getModuleDependencies = _interopRequireDefault(require("./getModuleDependencies"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(configFile) {
if (!_fs.default.existsSync(configFile)) {
throw new Error(`Specified Tailwind config file "${configFile}" doesn't exist.`);
}
return function (css, opts) {
(0, _getModuleDependencies.default)(configFile).forEach(mdl => {
opts.messages.push({
type: 'dependency',
parent: css.source.input.file,
file: mdl.file
});
});
};
}

View file

@ -0,0 +1,385 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = substituteClassApplyAtRules;
var _lodash = _interopRequireDefault(require("lodash"));
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
var _postcss = _interopRequireDefault(require("postcss"));
var _didyoumean = _interopRequireDefault(require("didyoumean"));
var _substituteTailwindAtRules = _interopRequireDefault(require("./substituteTailwindAtRules"));
var _evaluateTailwindFunctions = _interopRequireDefault(require("./evaluateTailwindFunctions"));
var _substituteVariantsAtRules = _interopRequireDefault(require("./substituteVariantsAtRules"));
var _substituteResponsiveAtRules = _interopRequireDefault(require("./substituteResponsiveAtRules"));
var _convertLayerAtRulesToControlComments = _interopRequireDefault(require("./convertLayerAtRulesToControlComments"));
var _substituteScreenAtRules = _interopRequireDefault(require("./substituteScreenAtRules"));
var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
var _useMemo = require("../util/useMemo");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function hasAtRule(css, atRule, condition) {
let found = false;
css.walkAtRules(atRule, condition === undefined ? () => {
found = true;
return false;
} : node => {
if (condition(node)) {
found = true;
return false;
}
});
return found;
}
function cloneWithoutChildren(node) {
if (node.type === 'atrule') {
return _postcss.default.atRule({
name: node.name,
params: node.params
});
}
if (node.type === 'rule') {
return _postcss.default.rule({
name: node.name,
selectors: node.selectors
});
}
const clone = node.clone();
clone.removeAll();
return clone;
}
const tailwindApplyPlaceholder = _postcssSelectorParser.default.attribute({
attribute: '__TAILWIND-APPLY-PLACEHOLDER__'
});
function generateRulesFromApply({
rule,
utilityName: className,
classPosition
}, replaceWiths) {
const parser = (0, _postcssSelectorParser.default)(selectors => {
let i = 0;
selectors.walkClasses(c => {
if (classPosition === i++ && c.value === className) {
c.replaceWith(tailwindApplyPlaceholder);
}
});
});
const processedSelectors = _lodash.default.flatMap(rule.selectors, selector => {
// You could argue we should make this replacement at the AST level, but if we believe
// the placeholder string is safe from collisions then it is safe to do this is a simple
// string replacement, and much, much faster.
return replaceWiths.map(replaceWith => parser.processSync(selector).replace('[__TAILWIND-APPLY-PLACEHOLDER__]', replaceWith));
});
const cloned = rule.clone();
let current = cloned;
let parent = rule.parent;
while (parent && parent.type !== 'root') {
const parentClone = cloneWithoutChildren(parent);
parentClone.append(current);
current.parent = parentClone;
current = parentClone;
parent = parent.parent;
}
cloned.selectors = processedSelectors;
return current;
}
const extractUtilityNamesParser = (0, _postcssSelectorParser.default)(selectors => {
let classes = [];
selectors.walkClasses(c => classes.push(c.value));
return classes;
});
const extractUtilityNames = (0, _useMemo.useMemo)(selector => extractUtilityNamesParser.transformSync(selector), selector => selector);
const cloneRuleWithParent = (0, _useMemo.useMemo)(rule => rule.clone({
parent: rule.parent
}), rule => rule);
function buildCssUtilityMap(css, startIndex) {
let index = startIndex;
const utilityMap = {};
function handle(getRule, rule) {
const utilityNames = extractUtilityNames(rule.selector);
utilityNames.forEach((utilityName, i) => {
if (utilityMap[utilityName] === undefined) {
utilityMap[utilityName] = [];
}
utilityMap[utilityName].push({
index,
utilityName,
classPosition: i,
...getRule(rule)
});
index++;
});
} // This is the end user's css. This might contain rules that we want to
// apply. We want immediate copies of everything in case that we have user
// defined classes that are recursively applied. Down below we are modifying
// the rules directly. We could do a better solution where we keep track of a
// dependency tree, but that is a bit more complex. Might revisit later,
// we'll see how this turns out!
css.walkRules(handle.bind(null, rule => ({
rule: cloneRuleWithParent(rule)
})));
return utilityMap;
}
const buildLookupTreeUtilityMap = (0, _useMemo.useMemo)(lookupTree => {
let index = 0;
const utilityMap = {};
function handle(getRule, rule) {
const utilityNames = extractUtilityNames(rule.selector);
utilityNames.forEach((utilityName, i) => {
if (utilityMap[utilityName] === undefined) {
utilityMap[utilityName] = [];
}
utilityMap[utilityName].push({
index,
utilityName,
classPosition: i,
...getRule(rule)
});
index++;
});
} // Lookup tree is the big lookup tree, making the rule lazy allows us to save
// some memory because we don't need everything.
lookupTree.walkRules(handle.bind(null, rule => ({
get rule() {
return cloneRuleWithParent(rule);
}
})));
return utilityMap;
}, tree => tree);
function mergeAdjacentRules(initialRule, rulesToInsert) {
let previousRule = initialRule;
rulesToInsert.forEach(toInsert => {
if (toInsert.type === 'rule' && previousRule.type === 'rule' && toInsert.selector === previousRule.selector) {
previousRule.append(toInsert.nodes);
} else if (toInsert.type === 'atrule' && previousRule.type === 'atrule' && toInsert.params === previousRule.params) {
const merged = mergeAdjacentRules(previousRule.nodes[previousRule.nodes.length - 1], toInsert.nodes);
previousRule.append(merged);
} else {
previousRule = toInsert;
}
toInsert.walk(n => {
if (n.nodes && n.nodes.length === 0) {
n.remove();
}
});
});
return rulesToInsert.filter(r => r.nodes.length > 0);
}
function makeExtractUtilityRules(css, lookupTree, config) {
const lookupTreeUtilityMap = buildLookupTreeUtilityMap(lookupTree);
const lookupTreeUtilityMapKeys = Object.keys(lookupTreeUtilityMap);
const utilityMap = buildCssUtilityMap(css, lookupTreeUtilityMapKeys.length);
function getUtility(utilityName) {
const utility = [];
if (lookupTreeUtilityMap[utilityName]) {
utility.push(...lookupTreeUtilityMap[utilityName]);
}
if (utilityMap[utilityName]) {
utility.push(...utilityMap[utilityName]);
}
if (utility.length > 0) return utility;
}
return function extractUtilityRules(utilityNames, rule) {
const combined = [];
utilityNames.forEach(utilityName => {
const utility = getUtility(utilityName);
if (utility === undefined) {
// Look for prefixed utility in case the user has goofed
const prefixedUtilityName = (0, _prefixSelector.default)(config.prefix, `.${utilityName}`).slice(1);
const prefixedUtility = getUtility(prefixedUtilityName);
if (prefixedUtility !== undefined) {
throw rule.error(`The \`${utilityName}\` class does not exist, but \`${prefixedUtilityName}\` does. Did you forget the prefix?`);
}
const suggestedClass = (0, _didyoumean.default)(utilityName, Object.keys(utilityMap).concat(lookupTreeUtilityMapKeys));
const suggestionMessage = suggestedClass ? `, but \`${suggestedClass}\` does` : '';
throw rule.error(`The \`${utilityName}\` class does not exist${suggestionMessage}. If you're sure that \`${utilityName}\` exists, make sure that any \`@import\` statements are being properly processed before Tailwind CSS sees your CSS, as \`@apply\` can only be used for classes in the same CSS tree.`, {
word: utilityName
});
}
combined.push(...utility);
});
return combined.sort((a, b) => a.index - b.index);
};
}
function findParent(rule, predicate) {
let parent = rule.parent;
while (parent) {
if (predicate(parent)) {
return parent;
}
parent = parent.parent;
}
throw new Error('No parent could be found');
}
function processApplyAtRules(css, lookupTree, config) {
const extractUtilityRules = makeExtractUtilityRules(css, lookupTree, config);
do {
css.walkAtRules('apply', applyRule => {
const parent = applyRule.parent; // Direct parent
const nearestParentRule = findParent(applyRule, r => r.type === 'rule');
const currentUtilityNames = extractUtilityNames(nearestParentRule.selector);
const [importantEntries, applyUtilityNames, important = importantEntries.length > 0] = _lodash.default.partition(applyRule.params.split(/[\s\t\n]+/g), n => n === '!important');
if (_lodash.default.intersection(applyUtilityNames, currentUtilityNames).length > 0) {
const currentUtilityName = _lodash.default.intersection(applyUtilityNames, currentUtilityNames)[0];
throw parent.error(`You cannot \`@apply\` the \`${currentUtilityName}\` utility here because it creates a circular dependency.`);
} // Extract any post-apply declarations and re-insert them after apply rules
const afterRule = parent.clone({
raws: {}
});
afterRule.nodes = afterRule.nodes.slice(parent.index(applyRule) + 1);
parent.nodes = parent.nodes.slice(0, parent.index(applyRule) + 1); // Sort applys to match CSS source order
const applys = extractUtilityRules(applyUtilityNames, applyRule); // Get new rules with the utility portion of the selector replaced with the new selector
const rulesToInsert = [];
applys.forEach(nearestParentRule === parent ? util => rulesToInsert.push(generateRulesFromApply(util, parent.selectors)) : util => util.rule.nodes.forEach(n => afterRule.append(n.clone())));
rulesToInsert.forEach(rule => {
if (rule.type === 'atrule') {
rule.walkRules(rule => {
rule.__tailwind = { ...rule.__tailwind,
important
};
});
} else {
rule.__tailwind = { ...rule.__tailwind,
important
};
}
});
const {
nodes
} = _lodash.default.tap(_postcss.default.root({
nodes: rulesToInsert
}), root => {
root.walkDecls(d => {
d.important = important;
});
});
const mergedRules = mergeAdjacentRules(nearestParentRule, [...nodes, afterRule]);
applyRule.remove();
parent.after(mergedRules); // If the base rule has nothing in it (all applys were pseudo or responsive variants),
// remove the rule fuggit.
if (parent.nodes.length === 0) {
parent.remove();
}
}); // We already know that we have at least 1 @apply rule. Otherwise this
// function would not have been called. Therefore we can execute this code
// at least once. This also means that in the best case scenario we only
// call this 2 times, instead of 3 times.
// 1st time -> before we call this function
// 2nd time -> when we check if we have to do this loop again (because do {} while (check))
// .. instead of
// 1st time -> before we call this function
// 2nd time -> when we check the first time (because while (check) do {})
// 3rd time -> when we re-check to see if we should do this loop again
} while (hasAtRule(css, 'apply'));
return css;
}
let defaultTailwindTree = new Map();
function substituteClassApplyAtRules(config, getProcessedPlugins, configChanged) {
return function (css) {
// We can stop already when we don't have any @apply rules. Vue users: you're welcome!
if (!hasAtRule(css, 'apply')) {
return css;
}
let requiredTailwindAtRules = ['base', 'components', 'utilities'];
if (hasAtRule(css, 'tailwind', node => {
let idx = requiredTailwindAtRules.indexOf(node.params);
if (idx !== -1) requiredTailwindAtRules.splice(idx, 1);
if (requiredTailwindAtRules.length <= 0) return true;
return false;
})) {
// Tree already contains all the at rules (requiredTailwindAtRules)
return processApplyAtRules(css, _postcss.default.root(), config);
}
let lookupKey = requiredTailwindAtRules.join(','); // We mutated the `requiredTailwindAtRules`, but when we hit this point in
// time, it means that we don't have all the atrules. The missing atrules
// are listed inside the requiredTailwindAtRules, which we can use to fill
// in the missing pieces.
//
// Important for <style> blocks in Vue components.
const generateLookupTree = configChanged || !defaultTailwindTree.has(lookupKey) ? () => {
return (0, _postcss.default)([(0, _substituteTailwindAtRules.default)(config, getProcessedPlugins()), (0, _evaluateTailwindFunctions.default)({
tailwindConfig: config
}), (0, _substituteVariantsAtRules.default)(config, getProcessedPlugins()), (0, _substituteResponsiveAtRules.default)(config), (0, _convertLayerAtRulesToControlComments.default)(config), (0, _substituteScreenAtRules.default)({
tailwindConfig: config
})]).process(requiredTailwindAtRules.map(rule => `@tailwind ${rule};`).join('\n'), {
from: __filename
}).then(result => {
defaultTailwindTree.set(lookupKey, result);
return result;
});
} : () => Promise.resolve(defaultTailwindTree.get(lookupKey));
return generateLookupTree().then(result => {
return processApplyAtRules(css, result.root, config);
});
};
}

View file

@ -0,0 +1,104 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _lodash = _interopRequireDefault(require("lodash"));
var _postcss = _interopRequireDefault(require("postcss"));
var _cloneNodes = _interopRequireDefault(require("../util/cloneNodes"));
var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
var _buildSelectorVariant = _interopRequireDefault(require("../util/buildSelectorVariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isLayer(node) {
if (Array.isArray(node)) {
return node.length === 1 && isLayer(node[0]);
}
return node.type === 'atrule' && node.name === 'layer';
}
function layerNodes(nodes) {
return isLayer(nodes) ? nodes[0].nodes : nodes;
}
function _default(config) {
return function (css) {
// Wrap any `responsive` rules with a copy of their parent `layer` to
// ensure the layer isn't lost when copying to the `screens` location.
css.walkAtRules('layer', layerAtRule => {
const layer = layerAtRule.params;
layerAtRule.walkAtRules('responsive', responsiveAtRule => {
const nestedlayerAtRule = _postcss.default.atRule({
name: 'layer',
params: layer
});
nestedlayerAtRule.prepend(responsiveAtRule.nodes);
responsiveAtRule.removeAll();
responsiveAtRule.prepend(nestedlayerAtRule);
});
});
const {
theme: {
screens
},
separator
} = config;
const responsiveRules = _postcss.default.root();
const finalRules = [];
css.walkAtRules('responsive', atRule => {
const nodes = atRule.nodes;
responsiveRules.append(...(0, _cloneNodes.default)(nodes)); // If the parent is already a `layer` (this is true for anything coming from
// a plugin, including core plugins) we don't want to create a double nested
// layer, so only insert the layer children. If there is no parent layer,
// preserve the layer information when inserting the nodes.
if (isLayer(atRule.parent)) {
atRule.before(layerNodes(nodes));
} else {
atRule.before(nodes);
}
atRule.remove();
});
_lodash.default.keys(screens).forEach(screen => {
const mediaQuery = _postcss.default.atRule({
name: 'media',
params: (0, _buildMediaQuery.default)(screens[screen])
});
mediaQuery.append(_lodash.default.tap(responsiveRules.clone(), clonedRoot => {
clonedRoot.walkRules(rule => {
rule.selectors = _lodash.default.map(rule.selectors, selector => (0, _buildSelectorVariant.default)(selector, screen, separator, message => {
throw rule.error(message);
}));
});
}));
finalRules.push(mediaQuery);
});
const hasScreenRules = finalRules.some(i => i.nodes.length !== 0);
css.walkAtRules('tailwind', atRule => {
if (atRule.params !== 'screens') {
return;
}
if (hasScreenRules) {
atRule.before(finalRules);
}
atRule.remove();
});
};
}

View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _lodash = _interopRequireDefault(require("lodash"));
var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default({
tailwindConfig: {
theme
}
}) {
return function (css) {
css.walkAtRules('screen', atRule => {
const screen = atRule.params;
if (!_lodash.default.has(theme.screens, screen)) {
throw atRule.error(`No \`${screen}\` screen found.`);
}
atRule.name = 'media';
atRule.params = (0, _buildMediaQuery.default)(theme.screens[screen]);
});
};
}

View file

@ -0,0 +1,97 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _lodash = _interopRequireDefault(require("lodash"));
var _postcss = _interopRequireDefault(require("postcss"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function updateSource(nodes, source) {
return _lodash.default.tap(Array.isArray(nodes) ? _postcss.default.root({
nodes
}) : nodes, tree => {
tree.walk(node => node.source = source);
});
}
function _default(_config, {
base: pluginBase,
components: pluginComponents,
utilities: pluginUtilities
}) {
return function (css) {
css.walkAtRules('import', atRule => {
if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
atRule.name = 'tailwind';
atRule.params = 'base';
}
if (atRule.params === '"tailwindcss/components"' || atRule.params === "'tailwindcss/components'") {
atRule.name = 'tailwind';
atRule.params = 'components';
}
if (atRule.params === '"tailwindcss/utilities"' || atRule.params === "'tailwindcss/utilities'") {
atRule.name = 'tailwind';
atRule.params = 'utilities';
}
if (atRule.params === '"tailwindcss/screens"' || atRule.params === "'tailwindcss/screens'") {
atRule.name = 'tailwind';
atRule.params = 'screens';
}
});
let includesScreensExplicitly = false;
const layers = {
base: [],
components: [],
utilities: []
};
css.walkAtRules('layer', atRule => {
if (!['base', 'components', 'utilities'].includes(atRule.params)) {
return;
}
layers[atRule.params].push(atRule);
});
css.walkAtRules('tailwind', atRule => {
if (atRule.params === 'preflight') {
// prettier-ignore
throw atRule.error("`@tailwind preflight` is not a valid at-rule in Tailwind v2.0, use `@tailwind base` instead.", {
word: 'preflight'
});
}
if (atRule.params === 'base') {
atRule.after(layers.base);
atRule.after(updateSource(pluginBase, atRule.source));
}
if (atRule.params === 'components') {
atRule.after(layers.components);
atRule.after(updateSource(pluginComponents, atRule.source));
}
if (atRule.params === 'utilities') {
atRule.after(layers.utilities);
atRule.after(updateSource(pluginUtilities, atRule.source));
}
if (atRule.params === 'screens') {
includesScreensExplicitly = true;
}
});
if (!includesScreensExplicitly) {
css.append([_postcss.default.atRule({
name: 'tailwind',
params: 'screens'
})]);
}
};
}

View file

@ -0,0 +1,247 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _lodash = _interopRequireDefault(require("lodash"));
var _postcss = _interopRequireDefault(require("postcss"));
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
var _generateVariantFunction = _interopRequireDefault(require("../util/generateVariantFunction"));
var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
var _buildSelectorVariant = _interopRequireDefault(require("../util/buildSelectorVariant"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function generatePseudoClassVariant(pseudoClass, selectorPrefix = pseudoClass) {
return (0, _generateVariantFunction.default)(({
modifySelectors,
separator
}) => {
const parser = (0, _postcssSelectorParser.default)(selectors => {
selectors.walkClasses(sel => {
sel.value = `${selectorPrefix}${separator}${sel.value}`;
sel.parent.insertAfter(sel, _postcssSelectorParser.default.pseudo({
value: `:${pseudoClass}`
}));
});
});
return modifySelectors(({
selector
}) => parser.processSync(selector));
});
}
function ensureIncludesDefault(variants) {
return variants.includes('DEFAULT') ? variants : ['DEFAULT', ...variants];
}
const defaultVariantGenerators = config => ({
DEFAULT: (0, _generateVariantFunction.default)(() => {}),
dark: (0, _generateVariantFunction.default)(({
container,
separator,
modifySelectors
}) => {
if (config.darkMode === false) {
return _postcss.default.root();
}
if (config.darkMode === 'media') {
const modified = modifySelectors(({
selector
}) => {
return (0, _buildSelectorVariant.default)(selector, 'dark', separator, message => {
throw container.error(message);
});
});
const mediaQuery = _postcss.default.atRule({
name: 'media',
params: '(prefers-color-scheme: dark)'
});
mediaQuery.append(modified);
container.append(mediaQuery);
return container;
}
if (config.darkMode === 'class') {
const modified = modifySelectors(({
selector
}) => {
return (0, _buildSelectorVariant.default)(selector, 'dark', separator, message => {
throw container.error(message);
});
});
modified.walkRules(rule => {
rule.selectors = rule.selectors.map(selector => {
return `${(0, _prefixSelector.default)(config.prefix, '.dark')} ${selector}`;
});
});
return modified;
}
throw new Error("The `darkMode` config option must be either 'media' or 'class'.");
}, {
unstable_stack: true
}),
'motion-safe': (0, _generateVariantFunction.default)(({
container,
separator,
modifySelectors
}) => {
const modified = modifySelectors(({
selector
}) => {
return (0, _buildSelectorVariant.default)(selector, 'motion-safe', separator, message => {
throw container.error(message);
});
});
const mediaQuery = _postcss.default.atRule({
name: 'media',
params: '(prefers-reduced-motion: no-preference)'
});
mediaQuery.append(modified);
container.append(mediaQuery);
}, {
unstable_stack: true
}),
'motion-reduce': (0, _generateVariantFunction.default)(({
container,
separator,
modifySelectors
}) => {
const modified = modifySelectors(({
selector
}) => {
return (0, _buildSelectorVariant.default)(selector, 'motion-reduce', separator, message => {
throw container.error(message);
});
});
const mediaQuery = _postcss.default.atRule({
name: 'media',
params: '(prefers-reduced-motion: reduce)'
});
mediaQuery.append(modified);
container.append(mediaQuery);
}, {
unstable_stack: true
}),
'group-hover': (0, _generateVariantFunction.default)(({
modifySelectors,
separator
}) => {
const parser = (0, _postcssSelectorParser.default)(selectors => {
selectors.walkClasses(sel => {
sel.value = `group-hover${separator}${sel.value}`;
sel.parent.insertBefore(sel, (0, _postcssSelectorParser.default)().astSync((0, _prefixSelector.default)(config.prefix, '.group:hover ')));
});
});
return modifySelectors(({
selector
}) => parser.processSync(selector));
}),
'group-focus': (0, _generateVariantFunction.default)(({
modifySelectors,
separator
}) => {
const parser = (0, _postcssSelectorParser.default)(selectors => {
selectors.walkClasses(sel => {
sel.value = `group-focus${separator}${sel.value}`;
sel.parent.insertBefore(sel, (0, _postcssSelectorParser.default)().astSync((0, _prefixSelector.default)(config.prefix, '.group:focus ')));
});
});
return modifySelectors(({
selector
}) => parser.processSync(selector));
}),
hover: generatePseudoClassVariant('hover'),
'focus-within': generatePseudoClassVariant('focus-within'),
'focus-visible': generatePseudoClassVariant('focus-visible'),
'read-only': generatePseudoClassVariant('read-only'),
focus: generatePseudoClassVariant('focus'),
active: generatePseudoClassVariant('active'),
visited: generatePseudoClassVariant('visited'),
disabled: generatePseudoClassVariant('disabled'),
checked: generatePseudoClassVariant('checked'),
first: generatePseudoClassVariant('first-child', 'first'),
last: generatePseudoClassVariant('last-child', 'last'),
odd: generatePseudoClassVariant('nth-child(odd)', 'odd'),
even: generatePseudoClassVariant('nth-child(even)', 'even'),
empty: generatePseudoClassVariant('empty')
});
function prependStackableVariants(atRule, variants, stackableVariants) {
if (!_lodash.default.some(variants, v => stackableVariants.includes(v))) {
return variants;
}
if (_lodash.default.every(variants, v => stackableVariants.includes(v))) {
return variants;
}
const variantsParent = _postcss.default.atRule({
name: 'variants',
params: variants.filter(v => stackableVariants.includes(v)).join(', ')
});
atRule.before(variantsParent);
variantsParent.append(atRule);
variants = _lodash.default.without(variants, ...stackableVariants);
return variants;
}
function _default(config, {
variantGenerators: pluginVariantGenerators
}) {
return function (css) {
const variantGenerators = { ...defaultVariantGenerators(config),
...pluginVariantGenerators
};
const stackableVariants = Object.entries(variantGenerators).filter(([_variant, {
options
}]) => options.unstable_stack).map(([variant]) => variant);
let variantsFound = false;
do {
variantsFound = false;
css.walkAtRules('variants', atRule => {
variantsFound = true;
let variants = _postcss.default.list.comma(atRule.params).filter(variant => variant !== '');
if (variants.includes('responsive')) {
const responsiveParent = _postcss.default.atRule({
name: 'responsive'
});
atRule.before(responsiveParent);
responsiveParent.append(atRule);
}
const remainingVariants = prependStackableVariants(atRule, variants, stackableVariants);
_lodash.default.forEach(_lodash.default.without(ensureIncludesDefault(remainingVariants), 'responsive'), variant => {
if (!variantGenerators[variant]) {
throw new Error(`Your config mentions the "${variant}" variant, but "${variant}" doesn't appear to be a variant. Did you forget or misconfigure a plugin that supplies that variant?`);
}
variantGenerators[variant].handler(atRule, config);
});
atRule.remove();
});
} while (variantsFound);
};
}

37
node_modules/tailwindcss/lib/plugins/accessibility.js generated vendored Normal file
View file

@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.sr-only': {
position: 'absolute',
width: '1px',
height: '1px',
padding: '0',
margin: '-1px',
overflow: 'hidden',
clip: 'rect(0, 0, 0, 0)',
whiteSpace: 'nowrap',
borderWidth: '0'
},
'.not-sr-only': {
position: 'static',
width: 'auto',
height: 'auto',
padding: '0',
margin: '0',
overflow: 'visible',
clip: 'auto',
whiteSpace: 'normal'
}
}, variants('accessibility'));
};
}

34
node_modules/tailwindcss/lib/plugins/alignContent.js generated vendored Normal file
View file

@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.content-center': {
'align-content': 'center'
},
'.content-start': {
'align-content': 'flex-start'
},
'.content-end': {
'align-content': 'flex-end'
},
'.content-between': {
'align-content': 'space-between'
},
'.content-around': {
'align-content': 'space-around'
},
'.content-evenly': {
'align-content': 'space-evenly'
}
}, variants('alignContent'));
};
}

31
node_modules/tailwindcss/lib/plugins/alignItems.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.items-start': {
'align-items': 'flex-start'
},
'.items-end': {
'align-items': 'flex-end'
},
'.items-center': {
'align-items': 'center'
},
'.items-baseline': {
'align-items': 'baseline'
},
'.items-stretch': {
'align-items': 'stretch'
}
}, variants('alignItems'));
};
}

34
node_modules/tailwindcss/lib/plugins/alignSelf.js generated vendored Normal file
View file

@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.self-auto': {
'align-self': 'auto'
},
'.self-start': {
'align-self': 'flex-start'
},
'.self-end': {
'align-self': 'flex-end'
},
'.self-center': {
'align-self': 'center'
},
'.self-stretch': {
'align-self': 'stretch'
},
'.self-baseline': {
'align-self': 'baseline'
}
}, variants('alignSelf'));
};
}

60
node_modules/tailwindcss/lib/plugins/animation.js generated vendored Normal file
View file

@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _parseAnimationValue = _interopRequireDefault(require("../util/parseAnimationValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function ({
matchUtilities,
theme,
variants,
prefix
}) {
let prefixName = name => prefix(`.${name}`).slice(1);
let keyframes = Object.fromEntries(Object.entries(theme('keyframes') || {}).map(([key, value]) => {
return [key, [{
[`@keyframes ${prefixName(key)}`]: value
}]];
}));
matchUtilities({
animate: (value, {
includeRules
}) => {
let animations = (0, _parseAnimationValue.default)(value);
for (let {
name
} of animations) {
if (keyframes[name] !== undefined) {
includeRules(keyframes[name], {
respectImportant: false
});
}
}
return {
animation: animations.map(({
name,
value
}) => {
if (name === undefined || keyframes[name] === undefined) {
return value;
}
return value.replace(name, prefixName(name));
}).join(', ')
};
}
}, {
values: theme('animation'),
variants: variants('animation')
});
};
}

19
node_modules/tailwindcss/lib/plugins/appearance.js generated vendored Normal file
View file

@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.appearance-none': {
appearance: 'none'
}
}, variants('appearance'));
};
}

31
node_modules/tailwindcss/lib/plugins/backdropBlur.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-blur': value => {
return {
'--tw-backdrop-blur': `blur(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropBlur'),
variants: variants('backdropBlur'),
type: 'any'
});
};
}

View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-brightness': value => {
return {
'--tw-backdrop-brightness': `brightness(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropBrightness'),
variants: variants('backdropBrightness'),
type: 'any'
});
};
}

View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-contrast': value => {
return {
'--tw-backdrop-contrast': `contrast(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropContrast'),
variants: variants('backdropContrast'),
type: 'any'
});
};
}

59
node_modules/tailwindcss/lib/plugins/backdropFilter.js generated vendored Normal file
View file

@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
addBase,
addUtilities,
variants
}) {
if (config('mode') === 'jit') {
addBase({
'@defaults backdrop-filter': {
'--tw-backdrop-blur': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-invert': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-opacity': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-filter': ['var(--tw-backdrop-blur)', 'var(--tw-backdrop-brightness)', 'var(--tw-backdrop-contrast)', 'var(--tw-backdrop-grayscale)', 'var(--tw-backdrop-hue-rotate)', 'var(--tw-backdrop-invert)', 'var(--tw-backdrop-opacity)', 'var(--tw-backdrop-saturate)', 'var(--tw-backdrop-sepia)'].join(' ')
}
});
addUtilities({
'.backdrop-filter': {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
},
'.backdrop-filter-none': {
'backdrop-filter': 'none'
}
}, variants('backdropFilter'));
} else {
addUtilities({
'.backdrop-filter': {
'--tw-backdrop-blur': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-invert': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-opacity': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-backdrop-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
'backdrop-filter': ['var(--tw-backdrop-blur)', 'var(--tw-backdrop-brightness)', 'var(--tw-backdrop-contrast)', 'var(--tw-backdrop-grayscale)', 'var(--tw-backdrop-hue-rotate)', 'var(--tw-backdrop-invert)', 'var(--tw-backdrop-opacity)', 'var(--tw-backdrop-saturate)', 'var(--tw-backdrop-sepia)'].join(' ')
},
'.backdrop-filter-none': {
'backdrop-filter': 'none'
}
}, variants('backdropFilter'));
}
};
}

View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-grayscale': value => {
return {
'--tw-backdrop-grayscale': `grayscale(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropGrayscale'),
variants: variants('backdropGrayscale'),
type: 'any'
});
};
}

View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-hue-rotate': value => {
return {
'--tw-backdrop-hue-rotate': `hue-rotate(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropHueRotate'),
variants: variants('backdropHueRotate'),
type: 'any'
});
};
}

31
node_modules/tailwindcss/lib/plugins/backdropInvert.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-invert': value => {
return {
'--tw-backdrop-invert': `invert(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropInvert'),
variants: variants('backdropInvert'),
type: 'any'
});
};
}

View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-opacity': value => {
return {
'--tw-backdrop-opacity': `opacity(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropOpacity'),
variants: variants('backdropOpacity'),
type: 'any'
});
};
}

View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-saturate': value => {
return {
'--tw-backdrop-saturate': `saturate(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropSaturate'),
variants: variants('backdropSaturate'),
type: 'any'
});
};
}

31
node_modules/tailwindcss/lib/plugins/backdropSepia.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
'backdrop-sepia': value => {
return {
'--tw-backdrop-sepia': `sepia(${value})`,
...(config('mode') === 'jit' ? {
'@defaults backdrop-filter': {},
'backdrop-filter': 'var(--tw-backdrop-filter)'
} : {})
};
}
}, {
values: theme('backdropSepia'),
variants: variants('backdropSepia'),
type: 'any'
});
};
}

View file

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.bg-fixed': {
'background-attachment': 'fixed'
},
'.bg-local': {
'background-attachment': 'local'
},
'.bg-scroll': {
'background-attachment': 'scroll'
}
}, variants('backgroundAttachment'));
};
}

View file

@ -0,0 +1,64 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.bg-blend-normal': {
'background-blend-mode': 'normal'
},
'.bg-blend-multiply': {
'background-blend-mode': 'multiply'
},
'.bg-blend-screen': {
'background-blend-mode': 'screen'
},
'.bg-blend-overlay': {
'background-blend-mode': 'overlay'
},
'.bg-blend-darken': {
'background-blend-mode': 'darken'
},
'.bg-blend-lighten': {
'background-blend-mode': 'lighten'
},
'.bg-blend-color-dodge': {
'background-blend-mode': 'color-dodge'
},
'.bg-blend-color-burn': {
'background-blend-mode': 'color-burn'
},
'.bg-blend-hard-light': {
'background-blend-mode': 'hard-light'
},
'.bg-blend-soft-light': {
'background-blend-mode': 'soft-light'
},
'.bg-blend-difference': {
'background-blend-mode': 'difference'
},
'.bg-blend-exclusion': {
'background-blend-mode': 'exclusion'
},
'.bg-blend-hue': {
'background-blend-mode': 'hue'
},
'.bg-blend-saturation': {
'background-blend-mode': 'saturation'
},
'.bg-blend-color': {
'background-blend-mode': 'color'
},
'.bg-blend-luminosity': {
'background-blend-mode': 'luminosity'
}
}, variants('backgroundBlendMode'));
};
}

28
node_modules/tailwindcss/lib/plugins/backgroundClip.js generated vendored Normal file
View file

@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.bg-clip-border': {
'background-clip': 'border-box'
},
'.bg-clip-padding': {
'background-clip': 'padding-box'
},
'.bg-clip-content': {
'background-clip': 'content-box'
},
'.bg-clip-text': {
'background-clip': 'text'
}
}, variants('backgroundClip'));
};
}

View file

@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _flattenColorPalette = _interopRequireDefault(require("../util/flattenColorPalette"));
var _withAlphaVariable = _interopRequireDefault(require("../util/withAlphaVariable"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function ({
matchUtilities,
theme,
variants,
corePlugins
}) {
matchUtilities({
bg: value => {
if (!corePlugins('backgroundOpacity')) {
return {
'background-color': value
};
}
return (0, _withAlphaVariable.default)({
color: value,
property: 'background-color',
variable: '--tw-bg-opacity'
});
}
}, {
values: (0, _flattenColorPalette.default)(theme('backgroundColor')),
variants: variants('backgroundColor'),
type: 'color'
});
};
}

View file

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
var _pluginUtils = require("../util/pluginUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('backgroundImage', [['bg', ['background-image']]], {
resolveArbitraryValue: _pluginUtils.asLookupValue
});
}

View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('backgroundOpacity', [['bg-opacity', ['--tw-bg-opacity']]]);
}

View file

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.bg-origin-border': {
'background-origin': 'border-box'
},
'.bg-origin-padding': {
'background-origin': 'padding-box'
},
'.bg-origin-content': {
'background-origin': 'content-box'
}
}, variants('backgroundOrigin'));
};
}

View file

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
var _pluginUtils = require("../util/pluginUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('backgroundPosition', [['bg', ['background-position']]], {
resolveArbitraryValue: _pluginUtils.asLookupValue
});
}

View file

@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.bg-repeat': {
'background-repeat': 'repeat'
},
'.bg-no-repeat': {
'background-repeat': 'no-repeat'
},
'.bg-repeat-x': {
'background-repeat': 'repeat-x'
},
'.bg-repeat-y': {
'background-repeat': 'repeat-y'
},
'.bg-repeat-round': {
'background-repeat': 'round'
},
'.bg-repeat-space': {
'background-repeat': 'space'
}
}, variants('backgroundRepeat'));
};
}

18
node_modules/tailwindcss/lib/plugins/backgroundSize.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
var _pluginUtils = require("../util/pluginUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('backgroundSize', [['bg', ['background-size']]], {
resolveArbitraryValue: _pluginUtils.asLookupValue
});
}

31
node_modules/tailwindcss/lib/plugins/blur.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
blur: value => {
return {
'--tw-blur': `blur(${value})`,
...(config('mode') === 'jit' ? {
'@defaults filter': {},
filter: 'var(--tw-filter)'
} : {})
};
}
}, {
values: theme('blur'),
variants: variants('blur'),
type: 'any'
});
};
}

22
node_modules/tailwindcss/lib/plugins/borderCollapse.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.border-collapse': {
'border-collapse': 'collapse'
},
'.border-separate': {
'border-collapse': 'separate'
}
}, variants('borderCollapse'));
};
}

144
node_modules/tailwindcss/lib/plugins/borderColor.js generated vendored Normal file
View file

@ -0,0 +1,144 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _flattenColorPalette = _interopRequireDefault(require("../util/flattenColorPalette"));
var _withAlphaVariable = _interopRequireDefault(require("../util/withAlphaVariable"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function ({
config,
addBase,
matchUtilities,
theme,
variants,
corePlugins
}) {
if (config('mode') === 'jit') {
if (!corePlugins('borderOpacity')) {
addBase({
'@defaults border-width': {
'border-color': theme('borderColor.DEFAULT', 'currentColor')
}
});
} else {
addBase({
'@defaults border-width': (0, _withAlphaVariable.default)({
color: theme('borderColor.DEFAULT', 'currentColor'),
property: 'border-color',
variable: '--tw-border-opacity'
})
});
}
} else {
if (!corePlugins('borderOpacity')) {
addBase({
'*, ::before, ::after': {
'border-color': theme('borderColor.DEFAULT', 'currentColor')
}
});
} else {
addBase({
'*, ::before, ::after': (0, _withAlphaVariable.default)({
color: theme('borderColor.DEFAULT', 'currentColor'),
property: 'border-color',
variable: '--tw-border-opacity'
})
});
}
}
matchUtilities({
border: value => {
if (!corePlugins('borderOpacity')) {
return {
'border-color': value
};
}
return (0, _withAlphaVariable.default)({
color: value,
property: 'border-color',
variable: '--tw-border-opacity'
});
}
}, {
values: (({
DEFAULT: _,
...colors
}) => colors)((0, _flattenColorPalette.default)(theme('borderColor'))),
variants: variants('borderColor'),
type: 'color'
});
if (config('mode') === 'jit') {
matchUtilities({
'border-t': value => {
if (!corePlugins('borderOpacity')) {
return {
'border-top-color': value
};
}
return (0, _withAlphaVariable.default)({
color: value,
property: 'border-top-color',
variable: '--tw-border-opacity'
});
},
'border-r': value => {
if (!corePlugins('borderOpacity')) {
return {
'border-right-color': value
};
}
return (0, _withAlphaVariable.default)({
color: value,
property: 'border-right-color',
variable: '--tw-border-opacity'
});
},
'border-b': value => {
if (!corePlugins('borderOpacity')) {
return {
'border-bottom-color': value
};
}
return (0, _withAlphaVariable.default)({
color: value,
property: 'border-bottom-color',
variable: '--tw-border-opacity'
});
},
'border-l': value => {
if (!corePlugins('borderOpacity')) {
return {
'border-left-color': value
};
}
return (0, _withAlphaVariable.default)({
color: value,
property: 'border-left-color',
variable: '--tw-border-opacity'
});
}
}, {
values: (({
DEFAULT: _,
...colors
}) => colors)((0, _flattenColorPalette.default)(theme('borderColor'))),
variants: variants('borderColor'),
type: 'color'
});
}
};
}

14
node_modules/tailwindcss/lib/plugins/borderOpacity.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('borderOpacity', [['border-opacity', ['--tw-border-opacity']]]);
}

14
node_modules/tailwindcss/lib/plugins/borderRadius.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('borderRadius', [['rounded', ['border-radius']], [['rounded-t', ['border-top-left-radius', 'border-top-right-radius']], ['rounded-r', ['border-top-right-radius', 'border-bottom-right-radius']], ['rounded-b', ['border-bottom-right-radius', 'border-bottom-left-radius']], ['rounded-l', ['border-top-left-radius', 'border-bottom-left-radius']]], [['rounded-tl', ['border-top-left-radius']], ['rounded-tr', ['border-top-right-radius']], ['rounded-br', ['border-bottom-right-radius']], ['rounded-bl', ['border-bottom-left-radius']]]]);
}

31
node_modules/tailwindcss/lib/plugins/borderStyle.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.border-solid': {
'border-style': 'solid'
},
'.border-dashed': {
'border-style': 'dashed'
},
'.border-dotted': {
'border-style': 'dotted'
},
'.border-double': {
'border-style': 'double'
},
'.border-none': {
'border-style': 'none'
}
}, variants('borderStyle'));
};
}

26
node_modules/tailwindcss/lib/plugins/borderWidth.js generated vendored Normal file
View file

@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _pluginUtils = require("../util/pluginUtils");
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function (helpers) {
if (helpers.config('mode') === 'jit') {
(0, _createUtilityPlugin.default)('borderWidth', [['border', [['@defaults border-width', {}], 'border-width']], [['border-t', [['@defaults border-width', {}], 'border-top-width']], ['border-r', [['@defaults border-width', {}], 'border-right-width']], ['border-b', [['@defaults border-width', {}], 'border-bottom-width']], ['border-l', [['@defaults border-width', {}], 'border-left-width']]]], {
resolveArbitraryValue: _pluginUtils.asLength
})(helpers);
} else {
(0, _createUtilityPlugin.default)('borderWidth', [['border', ['border-width']], [['border-t', ['border-top-width']], ['border-r', ['border-right-width']], ['border-b', ['border-bottom-width']], ['border-l', ['border-left-width']]]], {
resolveArbitraryValue: _pluginUtils.asLength
})(helpers);
}
};
}

View file

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.decoration-slice': {
'box-decoration-break': 'slice'
},
'.decoration-clone': {
'box-decoration-break': 'clone'
}
}, variants('boxDecorationBreak'));
};
}

58
node_modules/tailwindcss/lib/plugins/boxShadow.js generated vendored Normal file
View file

@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _transformThemeValue = _interopRequireDefault(require("../util/transformThemeValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let transformValue = (0, _transformThemeValue.default)('boxShadow');
let defaultBoxShadow = [`var(--tw-ring-offset-shadow, 0 0 #0000)`, `var(--tw-ring-shadow, 0 0 #0000)`, `var(--tw-shadow)`].join(', ');
function _default() {
return function ({
config,
matchUtilities,
addBase,
addUtilities,
theme,
variants
}) {
if (config('mode') === 'jit') {
addBase({
'@defaults box-shadow': {
'--tw-ring-offset-shadow': '0 0 #0000',
'--tw-ring-shadow': '0 0 #0000',
'--tw-shadow': '0 0 #0000'
}
});
} else {
addUtilities({
'*, ::before, ::after': {
'--tw-shadow': '0 0 #0000'
}
}, {
respectImportant: false
});
}
matchUtilities({
shadow: value => {
value = transformValue(value);
return { ...(config('mode') === 'jit' ? {
'@defaults box-shadow': {}
} : {}),
'--tw-shadow': value === 'none' ? '0 0 #0000' : value,
'box-shadow': defaultBoxShadow
};
}
}, {
values: theme('boxShadow'),
variants: variants('boxShadow'),
type: 'lookup'
});
};
}

22
node_modules/tailwindcss/lib/plugins/boxSizing.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.box-border': {
'box-sizing': 'border-box'
},
'.box-content': {
'box-sizing': 'content-box'
}
}, variants('boxSizing'));
};
}

31
node_modules/tailwindcss/lib/plugins/brightness.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
brightness: value => {
return {
'--tw-brightness': `brightness(${value})`,
...(config('mode') === 'jit' ? {
'@defaults filter': {},
filter: 'var(--tw-filter)'
} : {})
};
}
}, {
values: theme('brightness'),
variants: variants('brightness'),
type: 'any'
});
};
}

32
node_modules/tailwindcss/lib/plugins/caretColor.js generated vendored Normal file
View file

@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _flattenColorPalette = _interopRequireDefault(require("../util/flattenColorPalette"));
var _toColorValue = _interopRequireDefault(require("../util/toColorValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function ({
matchUtilities,
theme,
variants
}) {
matchUtilities({
caret: value => {
return {
'caret-color': (0, _toColorValue.default)(value)
};
}
}, {
values: (0, _flattenColorPalette.default)(theme('caretColor')),
variants: variants('caretColor'),
type: ['color', 'any']
});
};
}

28
node_modules/tailwindcss/lib/plugins/clear.js generated vendored Normal file
View file

@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.clear-left': {
clear: 'left'
},
'.clear-right': {
clear: 'right'
},
'.clear-both': {
clear: 'both'
},
'.clear-none': {
clear: 'none'
}
}, variants('clear'));
};
}

110
node_modules/tailwindcss/lib/plugins/container.js generated vendored Normal file
View file

@ -0,0 +1,110 @@
"use strict";
var _lodash = _interopRequireDefault(require("lodash"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable no-shadow */
function extractMinWidths(breakpoints) {
return _lodash.default.flatMap(breakpoints, breakpoints => {
if (_lodash.default.isString(breakpoints)) {
breakpoints = {
min: breakpoints
};
}
if (!Array.isArray(breakpoints)) {
breakpoints = [breakpoints];
}
return (0, _lodash.default)(breakpoints).filter(breakpoint => {
return _lodash.default.has(breakpoint, 'min') || _lodash.default.has(breakpoint, 'min-width');
}).map(breakpoint => {
return _lodash.default.get(breakpoint, 'min-width', breakpoint.min);
}).value();
});
}
function mapMinWidthsToPadding(minWidths, screens, paddings) {
if (typeof paddings === 'undefined') {
return [];
}
if (!_lodash.default.isObject(paddings)) {
return [{
screen: 'DEFAULT',
minWidth: 0,
padding: paddings
}];
}
const mapping = [];
if (paddings.DEFAULT) {
mapping.push({
screen: 'DEFAULT',
minWidth: 0,
padding: paddings.DEFAULT
});
}
_lodash.default.each(minWidths, minWidth => {
Object.keys(screens).forEach(screen => {
const screenMinWidth = _lodash.default.isPlainObject(screens[screen]) ? screens[screen].min || screens[screen]['min-width'] : screens[screen];
if (`${screenMinWidth}` === `${minWidth}`) {
mapping.push({
screen,
minWidth,
padding: paddings[screen]
});
}
});
});
return mapping;
}
module.exports = function () {
return function ({
addComponents,
theme,
variants
}) {
const screens = theme('container.screens', theme('screens'));
const minWidths = extractMinWidths(screens);
const paddings = mapMinWidthsToPadding(minWidths, screens, theme('container.padding'));
const generatePaddingFor = minWidth => {
const paddingConfig = _lodash.default.find(paddings, padding => `${padding.minWidth}` === `${minWidth}`);
if (!paddingConfig) {
return {};
}
return {
paddingRight: paddingConfig.padding,
paddingLeft: paddingConfig.padding
};
};
const atRules = (0, _lodash.default)(minWidths).sortBy(minWidth => parseInt(minWidth)).sortedUniq().map(minWidth => {
return {
[`@media (min-width: ${minWidth})`]: {
'.container': {
'max-width': minWidth,
...generatePaddingFor(minWidth)
}
}
};
}).value();
addComponents([{
'.container': Object.assign({
width: '100%'
}, theme('container.center', false) ? {
marginRight: 'auto',
marginLeft: 'auto'
} : {}, generatePaddingFor(0))
}, ...atRules], variants('container'));
};
};

14
node_modules/tailwindcss/lib/plugins/content.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('content');
}

31
node_modules/tailwindcss/lib/plugins/contrast.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
matchUtilities,
theme,
variants
}) {
matchUtilities({
contrast: value => {
return {
'--tw-contrast': `contrast(${value})`,
...(config('mode') === 'jit' ? {
'@defaults filter': {},
filter: 'var(--tw-filter)'
} : {})
};
}
}, {
values: theme('contrast'),
variants: variants('contrast'),
type: 'any'
});
};
}

23
node_modules/tailwindcss/lib/plugins/css/LICENSE generated vendored Normal file
View file

@ -0,0 +1,23 @@
MIT License
Copyright (c) Nicolas Gallagher
Copyright (c) Adam Wathan
Copyright (c) Jonathan Reinink
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

259
node_modules/tailwindcss/lib/plugins/css/preflight.css generated vendored Normal file
View file

@ -0,0 +1,259 @@
/**
* Manually forked from SUIT CSS Base: https://github.com/suitcss/base
* A thin layer on top of normalize.css that provides a starting point more
* suitable for web applications.
*/
/**
* Removes the default spacing and border for appropriate elements.
*/
blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
margin: 0;
}
button {
background-color: transparent;
background-image: none;
}
fieldset {
margin: 0;
padding: 0;
}
ol,
ul {
list-style: none;
margin: 0;
padding: 0;
}
/**
* Tailwind custom reset styles
*/
/**
* 1. Use the user's configured `sans` font-family (with Tailwind's default
* sans-serif font stack as a fallback) as a sane default.
* 2. Use Tailwind's default "normal" line-height so the user isn't forced
* to override it to ensure consistency even when using the default theme.
*/
html {
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 1 */
line-height: 1.5; /* 2 */
}
/**
* Inherit font-family and line-height from `html` so users can set them as
* a class directly on the `html` element.
*/
body {
font-family: inherit;
line-height: inherit;
}
/**
* 1. Prevent padding and border from affecting element width.
*
* We used to set this in the html element and inherit from
* the parent element for everything else. This caused issues
* in shadow-dom-enhanced elements like <details> where the content
* is wrapped by a div with box-sizing set to `content-box`.
*
* https://github.com/mozdevs/cssremedy/issues/4
*
*
* 2. Allow adding a border to an element by just adding a border-width.
*
* By default, the way the browser specifies that an element should have no
* border is by setting it's border-style to `none` in the user-agent
* stylesheet.
*
* In order to easily add borders to elements by just setting the `border-width`
* property, we change the default border-style for all elements to `solid`, and
* use border-width to hide them instead. This way our `border` utilities only
* need to set the `border-width` property instead of the entire `border`
* shorthand, making our border utilities much more straightforward to compose.
*
* https://github.com/tailwindcss/tailwindcss/pull/116
*/
*,
::before,
::after {
box-sizing: border-box; /* 1 */
border-width: 0; /* 2 */
border-style: solid; /* 2 */
border-color: currentColor; /* 2 */
}
/*
* Ensure horizontal rules are visible by default
*/
hr {
border-top-width: 1px;
}
/**
* Undo the `border-style: none` reset that Normalize applies to images so that
* our `border-{width}` utilities have the expected effect.
*
* The Normalize reset is unnecessary for us since we default the border-width
* to 0 on all elements.
*
* https://github.com/tailwindcss/tailwindcss/issues/362
*/
img {
border-style: solid;
}
textarea {
resize: vertical;
}
input::placeholder,
textarea::placeholder {
opacity: 1;
color: theme('colors.gray.400', #a1a1aa);
}
button,
[role="button"] {
cursor: pointer;
}
/**
* Override legacy focus reset from Normalize with modern Firefox focus styles.
*
* This is actually an improvement over the new defaults in Firefox in our testing,
* as it triggers the better focus styles even for links, which still use a dotted
* outline in Firefox by default.
*/
:-moz-focusring {
outline: auto;
}
table {
border-collapse: collapse;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: inherit;
font-weight: inherit;
}
/**
* Reset links to optimize for opt-in styling instead of
* opt-out.
*/
a {
color: inherit;
text-decoration: inherit;
}
/**
* Reset form element properties that are easy to forget to
* style explicitly so you don't inadvertently introduce
* styles that deviate from your design system. These styles
* supplement a partial reset that is already applied by
* normalize.css.
*/
button,
input,
optgroup,
select,
textarea {
padding: 0;
line-height: inherit;
color: inherit;
}
/**
* Use the configured 'mono' font family for elements that
* are expected to be rendered with a monospace font, falling
* back to the system monospace stack if there is no configured
* 'mono' font family.
*/
pre,
code,
kbd,
samp {
font-family: theme('fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
}
/**
* 1. Make replaced elements `display: block` by default as that's
* the behavior you want almost all of the time. Inspired by
* CSS Remedy, with `svg` added as well.
*
* https://github.com/mozdevs/cssremedy/issues/14
*
* 2. Add `vertical-align: middle` to align replaced elements more
* sensibly by default when overriding `display` by adding a
* utility like `inline`.
*
* This can trigger a poorly considered linting error in some
* tools but is included by design.
*
* https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210
*/
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
display: block; /* 1 */
vertical-align: middle; /* 2 */
}
/**
* Constrain images and videos to the parent width and preserve
* their intrinsic aspect ratio.
*
* https://github.com/mozdevs/cssremedy/issues/14
*/
img,
video {
max-width: 100%;
height: auto;
}
/**
* Ensure the default browser behavior of the `hidden` attribute.
*/
[hidden] {
display: none;
}

14
node_modules/tailwindcss/lib/plugins/cursor.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('cursor');
}

79
node_modules/tailwindcss/lib/plugins/display.js generated vendored Normal file
View file

@ -0,0 +1,79 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.block': {
display: 'block'
},
'.inline-block': {
display: 'inline-block'
},
'.inline': {
display: 'inline'
},
'.flex': {
display: 'flex'
},
'.inline-flex': {
display: 'inline-flex'
},
'.table': {
display: 'table'
},
'.inline-table': {
display: 'inline-table'
},
'.table-caption': {
display: 'table-caption'
},
'.table-cell': {
display: 'table-cell'
},
'.table-column': {
display: 'table-column'
},
'.table-column-group': {
display: 'table-column-group'
},
'.table-footer-group': {
display: 'table-footer-group'
},
'.table-header-group': {
display: 'table-header-group'
},
'.table-row-group': {
display: 'table-row-group'
},
'.table-row': {
display: 'table-row'
},
'.flow-root': {
display: 'flow-root'
},
'.grid': {
display: 'grid'
},
'.inline-grid': {
display: 'inline-grid'
},
'.contents': {
display: 'contents'
},
'.list-item': {
display: 'list-item'
},
'.hidden': {
display: 'none'
}
}, variants('display'));
};
}

48
node_modules/tailwindcss/lib/plugins/divideColor.js generated vendored Normal file
View file

@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _flattenColorPalette = _interopRequireDefault(require("../util/flattenColorPalette"));
var _withAlphaVariable = _interopRequireDefault(require("../util/withAlphaVariable"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function ({
matchUtilities,
theme,
variants,
corePlugins
}) {
matchUtilities({
divide: value => {
if (!corePlugins('divideOpacity')) {
return {
['& > :not([hidden]) ~ :not([hidden])']: {
'border-color': value
}
};
}
return {
['& > :not([hidden]) ~ :not([hidden])']: (0, _withAlphaVariable.default)({
color: value,
property: 'border-color',
variable: '--tw-divide-opacity'
})
};
}
}, {
values: (({
DEFAULT: _,
...colors
}) => colors)((0, _flattenColorPalette.default)(theme('divideColor'))),
variants: variants('divideColor'),
type: 'color'
});
};
}

28
node_modules/tailwindcss/lib/plugins/divideOpacity.js generated vendored Normal file
View file

@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
matchUtilities,
theme,
variants
}) {
matchUtilities({
'divide-opacity': value => {
return {
[`& > :not([hidden]) ~ :not([hidden])`]: {
'--tw-divide-opacity': value
}
};
}
}, {
values: theme('divideOpacity'),
variants: variants('divideOpacity'),
type: 'any'
});
};
}

31
node_modules/tailwindcss/lib/plugins/divideStyle.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.divide-solid > :not([hidden]) ~ :not([hidden])': {
'border-style': 'solid'
},
'.divide-dashed > :not([hidden]) ~ :not([hidden])': {
'border-style': 'dashed'
},
'.divide-dotted > :not([hidden]) ~ :not([hidden])': {
'border-style': 'dotted'
},
'.divide-double > :not([hidden]) ~ :not([hidden])': {
'border-style': 'double'
},
'.divide-none > :not([hidden]) ~ :not([hidden])': {
'border-style': 'none'
}
}, variants('divideStyle'));
};
}

59
node_modules/tailwindcss/lib/plugins/divideWidth.js generated vendored Normal file
View file

@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
matchUtilities,
addUtilities,
theme,
variants,
config
}) {
matchUtilities({
'divide-x': value => {
value = value === '0' ? '0px' : value;
return {
'& > :not([hidden]) ~ :not([hidden])': { ...(config('mode') === 'jit' ? {
'@defaults border-width': {}
} : {}),
'--tw-divide-x-reverse': '0',
'border-right-width': `calc(${value} * var(--tw-divide-x-reverse))`,
'border-left-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`
}
};
},
'divide-y': value => {
value = value === '0' ? '0px' : value;
return {
'& > :not([hidden]) ~ :not([hidden])': { ...(config('mode') === 'jit' ? {
'@defaults border-width': {}
} : {}),
'--tw-divide-y-reverse': '0',
'border-top-width': `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`,
'border-bottom-width': `calc(${value} * var(--tw-divide-y-reverse))`
}
};
}
}, {
values: theme('divideWidth'),
variants: variants('divideWidth'),
type: 'length'
});
addUtilities({
'.divide-y-reverse > :not([hidden]) ~ :not([hidden])': { ...(config('mode') === 'jit' ? {
'@defaults border-width': {}
} : {}),
'--tw-divide-y-reverse': '1'
},
'.divide-x-reverse > :not([hidden]) ~ :not([hidden])': { ...(config('mode') === 'jit' ? {
'@defaults border-width': {}
} : {}),
'--tw-divide-x-reverse': '1'
}
}, variants('divideWidth'));
};
}

33
node_modules/tailwindcss/lib/plugins/dropShadow.js generated vendored Normal file
View file

@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _lodash = _interopRequireDefault(require("lodash"));
var _nameClass = _interopRequireDefault(require("../util/nameClass"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function ({
config,
addUtilities,
theme,
variants
}) {
const utilities = _lodash.default.fromPairs(_lodash.default.map(theme('dropShadow'), (value, modifier) => {
return [(0, _nameClass.default)('drop-shadow', modifier), {
'--tw-drop-shadow': Array.isArray(value) ? value.map(v => `drop-shadow(${v})`).join(' ') : `drop-shadow(${value})`,
...(config('mode') === 'jit' ? {
'@defaults filter': {},
filter: 'var(--tw-filter)'
} : {})
}];
}));
addUtilities(utilities, variants('dropShadow'));
};
}

32
node_modules/tailwindcss/lib/plugins/fill.js generated vendored Normal file
View file

@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _flattenColorPalette = _interopRequireDefault(require("../util/flattenColorPalette"));
var _toColorValue = _interopRequireDefault(require("../util/toColorValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function ({
matchUtilities,
theme,
variants
}) {
matchUtilities({
fill: value => {
return {
fill: (0, _toColorValue.default)(value)
};
}
}, {
values: (0, _flattenColorPalette.default)(theme('fill')),
variants: variants('fill'),
type: ['color', 'any']
});
};
}

59
node_modules/tailwindcss/lib/plugins/filter.js generated vendored Normal file
View file

@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
config,
addBase,
addUtilities,
variants
}) {
if (config('mode') === 'jit') {
addBase({
'@defaults filter': {
'--tw-blur': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-invert': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-drop-shadow': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-filter': ['var(--tw-blur)', 'var(--tw-brightness)', 'var(--tw-contrast)', 'var(--tw-grayscale)', 'var(--tw-hue-rotate)', 'var(--tw-invert)', 'var(--tw-saturate)', 'var(--tw-sepia)', 'var(--tw-drop-shadow)'].join(' ')
}
});
addUtilities({
'.filter': {
'@defaults filter': {},
filter: 'var(--tw-filter)'
},
'.filter-none': {
filter: 'none'
}
}, variants('filter'));
} else {
addUtilities({
'.filter': {
'--tw-blur': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-invert': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-drop-shadow': 'var(--tw-empty,/*!*/ /*!*/)',
filter: ['var(--tw-blur)', 'var(--tw-brightness)', 'var(--tw-contrast)', 'var(--tw-grayscale)', 'var(--tw-hue-rotate)', 'var(--tw-invert)', 'var(--tw-saturate)', 'var(--tw-sepia)', 'var(--tw-drop-shadow)'].join(' ')
},
'.filter-none': {
filter: 'none'
}
}, variants('filter'));
}
};
}

14
node_modules/tailwindcss/lib/plugins/flex.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('flex');
}

28
node_modules/tailwindcss/lib/plugins/flexDirection.js generated vendored Normal file
View file

@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.flex-row': {
'flex-direction': 'row'
},
'.flex-row-reverse': {
'flex-direction': 'row-reverse'
},
'.flex-col': {
'flex-direction': 'column'
},
'.flex-col-reverse': {
'flex-direction': 'column-reverse'
}
}, variants('flexDirection'));
};
}

14
node_modules/tailwindcss/lib/plugins/flexGrow.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('flexGrow', [['flex-grow', ['flex-grow']]]);
}

14
node_modules/tailwindcss/lib/plugins/flexShrink.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('flexShrink', [['flex-shrink', ['flex-shrink']]]);
}

25
node_modules/tailwindcss/lib/plugins/flexWrap.js generated vendored Normal file
View file

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.flex-wrap': {
'flex-wrap': 'wrap'
},
'.flex-wrap-reverse': {
'flex-wrap': 'wrap-reverse'
},
'.flex-nowrap': {
'flex-wrap': 'nowrap'
}
}, variants('flexWrap'));
};
}

25
node_modules/tailwindcss/lib/plugins/float.js generated vendored Normal file
View file

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.float-right': {
float: 'right'
},
'.float-left': {
float: 'left'
},
'.float-none': {
float: 'none'
}
}, variants('float'));
};
}

18
node_modules/tailwindcss/lib/plugins/fontFamily.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
var _pluginUtils = require("../util/pluginUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('fontFamily', [['font', ['fontFamily']]], {
resolveArbitraryValue: _pluginUtils.asLookupValue
});
}

43
node_modules/tailwindcss/lib/plugins/fontSize.js generated vendored Normal file
View file

@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _isPlainObject = _interopRequireDefault(require("../util/isPlainObject"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return function ({
matchUtilities,
theme,
variants
}) {
matchUtilities({
text: value => {
let [fontSize, options] = Array.isArray(value) ? value : [value];
let {
lineHeight,
letterSpacing
} = (0, _isPlainObject.default)(options) ? options : {
lineHeight: options
};
return {
'font-size': fontSize,
...(lineHeight === undefined ? {} : {
'line-height': lineHeight
}),
...(letterSpacing === undefined ? {} : {
'letter-spacing': letterSpacing
})
};
}
}, {
values: theme('fontSize'),
variants: variants('fontSize'),
type: 'length'
});
};
}

24
node_modules/tailwindcss/lib/plugins/fontSmoothing.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.antialiased': {
'-webkit-font-smoothing': 'antialiased',
'-moz-osx-font-smoothing': 'grayscale'
},
'.subpixel-antialiased': {
'-webkit-font-smoothing': 'auto',
'-moz-osx-font-smoothing': 'auto'
}
}, variants('fontSmoothing'));
};
}

22
node_modules/tailwindcss/lib/plugins/fontStyle.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.italic': {
'font-style': 'italic'
},
'.not-italic': {
'font-style': 'normal'
}
}, variants('fontStyle'));
};
}

View file

@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _default() {
return function ({
addUtilities,
variants
}) {
addUtilities({
'.ordinal, .slashed-zero, .lining-nums, .oldstyle-nums, .proportional-nums, .tabular-nums, .diagonal-fractions, .stacked-fractions': {
'--tw-ordinal': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-slashed-zero': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-numeric-figure': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-numeric-spacing': 'var(--tw-empty,/*!*/ /*!*/)',
'--tw-numeric-fraction': 'var(--tw-empty,/*!*/ /*!*/)',
'font-variant-numeric': 'var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)'
},
'.normal-nums': {
'font-variant-numeric': 'normal'
},
'.ordinal': {
'--tw-ordinal': 'ordinal'
},
'.slashed-zero': {
'--tw-slashed-zero': 'slashed-zero'
},
'.lining-nums': {
'--tw-numeric-figure': 'lining-nums'
},
'.oldstyle-nums': {
'--tw-numeric-figure': 'oldstyle-nums'
},
'.proportional-nums': {
'--tw-numeric-spacing': 'proportional-nums'
},
'.tabular-nums': {
'--tw-numeric-spacing': 'tabular-nums'
},
'.diagonal-fractions': {
'--tw-numeric-fraction': 'diagonal-fractions'
},
'.stacked-fractions': {
'--tw-numeric-fraction': 'stacked-fractions'
}
}, variants('fontVariantNumeric'));
};
}

18
node_modules/tailwindcss/lib/plugins/fontWeight.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
var _pluginUtils = require("../util/pluginUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('fontWeight', [['font', ['fontWeight']]], {
resolveArbitraryValue: _pluginUtils.asLookupValue
});
}

14
node_modules/tailwindcss/lib/plugins/gap.js generated vendored Normal file
View file

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _createUtilityPlugin = _interopRequireDefault(require("../util/createUtilityPlugin"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return (0, _createUtilityPlugin.default)('gap', [['gap', ['gap']], [['gap-x', ['columnGap']], ['gap-y', ['rowGap']]]]);
}

View file

@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _flattenColorPalette = _interopRequireDefault(require("../util/flattenColorPalette"));
var _toColorValue = _interopRequireDefault(require("../util/toColorValue"));
var _withAlphaVariable = require("../util/withAlphaVariable");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function transparentTo(value) {
return (0, _withAlphaVariable.withAlphaValue)(value, 0, 'rgba(255, 255, 255, 0)');
}
function _default() {
return function ({
matchUtilities,
theme,
variants
}) {
let options = {
values: (0, _flattenColorPalette.default)(theme('gradientColorStops')),
variants: variants('gradientColorStops'),
type: ['color', 'any']
};
matchUtilities({
from: value => {
let transparentToValue = transparentTo(value);
return {
'--tw-gradient-from': (0, _toColorValue.default)(value, 'from'),
'--tw-gradient-stops': `var(--tw-gradient-from), var(--tw-gradient-to, ${transparentToValue})`
};
}
}, options);
matchUtilities({
via: value => {
let transparentToValue = transparentTo(value);
return {
'--tw-gradient-stops': `var(--tw-gradient-from), ${(0, _toColorValue.default)(value, 'via')}, var(--tw-gradient-to, ${transparentToValue})`
};
}
}, options);
matchUtilities({
to: value => {
return {
'--tw-gradient-to': (0, _toColorValue.default)(value, 'to')
};
}
}, options);
};
}

Some files were not shown because too many files have changed in this diff Show more