tailwindcss
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -248,5 +248,5 @@ // @ts-check | ||
postcssPlugin: "tailwindcss", | ||
Once (root, { result }) { | ||
async Once (root, { result }) { | ||
_sharedState.env.DEBUG && console.time("Compiling CSS"); | ||
(0, _processTailwindFeatures.default)(({ createContext })=>{ | ||
await (0, _processTailwindFeatures.default)(({ createContext })=>{ | ||
console.error(); | ||
@@ -253,0 +253,0 @@ console.error("Rebuilding..."); |
@@ -14,3 +14,3 @@ "use strict"; | ||
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue")); | ||
const _postcssvalueparser = /*#__PURE__*/ _interop_require_default(require("postcss-value-parser")); | ||
const _index = /*#__PURE__*/ _interop_require_default(require("../value-parser/index")); | ||
const _normalizeScreens = require("../util/normalizeScreens"); | ||
@@ -125,3 +125,3 @@ const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery")); | ||
} else { | ||
args[args.length - 1] += _postcssvalueparser.default.stringify(vNode); | ||
args[args.length - 1] += _index.default.stringify(vNode); | ||
} | ||
@@ -140,3 +140,5 @@ } | ||
function resolveFunctions(node, input, functions) { | ||
return (0, _postcssvalueparser.default)(input).walk((vNode)=>{ | ||
let hasAnyFn = Object.keys(functions).some((fn)=>input.includes(`${fn}(`)); | ||
if (!hasAnyFn) return input; | ||
return (0, _index.default)(input).walk((vNode)=>{ | ||
resolveVNode(node, vNode, functions); | ||
@@ -143,0 +145,0 @@ }).toString(); |
@@ -127,3 +127,3 @@ "use strict"; | ||
function expandTailwindAtRules(context) { | ||
return (root)=>{ | ||
return async (root)=>{ | ||
let layerNodes = { | ||
@@ -169,8 +169,8 @@ base: null, | ||
} else { | ||
for (let { file , content , extension } of context.changedContent){ | ||
await Promise.all(context.changedContent.map(async ({ file , content , extension })=>{ | ||
let transformer = getTransformer(context.tailwindConfig, extension); | ||
let extractor = getExtractor(context, extension); | ||
content = file ? _fs.default.readFileSync(file, "utf8") : content; | ||
content = file ? await _fs.default.promises.readFile(file, "utf8") : content; | ||
getClassCandidates(transformer(content), extractor, candidates, seen); | ||
} | ||
})); | ||
} | ||
@@ -177,0 +177,0 @@ env.DEBUG && console.timeEnd("Reading changed files"); |
@@ -234,8 +234,8 @@ "use strict"; | ||
if (match) { | ||
let [, char, seperator, value] = match; | ||
let [, char, separator, value] = match; | ||
// @-[200px] case | ||
if (char === "@" && seperator === "-") return []; | ||
if (char === "@" && separator === "-") return []; | ||
// group[:hover] case | ||
if (char !== "@" && seperator === "") return []; | ||
variant = variant.replace(`${seperator}[${value}]`, ""); | ||
if (char !== "@" && separator === "") return []; | ||
variant = variant.replace(`${separator}[${value}]`, ""); | ||
args.value = value; | ||
@@ -263,5 +263,13 @@ } | ||
if (context.variantMap.has(variant)) { | ||
var _context_variantOptions_get; | ||
let isArbitraryVariant = isArbitraryValue(variant); | ||
var _context_variantOptions_get_INTERNAL_FEATURES; | ||
let internalFeatures = (_context_variantOptions_get_INTERNAL_FEATURES = (_context_variantOptions_get = context.variantOptions.get(variant)) === null || _context_variantOptions_get === void 0 ? void 0 : _context_variantOptions_get[_setupContextUtils.INTERNAL_FEATURES]) !== null && _context_variantOptions_get_INTERNAL_FEATURES !== void 0 ? _context_variantOptions_get_INTERNAL_FEATURES : {}; | ||
let variantFunctionTuples = context.variantMap.get(variant).slice(); | ||
let result = []; | ||
let respectPrefix = (()=>{ | ||
if (isArbitraryVariant) return false; | ||
if (internalFeatures.respectPrefix === false) return false; | ||
return true; | ||
})(); | ||
for (let [meta, rule] of matches){ | ||
@@ -323,3 +331,3 @@ // Don't generate variants for user css | ||
format: selectorFormat, | ||
isArbitraryVariant | ||
respectPrefix | ||
}); | ||
@@ -350,3 +358,3 @@ }, | ||
format: ruleWithVariant, | ||
isArbitraryVariant | ||
respectPrefix | ||
}); | ||
@@ -390,3 +398,3 @@ } | ||
format: modified.replace(rebuiltBase, "&"), | ||
isArbitraryVariant | ||
respectPrefix | ||
}); | ||
@@ -393,0 +401,0 @@ rule.selector = before; |
@@ -12,2 +12,5 @@ "use strict"; | ||
_export(exports, { | ||
INTERNAL_FEATURES: function() { | ||
return INTERNAL_FEATURES; | ||
}, | ||
isValidVariantFormatString: function() { | ||
@@ -96,2 +99,3 @@ return isValidVariantFormatString; | ||
} | ||
const INTERNAL_FEATURES = Symbol(); | ||
const VARIANT_TYPES = { | ||
@@ -275,7 +279,10 @@ AddVariant: Symbol.for("ADD_VARIANT"), | ||
} | ||
let [, name, params] = /@(.*?)( .+|[({].*)/g.exec(str); | ||
return ({ wrap })=>wrap(_postcss.default.atRule({ | ||
let [, name, params] = /@(\S*)( .+|[({].*)?/g.exec(str); | ||
var _params_trim; | ||
return ({ wrap })=>{ | ||
return wrap(_postcss.default.atRule({ | ||
name, | ||
params: params.trim() | ||
params: (_params_trim = params === null || params === void 0 ? void 0 : params.trim()) !== null && _params_trim !== void 0 ? _params_trim : "" | ||
})); | ||
}; | ||
}).reverse(); | ||
@@ -930,3 +937,7 @@ return (api)=>{ | ||
for (const [, rule] of rules){ | ||
sortedClassNames.set(rule.raws.tailwind.candidate, idx++); | ||
let candidate = rule.raws.tailwind.candidate; | ||
var _sortedClassNames_get; | ||
// When multiple rules match a candidate | ||
// always take the position of the first one | ||
sortedClassNames.set(candidate, (_sortedClassNames_get = sortedClassNames.get(candidate)) !== null && _sortedClassNames_get !== void 0 ? _sortedClassNames_get : idx++); | ||
} | ||
@@ -1102,9 +1113,16 @@ return classes.map((className)=>{ | ||
let isArbitraryVariant = !(value in ((_options_values1 = options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {})); | ||
var _options_INTERNAL_FEATURES; | ||
let internalFeatures = (_options_INTERNAL_FEATURES = options[INTERNAL_FEATURES]) !== null && _options_INTERNAL_FEATURES !== void 0 ? _options_INTERNAL_FEATURES : {}; | ||
let respectPrefix = (()=>{ | ||
if (isArbitraryVariant) return false; | ||
if (internalFeatures.respectPrefix === false) return false; | ||
return true; | ||
})(); | ||
formatStrings = formatStrings.map((format)=>format.map((str)=>({ | ||
format: str, | ||
isArbitraryVariant | ||
respectPrefix | ||
}))); | ||
manualFormatStrings = manualFormatStrings.map((format)=>({ | ||
format, | ||
isArbitraryVariant | ||
respectPrefix | ||
})); | ||
@@ -1111,0 +1129,0 @@ let opts = { |
@@ -86,4 +86,5 @@ // @ts-check | ||
} | ||
var _configOrPath_config, _ref; | ||
// It's a plain object, not a path | ||
let newConfig = (0, _resolveconfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config); | ||
let newConfig = (0, _resolveconfig.default)((_ref = (_configOrPath_config = configOrPath === null || configOrPath === void 0 ? void 0 : configOrPath.config) !== null && _configOrPath_config !== void 0 ? _configOrPath_config : configOrPath) !== null && _ref !== void 0 ? _ref : {}); | ||
newConfig = (0, _validateConfig.validateConfig)(newConfig); | ||
@@ -90,0 +91,0 @@ return [ |
@@ -23,3 +23,3 @@ "use strict"; | ||
}, | ||
function(root, result) { | ||
async function(root, result) { | ||
var _findAtConfigPath1; | ||
@@ -34,3 +34,3 @@ // Use the path for the `@config` directive if it exists, otherwise use the | ||
if (root.type === "root") { | ||
(0, _processTailwindFeatures.default)(context)(root, result); | ||
await (0, _processTailwindFeatures.default)(context)(root, result); | ||
} | ||
@@ -40,3 +40,3 @@ } | ||
} | ||
(0, _processTailwindFeatures.default)(context)(root, result); | ||
await (0, _processTailwindFeatures.default)(context)(root, result); | ||
}, | ||
@@ -43,0 +43,0 @@ false && function lightningCssPlugin(_root, result) { |
@@ -29,3 +29,3 @@ "use strict"; | ||
function processTailwindFeatures(setupContext) { | ||
return function(root, result) { | ||
return async function(root, result) { | ||
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root); | ||
@@ -54,3 +54,3 @@ (0, _detectNesting.default)()(root, result); | ||
(0, _featureFlags.issueFlagNotices)(context.tailwindConfig); | ||
(0, _expandTailwindAtRules.default)(context)(root, result); | ||
await (0, _expandTailwindAtRules.default)(context)(root, result); | ||
// Partition apply rules that are generated by | ||
@@ -57,0 +57,0 @@ // addComponents, addUtilities and so on. |
@@ -92,5 +92,13 @@ "use strict"; | ||
} | ||
// 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)=>{ | ||
value = normalizeMathOperatorSpacing(value); | ||
return value; | ||
} | ||
/** | ||
* Add spaces around operators inside math functions | ||
* like calc() that do not follow an operator or '('. | ||
* | ||
* @param {string} value | ||
* @returns {string} | ||
*/ function normalizeMathOperatorSpacing(value) { | ||
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{ | ||
let vars = []; | ||
@@ -102,3 +110,2 @@ return match.replace(/var\((--.+?)[,)]/g, (match, g1)=>{ | ||
}); | ||
return value; | ||
} | ||
@@ -204,7 +211,8 @@ function url(value) { | ||
let gradientTypes = new Set([ | ||
"conic-gradient", | ||
"linear-gradient", | ||
"radial-gradient", | ||
"repeating-conic-gradient", | ||
"repeating-linear-gradient", | ||
"repeating-radial-gradient", | ||
"conic-gradient" | ||
"repeating-radial-gradient" | ||
]); | ||
@@ -211,0 +219,0 @@ function gradient(value) { |
@@ -35,3 +35,3 @@ "use strict"; | ||
} | ||
/** @typedef {import('postcss-selector-parser').Root} Root */ /** @typedef {import('postcss-selector-parser').Selector} Selector */ /** @typedef {import('postcss-selector-parser').Pseudo} Pseudo */ /** @typedef {import('postcss-selector-parser').Node} Node */ /** @typedef {{format: string, isArbitraryVariant: boolean}[]} RawFormats */ /** @typedef {import('postcss-selector-parser').Root} ParsedFormats */ /** @typedef {RawFormats | ParsedFormats} AcceptedFormats */ let MERGE = ":merge"; | ||
/** @typedef {import('postcss-selector-parser').Root} Root */ /** @typedef {import('postcss-selector-parser').Selector} Selector */ /** @typedef {import('postcss-selector-parser').Pseudo} Pseudo */ /** @typedef {import('postcss-selector-parser').Node} Node */ /** @typedef {{format: string, respectPrefix: boolean}[]} RawFormats */ /** @typedef {import('postcss-selector-parser').Root} ParsedFormats */ /** @typedef {RawFormats | ParsedFormats} AcceptedFormats */ let MERGE = ":merge"; | ||
function formatVariantSelector(formats, { context , candidate }) { | ||
@@ -45,3 +45,3 @@ var _context_tailwindConfig_prefix; | ||
...format, | ||
ast: format.isArbitraryVariant ? ast : (0, _prefixSelector.default)(prefix, ast) | ||
ast: format.respectPrefix ? (0, _prefixSelector.default)(prefix, ast) : ast | ||
}; | ||
@@ -48,0 +48,0 @@ }); |
@@ -32,3 +32,3 @@ "use strict"; | ||
} | ||
let ast = typeof selector === "string" ? (0, _postcssselectorparser.default)().astSync(selector) : selector; | ||
/** @type {import('postcss-selector-parser').Root} */ let ast = typeof selector === "string" ? (0, _postcssselectorparser.default)().astSync(selector) : selector; | ||
ast.walkClasses((classSelector)=>{ | ||
@@ -35,0 +35,0 @@ let baseClass = classSelector.value; |
@@ -14,3 +14,3 @@ /** @typedef {import('postcss-selector-parser').Root} Root */ /** @typedef {import('postcss-selector-parser').Selector} Selector */ /** @typedef {import('postcss-selector-parser').Pseudo} Pseudo */ /** @typedef {import('postcss-selector-parser').Node} Node */ // There are some pseudo-elements that may or may not be: | ||
// | ||
// This is a backwards-compat quirk of :before and :after variants. | ||
// This is a backwards-compat quirk of pseudo element variants from earlier versions of Tailwind CSS. | ||
/** @typedef {'terminal' | 'actionable' | 'jumpable'} PseudoProperty */ /** @type {Record<string, PseudoProperty[]>} */ "use strict"; | ||
@@ -27,2 +27,3 @@ Object.defineProperty(exports, "__esModule", { | ||
let elementProperties = { | ||
// Pseudo elements from the spec | ||
"::after": [ | ||
@@ -33,3 +34,4 @@ "terminal", | ||
"::backdrop": [ | ||
"terminal" | ||
"terminal", | ||
"jumpable" | ||
], | ||
@@ -58,3 +60,4 @@ "::before": [ | ||
"::marker": [ | ||
"terminal" | ||
"terminal", | ||
"jumpable" | ||
], | ||
@@ -66,6 +69,8 @@ "::part": [ | ||
"::placeholder": [ | ||
"terminal" | ||
"terminal", | ||
"jumpable" | ||
], | ||
"::selection": [ | ||
"terminal" | ||
"terminal", | ||
"jumpable" | ||
], | ||
@@ -81,3 +86,3 @@ "::slotted": [ | ||
], | ||
// other | ||
// Pseudo elements from the spec with special rules | ||
"::file-selector-button": [ | ||
@@ -87,35 +92,13 @@ "terminal", | ||
], | ||
"::-webkit-progress-bar": [ | ||
"terminal", | ||
// Library-specific pseudo elements used by component libraries | ||
// These are Shadow DOM-like | ||
"::deep": [ | ||
"actionable" | ||
], | ||
// Webkit scroll bar pseudo elements can be combined with user-action pseudo classes | ||
"::-webkit-scrollbar": [ | ||
"terminal", | ||
"::v-deep": [ | ||
"actionable" | ||
], | ||
"::-webkit-scrollbar-button": [ | ||
"terminal", | ||
"::ng-deep": [ | ||
"actionable" | ||
], | ||
"::-webkit-scrollbar-thumb": [ | ||
"terminal", | ||
"actionable" | ||
], | ||
"::-webkit-scrollbar-track": [ | ||
"terminal", | ||
"actionable" | ||
], | ||
"::-webkit-scrollbar-track-piece": [ | ||
"terminal", | ||
"actionable" | ||
], | ||
"::-webkit-scrollbar-corner": [ | ||
"terminal", | ||
"actionable" | ||
], | ||
"::-webkit-resizer": [ | ||
"terminal", | ||
"actionable" | ||
], | ||
// Note: As a rule, double colons (::) should be used instead of a single colon | ||
@@ -143,4 +126,5 @@ // (:). This distinguishes pseudo-classes from pseudo-elements. However, since | ||
// Because it's not recognized, we don't know if it's terminal or not | ||
// So we assume it can't be moved AND can have user-action pseudo classes attached to it | ||
// So we assume it can be moved AND can have user-action pseudo classes attached to it | ||
__default__: [ | ||
"terminal", | ||
"actionable" | ||
@@ -147,0 +131,0 @@ ] |
{ | ||
"name": "tailwindcss", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "A utility-first CSS framework for rapidly building custom user interfaces.", | ||
@@ -90,3 +90,2 @@ "license": "MIT", | ||
"postcss-selector-parser": "^6.0.11", | ||
"postcss-value-parser": "^4.2.0", | ||
"resolve": "^1.22.2", | ||
@@ -93,0 +92,0 @@ "sucrase": "^3.32.0" |
@@ -281,5 +281,5 @@ // @ts-check | ||
postcssPlugin: 'tailwindcss', | ||
Once(root, { result }) { | ||
async Once(root, { result }) { | ||
env.DEBUG && console.time('Compiling CSS') | ||
tailwind(({ createContext }) => { | ||
await tailwind(({ createContext }) => { | ||
console.error() | ||
@@ -286,0 +286,0 @@ console.error('Rebuilding...') |
import dlv from 'dlv' | ||
import didYouMean from 'didyoumean' | ||
import transformThemeValue from '../util/transformThemeValue' | ||
import parseValue from 'postcss-value-parser' | ||
import parseValue from '../value-parser/index' | ||
import { normalizeScreens } from '../util/normalizeScreens' | ||
@@ -149,2 +149,5 @@ import buildMediaQuery from '../util/buildMediaQuery' | ||
function resolveFunctions(node, input, functions) { | ||
let hasAnyFn = Object.keys(functions).some((fn) => input.includes(`${fn}(`)) | ||
if (!hasAnyFn) return input | ||
return parseValue(input) | ||
@@ -151,0 +154,0 @@ .walk((vNode) => { |
@@ -101,3 +101,3 @@ import fs from 'fs' | ||
export default function expandTailwindAtRules(context) { | ||
return (root) => { | ||
return async (root) => { | ||
let layerNodes = { | ||
@@ -149,8 +149,10 @@ base: null, | ||
} else { | ||
for (let { file, content, extension } of context.changedContent) { | ||
let transformer = getTransformer(context.tailwindConfig, extension) | ||
let extractor = getExtractor(context, extension) | ||
content = file ? fs.readFileSync(file, 'utf8') : content | ||
getClassCandidates(transformer(content), extractor, candidates, seen) | ||
} | ||
await Promise.all( | ||
context.changedContent.map(async ({ file, content, extension }) => { | ||
let transformer = getTransformer(context.tailwindConfig, extension) | ||
let extractor = getExtractor(context, extension) | ||
content = file ? await fs.promises.readFile(file, 'utf8') : content | ||
getClassCandidates(transformer(content), extractor, candidates, seen) | ||
}) | ||
) | ||
} | ||
@@ -157,0 +159,0 @@ |
@@ -16,3 +16,3 @@ import postcss from 'postcss' | ||
import { normalize } from '../util/dataTypes' | ||
import { isValidVariantFormatString, parseVariant } from './setupContextUtils' | ||
import { isValidVariantFormatString, parseVariant, INTERNAL_FEATURES } from './setupContextUtils' | ||
import isValidArbitraryValue from '../util/isSyntacticallyValidPropertyValue' | ||
@@ -197,9 +197,9 @@ import { splitAtTopLevelOnly } from '../util/splitAtTopLevelOnly.js' | ||
if (match) { | ||
let [, char, seperator, value] = match | ||
let [, char, separator, value] = match | ||
// @-[200px] case | ||
if (char === '@' && seperator === '-') return [] | ||
if (char === '@' && separator === '-') return [] | ||
// group[:hover] case | ||
if (char !== '@' && seperator === '') return [] | ||
if (char !== '@' && separator === '') return [] | ||
variant = variant.replace(`${seperator}[${value}]`, '') | ||
variant = variant.replace(`${separator}[${value}]`, '') | ||
args.value = value | ||
@@ -235,5 +235,12 @@ } | ||
let isArbitraryVariant = isArbitraryValue(variant) | ||
let internalFeatures = context.variantOptions.get(variant)?.[INTERNAL_FEATURES] ?? {} | ||
let variantFunctionTuples = context.variantMap.get(variant).slice() | ||
let result = [] | ||
let respectPrefix = (() => { | ||
if (isArbitraryVariant) return false | ||
if (internalFeatures.respectPrefix === false) return false | ||
return true | ||
})() | ||
for (let [meta, rule] of matches) { | ||
@@ -299,3 +306,3 @@ // Don't generate variants for user css | ||
format: selectorFormat, | ||
isArbitraryVariant, | ||
respectPrefix, | ||
}) | ||
@@ -329,3 +336,3 @@ }, | ||
format: ruleWithVariant, | ||
isArbitraryVariant, | ||
respectPrefix, | ||
}) | ||
@@ -374,3 +381,3 @@ } | ||
format: modified.replace(rebuiltBase, '&'), | ||
isArbitraryVariant, | ||
respectPrefix, | ||
}) | ||
@@ -377,0 +384,0 @@ rule.selector = before |
@@ -27,2 +27,4 @@ import fs from 'fs' | ||
export const INTERNAL_FEATURES = Symbol() | ||
const VARIANT_TYPES = { | ||
@@ -234,4 +236,4 @@ AddVariant: Symbol.for('ADD_VARIANT'), | ||
let [, name, params] = /@(.*?)( .+|[({].*)/g.exec(str) | ||
return ({ wrap }) => wrap(postcss.atRule({ name, params: params.trim() })) | ||
let [, name, params] = /@(\S*)( .+|[({].*)?/g.exec(str) | ||
return ({ wrap }) => wrap(postcss.atRule({ name, params: params?.trim() ?? '' })) | ||
}) | ||
@@ -954,3 +956,7 @@ .reverse() | ||
for (const [, rule] of rules) { | ||
sortedClassNames.set(rule.raws.tailwind.candidate, idx++) | ||
let candidate = rule.raws.tailwind.candidate | ||
// When multiple rules match a candidate | ||
// always take the position of the first one | ||
sortedClassNames.set(candidate, sortedClassNames.get(candidate) ?? idx++) | ||
} | ||
@@ -1125,7 +1131,14 @@ | ||
let isArbitraryVariant = !(value in (options.values ?? {})) | ||
let internalFeatures = options[INTERNAL_FEATURES] ?? {} | ||
let respectPrefix = (() => { | ||
if (isArbitraryVariant) return false | ||
if (internalFeatures.respectPrefix === false) return false | ||
return true | ||
})() | ||
formatStrings = formatStrings.map((format) => | ||
format.map((str) => ({ | ||
format: str, | ||
isArbitraryVariant, | ||
respectPrefix, | ||
})) | ||
@@ -1136,3 +1149,3 @@ ) | ||
format, | ||
isArbitraryVariant, | ||
respectPrefix, | ||
})) | ||
@@ -1139,0 +1152,0 @@ |
@@ -66,5 +66,3 @@ // @ts-check | ||
// It's a plain object, not a path | ||
let newConfig = resolveConfig( | ||
configOrPath.config === undefined ? configOrPath : configOrPath.config | ||
) | ||
let newConfig = resolveConfig(configOrPath?.config ?? configOrPath ?? {}) | ||
@@ -71,0 +69,0 @@ newConfig = validateConfig(newConfig) |
@@ -16,3 +16,3 @@ import setupTrackingContext from './lib/setupTrackingContext' | ||
}, | ||
function (root, result) { | ||
async function (root, result) { | ||
// Use the path for the `@config` directive if it exists, otherwise use the | ||
@@ -29,3 +29,3 @@ // path for the file being processed | ||
if (root.type === 'root') { | ||
processTailwindFeatures(context)(root, result) | ||
await processTailwindFeatures(context)(root, result) | ||
} | ||
@@ -37,3 +37,3 @@ } | ||
processTailwindFeatures(context)(root, result) | ||
await processTailwindFeatures(context)(root, result) | ||
}, | ||
@@ -40,0 +40,0 @@ __OXIDE__ && |
@@ -15,3 +15,3 @@ import normalizeTailwindDirectives from './lib/normalizeTailwindDirectives' | ||
export default function processTailwindFeatures(setupContext) { | ||
return function (root, result) { | ||
return async function (root, result) { | ||
let { tailwindDirectives, applyDirectives } = normalizeTailwindDirectives(root) | ||
@@ -48,3 +48,4 @@ | ||
expandTailwindAtRules(context)(root, result) | ||
await expandTailwindAtRules(context)(root, result) | ||
// Partition apply rules that are generated by | ||
@@ -51,0 +52,0 @@ // addComponents, addUtilities and so on. |
@@ -52,6 +52,18 @@ import { parseColor } from './color' | ||
// 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) => { | ||
value = normalizeMathOperatorSpacing(value) | ||
return value | ||
} | ||
/** | ||
* Add spaces around operators inside math functions | ||
* like calc() that do not follow an operator or '('. | ||
* | ||
* @param {string} value | ||
* @returns {string} | ||
*/ | ||
function normalizeMathOperatorSpacing(value) { | ||
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match) => { | ||
let vars = [] | ||
return match | ||
@@ -65,4 +77,2 @@ .replace(/var\((--.+?)[,)]/g, (match, g1) => { | ||
}) | ||
return value | ||
} | ||
@@ -183,7 +193,8 @@ | ||
let gradientTypes = new Set([ | ||
'conic-gradient', | ||
'linear-gradient', | ||
'radial-gradient', | ||
'repeating-conic-gradient', | ||
'repeating-linear-gradient', | ||
'repeating-radial-gradient', | ||
'conic-gradient', | ||
]) | ||
@@ -190,0 +201,0 @@ export function gradient(value) { |
@@ -12,3 +12,3 @@ import selectorParser from 'postcss-selector-parser' | ||
/** @typedef {{format: string, isArbitraryVariant: boolean}[]} RawFormats */ | ||
/** @typedef {{format: string, respectPrefix: boolean}[]} RawFormats */ | ||
/** @typedef {import('postcss-selector-parser').Root} ParsedFormats */ | ||
@@ -33,3 +33,3 @@ /** @typedef {RawFormats | ParsedFormats} AcceptedFormats */ | ||
...format, | ||
ast: format.isArbitraryVariant ? ast : prefixSelector(prefix, ast), | ||
ast: format.respectPrefix ? prefixSelector(prefix, ast) : ast, | ||
} | ||
@@ -36,0 +36,0 @@ }) |
@@ -20,2 +20,3 @@ import parser from 'postcss-selector-parser' | ||
/** @type {import('postcss-selector-parser').Root} */ | ||
let ast = typeof selector === 'string' ? parser().astSync(selector) : selector | ||
@@ -22,0 +23,0 @@ |
@@ -22,3 +22,3 @@ /** @typedef {import('postcss-selector-parser').Root} Root */ | ||
// | ||
// This is a backwards-compat quirk of :before and :after variants. | ||
// This is a backwards-compat quirk of pseudo element variants from earlier versions of Tailwind CSS. | ||
@@ -29,4 +29,5 @@ /** @typedef {'terminal' | 'actionable' | 'jumpable'} PseudoProperty */ | ||
let elementProperties = { | ||
// Pseudo elements from the spec | ||
'::after': ['terminal', 'jumpable'], | ||
'::backdrop': ['terminal'], | ||
'::backdrop': ['terminal', 'jumpable'], | ||
'::before': ['terminal', 'jumpable'], | ||
@@ -38,6 +39,6 @@ '::cue': ['terminal'], | ||
'::grammar-error': ['terminal'], | ||
'::marker': ['terminal'], | ||
'::marker': ['terminal', 'jumpable'], | ||
'::part': ['terminal', 'actionable'], | ||
'::placeholder': ['terminal'], | ||
'::selection': ['terminal'], | ||
'::placeholder': ['terminal', 'jumpable'], | ||
'::selection': ['terminal', 'jumpable'], | ||
'::slotted': ['terminal'], | ||
@@ -47,14 +48,10 @@ '::spelling-error': ['terminal'], | ||
// other | ||
// Pseudo elements from the spec with special rules | ||
'::file-selector-button': ['terminal', 'actionable'], | ||
'::-webkit-progress-bar': ['terminal', 'actionable'], | ||
// Webkit scroll bar pseudo elements can be combined with user-action pseudo classes | ||
'::-webkit-scrollbar': ['terminal', 'actionable'], | ||
'::-webkit-scrollbar-button': ['terminal', 'actionable'], | ||
'::-webkit-scrollbar-thumb': ['terminal', 'actionable'], | ||
'::-webkit-scrollbar-track': ['terminal', 'actionable'], | ||
'::-webkit-scrollbar-track-piece': ['terminal', 'actionable'], | ||
'::-webkit-scrollbar-corner': ['terminal', 'actionable'], | ||
'::-webkit-resizer': ['terminal', 'actionable'], | ||
// Library-specific pseudo elements used by component libraries | ||
// These are Shadow DOM-like | ||
'::deep': ['actionable'], | ||
'::v-deep': ['actionable'], | ||
'::ng-deep': ['actionable'], | ||
@@ -72,4 +69,4 @@ // Note: As a rule, double colons (::) should be used instead of a single colon | ||
// Because it's not recognized, we don't know if it's terminal or not | ||
// So we assume it can't be moved AND can have user-action pseudo classes attached to it | ||
__default__: ['actionable'], | ||
// So we assume it can be moved AND can have user-action pseudo classes attached to it | ||
__default__: ['terminal', 'actionable'], | ||
} | ||
@@ -76,0 +73,0 @@ |
@@ -18,2 +18,3 @@ module.exports = { | ||
aria: { | ||
busy: 'busy="true"', | ||
checked: 'checked="true"', | ||
@@ -20,0 +21,0 @@ disabled: 'disabled="true"', |
@@ -6,2 +6,3 @@ import { Config } from '../../types' | ||
aria: Record< | ||
| 'busy' | ||
| 'checked' | ||
@@ -8,0 +9,0 @@ | 'disabled' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5474942
22
274
33969
+ Addedpicocolors@1.0.1(transitive)
+ Addedpostcss@8.4.41(transitive)
+ Addedyaml@2.5.0(transitive)
- Removedpostcss-value-parser@^4.2.0
- Removedpicocolors@1.1.0(transitive)
- Removedpostcss@8.4.45(transitive)
- Removedyaml@2.5.1(transitive)