mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
config redirect
This commit is contained in:
28
node_modules/tailwindcss/lib/cli-peer-dependencies.js
generated
vendored
Normal file
28
node_modules/tailwindcss/lib/cli-peer-dependencies.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
lazyPostcss: ()=>lazyPostcss,
|
||||
lazyPostcssImport: ()=>lazyPostcssImport,
|
||||
lazyAutoprefixer: ()=>lazyAutoprefixer,
|
||||
lazyCssnano: ()=>lazyCssnano
|
||||
});
|
||||
function lazyPostcss() {
|
||||
return require("postcss");
|
||||
}
|
||||
function lazyPostcssImport() {
|
||||
return require("postcss-import");
|
||||
}
|
||||
function lazyAutoprefixer() {
|
||||
return require("autoprefixer");
|
||||
}
|
||||
function lazyCssnano() {
|
||||
return require("cssnano");
|
||||
}
|
||||
229
node_modules/tailwindcss/lib/cli.js
generated
vendored
Executable file
229
node_modules/tailwindcss/lib/cli.js
generated
vendored
Executable file
@@ -0,0 +1,229 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
const _arg = /*#__PURE__*/ _interopRequireDefault(require("arg"));
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _build = require("./cli/build");
|
||||
const _help = require("./cli/help");
|
||||
const _init = require("./cli/init");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function isESM() {
|
||||
const pkgPath = _path.default.resolve("./package.json");
|
||||
try {
|
||||
let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
|
||||
return pkg.type && pkg.type === "module";
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
let configs = isESM() ? {
|
||||
tailwind: "tailwind.config.cjs",
|
||||
postcss: "postcss.config.cjs"
|
||||
} : {
|
||||
tailwind: "tailwind.config.js",
|
||||
postcss: "postcss.config.js"
|
||||
};
|
||||
// ---
|
||||
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.init,
|
||||
args: {
|
||||
"--full": {
|
||||
type: Boolean,
|
||||
description: `Initialize a full \`${configs.tailwind}\` file`
|
||||
},
|
||||
"--postcss": {
|
||||
type: Boolean,
|
||||
description: `Initialize a \`${configs.postcss}\` file`
|
||||
},
|
||||
"-f": "--full",
|
||||
"-p": "--postcss"
|
||||
}
|
||||
},
|
||||
build: {
|
||||
run: _build.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"
|
||||
},
|
||||
"--poll": {
|
||||
type: Boolean,
|
||||
description: "Use polling instead of filesystem events when watching"
|
||||
},
|
||||
"--content": {
|
||||
type: String,
|
||||
description: "Content paths to use for removing unused classes"
|
||||
},
|
||||
"--purge": {
|
||||
type: String,
|
||||
deprecated: true
|
||||
},
|
||||
"--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",
|
||||
"-p": "--poll"
|
||||
}
|
||||
}
|
||||
};
|
||||
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))) {
|
||||
(0, _help.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 {
|
||||
(0, _help.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 ref;
|
||||
return !(value === null || value === void 0 ? void 0 : (ref = value.type) === null || ref === void 0 ? void 0 : ref.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") {
|
||||
(0, _help.help)({
|
||||
message: err.message,
|
||||
usage: [
|
||||
"tailwindcss <command> [options]"
|
||||
],
|
||||
options: sharedFlags
|
||||
});
|
||||
process.exit(1);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
})();
|
||||
if (args["--help"]) {
|
||||
(0, _help.help)({
|
||||
options: {
|
||||
...flags,
|
||||
...sharedFlags
|
||||
},
|
||||
usage: [
|
||||
`tailwindcss ${command} [options]`
|
||||
]
|
||||
});
|
||||
process.exit(0);
|
||||
}
|
||||
run(args, configs);
|
||||
54
node_modules/tailwindcss/lib/cli/build/deps.js
generated
vendored
Normal file
54
node_modules/tailwindcss/lib/cli/build/deps.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
loadPostcss: ()=>loadPostcss,
|
||||
loadPostcssImport: ()=>loadPostcssImport,
|
||||
loadCssNano: ()=>loadCssNano,
|
||||
loadAutoprefixer: ()=>loadAutoprefixer
|
||||
});
|
||||
const _indexJs = require("../../../peers/index.js");
|
||||
function loadPostcss() {
|
||||
// Try to load a local `postcss` version first
|
||||
try {
|
||||
return require("postcss");
|
||||
} catch {}
|
||||
return (0, _indexJs.lazyPostcss)();
|
||||
}
|
||||
function loadPostcssImport() {
|
||||
// Try to load a local `postcss-import` version first
|
||||
try {
|
||||
return require("postcss-import");
|
||||
} catch {}
|
||||
return (0, _indexJs.lazyPostcssImport)();
|
||||
}
|
||||
function loadCssNano() {
|
||||
let options = {
|
||||
preset: [
|
||||
"default",
|
||||
{
|
||||
cssDeclarationSorter: false
|
||||
}
|
||||
]
|
||||
};
|
||||
// Try to load a local `cssnano` version first
|
||||
try {
|
||||
return require("cssnano");
|
||||
} catch {}
|
||||
return (0, _indexJs.lazyCssnano)()(options);
|
||||
}
|
||||
function loadAutoprefixer() {
|
||||
// Try to load a local `autoprefixer` version first
|
||||
try {
|
||||
return require("autoprefixer");
|
||||
} catch {}
|
||||
return (0, _indexJs.lazyAutoprefixer)();
|
||||
}
|
||||
44
node_modules/tailwindcss/lib/cli/build/index.js
generated
vendored
Normal file
44
node_modules/tailwindcss/lib/cli/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "build", {
|
||||
enumerable: true,
|
||||
get: ()=>build
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
const _pluginJs = require("./plugin.js");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
async function build(args, configs) {
|
||||
let input = args["--input"];
|
||||
let shouldWatch = args["--watch"];
|
||||
// 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 && 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);
|
||||
}
|
||||
// TODO: Reference the @config path here if exists
|
||||
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve(`./${configs.tailwind}`));
|
||||
let processor = await (0, _pluginJs.createProcessor)(args, configPath);
|
||||
if (shouldWatch) {
|
||||
/* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.on("end", ()=>process.exit(0));
|
||||
process.stdin.resume();
|
||||
await processor.watch();
|
||||
} else {
|
||||
await processor.build();
|
||||
}
|
||||
}
|
||||
362
node_modules/tailwindcss/lib/cli/build/plugin.js
generated
vendored
Normal file
362
node_modules/tailwindcss/lib/cli/build/plugin.js
generated
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createProcessor", {
|
||||
enumerable: true,
|
||||
get: ()=>createProcessor
|
||||
});
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _postcssLoadConfig = /*#__PURE__*/ _interopRequireDefault(require("postcss-load-config"));
|
||||
const _lilconfig = require("lilconfig");
|
||||
const _plugins = /*#__PURE__*/ _interopRequireDefault(require("postcss-load-config/src/plugins" // Little bit scary, looking at private/internal API
|
||||
));
|
||||
const _options = /*#__PURE__*/ _interopRequireDefault(require("postcss-load-config/src/options" // Little bit scary, looking at private/internal API
|
||||
));
|
||||
const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("../../processTailwindFeatures"));
|
||||
const _deps = require("./deps");
|
||||
const _utils = require("./utils");
|
||||
const _shared = require("../shared");
|
||||
const _resolveConfigJs = /*#__PURE__*/ _interopRequireDefault(require("../../../resolveConfig.js"));
|
||||
const _getModuleDependenciesJs = /*#__PURE__*/ _interopRequireDefault(require("../../lib/getModuleDependencies.js"));
|
||||
const _contentJs = require("../../lib/content.js");
|
||||
const _watchingJs = require("./watching.js");
|
||||
const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob"));
|
||||
const _findAtConfigPathJs = require("../../lib/findAtConfigPath.js");
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("../../util/log"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {string} [customPostCssPath ]
|
||||
* @returns
|
||||
*/ async function loadPostCssPlugins(customPostCssPath) {
|
||||
let config = customPostCssPath ? await (async ()=>{
|
||||
let file = _path.default.resolve(customPostCssPath);
|
||||
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.1.0/src/index.js
|
||||
// @ts-ignore
|
||||
let { config ={} } = await (0, _lilconfig.lilconfig)("postcss").load(file);
|
||||
if (typeof config === "function") {
|
||||
config = config();
|
||||
} else {
|
||||
config = Object.assign({}, config);
|
||||
}
|
||||
if (!config.plugins) {
|
||||
config.plugins = [];
|
||||
}
|
||||
return {
|
||||
file,
|
||||
plugins: (0, _plugins.default)(config, file),
|
||||
options: (0, _options.default)(config, file)
|
||||
};
|
||||
})() : await (0, _postcssLoadConfig.default)();
|
||||
let configPlugins = config.plugins;
|
||||
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,
|
||||
config.options
|
||||
];
|
||||
}
|
||||
function loadBuiltinPostcssPlugins() {
|
||||
let postcss = (0, _deps.loadPostcss)();
|
||||
let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
|
||||
return [
|
||||
[
|
||||
(root)=>{
|
||||
root.walkAtRules("import", (rule)=>{
|
||||
if (rule.params.slice(1).startsWith("tailwindcss/")) {
|
||||
rule.after(postcss.comment({
|
||||
text: IMPORT_COMMENT + rule.params
|
||||
}));
|
||||
rule.remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
(0, _deps.loadPostcssImport)(),
|
||||
(root)=>{
|
||||
root.walkComments((rule)=>{
|
||||
if (rule.text.startsWith(IMPORT_COMMENT)) {
|
||||
rule.after(postcss.atRule({
|
||||
name: "import",
|
||||
params: rule.text.replace(IMPORT_COMMENT, "")
|
||||
}));
|
||||
rule.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
],
|
||||
[],
|
||||
{}
|
||||
];
|
||||
}
|
||||
let state = {
|
||||
/** @type {any} */ context: null,
|
||||
/** @type {ReturnType<typeof createWatcher> | null} */ watcher: null,
|
||||
/** @type {{content: string, extension: string}[]} */ changedContent: [],
|
||||
configDependencies: new Set(),
|
||||
contextDependencies: new Set(),
|
||||
/** @type {import('../../lib/content.js').ContentPath[]} */ contentPaths: [],
|
||||
refreshContentPaths () {
|
||||
var ref;
|
||||
this.contentPaths = (0, _contentJs.parseCandidateFiles)(this.context, (ref = this.context) === null || ref === void 0 ? void 0 : ref.tailwindConfig);
|
||||
},
|
||||
get config () {
|
||||
return this.context.tailwindConfig;
|
||||
},
|
||||
get contentPatterns () {
|
||||
return {
|
||||
all: this.contentPaths.map((contentPath)=>contentPath.pattern),
|
||||
dynamic: this.contentPaths.filter((contentPath)=>contentPath.glob !== undefined).map((contentPath)=>contentPath.pattern)
|
||||
};
|
||||
},
|
||||
loadConfig (configPath, content) {
|
||||
if (this.watcher && configPath) {
|
||||
this.refreshConfigDependencies(configPath);
|
||||
}
|
||||
let config = configPath ? require(configPath) : {};
|
||||
// @ts-ignore
|
||||
config = (0, _resolveConfigJs.default)(config, {
|
||||
content: {
|
||||
files: []
|
||||
}
|
||||
});
|
||||
// Override content files if `--content` has been passed explicitly
|
||||
if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
|
||||
config.content.files = content;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
refreshConfigDependencies (configPath) {
|
||||
_shared.env.DEBUG && console.time("Module dependencies");
|
||||
for (let file of this.configDependencies){
|
||||
delete require.cache[require.resolve(file)];
|
||||
}
|
||||
if (configPath) {
|
||||
let deps = (0, _getModuleDependenciesJs.default)(configPath).map(({ file })=>file);
|
||||
for (let dependency of deps){
|
||||
this.configDependencies.add(dependency);
|
||||
}
|
||||
}
|
||||
_shared.env.DEBUG && console.timeEnd("Module dependencies");
|
||||
},
|
||||
readContentPaths () {
|
||||
let content = [];
|
||||
// Resolve globs from the content config
|
||||
// TODO: When we make the postcss plugin async-capable this can become async
|
||||
let files = _fastGlob.default.sync(this.contentPatterns.all);
|
||||
for (let file of files){
|
||||
content.push({
|
||||
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
||||
extension: _path.default.extname(file).slice(1)
|
||||
});
|
||||
}
|
||||
// Resolve raw content in the tailwind config
|
||||
let rawContent = this.config.content.files.filter((file)=>{
|
||||
return file !== null && typeof file === "object";
|
||||
});
|
||||
for (let { raw: htmlContent , extension ="html" } of rawContent){
|
||||
content.push({
|
||||
content: htmlContent,
|
||||
extension
|
||||
});
|
||||
}
|
||||
return content;
|
||||
},
|
||||
getContext ({ createContext , cliConfigPath , root , result , content }) {
|
||||
if (this.context) {
|
||||
this.context.changedContent = this.changedContent.splice(0);
|
||||
return this.context;
|
||||
}
|
||||
_shared.env.DEBUG && console.time("Searching for config");
|
||||
var ref;
|
||||
let configPath = (ref = (0, _findAtConfigPathJs.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : cliConfigPath;
|
||||
_shared.env.DEBUG && console.timeEnd("Searching for config");
|
||||
_shared.env.DEBUG && console.time("Loading config");
|
||||
let config = this.loadConfig(configPath, content);
|
||||
_shared.env.DEBUG && console.timeEnd("Loading config");
|
||||
_shared.env.DEBUG && console.time("Creating context");
|
||||
this.context = createContext(config, []);
|
||||
Object.assign(this.context, {
|
||||
userConfigPath: configPath
|
||||
});
|
||||
_shared.env.DEBUG && console.timeEnd("Creating context");
|
||||
_shared.env.DEBUG && console.time("Resolving content paths");
|
||||
this.refreshContentPaths();
|
||||
_shared.env.DEBUG && console.timeEnd("Resolving content paths");
|
||||
if (this.watcher) {
|
||||
_shared.env.DEBUG && console.time("Watch new files");
|
||||
this.watcher.refreshWatchedFiles();
|
||||
_shared.env.DEBUG && console.timeEnd("Watch new files");
|
||||
}
|
||||
_shared.env.DEBUG && console.time("Reading content files");
|
||||
for (let file of this.readContentPaths()){
|
||||
this.context.changedContent.push(file);
|
||||
}
|
||||
_shared.env.DEBUG && console.timeEnd("Reading content files");
|
||||
return this.context;
|
||||
}
|
||||
};
|
||||
async function createProcessor(args, cliConfigPath) {
|
||||
var ref;
|
||||
let postcss = (0, _deps.loadPostcss)();
|
||||
let input = args["--input"];
|
||||
let output = args["--output"];
|
||||
let includePostCss = args["--postcss"];
|
||||
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
||||
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : loadBuiltinPostcssPlugins();
|
||||
if (args["--purge"]) {
|
||||
_log.default.warn("purge-flag-deprecated", [
|
||||
"The `--purge` flag has been deprecated.",
|
||||
"Please use `--content` instead."
|
||||
]);
|
||||
if (!args["--content"]) {
|
||||
args["--content"] = args["--purge"];
|
||||
}
|
||||
}
|
||||
var ref1;
|
||||
let content = (ref1 = (ref = args["--content"]) === null || ref === void 0 ? void 0 : ref.split(/(?<!{[^}]+),/)) !== null && ref1 !== void 0 ? ref1 : [];
|
||||
let tailwindPlugin = ()=>{
|
||||
return {
|
||||
postcssPlugin: "tailwindcss",
|
||||
Once (root, { result }) {
|
||||
_shared.env.DEBUG && console.time("Compiling CSS");
|
||||
(0, _processTailwindFeatures.default)(({ createContext })=>{
|
||||
console.error();
|
||||
console.error("Rebuilding...");
|
||||
return ()=>{
|
||||
return state.getContext({
|
||||
createContext,
|
||||
cliConfigPath,
|
||||
root,
|
||||
result,
|
||||
content
|
||||
});
|
||||
};
|
||||
})(root, result);
|
||||
_shared.env.DEBUG && console.timeEnd("Compiling CSS");
|
||||
}
|
||||
};
|
||||
};
|
||||
tailwindPlugin.postcss = true;
|
||||
let plugins = [
|
||||
...beforePlugins,
|
||||
tailwindPlugin,
|
||||
!args["--minify"] && _utils.formatNodes,
|
||||
...afterPlugins,
|
||||
!args["--no-autoprefixer"] && (0, _deps.loadAutoprefixer)(),
|
||||
args["--minify"] && (0, _deps.loadCssNano)()
|
||||
].filter(Boolean);
|
||||
/** @type {import('postcss').Processor} */ // @ts-ignore
|
||||
let processor = postcss(plugins);
|
||||
async function readInput() {
|
||||
// Piping in data, let's drain the stdin
|
||||
if (input === "-") {
|
||||
return (0, _utils.drainStdin)();
|
||||
}
|
||||
// Input file has been provided
|
||||
if (input) {
|
||||
return _fs.default.promises.readFile(_path.default.resolve(input), "utf8");
|
||||
}
|
||||
// No input file provided, fallback to default atrules
|
||||
return "@tailwind base; @tailwind components; @tailwind utilities";
|
||||
}
|
||||
async function build() {
|
||||
let start = process.hrtime.bigint();
|
||||
return readInput().then((css)=>processor.process(css, {
|
||||
...postcssOptions,
|
||||
from: input,
|
||||
to: output
|
||||
})).then((result)=>{
|
||||
if (!state.watcher) {
|
||||
return result;
|
||||
}
|
||||
_shared.env.DEBUG && console.time("Recording PostCSS dependencies");
|
||||
for (let message of result.messages){
|
||||
if (message.type === "dependency") {
|
||||
state.contextDependencies.add(message.file);
|
||||
}
|
||||
}
|
||||
_shared.env.DEBUG && console.timeEnd("Recording PostCSS dependencies");
|
||||
// TODO: This needs to be in a different spot
|
||||
_shared.env.DEBUG && console.time("Watch new files");
|
||||
state.watcher.refreshWatchedFiles();
|
||||
_shared.env.DEBUG && console.timeEnd("Watch new files");
|
||||
return result;
|
||||
}).then((result)=>{
|
||||
if (!output) {
|
||||
process.stdout.write(result.css);
|
||||
return;
|
||||
}
|
||||
return Promise.all([
|
||||
(0, _utils.outputFile)(output, result.css),
|
||||
result.map && (0, _utils.outputFile)(output + ".map", result.map.toString())
|
||||
]);
|
||||
}).then(()=>{
|
||||
let end = process.hrtime.bigint();
|
||||
console.error();
|
||||
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
||||
}).then(()=>{}, (err)=>{
|
||||
// TODO: If an initial build fails we can't easily pick up any PostCSS dependencies
|
||||
// that were collected before the error occurred
|
||||
// The result is not stored on the error so we have to store it externally
|
||||
// and pull the messages off of it here somehow
|
||||
// This results in a less than ideal DX because the watcher will not pick up
|
||||
// changes to imported CSS if one of them caused an error during the initial build
|
||||
// If you fix it and then save the main CSS file so there's no error
|
||||
// The watcher will start watching the imported CSS files and will be
|
||||
// resilient to future errors.
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @param {{file: string, content(): Promise<string>, extension: string}[]} changes
|
||||
*/ async function parseChanges(changes) {
|
||||
return Promise.all(changes.map(async (change)=>({
|
||||
content: await change.content(),
|
||||
extension: change.extension
|
||||
})));
|
||||
}
|
||||
if (input !== undefined && input !== "-") {
|
||||
state.contextDependencies.add(_path.default.resolve(input));
|
||||
}
|
||||
return {
|
||||
build,
|
||||
watch: async ()=>{
|
||||
state.watcher = (0, _watchingJs.createWatcher)(args, {
|
||||
state,
|
||||
/**
|
||||
* @param {{file: string, content(): Promise<string>, extension: string}[]} changes
|
||||
*/ async rebuild (changes) {
|
||||
let needsNewContext = changes.some((change)=>{
|
||||
return state.configDependencies.has(change.file) || state.contextDependencies.has(change.file);
|
||||
});
|
||||
if (needsNewContext) {
|
||||
state.context = null;
|
||||
} else {
|
||||
for (let change of (await parseChanges(changes))){
|
||||
state.changedContent.push(change);
|
||||
}
|
||||
}
|
||||
return build();
|
||||
}
|
||||
});
|
||||
await build();
|
||||
}
|
||||
};
|
||||
}
|
||||
78
node_modules/tailwindcss/lib/cli/build/utils.js
generated
vendored
Normal file
78
node_modules/tailwindcss/lib/cli/build/utils.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
indentRecursive: ()=>indentRecursive,
|
||||
formatNodes: ()=>formatNodes,
|
||||
readFileWithRetries: ()=>readFileWithRetries,
|
||||
drainStdin: ()=>drainStdin,
|
||||
outputFile: ()=>outputFile
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
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 = "";
|
||||
}
|
||||
}
|
||||
async function readFileWithRetries(path, tries = 5) {
|
||||
for(let n = 0; n <= tries; n++){
|
||||
try {
|
||||
return await _fs.default.promises.readFile(path, "utf8");
|
||||
} catch (err) {
|
||||
if (n !== tries) {
|
||||
if (err.code === "ENOENT" || err.code === "EBUSY") {
|
||||
await new Promise((resolve)=>setTimeout(resolve, 10));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
function drainStdin() {
|
||||
return new Promise((resolve, reject)=>{
|
||||
let result = "";
|
||||
process.stdin.on("data", (chunk)=>{
|
||||
result += chunk;
|
||||
});
|
||||
process.stdin.on("end", ()=>resolve(result));
|
||||
process.stdin.on("error", (err)=>reject(err));
|
||||
});
|
||||
}
|
||||
async function outputFile(file, newContents) {
|
||||
try {
|
||||
let currentContents = await _fs.default.promises.readFile(file, "utf8");
|
||||
if (currentContents === newContents) {
|
||||
return; // Skip writing the file
|
||||
}
|
||||
} catch {}
|
||||
// Write the file
|
||||
await _fs.default.promises.mkdir(_path.default.dirname(file), {
|
||||
recursive: true
|
||||
});
|
||||
await _fs.default.promises.writeFile(file, newContents, "utf8");
|
||||
}
|
||||
178
node_modules/tailwindcss/lib/cli/build/watching.js
generated
vendored
Normal file
178
node_modules/tailwindcss/lib/cli/build/watching.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createWatcher", {
|
||||
enumerable: true,
|
||||
get: ()=>createWatcher
|
||||
});
|
||||
const _chokidar = /*#__PURE__*/ _interopRequireDefault(require("chokidar"));
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _micromatch = /*#__PURE__*/ _interopRequireDefault(require("micromatch"));
|
||||
const _normalizePath = /*#__PURE__*/ _interopRequireDefault(require("normalize-path"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
const _utilsJs = require("./utils.js");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function createWatcher(args, { state , rebuild }) {
|
||||
let shouldPoll = args["--poll"];
|
||||
let shouldCoalesceWriteEvents = shouldPoll || process.platform === "win32";
|
||||
// Polling interval in milliseconds
|
||||
// Used only when polling or coalescing add/change events on Windows
|
||||
let pollInterval = 10;
|
||||
let watcher = _chokidar.default.watch([], {
|
||||
// Force checking for atomic writes in all situations
|
||||
// This causes chokidar to wait up to 100ms for a file to re-added after it's been unlinked
|
||||
// This only works when watching directories though
|
||||
atomic: true,
|
||||
usePolling: shouldPoll,
|
||||
interval: shouldPoll ? pollInterval : undefined,
|
||||
ignoreInitial: true,
|
||||
awaitWriteFinish: shouldCoalesceWriteEvents ? {
|
||||
stabilityThreshold: 50,
|
||||
pollInterval: pollInterval
|
||||
} : false
|
||||
});
|
||||
// A queue of rebuilds, file reads, etc… to run
|
||||
let chain = Promise.resolve();
|
||||
/**
|
||||
* A list of files that have been changed since the last rebuild
|
||||
*
|
||||
* @type {{file: string, content: () => Promise<string>, extension: string}[]}
|
||||
*/ let changedContent = [];
|
||||
/**
|
||||
* A list of files for which a rebuild has already been queued.
|
||||
* This is used to prevent duplicate rebuilds when multiple events are fired for the same file.
|
||||
* The rebuilt file is cleared from this list when it's associated rebuild has _started_
|
||||
* This is because if the file is changed during a rebuild it won't trigger a new rebuild which it should
|
||||
**/ let pendingRebuilds = new Set();
|
||||
let _timer;
|
||||
let _reject;
|
||||
/**
|
||||
* Rebuilds the changed files and resolves when the rebuild is
|
||||
* complete regardless of whether it was successful or not
|
||||
*/ async function rebuildAndContinue() {
|
||||
let changes = changedContent.splice(0);
|
||||
// There are no changes to rebuild so we can just do nothing
|
||||
if (changes.length === 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
// Clear all pending rebuilds for the about-to-be-built files
|
||||
changes.forEach((change)=>pendingRebuilds.delete(change.file));
|
||||
// Resolve the promise even when the rebuild fails
|
||||
return rebuild(changes).then(()=>{}, ()=>{});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {*} file
|
||||
* @param {(() => Promise<string>) | null} content
|
||||
* @param {boolean} skipPendingCheck
|
||||
* @returns {Promise<void>}
|
||||
*/ function recordChangedFile(file, content = null, skipPendingCheck = false) {
|
||||
file = _path.default.resolve(file);
|
||||
// Applications like Vim/Neovim fire both rename and change events in succession for atomic writes
|
||||
// In that case rebuild has already been queued by rename, so can be skipped in change
|
||||
if (pendingRebuilds.has(file) && !skipPendingCheck) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
// Mark that a rebuild of this file is going to happen
|
||||
// It MUST happen synchronously before the rebuild is queued for this to be effective
|
||||
pendingRebuilds.add(file);
|
||||
changedContent.push({
|
||||
file,
|
||||
content: content !== null && content !== void 0 ? content : ()=>_fs.default.promises.readFile(file, "utf8"),
|
||||
extension: _path.default.extname(file).slice(1)
|
||||
});
|
||||
if (_timer) {
|
||||
clearTimeout(_timer);
|
||||
_reject();
|
||||
}
|
||||
// If a rebuild is already in progress we don't want to start another one until the 10ms timer has expired
|
||||
chain = chain.then(()=>new Promise((resolve, reject)=>{
|
||||
_timer = setTimeout(resolve, 10);
|
||||
_reject = reject;
|
||||
}));
|
||||
// Resolves once this file has been rebuilt (or the rebuild for this file has failed)
|
||||
// This queues as many rebuilds as there are changed files
|
||||
// But those rebuilds happen after some delay
|
||||
// And will immediately resolve if there are no changes
|
||||
chain = chain.then(rebuildAndContinue, rebuildAndContinue);
|
||||
return chain;
|
||||
}
|
||||
watcher.on("change", (file)=>recordChangedFile(file));
|
||||
watcher.on("add", (file)=>recordChangedFile(file));
|
||||
// Restore watching any files that are "removed"
|
||||
// This can happen when a file is pseudo-atomically replaced (a copy is created, overwritten, the old one is unlinked, and the new one is renamed)
|
||||
// TODO: An an optimization we should allow removal when the config changes
|
||||
watcher.on("unlink", (file)=>{
|
||||
file = (0, _normalizePath.default)(file);
|
||||
// Only re-add the file if it's not covered by a dynamic pattern
|
||||
if (!_micromatch.default.some([
|
||||
file
|
||||
], state.contentPatterns.dynamic)) {
|
||||
watcher.add(file);
|
||||
}
|
||||
});
|
||||
// Some applications such as Visual Studio (but not VS Code)
|
||||
// will only fire a rename event for atomic writes and not a change event
|
||||
// This is very likely a chokidar bug but it's one we need to work around
|
||||
// We treat this as a change event and rebuild the CSS
|
||||
watcher.on("raw", (evt, filePath, meta)=>{
|
||||
if (evt !== "rename") {
|
||||
return;
|
||||
}
|
||||
let watchedPath = meta.watchedPath;
|
||||
// Watched path might be the file itself
|
||||
// Or the directory it is in
|
||||
filePath = watchedPath.endsWith(filePath) ? watchedPath : _path.default.join(watchedPath, filePath);
|
||||
// Skip this event since the files it is for does not match any of the registered content globs
|
||||
if (!_micromatch.default.some([
|
||||
filePath
|
||||
], state.contentPatterns.all)) {
|
||||
return;
|
||||
}
|
||||
// Skip since we've already queued a rebuild for this file that hasn't happened yet
|
||||
if (pendingRebuilds.has(filePath)) {
|
||||
return;
|
||||
}
|
||||
// We'll go ahead and add the file to the pending rebuilds list here
|
||||
// It'll be removed when the rebuild starts unless the read fails
|
||||
// which will be taken care of as well
|
||||
pendingRebuilds.add(filePath);
|
||||
async function enqueue() {
|
||||
try {
|
||||
// We need to read the file as early as possible outside of the chain
|
||||
// because it may be gone by the time we get to it. doing the read
|
||||
// immediately increases the chance that the file is still there
|
||||
let content = await (0, _utilsJs.readFileWithRetries)(_path.default.resolve(filePath));
|
||||
if (content === undefined) {
|
||||
return;
|
||||
}
|
||||
// This will push the rebuild onto the chain
|
||||
// We MUST skip the rebuild check here otherwise the rebuild will never happen on Linux
|
||||
// This is because the order of events and timing is different on Linux
|
||||
// @ts-ignore: TypeScript isn't picking up that content is a string here
|
||||
await recordChangedFile(filePath, ()=>content, true);
|
||||
} catch {
|
||||
// If reading the file fails, it's was probably a deleted temporary file
|
||||
// So we can ignore it and no rebuild is needed
|
||||
}
|
||||
}
|
||||
enqueue().then(()=>{
|
||||
// If the file read fails we still need to make sure the file isn't stuck in the pending rebuilds list
|
||||
pendingRebuilds.delete(filePath);
|
||||
});
|
||||
});
|
||||
return {
|
||||
fswatcher: watcher,
|
||||
refreshWatchedFiles () {
|
||||
watcher.add(Array.from(state.contextDependencies));
|
||||
watcher.add(Array.from(state.configDependencies));
|
||||
watcher.add(state.contentPatterns.all);
|
||||
}
|
||||
};
|
||||
}
|
||||
71
node_modules/tailwindcss/lib/cli/help/index.js
generated
vendored
Normal file
71
node_modules/tailwindcss/lib/cli/help/index.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "help", {
|
||||
enumerable: true,
|
||||
get: ()=>help
|
||||
});
|
||||
const _packageJson = /*#__PURE__*/ _interopRequireDefault(require("../../../package.json"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function help({ message , usage , commands , options }) {
|
||||
let indent = 2;
|
||||
// Render header
|
||||
console.log();
|
||||
console.log(`${_packageJson.default.name} v${_packageJson.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 , deprecated } of Object.values(groupedOptions)){
|
||||
if (deprecated) continue;
|
||||
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();
|
||||
}
|
||||
18
node_modules/tailwindcss/lib/cli/index.js
generated
vendored
Normal file
18
node_modules/tailwindcss/lib/cli/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
_exportStar(require("./build"), exports);
|
||||
_exportStar(require("./config"), exports);
|
||||
_exportStar(require("./content"), exports);
|
||||
function _exportStar(from, to) {
|
||||
Object.keys(from).forEach(function(k) {
|
||||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return from[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
return from;
|
||||
}
|
||||
46
node_modules/tailwindcss/lib/cli/init/index.js
generated
vendored
Normal file
46
node_modules/tailwindcss/lib/cli/init/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "init", {
|
||||
enumerable: true,
|
||||
get: ()=>init
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function init(args, configs) {
|
||||
let messages = [];
|
||||
var ref;
|
||||
let tailwindConfigLocation = _path.default.resolve((ref = args["_"][1]) !== null && ref !== void 0 ? ref : `./${configs.tailwind}`);
|
||||
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");
|
||||
_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(`./${configs.postcss}`);
|
||||
if (_fs.default.existsSync(postcssConfigLocation)) {
|
||||
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
||||
} else {
|
||||
let stubFile1 = _fs.default.readFileSync(_path.default.resolve(__dirname, "../../../stubs/defaultPostCssConfig.stub.js"), "utf8");
|
||||
_fs.default.writeFileSync(postcssConfigLocation, stubFile1, "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);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
node_modules/tailwindcss/lib/cli/shared.js
generated
vendored
Normal file
12
node_modules/tailwindcss/lib/cli/shared.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "env", {
|
||||
enumerable: true,
|
||||
get: ()=>env
|
||||
});
|
||||
const env = {
|
||||
DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== "0"
|
||||
};
|
||||
44
node_modules/tailwindcss/lib/constants.js
generated
vendored
Normal file
44
node_modules/tailwindcss/lib/constants.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
cli: ()=>cli,
|
||||
defaultConfigFile: ()=>defaultConfigFile,
|
||||
defaultPostCssConfigFile: ()=>defaultPostCssConfigFile,
|
||||
cjsConfigFile: ()=>cjsConfigFile,
|
||||
cjsPostCssConfigFile: ()=>cjsPostCssConfigFile,
|
||||
supportedConfigFiles: ()=>supportedConfigFiles,
|
||||
supportedPostCssConfigFile: ()=>supportedPostCssConfigFile,
|
||||
defaultConfigStubFile: ()=>defaultConfigStubFile,
|
||||
simpleConfigStubFile: ()=>simpleConfigStubFile,
|
||||
defaultPostCssConfigStubFile: ()=>defaultPostCssConfigStubFile
|
||||
});
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const cli = "tailwind";
|
||||
const defaultConfigFile = "./tailwind.config.js";
|
||||
const defaultPostCssConfigFile = "./postcss.config.js";
|
||||
const cjsConfigFile = "./tailwind.config.cjs";
|
||||
const cjsPostCssConfigFile = "./postcss.config.cjs";
|
||||
const supportedConfigFiles = [
|
||||
cjsConfigFile,
|
||||
defaultConfigFile
|
||||
];
|
||||
const supportedPostCssConfigFile = [
|
||||
cjsPostCssConfigFile,
|
||||
defaultPostCssConfigFile
|
||||
];
|
||||
const defaultConfigStubFile = _path.default.resolve(__dirname, "../stubs/defaultConfig.stub.js");
|
||||
const simpleConfigStubFile = _path.default.resolve(__dirname, "../stubs/simpleConfig.stub.js");
|
||||
const defaultPostCssConfigStubFile = _path.default.resolve(__dirname, "../stubs/defaultPostCssConfig.stub.js");
|
||||
181
node_modules/tailwindcss/lib/corePluginList.js
generated
vendored
Normal file
181
node_modules/tailwindcss/lib/corePluginList.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _default = [
|
||||
"preflight",
|
||||
"container",
|
||||
"accessibility",
|
||||
"pointerEvents",
|
||||
"visibility",
|
||||
"position",
|
||||
"inset",
|
||||
"isolation",
|
||||
"zIndex",
|
||||
"order",
|
||||
"gridColumn",
|
||||
"gridColumnStart",
|
||||
"gridColumnEnd",
|
||||
"gridRow",
|
||||
"gridRowStart",
|
||||
"gridRowEnd",
|
||||
"float",
|
||||
"clear",
|
||||
"margin",
|
||||
"boxSizing",
|
||||
"display",
|
||||
"aspectRatio",
|
||||
"height",
|
||||
"maxHeight",
|
||||
"minHeight",
|
||||
"width",
|
||||
"minWidth",
|
||||
"maxWidth",
|
||||
"flex",
|
||||
"flexShrink",
|
||||
"flexGrow",
|
||||
"flexBasis",
|
||||
"tableLayout",
|
||||
"borderCollapse",
|
||||
"borderSpacing",
|
||||
"transformOrigin",
|
||||
"translate",
|
||||
"rotate",
|
||||
"skew",
|
||||
"scale",
|
||||
"transform",
|
||||
"animation",
|
||||
"cursor",
|
||||
"touchAction",
|
||||
"userSelect",
|
||||
"resize",
|
||||
"scrollSnapType",
|
||||
"scrollSnapAlign",
|
||||
"scrollSnapStop",
|
||||
"scrollMargin",
|
||||
"scrollPadding",
|
||||
"listStylePosition",
|
||||
"listStyleType",
|
||||
"appearance",
|
||||
"columns",
|
||||
"breakBefore",
|
||||
"breakInside",
|
||||
"breakAfter",
|
||||
"gridAutoColumns",
|
||||
"gridAutoFlow",
|
||||
"gridAutoRows",
|
||||
"gridTemplateColumns",
|
||||
"gridTemplateRows",
|
||||
"flexDirection",
|
||||
"flexWrap",
|
||||
"placeContent",
|
||||
"placeItems",
|
||||
"alignContent",
|
||||
"alignItems",
|
||||
"justifyContent",
|
||||
"justifyItems",
|
||||
"gap",
|
||||
"space",
|
||||
"divideWidth",
|
||||
"divideStyle",
|
||||
"divideColor",
|
||||
"divideOpacity",
|
||||
"placeSelf",
|
||||
"alignSelf",
|
||||
"justifySelf",
|
||||
"overflow",
|
||||
"overscrollBehavior",
|
||||
"scrollBehavior",
|
||||
"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",
|
||||
"textIndent",
|
||||
"verticalAlign",
|
||||
"fontFamily",
|
||||
"fontSize",
|
||||
"fontWeight",
|
||||
"textTransform",
|
||||
"fontStyle",
|
||||
"fontVariantNumeric",
|
||||
"lineHeight",
|
||||
"letterSpacing",
|
||||
"textColor",
|
||||
"textOpacity",
|
||||
"textDecoration",
|
||||
"textDecorationColor",
|
||||
"textDecorationStyle",
|
||||
"textDecorationThickness",
|
||||
"textUnderlineOffset",
|
||||
"fontSmoothing",
|
||||
"placeholderColor",
|
||||
"placeholderOpacity",
|
||||
"caretColor",
|
||||
"accentColor",
|
||||
"opacity",
|
||||
"backgroundBlendMode",
|
||||
"mixBlendMode",
|
||||
"boxShadow",
|
||||
"boxShadowColor",
|
||||
"outlineStyle",
|
||||
"outlineWidth",
|
||||
"outlineOffset",
|
||||
"outlineColor",
|
||||
"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",
|
||||
"willChange",
|
||||
"content"
|
||||
];
|
||||
3893
node_modules/tailwindcss/lib/corePlugins.js
generated
vendored
Normal file
3893
node_modules/tailwindcss/lib/corePlugins.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
25
node_modules/tailwindcss/lib/css/LICENSE
generated
vendored
Normal file
25
node_modules/tailwindcss/lib/css/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Nicolas Gallagher
|
||||
Copyright (c) Jonathan Neal
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
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.
|
||||
367
node_modules/tailwindcss/lib/css/preflight.css
generated
vendored
Normal file
367
node_modules/tailwindcss/lib/css/preflight.css
generated
vendored
Normal file
@@ -0,0 +1,367 @@
|
||||
/*
|
||||
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
||||
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
||||
*/
|
||||
|
||||
*,
|
||||
::before,
|
||||
::after {
|
||||
box-sizing: border-box; /* 1 */
|
||||
border-width: 0; /* 2 */
|
||||
border-style: solid; /* 2 */
|
||||
border-color: theme('borderColor.DEFAULT', currentColor); /* 2 */
|
||||
}
|
||||
|
||||
::before,
|
||||
::after {
|
||||
--tw-content: '';
|
||||
}
|
||||
|
||||
/*
|
||||
1. Use a consistent sensible line-height in all browsers.
|
||||
2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
3. Use a more readable tab size.
|
||||
4. Use the user's configured `sans` font-family by default.
|
||||
5. Use the user's configured `sans` font-feature-settings by default.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1.5; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
-moz-tab-size: 4; /* 3 */
|
||||
tab-size: 4; /* 3 */
|
||||
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"); /* 4 */
|
||||
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
|
||||
}
|
||||
|
||||
/*
|
||||
1. Remove the margin in all browsers.
|
||||
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0; /* 1 */
|
||||
line-height: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
1. Add the correct height in Firefox.
|
||||
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
||||
3. Ensure horizontal rules are visible by default.
|
||||
*/
|
||||
|
||||
hr {
|
||||
height: 0; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
border-top-width: 1px; /* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct text decoration in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
abbr:where([title]) {
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the default font size and weight for headings.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct font weight in Edge and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Use the user's configured `mono` font family by default.
|
||||
2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp,
|
||||
pre {
|
||||
font-family: theme('fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/*
|
||||
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
||||
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
||||
3. Remove gaps between table borders by default.
|
||||
*/
|
||||
|
||||
table {
|
||||
text-indent: 0; /* 1 */
|
||||
border-color: inherit; /* 2 */
|
||||
border-collapse: collapse; /* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
1. Change the font styles in all browsers.
|
||||
2. Remove the margin in Firefox and Safari.
|
||||
3. Remove default padding in all browsers.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
font-weight: inherit; /* 1 */
|
||||
line-height: inherit; /* 1 */
|
||||
color: inherit; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
padding: 0; /* 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the inheritance of text transform in Edge and Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Correct the inability to style clickable types in iOS and Safari.
|
||||
2. Remove default button styles.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type='button'],
|
||||
[type='reset'],
|
||||
[type='submit'] {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
background-color: transparent; /* 2 */
|
||||
background-image: none; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Use the modern Firefox focus style for all focusable elements.
|
||||
*/
|
||||
|
||||
:-moz-focusring {
|
||||
outline: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
|
||||
*/
|
||||
|
||||
:-moz-ui-invalid {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct vertical alignment in Chrome and Firefox.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/*
|
||||
Correct the cursor style of increment and decrement buttons in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-inner-spin-button,
|
||||
::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Correct the odd appearance in Chrome and Safari.
|
||||
2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type='search'] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Correct the inability to style clickable types in iOS and Safari.
|
||||
2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Add the correct display in Chrome and Safari.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
/*
|
||||
Removes the default spacing and border for appropriate elements.
|
||||
*/
|
||||
|
||||
blockquote,
|
||||
dl,
|
||||
dd,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
hr,
|
||||
figure,
|
||||
p,
|
||||
pre {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
menu {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Prevent resizing textareas horizontally by default.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
|
||||
2. Set the default placeholder color to the user's configured gray 400 color.
|
||||
*/
|
||||
|
||||
input::placeholder,
|
||||
textarea::placeholder {
|
||||
opacity: 1; /* 1 */
|
||||
color: theme('colors.gray.400', #9ca3af); /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Set the default cursor for buttons.
|
||||
*/
|
||||
|
||||
button,
|
||||
[role="button"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
Make sure disabled buttons don't get the pointer cursor.
|
||||
*/
|
||||
:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/*
|
||||
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
|
||||
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
|
||||
This can trigger a poorly considered lint error in some tools but is included by design.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* Make elements with the HTML hidden attribute stay hidden by default */
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
71
node_modules/tailwindcss/lib/featureFlags.js
generated
vendored
Normal file
71
node_modules/tailwindcss/lib/featureFlags.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
flagEnabled: ()=>flagEnabled,
|
||||
issueFlagNotices: ()=>issueFlagNotices,
|
||||
default: ()=>_default
|
||||
});
|
||||
const _picocolors = /*#__PURE__*/ _interopRequireDefault(require("picocolors"));
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("./util/log"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
let defaults = {
|
||||
optimizeUniversalDefaults: false,
|
||||
generalizedModifiers: true
|
||||
};
|
||||
let featureFlags = {
|
||||
future: [
|
||||
"hoverOnlyWhenSupported",
|
||||
"respectDefaultRingColorOpacity",
|
||||
"disableColorOpacityUtilitiesByDefault",
|
||||
"relativeContentPathsByDefault"
|
||||
],
|
||||
experimental: [
|
||||
"optimizeUniversalDefaults",
|
||||
"generalizedModifiers"
|
||||
]
|
||||
};
|
||||
function flagEnabled(config, flag) {
|
||||
if (featureFlags.future.includes(flag)) {
|
||||
var ref;
|
||||
var ref1, ref2;
|
||||
return config.future === "all" || ((ref2 = (ref1 = config === null || config === void 0 ? void 0 : (ref = config.future) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref1 !== void 0 ? ref1 : defaults[flag]) !== null && ref2 !== void 0 ? ref2 : false);
|
||||
}
|
||||
if (featureFlags.experimental.includes(flag)) {
|
||||
var ref3;
|
||||
var ref4, ref5;
|
||||
return config.experimental === "all" || ((ref5 = (ref4 = config === null || config === void 0 ? void 0 : (ref3 = config.experimental) === null || ref3 === void 0 ? void 0 : ref3[flag]) !== null && ref4 !== void 0 ? ref4 : defaults[flag]) !== null && ref5 !== void 0 ? ref5 : false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function experimentalFlagsEnabled(config) {
|
||||
if (config.experimental === "all") {
|
||||
return featureFlags.experimental;
|
||||
}
|
||||
var ref;
|
||||
return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {}).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) {
|
||||
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
|
||||
_log.default.warn("experimental-flags-enabled", [
|
||||
`You have enabled experimental features: ${changes}`,
|
||||
"Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time."
|
||||
]);
|
||||
}
|
||||
}
|
||||
const _default = featureFlags;
|
||||
48
node_modules/tailwindcss/lib/index.js
generated
vendored
Normal file
48
node_modules/tailwindcss/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const _setupTrackingContext = /*#__PURE__*/ _interopRequireDefault(require("./lib/setupTrackingContext"));
|
||||
const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("./processTailwindFeatures"));
|
||||
const _sharedState = require("./lib/sharedState");
|
||||
const _findAtConfigPath = require("./lib/findAtConfigPath");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
module.exports = function tailwindcss(configOrPath) {
|
||||
return {
|
||||
postcssPlugin: "tailwindcss",
|
||||
plugins: [
|
||||
_sharedState.env.DEBUG && function(root) {
|
||||
console.log("\n");
|
||||
console.time("JIT TOTAL");
|
||||
return root;
|
||||
},
|
||||
function(root, result) {
|
||||
var ref;
|
||||
// Use the path for the `@config` directive if it exists, otherwise use the
|
||||
// path for the file being processed
|
||||
configOrPath = (ref = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : configOrPath;
|
||||
let context = (0, _setupTrackingContext.default)(configOrPath);
|
||||
if (root.type === "document") {
|
||||
let roots = root.nodes.filter((node)=>node.type === "root");
|
||||
for (const root1 of roots){
|
||||
if (root1.type === "root") {
|
||||
(0, _processTailwindFeatures.default)(context)(root1, result);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
(0, _processTailwindFeatures.default)(context)(root, result);
|
||||
},
|
||||
_sharedState.env.DEBUG && function(root) {
|
||||
console.timeEnd("JIT TOTAL");
|
||||
console.log("\n");
|
||||
return root;
|
||||
}
|
||||
].filter(Boolean)
|
||||
};
|
||||
};
|
||||
module.exports.postcss = true;
|
||||
90
node_modules/tailwindcss/lib/lib/cacheInvalidation.js
generated
vendored
Normal file
90
node_modules/tailwindcss/lib/lib/cacheInvalidation.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "hasContentChanged", {
|
||||
enumerable: true,
|
||||
get: ()=>hasContentChanged
|
||||
});
|
||||
const _crypto = /*#__PURE__*/ _interopRequireDefault(require("crypto"));
|
||||
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
|
||||
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;
|
||||
}
|
||||
/**
|
||||
* Calculate the hash of a string.
|
||||
*
|
||||
* This doesn't need to be cryptographically secure or
|
||||
* anything like that since it's used only to detect
|
||||
* when the CSS changes to invalidate the context.
|
||||
*
|
||||
* This is wrapped in a try/catch because it's really dependent
|
||||
* on how Node itself is build and the environment and OpenSSL
|
||||
* version / build that is installed on the user's machine.
|
||||
*
|
||||
* Based on the environment this can just outright fail.
|
||||
*
|
||||
* See https://github.com/nodejs/node/issues/40455
|
||||
*
|
||||
* @param {string} str
|
||||
*/ function getHash(str) {
|
||||
try {
|
||||
return _crypto.default.createHash("md5").update(str, "utf-8").digest("binary");
|
||||
} catch (err) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function hasContentChanged(sourcePath, root) {
|
||||
let css = root.toString();
|
||||
// We only care about files with @tailwind directives
|
||||
// Other files use an existing context
|
||||
if (!css.includes("@tailwind")) {
|
||||
return false;
|
||||
}
|
||||
let existingHash = _sharedState.sourceHashMap.get(sourcePath);
|
||||
let rootHash = getHash(css);
|
||||
let didChange = existingHash !== rootHash;
|
||||
_sharedState.sourceHashMap.set(sourcePath, rootHash);
|
||||
return didChange;
|
||||
}
|
||||
59
node_modules/tailwindcss/lib/lib/collapseAdjacentRules.js
generated
vendored
Normal file
59
node_modules/tailwindcss/lib/lib/collapseAdjacentRules.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>collapseAdjacentRules
|
||||
});
|
||||
let comparisonMap = {
|
||||
atrule: [
|
||||
"name",
|
||||
"params"
|
||||
],
|
||||
rule: [
|
||||
"selector"
|
||||
]
|
||||
};
|
||||
let types = new Set(Object.keys(comparisonMap));
|
||||
function collapseAdjacentRules() {
|
||||
function collapseRulesIn(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];
|
||||
var _property, _property1;
|
||||
if (node.type === "atrule" && node.name === "font-face") {
|
||||
currentRule = node;
|
||||
} else if (properties.every((property)=>((_property = node[property]) !== null && _property !== void 0 ? _property : "").replace(/\s+/g, " ") === ((_property1 = currentRule[property]) !== null && _property1 !== void 0 ? _property1 : "").replace(/\s+/g, " "))) {
|
||||
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
||||
if (node.nodes) {
|
||||
currentRule.append(node.nodes);
|
||||
}
|
||||
node.remove();
|
||||
} else {
|
||||
currentRule = node;
|
||||
}
|
||||
});
|
||||
// After we've collapsed adjacent rules & at-rules, we need to collapse
|
||||
// adjacent rules & at-rules that are children of at-rules.
|
||||
// We do not care about nesting rules because Tailwind CSS
|
||||
// explicitly does not handle rule nesting on its own as
|
||||
// the user is expected to use a nesting plugin
|
||||
root.each((node)=>{
|
||||
if (node.type === "atrule") {
|
||||
collapseRulesIn(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
return (root)=>{
|
||||
collapseRulesIn(root);
|
||||
};
|
||||
}
|
||||
83
node_modules/tailwindcss/lib/lib/collapseDuplicateDeclarations.js
generated
vendored
Normal file
83
node_modules/tailwindcss/lib/lib/collapseDuplicateDeclarations.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>collapseDuplicateDeclarations
|
||||
});
|
||||
function collapseDuplicateDeclarations() {
|
||||
return (root)=>{
|
||||
root.walkRules((node)=>{
|
||||
let seen = new Map();
|
||||
let droppable = new Set([]);
|
||||
let byProperty = new Map();
|
||||
node.walkDecls((decl)=>{
|
||||
// This could happen if we have nested selectors. In that case the
|
||||
// parent will loop over all its declarations but also the declarations
|
||||
// of nested rules. With this we ensure that we are shallowly checking
|
||||
// declarations.
|
||||
if (decl.parent !== node) {
|
||||
return;
|
||||
}
|
||||
if (seen.has(decl.prop)) {
|
||||
// Exact same value as what we have seen so far
|
||||
if (seen.get(decl.prop).value === decl.value) {
|
||||
// Keep the last one, drop the one we've seen so far
|
||||
droppable.add(seen.get(decl.prop));
|
||||
// Override the existing one with the new value. This is necessary
|
||||
// so that if we happen to have more than one declaration with the
|
||||
// same value, that we keep removing the previous one. Otherwise we
|
||||
// will only remove the *first* one.
|
||||
seen.set(decl.prop, decl);
|
||||
return;
|
||||
}
|
||||
// Not the same value, so we need to check if we can merge it so
|
||||
// let's collect it first.
|
||||
if (!byProperty.has(decl.prop)) {
|
||||
byProperty.set(decl.prop, new Set());
|
||||
}
|
||||
byProperty.get(decl.prop).add(seen.get(decl.prop));
|
||||
byProperty.get(decl.prop).add(decl);
|
||||
}
|
||||
seen.set(decl.prop, decl);
|
||||
});
|
||||
// Drop all the duplicate declarations with the exact same value we've
|
||||
// already seen so far.
|
||||
for (let decl of droppable){
|
||||
decl.remove();
|
||||
}
|
||||
// Analyze the declarations based on its unit, drop all the declarations
|
||||
// with the same unit but the last one in the list.
|
||||
for (let declarations of byProperty.values()){
|
||||
let byUnit = new Map();
|
||||
for (let decl1 of declarations){
|
||||
let unit = resolveUnit(decl1.value);
|
||||
if (unit === null) {
|
||||
continue;
|
||||
}
|
||||
if (!byUnit.has(unit)) {
|
||||
byUnit.set(unit, new Set());
|
||||
}
|
||||
byUnit.get(unit).add(decl1);
|
||||
}
|
||||
for (let declarations1 of byUnit.values()){
|
||||
// Get all but the last one
|
||||
let removableDeclarations = Array.from(declarations1).slice(0, -1);
|
||||
for (let decl2 of removableDeclarations){
|
||||
decl2.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
let UNITLESS_NUMBER = Symbol("unitless-number");
|
||||
function resolveUnit(input) {
|
||||
let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
|
||||
if (result) {
|
||||
var ref;
|
||||
return (ref = result[1]) !== null && ref !== void 0 ? ref : UNITLESS_NUMBER;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
177
node_modules/tailwindcss/lib/lib/content.js
generated
vendored
Normal file
177
node_modules/tailwindcss/lib/lib/content.js
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
parseCandidateFiles: ()=>parseCandidateFiles,
|
||||
resolvedChangedContent: ()=>resolvedChangedContent
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
const _isGlob = /*#__PURE__*/ _interopRequireDefault(require("is-glob"));
|
||||
const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob"));
|
||||
const _normalizePath = /*#__PURE__*/ _interopRequireDefault(require("normalize-path"));
|
||||
const _parseGlob = require("../util/parseGlob");
|
||||
const _sharedState = require("./sharedState");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function parseCandidateFiles(context, tailwindConfig) {
|
||||
let files = tailwindConfig.content.files;
|
||||
// Normalize the file globs
|
||||
files = files.filter((filePath)=>typeof filePath === "string");
|
||||
files = files.map(_normalizePath.default);
|
||||
// Split into included and excluded globs
|
||||
let tasks = _fastGlob.default.generateTasks(files);
|
||||
/** @type {ContentPath[]} */ let included = [];
|
||||
/** @type {ContentPath[]} */ let excluded = [];
|
||||
for (const task of tasks){
|
||||
included.push(...task.positive.map((filePath)=>parseFilePath(filePath, false)));
|
||||
excluded.push(...task.negative.map((filePath)=>parseFilePath(filePath, true)));
|
||||
}
|
||||
let paths = [
|
||||
...included,
|
||||
...excluded
|
||||
];
|
||||
// Resolve paths relative to the config file or cwd
|
||||
paths = resolveRelativePaths(context, paths);
|
||||
// Resolve symlinks if possible
|
||||
paths = paths.flatMap(resolvePathSymlinks);
|
||||
// Update cached patterns
|
||||
paths = paths.map(resolveGlobPattern);
|
||||
return paths;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {string} filePath
|
||||
* @param {boolean} ignore
|
||||
* @returns {ContentPath}
|
||||
*/ function parseFilePath(filePath, ignore) {
|
||||
let contentPath = {
|
||||
original: filePath,
|
||||
base: filePath,
|
||||
ignore,
|
||||
pattern: filePath,
|
||||
glob: null
|
||||
};
|
||||
if ((0, _isGlob.default)(filePath)) {
|
||||
Object.assign(contentPath, (0, _parseGlob.parseGlob)(filePath));
|
||||
}
|
||||
return contentPath;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {ContentPath} contentPath
|
||||
* @returns {ContentPath}
|
||||
*/ function resolveGlobPattern(contentPath) {
|
||||
// This is required for Windows support to properly pick up Glob paths.
|
||||
// Afaik, this technically shouldn't be needed but there's probably
|
||||
// some internal, direct path matching with a normalized path in
|
||||
// a package which can't handle mixed directory separators
|
||||
let base = (0, _normalizePath.default)(contentPath.base);
|
||||
// If the user's file path contains any special characters (like parens) for instance fast-glob
|
||||
// is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
|
||||
base = _fastGlob.default.escapePath(base);
|
||||
contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
|
||||
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
|
||||
return contentPath;
|
||||
}
|
||||
/**
|
||||
* Resolve each path relative to the config file (when possible) if the experimental flag is enabled
|
||||
* Otherwise, resolve relative to the current working directory
|
||||
*
|
||||
* @param {any} context
|
||||
* @param {ContentPath[]} contentPaths
|
||||
* @returns {ContentPath[]}
|
||||
*/ function resolveRelativePaths(context, contentPaths) {
|
||||
let resolveFrom = [];
|
||||
// Resolve base paths relative to the config file (when possible) if the experimental flag is enabled
|
||||
if (context.userConfigPath && context.tailwindConfig.content.relative) {
|
||||
resolveFrom = [
|
||||
_path.default.dirname(context.userConfigPath)
|
||||
];
|
||||
}
|
||||
return contentPaths.map((contentPath)=>{
|
||||
contentPath.base = _path.default.resolve(...resolveFrom, contentPath.base);
|
||||
return contentPath;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Resolve the symlink for the base directory / file in each path
|
||||
* These are added as additional dependencies to watch for changes because
|
||||
* some tools (like webpack) will only watch the actual file or directory
|
||||
* but not the symlink itself even in projects that use monorepos.
|
||||
*
|
||||
* @param {ContentPath} contentPath
|
||||
* @returns {ContentPath[]}
|
||||
*/ function resolvePathSymlinks(contentPath) {
|
||||
let paths = [
|
||||
contentPath
|
||||
];
|
||||
try {
|
||||
let resolvedPath = _fs.default.realpathSync(contentPath.base);
|
||||
if (resolvedPath !== contentPath.base) {
|
||||
paths.push({
|
||||
...contentPath,
|
||||
base: resolvedPath
|
||||
});
|
||||
}
|
||||
} catch {
|
||||
// TODO: log this?
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
||||
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string").map(({ raw , extension ="html" })=>({
|
||||
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;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {ContentPath[]} candidateFiles
|
||||
* @param {Map<string, number>} fileModifiedMap
|
||||
* @returns {Set<string>}
|
||||
*/ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
||||
let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
|
||||
let changedFiles = new Set();
|
||||
_sharedState.env.DEBUG && console.time("Finding changed files");
|
||||
let files = _fastGlob.default.sync(paths, {
|
||||
absolute: true
|
||||
});
|
||||
for (let file of files){
|
||||
let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
|
||||
let modified = _fs.default.statSync(file).mtimeMs;
|
||||
// This check is intentionally >= because we track the last modified time of context dependencies
|
||||
// earier in the process and we want to make sure we don't miss any changes that happen
|
||||
// when a context dependency is also a content dependency
|
||||
// Ideally, we'd do all this tracking at one time but that is a larger refactor
|
||||
// than we want to commit to right now, so this is a decent compromise.
|
||||
// This should be sufficient because file modification times will be off by at least
|
||||
// 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
|
||||
if (modified >= prevModified) {
|
||||
changedFiles.add(file);
|
||||
fileModifiedMap.set(file, modified);
|
||||
}
|
||||
}
|
||||
_sharedState.env.DEBUG && console.timeEnd("Finding changed files");
|
||||
return changedFiles;
|
||||
}
|
||||
236
node_modules/tailwindcss/lib/lib/defaultExtractor.js
generated
vendored
Normal file
236
node_modules/tailwindcss/lib/lib/defaultExtractor.js
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "defaultExtractor", {
|
||||
enumerable: true,
|
||||
get: ()=>defaultExtractor
|
||||
});
|
||||
const _featureFlags = require("../featureFlags");
|
||||
const _regex = /*#__PURE__*/ _interopRequireWildcard(require("./regex"));
|
||||
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 defaultExtractor(context) {
|
||||
let patterns = Array.from(buildRegExps(context));
|
||||
/**
|
||||
* @param {string} content
|
||||
*/ return (content)=>{
|
||||
/** @type {(string|string)[]} */ let results = [];
|
||||
for (let pattern of patterns){
|
||||
var ref;
|
||||
results = [
|
||||
...results,
|
||||
...(ref = content.match(pattern)) !== null && ref !== void 0 ? ref : []
|
||||
];
|
||||
}
|
||||
return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
|
||||
};
|
||||
}
|
||||
function* buildRegExps(context) {
|
||||
let separator = context.tailwindConfig.separator;
|
||||
let variantGroupingEnabled = (0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping");
|
||||
let prefix = context.tailwindConfig.prefix !== "" ? _regex.optional(_regex.pattern([
|
||||
/-?/,
|
||||
_regex.escape(context.tailwindConfig.prefix)
|
||||
])) : "";
|
||||
let utility = _regex.any([
|
||||
// Arbitrary properties
|
||||
/\[[^\s:'"`]+:[^\s]+\]/,
|
||||
// Utilities
|
||||
_regex.pattern([
|
||||
// Utility Name / Group Name
|
||||
/-?(?:\w+)/,
|
||||
// Normal/Arbitrary values
|
||||
_regex.optional(_regex.any([
|
||||
_regex.pattern([
|
||||
// Arbitrary values
|
||||
/-(?:\w+-)*\[[^\s:]+\]/,
|
||||
// Not immediately followed by an `{[(`
|
||||
/(?![{([]])/,
|
||||
// optionally followed by an opacity modifier
|
||||
/(?:\/[^\s'"`\\><$]*)?/
|
||||
]),
|
||||
_regex.pattern([
|
||||
// Arbitrary values
|
||||
/-(?:\w+-)*\[[^\s]+\]/,
|
||||
// Not immediately followed by an `{[(`
|
||||
/(?![{([]])/,
|
||||
// optionally followed by an opacity modifier
|
||||
/(?:\/[^\s'"`\\$]*)?/
|
||||
]),
|
||||
// Normal values w/o quotes — may include an opacity modifier
|
||||
/[-\/][^\s'"`\\$={><]*/
|
||||
]))
|
||||
])
|
||||
]);
|
||||
let variantPatterns = [
|
||||
// Without quotes
|
||||
_regex.any([
|
||||
// This is here to provide special support for the `@` variant
|
||||
_regex.pattern([
|
||||
/@\[[^\s"'`]+\](\/[^\s"'`]+)?/,
|
||||
separator
|
||||
]),
|
||||
_regex.pattern([
|
||||
/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
|
||||
separator
|
||||
]),
|
||||
_regex.pattern([
|
||||
/[^\s"'`\[\\]+/,
|
||||
separator
|
||||
])
|
||||
]),
|
||||
// With quotes allowed
|
||||
_regex.any([
|
||||
_regex.pattern([
|
||||
/([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
|
||||
separator
|
||||
]),
|
||||
_regex.pattern([
|
||||
/[^\s`\[\\]+/,
|
||||
separator
|
||||
])
|
||||
])
|
||||
];
|
||||
for (const variantPattern of variantPatterns){
|
||||
yield _regex.pattern([
|
||||
// Variants
|
||||
"((?=((",
|
||||
variantPattern,
|
||||
")+))\\2)?",
|
||||
// Important (optional)
|
||||
/!?/,
|
||||
prefix,
|
||||
variantGroupingEnabled ? _regex.any([
|
||||
// Or any of those things but grouped separated by commas
|
||||
_regex.pattern([
|
||||
/\(/,
|
||||
utility,
|
||||
_regex.zeroOrMore([
|
||||
/,/,
|
||||
utility
|
||||
]),
|
||||
/\)/
|
||||
]),
|
||||
// Arbitrary properties, constrained utilities, arbitrary values, etc…
|
||||
utility
|
||||
]) : utility
|
||||
]);
|
||||
}
|
||||
// 5. Inner matches
|
||||
yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
|
||||
}
|
||||
// We want to capture any "special" characters
|
||||
// AND the characters immediately following them (if there is one)
|
||||
let SPECIALS = /([\[\]'"`])([^\[\]'"`])?/g;
|
||||
let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
||||
/**
|
||||
* Clips a string ensuring that parentheses, quotes, etc… are balanced
|
||||
* Used for arbitrary values only
|
||||
*
|
||||
* We will go past the end of the balanced parens until we find a non-class character
|
||||
*
|
||||
* Depth matching behavior:
|
||||
* w-[calc(100%-theme('spacing[some_key][1.5]'))]']
|
||||
* ┬ ┬ ┬┬ ┬ ┬┬ ┬┬┬┬┬┬┬
|
||||
* 1 2 3 4 34 3 210 END
|
||||
* ╰────┴──────────┴────────┴────────┴┴───┴─┴┴┴
|
||||
*
|
||||
* @param {string} input
|
||||
*/ function clipAtBalancedParens(input) {
|
||||
// We are care about this for arbitrary values
|
||||
if (!input.includes("-[")) {
|
||||
return input;
|
||||
}
|
||||
let depth = 0;
|
||||
let openStringTypes = [];
|
||||
// Find all parens, brackets, quotes, etc
|
||||
// Stop when we end at a balanced pair
|
||||
// This is naive and will treat mismatched parens as balanced
|
||||
// This shouldn't be a problem in practice though
|
||||
let matches = input.matchAll(SPECIALS);
|
||||
// We can't use lookbehind assertions because we have to support Safari
|
||||
// So, instead, we've emulated it using capture groups and we'll re-work the matches to accommodate
|
||||
matches = Array.from(matches).flatMap((match)=>{
|
||||
const [, ...groups] = match;
|
||||
return groups.map((group, idx)=>Object.assign([], match, {
|
||||
index: match.index + idx,
|
||||
0: group
|
||||
}));
|
||||
});
|
||||
for (let match of matches){
|
||||
let char = match[0];
|
||||
let inStringType = openStringTypes[openStringTypes.length - 1];
|
||||
if (char === inStringType) {
|
||||
openStringTypes.pop();
|
||||
} else if (char === "'" || char === '"' || char === "`") {
|
||||
openStringTypes.push(char);
|
||||
}
|
||||
if (inStringType) {
|
||||
continue;
|
||||
} else if (char === "[") {
|
||||
depth++;
|
||||
continue;
|
||||
} else if (char === "]") {
|
||||
depth--;
|
||||
continue;
|
||||
}
|
||||
// We've gone one character past the point where we should stop
|
||||
// This means that there was an extra closing `]`
|
||||
// We'll clip to just before it
|
||||
if (depth < 0) {
|
||||
return input.substring(0, match.index);
|
||||
}
|
||||
// We've finished balancing the brackets but there still may be characters that can be included
|
||||
// For example in the class `text-[#336699]/[.35]`
|
||||
// The depth goes to `0` at the closing `]` but goes up again at the `[`
|
||||
// If we're at zero and encounter a non-class character then we clip the class there
|
||||
if (depth === 0 && !ALLOWED_CLASS_CHARACTERS.test(char)) {
|
||||
return input.substring(0, match.index);
|
||||
}
|
||||
}
|
||||
return input;
|
||||
} // Regular utilities
|
||||
// {{modifier}:}*{namespace}{-{suffix}}*{/{opacityModifier}}?
|
||||
// Arbitrary values
|
||||
// {{modifier}:}*{namespace}-[{arbitraryValue}]{/{opacityModifier}}?
|
||||
// arbitraryValue: no whitespace, balanced quotes unless within quotes, balanced brackets unless within quotes
|
||||
// Arbitrary properties
|
||||
// {{modifier}:}*[{validCssPropertyName}:{arbitraryValue}]
|
||||
37
node_modules/tailwindcss/lib/lib/detectNesting.js
generated
vendored
Normal file
37
node_modules/tailwindcss/lib/lib/detectNesting.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
function _default(_context) {
|
||||
return (root, result)=>{
|
||||
let found = false;
|
||||
root.walkAtRules("tailwind", (node)=>{
|
||||
if (found) return false;
|
||||
if (node.parent && node.parent.type !== "root") {
|
||||
found = true;
|
||||
node.warn(result, [
|
||||
"Nested @tailwind rules were detected, but are not supported.",
|
||||
"Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
|
||||
"Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy"
|
||||
].join("\n"));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
root.walkRules((rule)=>{
|
||||
if (found) return false;
|
||||
rule.walkRules((nestedRule)=>{
|
||||
found = true;
|
||||
nestedRule.warn(result, [
|
||||
"Nested CSS was detected, but CSS nesting has not been configured correctly.",
|
||||
"Please enable a CSS nesting plugin *before* Tailwind in your configuration.",
|
||||
"See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting"
|
||||
].join("\n"));
|
||||
return false;
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
234
node_modules/tailwindcss/lib/lib/evaluateTailwindFunctions.js
generated
vendored
Normal file
234
node_modules/tailwindcss/lib/lib/evaluateTailwindFunctions.js
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _dlv = /*#__PURE__*/ _interopRequireDefault(require("dlv"));
|
||||
const _didyoumean = /*#__PURE__*/ _interopRequireDefault(require("didyoumean"));
|
||||
const _transformThemeValue = /*#__PURE__*/ _interopRequireDefault(require("../util/transformThemeValue"));
|
||||
const _postcssValueParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-value-parser"));
|
||||
const _normalizeScreens = require("../util/normalizeScreens");
|
||||
const _buildMediaQuery = /*#__PURE__*/ _interopRequireDefault(require("../util/buildMediaQuery"));
|
||||
const _toPath = require("../util/toPath");
|
||||
const _withAlphaVariable = require("../util/withAlphaVariable");
|
||||
const _pluginUtils = require("../util/pluginUtils");
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function isObject(input) {
|
||||
return typeof input === "object" && input !== null;
|
||||
}
|
||||
function findClosestExistingPath(theme, path) {
|
||||
let parts = (0, _toPath.toPath)(path);
|
||||
do {
|
||||
parts.pop();
|
||||
if ((0, _dlv.default)(theme, parts) !== undefined) 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, themeOpts = {}) {
|
||||
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+|['"]+$/g, "");
|
||||
const pathSegments = Array.isArray(path) ? path : (0, _toPath.toPath)(pathString);
|
||||
const value = (0, _dlv.default)(config.theme, pathSegments, defaultValue);
|
||||
if (value === undefined) {
|
||||
let error = `'${pathString}' does not exist in your theme config.`;
|
||||
const parentSegments = pathSegments.slice(0, -1);
|
||||
const parentValue = (0, _dlv.default)(config.theme, parentSegments);
|
||||
if (isObject(parentValue)) {
|
||||
const validKeys = Object.keys(parentValue).filter((key)=>validatePath(config, [
|
||||
...parentSegments,
|
||||
key
|
||||
]).isValid);
|
||||
const suggestion = (0, _didyoumean.default)(pathSegments[pathSegments.length - 1], 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 = (0, _dlv.default)(config.theme, closestPath);
|
||||
if (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 error1 = `'${pathString}' was found but does not resolve to a string.`;
|
||||
if (isObject(value)) {
|
||||
let validKeys1 = Object.keys(value).filter((key)=>validatePath(config, [
|
||||
...pathSegments,
|
||||
key
|
||||
]).isValid);
|
||||
if (validKeys1.length) {
|
||||
error1 += ` Did you mean something like '${pathToString([
|
||||
...pathSegments,
|
||||
validKeys1[0]
|
||||
])}'?`;
|
||||
}
|
||||
}
|
||||
return {
|
||||
isValid: false,
|
||||
error: error1
|
||||
};
|
||||
}
|
||||
const [themeSection] = pathSegments;
|
||||
return {
|
||||
isValid: true,
|
||||
value: (0, _transformThemeValue.default)(themeSection)(value, themeOpts)
|
||||
};
|
||||
}
|
||||
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"
|
||||
};
|
||||
/**
|
||||
* @param {string} path
|
||||
* @returns {Iterable<[path: string, alpha: string|undefined]>}
|
||||
*/ function* toPaths(path) {
|
||||
// Strip quotes from beginning and end of string
|
||||
// This allows the alpha value to be present inside of quotes
|
||||
path = path.replace(/^['"]+|['"]+$/g, "");
|
||||
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/);
|
||||
let alpha = undefined;
|
||||
yield [
|
||||
path,
|
||||
undefined
|
||||
];
|
||||
if (matches) {
|
||||
path = matches[1];
|
||||
alpha = matches[2];
|
||||
yield [
|
||||
path,
|
||||
alpha
|
||||
];
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {any} config
|
||||
* @param {string} path
|
||||
* @param {any} defaultValue
|
||||
*/ function resolvePath(config, path, defaultValue) {
|
||||
const results = Array.from(toPaths(path)).map(([path, alpha])=>{
|
||||
return Object.assign(validatePath(config, path, defaultValue, {
|
||||
opacityValue: alpha
|
||||
}), {
|
||||
resolvedPath: path,
|
||||
alpha
|
||||
});
|
||||
});
|
||||
var ref;
|
||||
return (ref = results.find((result)=>result.isValid)) !== null && ref !== void 0 ? ref : results[0];
|
||||
}
|
||||
function _default(context) {
|
||||
let config = context.tailwindConfig;
|
||||
let functions = {
|
||||
theme: (node, path, ...defaultValue)=>{
|
||||
let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
|
||||
if (!isValid) {
|
||||
var ref;
|
||||
let parentNode = node.parent;
|
||||
let candidate = (ref = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || ref === void 0 ? void 0 : ref.candidate;
|
||||
if (parentNode && candidate !== undefined) {
|
||||
// Remove this utility from any caches
|
||||
context.markInvalidUtilityNode(parentNode);
|
||||
// Remove the CSS node from the markup
|
||||
parentNode.remove();
|
||||
// Show a warning
|
||||
_log.default.warn("invalid-theme-key-in-class", [
|
||||
`The utility \`${candidate}\` contains an invalid theme value and was not generated.`
|
||||
]);
|
||||
return;
|
||||
}
|
||||
throw node.error(error);
|
||||
}
|
||||
let maybeColor = (0, _pluginUtils.parseColorFormat)(value);
|
||||
let isColorFunction = maybeColor !== undefined && typeof maybeColor === "function";
|
||||
if (alpha !== undefined || isColorFunction) {
|
||||
if (alpha === undefined) {
|
||||
alpha = 1.0;
|
||||
}
|
||||
value = (0, _withAlphaVariable.withAlphaValue)(maybeColor, alpha, maybeColor);
|
||||
}
|
||||
return value;
|
||||
},
|
||||
screen: (node, screen)=>{
|
||||
screen = screen.replace(/^['"]+/g, "").replace(/['"]+$/g, "");
|
||||
let screens = (0, _normalizeScreens.normalizeScreens)(config.theme.screens);
|
||||
let screenDefinition = screens.find(({ name })=>name === screen);
|
||||
if (!screenDefinition) {
|
||||
throw node.error(`The '${screen}' screen does not exist in your theme.`);
|
||||
}
|
||||
return (0, _buildMediaQuery.default)(screenDefinition);
|
||||
}
|
||||
};
|
||||
return (root)=>{
|
||||
root.walk((node)=>{
|
||||
let property = nodeTypePropertyMap[node.type];
|
||||
if (property === undefined) {
|
||||
return;
|
||||
}
|
||||
node[property] = resolveFunctions(node, node[property], functions);
|
||||
});
|
||||
};
|
||||
}
|
||||
526
node_modules/tailwindcss/lib/lib/expandApplyAtRules.js
generated
vendored
Normal file
526
node_modules/tailwindcss/lib/lib/expandApplyAtRules.js
generated
vendored
Normal file
@@ -0,0 +1,526 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>expandApplyAtRules
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _generateRules = require("./generateRules");
|
||||
const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("../util/escapeClassName"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
/** @typedef {Map<string, [any, import('postcss').Rule[]]>} ApplyCache */ function extractClasses(node) {
|
||||
/** @type {Map<string, Set<string>>} */ let groups = new Map();
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
node.clone()
|
||||
]
|
||||
});
|
||||
container.walkRules((rule)=>{
|
||||
(0, _postcssSelectorParser.default)((selectors)=>{
|
||||
selectors.walkClasses((classSelector)=>{
|
||||
let parentSelector = classSelector.parent.toString();
|
||||
let classes = groups.get(parentSelector);
|
||||
if (!classes) {
|
||||
groups.set(parentSelector, classes = new Set());
|
||||
}
|
||||
classes.add(classSelector.value);
|
||||
});
|
||||
}).processSync(rule.selector);
|
||||
});
|
||||
let normalizedGroups = Array.from(groups.values(), (classes)=>Array.from(classes));
|
||||
let classes = normalizedGroups.flat();
|
||||
return Object.assign(classes, {
|
||||
groups: normalizedGroups
|
||||
});
|
||||
}
|
||||
let selectorExtractor = (0, _postcssSelectorParser.default)();
|
||||
/**
|
||||
* @param {string} ruleSelectors
|
||||
*/ function extractSelectors(ruleSelectors) {
|
||||
return selectorExtractor.astSync(ruleSelectors);
|
||||
}
|
||||
function extractBaseCandidates(candidates, separator) {
|
||||
let baseClasses = new Set();
|
||||
for (let candidate of candidates){
|
||||
baseClasses.add(candidate.split(separator).pop());
|
||||
}
|
||||
return Array.from(baseClasses);
|
||||
}
|
||||
function prefix(context, selector) {
|
||||
let prefix = context.tailwindConfig.prefix;
|
||||
return typeof prefix === "function" ? prefix(selector) : prefix + selector;
|
||||
}
|
||||
function* pathToRoot(node) {
|
||||
yield node;
|
||||
while(node.parent){
|
||||
yield node.parent;
|
||||
node = node.parent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Only clone the node itself and not its children
|
||||
*
|
||||
* @param {*} node
|
||||
* @param {*} overrides
|
||||
* @returns
|
||||
*/ function shallowClone(node, overrides = {}) {
|
||||
let children = node.nodes;
|
||||
node.nodes = [];
|
||||
let tmp = node.clone(overrides);
|
||||
node.nodes = children;
|
||||
return tmp;
|
||||
}
|
||||
/**
|
||||
* Clone just the nodes all the way to the top that are required to represent
|
||||
* this singular rule in the tree.
|
||||
*
|
||||
* For example, if we have CSS like this:
|
||||
* ```css
|
||||
* @media (min-width: 768px) {
|
||||
* @supports (display: grid) {
|
||||
* .foo {
|
||||
* display: grid;
|
||||
* grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @supports (backdrop-filter: blur(1px)) {
|
||||
* .bar {
|
||||
* backdrop-filter: blur(1px);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* .baz {
|
||||
* color: orange;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* And we're cloning `.bar` it'll return a cloned version of what's required for just that single node:
|
||||
*
|
||||
* ```css
|
||||
* @media (min-width: 768px) {
|
||||
* @supports (backdrop-filter: blur(1px)) {
|
||||
* .bar {
|
||||
* backdrop-filter: blur(1px);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param {import('postcss').Node} node
|
||||
*/ function nestedClone(node) {
|
||||
for (let parent of pathToRoot(node)){
|
||||
if (node === parent) {
|
||||
continue;
|
||||
}
|
||||
if (parent.type === "root") {
|
||||
break;
|
||||
}
|
||||
node = shallowClone(parent, {
|
||||
nodes: [
|
||||
node
|
||||
]
|
||||
});
|
||||
}
|
||||
return node;
|
||||
}
|
||||
/**
|
||||
* @param {import('postcss').Root} root
|
||||
*/ function buildLocalApplyCache(root, context) {
|
||||
/** @type {ApplyCache} */ let cache = new Map();
|
||||
root.walkRules((rule)=>{
|
||||
// Ignore rules generated by Tailwind
|
||||
for (let node of pathToRoot(rule)){
|
||||
var ref;
|
||||
if (((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.layer) !== undefined) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Clone what's required to represent this singular rule in the tree
|
||||
let container = nestedClone(rule);
|
||||
let sort = context.offsets.create("user");
|
||||
for (let className of extractClasses(rule)){
|
||||
let list = cache.get(className) || [];
|
||||
cache.set(className, list);
|
||||
list.push([
|
||||
{
|
||||
layer: "user",
|
||||
sort,
|
||||
important: false
|
||||
},
|
||||
container
|
||||
]);
|
||||
}
|
||||
});
|
||||
return cache;
|
||||
}
|
||||
/**
|
||||
* @returns {ApplyCache}
|
||||
*/ 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;
|
||||
}
|
||||
/**
|
||||
* Build a cache only when it's first used
|
||||
*
|
||||
* @param {() => ApplyCache} buildCacheFn
|
||||
* @returns {ApplyCache}
|
||||
*/ function lazyCache(buildCacheFn) {
|
||||
let cache = null;
|
||||
return {
|
||||
get: (name)=>{
|
||||
cache = cache || buildCacheFn();
|
||||
return cache.get(name);
|
||||
},
|
||||
has: (name)=>{
|
||||
cache = cache || buildCacheFn();
|
||||
return cache.has(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Take a series of multiple caches and merge
|
||||
* them so they act like one large cache
|
||||
*
|
||||
* @param {ApplyCache[]} caches
|
||||
* @returns {ApplyCache}
|
||||
*/ function combineCaches(caches) {
|
||||
return {
|
||||
get: (name)=>caches.flatMap((cache)=>cache.get(name) || []),
|
||||
has: (name)=>caches.some((cache)=>cache.has(name))
|
||||
};
|
||||
}
|
||||
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 processApply(root, context, localCache) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
// Fill up some caches!
|
||||
let applyClassCache = combineCaches([
|
||||
localCache,
|
||||
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`
|
||||
*
|
||||
* @param {string} selector
|
||||
* @param {string} utilitySelectors
|
||||
* @param {string} candidate
|
||||
*/ function replaceSelector(selector, utilitySelectors, candidate) {
|
||||
let selectorList = extractSelectors(selector);
|
||||
let utilitySelectorsList = extractSelectors(utilitySelectors);
|
||||
let candidateList = extractSelectors(`.${(0, _escapeClassName.default)(candidate)}`);
|
||||
let candidateClass = candidateList.nodes[0].nodes[0];
|
||||
selectorList.each((sel)=>{
|
||||
/** @type {Set<import('postcss-selector-parser').Selector>} */ let replaced = new Set();
|
||||
utilitySelectorsList.each((utilitySelector)=>{
|
||||
let hasReplaced = false;
|
||||
utilitySelector = utilitySelector.clone();
|
||||
utilitySelector.walkClasses((node)=>{
|
||||
if (node.value !== candidateClass.value) {
|
||||
return;
|
||||
}
|
||||
// Don't replace multiple instances of the same class
|
||||
// This is theoretically correct but only partially
|
||||
// We'd need to generate every possible permutation of the replacement
|
||||
// For example with `.foo + .foo { … }` and `section { @apply foo; }`
|
||||
// We'd need to generate all of these:
|
||||
// - `.foo + .foo`
|
||||
// - `.foo + section`
|
||||
// - `section + .foo`
|
||||
// - `section + section`
|
||||
if (hasReplaced) {
|
||||
return;
|
||||
}
|
||||
// Since you can only `@apply` class names this is sufficient
|
||||
// We want to replace the matched class name with the selector the user is using
|
||||
// Ex: Replace `.text-blue-500` with `.foo.bar:is(.something-cool)`
|
||||
node.replaceWith(...sel.nodes.map((node)=>node.clone()));
|
||||
// Record that we did something and we want to use this new selector
|
||||
replaced.add(utilitySelector);
|
||||
hasReplaced = true;
|
||||
});
|
||||
});
|
||||
// Sort tag names before class names (but only sort each group (separated by a combinator)
|
||||
// separately and not in total)
|
||||
// This happens when replacing `.bar` in `.foo.bar` with a tag like `section`
|
||||
for (let sel1 of replaced){
|
||||
let groups = [
|
||||
[]
|
||||
];
|
||||
for (let node of sel1.nodes){
|
||||
if (node.type === "combinator") {
|
||||
groups.push(node);
|
||||
groups.push([]);
|
||||
} else {
|
||||
let last = groups[groups.length - 1];
|
||||
last.push(node);
|
||||
}
|
||||
}
|
||||
sel1.nodes = [];
|
||||
for (let group of groups){
|
||||
if (Array.isArray(group)) {
|
||||
group.sort((a, b)=>{
|
||||
if (a.type === "tag" && b.type === "class") {
|
||||
return -1;
|
||||
} else if (a.type === "class" && b.type === "tag") {
|
||||
return 1;
|
||||
} else if (a.type === "class" && b.type === "pseudo" && b.value.startsWith("::")) {
|
||||
return -1;
|
||||
} else if (a.type === "pseudo" && a.value.startsWith("::") && b.type === "class") {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
sel1.nodes = sel1.nodes.concat(group);
|
||||
}
|
||||
}
|
||||
sel.replaceWith(...replaced);
|
||||
});
|
||||
return selectorList.toString();
|
||||
}
|
||||
let perParentApplies = new Map();
|
||||
// Collect all apply candidates and their rules
|
||||
for (let apply of applies){
|
||||
let [candidates] = perParentApplies.get(apply.parent) || [
|
||||
[],
|
||||
apply.source
|
||||
];
|
||||
perParentApplies.set(apply.parent, [
|
||||
candidates,
|
||||
apply.source
|
||||
]);
|
||||
let [applyCandidates1, important] = extractApplyCandidates(apply.params);
|
||||
if (apply.parent.type === "atrule") {
|
||||
if (apply.parent.name === "screen") {
|
||||
let screenType = apply.parent.params;
|
||||
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${applyCandidates1.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 applyCandidates1){
|
||||
if ([
|
||||
prefix(context, "group"),
|
||||
prefix(context, "peer")
|
||||
].includes(applyCandidate)) {
|
||||
// TODO: Link to specific documentation page with error code.
|
||||
throw apply.error(`@apply should not be used with the '${applyCandidate}' utility`);
|
||||
}
|
||||
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 (let [parent, [candidates1, atApplySource]] of perParentApplies){
|
||||
let siblings = [];
|
||||
for (let [applyCandidate1, important1, rules1] of candidates1){
|
||||
let potentialApplyCandidates = [
|
||||
applyCandidate1,
|
||||
...extractBaseCandidates([
|
||||
applyCandidate1
|
||||
], context.tailwindConfig.separator)
|
||||
];
|
||||
for (let [meta, node] of rules1){
|
||||
let parentClasses = extractClasses(parent);
|
||||
let nodeClasses = extractClasses(node);
|
||||
// When we encounter a rule like `.dark .a, .b { … }` we only want to be left with `[.dark, .a]` if the base applyCandidate is `.a` or with `[.b]` if the base applyCandidate is `.b`
|
||||
// So we've split them into groups
|
||||
nodeClasses = nodeClasses.groups.filter((classList)=>classList.some((className)=>potentialApplyCandidates.includes(className))).flat();
|
||||
// Add base utility classes from the @apply node to the list of
|
||||
// classes to check whether it intersects and therefore results in a
|
||||
// circular dependency or not.
|
||||
//
|
||||
// E.g.:
|
||||
// .foo {
|
||||
// @apply hover:a; // This applies "a" but with a modifier
|
||||
// }
|
||||
//
|
||||
// We only have to do that with base classes of the `node`, not of the `parent`
|
||||
// E.g.:
|
||||
// .hover\:foo {
|
||||
// @apply bar;
|
||||
// }
|
||||
// .bar {
|
||||
// @apply foo;
|
||||
// }
|
||||
//
|
||||
// This should not result in a circular dependency because we are
|
||||
// just applying `.foo` and the rule above is `.hover\:foo` which is
|
||||
// unrelated. However, if we were to apply `hover:foo` then we _did_
|
||||
// have to include this one.
|
||||
nodeClasses = nodeClasses.concat(extractBaseCandidates(nodeClasses, context.tailwindConfig.separator));
|
||||
let intersects = parentClasses.some((selector)=>nodeClasses.includes(selector));
|
||||
if (intersects) {
|
||||
throw node.error(`You cannot \`@apply\` the \`${applyCandidate1}\` utility here because it creates a circular dependency.`);
|
||||
}
|
||||
let root1 = _postcss.default.root({
|
||||
nodes: [
|
||||
node.clone()
|
||||
]
|
||||
});
|
||||
// Make sure every node in the entire tree points back at the @apply rule that generated it
|
||||
root1.walk((node)=>{
|
||||
node.source = atApplySource;
|
||||
});
|
||||
let canRewriteSelector = node.type !== "atrule" || node.type === "atrule" && node.name !== "keyframes";
|
||||
if (canRewriteSelector) {
|
||||
root1.walkRules((rule)=>{
|
||||
// Let's imagine you have the following structure:
|
||||
//
|
||||
// .foo {
|
||||
// @apply bar;
|
||||
// }
|
||||
//
|
||||
// @supports (a: b) {
|
||||
// .bar {
|
||||
// color: blue
|
||||
// }
|
||||
//
|
||||
// .something-unrelated {}
|
||||
// }
|
||||
//
|
||||
// In this case we want to apply `.bar` but it happens to be in
|
||||
// an atrule node. We clone that node instead of the nested one
|
||||
// because we still want that @supports rule to be there once we
|
||||
// applied everything.
|
||||
//
|
||||
// However it happens to be that the `.something-unrelated` is
|
||||
// also in that same shared @supports atrule. This is not good,
|
||||
// and this should not be there. The good part is that this is
|
||||
// a clone already and it can be safely removed. The question is
|
||||
// how do we know we can remove it. Basically what we can do is
|
||||
// match it against the applyCandidate that you want to apply. If
|
||||
// it doesn't match the we can safely delete it.
|
||||
//
|
||||
// If we didn't do this, then the `replaceSelector` function
|
||||
// would have replaced this with something that didn't exist and
|
||||
// therefore it removed the selector altogether. In this specific
|
||||
// case it would result in `{}` instead of `.something-unrelated {}`
|
||||
if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate1)) {
|
||||
rule.remove();
|
||||
return;
|
||||
}
|
||||
// Strip the important selector from the parent selector if at the beginning
|
||||
let importantSelector = typeof context.tailwindConfig.important === "string" ? context.tailwindConfig.important : null;
|
||||
// We only want to move the "important" selector if this is a Tailwind-generated utility
|
||||
// We do *not* want to do this for user CSS that happens to be structured the same
|
||||
let isGenerated = parent.raws.tailwind !== undefined;
|
||||
let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
|
||||
rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate1);
|
||||
// And then re-add it if it was removed
|
||||
if (importantSelector && parentSelector !== parent.selector) {
|
||||
rule.selector = `${importantSelector} ${rule.selector}`;
|
||||
}
|
||||
rule.walkDecls((d)=>{
|
||||
d.important = meta.important || important1;
|
||||
});
|
||||
});
|
||||
}
|
||||
// It could be that the node we were inserted was removed because the class didn't match
|
||||
// If that was the *only* rule in the parent, then we have nothing add so we skip it
|
||||
if (!root1.nodes[0]) {
|
||||
continue;
|
||||
}
|
||||
// Insert it
|
||||
siblings.push([
|
||||
meta.sort,
|
||||
root1.nodes[0]
|
||||
]);
|
||||
}
|
||||
}
|
||||
// Inject the rules, sorted, correctly
|
||||
let nodes = context.offsets.sort(siblings).map((s)=>s[1]);
|
||||
// `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
|
||||
parent.after(nodes);
|
||||
}
|
||||
for (let apply1 of applies){
|
||||
// If there are left-over declarations, just remove the @apply
|
||||
if (apply1.parent.nodes.length > 1) {
|
||||
apply1.remove();
|
||||
} else {
|
||||
// The node is empty, drop the full node
|
||||
apply1.parent.remove();
|
||||
}
|
||||
}
|
||||
// Do it again, in case we have other `@apply` rules
|
||||
processApply(root, context, localCache);
|
||||
}
|
||||
function expandApplyAtRules(context) {
|
||||
return (root)=>{
|
||||
// Build a cache of the user's CSS so we can use it to resolve classes used by @apply
|
||||
let localCache = lazyCache(()=>buildLocalApplyCache(root, context));
|
||||
processApply(root, context, localCache);
|
||||
};
|
||||
}
|
||||
247
node_modules/tailwindcss/lib/lib/expandTailwindAtRules.js
generated
vendored
Normal file
247
node_modules/tailwindcss/lib/lib/expandTailwindAtRules.js
generated
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>expandTailwindAtRules
|
||||
});
|
||||
const _quickLru = /*#__PURE__*/ _interopRequireDefault(require("quick-lru"));
|
||||
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
|
||||
const _generateRules = require("./generateRules");
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
||||
const _cloneNodes = /*#__PURE__*/ _interopRequireDefault(require("../util/cloneNodes"));
|
||||
const _defaultExtractor = require("./defaultExtractor");
|
||||
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;
|
||||
const builtInExtractors = {
|
||||
DEFAULT: _defaultExtractor.defaultExtractor
|
||||
};
|
||||
const builtInTransformers = {
|
||||
DEFAULT: (content)=>content,
|
||||
svelte: (content)=>content.replace(/(?:^|\s)class:/g, " ")
|
||||
};
|
||||
function getExtractor(context, fileExtension) {
|
||||
let extractors = context.tailwindConfig.content.extract;
|
||||
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || builtInExtractors.DEFAULT(context);
|
||||
}
|
||||
function getTransformer(tailwindConfig, fileExtension) {
|
||||
let transformers = tailwindConfig.content.transform;
|
||||
return transformers[fileExtension] || transformers.DEFAULT || builtInTransformers[fileExtension] || builtInTransformers.DEFAULT;
|
||||
}
|
||||
let extractorCache = new WeakMap();
|
||||
// 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, candidates, seen) {
|
||||
if (!extractorCache.has(extractor)) {
|
||||
extractorCache.set(extractor, new _quickLru.default({
|
||||
maxSize: 25000
|
||||
}));
|
||||
}
|
||||
for (let line of content.split("\n")){
|
||||
line = line.trim();
|
||||
if (seen.has(line)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(line);
|
||||
if (extractorCache.get(extractor).has(line)) {
|
||||
for (let match of extractorCache.get(extractor).get(line)){
|
||||
candidates.add(match);
|
||||
}
|
||||
} else {
|
||||
let extractorMatches = extractor(line).filter((s)=>s !== "!*");
|
||||
let lineMatchesSet = new Set(extractorMatches);
|
||||
for (let match1 of lineMatchesSet){
|
||||
candidates.add(match1);
|
||||
}
|
||||
extractorCache.get(extractor).set(line, lineMatchesSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {[import('./offsets.js').RuleOffset, import('postcss').Node][]} rules
|
||||
* @param {*} context
|
||||
*/ function buildStylesheet(rules, context) {
|
||||
let sortedRules = context.offsets.sort(rules);
|
||||
let returnValue = {
|
||||
base: new Set(),
|
||||
defaults: new Set(),
|
||||
components: new Set(),
|
||||
utilities: new Set(),
|
||||
variants: new Set()
|
||||
};
|
||||
for (let [sort, rule] of sortedRules){
|
||||
returnValue[sort.layer].add(rule);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
function expandTailwindAtRules(context) {
|
||||
return (root)=>{
|
||||
let layerNodes = {
|
||||
base: null,
|
||||
components: null,
|
||||
utilities: null,
|
||||
variants: null
|
||||
};
|
||||
root.walkAtRules((rule)=>{
|
||||
// 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.
|
||||
if (rule.name === "tailwind") {
|
||||
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([
|
||||
_sharedState.NOT_ON_DEMAND
|
||||
]);
|
||||
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, extension);
|
||||
getClassCandidates(transformer(content), extractor, candidates, seen);
|
||||
}
|
||||
env.DEBUG && console.timeEnd("Reading changed files");
|
||||
// ---
|
||||
// Generate the actual CSS
|
||||
let classCacheCount = context.classCache.size;
|
||||
env.DEBUG && console.time("Generate 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) {
|
||||
context.stylesheetCache = buildStylesheet([
|
||||
...context.ruleCache
|
||||
], context);
|
||||
}
|
||||
env.DEBUG && console.timeEnd("Build stylesheet");
|
||||
let { defaults: defaultNodes , 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,
|
||||
...defaultNodes
|
||||
], layerNodes.base.source, {
|
||||
layer: "base"
|
||||
}));
|
||||
layerNodes.base.remove();
|
||||
}
|
||||
if (layerNodes.components) {
|
||||
layerNodes.components.before((0, _cloneNodes.default)([
|
||||
...componentNodes
|
||||
], layerNodes.components.source, {
|
||||
layer: "components"
|
||||
}));
|
||||
layerNodes.components.remove();
|
||||
}
|
||||
if (layerNodes.utilities) {
|
||||
layerNodes.utilities.before((0, _cloneNodes.default)([
|
||||
...utilityNodes
|
||||
], layerNodes.utilities.source, {
|
||||
layer: "utilities"
|
||||
}));
|
||||
layerNodes.utilities.remove();
|
||||
}
|
||||
// We do post-filtering to not alter the emitted order of the variants
|
||||
const variantNodes = Array.from(screenNodes).filter((node)=>{
|
||||
var ref;
|
||||
const parentLayer = (ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer;
|
||||
if (parentLayer === "components") {
|
||||
return layerNodes.components !== null;
|
||||
}
|
||||
if (parentLayer === "utilities") {
|
||||
return layerNodes.utilities !== null;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (layerNodes.variants) {
|
||||
layerNodes.variants.before((0, _cloneNodes.default)(variantNodes, layerNodes.variants.source, {
|
||||
layer: "variants"
|
||||
}));
|
||||
layerNodes.variants.remove();
|
||||
} else if (variantNodes.length > 0) {
|
||||
root.append((0, _cloneNodes.default)(variantNodes, root.source, {
|
||||
layer: "variants"
|
||||
}));
|
||||
}
|
||||
// If we've got a utility layer and no utilities are generated there's likely something wrong
|
||||
const hasUtilityVariants = variantNodes.some((node)=>{
|
||||
var ref;
|
||||
return ((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer) === "utilities";
|
||||
});
|
||||
if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
|
||||
_log.default.warn("content-problems", [
|
||||
"No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.",
|
||||
"https://tailwindcss.com/docs/content-configuration"
|
||||
]);
|
||||
}
|
||||
// ---
|
||||
if (env.DEBUG) {
|
||||
console.log("Potential classes: ", candidates.size);
|
||||
console.log("Active contexts: ", _sharedState.contextSourcesMap.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();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
44
node_modules/tailwindcss/lib/lib/findAtConfigPath.js
generated
vendored
Normal file
44
node_modules/tailwindcss/lib/lib/findAtConfigPath.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "findAtConfigPath", {
|
||||
enumerable: true,
|
||||
get: ()=>findAtConfigPath
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function findAtConfigPath(root, result) {
|
||||
let configPath = null;
|
||||
let relativeTo = null;
|
||||
root.walkAtRules("config", (rule)=>{
|
||||
var ref;
|
||||
var _file, ref1;
|
||||
relativeTo = (ref1 = (_file = (ref = rule.source) === null || ref === void 0 ? void 0 : ref.input.file) !== null && _file !== void 0 ? _file : result.opts.from) !== null && ref1 !== void 0 ? ref1 : null;
|
||||
if (relativeTo === null) {
|
||||
throw rule.error("The `@config` directive cannot be used without setting `from` in your PostCSS config.");
|
||||
}
|
||||
if (configPath) {
|
||||
throw rule.error("Only one `@config` directive is allowed per file.");
|
||||
}
|
||||
let matches = rule.params.match(/(['"])(.*?)\1/);
|
||||
if (!matches) {
|
||||
throw rule.error("A path is required when using the `@config` directive.");
|
||||
}
|
||||
let inputPath = matches[2];
|
||||
if (_path.default.isAbsolute(inputPath)) {
|
||||
throw rule.error("The `@config` directive cannot be used with an absolute path.");
|
||||
}
|
||||
configPath = _path.default.resolve(_path.default.dirname(relativeTo), inputPath);
|
||||
if (!_fs.default.existsSync(configPath)) {
|
||||
throw rule.error(`The config file at "${inputPath}" does not exist. Make sure the path is correct and the file exists.`);
|
||||
}
|
||||
rule.remove();
|
||||
});
|
||||
return configPath ? configPath : null;
|
||||
}
|
||||
817
node_modules/tailwindcss/lib/lib/generateRules.js
generated
vendored
Normal file
817
node_modules/tailwindcss/lib/lib/generateRules.js
generated
vendored
Normal file
@@ -0,0 +1,817 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
getClassNameFromSelector: ()=>getClassNameFromSelector,
|
||||
resolveMatches: ()=>resolveMatches,
|
||||
generateRules: ()=>generateRules
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _parseObjectStyles = /*#__PURE__*/ _interopRequireDefault(require("../util/parseObjectStyles"));
|
||||
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("../util/isPlainObject"));
|
||||
const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
|
||||
const _pluginUtils = require("../util/pluginUtils");
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
||||
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
|
||||
const _formatVariantSelector = require("../util/formatVariantSelector");
|
||||
const _nameClass = require("../util/nameClass");
|
||||
const _dataTypes = require("../util/dataTypes");
|
||||
const _setupContextUtils = require("./setupContextUtils");
|
||||
const _isValidArbitraryValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
||||
const _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
|
||||
const _featureFlags = require("../featureFlags");
|
||||
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 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) {
|
||||
let lastIndex = Infinity;
|
||||
while(lastIndex >= 0){
|
||||
let dashIdx;
|
||||
let wasSlash = false;
|
||||
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[]
|
||||
if (candidate[bracketIdx - 1] === "-") {
|
||||
dashIdx = bracketIdx - 1;
|
||||
} else if (candidate[bracketIdx - 1] === "/") {
|
||||
dashIdx = bracketIdx - 1;
|
||||
wasSlash = true;
|
||||
} else {
|
||||
dashIdx = -1;
|
||||
}
|
||||
} else if (lastIndex === Infinity && candidate.includes("/")) {
|
||||
dashIdx = candidate.lastIndexOf("/");
|
||||
wasSlash = true;
|
||||
} else {
|
||||
dashIdx = candidate.lastIndexOf("-", lastIndex);
|
||||
}
|
||||
if (dashIdx < 0) {
|
||||
break;
|
||||
}
|
||||
let prefix = candidate.slice(0, dashIdx);
|
||||
let modifier = candidate.slice(wasSlash ? dashIdx : dashIdx + 1);
|
||||
lastIndex = dashIdx - 1;
|
||||
// TODO: This feels a bit hacky
|
||||
if (prefix === "" || modifier === "/") {
|
||||
continue;
|
||||
}
|
||||
yield [
|
||||
prefix,
|
||||
modifier
|
||||
];
|
||||
}
|
||||
}
|
||||
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()
|
||||
]
|
||||
});
|
||||
let classCandidate = match[1].raws.tailwind.classCandidate;
|
||||
container.walkRules((r)=>{
|
||||
// If this is a negative utility with a dash *before* the prefix we
|
||||
// have to ensure that the generated selector matches the candidate
|
||||
// Not doing this will cause `-tw-top-1` to generate the class `.tw--top-1`
|
||||
// The disconnect between candidate <-> class can cause @apply to hard crash.
|
||||
let shouldPrependNegative = classCandidate.startsWith("-");
|
||||
r.selector = (0, _prefixSelector.default)(context.tailwindConfig.prefix, r.selector, shouldPrependNegative);
|
||||
});
|
||||
match[1] = container.nodes[0];
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
function applyImportant(matches, classCandidate) {
|
||||
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)((0, _pluginUtils.filterSelectorsForClass)(r.selector, classCandidate), (className)=>{
|
||||
if (className === classCandidate) {
|
||||
return `!${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;
|
||||
}
|
||||
/** @type {{modifier: string | null, value: string | null}} */ let args = {
|
||||
modifier: null,
|
||||
value: _sharedState.NONE
|
||||
};
|
||||
// Retrieve "modifier"
|
||||
{
|
||||
let match = /(.*)\/(.*)$/g.exec(variant);
|
||||
if (match) {
|
||||
variant = match[1];
|
||||
args.modifier = match[2];
|
||||
if (!(0, _featureFlags.flagEnabled)(context.tailwindConfig, "generalizedModifiers")) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Retrieve "arbitrary value"
|
||||
if (variant.endsWith("]") && !variant.startsWith("[")) {
|
||||
// We either have:
|
||||
// @[200px]
|
||||
// group-[:hover]
|
||||
//
|
||||
// But we don't want:
|
||||
// @-[200px] (`-` is incorrect)
|
||||
// group[:hover] (`-` is missing)
|
||||
let match1 = /(.)(-?)\[(.*)\]/g.exec(variant);
|
||||
if (match1) {
|
||||
let [, char, seperator, value] = match1;
|
||||
// @-[200px] case
|
||||
if (char === "@" && seperator === "-") return [];
|
||||
// group[:hover] case
|
||||
if (char !== "@" && seperator === "") return [];
|
||||
variant = variant.replace(`${seperator}[${value}]`, "");
|
||||
args.value = value;
|
||||
}
|
||||
}
|
||||
// Register arbitrary variants
|
||||
if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
|
||||
let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
|
||||
if (!(0, _setupContextUtils.isValidVariantFormatString)(selector)) {
|
||||
return [];
|
||||
}
|
||||
let fn = (0, _setupContextUtils.parseVariant)(selector);
|
||||
let sort = context.offsets.recordVariant(variant);
|
||||
context.variantMap.set(variant, [
|
||||
[
|
||||
sort,
|
||||
fn
|
||||
]
|
||||
]);
|
||||
}
|
||||
if (context.variantMap.has(variant)) {
|
||||
let variantFunctionTuples = context.variantMap.get(variant).slice();
|
||||
let result = [];
|
||||
for (let [meta, rule] of matches){
|
||||
// Don't generate variants for user css
|
||||
if (meta.layer === "user") {
|
||||
continue;
|
||||
}
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
rule.clone()
|
||||
]
|
||||
});
|
||||
for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples){
|
||||
let clone = (containerFromArray !== null && containerFromArray !== void 0 ? containerFromArray : container).clone();
|
||||
let collectedFormats = [];
|
||||
function prepareBackup() {
|
||||
// Already prepared, chicken out
|
||||
if (clone.raws.neededBackup) {
|
||||
return;
|
||||
}
|
||||
clone.raws.neededBackup = true;
|
||||
clone.walkRules((rule)=>rule.raws.originalSelector = rule.selector);
|
||||
}
|
||||
function modifySelectors(modifierFunction) {
|
||||
prepareBackup();
|
||||
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({
|
||||
// Public API
|
||||
get container () {
|
||||
prepareBackup();
|
||||
return clone;
|
||||
},
|
||||
separator: context.tailwindConfig.separator,
|
||||
modifySelectors,
|
||||
// Private API for now
|
||||
wrap (wrapper) {
|
||||
let nodes = clone.nodes;
|
||||
clone.removeAll();
|
||||
wrapper.append(nodes);
|
||||
clone.append(wrapper);
|
||||
},
|
||||
format (selectorFormat) {
|
||||
collectedFormats.push(selectorFormat);
|
||||
},
|
||||
args
|
||||
});
|
||||
// It can happen that a list of format strings is returned from within the function. In that
|
||||
// case, we have to process them as well. We can use the existing `variantSort`.
|
||||
if (Array.isArray(ruleWithVariant)) {
|
||||
for (let [idx, variantFunction1] of ruleWithVariant.entries()){
|
||||
// This is a little bit scary since we are pushing to an array of items that we are
|
||||
// currently looping over. However, you can also think of it like a processing queue
|
||||
// where you keep handling jobs until everything is done and each job can queue more
|
||||
// jobs if needed.
|
||||
variantFunctionTuples.push([
|
||||
context.offsets.applyParallelOffset(variantSort, idx),
|
||||
variantFunction1,
|
||||
// If the clone has been modified we have to pass that back
|
||||
// though so each rule can use the modified container
|
||||
clone.clone()
|
||||
]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (typeof ruleWithVariant === "string") {
|
||||
collectedFormats.push(ruleWithVariant);
|
||||
}
|
||||
if (ruleWithVariant === null) {
|
||||
continue;
|
||||
}
|
||||
// We had to backup selectors, therefore we assume that somebody touched
|
||||
// `container` or `modifySelectors`. Let's see if they did, so that we
|
||||
// can restore the selectors, and collect the format strings.
|
||||
if (clone.raws.neededBackup) {
|
||||
delete clone.raws.neededBackup;
|
||||
clone.walkRules((rule)=>{
|
||||
let before = rule.raws.originalSelector;
|
||||
if (!before) return;
|
||||
delete rule.raws.originalSelector;
|
||||
if (before === rule.selector) return; // No mutation happened
|
||||
let modified = rule.selector;
|
||||
// Rebuild the base selector, this is what plugin authors would do
|
||||
// as well. E.g.: `${variant}${separator}${className}`.
|
||||
// However, plugin authors probably also prepend or append certain
|
||||
// classes, pseudos, ids, ...
|
||||
let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
|
||||
selectors.walkClasses((classNode)=>{
|
||||
classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
|
||||
});
|
||||
}).processSync(before);
|
||||
// Now that we know the original selector, the new selector, and
|
||||
// the rebuild part in between, we can replace the part that plugin
|
||||
// authors need to rebuild with `&`, and eventually store it in the
|
||||
// collectedFormats. Similar to what `format('...')` would do.
|
||||
//
|
||||
// E.g.:
|
||||
// variant: foo
|
||||
// selector: .markdown > p
|
||||
// modified (by plugin): .foo .foo\\:markdown > p
|
||||
// rebuiltBase (internal): .foo\\:markdown > p
|
||||
// format: .foo &
|
||||
collectedFormats.push(modified.replace(rebuiltBase, "&"));
|
||||
rule.selector = before;
|
||||
});
|
||||
}
|
||||
// This tracks the originating layer for the variant
|
||||
// For example:
|
||||
// .sm:underline {} is a variant of something in the utilities layer
|
||||
// .sm:container {} is a variant of the container component
|
||||
clone.nodes[0].raws.tailwind = {
|
||||
...clone.nodes[0].raws.tailwind,
|
||||
parentLayer: meta.layer
|
||||
};
|
||||
var _collectedFormats;
|
||||
let withOffset = [
|
||||
{
|
||||
...meta,
|
||||
sort: context.offsets.applyVariantOffset(meta.sort, variantSort, Object.assign(args, context.variantOptions.get(variant))),
|
||||
collectedFormats: ((_collectedFormats = meta.collectedFormats) !== null && _collectedFormats !== void 0 ? _collectedFormats : []).concat(collectedFormats),
|
||||
isArbitraryVariant: isArbitraryValue(variant)
|
||||
},
|
||||
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
|
||||
];
|
||||
}
|
||||
const IS_VALID_PROPERTY_NAME = /^[a-z_-]/;
|
||||
function isValidPropName(name) {
|
||||
return IS_VALID_PROPERTY_NAME.test(name);
|
||||
}
|
||||
/**
|
||||
* @param {string} declaration
|
||||
* @returns {boolean}
|
||||
*/ function looksLikeUri(declaration) {
|
||||
// Quick bailout for obvious non-urls
|
||||
// This doesn't support schemes that don't use a leading // but that's unlikely to be a problem
|
||||
if (!declaration.includes("://")) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const url = new URL(declaration);
|
||||
return url.scheme !== "" && url.host !== "";
|
||||
} catch (err) {
|
||||
// Definitely not a valid url
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function isParsableNode(node) {
|
||||
let isParsable = true;
|
||||
node.walkDecls((decl)=>{
|
||||
if (!isParsableCssValue(decl.name, decl.value)) {
|
||||
isParsable = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return isParsable;
|
||||
}
|
||||
function isParsableCssValue(property, value) {
|
||||
// We don't want to to treat [https://example.com] as a custom property
|
||||
// Even though, according to the CSS grammar, it's a totally valid CSS declaration
|
||||
// So we short-circuit here by checking if the custom property looks like a url
|
||||
if (looksLikeUri(`${property}:${value}`)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
_postcss.default.parse(`a{${property}:${value}}`).toResult();
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function extractArbitraryProperty(classCandidate, context) {
|
||||
var ref;
|
||||
let [, property, value] = (ref = classCandidate.match(/^\[([a-zA-Z0-9-_]+):(\S+)\]$/)) !== null && ref !== void 0 ? ref : [];
|
||||
if (value === undefined) {
|
||||
return null;
|
||||
}
|
||||
if (!isValidPropName(property)) {
|
||||
return null;
|
||||
}
|
||||
if (!(0, _isValidArbitraryValue.default)(value)) {
|
||||
return null;
|
||||
}
|
||||
let normalized = (0, _dataTypes.normalize)(value);
|
||||
if (!isParsableCssValue(property, normalized)) {
|
||||
return null;
|
||||
}
|
||||
let sort = context.offsets.arbitraryProperty();
|
||||
return [
|
||||
[
|
||||
{
|
||||
sort,
|
||||
layer: "utilities"
|
||||
},
|
||||
()=>({
|
||||
[(0, _nameClass.asClass)(classCandidate)]: {
|
||||
[property]: normalized
|
||||
}
|
||||
})
|
||||
]
|
||||
];
|
||||
}
|
||||
function* resolveMatchedPlugins(classCandidate, context) {
|
||||
if (context.candidateRuleMap.has(classCandidate)) {
|
||||
yield [
|
||||
context.candidateRuleMap.get(classCandidate),
|
||||
"DEFAULT"
|
||||
];
|
||||
}
|
||||
yield* function*(arbitraryPropertyRule) {
|
||||
if (arbitraryPropertyRule !== null) {
|
||||
yield [
|
||||
arbitraryPropertyRule,
|
||||
"DEFAULT"
|
||||
];
|
||||
}
|
||||
}(extractArbitraryProperty(classCandidate, context));
|
||||
let candidatePrefix = classCandidate;
|
||||
let negative = false;
|
||||
const twConfigPrefix = context.tailwindConfig.prefix;
|
||||
const twConfigPrefixLen = twConfigPrefix.length;
|
||||
const hasMatchingPrefix = candidatePrefix.startsWith(twConfigPrefix) || candidatePrefix.startsWith(`-${twConfigPrefix}`);
|
||||
if (candidatePrefix[twConfigPrefixLen] === "-" && hasMatchingPrefix) {
|
||||
negative = true;
|
||||
candidatePrefix = twConfigPrefix + candidatePrefix.slice(twConfigPrefixLen + 1);
|
||||
}
|
||||
if (negative && context.candidateRuleMap.has(candidatePrefix)) {
|
||||
yield [
|
||||
context.candidateRuleMap.get(candidatePrefix),
|
||||
"-DEFAULT"
|
||||
];
|
||||
}
|
||||
for (let [prefix, modifier] of candidatePermutations(candidatePrefix)){
|
||||
if (context.candidateRuleMap.has(prefix)) {
|
||||
yield [
|
||||
context.candidateRuleMap.get(prefix),
|
||||
negative ? `-${modifier}` : modifier
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
function splitWithSeparator(input, separator) {
|
||||
if (input === _sharedState.NOT_ON_DEMAND) {
|
||||
return [
|
||||
_sharedState.NOT_ON_DEMAND
|
||||
];
|
||||
}
|
||||
return (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(input, separator);
|
||||
}
|
||||
function* recordCandidates(matches, classCandidate) {
|
||||
for (const match of matches){
|
||||
var ref;
|
||||
var ref1;
|
||||
match[1].raws.tailwind = {
|
||||
...match[1].raws.tailwind,
|
||||
classCandidate,
|
||||
preserveSource: (ref1 = (ref = match[0].options) === null || ref === void 0 ? void 0 : ref.preserveSource) !== null && ref1 !== void 0 ? ref1 : false
|
||||
};
|
||||
yield match;
|
||||
}
|
||||
}
|
||||
function* resolveMatches(candidate, context, original = candidate) {
|
||||
let separator = context.tailwindConfig.separator;
|
||||
let [classCandidate, ...variants] = splitWithSeparator(candidate, separator).reverse();
|
||||
let important = false;
|
||||
if (classCandidate.startsWith("!")) {
|
||||
important = true;
|
||||
classCandidate = classCandidate.slice(1);
|
||||
}
|
||||
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping")) {
|
||||
if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
|
||||
let base = variants.slice().reverse().join(separator);
|
||||
for (let part of (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
|
||||
yield* resolveMatches(base + separator + part, context, original);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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 typesByMatches = new Map();
|
||||
let [plugins, modifier] = matchedPlugins;
|
||||
let isOnlyPlugin = plugins.length === 1;
|
||||
for (let [sort, plugin] of plugins){
|
||||
let matchesPerPlugin = [];
|
||||
if (typeof plugin === "function") {
|
||||
for (let ruleSet of [].concat(plugin(modifier, {
|
||||
isOnlyPlugin
|
||||
}))){
|
||||
let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
|
||||
for (let rule of rules){
|
||||
matchesPerPlugin.push([
|
||||
{
|
||||
...sort,
|
||||
options: {
|
||||
...sort.options,
|
||||
...options
|
||||
}
|
||||
},
|
||||
rule
|
||||
]);
|
||||
}
|
||||
}
|
||||
} else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
|
||||
let ruleSet1 = plugin;
|
||||
let [rules1, options1] = parseRules(ruleSet1, context.postCssNodeCache);
|
||||
for (let rule1 of rules1){
|
||||
matchesPerPlugin.push([
|
||||
{
|
||||
...sort,
|
||||
options: {
|
||||
...sort.options,
|
||||
...options1
|
||||
}
|
||||
},
|
||||
rule1
|
||||
]);
|
||||
}
|
||||
}
|
||||
if (matchesPerPlugin.length > 0) {
|
||||
var ref;
|
||||
var ref1, _options;
|
||||
let matchingTypes = Array.from((0, _pluginUtils.getMatchingTypes)((ref1 = (ref = sort.options) === null || ref === void 0 ? void 0 : ref.types) !== null && ref1 !== void 0 ? ref1 : [], modifier, (_options = sort.options) !== null && _options !== void 0 ? _options : {}, context.tailwindConfig)).map(([_, type])=>type);
|
||||
if (matchingTypes.length > 0) {
|
||||
typesByMatches.set(matchesPerPlugin, matchingTypes);
|
||||
}
|
||||
matches.push(matchesPerPlugin);
|
||||
}
|
||||
}
|
||||
if (isArbitraryValue(modifier)) {
|
||||
if (matches.length > 1) {
|
||||
// Partition plugins in 2 categories so that we can start searching in the plugins that
|
||||
// don't have `any` as a type first.
|
||||
let [withAny, withoutAny] = matches.reduce((group, plugin)=>{
|
||||
let hasAnyType = plugin.some(([{ options }])=>options.types.some(({ type })=>type === "any"));
|
||||
if (hasAnyType) {
|
||||
group[0].push(plugin);
|
||||
} else {
|
||||
group[1].push(plugin);
|
||||
}
|
||||
return group;
|
||||
}, [
|
||||
[],
|
||||
[]
|
||||
]);
|
||||
function findFallback(matches) {
|
||||
// If only a single plugin matches, let's take that one
|
||||
if (matches.length === 1) {
|
||||
return matches[0];
|
||||
}
|
||||
// Otherwise, find the plugin that creates a valid rule given the arbitrary value, and
|
||||
// also has the correct type which preferOnConflicts the plugin in case of clashes.
|
||||
return matches.find((rules)=>{
|
||||
let matchingTypes = typesByMatches.get(rules);
|
||||
return rules.some(([{ options }, rule])=>{
|
||||
if (!isParsableNode(rule)) {
|
||||
return false;
|
||||
}
|
||||
return options.types.some(({ type , preferOnConflict })=>matchingTypes.includes(type) && preferOnConflict);
|
||||
});
|
||||
});
|
||||
}
|
||||
var ref2;
|
||||
// Try to find a fallback plugin, because we already know that multiple plugins matched for
|
||||
// the given arbitrary value.
|
||||
let fallback = (ref2 = findFallback(withoutAny)) !== null && ref2 !== void 0 ? ref2 : findFallback(withAny);
|
||||
if (fallback) {
|
||||
matches = [
|
||||
fallback
|
||||
];
|
||||
} else {
|
||||
var ref3;
|
||||
let typesPerPlugin = matches.map((match)=>new Set([
|
||||
...(ref3 = typesByMatches.get(match)) !== null && ref3 !== void 0 ? ref3 : []
|
||||
]));
|
||||
// Remove duplicates, so that we can detect proper unique types for each plugin.
|
||||
for (let pluginTypes of typesPerPlugin){
|
||||
for (let type of pluginTypes){
|
||||
let removeFromOwnGroup = false;
|
||||
for (let otherGroup of typesPerPlugin){
|
||||
if (pluginTypes === otherGroup) continue;
|
||||
if (otherGroup.has(type)) {
|
||||
otherGroup.delete(type);
|
||||
removeFromOwnGroup = true;
|
||||
}
|
||||
}
|
||||
if (removeFromOwnGroup) pluginTypes.delete(type);
|
||||
}
|
||||
}
|
||||
let messages = [];
|
||||
for (let [idx, group] of typesPerPlugin.entries()){
|
||||
for (let type1 of group){
|
||||
let rules2 = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
|
||||
.map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
|
||||
.join("\n")).join("\n\n");
|
||||
messages.push(` Use \`${candidate.replace("[", `[${type1}:`)}\` for \`${rules2.trim()}\``);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_log.default.warn([
|
||||
`The class \`${candidate}\` is ambiguous and matches multiple utilities.`,
|
||||
...messages,
|
||||
`If this is content and not a class, replace it with \`${candidate.replace("[", "[").replace("]", "]")}\` to silence this warning.`
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
matches = matches.map((list)=>list.filter((match)=>isParsableNode(match[1])));
|
||||
}
|
||||
matches = matches.flat();
|
||||
matches = Array.from(recordCandidates(matches, classCandidate));
|
||||
matches = applyPrefix(matches, context);
|
||||
if (important) {
|
||||
matches = applyImportant(matches, classCandidate);
|
||||
}
|
||||
for (let variant of variants){
|
||||
matches = applyVariant(variant, matches, context);
|
||||
}
|
||||
for (let match of matches){
|
||||
match[1].raws.tailwind = {
|
||||
...match[1].raws.tailwind,
|
||||
candidate
|
||||
};
|
||||
// Apply final format selector
|
||||
if (match[0].collectedFormats) {
|
||||
let finalFormat = (0, _formatVariantSelector.formatVariantSelector)("&", ...match[0].collectedFormats);
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
match[1].clone()
|
||||
]
|
||||
});
|
||||
container.walkRules((rule)=>{
|
||||
var ref;
|
||||
if (inKeyframes(rule)) return;
|
||||
var ref1;
|
||||
rule.selector = (0, _formatVariantSelector.finalizeSelector)(finalFormat, {
|
||||
selector: rule.selector,
|
||||
candidate: original,
|
||||
base: candidate.split(new RegExp(`\\${(ref1 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref1 !== void 0 ? ref1 : ":"}(?![^[]*\\])`)).pop(),
|
||||
isArbitraryVariant: match[0].isArbitraryVariant,
|
||||
context
|
||||
});
|
||||
});
|
||||
match[1] = container.nodes[0];
|
||||
}
|
||||
yield match;
|
||||
}
|
||||
}
|
||||
}
|
||||
function inKeyframes(rule) {
|
||||
return rule.parent && rule.parent.type === "atrule" && rule.parent.name === "keyframes";
|
||||
}
|
||||
function getImportantStrategy(important) {
|
||||
if (important === true) {
|
||||
return (rule)=>{
|
||||
if (inKeyframes(rule)) {
|
||||
return;
|
||||
}
|
||||
rule.walkDecls((d)=>{
|
||||
if (d.parent.type === "rule" && !inKeyframes(d.parent)) {
|
||||
d.important = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
if (typeof important === "string") {
|
||||
return (rule)=>{
|
||||
if (inKeyframes(rule)) {
|
||||
return;
|
||||
}
|
||||
rule.selectors = rule.selectors.map((selector)=>{
|
||||
return `${important} ${selector}`;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
function generateRules(candidates, context) {
|
||||
let allRules = [];
|
||||
let strategy = getImportantStrategy(context.tailwindConfig.important);
|
||||
for (let candidate of candidates){
|
||||
if (context.notClassCache.has(candidate)) {
|
||||
continue;
|
||||
}
|
||||
if (context.candidateRuleCache.has(candidate)) {
|
||||
allRules = allRules.concat(Array.from(context.candidateRuleCache.get(candidate)));
|
||||
continue;
|
||||
}
|
||||
let matches = Array.from(resolveMatches(candidate, context));
|
||||
if (matches.length === 0) {
|
||||
context.notClassCache.add(candidate);
|
||||
continue;
|
||||
}
|
||||
context.classCache.set(candidate, matches);
|
||||
var ref;
|
||||
let rules = (ref = context.candidateRuleCache.get(candidate)) !== null && ref !== void 0 ? ref : new Set();
|
||||
context.candidateRuleCache.set(candidate, rules);
|
||||
for (const match of matches){
|
||||
let [{ sort , options }, rule] = match;
|
||||
if (options.respectImportant && strategy) {
|
||||
let container = _postcss.default.root({
|
||||
nodes: [
|
||||
rule.clone()
|
||||
]
|
||||
});
|
||||
container.walkRules(strategy);
|
||||
rule = container.nodes[0];
|
||||
}
|
||||
let newEntry = [
|
||||
sort,
|
||||
rule
|
||||
];
|
||||
rules.add(newEntry);
|
||||
context.ruleCache.add(newEntry);
|
||||
allRules.push(newEntry);
|
||||
}
|
||||
}
|
||||
return allRules;
|
||||
}
|
||||
function isArbitraryValue(input) {
|
||||
return input.startsWith("[") && input.endsWith("]");
|
||||
}
|
||||
51
node_modules/tailwindcss/lib/lib/getModuleDependencies.js
generated
vendored
Normal file
51
node_modules/tailwindcss/lib/lib/getModuleDependencies.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>getModuleDependencies
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
const _resolve = /*#__PURE__*/ _interopRequireDefault(require("resolve"));
|
||||
const _detective = /*#__PURE__*/ _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;
|
||||
}
|
||||
87
node_modules/tailwindcss/lib/lib/normalizeTailwindDirectives.js
generated
vendored
Normal file
87
node_modules/tailwindcss/lib/lib/normalizeTailwindDirectives.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>normalizeTailwindDirectives
|
||||
});
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function normalizeTailwindDirectives(root) {
|
||||
let tailwindDirectives = new Set();
|
||||
let layerDirectives = new Set();
|
||||
let applyDirectives = new Set();
|
||||
root.walkAtRules((atRule)=>{
|
||||
if (atRule.name === "apply") {
|
||||
applyDirectives.add(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)) {
|
||||
if ([
|
||||
"responsive",
|
||||
"variants"
|
||||
].includes(atRule.name)) {
|
||||
_log.default.warn(`${atRule.name}-at-rule-deprecated`, [
|
||||
`The \`@${atRule.name}\` directive has been deprecated in Tailwind CSS v3.0.`,
|
||||
`Use \`@layer utilities\` or \`@layer components\` instead.`,
|
||||
"https://tailwindcss.com/docs/upgrade-guide#replace-variants-with-layer"
|
||||
]);
|
||||
}
|
||||
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,
|
||||
applyDirectives
|
||||
};
|
||||
}
|
||||
217
node_modules/tailwindcss/lib/lib/offsets.js
generated
vendored
Normal file
217
node_modules/tailwindcss/lib/lib/offsets.js
generated
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
// @ts-check
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Offsets", {
|
||||
enumerable: true,
|
||||
get: ()=>Offsets
|
||||
});
|
||||
const _bigSign = /*#__PURE__*/ _interopRequireDefault(require("../util/bigSign"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
class Offsets {
|
||||
constructor(){
|
||||
/**
|
||||
* Offsets for the next rule in a given layer
|
||||
*
|
||||
* @type {Record<Layer, bigint>}
|
||||
*/ this.offsets = {
|
||||
defaults: 0n,
|
||||
base: 0n,
|
||||
components: 0n,
|
||||
utilities: 0n,
|
||||
variants: 0n,
|
||||
user: 0n
|
||||
};
|
||||
/**
|
||||
* Positions for a given layer
|
||||
*
|
||||
* @type {Record<Layer, bigint>}
|
||||
*/ this.layerPositions = {
|
||||
defaults: 0n,
|
||||
base: 1n,
|
||||
components: 2n,
|
||||
utilities: 3n,
|
||||
// There isn't technically a "user" layer, but we need to give it a position
|
||||
// Because it's used for ordering user-css from @apply
|
||||
user: 4n,
|
||||
variants: 5n
|
||||
};
|
||||
/**
|
||||
* The total number of functions currently registered across all variants (including arbitrary variants)
|
||||
*
|
||||
* @type {bigint}
|
||||
*/ this.reservedVariantBits = 0n;
|
||||
/**
|
||||
* Positions for a given variant
|
||||
*
|
||||
* @type {Map<string, bigint>}
|
||||
*/ this.variantOffsets = new Map();
|
||||
}
|
||||
/**
|
||||
* @param {Layer} layer
|
||||
* @returns {RuleOffset}
|
||||
*/ create(layer) {
|
||||
return {
|
||||
layer,
|
||||
parentLayer: layer,
|
||||
arbitrary: 0n,
|
||||
variants: 0n,
|
||||
parallelIndex: 0n,
|
||||
index: this.offsets[layer]++,
|
||||
options: []
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @returns {RuleOffset}
|
||||
*/ arbitraryProperty() {
|
||||
return {
|
||||
...this.create("utilities"),
|
||||
arbitrary: 1n
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Get the offset for a variant
|
||||
*
|
||||
* @param {string} variant
|
||||
* @param {number} index
|
||||
* @returns {RuleOffset}
|
||||
*/ forVariant(variant, index = 0) {
|
||||
let offset = this.variantOffsets.get(variant);
|
||||
if (offset === undefined) {
|
||||
throw new Error(`Cannot find offset for unknown variant ${variant}`);
|
||||
}
|
||||
return {
|
||||
...this.create("variants"),
|
||||
variants: offset << BigInt(index)
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param {RuleOffset} rule
|
||||
* @param {RuleOffset} variant
|
||||
* @param {VariantOption} options
|
||||
* @returns {RuleOffset}
|
||||
*/ applyVariantOffset(rule, variant, options) {
|
||||
return {
|
||||
...rule,
|
||||
layer: "variants",
|
||||
parentLayer: rule.layer === "variants" ? rule.parentLayer : rule.layer,
|
||||
variants: rule.variants | variant.variants,
|
||||
options: options.sort ? [].concat(options, rule.options) : rule.options,
|
||||
// TODO: Technically this is wrong. We should be handling parallel index on a per variant basis.
|
||||
// We'll take the max of all the parallel indexes for now.
|
||||
// @ts-ignore
|
||||
parallelIndex: max([
|
||||
rule.parallelIndex,
|
||||
variant.parallelIndex
|
||||
])
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param {RuleOffset} offset
|
||||
* @param {number} parallelIndex
|
||||
* @returns {RuleOffset}
|
||||
*/ applyParallelOffset(offset, parallelIndex) {
|
||||
return {
|
||||
...offset,
|
||||
parallelIndex: BigInt(parallelIndex)
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Each variant gets 1 bit per function / rule registered.
|
||||
* This is because multiple variants can be applied to a single rule and we need to know which ones are present and which ones are not.
|
||||
* Additionally, every unique group of variants is grouped together in the stylesheet.
|
||||
*
|
||||
* This grouping is order-independent. For instance, we do not differentiate between `hover:focus` and `focus:hover`.
|
||||
*
|
||||
* @param {string[]} variants
|
||||
* @param {(name: string) => number} getLength
|
||||
*/ recordVariants(variants, getLength) {
|
||||
for (let variant of variants){
|
||||
this.recordVariant(variant, getLength(variant));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The same as `recordVariants` but for a single arbitrary variant at runtime.
|
||||
* @param {string} variant
|
||||
* @param {number} fnCount
|
||||
*
|
||||
* @returns {RuleOffset} The highest offset for this variant
|
||||
*/ recordVariant(variant, fnCount = 1) {
|
||||
this.variantOffsets.set(variant, 1n << this.reservedVariantBits);
|
||||
// Ensure space is reserved for each "function" in the parallel variant
|
||||
// by offsetting the next variant by the number of parallel variants
|
||||
// in the one we just added.
|
||||
// Single functions that return parallel variants are NOT handled separately here
|
||||
// They're offset by 1 (or the number of functions) as usual
|
||||
// And each rule returned is tracked separately since the functions are evaluated lazily.
|
||||
// @see `RuleOffset.parallelIndex`
|
||||
this.reservedVariantBits += BigInt(fnCount);
|
||||
return {
|
||||
...this.create("variants"),
|
||||
variants: 1n << this.reservedVariantBits
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @param {RuleOffset} a
|
||||
* @param {RuleOffset} b
|
||||
* @returns {bigint}
|
||||
*/ compare(a, b) {
|
||||
// Sort layers together
|
||||
if (a.layer !== b.layer) {
|
||||
return this.layerPositions[a.layer] - this.layerPositions[b.layer];
|
||||
}
|
||||
// Sort based on the sorting function
|
||||
for (let aOptions of a.options){
|
||||
for (let bOptions of b.options){
|
||||
if (aOptions.id !== bOptions.id) continue;
|
||||
if (!aOptions.sort || !bOptions.sort) continue;
|
||||
let result = aOptions.sort({
|
||||
value: aOptions.value,
|
||||
modifier: aOptions.modifier
|
||||
}, {
|
||||
value: bOptions.value,
|
||||
modifier: bOptions.modifier
|
||||
});
|
||||
if (result !== 0) return result;
|
||||
}
|
||||
}
|
||||
// Sort variants in the order they were registered
|
||||
if (a.variants !== b.variants) {
|
||||
return a.variants - b.variants;
|
||||
}
|
||||
// Make sure each rule returned by a parallel variant is sorted in ascending order
|
||||
if (a.parallelIndex !== b.parallelIndex) {
|
||||
return a.parallelIndex - b.parallelIndex;
|
||||
}
|
||||
// Always sort arbitrary properties after other utilities
|
||||
if (a.arbitrary !== b.arbitrary) {
|
||||
return a.arbitrary - b.arbitrary;
|
||||
}
|
||||
// Sort utilities, components, etc… in the order they were registered
|
||||
return a.index - b.index;
|
||||
}
|
||||
/**
|
||||
* @template T
|
||||
* @param {[RuleOffset, T][]} list
|
||||
* @returns {[RuleOffset, T][]}
|
||||
*/ sort(list) {
|
||||
return list.sort(([a], [b])=>(0, _bigSign.default)(this.compare(a, b)));
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {bigint[]} nums
|
||||
* @returns {bigint|null}
|
||||
*/ function max(nums) {
|
||||
let max = null;
|
||||
for (const num of nums){
|
||||
max = max !== null && max !== void 0 ? max : num;
|
||||
max = max > num ? max : num;
|
||||
}
|
||||
return max;
|
||||
}
|
||||
56
node_modules/tailwindcss/lib/lib/partitionApplyAtRules.js
generated
vendored
Normal file
56
node_modules/tailwindcss/lib/lib/partitionApplyAtRules.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>expandApplyAtRules
|
||||
});
|
||||
function partitionRules(root) {
|
||||
if (!root.walkAtRules) return;
|
||||
let applyParents = new Set();
|
||||
root.walkAtRules("apply", (rule)=>{
|
||||
applyParents.add(rule.parent);
|
||||
});
|
||||
if (applyParents.size === 0) {
|
||||
return;
|
||||
}
|
||||
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 clone = rule.clone({
|
||||
nodes: []
|
||||
});
|
||||
clone.append(group);
|
||||
rule.after(clone);
|
||||
}
|
||||
rule.remove();
|
||||
}
|
||||
}
|
||||
function expandApplyAtRules() {
|
||||
return (root)=>{
|
||||
partitionRules(root);
|
||||
};
|
||||
}
|
||||
60
node_modules/tailwindcss/lib/lib/regex.js
generated
vendored
Normal file
60
node_modules/tailwindcss/lib/lib/regex.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
pattern: ()=>pattern,
|
||||
withoutCapturing: ()=>withoutCapturing,
|
||||
any: ()=>any,
|
||||
optional: ()=>optional,
|
||||
zeroOrMore: ()=>zeroOrMore,
|
||||
nestedBrackets: ()=>nestedBrackets,
|
||||
escape: ()=>escape
|
||||
});
|
||||
const REGEX_SPECIAL = /[\\^$.*+?()[\]{}|]/g;
|
||||
const REGEX_HAS_SPECIAL = RegExp(REGEX_SPECIAL.source);
|
||||
/**
|
||||
* @param {string|RegExp|Array<string|RegExp>} source
|
||||
*/ function toSource(source) {
|
||||
source = Array.isArray(source) ? source : [
|
||||
source
|
||||
];
|
||||
source = source.map((item)=>item instanceof RegExp ? item.source : item);
|
||||
return source.join("");
|
||||
}
|
||||
function pattern(source) {
|
||||
return new RegExp(toSource(source), "g");
|
||||
}
|
||||
function withoutCapturing(source) {
|
||||
return new RegExp(`(?:${toSource(source)})`, "g");
|
||||
}
|
||||
function any(sources) {
|
||||
return `(?:${sources.map(toSource).join("|")})`;
|
||||
}
|
||||
function optional(source) {
|
||||
return `(?:${toSource(source)})?`;
|
||||
}
|
||||
function zeroOrMore(source) {
|
||||
return `(?:${toSource(source)})*`;
|
||||
}
|
||||
function nestedBrackets(open, close, depth = 1) {
|
||||
return withoutCapturing([
|
||||
escape(open),
|
||||
/[^\s]*/,
|
||||
depth === 1 ? `[^${escape(open)}${escape(close)}\s]*` : any([
|
||||
`[^${escape(open)}${escape(close)}\s]*`,
|
||||
nestedBrackets(open, close, depth - 1)
|
||||
]),
|
||||
/[^\s]*/,
|
||||
escape(close)
|
||||
]);
|
||||
}
|
||||
function escape(string) {
|
||||
return string && REGEX_HAS_SPECIAL.test(string) ? string.replace(REGEX_SPECIAL, "\\$&") : string || "";
|
||||
}
|
||||
161
node_modules/tailwindcss/lib/lib/resolveDefaultsAtRules.js
generated
vendored
Normal file
161
node_modules/tailwindcss/lib/lib/resolveDefaultsAtRules.js
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
elementSelectorParser: ()=>elementSelectorParser,
|
||||
default: ()=>resolveDefaultsAtRules
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _featureFlags = require("../featureFlags");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
let getNode = {
|
||||
id (node) {
|
||||
return _postcssSelectorParser.default.attribute({
|
||||
attribute: "id",
|
||||
operator: "=",
|
||||
value: node.value,
|
||||
quoteMark: '"'
|
||||
});
|
||||
}
|
||||
};
|
||||
function minimumImpactSelector(nodes) {
|
||||
let rest = nodes.filter((node)=>{
|
||||
// Keep non-pseudo nodes
|
||||
if (node.type !== "pseudo") return true;
|
||||
// Keep pseudo nodes that have subnodes
|
||||
// E.g.: `:not()` contains subnodes inside the parentheses
|
||||
if (node.nodes.length > 0) return true;
|
||||
// Keep pseudo `elements`
|
||||
// This implicitly means that we ignore pseudo `classes`
|
||||
return node.value.startsWith("::") || [
|
||||
":before",
|
||||
":after",
|
||||
":first-line",
|
||||
":first-letter"
|
||||
].includes(node.value);
|
||||
}).reverse();
|
||||
let searchFor = new Set([
|
||||
"tag",
|
||||
"class",
|
||||
"id",
|
||||
"attribute"
|
||||
]);
|
||||
let splitPointIdx = rest.findIndex((n)=>searchFor.has(n.type));
|
||||
if (splitPointIdx === -1) return rest.reverse().join("").trim();
|
||||
let node = rest[splitPointIdx];
|
||||
let bestNode = getNode[node.type] ? getNode[node.type](node) : node;
|
||||
rest = rest.slice(0, splitPointIdx);
|
||||
let combinatorIdx = rest.findIndex((n)=>n.type === "combinator" && n.value === ">");
|
||||
if (combinatorIdx !== -1) {
|
||||
rest.splice(0, combinatorIdx);
|
||||
rest.unshift(_postcssSelectorParser.default.universal());
|
||||
}
|
||||
return [
|
||||
bestNode,
|
||||
...rest.reverse()
|
||||
].join("").trim();
|
||||
}
|
||||
let elementSelectorParser = (0, _postcssSelectorParser.default)((selectors)=>{
|
||||
return selectors.map((s)=>{
|
||||
let nodes = s.split((n)=>n.type === "combinator" && n.value === " ").pop();
|
||||
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();
|
||||
/** @type {Set<import('postcss').AtRule>} */ 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();
|
||||
});
|
||||
if ((0, _featureFlags.flagEnabled)(tailwindConfig, "optimizeUniversalDefaults")) {
|
||||
for (let universal of universals){
|
||||
/** @type {Map<string, Set<string>>} */ let selectorGroups = new Map();
|
||||
var ref;
|
||||
let rules = (ref = variableNodeMap.get(universal.params)) !== null && ref !== void 0 ? ref : [];
|
||||
for (let rule of rules){
|
||||
for (let selector of extractElementSelector(rule.selector)){
|
||||
// If selector contains a vendor prefix after a pseudo element or class,
|
||||
// we consider them separately because merging the declarations into
|
||||
// a single rule will cause browsers that do not understand the
|
||||
// vendor prefix to throw out the whole rule
|
||||
let selectorGroupName = selector.includes(":-") || selector.includes("::-") ? selector : "__DEFAULT__";
|
||||
var ref1;
|
||||
let selectors = (ref1 = selectorGroups.get(selectorGroupName)) !== null && ref1 !== void 0 ? ref1 : new Set();
|
||||
selectorGroups.set(selectorGroupName, selectors);
|
||||
selectors.add(selector);
|
||||
}
|
||||
}
|
||||
if ((0, _featureFlags.flagEnabled)(tailwindConfig, "optimizeUniversalDefaults")) {
|
||||
if (selectorGroups.size === 0) {
|
||||
universal.remove();
|
||||
continue;
|
||||
}
|
||||
for (let [, selectors1] of selectorGroups){
|
||||
let universalRule = _postcss.default.rule({
|
||||
source: universal.source
|
||||
});
|
||||
universalRule.selectors = [
|
||||
...selectors1
|
||||
];
|
||||
universalRule.append(universal.nodes.map((node)=>node.clone()));
|
||||
universal.before(universalRule);
|
||||
}
|
||||
}
|
||||
universal.remove();
|
||||
}
|
||||
} else if (universals.size) {
|
||||
let universalRule1 = _postcss.default.rule({
|
||||
selectors: [
|
||||
"*",
|
||||
"::before",
|
||||
"::after"
|
||||
]
|
||||
});
|
||||
for (let universal1 of universals){
|
||||
universalRule1.append(universal1.nodes);
|
||||
if (!universalRule1.parent) {
|
||||
universal1.before(universalRule1);
|
||||
}
|
||||
if (!universalRule1.source) {
|
||||
universalRule1.source = universal1.source;
|
||||
}
|
||||
universal1.remove();
|
||||
}
|
||||
let backdropRule = universalRule1.clone({
|
||||
selectors: [
|
||||
"::backdrop"
|
||||
]
|
||||
});
|
||||
universalRule1.after(backdropRule);
|
||||
}
|
||||
};
|
||||
}
|
||||
1196
node_modules/tailwindcss/lib/lib/setupContextUtils.js
generated
vendored
Normal file
1196
node_modules/tailwindcss/lib/lib/setupContextUtils.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
142
node_modules/tailwindcss/lib/lib/setupTrackingContext.js
generated
vendored
Normal file
142
node_modules/tailwindcss/lib/lib/setupTrackingContext.js
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, // 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
|
||||
"default", {
|
||||
enumerable: true,
|
||||
get: ()=>setupTrackingContext
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _quickLru = /*#__PURE__*/ _interopRequireDefault(require("quick-lru"));
|
||||
const _hashConfig = /*#__PURE__*/ _interopRequireDefault(require("../util/hashConfig"));
|
||||
const _getModuleDependencies = /*#__PURE__*/ _interopRequireDefault(require("../lib/getModuleDependencies"));
|
||||
const _resolveConfig = /*#__PURE__*/ _interopRequireDefault(require("../public/resolve-config"));
|
||||
const _resolveConfigPath = /*#__PURE__*/ _interopRequireDefault(require("../util/resolveConfigPath"));
|
||||
const _setupContextUtils = require("./setupContextUtils");
|
||||
const _parseDependency = /*#__PURE__*/ _interopRequireDefault(require("../util/parseDependency"));
|
||||
const _validateConfigJs = require("../util/validateConfig.js");
|
||||
const _contentJs = require("./content.js");
|
||||
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 candidateFiles = (0, _contentJs.parseCandidateFiles)(context, tailwindConfig);
|
||||
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 file1 of newDeps){
|
||||
delete require.cache[file1];
|
||||
}
|
||||
let newConfig = (0, _resolveConfig.default)(require(userConfigPath));
|
||||
newConfig = (0, _validateConfigJs.validateConfig)(newConfig);
|
||||
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 newConfig1 = (0, _resolveConfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
|
||||
newConfig1 = (0, _validateConfigJs.validateConfig)(newConfig1);
|
||||
return [
|
||||
newConfig1,
|
||||
null,
|
||||
(0, _hashConfig.default)(newConfig1),
|
||||
[]
|
||||
];
|
||||
}
|
||||
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 or @apply rules, we don't consider this CSS
|
||||
// file or its 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)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
||||
let candidateFiles = getCandidateFiles(context, tailwindConfig);
|
||||
// If there are no @tailwind or @apply 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 contentPath of candidateFiles){
|
||||
for (let dependency of (0, _parseDependency.default)(contentPath)){
|
||||
registerDependency(dependency);
|
||||
}
|
||||
}
|
||||
for (let changedContent of (0, _contentJs.resolvedChangedContent)(context, candidateFiles, fileModifiedMap)){
|
||||
context.changedContent.push(changedContent);
|
||||
}
|
||||
}
|
||||
for (let file of configDependencies){
|
||||
registerDependency({
|
||||
type: "dependency",
|
||||
file
|
||||
});
|
||||
}
|
||||
return context;
|
||||
};
|
||||
};
|
||||
}
|
||||
60
node_modules/tailwindcss/lib/lib/sharedState.js
generated
vendored
Normal file
60
node_modules/tailwindcss/lib/lib/sharedState.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
env: ()=>env,
|
||||
contextMap: ()=>contextMap,
|
||||
configContextMap: ()=>configContextMap,
|
||||
contextSourcesMap: ()=>contextSourcesMap,
|
||||
sourceHashMap: ()=>sourceHashMap,
|
||||
NOT_ON_DEMAND: ()=>NOT_ON_DEMAND,
|
||||
NONE: ()=>NONE,
|
||||
resolveDebug: ()=>resolveDebug
|
||||
});
|
||||
const env = {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
DEBUG: resolveDebug(process.env.DEBUG)
|
||||
};
|
||||
const contextMap = new Map();
|
||||
const configContextMap = new Map();
|
||||
const contextSourcesMap = new Map();
|
||||
const sourceHashMap = new Map();
|
||||
const NOT_ON_DEMAND = new String("*");
|
||||
const NONE = Symbol("__NONE__");
|
||||
function resolveDebug(debug) {
|
||||
if (debug === undefined) {
|
||||
return false;
|
||||
}
|
||||
// Environment variables are strings, so convert to boolean
|
||||
if (debug === "true" || debug === "1") {
|
||||
return true;
|
||||
}
|
||||
if (debug === "false" || debug === "0") {
|
||||
return false;
|
||||
}
|
||||
// Keep the debug convention into account:
|
||||
// DEBUG=* -> This enables all debug modes
|
||||
// DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
|
||||
// DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
|
||||
// DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
|
||||
if (debug === "*") {
|
||||
return true;
|
||||
}
|
||||
let debuggers = debug.split(",").map((d)=>d.split(":")[0]);
|
||||
// Ignoring tailwindcss
|
||||
if (debuggers.includes("-tailwindcss")) {
|
||||
return false;
|
||||
}
|
||||
// Including tailwindcss
|
||||
if (debuggers.includes("tailwindcss")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
29
node_modules/tailwindcss/lib/lib/substituteScreenAtRules.js
generated
vendored
Normal file
29
node_modules/tailwindcss/lib/lib/substituteScreenAtRules.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _normalizeScreens = require("../util/normalizeScreens");
|
||||
const _buildMediaQuery = /*#__PURE__*/ _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)=>{
|
||||
let screen = atRule.params;
|
||||
let screens = (0, _normalizeScreens.normalizeScreens)(theme.screens);
|
||||
let screenDefinition = screens.find(({ name })=>name === screen);
|
||||
if (!screenDefinition) {
|
||||
throw atRule.error(`No \`${screen}\` screen found.`);
|
||||
}
|
||||
atRule.name = "media";
|
||||
atRule.params = (0, _buildMediaQuery.default)(screenDefinition);
|
||||
});
|
||||
};
|
||||
}
|
||||
42
node_modules/tailwindcss/lib/postcss-plugins/nesting/README.md
generated
vendored
Normal file
42
node_modules/tailwindcss/lib/postcss-plugins/nesting/README.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# tailwindcss/nesting
|
||||
|
||||
This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
|
||||
|
||||
Add it to your PostCSS configuration, somewhere before Tailwind itself:
|
||||
|
||||
```js
|
||||
// postcss.config.js
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('postcss-import'),
|
||||
require('tailwindcss/nesting'),
|
||||
require('tailwindcss'),
|
||||
require('autoprefixer'),
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
|
||||
|
||||
If you'd rather use [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
|
||||
|
||||
```shell
|
||||
npm install postcss-nesting
|
||||
```
|
||||
|
||||
Then pass the plugin itself as an argument to `tailwindcss/nesting` in your PostCSS configuration:
|
||||
|
||||
```js
|
||||
// postcss.config.js
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('postcss-import'),
|
||||
require('tailwindcss/nesting')(require('postcss-nesting')),
|
||||
require('tailwindcss'),
|
||||
require('autoprefixer'),
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This can also be helpful if for whatever reason you need to use a very specific version of `postcss-nested` and want to override the version we bundle with `tailwindcss/nesting` itself.
|
||||
|
||||
19
node_modules/tailwindcss/lib/postcss-plugins/nesting/index.js
generated
vendored
Normal file
19
node_modules/tailwindcss/lib/postcss-plugins/nesting/index.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _plugin = require("./plugin");
|
||||
const _default = Object.assign(function(opts) {
|
||||
return {
|
||||
postcssPlugin: "tailwindcss/nesting",
|
||||
Once (root, { result }) {
|
||||
return (0, _plugin.nesting)(opts)(root, result);
|
||||
}
|
||||
};
|
||||
}, {
|
||||
postcss: true
|
||||
});
|
||||
87
node_modules/tailwindcss/lib/postcss-plugins/nesting/plugin.js
generated
vendored
Normal file
87
node_modules/tailwindcss/lib/postcss-plugins/nesting/plugin.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "nesting", {
|
||||
enumerable: true,
|
||||
get: ()=>nesting
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _postcssNested = /*#__PURE__*/ _interopRequireDefault(require("postcss-nested"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function nesting(opts = _postcssNested.default) {
|
||||
return (root, result)=>{
|
||||
root.walkAtRules("screen", (rule)=>{
|
||||
rule.name = "media";
|
||||
rule.params = `screen(${rule.params})`;
|
||||
});
|
||||
root.walkAtRules("apply", (rule)=>{
|
||||
rule.before(_postcss.default.decl({
|
||||
prop: "__apply",
|
||||
value: rule.params,
|
||||
source: rule.source
|
||||
}));
|
||||
rule.remove();
|
||||
});
|
||||
let plugin = (()=>{
|
||||
var ref;
|
||||
if (typeof opts === "function" || typeof opts === "object" && (opts === null || opts === void 0 ? void 0 : (ref = opts.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(opts, "postcssPlugin"))) {
|
||||
return opts;
|
||||
}
|
||||
if (typeof opts === "string") {
|
||||
return require(opts);
|
||||
}
|
||||
if (Object.keys(opts).length <= 0) {
|
||||
return _postcssNested.default;
|
||||
}
|
||||
throw new Error("tailwindcss/nesting should be loaded with a nesting plugin.");
|
||||
})();
|
||||
(0, _postcss.default)([
|
||||
plugin
|
||||
]).process(root, result.opts).sync();
|
||||
root.walkDecls("__apply", (decl)=>{
|
||||
decl.before(_postcss.default.atRule({
|
||||
name: "apply",
|
||||
params: decl.value,
|
||||
source: decl.source
|
||||
}));
|
||||
decl.remove();
|
||||
});
|
||||
/**
|
||||
* Use a private PostCSS API to remove the "clean" flag from the entire AST.
|
||||
* This is done because running process() on the AST will set the "clean"
|
||||
* flag on all nodes, which we don't want.
|
||||
*
|
||||
* This causes downstream plugins using the visitor API to be skipped.
|
||||
*
|
||||
* This is guarded because the PostCSS API is not public
|
||||
* and may change in future versions of PostCSS.
|
||||
*
|
||||
* See https://github.com/postcss/postcss/issues/1712 for more details
|
||||
*
|
||||
* @param {import('postcss').Node} node
|
||||
*/ function markDirty(node) {
|
||||
if (!("markDirty" in node)) {
|
||||
return;
|
||||
}
|
||||
// Traverse the tree down to the leaf nodes
|
||||
if (node.nodes) {
|
||||
node.nodes.forEach((n)=>markDirty(n));
|
||||
}
|
||||
// If it's a leaf node mark it as dirty
|
||||
// We do this here because marking a node as dirty
|
||||
// will walk up the tree and mark all parents as dirty
|
||||
// resulting in a lot of unnecessary work if we did this
|
||||
// for every single node
|
||||
if (!node.nodes) {
|
||||
node.markDirty();
|
||||
}
|
||||
}
|
||||
markDirty(root);
|
||||
return root;
|
||||
};
|
||||
}
|
||||
62
node_modules/tailwindcss/lib/processTailwindFeatures.js
generated
vendored
Normal file
62
node_modules/tailwindcss/lib/processTailwindFeatures.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>processTailwindFeatures
|
||||
});
|
||||
const _normalizeTailwindDirectives = /*#__PURE__*/ _interopRequireDefault(require("./lib/normalizeTailwindDirectives"));
|
||||
const _expandTailwindAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/expandTailwindAtRules"));
|
||||
const _expandApplyAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/expandApplyAtRules"));
|
||||
const _evaluateTailwindFunctions = /*#__PURE__*/ _interopRequireDefault(require("./lib/evaluateTailwindFunctions"));
|
||||
const _substituteScreenAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/substituteScreenAtRules"));
|
||||
const _resolveDefaultsAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/resolveDefaultsAtRules"));
|
||||
const _collapseAdjacentRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/collapseAdjacentRules"));
|
||||
const _collapseDuplicateDeclarations = /*#__PURE__*/ _interopRequireDefault(require("./lib/collapseDuplicateDeclarations"));
|
||||
const _partitionApplyAtRules = /*#__PURE__*/ _interopRequireDefault(require("./lib/partitionApplyAtRules"));
|
||||
const _detectNesting = /*#__PURE__*/ _interopRequireDefault(require("./lib/detectNesting"));
|
||||
const _setupContextUtils = require("./lib/setupContextUtils");
|
||||
const _featureFlags = require("./featureFlags");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function processTailwindFeatures(setupContext) {
|
||||
return function(root, result) {
|
||||
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root);
|
||||
(0, _detectNesting.default)()(root, result);
|
||||
// Partition apply rules that are found in the css
|
||||
// itself.
|
||||
(0, _partitionApplyAtRules.default)()(root, result);
|
||||
let context = setupContext({
|
||||
tailwindDirectives,
|
||||
applyDirectives,
|
||||
registerDependency (dependency) {
|
||||
result.messages.push({
|
||||
plugin: "tailwindcss",
|
||||
parent: result.opts.from,
|
||||
...dependency
|
||||
});
|
||||
},
|
||||
createContext (tailwindConfig, changedContent) {
|
||||
return (0, _setupContextUtils.createContext)(tailwindConfig, changedContent, 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, _featureFlags.issueFlagNotices)(context.tailwindConfig);
|
||||
(0, _expandTailwindAtRules.default)(context)(root, result);
|
||||
// Partition apply rules that are generated by
|
||||
// addComponents, addUtilities and so on.
|
||||
(0, _partitionApplyAtRules.default)()(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);
|
||||
(0, _collapseDuplicateDeclarations.default)(context)(root, result);
|
||||
};
|
||||
}
|
||||
331
node_modules/tailwindcss/lib/public/colors.js
generated
vendored
Normal file
331
node_modules/tailwindcss/lib/public/colors.js
generated
vendored
Normal file
@@ -0,0 +1,331 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function warn({ version , from , to }) {
|
||||
_log.default.warn(`${from}-color-renamed`, [
|
||||
`As of Tailwind CSS ${version}, \`${from}\` has been renamed to \`${to}\`.`,
|
||||
"Update your configuration file to silence this warning."
|
||||
]);
|
||||
}
|
||||
const _default = {
|
||||
inherit: "inherit",
|
||||
current: "currentColor",
|
||||
transparent: "transparent",
|
||||
black: "#000",
|
||||
white: "#fff",
|
||||
slate: {
|
||||
50: "#f8fafc",
|
||||
100: "#f1f5f9",
|
||||
200: "#e2e8f0",
|
||||
300: "#cbd5e1",
|
||||
400: "#94a3b8",
|
||||
500: "#64748b",
|
||||
600: "#475569",
|
||||
700: "#334155",
|
||||
800: "#1e293b",
|
||||
900: "#0f172a"
|
||||
},
|
||||
gray: {
|
||||
50: "#f9fafb",
|
||||
100: "#f3f4f6",
|
||||
200: "#e5e7eb",
|
||||
300: "#d1d5db",
|
||||
400: "#9ca3af",
|
||||
500: "#6b7280",
|
||||
600: "#4b5563",
|
||||
700: "#374151",
|
||||
800: "#1f2937",
|
||||
900: "#111827"
|
||||
},
|
||||
zinc: {
|
||||
50: "#fafafa",
|
||||
100: "#f4f4f5",
|
||||
200: "#e4e4e7",
|
||||
300: "#d4d4d8",
|
||||
400: "#a1a1aa",
|
||||
500: "#71717a",
|
||||
600: "#52525b",
|
||||
700: "#3f3f46",
|
||||
800: "#27272a",
|
||||
900: "#18181b"
|
||||
},
|
||||
neutral: {
|
||||
50: "#fafafa",
|
||||
100: "#f5f5f5",
|
||||
200: "#e5e5e5",
|
||||
300: "#d4d4d4",
|
||||
400: "#a3a3a3",
|
||||
500: "#737373",
|
||||
600: "#525252",
|
||||
700: "#404040",
|
||||
800: "#262626",
|
||||
900: "#171717"
|
||||
},
|
||||
stone: {
|
||||
50: "#fafaf9",
|
||||
100: "#f5f5f4",
|
||||
200: "#e7e5e4",
|
||||
300: "#d6d3d1",
|
||||
400: "#a8a29e",
|
||||
500: "#78716c",
|
||||
600: "#57534e",
|
||||
700: "#44403c",
|
||||
800: "#292524",
|
||||
900: "#1c1917"
|
||||
},
|
||||
red: {
|
||||
50: "#fef2f2",
|
||||
100: "#fee2e2",
|
||||
200: "#fecaca",
|
||||
300: "#fca5a5",
|
||||
400: "#f87171",
|
||||
500: "#ef4444",
|
||||
600: "#dc2626",
|
||||
700: "#b91c1c",
|
||||
800: "#991b1b",
|
||||
900: "#7f1d1d"
|
||||
},
|
||||
orange: {
|
||||
50: "#fff7ed",
|
||||
100: "#ffedd5",
|
||||
200: "#fed7aa",
|
||||
300: "#fdba74",
|
||||
400: "#fb923c",
|
||||
500: "#f97316",
|
||||
600: "#ea580c",
|
||||
700: "#c2410c",
|
||||
800: "#9a3412",
|
||||
900: "#7c2d12"
|
||||
},
|
||||
amber: {
|
||||
50: "#fffbeb",
|
||||
100: "#fef3c7",
|
||||
200: "#fde68a",
|
||||
300: "#fcd34d",
|
||||
400: "#fbbf24",
|
||||
500: "#f59e0b",
|
||||
600: "#d97706",
|
||||
700: "#b45309",
|
||||
800: "#92400e",
|
||||
900: "#78350f"
|
||||
},
|
||||
yellow: {
|
||||
50: "#fefce8",
|
||||
100: "#fef9c3",
|
||||
200: "#fef08a",
|
||||
300: "#fde047",
|
||||
400: "#facc15",
|
||||
500: "#eab308",
|
||||
600: "#ca8a04",
|
||||
700: "#a16207",
|
||||
800: "#854d0e",
|
||||
900: "#713f12"
|
||||
},
|
||||
lime: {
|
||||
50: "#f7fee7",
|
||||
100: "#ecfccb",
|
||||
200: "#d9f99d",
|
||||
300: "#bef264",
|
||||
400: "#a3e635",
|
||||
500: "#84cc16",
|
||||
600: "#65a30d",
|
||||
700: "#4d7c0f",
|
||||
800: "#3f6212",
|
||||
900: "#365314"
|
||||
},
|
||||
green: {
|
||||
50: "#f0fdf4",
|
||||
100: "#dcfce7",
|
||||
200: "#bbf7d0",
|
||||
300: "#86efac",
|
||||
400: "#4ade80",
|
||||
500: "#22c55e",
|
||||
600: "#16a34a",
|
||||
700: "#15803d",
|
||||
800: "#166534",
|
||||
900: "#14532d"
|
||||
},
|
||||
emerald: {
|
||||
50: "#ecfdf5",
|
||||
100: "#d1fae5",
|
||||
200: "#a7f3d0",
|
||||
300: "#6ee7b7",
|
||||
400: "#34d399",
|
||||
500: "#10b981",
|
||||
600: "#059669",
|
||||
700: "#047857",
|
||||
800: "#065f46",
|
||||
900: "#064e3b"
|
||||
},
|
||||
teal: {
|
||||
50: "#f0fdfa",
|
||||
100: "#ccfbf1",
|
||||
200: "#99f6e4",
|
||||
300: "#5eead4",
|
||||
400: "#2dd4bf",
|
||||
500: "#14b8a6",
|
||||
600: "#0d9488",
|
||||
700: "#0f766e",
|
||||
800: "#115e59",
|
||||
900: "#134e4a"
|
||||
},
|
||||
cyan: {
|
||||
50: "#ecfeff",
|
||||
100: "#cffafe",
|
||||
200: "#a5f3fc",
|
||||
300: "#67e8f9",
|
||||
400: "#22d3ee",
|
||||
500: "#06b6d4",
|
||||
600: "#0891b2",
|
||||
700: "#0e7490",
|
||||
800: "#155e75",
|
||||
900: "#164e63"
|
||||
},
|
||||
sky: {
|
||||
50: "#f0f9ff",
|
||||
100: "#e0f2fe",
|
||||
200: "#bae6fd",
|
||||
300: "#7dd3fc",
|
||||
400: "#38bdf8",
|
||||
500: "#0ea5e9",
|
||||
600: "#0284c7",
|
||||
700: "#0369a1",
|
||||
800: "#075985",
|
||||
900: "#0c4a6e"
|
||||
},
|
||||
blue: {
|
||||
50: "#eff6ff",
|
||||
100: "#dbeafe",
|
||||
200: "#bfdbfe",
|
||||
300: "#93c5fd",
|
||||
400: "#60a5fa",
|
||||
500: "#3b82f6",
|
||||
600: "#2563eb",
|
||||
700: "#1d4ed8",
|
||||
800: "#1e40af",
|
||||
900: "#1e3a8a"
|
||||
},
|
||||
indigo: {
|
||||
50: "#eef2ff",
|
||||
100: "#e0e7ff",
|
||||
200: "#c7d2fe",
|
||||
300: "#a5b4fc",
|
||||
400: "#818cf8",
|
||||
500: "#6366f1",
|
||||
600: "#4f46e5",
|
||||
700: "#4338ca",
|
||||
800: "#3730a3",
|
||||
900: "#312e81"
|
||||
},
|
||||
violet: {
|
||||
50: "#f5f3ff",
|
||||
100: "#ede9fe",
|
||||
200: "#ddd6fe",
|
||||
300: "#c4b5fd",
|
||||
400: "#a78bfa",
|
||||
500: "#8b5cf6",
|
||||
600: "#7c3aed",
|
||||
700: "#6d28d9",
|
||||
800: "#5b21b6",
|
||||
900: "#4c1d95"
|
||||
},
|
||||
purple: {
|
||||
50: "#faf5ff",
|
||||
100: "#f3e8ff",
|
||||
200: "#e9d5ff",
|
||||
300: "#d8b4fe",
|
||||
400: "#c084fc",
|
||||
500: "#a855f7",
|
||||
600: "#9333ea",
|
||||
700: "#7e22ce",
|
||||
800: "#6b21a8",
|
||||
900: "#581c87"
|
||||
},
|
||||
fuchsia: {
|
||||
50: "#fdf4ff",
|
||||
100: "#fae8ff",
|
||||
200: "#f5d0fe",
|
||||
300: "#f0abfc",
|
||||
400: "#e879f9",
|
||||
500: "#d946ef",
|
||||
600: "#c026d3",
|
||||
700: "#a21caf",
|
||||
800: "#86198f",
|
||||
900: "#701a75"
|
||||
},
|
||||
pink: {
|
||||
50: "#fdf2f8",
|
||||
100: "#fce7f3",
|
||||
200: "#fbcfe8",
|
||||
300: "#f9a8d4",
|
||||
400: "#f472b6",
|
||||
500: "#ec4899",
|
||||
600: "#db2777",
|
||||
700: "#be185d",
|
||||
800: "#9d174d",
|
||||
900: "#831843"
|
||||
},
|
||||
rose: {
|
||||
50: "#fff1f2",
|
||||
100: "#ffe4e6",
|
||||
200: "#fecdd3",
|
||||
300: "#fda4af",
|
||||
400: "#fb7185",
|
||||
500: "#f43f5e",
|
||||
600: "#e11d48",
|
||||
700: "#be123c",
|
||||
800: "#9f1239",
|
||||
900: "#881337"
|
||||
},
|
||||
get lightBlue () {
|
||||
warn({
|
||||
version: "v2.2",
|
||||
from: "lightBlue",
|
||||
to: "sky"
|
||||
});
|
||||
return this.sky;
|
||||
},
|
||||
get warmGray () {
|
||||
warn({
|
||||
version: "v3.0",
|
||||
from: "warmGray",
|
||||
to: "stone"
|
||||
});
|
||||
return this.stone;
|
||||
},
|
||||
get trueGray () {
|
||||
warn({
|
||||
version: "v3.0",
|
||||
from: "trueGray",
|
||||
to: "neutral"
|
||||
});
|
||||
return this.neutral;
|
||||
},
|
||||
get coolGray () {
|
||||
warn({
|
||||
version: "v3.0",
|
||||
from: "coolGray",
|
||||
to: "gray"
|
||||
});
|
||||
return this.gray;
|
||||
},
|
||||
get blueGray () {
|
||||
warn({
|
||||
version: "v3.0",
|
||||
from: "blueGray",
|
||||
to: "slate"
|
||||
});
|
||||
return this.slate;
|
||||
}
|
||||
};
|
||||
15
node_modules/tailwindcss/lib/public/create-plugin.js
generated
vendored
Normal file
15
node_modules/tailwindcss/lib/public/create-plugin.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _createPlugin = /*#__PURE__*/ _interopRequireDefault(require("../util/createPlugin"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const _default = _createPlugin.default;
|
||||
16
node_modules/tailwindcss/lib/public/default-config.js
generated
vendored
Normal file
16
node_modules/tailwindcss/lib/public/default-config.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _cloneDeep = require("../util/cloneDeep");
|
||||
const _defaultConfigStub = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const _default = (0, _cloneDeep.cloneDeep)(_defaultConfigStub.default);
|
||||
16
node_modules/tailwindcss/lib/public/default-theme.js
generated
vendored
Normal file
16
node_modules/tailwindcss/lib/public/default-theme.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _cloneDeep = require("../util/cloneDeep");
|
||||
const _defaultConfigStub = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const _default = (0, _cloneDeep.cloneDeep)(_defaultConfigStub.default.theme);
|
||||
22
node_modules/tailwindcss/lib/public/resolve-config.js
generated
vendored
Normal file
22
node_modules/tailwindcss/lib/public/resolve-config.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>resolveConfig
|
||||
});
|
||||
const _resolveConfig = /*#__PURE__*/ _interopRequireDefault(require("../util/resolveConfig"));
|
||||
const _getAllConfigs = /*#__PURE__*/ _interopRequireDefault(require("../util/getAllConfigs"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function resolveConfig(...configs) {
|
||||
let [, ...defaultConfigs] = (0, _getAllConfigs.default)(configs[0]);
|
||||
return (0, _resolveConfig.default)([
|
||||
...configs,
|
||||
...defaultConfigs
|
||||
]);
|
||||
}
|
||||
11
node_modules/tailwindcss/lib/util/bigSign.js
generated
vendored
Normal file
11
node_modules/tailwindcss/lib/util/bigSign.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>bigSign
|
||||
});
|
||||
function bigSign(bigIntValue) {
|
||||
return (bigIntValue > 0n) - (bigIntValue < 0n);
|
||||
}
|
||||
25
node_modules/tailwindcss/lib/util/buildMediaQuery.js
generated
vendored
Normal file
25
node_modules/tailwindcss/lib/util/buildMediaQuery.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>buildMediaQuery
|
||||
});
|
||||
function buildMediaQuery(screens) {
|
||||
screens = Array.isArray(screens) ? screens : [
|
||||
screens
|
||||
];
|
||||
return screens.map((screen)=>{
|
||||
let values = screen.values.map((screen)=>{
|
||||
if (screen.raw !== undefined) {
|
||||
return screen.raw;
|
||||
}
|
||||
return [
|
||||
screen.min && `(min-width: ${screen.min})`,
|
||||
screen.max && `(max-width: ${screen.max})`
|
||||
].filter(Boolean).join(" and ");
|
||||
});
|
||||
return screen.not ? `not all and ${values}` : values;
|
||||
}).join(", ");
|
||||
}
|
||||
20
node_modules/tailwindcss/lib/util/cloneDeep.js
generated
vendored
Normal file
20
node_modules/tailwindcss/lib/util/cloneDeep.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "cloneDeep", {
|
||||
enumerable: true,
|
||||
get: ()=>cloneDeep
|
||||
});
|
||||
function cloneDeep(value) {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((child)=>cloneDeep(child));
|
||||
}
|
||||
if (typeof value === "object" && value !== null) {
|
||||
return Object.fromEntries(Object.entries(value).map(([k, v])=>[
|
||||
k,
|
||||
cloneDeep(v)
|
||||
]));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
32
node_modules/tailwindcss/lib/util/cloneNodes.js
generated
vendored
Normal file
32
node_modules/tailwindcss/lib/util/cloneNodes.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>cloneNodes
|
||||
});
|
||||
function cloneNodes(nodes, source = undefined, raws = undefined) {
|
||||
return nodes.map((node)=>{
|
||||
var ref;
|
||||
let cloned = node.clone();
|
||||
// We always want override the source map
|
||||
// except when explicitly told not to
|
||||
let shouldOverwriteSource = ((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.preserveSource) !== true || !cloned.source;
|
||||
if (source !== undefined && shouldOverwriteSource) {
|
||||
cloned.source = source;
|
||||
if ("walk" in cloned) {
|
||||
cloned.walk((child)=>{
|
||||
child.source = source;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (raws !== undefined) {
|
||||
cloned.raws.tailwind = {
|
||||
...cloned.raws.tailwind,
|
||||
...raws
|
||||
};
|
||||
}
|
||||
return cloned;
|
||||
});
|
||||
}
|
||||
98
node_modules/tailwindcss/lib/util/color.js
generated
vendored
Normal file
98
node_modules/tailwindcss/lib/util/color.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
parseColor: ()=>parseColor,
|
||||
formatColor: ()=>formatColor
|
||||
});
|
||||
const _colorName = /*#__PURE__*/ _interopRequireDefault(require("color-name"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
let HEX = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
|
||||
let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
|
||||
let VALUE = /(?:\d+|\d*\.\d+)%?/;
|
||||
let SEP = /(?:\s*,\s*|\s+)/;
|
||||
let ALPHA_SEP = /\s*[,/]\s*/;
|
||||
let CUSTOM_PROPERTY = /var\(--(?:[^ )]*?)\)/;
|
||||
let RGB = new RegExp(`^(rgb)a?\\(\\s*(${VALUE.source}|${CUSTOM_PROPERTY.source})(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`);
|
||||
let HSL = new RegExp(`^(hsl)a?\\(\\s*((?:${VALUE.source})(?:deg|rad|grad|turn)?|${CUSTOM_PROPERTY.source})(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?(?:${ALPHA_SEP.source}(${VALUE.source}|${CUSTOM_PROPERTY.source}))?\\s*\\)$`);
|
||||
function parseColor(value, { loose =false } = {}) {
|
||||
var ref, ref1;
|
||||
if (typeof value !== "string") {
|
||||
return null;
|
||||
}
|
||||
value = value.trim();
|
||||
if (value === "transparent") {
|
||||
return {
|
||||
mode: "rgb",
|
||||
color: [
|
||||
"0",
|
||||
"0",
|
||||
"0"
|
||||
],
|
||||
alpha: "0"
|
||||
};
|
||||
}
|
||||
if (value in _colorName.default) {
|
||||
return {
|
||||
mode: "rgb",
|
||||
color: _colorName.default[value].map((v)=>v.toString())
|
||||
};
|
||||
}
|
||||
let hex = value.replace(SHORT_HEX, (_, r, g, b, a)=>[
|
||||
"#",
|
||||
r,
|
||||
r,
|
||||
g,
|
||||
g,
|
||||
b,
|
||||
b,
|
||||
a ? a + a : ""
|
||||
].join("")).match(HEX);
|
||||
if (hex !== null) {
|
||||
return {
|
||||
mode: "rgb",
|
||||
color: [
|
||||
parseInt(hex[1], 16),
|
||||
parseInt(hex[2], 16),
|
||||
parseInt(hex[3], 16)
|
||||
].map((v)=>v.toString()),
|
||||
alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined
|
||||
};
|
||||
}
|
||||
var ref2;
|
||||
let match = (ref2 = value.match(RGB)) !== null && ref2 !== void 0 ? ref2 : value.match(HSL);
|
||||
if (match === null) {
|
||||
return null;
|
||||
}
|
||||
let color = [
|
||||
match[2],
|
||||
match[3],
|
||||
match[4]
|
||||
].filter(Boolean).map((v)=>v.toString());
|
||||
if (!loose && color.length !== 3) {
|
||||
return null;
|
||||
}
|
||||
if (color.length < 3 && !color.some((part)=>/^var\(.*?\)$/.test(part))) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
mode: match[1],
|
||||
color,
|
||||
alpha: (ref = match[5]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
|
||||
};
|
||||
}
|
||||
function formatColor({ mode , color , alpha }) {
|
||||
let hasAlpha = alpha !== undefined;
|
||||
return `${mode}(${color.join(" ")}${hasAlpha ? ` / ${alpha}` : ""})`;
|
||||
}
|
||||
21
node_modules/tailwindcss/lib/util/configurePlugins.js
generated
vendored
Normal file
21
node_modules/tailwindcss/lib/util/configurePlugins.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
function _default(pluginConfig, plugins) {
|
||||
if (pluginConfig === undefined) {
|
||||
return plugins;
|
||||
}
|
||||
const pluginNames = Array.isArray(pluginConfig) ? pluginConfig : [
|
||||
...new Set(plugins.filter((pluginName)=>{
|
||||
return pluginConfig !== false && pluginConfig[pluginName] !== false;
|
||||
}).concat(Object.keys(pluginConfig).filter((pluginName)=>{
|
||||
return pluginConfig[pluginName] !== false;
|
||||
})))
|
||||
];
|
||||
return pluginNames;
|
||||
}
|
||||
30
node_modules/tailwindcss/lib/util/createPlugin.js
generated
vendored
Normal file
30
node_modules/tailwindcss/lib/util/createPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
function createPlugin(plugin, config) {
|
||||
return {
|
||||
handler: plugin,
|
||||
config
|
||||
};
|
||||
}
|
||||
createPlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {
|
||||
const optionsFunction = function(options) {
|
||||
return {
|
||||
__options: options,
|
||||
handler: pluginFunction(options),
|
||||
config: configFunction(options)
|
||||
};
|
||||
};
|
||||
optionsFunction.__isOptionsFunction = true;
|
||||
// Expose plugin dependencies so that `object-hash` returns a different
|
||||
// value if anything here changes, to ensure a rebuild is triggered.
|
||||
optionsFunction.__pluginFunction = pluginFunction;
|
||||
optionsFunction.__configFunction = configFunction;
|
||||
return optionsFunction;
|
||||
};
|
||||
const _default = createPlugin;
|
||||
51
node_modules/tailwindcss/lib/util/createUtilityPlugin.js
generated
vendored
Normal file
51
node_modules/tailwindcss/lib/util/createUtilityPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>createUtilityPlugin
|
||||
});
|
||||
const _transformThemeValue = /*#__PURE__*/ _interopRequireDefault(require("./transformThemeValue"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function createUtilityPlugin(themeKey, utilityVariations = [
|
||||
[
|
||||
themeKey,
|
||||
[
|
||||
themeKey
|
||||
]
|
||||
]
|
||||
], { filterDefault =false , ...options } = {}) {
|
||||
let transformValue = (0, _transformThemeValue.default)(themeKey);
|
||||
return function({ matchUtilities , theme }) {
|
||||
for (let utilityVariation of utilityVariations){
|
||||
let group = Array.isArray(utilityVariation[0]) ? utilityVariation : [
|
||||
utilityVariation
|
||||
];
|
||||
var ref;
|
||||
matchUtilities(group.reduce((obj, [classPrefix, properties])=>{
|
||||
return Object.assign(obj, {
|
||||
[classPrefix]: (value)=>{
|
||||
return properties.reduce((obj, name)=>{
|
||||
if (Array.isArray(name)) {
|
||||
return Object.assign(obj, {
|
||||
[name[0]]: name[1]
|
||||
});
|
||||
}
|
||||
return Object.assign(obj, {
|
||||
[name]: transformValue(value)
|
||||
});
|
||||
}, {});
|
||||
}
|
||||
});
|
||||
}, {}), {
|
||||
...options,
|
||||
values: filterDefault ? Object.fromEntries(Object.entries((ref = theme(themeKey)) !== null && ref !== void 0 ? ref : {}).filter(([modifier])=>modifier !== "DEFAULT")) : theme(themeKey)
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
239
node_modules/tailwindcss/lib/util/dataTypes.js
generated
vendored
Normal file
239
node_modules/tailwindcss/lib/util/dataTypes.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
normalize: ()=>normalize,
|
||||
url: ()=>url,
|
||||
number: ()=>number,
|
||||
percentage: ()=>percentage,
|
||||
length: ()=>length,
|
||||
lineWidth: ()=>lineWidth,
|
||||
shadow: ()=>shadow,
|
||||
color: ()=>color,
|
||||
image: ()=>image,
|
||||
gradient: ()=>gradient,
|
||||
position: ()=>position,
|
||||
familyName: ()=>familyName,
|
||||
genericName: ()=>genericName,
|
||||
absoluteSize: ()=>absoluteSize,
|
||||
relativeSize: ()=>relativeSize
|
||||
});
|
||||
const _color = require("./color");
|
||||
const _parseBoxShadowValue = require("./parseBoxShadowValue");
|
||||
const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
|
||||
let cssFunctions = [
|
||||
"min",
|
||||
"max",
|
||||
"clamp",
|
||||
"calc"
|
||||
];
|
||||
// Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types
|
||||
function isCSSFunction(value) {
|
||||
return cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.*\\)`).test(value));
|
||||
}
|
||||
function normalize(value, isRoot = true) {
|
||||
// Keep raw strings if it starts with `url(`
|
||||
if (value.includes("url(")) {
|
||||
return value.split(/(url\(.*?\))/g).filter(Boolean).map((part)=>{
|
||||
if (/^url\(.*?\)$/.test(part)) {
|
||||
return part;
|
||||
}
|
||||
return normalize(part, false);
|
||||
}).join("");
|
||||
}
|
||||
// Convert `_` to ` `, except for escaped underscores `\_`
|
||||
value = value.replace(/([^\\])_+/g, (fullMatch, characterBefore)=>characterBefore + " ".repeat(fullMatch.length - 1)).replace(/^_/g, " ").replace(/\\_/g, "_");
|
||||
// Remove leftover whitespace
|
||||
if (isRoot) {
|
||||
value = value.trim();
|
||||
}
|
||||
// Add spaces around operators inside math functions like calc() that do not follow an operator
|
||||
// or '('.
|
||||
value = value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
|
||||
return match.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
|
||||
});
|
||||
return value;
|
||||
}
|
||||
function url(value) {
|
||||
return value.startsWith("url(");
|
||||
}
|
||||
function number(value) {
|
||||
return !isNaN(Number(value)) || isCSSFunction(value);
|
||||
}
|
||||
function percentage(value) {
|
||||
return value.endsWith("%") && number(value.slice(0, -1)) || isCSSFunction(value);
|
||||
}
|
||||
let lengthUnits = [
|
||||
"cm",
|
||||
"mm",
|
||||
"Q",
|
||||
"in",
|
||||
"pc",
|
||||
"pt",
|
||||
"px",
|
||||
"em",
|
||||
"ex",
|
||||
"ch",
|
||||
"rem",
|
||||
"lh",
|
||||
"vw",
|
||||
"vh",
|
||||
"vmin",
|
||||
"vmax"
|
||||
];
|
||||
let lengthUnitsPattern = `(?:${lengthUnits.join("|")})`;
|
||||
function length(value) {
|
||||
return value === "0" || new RegExp(`^[+-]?[0-9]*\.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`).test(value) || isCSSFunction(value);
|
||||
}
|
||||
let lineWidths = new Set([
|
||||
"thin",
|
||||
"medium",
|
||||
"thick"
|
||||
]);
|
||||
function lineWidth(value) {
|
||||
return lineWidths.has(value);
|
||||
}
|
||||
function shadow(value) {
|
||||
let parsedShadows = (0, _parseBoxShadowValue.parseBoxShadowValue)(normalize(value));
|
||||
for (let parsedShadow of parsedShadows){
|
||||
if (!parsedShadow.valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function color(value) {
|
||||
let colors = 0;
|
||||
let result = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, "_").every((part)=>{
|
||||
part = normalize(part);
|
||||
if (part.startsWith("var(")) return true;
|
||||
if ((0, _color.parseColor)(part, {
|
||||
loose: true
|
||||
}) !== null) return colors++, true;
|
||||
return false;
|
||||
});
|
||||
if (!result) return false;
|
||||
return colors > 0;
|
||||
}
|
||||
function image(value) {
|
||||
let images = 0;
|
||||
let result = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>{
|
||||
part = normalize(part);
|
||||
if (part.startsWith("var(")) return true;
|
||||
if (url(part) || gradient(part) || [
|
||||
"element(",
|
||||
"image(",
|
||||
"cross-fade(",
|
||||
"image-set("
|
||||
].some((fn)=>part.startsWith(fn))) {
|
||||
images++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (!result) return false;
|
||||
return images > 0;
|
||||
}
|
||||
let gradientTypes = new Set([
|
||||
"linear-gradient",
|
||||
"radial-gradient",
|
||||
"repeating-linear-gradient",
|
||||
"repeating-radial-gradient",
|
||||
"conic-gradient"
|
||||
]);
|
||||
function gradient(value) {
|
||||
value = normalize(value);
|
||||
for (let type of gradientTypes){
|
||||
if (value.startsWith(`${type}(`)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
let validPositions = new Set([
|
||||
"center",
|
||||
"top",
|
||||
"right",
|
||||
"bottom",
|
||||
"left"
|
||||
]);
|
||||
function position(value) {
|
||||
let positions = 0;
|
||||
let result = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, "_").every((part)=>{
|
||||
part = normalize(part);
|
||||
if (part.startsWith("var(")) return true;
|
||||
if (validPositions.has(part) || length(part) || percentage(part)) {
|
||||
positions++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (!result) return false;
|
||||
return positions > 0;
|
||||
}
|
||||
function familyName(value) {
|
||||
let fonts = 0;
|
||||
let result = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>{
|
||||
part = normalize(part);
|
||||
if (part.startsWith("var(")) return true;
|
||||
// If it contains spaces, then it should be quoted
|
||||
if (part.includes(" ")) {
|
||||
if (!/(['"])([^"']+)\1/g.test(part)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// If it starts with a number, it's invalid
|
||||
if (/^\d/g.test(part)) {
|
||||
return false;
|
||||
}
|
||||
fonts++;
|
||||
return true;
|
||||
});
|
||||
if (!result) return false;
|
||||
return fonts > 0;
|
||||
}
|
||||
let genericNames = new Set([
|
||||
"serif",
|
||||
"sans-serif",
|
||||
"monospace",
|
||||
"cursive",
|
||||
"fantasy",
|
||||
"system-ui",
|
||||
"ui-serif",
|
||||
"ui-sans-serif",
|
||||
"ui-monospace",
|
||||
"ui-rounded",
|
||||
"math",
|
||||
"emoji",
|
||||
"fangsong"
|
||||
]);
|
||||
function genericName(value) {
|
||||
return genericNames.has(value);
|
||||
}
|
||||
let absoluteSizes = new Set([
|
||||
"xx-small",
|
||||
"x-small",
|
||||
"small",
|
||||
"medium",
|
||||
"large",
|
||||
"x-large",
|
||||
"x-large",
|
||||
"xxx-large"
|
||||
]);
|
||||
function absoluteSize(value) {
|
||||
return absoluteSizes.has(value);
|
||||
}
|
||||
let relativeSizes = new Set([
|
||||
"larger",
|
||||
"smaller"
|
||||
]);
|
||||
function relativeSize(value) {
|
||||
return relativeSizes.has(value);
|
||||
}
|
||||
25
node_modules/tailwindcss/lib/util/defaults.js
generated
vendored
Normal file
25
node_modules/tailwindcss/lib/util/defaults.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "defaults", {
|
||||
enumerable: true,
|
||||
get: ()=>defaults
|
||||
});
|
||||
function defaults(target, ...sources) {
|
||||
for (let source of sources){
|
||||
for(let k in source){
|
||||
var ref;
|
||||
if (!(target === null || target === void 0 ? void 0 : (ref = target.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(target, k))) {
|
||||
target[k] = source[k];
|
||||
}
|
||||
}
|
||||
for (let k1 of Object.getOwnPropertySymbols(source)){
|
||||
var ref1;
|
||||
if (!(target === null || target === void 0 ? void 0 : (ref1 = target.hasOwnProperty) === null || ref1 === void 0 ? void 0 : ref1.call(target, k1))) {
|
||||
target[k1] = source[k1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
22
node_modules/tailwindcss/lib/util/escapeClassName.js
generated
vendored
Normal file
22
node_modules/tailwindcss/lib/util/escapeClassName.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>escapeClassName
|
||||
});
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function escapeClassName(className) {
|
||||
var ref;
|
||||
let node = _postcssSelectorParser.default.className();
|
||||
node.value = className;
|
||||
var ref1;
|
||||
return (0, _escapeCommas.default)((ref1 = node === null || node === void 0 ? void 0 : (ref = node.raws) === null || ref === void 0 ? void 0 : ref.value) !== null && ref1 !== void 0 ? ref1 : node.value);
|
||||
}
|
||||
11
node_modules/tailwindcss/lib/util/escapeCommas.js
generated
vendored
Normal file
11
node_modules/tailwindcss/lib/util/escapeCommas.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>escapeCommas
|
||||
});
|
||||
function escapeCommas(className) {
|
||||
return className.replace(/\\,/g, "\\2c ");
|
||||
}
|
||||
16
node_modules/tailwindcss/lib/util/flattenColorPalette.js
generated
vendored
Normal file
16
node_modules/tailwindcss/lib/util/flattenColorPalette.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const flattenColorPalette = (colors)=>Object.assign({}, ...Object.entries(colors !== null && colors !== void 0 ? colors : {}).flatMap(([color, values])=>typeof values == "object" ? Object.entries(flattenColorPalette(values)).map(([number, hex])=>({
|
||||
[color + (number === "DEFAULT" ? "" : `-${number}`)]: hex
|
||||
})) : [
|
||||
{
|
||||
[`${color}`]: values
|
||||
}
|
||||
]));
|
||||
const _default = flattenColorPalette;
|
||||
285
node_modules/tailwindcss/lib/util/formatVariantSelector.js
generated
vendored
Normal file
285
node_modules/tailwindcss/lib/util/formatVariantSelector.js
generated
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
selectorFunctions: ()=>selectorFunctions,
|
||||
formatVariantSelector: ()=>formatVariantSelector,
|
||||
finalizeSelector: ()=>finalizeSelector
|
||||
});
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _unesc = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser/dist/util/unesc"));
|
||||
const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("../util/escapeClassName"));
|
||||
const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var ref;
|
||||
let MERGE = ":merge";
|
||||
let PARENT = "&";
|
||||
let selectorFunctions = new Set([
|
||||
MERGE
|
||||
]);
|
||||
function formatVariantSelector(current, ...others) {
|
||||
for (let other of others){
|
||||
let incomingValue = resolveFunctionArgument(other, MERGE);
|
||||
if (incomingValue !== null) {
|
||||
let existingValue = resolveFunctionArgument(current, MERGE, incomingValue);
|
||||
if (existingValue !== null) {
|
||||
let existingTarget = `${MERGE}(${incomingValue})`;
|
||||
let splitIdx = other.indexOf(existingTarget);
|
||||
let addition = other.slice(splitIdx + existingTarget.length).split(" ")[0];
|
||||
current = current.replace(existingTarget, existingTarget + addition);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
current = other.replace(PARENT, current);
|
||||
}
|
||||
return current;
|
||||
}
|
||||
/**
|
||||
* Given any node in a selector this gets the "simple" selector it's a part of
|
||||
* A simple selector is just a list of nodes without any combinators
|
||||
* Technically :is(), :not(), :has(), etc… can have combinators but those are nested
|
||||
* inside the relevant node and won't be picked up so they're fine to ignore
|
||||
*
|
||||
* @param {import('postcss-selector-parser').Node} node
|
||||
* @returns {import('postcss-selector-parser').Node[]}
|
||||
**/ function simpleSelectorForNode(node) {
|
||||
/** @type {import('postcss-selector-parser').Node[]} */ let nodes = [];
|
||||
// Walk backwards until we hit a combinator node (or the start)
|
||||
while(node.prev() && node.prev().type !== "combinator"){
|
||||
node = node.prev();
|
||||
}
|
||||
// Now record all non-combinator nodes until we hit one (or the end)
|
||||
while(node && node.type !== "combinator"){
|
||||
nodes.push(node);
|
||||
node = node.next();
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
/**
|
||||
* Resorts the nodes in a selector to ensure they're in the correct order
|
||||
* Tags go before classes, and pseudo classes go after classes
|
||||
*
|
||||
* @param {import('postcss-selector-parser').Selector} sel
|
||||
* @returns {import('postcss-selector-parser').Selector}
|
||||
**/ function resortSelector(sel) {
|
||||
sel.sort((a, b)=>{
|
||||
if (a.type === "tag" && b.type === "class") {
|
||||
return -1;
|
||||
} else if (a.type === "class" && b.type === "tag") {
|
||||
return 1;
|
||||
} else if (a.type === "class" && b.type === "pseudo" && b.value.startsWith("::")) {
|
||||
return -1;
|
||||
} else if (a.type === "pseudo" && a.value.startsWith("::") && b.type === "class") {
|
||||
return 1;
|
||||
}
|
||||
return sel.index(a) - sel.index(b);
|
||||
});
|
||||
return sel;
|
||||
}
|
||||
function eliminateIrrelevantSelectors(sel, base) {
|
||||
let hasClassesMatchingCandidate = false;
|
||||
sel.walk((child)=>{
|
||||
if (child.type === "class" && child.value === base) {
|
||||
hasClassesMatchingCandidate = true;
|
||||
return false // Stop walking
|
||||
;
|
||||
}
|
||||
});
|
||||
if (!hasClassesMatchingCandidate) {
|
||||
sel.remove();
|
||||
}
|
||||
// We do NOT recursively eliminate sub selectors that don't have the base class
|
||||
// as this is NOT a safe operation. For example, if we have:
|
||||
// `.space-x-2 > :not([hidden]) ~ :not([hidden])`
|
||||
// We cannot remove the [hidden] from the :not() because it would change the
|
||||
// meaning of the selector.
|
||||
// TODO: Can we do this for :matches, :is, and :where?
|
||||
}
|
||||
var ref1;
|
||||
function finalizeSelector(format, { selector , candidate , context , isArbitraryVariant , // Split by the separator, but ignore the separator inside square brackets:
|
||||
//
|
||||
// E.g.: dark:lg:hover:[paint-order:markers]
|
||||
// ┬ ┬ ┬ ┬
|
||||
// │ │ │ ╰── We will not split here
|
||||
// ╰──┴─────┴─────────────── We will split here
|
||||
//
|
||||
base =candidate.split(new RegExp(`\\${(ref1 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref1 !== void 0 ? ref1 : ":"}(?![^[]*\\])`)).pop() }) {
|
||||
var ref2;
|
||||
let ast = (0, _postcssSelectorParser.default)().astSync(selector);
|
||||
// We explicitly DO NOT prefix classes in arbitrary variants
|
||||
if ((context === null || context === void 0 ? void 0 : (ref2 = context.tailwindConfig) === null || ref2 === void 0 ? void 0 : ref2.prefix) && !isArbitraryVariant) {
|
||||
format = (0, _prefixSelector.default)(context.tailwindConfig.prefix, format);
|
||||
}
|
||||
format = format.replace(PARENT, `.${(0, _escapeClassName.default)(candidate)}`);
|
||||
let formatAst = (0, _postcssSelectorParser.default)().astSync(format);
|
||||
// Remove extraneous selectors that do not include the base class/candidate being matched against
|
||||
// For example if we have a utility defined `.a, .b { color: red}`
|
||||
// And the formatted variant is sm:b then we want the final selector to be `.sm\:b` and not `.a, .sm\:b`
|
||||
ast.each((sel)=>eliminateIrrelevantSelectors(sel, base));
|
||||
// Normalize escaped classes, e.g.:
|
||||
//
|
||||
// The idea would be to replace the escaped `base` in the selector with the
|
||||
// `format`. However, in css you can escape the same selector in a few
|
||||
// different ways. This would result in different strings and therefore we
|
||||
// can't replace it properly.
|
||||
//
|
||||
// base: bg-[rgb(255,0,0)]
|
||||
// base in selector: bg-\\[rgb\\(255\\,0\\,0\\)\\]
|
||||
// escaped base: bg-\\[rgb\\(255\\2c 0\\2c 0\\)\\]
|
||||
//
|
||||
ast.walkClasses((node)=>{
|
||||
if (node.raws && node.value.includes(base)) {
|
||||
node.raws.value = (0, _escapeClassName.default)((0, _unesc.default)(node.raws.value));
|
||||
}
|
||||
});
|
||||
let simpleStart = _postcssSelectorParser.default.comment({
|
||||
value: "/*__simple__*/"
|
||||
});
|
||||
let simpleEnd = _postcssSelectorParser.default.comment({
|
||||
value: "/*__simple__*/"
|
||||
});
|
||||
// We can safely replace the escaped base now, since the `base` section is
|
||||
// now in a normalized escaped value.
|
||||
ast.walkClasses((node)=>{
|
||||
if (node.value !== base) {
|
||||
return;
|
||||
}
|
||||
let parent = node.parent;
|
||||
let formatNodes = formatAst.nodes[0].nodes;
|
||||
// Perf optimization: if the parent is a single class we can just replace it and be done
|
||||
if (parent.nodes.length === 1) {
|
||||
node.replaceWith(...formatNodes);
|
||||
return;
|
||||
}
|
||||
let simpleSelector = simpleSelectorForNode(node);
|
||||
parent.insertBefore(simpleSelector[0], simpleStart);
|
||||
parent.insertAfter(simpleSelector[simpleSelector.length - 1], simpleEnd);
|
||||
for (let child of formatNodes){
|
||||
parent.insertBefore(simpleSelector[0], child);
|
||||
}
|
||||
node.remove();
|
||||
// Re-sort the simple selector to ensure it's in the correct order
|
||||
simpleSelector = simpleSelectorForNode(simpleStart);
|
||||
let firstNode = parent.index(simpleStart);
|
||||
parent.nodes.splice(firstNode, simpleSelector.length, ...resortSelector(_postcssSelectorParser.default.selector({
|
||||
nodes: simpleSelector
|
||||
})).nodes);
|
||||
simpleStart.remove();
|
||||
simpleEnd.remove();
|
||||
});
|
||||
// This will make sure to move pseudo's to the correct spot (the end for
|
||||
// pseudo elements) because otherwise the selector will never work
|
||||
// anyway.
|
||||
//
|
||||
// E.g.:
|
||||
// - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
||||
// - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
||||
//
|
||||
// `::before:hover` doesn't work, which means that we can make it work for you by flipping the order.
|
||||
function collectPseudoElements(selector) {
|
||||
let nodes = [];
|
||||
for (let node of selector.nodes){
|
||||
if (isPseudoElement(node)) {
|
||||
nodes.push(node);
|
||||
selector.removeChild(node);
|
||||
}
|
||||
if (node === null || node === void 0 ? void 0 : node.nodes) {
|
||||
nodes.push(...collectPseudoElements(node));
|
||||
}
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
// Remove unnecessary pseudo selectors that we used as placeholders
|
||||
ast.each((selector)=>{
|
||||
selector.walkPseudos((p)=>{
|
||||
if (selectorFunctions.has(p.value)) {
|
||||
p.replaceWith(p.nodes);
|
||||
}
|
||||
});
|
||||
let pseudoElements = collectPseudoElements(selector);
|
||||
if (pseudoElements.length > 0) {
|
||||
selector.nodes.push(pseudoElements.sort(sortSelector));
|
||||
}
|
||||
});
|
||||
return ast.toString();
|
||||
}
|
||||
// Note: As a rule, double colons (::) should be used instead of a single colon
|
||||
// (:). This distinguishes pseudo-classes from pseudo-elements. However, since
|
||||
// this distinction was not present in older versions of the W3C spec, most
|
||||
// browsers support both syntaxes for the original pseudo-elements.
|
||||
let pseudoElementsBC = [
|
||||
":before",
|
||||
":after",
|
||||
":first-line",
|
||||
":first-letter"
|
||||
];
|
||||
// These pseudo-elements _can_ be combined with other pseudo selectors AND the order does matter.
|
||||
let pseudoElementExceptions = [
|
||||
"::file-selector-button"
|
||||
];
|
||||
// This will make sure to move pseudo's to the correct spot (the end for
|
||||
// pseudo elements) because otherwise the selector will never work
|
||||
// anyway.
|
||||
//
|
||||
// E.g.:
|
||||
// - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
||||
// - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
||||
//
|
||||
// `::before:hover` doesn't work, which means that we can make it work
|
||||
// for you by flipping the order.
|
||||
function sortSelector(a, z) {
|
||||
// Both nodes are non-pseudo's so we can safely ignore them and keep
|
||||
// them in the same order.
|
||||
if (a.type !== "pseudo" && z.type !== "pseudo") {
|
||||
return 0;
|
||||
}
|
||||
// If one of them is a combinator, we need to keep it in the same order
|
||||
// because that means it will start a new "section" in the selector.
|
||||
if (a.type === "combinator" ^ z.type === "combinator") {
|
||||
return 0;
|
||||
}
|
||||
// One of the items is a pseudo and the other one isn't. Let's move
|
||||
// the pseudo to the right.
|
||||
if (a.type === "pseudo" ^ z.type === "pseudo") {
|
||||
return (a.type === "pseudo") - (z.type === "pseudo");
|
||||
}
|
||||
// Both are pseudo's, move the pseudo elements (except for
|
||||
// ::file-selector-button) to the right.
|
||||
return isPseudoElement(a) - isPseudoElement(z);
|
||||
}
|
||||
function isPseudoElement(node) {
|
||||
if (node.type !== "pseudo") return false;
|
||||
if (pseudoElementExceptions.includes(node.value)) return false;
|
||||
return node.value.startsWith("::") || pseudoElementsBC.includes(node.value);
|
||||
}
|
||||
function resolveFunctionArgument(haystack, needle, arg) {
|
||||
let startIdx = haystack.indexOf(arg ? `${needle}(${arg})` : needle);
|
||||
if (startIdx === -1) return null;
|
||||
// Start inside the `(`
|
||||
startIdx += needle.length + 1;
|
||||
let target = "";
|
||||
let count = 0;
|
||||
for (let char of haystack.slice(startIdx)){
|
||||
if (char !== "(" && char !== ")") {
|
||||
target += char;
|
||||
} else if (char === "(") {
|
||||
target += char;
|
||||
count++;
|
||||
} else if (char === ")") {
|
||||
if (--count < 0) break; // unbalanced
|
||||
target += char;
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
48
node_modules/tailwindcss/lib/util/getAllConfigs.js
generated
vendored
Normal file
48
node_modules/tailwindcss/lib/util/getAllConfigs.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>getAllConfigs
|
||||
});
|
||||
const _defaultConfigStubJs = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/defaultConfig.stub.js"));
|
||||
const _featureFlags = require("../featureFlags");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function getAllConfigs(config) {
|
||||
var ref;
|
||||
const configs = ((ref = config === null || config === void 0 ? void 0 : config.presets) !== null && ref !== void 0 ? ref : [
|
||||
_defaultConfigStubJs.default
|
||||
]).slice().reverse().flatMap((preset)=>getAllConfigs(preset instanceof Function ? preset() : preset));
|
||||
const features = {
|
||||
// Add experimental configs here...
|
||||
respectDefaultRingColorOpacity: {
|
||||
theme: {
|
||||
ringColor: ({ theme })=>({
|
||||
DEFAULT: "#3b82f67f",
|
||||
...theme("colors")
|
||||
})
|
||||
}
|
||||
},
|
||||
disableColorOpacityUtilitiesByDefault: {
|
||||
corePlugins: {
|
||||
backgroundOpacity: false,
|
||||
borderOpacity: false,
|
||||
divideOpacity: false,
|
||||
placeholderOpacity: false,
|
||||
ringOpacity: false,
|
||||
textOpacity: false
|
||||
}
|
||||
}
|
||||
};
|
||||
const experimentals = Object.keys(features).filter((feature)=>(0, _featureFlags.flagEnabled)(config, feature)).map((feature)=>features[feature]);
|
||||
return [
|
||||
config,
|
||||
...experimentals,
|
||||
...configs
|
||||
];
|
||||
}
|
||||
19
node_modules/tailwindcss/lib/util/hashConfig.js
generated
vendored
Normal file
19
node_modules/tailwindcss/lib/util/hashConfig.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>hashConfig
|
||||
});
|
||||
const _objectHash = /*#__PURE__*/ _interopRequireDefault(require("object-hash"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function hashConfig(config) {
|
||||
return (0, _objectHash.default)(config, {
|
||||
ignoreUnknown: true
|
||||
});
|
||||
}
|
||||
11
node_modules/tailwindcss/lib/util/isKeyframeRule.js
generated
vendored
Normal file
11
node_modules/tailwindcss/lib/util/isKeyframeRule.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>isKeyframeRule
|
||||
});
|
||||
function isKeyframeRule(rule) {
|
||||
return rule.parent && rule.parent.type === "atrule" && /keyframes$/.test(rule.parent.name);
|
||||
}
|
||||
15
node_modules/tailwindcss/lib/util/isPlainObject.js
generated
vendored
Normal file
15
node_modules/tailwindcss/lib/util/isPlainObject.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>isPlainObject
|
||||
});
|
||||
function isPlainObject(value) {
|
||||
if (Object.prototype.toString.call(value) !== "[object Object]") {
|
||||
return false;
|
||||
}
|
||||
const prototype = Object.getPrototypeOf(value);
|
||||
return prototype === null || prototype === Object.prototype;
|
||||
}
|
||||
72
node_modules/tailwindcss/lib/util/isValidArbitraryValue.js
generated
vendored
Normal file
72
node_modules/tailwindcss/lib/util/isValidArbitraryValue.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, // 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']
|
||||
"default", {
|
||||
enumerable: true,
|
||||
get: ()=>isValidArbitraryValue
|
||||
});
|
||||
let matchingBrackets = new Map([
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
]
|
||||
]);
|
||||
let inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v])=>[
|
||||
v,
|
||||
k
|
||||
]));
|
||||
let quotes = new Set([
|
||||
'"',
|
||||
"'",
|
||||
"`"
|
||||
]);
|
||||
function isValidArbitraryValue(value) {
|
||||
let stack = [];
|
||||
let inQuotes = false;
|
||||
for(let i = 0; i < value.length; i++){
|
||||
let char = value[i];
|
||||
if (char === ":" && !inQuotes && stack.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
57
node_modules/tailwindcss/lib/util/log.js
generated
vendored
Normal file
57
node_modules/tailwindcss/lib/util/log.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
dim: ()=>dim,
|
||||
default: ()=>_default
|
||||
});
|
||||
const _picocolors = /*#__PURE__*/ _interopRequireDefault(require("picocolors"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
let alreadyShown = new Set();
|
||||
function log(type, messages, key) {
|
||||
if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) return;
|
||||
if (key && alreadyShown.has(key)) return;
|
||||
if (key) alreadyShown.add(key);
|
||||
console.warn("");
|
||||
messages.forEach((message)=>console.warn(type, "-", message));
|
||||
}
|
||||
function dim(input) {
|
||||
return _picocolors.default.dim(input);
|
||||
}
|
||||
const _default = {
|
||||
info (key, messages) {
|
||||
log(_picocolors.default.bold(_picocolors.default.cyan("info")), ...Array.isArray(key) ? [
|
||||
key
|
||||
] : [
|
||||
messages,
|
||||
key
|
||||
]);
|
||||
},
|
||||
warn (key, messages) {
|
||||
log(_picocolors.default.bold(_picocolors.default.yellow("warn")), ...Array.isArray(key) ? [
|
||||
key
|
||||
] : [
|
||||
messages,
|
||||
key
|
||||
]);
|
||||
},
|
||||
risk (key, messages) {
|
||||
log(_picocolors.default.bold(_picocolors.default.magenta("risk")), ...Array.isArray(key) ? [
|
||||
key
|
||||
] : [
|
||||
messages,
|
||||
key
|
||||
]);
|
||||
}
|
||||
};
|
||||
43
node_modules/tailwindcss/lib/util/nameClass.js
generated
vendored
Normal file
43
node_modules/tailwindcss/lib/util/nameClass.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
asClass: ()=>asClass,
|
||||
default: ()=>nameClass,
|
||||
formatClass: ()=>formatClass
|
||||
});
|
||||
const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("./escapeClassName"));
|
||||
const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function asClass(name) {
|
||||
return (0, _escapeCommas.default)(`.${(0, _escapeClassName.default)(name)}`);
|
||||
}
|
||||
function nameClass(classPrefix, key) {
|
||||
return asClass(formatClass(classPrefix, key));
|
||||
}
|
||||
function formatClass(classPrefix, key) {
|
||||
if (key === "DEFAULT") {
|
||||
return classPrefix;
|
||||
}
|
||||
if (key === "-" || key === "-DEFAULT") {
|
||||
return `-${classPrefix}`;
|
||||
}
|
||||
if (key.startsWith("-")) {
|
||||
return `-${classPrefix}${key}`;
|
||||
}
|
||||
if (key.startsWith("/")) {
|
||||
return `${classPrefix}${key}`;
|
||||
}
|
||||
return `${classPrefix}-${key}`;
|
||||
}
|
||||
34
node_modules/tailwindcss/lib/util/negateValue.js
generated
vendored
Normal file
34
node_modules/tailwindcss/lib/util/negateValue.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
function _default(value) {
|
||||
value = `${value}`;
|
||||
if (value === "0") {
|
||||
return "0";
|
||||
}
|
||||
// Flip sign of numbers
|
||||
if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
|
||||
return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
|
||||
}
|
||||
// What functions we support negating numeric values for
|
||||
// var() isn't inherently a numeric function but we support it anyway
|
||||
// The trigonometric functions are omitted because you'll need to use calc(…) with them _anyway_
|
||||
// to produce generally useful results and that will be covered already
|
||||
let numericFunctions = [
|
||||
"var",
|
||||
"calc",
|
||||
"min",
|
||||
"max",
|
||||
"clamp"
|
||||
];
|
||||
for (const fn of numericFunctions){
|
||||
if (value.includes(`${fn}(`)) {
|
||||
return `calc(${value} * -1)`;
|
||||
}
|
||||
}
|
||||
}
|
||||
281
node_modules/tailwindcss/lib/util/normalizeConfig.js
generated
vendored
Normal file
281
node_modules/tailwindcss/lib/util/normalizeConfig.js
generated
vendored
Normal file
@@ -0,0 +1,281 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "normalizeConfig", {
|
||||
enumerable: true,
|
||||
get: ()=>normalizeConfig
|
||||
});
|
||||
const _log = /*#__PURE__*/ _interopRequireWildcard(require("./log"));
|
||||
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 normalizeConfig(config) {
|
||||
// Quick structure validation
|
||||
/**
|
||||
* type FilePath = string
|
||||
* type RawFile = { raw: string, extension?: string }
|
||||
* type ExtractorFn = (content: string) => Array<string>
|
||||
* type TransformerFn = (content: string) => string
|
||||
*
|
||||
* type Content =
|
||||
* | Array<FilePath | RawFile>
|
||||
* | {
|
||||
* files: Array<FilePath | RawFile>,
|
||||
* extract?: ExtractorFn | { [extension: string]: ExtractorFn }
|
||||
* transform?: TransformerFn | { [extension: string]: TransformerFn }
|
||||
* }
|
||||
*/ let valid = (()=>{
|
||||
// `config.purge` should not exist anymore
|
||||
if (config.purge) {
|
||||
return false;
|
||||
}
|
||||
// `config.content` should exist
|
||||
if (!config.content) {
|
||||
return false;
|
||||
}
|
||||
// `config.content` should be an object or an array
|
||||
if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
|
||||
return false;
|
||||
}
|
||||
// When `config.content` is an array, it should consist of FilePaths or RawFiles
|
||||
if (Array.isArray(config.content)) {
|
||||
return config.content.every((path)=>{
|
||||
// `path` can be a string
|
||||
if (typeof path === "string") return true;
|
||||
// `path` can be an object { raw: string, extension?: string }
|
||||
// `raw` must be a string
|
||||
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
||||
// `extension` (if provided) should also be a string
|
||||
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
// When `config.content` is an object
|
||||
if (typeof config.content === "object" && config.content !== null) {
|
||||
// Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
|
||||
if (Object.keys(config.content).some((key)=>![
|
||||
"files",
|
||||
"relative",
|
||||
"extract",
|
||||
"transform"
|
||||
].includes(key))) {
|
||||
return false;
|
||||
}
|
||||
// `config.content.files` should exist of FilePaths or RawFiles
|
||||
if (Array.isArray(config.content.files)) {
|
||||
if (!config.content.files.every((path)=>{
|
||||
// `path` can be a string
|
||||
if (typeof path === "string") return true;
|
||||
// `path` can be an object { raw: string, extension?: string }
|
||||
// `raw` must be a string
|
||||
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
||||
// `extension` (if provided) should also be a string
|
||||
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})) {
|
||||
return false;
|
||||
}
|
||||
// `config.content.extract` is optional, and can be a Function or a Record<String, Function>
|
||||
if (typeof config.content.extract === "object") {
|
||||
for (let value of Object.values(config.content.extract)){
|
||||
if (typeof value !== "function") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
|
||||
return false;
|
||||
}
|
||||
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
||||
if (typeof config.content.transform === "object") {
|
||||
for (let value1 of Object.values(config.content.transform)){
|
||||
if (typeof value1 !== "function") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
|
||||
return false;
|
||||
}
|
||||
// `config.content.relative` is optional and can be a boolean
|
||||
if (typeof config.content.relative !== "boolean" && typeof config.content.relative !== "undefined") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})();
|
||||
if (!valid) {
|
||||
_log.default.warn("purge-deprecation", [
|
||||
"The `purge`/`content` options have changed in Tailwind CSS v3.0.",
|
||||
"Update your configuration file to eliminate this warning.",
|
||||
"https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
|
||||
]);
|
||||
}
|
||||
// Normalize the `safelist`
|
||||
config.safelist = (()=>{
|
||||
var ref;
|
||||
let { content , purge , safelist } = config;
|
||||
if (Array.isArray(safelist)) return safelist;
|
||||
if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
|
||||
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
|
||||
if (Array.isArray(purge === null || purge === void 0 ? void 0 : (ref = purge.options) === null || ref === void 0 ? void 0 : ref.safelist)) return purge.options.safelist;
|
||||
return [];
|
||||
})();
|
||||
// Normalize the `blocklist`
|
||||
config.blocklist = (()=>{
|
||||
let { blocklist } = config;
|
||||
if (Array.isArray(blocklist)) {
|
||||
if (blocklist.every((item)=>typeof item === "string")) {
|
||||
return blocklist;
|
||||
}
|
||||
_log.default.warn("blocklist-invalid", [
|
||||
"The `blocklist` option must be an array of strings.",
|
||||
"https://tailwindcss.com/docs/content-configuration#discarding-classes"
|
||||
]);
|
||||
}
|
||||
return [];
|
||||
})();
|
||||
// Normalize prefix option
|
||||
if (typeof config.prefix === "function") {
|
||||
_log.default.warn("prefix-function", [
|
||||
"As of Tailwind CSS v3.0, `prefix` cannot be a function.",
|
||||
"Update `prefix` in your configuration to be a string to eliminate this warning.",
|
||||
"https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
|
||||
]);
|
||||
config.prefix = "";
|
||||
} else {
|
||||
var _prefix;
|
||||
config.prefix = (_prefix = config.prefix) !== null && _prefix !== void 0 ? _prefix : "";
|
||||
}
|
||||
// Normalize the `content`
|
||||
config.content = {
|
||||
relative: (()=>{
|
||||
var ref;
|
||||
let { content } = config;
|
||||
if (content === null || content === void 0 ? void 0 : content.relative) {
|
||||
return content.relative;
|
||||
}
|
||||
var ref1;
|
||||
return (ref1 = (ref = config.future) === null || ref === void 0 ? void 0 : ref.relativeContentPathsByDefault) !== null && ref1 !== void 0 ? ref1 : false;
|
||||
})(),
|
||||
files: (()=>{
|
||||
let { content , purge } = config;
|
||||
if (Array.isArray(purge)) return purge;
|
||||
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
|
||||
if (Array.isArray(content)) return content;
|
||||
if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
|
||||
if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
|
||||
return [];
|
||||
})(),
|
||||
extract: (()=>{
|
||||
let extract = (()=>{
|
||||
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9;
|
||||
if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.extract) return config.purge.extract;
|
||||
if ((ref1 = config.content) === null || ref1 === void 0 ? void 0 : ref1.extract) return config.content.extract;
|
||||
if ((ref2 = config.purge) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.extract) === null || ref3 === void 0 ? void 0 : ref3.DEFAULT) return config.purge.extract.DEFAULT;
|
||||
if ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.extract) === null || ref5 === void 0 ? void 0 : ref5.DEFAULT) return config.content.extract.DEFAULT;
|
||||
if ((ref6 = config.purge) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.options) === null || ref7 === void 0 ? void 0 : ref7.extractors) return config.purge.options.extractors;
|
||||
if ((ref8 = config.content) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.options) === null || ref9 === void 0 ? void 0 : ref9.extractors) return config.content.options.extractors;
|
||||
return {};
|
||||
})();
|
||||
let extractors = {};
|
||||
let defaultExtractor = (()=>{
|
||||
var ref, ref1, ref2, ref3;
|
||||
if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref1 = ref.options) === null || ref1 === void 0 ? void 0 : ref1.defaultExtractor) {
|
||||
return config.purge.options.defaultExtractor;
|
||||
}
|
||||
if ((ref2 = config.content) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.options) === null || ref3 === void 0 ? void 0 : ref3.defaultExtractor) {
|
||||
return config.content.options.defaultExtractor;
|
||||
}
|
||||
return undefined;
|
||||
})();
|
||||
if (defaultExtractor !== undefined) {
|
||||
extractors.DEFAULT = defaultExtractor;
|
||||
}
|
||||
// Functions
|
||||
if (typeof extract === "function") {
|
||||
extractors.DEFAULT = extract;
|
||||
} else if (Array.isArray(extract)) {
|
||||
for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
|
||||
for (let extension of extensions){
|
||||
extractors[extension] = extractor;
|
||||
}
|
||||
}
|
||||
} else if (typeof extract === "object" && extract !== null) {
|
||||
Object.assign(extractors, extract);
|
||||
}
|
||||
return extractors;
|
||||
})(),
|
||||
transform: (()=>{
|
||||
let transform = (()=>{
|
||||
var ref, ref1, ref2, ref3, ref4, ref5;
|
||||
if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.transform) return config.purge.transform;
|
||||
if ((ref1 = config.content) === null || ref1 === void 0 ? void 0 : ref1.transform) return config.content.transform;
|
||||
if ((ref2 = config.purge) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.transform) === null || ref3 === void 0 ? void 0 : ref3.DEFAULT) return config.purge.transform.DEFAULT;
|
||||
if ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.transform) === null || ref5 === void 0 ? void 0 : ref5.DEFAULT) return config.content.transform.DEFAULT;
|
||||
return {};
|
||||
})();
|
||||
let transformers = {};
|
||||
if (typeof transform === "function") {
|
||||
transformers.DEFAULT = transform;
|
||||
}
|
||||
if (typeof transform === "object" && transform !== null) {
|
||||
Object.assign(transformers, transform);
|
||||
}
|
||||
return transformers;
|
||||
})()
|
||||
};
|
||||
// Validate globs to prevent bogus globs.
|
||||
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
||||
for (let file of config.content.files){
|
||||
if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
|
||||
_log.default.warn("invalid-glob-braces", [
|
||||
`The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
|
||||
`Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
}
|
||||
170
node_modules/tailwindcss/lib/util/normalizeScreens.js
generated
vendored
Normal file
170
node_modules/tailwindcss/lib/util/normalizeScreens.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* @typedef {object} ScreenValue
|
||||
* @property {number|undefined} min
|
||||
* @property {number|undefined} max
|
||||
* @property {string|undefined} raw
|
||||
*/ /**
|
||||
* @typedef {object} Screen
|
||||
* @property {string} name
|
||||
* @property {boolean} not
|
||||
* @property {ScreenValue[]} values
|
||||
*/ /**
|
||||
* A function that normalizes the various forms that the screens object can be
|
||||
* provided in.
|
||||
*
|
||||
* Input(s):
|
||||
* - ['100px', '200px'] // Raw strings
|
||||
* - { sm: '100px', md: '200px' } // Object with string values
|
||||
* - { sm: { min: '100px' }, md: { max: '100px' } } // Object with object values
|
||||
* - { sm: [{ min: '100px' }, { max: '200px' }] } // Object with object array (multiple values)
|
||||
*
|
||||
* Output(s):
|
||||
* - [{ name: 'sm', values: [{ min: '100px', max: '200px' }] }] // List of objects, that contains multiple values
|
||||
*
|
||||
* @returns {Screen[]}
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
normalizeScreens: ()=>normalizeScreens,
|
||||
isScreenSortable: ()=>isScreenSortable,
|
||||
compareScreens: ()=>compareScreens,
|
||||
toScreen: ()=>toScreen
|
||||
});
|
||||
function normalizeScreens(screens, root = true) {
|
||||
if (Array.isArray(screens)) {
|
||||
return screens.map((screen)=>{
|
||||
if (root && Array.isArray(screen)) {
|
||||
throw new Error("The tuple syntax is not supported for `screens`.");
|
||||
}
|
||||
if (typeof screen === "string") {
|
||||
return {
|
||||
name: screen.toString(),
|
||||
not: false,
|
||||
values: [
|
||||
{
|
||||
min: screen,
|
||||
max: undefined
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
let [name, options] = screen;
|
||||
name = name.toString();
|
||||
if (typeof options === "string") {
|
||||
return {
|
||||
name,
|
||||
not: false,
|
||||
values: [
|
||||
{
|
||||
min: options,
|
||||
max: undefined
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
if (Array.isArray(options)) {
|
||||
return {
|
||||
name,
|
||||
not: false,
|
||||
values: options.map((option)=>resolveValue(option))
|
||||
};
|
||||
}
|
||||
return {
|
||||
name,
|
||||
not: false,
|
||||
values: [
|
||||
resolveValue(options)
|
||||
]
|
||||
};
|
||||
});
|
||||
}
|
||||
return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
|
||||
}
|
||||
function isScreenSortable(screen) {
|
||||
if (screen.values.length !== 1) {
|
||||
return {
|
||||
result: false,
|
||||
reason: "multiple-values"
|
||||
};
|
||||
} else if (screen.values[0].raw !== undefined) {
|
||||
return {
|
||||
result: false,
|
||||
reason: "raw-values"
|
||||
};
|
||||
} else if (screen.values[0].min !== undefined && screen.values[0].max !== undefined) {
|
||||
return {
|
||||
result: false,
|
||||
reason: "min-and-max"
|
||||
};
|
||||
}
|
||||
return {
|
||||
result: true,
|
||||
reason: null
|
||||
};
|
||||
}
|
||||
function compareScreens(type, a, z) {
|
||||
let aScreen = toScreen(a, type);
|
||||
let zScreen = toScreen(z, type);
|
||||
let aSorting = isScreenSortable(aScreen);
|
||||
let bSorting = isScreenSortable(zScreen);
|
||||
// These cases should never happen and indicate a bug in Tailwind CSS itself
|
||||
if (aSorting.reason === "multiple-values" || bSorting.reason === "multiple-values") {
|
||||
throw new Error("Attempted to sort a screen with multiple values. This should never happen. Please open a bug report.");
|
||||
} else if (aSorting.reason === "raw-values" || bSorting.reason === "raw-values") {
|
||||
throw new Error("Attempted to sort a screen with raw values. This should never happen. Please open a bug report.");
|
||||
} else if (aSorting.reason === "min-and-max" || bSorting.reason === "min-and-max") {
|
||||
throw new Error("Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.");
|
||||
}
|
||||
// Let the sorting begin
|
||||
let { min: aMin , max: aMax } = aScreen.values[0];
|
||||
let { min: zMin , max: zMax } = zScreen.values[0];
|
||||
// Negating screens flip their behavior. Basically `not min-width` is `max-width`
|
||||
if (a.not) [aMin, aMax] = [
|
||||
aMax,
|
||||
aMin
|
||||
];
|
||||
if (z.not) [zMin, zMax] = [
|
||||
zMax,
|
||||
zMin
|
||||
];
|
||||
aMin = aMin === undefined ? aMin : parseFloat(aMin);
|
||||
aMax = aMax === undefined ? aMax : parseFloat(aMax);
|
||||
zMin = zMin === undefined ? zMin : parseFloat(zMin);
|
||||
zMax = zMax === undefined ? zMax : parseFloat(zMax);
|
||||
let [aValue, zValue] = type === "min" ? [
|
||||
aMin,
|
||||
zMin
|
||||
] : [
|
||||
zMax,
|
||||
aMax
|
||||
];
|
||||
return aValue - zValue;
|
||||
}
|
||||
function toScreen(value, type) {
|
||||
if (typeof value === "object") {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
name: "arbitrary-screen",
|
||||
values: [
|
||||
{
|
||||
[type]: value
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } = {}) {
|
||||
return {
|
||||
min,
|
||||
max,
|
||||
raw
|
||||
};
|
||||
}
|
||||
91
node_modules/tailwindcss/lib/util/parseAnimationValue.js
generated
vendored
Normal file
91
node_modules/tailwindcss/lib/util/parseAnimationValue.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>parseAnimationValue
|
||||
});
|
||||
const DIRECTIONS = new Set([
|
||||
"normal",
|
||||
"reverse",
|
||||
"alternate",
|
||||
"alternate-reverse"
|
||||
]);
|
||||
const PLAY_STATES = new Set([
|
||||
"running",
|
||||
"paused"
|
||||
]);
|
||||
const FILL_MODES = new Set([
|
||||
"none",
|
||||
"forwards",
|
||||
"backwards",
|
||||
"both"
|
||||
]);
|
||||
const ITERATION_COUNTS = new Set([
|
||||
"infinite"
|
||||
]);
|
||||
const TIMINGS = new Set([
|
||||
"linear",
|
||||
"ease",
|
||||
"ease-in",
|
||||
"ease-out",
|
||||
"ease-in-out",
|
||||
"step-start",
|
||||
"step-end"
|
||||
]);
|
||||
const TIMING_FNS = [
|
||||
"cubic-bezier",
|
||||
"steps"
|
||||
];
|
||||
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
||||
;
|
||||
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
||||
;
|
||||
const TIME = /^(-?[\d.]+m?s)$/;
|
||||
const DIGIT = /^(\d+)$/;
|
||||
function parseAnimationValue(input) {
|
||||
let animations = input.split(COMMA);
|
||||
return animations.map((animation)=>{
|
||||
let value = animation.trim();
|
||||
let result = {
|
||||
value
|
||||
};
|
||||
let parts = value.split(SPACE);
|
||||
let seen = new Set();
|
||||
for (let part of parts){
|
||||
if (!seen.has("DIRECTIONS") && DIRECTIONS.has(part)) {
|
||||
result.direction = part;
|
||||
seen.add("DIRECTIONS");
|
||||
} else if (!seen.has("PLAY_STATES") && PLAY_STATES.has(part)) {
|
||||
result.playState = part;
|
||||
seen.add("PLAY_STATES");
|
||||
} else if (!seen.has("FILL_MODES") && FILL_MODES.has(part)) {
|
||||
result.fillMode = part;
|
||||
seen.add("FILL_MODES");
|
||||
} else if (!seen.has("ITERATION_COUNTS") && (ITERATION_COUNTS.has(part) || DIGIT.test(part))) {
|
||||
result.iterationCount = part;
|
||||
seen.add("ITERATION_COUNTS");
|
||||
} else if (!seen.has("TIMING_FUNCTION") && TIMINGS.has(part)) {
|
||||
result.timingFunction = part;
|
||||
seen.add("TIMING_FUNCTION");
|
||||
} else if (!seen.has("TIMING_FUNCTION") && TIMING_FNS.some((f)=>part.startsWith(`${f}(`))) {
|
||||
result.timingFunction = part;
|
||||
seen.add("TIMING_FUNCTION");
|
||||
} else if (!seen.has("DURATION") && TIME.test(part)) {
|
||||
result.duration = part;
|
||||
seen.add("DURATION");
|
||||
} else if (!seen.has("DELAY") && TIME.test(part)) {
|
||||
result.delay = part;
|
||||
seen.add("DELAY");
|
||||
} else if (!seen.has("NAME")) {
|
||||
result.name = part;
|
||||
seen.add("NAME");
|
||||
} else {
|
||||
if (!result.unknown) result.unknown = [];
|
||||
result.unknown.push(part);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
84
node_modules/tailwindcss/lib/util/parseBoxShadowValue.js
generated
vendored
Normal file
84
node_modules/tailwindcss/lib/util/parseBoxShadowValue.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
parseBoxShadowValue: ()=>parseBoxShadowValue,
|
||||
formatBoxShadowValue: ()=>formatBoxShadowValue
|
||||
});
|
||||
const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
|
||||
let KEYWORDS = new Set([
|
||||
"inset",
|
||||
"inherit",
|
||||
"initial",
|
||||
"revert",
|
||||
"unset"
|
||||
]);
|
||||
let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
||||
;
|
||||
let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
|
||||
function parseBoxShadowValue(input) {
|
||||
let shadows = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, ",");
|
||||
return shadows.map((shadow)=>{
|
||||
let value = shadow.trim();
|
||||
let result = {
|
||||
raw: value
|
||||
};
|
||||
let parts = value.split(SPACE);
|
||||
let seen = new Set();
|
||||
for (let part of parts){
|
||||
// Reset index, since the regex is stateful.
|
||||
LENGTH.lastIndex = 0;
|
||||
// Keyword
|
||||
if (!seen.has("KEYWORD") && KEYWORDS.has(part)) {
|
||||
result.keyword = part;
|
||||
seen.add("KEYWORD");
|
||||
} else if (LENGTH.test(part)) {
|
||||
if (!seen.has("X")) {
|
||||
result.x = part;
|
||||
seen.add("X");
|
||||
} else if (!seen.has("Y")) {
|
||||
result.y = part;
|
||||
seen.add("Y");
|
||||
} else if (!seen.has("BLUR")) {
|
||||
result.blur = part;
|
||||
seen.add("BLUR");
|
||||
} else if (!seen.has("SPREAD")) {
|
||||
result.spread = part;
|
||||
seen.add("SPREAD");
|
||||
}
|
||||
} else {
|
||||
if (!result.color) {
|
||||
result.color = part;
|
||||
} else {
|
||||
if (!result.unknown) result.unknown = [];
|
||||
result.unknown.push(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check if valid
|
||||
result.valid = result.x !== undefined && result.y !== undefined;
|
||||
return result;
|
||||
});
|
||||
}
|
||||
function formatBoxShadowValue(shadows) {
|
||||
return shadows.map((shadow)=>{
|
||||
if (!shadow.valid) {
|
||||
return shadow.raw;
|
||||
}
|
||||
return [
|
||||
shadow.keyword,
|
||||
shadow.x,
|
||||
shadow.y,
|
||||
shadow.blur,
|
||||
shadow.spread,
|
||||
shadow.color
|
||||
].filter(Boolean).join(" ");
|
||||
}).join(", ");
|
||||
}
|
||||
45
node_modules/tailwindcss/lib/util/parseDependency.js
generated
vendored
Normal file
45
node_modules/tailwindcss/lib/util/parseDependency.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
// @ts-check
|
||||
/**
|
||||
* @typedef {{type: 'dependency', file: string} | {type: 'dir-dependency', dir: string, glob: string}} Dependency
|
||||
*/ /**
|
||||
*
|
||||
* @param {import('../lib/content.js').ContentPath} contentPath
|
||||
* @returns {Dependency[]}
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>parseDependency
|
||||
});
|
||||
function parseDependency(contentPath) {
|
||||
if (contentPath.ignore) {
|
||||
return [];
|
||||
}
|
||||
if (!contentPath.glob) {
|
||||
return [
|
||||
{
|
||||
type: "dependency",
|
||||
file: contentPath.base
|
||||
}
|
||||
];
|
||||
}
|
||||
if (process.env.ROLLUP_WATCH === "true") {
|
||||
// rollup-plugin-postcss does not support dir-dependency messages
|
||||
// but directories can be watched in the same way as files
|
||||
return [
|
||||
{
|
||||
type: "dependency",
|
||||
file: contentPath.base
|
||||
}
|
||||
];
|
||||
}
|
||||
return [
|
||||
{
|
||||
type: "dir-dependency",
|
||||
dir: contentPath.base,
|
||||
glob: contentPath.glob
|
||||
}
|
||||
];
|
||||
}
|
||||
34
node_modules/tailwindcss/lib/util/parseGlob.js
generated
vendored
Normal file
34
node_modules/tailwindcss/lib/util/parseGlob.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "parseGlob", {
|
||||
enumerable: true,
|
||||
get: ()=>parseGlob
|
||||
});
|
||||
const _globParent = /*#__PURE__*/ _interopRequireDefault(require("glob-parent"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function parseGlob(pattern) {
|
||||
let glob = pattern;
|
||||
let base = (0, _globParent.default)(pattern);
|
||||
if (base !== ".") {
|
||||
glob = pattern.substr(base.length);
|
||||
if (glob.charAt(0) === "/") {
|
||||
glob = glob.substr(1);
|
||||
}
|
||||
}
|
||||
if (glob.substr(0, 2) === "./") {
|
||||
glob = glob.substr(2);
|
||||
}
|
||||
if (glob.charAt(0) === "/") {
|
||||
glob = glob.substr(1);
|
||||
}
|
||||
return {
|
||||
base,
|
||||
glob
|
||||
};
|
||||
}
|
||||
34
node_modules/tailwindcss/lib/util/parseObjectStyles.js
generated
vendored
Normal file
34
node_modules/tailwindcss/lib/util/parseObjectStyles.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>parseObjectStyles
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _postcssNested = /*#__PURE__*/ _interopRequireDefault(require("postcss-nested"));
|
||||
const _postcssJs = /*#__PURE__*/ _interopRequireDefault(require("postcss-js"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function parseObjectStyles(styles) {
|
||||
if (!Array.isArray(styles)) {
|
||||
return parseObjectStyles([
|
||||
styles
|
||||
]);
|
||||
}
|
||||
return styles.flatMap((style)=>{
|
||||
return (0, _postcss.default)([
|
||||
(0, _postcssNested.default)({
|
||||
bubble: [
|
||||
"screen"
|
||||
]
|
||||
})
|
||||
]).process(style, {
|
||||
parser: _postcssJs.default
|
||||
}).root.nodes;
|
||||
});
|
||||
}
|
||||
278
node_modules/tailwindcss/lib/util/pluginUtils.js
generated
vendored
Normal file
278
node_modules/tailwindcss/lib/util/pluginUtils.js
generated
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
updateAllClasses: ()=>updateAllClasses,
|
||||
filterSelectorsForClass: ()=>filterSelectorsForClass,
|
||||
asValue: ()=>asValue,
|
||||
parseColorFormat: ()=>parseColorFormat,
|
||||
asColor: ()=>asColor,
|
||||
asLookupValue: ()=>asLookupValue,
|
||||
typeMap: ()=>typeMap,
|
||||
coerceValue: ()=>coerceValue,
|
||||
getMatchingTypes: ()=>getMatchingTypes
|
||||
});
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
|
||||
const _withAlphaVariable = require("./withAlphaVariable");
|
||||
const _dataTypes = require("./dataTypes");
|
||||
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
||||
const _validateFormalSyntax = require("./validateFormalSyntax");
|
||||
const _featureFlagsJs = require("../featureFlags.js");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function updateAllClasses(selectors, updateClass) {
|
||||
let parser = (0, _postcssSelectorParser.default)((selectors)=>{
|
||||
selectors.walkClasses((sel)=>{
|
||||
let updatedClass = updateClass(sel.value);
|
||||
sel.value = updatedClass;
|
||||
if (sel.raws && sel.raws.value) {
|
||||
sel.raws.value = (0, _escapeCommas.default)(sel.raws.value);
|
||||
}
|
||||
});
|
||||
});
|
||||
let result = parser.processSync(selectors);
|
||||
return result;
|
||||
}
|
||||
function filterSelectorsForClass(selectors, classCandidate) {
|
||||
let parser = (0, _postcssSelectorParser.default)((selectors)=>{
|
||||
selectors.each((sel)=>{
|
||||
const containsClass = sel.nodes.some((node)=>node.type === "class" && node.value === classCandidate);
|
||||
if (!containsClass) {
|
||||
sel.remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
let result = parser.processSync(selectors);
|
||||
return result;
|
||||
}
|
||||
function resolveArbitraryValue(modifier, validate) {
|
||||
if (!isArbitraryValue(modifier)) {
|
||||
return undefined;
|
||||
}
|
||||
let value = modifier.slice(1, -1);
|
||||
if (!validate(value)) {
|
||||
return undefined;
|
||||
}
|
||||
return (0, _dataTypes.normalize)(value);
|
||||
}
|
||||
function asNegativeValue(modifier, lookup = {}, validate) {
|
||||
let positiveValue = lookup[modifier];
|
||||
if (positiveValue !== undefined) {
|
||||
return (0, _negateValue.default)(positiveValue);
|
||||
}
|
||||
if (isArbitraryValue(modifier)) {
|
||||
let resolved = resolveArbitraryValue(modifier, validate);
|
||||
if (resolved === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return (0, _negateValue.default)(resolved);
|
||||
}
|
||||
}
|
||||
function asValue(modifier, options = {}, { validate =()=>true } = {}) {
|
||||
var ref;
|
||||
let value = (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
||||
if (value !== undefined) {
|
||||
return value;
|
||||
}
|
||||
if (options.supportsNegativeValues && modifier.startsWith("-")) {
|
||||
return asNegativeValue(modifier.slice(1), options.values, validate);
|
||||
}
|
||||
return resolveArbitraryValue(modifier, validate);
|
||||
}
|
||||
function isArbitraryValue(input) {
|
||||
return input.startsWith("[") && input.endsWith("]");
|
||||
}
|
||||
function splitUtilityModifier(modifier) {
|
||||
let slashIdx = modifier.lastIndexOf("/");
|
||||
if (slashIdx === -1 || slashIdx === modifier.length - 1) {
|
||||
return [
|
||||
modifier,
|
||||
undefined
|
||||
];
|
||||
}
|
||||
let arbitrary = isArbitraryValue(modifier);
|
||||
// The modifier could be of the form `[foo]/[bar]`
|
||||
// We want to handle this case properly
|
||||
// without affecting `[foo/bar]`
|
||||
if (arbitrary && !modifier.includes("]/[")) {
|
||||
return [
|
||||
modifier,
|
||||
undefined
|
||||
];
|
||||
}
|
||||
return [
|
||||
modifier.slice(0, slashIdx),
|
||||
modifier.slice(slashIdx + 1)
|
||||
];
|
||||
}
|
||||
function parseColorFormat(value) {
|
||||
if (typeof value === "string" && value.includes("<alpha-value>")) {
|
||||
let oldValue = value;
|
||||
return ({ opacityValue =1 })=>oldValue.replace("<alpha-value>", opacityValue);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function asColor(_, options = {}, { tailwindConfig ={} , utilityModifier , rawModifier } = {}) {
|
||||
var ref;
|
||||
if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[rawModifier]) !== undefined) {
|
||||
var ref1;
|
||||
return parseColorFormat((ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[rawModifier]);
|
||||
}
|
||||
// TODO: Hoist this up to getMatchingTypes or something
|
||||
// We do this here because we need the alpha value (if any)
|
||||
let [color, alpha] = splitUtilityModifier(rawModifier);
|
||||
if (alpha !== undefined) {
|
||||
var ref2, ref3, ref4;
|
||||
var ref5;
|
||||
let normalizedColor = (ref5 = (ref2 = options.values) === null || ref2 === void 0 ? void 0 : ref2[color]) !== null && ref5 !== void 0 ? ref5 : isArbitraryValue(color) ? color.slice(1, -1) : undefined;
|
||||
if (normalizedColor === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
normalizedColor = parseColorFormat(normalizedColor);
|
||||
if (isArbitraryValue(alpha)) {
|
||||
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, alpha.slice(1, -1));
|
||||
}
|
||||
if (((ref3 = tailwindConfig.theme) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.opacity) === null || ref4 === void 0 ? void 0 : ref4[alpha]) === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, tailwindConfig.theme.opacity[alpha]);
|
||||
}
|
||||
return asValue(rawModifier, options, {
|
||||
rawModifier,
|
||||
utilityModifier,
|
||||
validate: _dataTypes.color
|
||||
});
|
||||
}
|
||||
function asLookupValue(modifier, options = {}) {
|
||||
var ref;
|
||||
return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
||||
}
|
||||
function guess(validate) {
|
||||
return (modifier, options, extras)=>{
|
||||
return asValue(modifier, options, {
|
||||
...extras,
|
||||
validate
|
||||
});
|
||||
};
|
||||
}
|
||||
let typeMap = {
|
||||
any: asValue,
|
||||
color: asColor,
|
||||
url: guess(_dataTypes.url),
|
||||
image: guess(_dataTypes.image),
|
||||
length: guess(_dataTypes.length),
|
||||
percentage: guess(_dataTypes.percentage),
|
||||
position: guess(_dataTypes.position),
|
||||
lookup: asLookupValue,
|
||||
"generic-name": guess(_dataTypes.genericName),
|
||||
"family-name": guess(_dataTypes.familyName),
|
||||
number: guess(_dataTypes.number),
|
||||
"line-width": guess(_dataTypes.lineWidth),
|
||||
"absolute-size": guess(_dataTypes.absoluteSize),
|
||||
"relative-size": guess(_dataTypes.relativeSize),
|
||||
shadow: guess(_dataTypes.shadow),
|
||||
size: guess(_validateFormalSyntax.backgroundSize)
|
||||
};
|
||||
let supportedTypes = Object.keys(typeMap);
|
||||
function splitAtFirst(input, delim) {
|
||||
let idx = input.indexOf(delim);
|
||||
if (idx === -1) return [
|
||||
undefined,
|
||||
input
|
||||
];
|
||||
return [
|
||||
input.slice(0, idx),
|
||||
input.slice(idx + 1)
|
||||
];
|
||||
}
|
||||
function coerceValue(types, modifier, options, tailwindConfig) {
|
||||
if (isArbitraryValue(modifier)) {
|
||||
let arbitraryValue = modifier.slice(1, -1);
|
||||
let [explicitType, value] = splitAtFirst(arbitraryValue, ":");
|
||||
// It could be that this resolves to `url(https` which is not a valid
|
||||
// identifier. We currently only support "simple" words with dashes or
|
||||
// underscores. E.g.: family-name
|
||||
if (!/^[\w-_]+$/g.test(explicitType)) {
|
||||
value = arbitraryValue;
|
||||
} else if (explicitType !== undefined && !supportedTypes.includes(explicitType)) {
|
||||
return [];
|
||||
}
|
||||
if (value.length > 0 && supportedTypes.includes(explicitType)) {
|
||||
return [
|
||||
asValue(`[${value}]`, options),
|
||||
explicitType,
|
||||
null
|
||||
];
|
||||
}
|
||||
}
|
||||
let matches = getMatchingTypes(types, modifier, options, tailwindConfig);
|
||||
// Find first matching type
|
||||
for (let match of matches){
|
||||
return match;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
|
||||
let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
||||
let [modifier, utilityModifier] = splitUtilityModifier(rawModifier);
|
||||
let canUseUtilityModifier = modifiersEnabled && options.modifiers != null && (options.modifiers === "any" || typeof options.modifiers === "object" && (utilityModifier && isArbitraryValue(utilityModifier) || utilityModifier in options.modifiers));
|
||||
if (!canUseUtilityModifier) {
|
||||
modifier = rawModifier;
|
||||
utilityModifier = undefined;
|
||||
}
|
||||
if (utilityModifier !== undefined && modifier === "") {
|
||||
modifier = "DEFAULT";
|
||||
}
|
||||
// Check the full value first
|
||||
// TODO: Move to asValue… somehow
|
||||
if (utilityModifier !== undefined) {
|
||||
if (typeof options.modifiers === "object") {
|
||||
var ref;
|
||||
var ref1;
|
||||
let configValue = (ref1 = (ref = options.modifiers) === null || ref === void 0 ? void 0 : ref[utilityModifier]) !== null && ref1 !== void 0 ? ref1 : null;
|
||||
if (configValue !== null) {
|
||||
utilityModifier = configValue;
|
||||
} else if (isArbitraryValue(utilityModifier)) {
|
||||
utilityModifier = utilityModifier.slice(1, -1);
|
||||
}
|
||||
}
|
||||
let result = asValue(rawModifier, options, {
|
||||
rawModifier,
|
||||
utilityModifier,
|
||||
tailwindConfig
|
||||
});
|
||||
if (result !== undefined) {
|
||||
yield [
|
||||
result,
|
||||
"any",
|
||||
null
|
||||
];
|
||||
}
|
||||
}
|
||||
for (const { type } of types !== null && types !== void 0 ? types : []){
|
||||
let result1 = typeMap[type](modifier, options, {
|
||||
rawModifier,
|
||||
utilityModifier,
|
||||
tailwindConfig
|
||||
});
|
||||
if (result1 === undefined) {
|
||||
continue;
|
||||
}
|
||||
yield [
|
||||
result1,
|
||||
type,
|
||||
utilityModifier !== null && utilityModifier !== void 0 ? utilityModifier : null
|
||||
];
|
||||
}
|
||||
}
|
||||
23
node_modules/tailwindcss/lib/util/prefixSelector.js
generated
vendored
Normal file
23
node_modules/tailwindcss/lib/util/prefixSelector.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>_default
|
||||
});
|
||||
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function _default(prefix, selector, prependNegative = false) {
|
||||
return (0, _postcssSelectorParser.default)((selectors)=>{
|
||||
selectors.walkClasses((classSelector)=>{
|
||||
let baseClass = classSelector.value;
|
||||
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
|
||||
classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
|
||||
});
|
||||
}).processSync(selector);
|
||||
}
|
||||
29
node_modules/tailwindcss/lib/util/removeAlphaVariables.js
generated
vendored
Normal file
29
node_modules/tailwindcss/lib/util/removeAlphaVariables.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* This function removes any uses of CSS variables used as an alpha channel
|
||||
*
|
||||
* This is required for selectors like `:visited` which do not allow
|
||||
* changes in opacity or external control using CSS variables.
|
||||
*
|
||||
* @param {import('postcss').Container} container
|
||||
* @param {string[]} toRemove
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "removeAlphaVariables", {
|
||||
enumerable: true,
|
||||
get: ()=>removeAlphaVariables
|
||||
});
|
||||
function removeAlphaVariables(container, toRemove) {
|
||||
container.walkDecls((decl)=>{
|
||||
if (toRemove.includes(decl.prop)) {
|
||||
decl.remove();
|
||||
return;
|
||||
}
|
||||
for (let varName of toRemove){
|
||||
if (decl.value.includes(`/ var(${varName})`)) {
|
||||
decl.value = decl.value.replace(`/ var(${varName})`, "");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
256
node_modules/tailwindcss/lib/util/resolveConfig.js
generated
vendored
Normal file
256
node_modules/tailwindcss/lib/util/resolveConfig.js
generated
vendored
Normal file
@@ -0,0 +1,256 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>resolveConfig
|
||||
});
|
||||
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
||||
const _corePluginList = /*#__PURE__*/ _interopRequireDefault(require("../corePluginList"));
|
||||
const _configurePlugins = /*#__PURE__*/ _interopRequireDefault(require("./configurePlugins"));
|
||||
const _defaultConfigStub = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
|
||||
const _colors = /*#__PURE__*/ _interopRequireDefault(require("../public/colors"));
|
||||
const _defaults = require("./defaults");
|
||||
const _toPath = require("./toPath");
|
||||
const _normalizeConfig = require("./normalizeConfig");
|
||||
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
|
||||
const _cloneDeep = require("./cloneDeep");
|
||||
const _pluginUtils = require("./pluginUtils");
|
||||
const _withAlphaVariable = require("./withAlphaVariable");
|
||||
const _toColorValue = /*#__PURE__*/ _interopRequireDefault(require("./toColorValue"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function isFunction(input) {
|
||||
return typeof input === "function";
|
||||
}
|
||||
function mergeWith(target, ...sources) {
|
||||
let customizer = sources.pop();
|
||||
for (let source of sources){
|
||||
for(let k in source){
|
||||
let merged = customizer(target[k], source[k]);
|
||||
if (merged === undefined) {
|
||||
if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
|
||||
target[k] = mergeWith({}, target[k], source[k], customizer);
|
||||
} else {
|
||||
target[k] = source[k];
|
||||
}
|
||||
} else {
|
||||
target[k] = merged;
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
const configUtils = {
|
||||
colors: _colors.default,
|
||||
negative (scale) {
|
||||
// TODO: Log that this function isn't really needed anymore?
|
||||
return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
|
||||
let negativeValue = (0, _negateValue.default)(scale[key]);
|
||||
if (negativeValue !== undefined) {
|
||||
negativeScale[`-${key}`] = negativeValue;
|
||||
}
|
||||
return negativeScale;
|
||||
}, {});
|
||||
},
|
||||
breakpoints (screens) {
|
||||
return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
|
||||
...breakpoints,
|
||||
[`screen-${key}`]: screens[key]
|
||||
}), {});
|
||||
}
|
||||
};
|
||||
function value(valueToResolve, ...args) {
|
||||
return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
|
||||
}
|
||||
function collectExtends(items) {
|
||||
return items.reduce((merged, { extend })=>{
|
||||
return mergeWith(merged, extend, (mergedValue, extendValue)=>{
|
||||
if (mergedValue === undefined) {
|
||||
return [
|
||||
extendValue
|
||||
];
|
||||
}
|
||||
if (Array.isArray(mergedValue)) {
|
||||
return [
|
||||
extendValue,
|
||||
...mergedValue
|
||||
];
|
||||
}
|
||||
return [
|
||||
extendValue,
|
||||
mergedValue
|
||||
];
|
||||
});
|
||||
}, {});
|
||||
}
|
||||
function mergeThemes(themes) {
|
||||
return {
|
||||
...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
|
||||
// In order to resolve n config objects, we combine all of their `extend` properties
|
||||
// into arrays instead of objects so they aren't overridden.
|
||||
extend: collectExtends(themes)
|
||||
};
|
||||
}
|
||||
function mergeExtensionCustomizer(merged, value) {
|
||||
// When we have an array of objects, we do want to merge it
|
||||
if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
|
||||
return merged.concat(value);
|
||||
}
|
||||
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
||||
if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
|
||||
return [
|
||||
merged,
|
||||
...value
|
||||
];
|
||||
}
|
||||
// Override arrays (for example for font-families, box-shadows, ...)
|
||||
if (Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
// Execute default behaviour
|
||||
return undefined;
|
||||
}
|
||||
function mergeExtensions({ extend , ...theme }) {
|
||||
return mergeWith(theme, extend, (themeValue, extensions)=>{
|
||||
// The `extend` property is an array, so we need to check if it contains any functions
|
||||
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
||||
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
|
||||
}
|
||||
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
||||
themeValue,
|
||||
...extensions
|
||||
].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {string} key
|
||||
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
||||
*/ function* toPaths(key) {
|
||||
let path = (0, _toPath.toPath)(key);
|
||||
if (path.length === 0) {
|
||||
return;
|
||||
}
|
||||
yield path;
|
||||
if (Array.isArray(key)) {
|
||||
return;
|
||||
}
|
||||
let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
|
||||
let matches = key.match(pattern);
|
||||
if (matches !== null) {
|
||||
let [, prefix, alpha] = matches;
|
||||
let newPath = (0, _toPath.toPath)(prefix);
|
||||
newPath.alpha = alpha;
|
||||
yield newPath;
|
||||
}
|
||||
}
|
||||
function resolveFunctionKeys(object) {
|
||||
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
||||
const resolvePath = (key, defaultValue)=>{
|
||||
for (const path of toPaths(key)){
|
||||
let index = 0;
|
||||
let val = object;
|
||||
while(val !== undefined && val !== null && index < path.length){
|
||||
val = val[path[index++]];
|
||||
let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
|
||||
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
|
||||
}
|
||||
if (val !== undefined) {
|
||||
if (path.alpha !== undefined) {
|
||||
let normalized = (0, _pluginUtils.parseColorFormat)(val);
|
||||
return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
|
||||
}
|
||||
if ((0, _isPlainObject.default)(val)) {
|
||||
return (0, _cloneDeep.cloneDeep)(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
};
|
||||
Object.assign(resolvePath, {
|
||||
theme: resolvePath,
|
||||
...configUtils
|
||||
});
|
||||
return Object.keys(object).reduce((resolved, key)=>{
|
||||
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
|
||||
return resolved;
|
||||
}, {});
|
||||
}
|
||||
function extractPluginConfigs(configs) {
|
||||
let allConfigs = [];
|
||||
configs.forEach((config)=>{
|
||||
allConfigs = [
|
||||
...allConfigs,
|
||||
config
|
||||
];
|
||||
var ref;
|
||||
const plugins = (ref = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref !== void 0 ? ref : [];
|
||||
if (plugins.length === 0) {
|
||||
return;
|
||||
}
|
||||
plugins.forEach((plugin)=>{
|
||||
if (plugin.__isOptionsFunction) {
|
||||
plugin = plugin();
|
||||
}
|
||||
var ref;
|
||||
allConfigs = [
|
||||
...allConfigs,
|
||||
...extractPluginConfigs([
|
||||
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
|
||||
])
|
||||
];
|
||||
});
|
||||
});
|
||||
return allConfigs;
|
||||
}
|
||||
function resolveCorePlugins(corePluginConfigs) {
|
||||
const result = [
|
||||
...corePluginConfigs
|
||||
].reduceRight((resolved, corePluginConfig)=>{
|
||||
if (isFunction(corePluginConfig)) {
|
||||
return corePluginConfig({
|
||||
corePlugins: resolved
|
||||
});
|
||||
}
|
||||
return (0, _configurePlugins.default)(corePluginConfig, resolved);
|
||||
}, _corePluginList.default);
|
||||
return result;
|
||||
}
|
||||
function resolvePluginLists(pluginLists) {
|
||||
const result = [
|
||||
...pluginLists
|
||||
].reduceRight((resolved, pluginList)=>{
|
||||
return [
|
||||
...resolved,
|
||||
...pluginList
|
||||
];
|
||||
}, []);
|
||||
return result;
|
||||
}
|
||||
function resolveConfig(configs) {
|
||||
let allConfigs = [
|
||||
...extractPluginConfigs(configs),
|
||||
{
|
||||
prefix: "",
|
||||
important: false,
|
||||
separator: ":",
|
||||
variantOrder: _defaultConfigStub.default.variantOrder
|
||||
}
|
||||
];
|
||||
var ref, ref1;
|
||||
return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
|
||||
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
||||
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
|
||||
})))),
|
||||
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
||||
plugins: resolvePluginLists(configs.map((c)=>{
|
||||
return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
|
||||
}))
|
||||
}, ...allConfigs));
|
||||
}
|
||||
54
node_modules/tailwindcss/lib/util/resolveConfigPath.js
generated
vendored
Normal file
54
node_modules/tailwindcss/lib/util/resolveConfigPath.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>resolveConfigPath
|
||||
});
|
||||
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
||||
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function isObject(value) {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
function isEmpty(obj) {
|
||||
return Object.keys(obj).length === 0;
|
||||
}
|
||||
function isString(value) {
|
||||
return typeof value === "string" || value instanceof String;
|
||||
}
|
||||
function resolveConfigPath(pathOrConfig) {
|
||||
// require('tailwindcss')({ theme: ..., variants: ... })
|
||||
if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
|
||||
return null;
|
||||
}
|
||||
// require('tailwindcss')({ config: 'custom-config.js' })
|
||||
if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
|
||||
return _path.default.resolve(pathOrConfig.config);
|
||||
}
|
||||
// require('tailwindcss')({ config: { theme: ..., variants: ... } })
|
||||
if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
|
||||
return null;
|
||||
}
|
||||
// require('tailwindcss')('custom-config.js')
|
||||
if (isString(pathOrConfig)) {
|
||||
return _path.default.resolve(pathOrConfig);
|
||||
}
|
||||
// require('tailwindcss')
|
||||
for (const configFile of [
|
||||
"./tailwind.config.js",
|
||||
"./tailwind.config.cjs"
|
||||
]){
|
||||
try {
|
||||
const configPath = _path.default.resolve(configFile);
|
||||
_fs.default.accessSync(configPath);
|
||||
return configPath;
|
||||
} catch (err) {}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
22
node_modules/tailwindcss/lib/util/responsive.js
generated
vendored
Normal file
22
node_modules/tailwindcss/lib/util/responsive.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>responsive
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _cloneNodes = /*#__PURE__*/ _interopRequireDefault(require("./cloneNodes"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function responsive(rules) {
|
||||
return _postcss.default.atRule({
|
||||
name: "responsive"
|
||||
}).append((0, _cloneNodes.default)(Array.isArray(rules) ? rules : [
|
||||
rules
|
||||
]));
|
||||
}
|
||||
43
node_modules/tailwindcss/lib/util/splitAtTopLevelOnly.js
generated
vendored
Normal file
43
node_modules/tailwindcss/lib/util/splitAtTopLevelOnly.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* This splits a string on a top-level character.
|
||||
*
|
||||
* Regex doesn't support recursion (at least not the JS-flavored version).
|
||||
* So we have to use a tiny state machine to keep track of paren placement.
|
||||
*
|
||||
* Expected behavior using commas:
|
||||
* var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
|
||||
* ─┬─ ┬ ┬ ┬
|
||||
* x x x ╰──────── Split because top-level
|
||||
* ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
|
||||
*
|
||||
* @param {string} input
|
||||
* @param {string} separator
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "splitAtTopLevelOnly", {
|
||||
enumerable: true,
|
||||
get: ()=>splitAtTopLevelOnly
|
||||
});
|
||||
function splitAtTopLevelOnly(input, separator) {
|
||||
let stack = [];
|
||||
let parts = [];
|
||||
let lastPos = 0;
|
||||
for(let idx = 0; idx < input.length; idx++){
|
||||
let char = input[idx];
|
||||
if (stack.length === 0 && char === separator[0]) {
|
||||
if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
|
||||
parts.push(input.slice(lastPos, idx));
|
||||
lastPos = idx + separator.length;
|
||||
}
|
||||
}
|
||||
if (char === "(" || char === "[" || char === "{") {
|
||||
stack.push(char);
|
||||
} else if (char === ")" && stack[stack.length - 1] === "(" || char === "]" && stack[stack.length - 1] === "[" || char === "}" && stack[stack.length - 1] === "{") {
|
||||
stack.pop();
|
||||
}
|
||||
}
|
||||
parts.push(input.slice(lastPos));
|
||||
return parts;
|
||||
}
|
||||
12
node_modules/tailwindcss/lib/util/tap.js
generated
vendored
Normal file
12
node_modules/tailwindcss/lib/util/tap.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "tap", {
|
||||
enumerable: true,
|
||||
get: ()=>tap
|
||||
});
|
||||
function tap(value, mutator) {
|
||||
mutator(value);
|
||||
return value;
|
||||
}
|
||||
11
node_modules/tailwindcss/lib/util/toColorValue.js
generated
vendored
Normal file
11
node_modules/tailwindcss/lib/util/toColorValue.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>toColorValue
|
||||
});
|
||||
function toColorValue(maybeFunction) {
|
||||
return typeof maybeFunction === "function" ? maybeFunction({}) : maybeFunction;
|
||||
}
|
||||
30
node_modules/tailwindcss/lib/util/toPath.js
generated
vendored
Normal file
30
node_modules/tailwindcss/lib/util/toPath.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Parse a path string into an array of path segments.
|
||||
*
|
||||
* Square bracket notation `a[b]` may be used to "escape" dots that would otherwise be interpreted as path separators.
|
||||
*
|
||||
* Example:
|
||||
* a -> ['a']
|
||||
* a.b.c -> ['a', 'b', 'c']
|
||||
* a[b].c -> ['a', 'b', 'c']
|
||||
* a[b.c].e.f -> ['a', 'b.c', 'e', 'f']
|
||||
* a[b][c][d] -> ['a', 'b', 'c', 'd']
|
||||
*
|
||||
* @param {string|string[]} path
|
||||
**/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "toPath", {
|
||||
enumerable: true,
|
||||
get: ()=>toPath
|
||||
});
|
||||
function toPath(path) {
|
||||
if (Array.isArray(path)) return path;
|
||||
let openBrackets = path.split("[").length - 1;
|
||||
let closedBrackets = path.split("]").length - 1;
|
||||
if (openBrackets !== closedBrackets) {
|
||||
throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
|
||||
}
|
||||
return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
|
||||
}
|
||||
71
node_modules/tailwindcss/lib/util/transformThemeValue.js
generated
vendored
Normal file
71
node_modules/tailwindcss/lib/util/transformThemeValue.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: ()=>transformThemeValue
|
||||
});
|
||||
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
||||
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function transformThemeValue(themeSection) {
|
||||
if ([
|
||||
"fontSize",
|
||||
"outline"
|
||||
].includes(themeSection)) {
|
||||
return (value)=>{
|
||||
if (typeof value === "function") value = value({});
|
||||
if (Array.isArray(value)) value = value[0];
|
||||
return value;
|
||||
};
|
||||
}
|
||||
if (themeSection === "fontFamily") {
|
||||
return (value)=>{
|
||||
if (typeof value === "function") value = value({});
|
||||
let families = Array.isArray(value) && (0, _isPlainObject.default)(value[1]) ? value[0] : value;
|
||||
return Array.isArray(families) ? families.join(", ") : families;
|
||||
};
|
||||
}
|
||||
if ([
|
||||
"boxShadow",
|
||||
"transitionProperty",
|
||||
"transitionDuration",
|
||||
"transitionDelay",
|
||||
"transitionTimingFunction",
|
||||
"backgroundImage",
|
||||
"backgroundSize",
|
||||
"backgroundColor",
|
||||
"cursor",
|
||||
"animation"
|
||||
].includes(themeSection)) {
|
||||
return (value)=>{
|
||||
if (typeof value === "function") value = value({});
|
||||
if (Array.isArray(value)) value = value.join(", ");
|
||||
return value;
|
||||
};
|
||||
}
|
||||
// For backwards compatibility reasons, before we switched to underscores
|
||||
// instead of commas for arbitrary values.
|
||||
if ([
|
||||
"gridTemplateColumns",
|
||||
"gridTemplateRows",
|
||||
"objectPosition"
|
||||
].includes(themeSection)) {
|
||||
return (value)=>{
|
||||
if (typeof value === "function") value = value({});
|
||||
if (typeof value === "string") value = _postcss.default.list.comma(value).join(" ");
|
||||
return value;
|
||||
};
|
||||
}
|
||||
return (value, opts = {})=>{
|
||||
if (typeof value === "function") {
|
||||
value = value(opts);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
}
|
||||
24
node_modules/tailwindcss/lib/util/validateConfig.js
generated
vendored
Normal file
24
node_modules/tailwindcss/lib/util/validateConfig.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "validateConfig", {
|
||||
enumerable: true,
|
||||
get: ()=>validateConfig
|
||||
});
|
||||
const _log = /*#__PURE__*/ _interopRequireDefault(require("./log"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function validateConfig(config) {
|
||||
if (config.content.files.length === 0) {
|
||||
_log.default.warn("content-problems", [
|
||||
"The `content` option in your Tailwind CSS configuration is missing or empty.",
|
||||
"Configure your content sources or your generated CSS will be missing styles.",
|
||||
"https://tailwindcss.com/docs/content-configuration"
|
||||
]);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
24
node_modules/tailwindcss/lib/util/validateFormalSyntax.js
generated
vendored
Normal file
24
node_modules/tailwindcss/lib/util/validateFormalSyntax.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "backgroundSize", {
|
||||
enumerable: true,
|
||||
get: ()=>backgroundSize
|
||||
});
|
||||
const _dataTypes = require("./dataTypes");
|
||||
const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
|
||||
function backgroundSize(value) {
|
||||
let keywordValues = [
|
||||
"cover",
|
||||
"contain"
|
||||
];
|
||||
// the <length-percentage> type will probably be a css function
|
||||
// so we have to use `splitAtTopLevelOnly`
|
||||
return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>{
|
||||
let sizes = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(part, "_").filter(Boolean);
|
||||
if (sizes.length === 1 && keywordValues.includes(sizes[0])) return true;
|
||||
if (sizes.length !== 1 && sizes.length !== 2) return false;
|
||||
return sizes.every((size)=>(0, _dataTypes.length)(size) || (0, _dataTypes.percentage)(size) || size === "auto");
|
||||
});
|
||||
}
|
||||
75
node_modules/tailwindcss/lib/util/withAlphaVariable.js
generated
vendored
Normal file
75
node_modules/tailwindcss/lib/util/withAlphaVariable.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
withAlphaValue: ()=>withAlphaValue,
|
||||
default: ()=>withAlphaVariable
|
||||
});
|
||||
const _color = require("./color");
|
||||
function withAlphaValue(color, alphaValue, defaultValue) {
|
||||
if (typeof color === "function") {
|
||||
return color({
|
||||
opacityValue: alphaValue
|
||||
});
|
||||
}
|
||||
let parsed = (0, _color.parseColor)(color, {
|
||||
loose: true
|
||||
});
|
||||
if (parsed === null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return (0, _color.formatColor)({
|
||||
...parsed,
|
||||
alpha: alphaValue
|
||||
});
|
||||
}
|
||||
function withAlphaVariable({ color , property , variable }) {
|
||||
let properties = [].concat(property);
|
||||
if (typeof color === "function") {
|
||||
return {
|
||||
[variable]: "1",
|
||||
...Object.fromEntries(properties.map((p)=>{
|
||||
return [
|
||||
p,
|
||||
color({
|
||||
opacityVariable: variable,
|
||||
opacityValue: `var(${variable})`
|
||||
})
|
||||
];
|
||||
}))
|
||||
};
|
||||
}
|
||||
const parsed = (0, _color.parseColor)(color);
|
||||
if (parsed === null) {
|
||||
return Object.fromEntries(properties.map((p)=>[
|
||||
p,
|
||||
color
|
||||
]));
|
||||
}
|
||||
if (parsed.alpha !== undefined) {
|
||||
// Has an alpha value, return color as-is
|
||||
return Object.fromEntries(properties.map((p)=>[
|
||||
p,
|
||||
color
|
||||
]));
|
||||
}
|
||||
return {
|
||||
[variable]: "1",
|
||||
...Object.fromEntries(properties.map((p)=>{
|
||||
return [
|
||||
p,
|
||||
(0, _color.formatColor)({
|
||||
...parsed,
|
||||
alpha: `var(${variable})`
|
||||
})
|
||||
];
|
||||
}))
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user