tailwindcss 0.0.0-insiders.cb6e45a → 0.0.0-insiders.cbbfa82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -28
- package/README.md +6 -5
- package/lib/cli/build/index.js +5 -1
- package/lib/cli/build/plugin.js +32 -5
- package/lib/cli/build/watching.js +77 -12
- package/lib/cli.js +19 -9
- package/lib/corePlugins.js +11 -10
- package/lib/css/preflight.css +2 -0
- package/lib/lib/content.js +14 -4
- package/lib/lib/defaultExtractor.js +1 -1
- package/lib/lib/expandApplyAtRules.js +34 -15
- package/lib/lib/expandTailwindAtRules.js +1 -1
- package/lib/lib/findAtConfigPath.js +4 -4
- package/lib/lib/generateRules.js +4 -4
- package/lib/lib/setupContextUtils.js +29 -22
- package/lib/util/dataTypes.js +3 -0
- package/lib/util/formatVariantSelector.js +3 -3
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +2 -2
- package/lib/util/normalizeConfig.js +14 -0
- package/lib/util/pluginUtils.js +53 -34
- package/lib/util/resolveConfig.js +4 -9
- package/package.json +9 -10
- package/peers/index.js +650 -581
- package/src/cli/build/index.js +6 -2
- package/src/cli/build/plugin.js +41 -4
- package/src/cli/build/watching.js +105 -12
- package/src/cli.js +24 -13
- package/src/corePlugins.js +13 -11
- package/src/css/preflight.css +2 -0
- package/src/lib/content.js +16 -8
- package/src/lib/defaultExtractor.js +1 -1
- package/src/lib/expandApplyAtRules.js +35 -15
- package/src/lib/findAtConfigPath.js +4 -6
- package/src/lib/generateRules.js +11 -8
- package/src/lib/setupContextUtils.js +28 -23
- package/src/util/dataTypes.js +4 -0
- package/src/util/formatVariantSelector.js +2 -2
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/normalizeConfig.js +18 -0
- package/src/util/pluginUtils.js +60 -26
- package/src/util/resolveConfig.js +3 -9
- package/stubs/defaultConfig.stub.js +1 -18
- package/types/config.d.ts +1 -0
|
@@ -21,18 +21,18 @@ function findAtConfigPath(root, result) {
|
|
|
21
21
|
var _file, ref1;
|
|
22
22
|
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;
|
|
23
23
|
if (relativeTo === null) {
|
|
24
|
-
throw rule.error("The `@config`
|
|
24
|
+
throw rule.error("The `@config` directive cannot be used without setting `from` in your PostCSS config.");
|
|
25
25
|
}
|
|
26
26
|
if (configPath) {
|
|
27
|
-
throw rule.error("Only `@config`
|
|
27
|
+
throw rule.error("Only one `@config` directive is allowed per file.");
|
|
28
28
|
}
|
|
29
29
|
let matches = rule.params.match(/(['"])(.*?)\1/);
|
|
30
30
|
if (!matches) {
|
|
31
|
-
throw rule.error("
|
|
31
|
+
throw rule.error("A path is required when using the `@config` directive.");
|
|
32
32
|
}
|
|
33
33
|
let inputPath = matches[2];
|
|
34
34
|
if (_path.default.isAbsolute(inputPath)) {
|
|
35
|
-
throw rule.error("The `@config`
|
|
35
|
+
throw rule.error("The `@config` directive cannot be used with an absolute path.");
|
|
36
36
|
}
|
|
37
37
|
configPath = _path.default.resolve(_path.default.dirname(relativeTo), inputPath);
|
|
38
38
|
if (!_fs.default.existsSync(configPath)) {
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -25,7 +25,7 @@ const _formatVariantSelector = require("../util/formatVariantSelector");
|
|
|
25
25
|
const _nameClass = require("../util/nameClass");
|
|
26
26
|
const _dataTypes = require("../util/dataTypes");
|
|
27
27
|
const _setupContextUtils = require("./setupContextUtils");
|
|
28
|
-
const
|
|
28
|
+
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isSyntacticallyValidPropertyValue"));
|
|
29
29
|
const _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
|
|
30
30
|
const _featureFlags = require("../featureFlags");
|
|
31
31
|
function _interopRequireDefault(obj) {
|
|
@@ -162,7 +162,7 @@ function applyImportant(matches, classCandidate) {
|
|
|
162
162
|
]
|
|
163
163
|
});
|
|
164
164
|
container.walkRules((r)=>{
|
|
165
|
-
r.selector = (0, _pluginUtils.updateAllClasses)(r.selector, (className)=>{
|
|
165
|
+
r.selector = (0, _pluginUtils.updateAllClasses)((0, _pluginUtils.filterSelectorsForClass)(r.selector, classCandidate), (className)=>{
|
|
166
166
|
if (className === classCandidate) {
|
|
167
167
|
return `!${className}`;
|
|
168
168
|
}
|
|
@@ -256,7 +256,7 @@ function applyVariant(variant, matches, context) {
|
|
|
256
256
|
]
|
|
257
257
|
});
|
|
258
258
|
for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples){
|
|
259
|
-
let clone = containerFromArray !== null && containerFromArray !== void 0 ? containerFromArray : container.clone();
|
|
259
|
+
let clone = (containerFromArray !== null && containerFromArray !== void 0 ? containerFromArray : container).clone();
|
|
260
260
|
let collectedFormats = [];
|
|
261
261
|
function prepareBackup() {
|
|
262
262
|
// Already prepared, chicken out
|
|
@@ -464,7 +464,7 @@ function extractArbitraryProperty(classCandidate, context) {
|
|
|
464
464
|
if (!isValidPropName(property)) {
|
|
465
465
|
return null;
|
|
466
466
|
}
|
|
467
|
-
if (!(0,
|
|
467
|
+
if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
|
|
468
468
|
return null;
|
|
469
469
|
}
|
|
470
470
|
let normalized = (0, _dataTypes.normalize)(value);
|
|
@@ -32,7 +32,7 @@ const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedStat
|
|
|
32
32
|
const _toPath = require("../util/toPath");
|
|
33
33
|
const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
|
|
34
34
|
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("../util/negateValue"));
|
|
35
|
-
const
|
|
35
|
+
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isSyntacticallyValidPropertyValue"));
|
|
36
36
|
const _generateRules = require("./generateRules");
|
|
37
37
|
const _cacheInvalidationJs = require("./cacheInvalidation.js");
|
|
38
38
|
const _offsetsJs = require("./offsets.js");
|
|
@@ -281,26 +281,20 @@ function parseVariant(variant) {
|
|
|
281
281
|
return context.tailwindConfig.prefix + identifier;
|
|
282
282
|
}
|
|
283
283
|
function resolveThemeValue(path, defaultValue, opts = {}) {
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
let parts = (0, _toPath.toPath)(path);
|
|
285
|
+
let value = getConfigValue([
|
|
286
286
|
"theme",
|
|
287
|
-
|
|
288
|
-
...subPaths
|
|
287
|
+
...parts
|
|
289
288
|
], defaultValue);
|
|
290
|
-
return (0, _transformThemeValue.default)(
|
|
289
|
+
return (0, _transformThemeValue.default)(parts[0])(value, opts);
|
|
291
290
|
}
|
|
292
|
-
const theme = Object.assign((path, defaultValue = undefined)=>resolveThemeValue(path, defaultValue), {
|
|
293
|
-
withAlpha: (path, opacityValue)=>resolveThemeValue(path, undefined, {
|
|
294
|
-
opacityValue
|
|
295
|
-
})
|
|
296
|
-
});
|
|
297
291
|
let variantIdentifier = 0;
|
|
298
292
|
let api = {
|
|
299
293
|
postcss: _postcss.default,
|
|
300
294
|
prefix: applyConfiguredPrefix,
|
|
301
295
|
e: _escapeClassName.default,
|
|
302
296
|
config: getConfigValue,
|
|
303
|
-
theme,
|
|
297
|
+
theme: resolveThemeValue,
|
|
304
298
|
corePlugins: (path)=>{
|
|
305
299
|
if (Array.isArray(tailwindConfig.corePlugins)) {
|
|
306
300
|
return tailwindConfig.corePlugins.includes(path);
|
|
@@ -430,7 +424,7 @@ function parseVariant(variant) {
|
|
|
430
424
|
return [];
|
|
431
425
|
}
|
|
432
426
|
}
|
|
433
|
-
if (!(0,
|
|
427
|
+
if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
|
|
434
428
|
return [];
|
|
435
429
|
}
|
|
436
430
|
let extras = {
|
|
@@ -496,7 +490,7 @@ function parseVariant(variant) {
|
|
|
496
490
|
return [];
|
|
497
491
|
}
|
|
498
492
|
}
|
|
499
|
-
if (!(0,
|
|
493
|
+
if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
|
|
500
494
|
return [];
|
|
501
495
|
}
|
|
502
496
|
let extras = {
|
|
@@ -533,7 +527,7 @@ function parseVariant(variant) {
|
|
|
533
527
|
variantFunctions = [].concat(variantFunctions).map((variantFunction)=>{
|
|
534
528
|
if (typeof variantFunction !== "string") {
|
|
535
529
|
// Safelist public API functions
|
|
536
|
-
return (api)=>{
|
|
530
|
+
return (api = {})=>{
|
|
537
531
|
let { args , modifySelectors , container , separator , wrap , format } = api;
|
|
538
532
|
let result = variantFunction(Object.assign({
|
|
539
533
|
modifySelectors,
|
|
@@ -574,12 +568,14 @@ function parseVariant(variant) {
|
|
|
574
568
|
var ref1;
|
|
575
569
|
for (let [key, value] of Object.entries((ref1 = options === null || options === void 0 ? void 0 : options.values) !== null && ref1 !== void 0 ? ref1 : {})){
|
|
576
570
|
if (key === "DEFAULT") continue;
|
|
577
|
-
api.addVariant(isSpecial ? `${variant}${key}` : `${variant}-${key}`, ({ args , container })=>
|
|
578
|
-
|
|
571
|
+
api.addVariant(isSpecial ? `${variant}${key}` : `${variant}-${key}`, ({ args , container })=>{
|
|
572
|
+
return variantFn(value, modifiersEnabled ? {
|
|
573
|
+
modifier: args === null || args === void 0 ? void 0 : args.modifier,
|
|
579
574
|
container
|
|
580
575
|
} : {
|
|
581
576
|
container
|
|
582
|
-
})
|
|
577
|
+
});
|
|
578
|
+
}, {
|
|
583
579
|
...options,
|
|
584
580
|
value,
|
|
585
581
|
id,
|
|
@@ -590,11 +586,13 @@ function parseVariant(variant) {
|
|
|
590
586
|
var ref2;
|
|
591
587
|
let hasDefault = "DEFAULT" in ((ref2 = options === null || options === void 0 ? void 0 : options.values) !== null && ref2 !== void 0 ? ref2 : {});
|
|
592
588
|
api.addVariant(variant, ({ args , container })=>{
|
|
593
|
-
if (args.value === _sharedState.NONE && !hasDefault) {
|
|
589
|
+
if ((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE && !hasDefault) {
|
|
594
590
|
return null;
|
|
595
591
|
}
|
|
596
|
-
|
|
597
|
-
|
|
592
|
+
var // (JetBrains) plugins.
|
|
593
|
+
ref;
|
|
594
|
+
return variantFn((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE ? options.values.DEFAULT : (ref = args === null || args === void 0 ? void 0 : args.value) !== null && ref !== void 0 ? ref : typeof args === "string" ? args : "", modifiersEnabled ? {
|
|
595
|
+
modifier: args === null || args === void 0 ? void 0 : args.modifier,
|
|
598
596
|
container
|
|
599
597
|
} : {
|
|
600
598
|
container
|
|
@@ -795,6 +793,7 @@ function registerPlugins(plugins, context) {
|
|
|
795
793
|
if (checks.length > 0) {
|
|
796
794
|
let patternMatchingCount = new Map();
|
|
797
795
|
let prefixLength = context.tailwindConfig.prefix.length;
|
|
796
|
+
let checkImportantUtils = checks.some((check)=>check.pattern.source.includes("!"));
|
|
798
797
|
for (let util of classList){
|
|
799
798
|
let utils = Array.isArray(util) ? (()=>{
|
|
800
799
|
let [utilName, options] = util;
|
|
@@ -823,6 +822,12 @@ function registerPlugins(plugins, context) {
|
|
|
823
822
|
...classes.flatMap((cls)=>Object.keys(context.tailwindConfig.theme.opacity).map((opacity)=>`${cls}/${opacity}`))
|
|
824
823
|
];
|
|
825
824
|
}
|
|
825
|
+
if (checkImportantUtils && (options === null || options === void 0 ? void 0 : options.respectImportant)) {
|
|
826
|
+
classes = [
|
|
827
|
+
...classes,
|
|
828
|
+
...classes.map((cls)=>"!" + cls)
|
|
829
|
+
];
|
|
830
|
+
}
|
|
826
831
|
return classes;
|
|
827
832
|
})() : [
|
|
828
833
|
util
|
|
@@ -1087,13 +1092,15 @@ function registerPlugins(plugins, context) {
|
|
|
1087
1092
|
markInvalidUtilityCandidate(context, candidate);
|
|
1088
1093
|
}
|
|
1089
1094
|
function createContext(tailwindConfig, changedContent = [], root = _postcss.default.root()) {
|
|
1095
|
+
var _blocklist;
|
|
1090
1096
|
let context = {
|
|
1091
1097
|
disposables: [],
|
|
1092
1098
|
ruleCache: new Set(),
|
|
1093
1099
|
candidateRuleCache: new Map(),
|
|
1094
1100
|
classCache: new Map(),
|
|
1095
1101
|
applyClassCache: new Map(),
|
|
1096
|
-
|
|
1102
|
+
// Seed the not class cache with the blocklist (which is only strings)
|
|
1103
|
+
notClassCache: new Set((_blocklist = tailwindConfig.blocklist) !== null && _blocklist !== void 0 ? _blocklist : []),
|
|
1097
1104
|
postCssNodeCache: new Map(),
|
|
1098
1105
|
candidateRuleMap: new Map(),
|
|
1099
1106
|
tailwindConfig,
|
package/lib/util/dataTypes.js
CHANGED
|
@@ -39,6 +39,9 @@ function isCSSFunction(value) {
|
|
|
39
39
|
return cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.*\\)`).test(value));
|
|
40
40
|
}
|
|
41
41
|
function normalize(value, isRoot = true) {
|
|
42
|
+
if (value.startsWith("--")) {
|
|
43
|
+
return `var(${value})`;
|
|
44
|
+
}
|
|
42
45
|
// Keep raw strings if it starts with `url(`
|
|
43
46
|
if (value.includes("url(")) {
|
|
44
47
|
return value.split(/(url\(.*?\))/g).filter(Boolean).map((part)=>{
|
|
@@ -78,9 +78,9 @@ function formatVariantSelector(current, ...others) {
|
|
|
78
78
|
return -1;
|
|
79
79
|
} else if (a.type === "class" && b.type === "tag") {
|
|
80
80
|
return 1;
|
|
81
|
-
} else if (a.type === "class" && b.type === "pseudo" && b.value
|
|
81
|
+
} else if (a.type === "class" && b.type === "pseudo" && b.value.startsWith("::")) {
|
|
82
82
|
return -1;
|
|
83
|
-
} else if (a.type === "pseudo" && a.value
|
|
83
|
+
} else if (a.type === "pseudo" && a.value.startsWith("::") && b.type === "class") {
|
|
84
84
|
return 1;
|
|
85
85
|
}
|
|
86
86
|
return sel.index(a) - sel.index(b);
|
|
@@ -114,7 +114,7 @@ function finalizeSelector(format, { selector , candidate , context , isArbitrary
|
|
|
114
114
|
// │ │ │ ╰── We will not split here
|
|
115
115
|
// ╰──┴─────┴─────────────── We will split here
|
|
116
116
|
//
|
|
117
|
-
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()
|
|
117
|
+
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() }) {
|
|
118
118
|
var ref2;
|
|
119
119
|
let ast = (0, _postcssSelectorParser.default)().astSync(selector);
|
|
120
120
|
// We explicitly DO NOT prefix classes in arbitrary variants
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, // Arbitrary values must contain balanced bracket
|
|
|
10
10
|
// E.g.: content-['this-is-also-valid]-weirdly-enough']
|
|
11
11
|
"default", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: ()=>
|
|
13
|
+
get: ()=>isSyntacticallyValidPropertyValue
|
|
14
14
|
});
|
|
15
15
|
let matchingBrackets = new Map([
|
|
16
16
|
[
|
|
@@ -35,7 +35,7 @@ let quotes = new Set([
|
|
|
35
35
|
"'",
|
|
36
36
|
"`"
|
|
37
37
|
]);
|
|
38
|
-
function
|
|
38
|
+
function isSyntacticallyValidPropertyValue(value) {
|
|
39
39
|
let stack = [];
|
|
40
40
|
let inQuotes = false;
|
|
41
41
|
for(let i = 0; i < value.length; i++){
|
|
@@ -162,6 +162,20 @@ function normalizeConfig(config) {
|
|
|
162
162
|
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;
|
|
163
163
|
return [];
|
|
164
164
|
})();
|
|
165
|
+
// Normalize the `blocklist`
|
|
166
|
+
config.blocklist = (()=>{
|
|
167
|
+
let { blocklist } = config;
|
|
168
|
+
if (Array.isArray(blocklist)) {
|
|
169
|
+
if (blocklist.every((item)=>typeof item === "string")) {
|
|
170
|
+
return blocklist;
|
|
171
|
+
}
|
|
172
|
+
_log.default.warn("blocklist-invalid", [
|
|
173
|
+
"The `blocklist` option must be an array of strings.",
|
|
174
|
+
"https://tailwindcss.com/docs/content-configuration#discarding-classes"
|
|
175
|
+
]);
|
|
176
|
+
}
|
|
177
|
+
return [];
|
|
178
|
+
})();
|
|
165
179
|
// Normalize prefix option
|
|
166
180
|
if (typeof config.prefix === "function") {
|
|
167
181
|
_log.default.warn("prefix-function", [
|
package/lib/util/pluginUtils.js
CHANGED
|
@@ -10,6 +10,7 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
updateAllClasses: ()=>updateAllClasses,
|
|
13
|
+
filterSelectorsForClass: ()=>filterSelectorsForClass,
|
|
13
14
|
asValue: ()=>asValue,
|
|
14
15
|
parseColorFormat: ()=>parseColorFormat,
|
|
15
16
|
asColor: ()=>asColor,
|
|
@@ -43,6 +44,18 @@ function updateAllClasses(selectors, updateClass) {
|
|
|
43
44
|
let result = parser.processSync(selectors);
|
|
44
45
|
return result;
|
|
45
46
|
}
|
|
47
|
+
function filterSelectorsForClass(selectors, classCandidate) {
|
|
48
|
+
let parser = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
49
|
+
selectors.each((sel)=>{
|
|
50
|
+
const containsClass = sel.nodes.some((node)=>node.type === "class" && node.value === classCandidate);
|
|
51
|
+
if (!containsClass) {
|
|
52
|
+
sel.remove();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
let result = parser.processSync(selectors);
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
46
59
|
function resolveArbitraryValue(modifier, validate) {
|
|
47
60
|
if (!isArbitraryValue(modifier)) {
|
|
48
61
|
return undefined;
|
|
@@ -110,15 +123,22 @@ function parseColorFormat(value) {
|
|
|
110
123
|
}
|
|
111
124
|
return value;
|
|
112
125
|
}
|
|
113
|
-
function
|
|
126
|
+
function unwrapArbitraryModifier(modifier) {
|
|
127
|
+
modifier = modifier.slice(1, -1);
|
|
128
|
+
if (modifier.startsWith("--")) {
|
|
129
|
+
modifier = `var(${modifier})`;
|
|
130
|
+
}
|
|
131
|
+
return modifier;
|
|
132
|
+
}
|
|
133
|
+
function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
114
134
|
var ref;
|
|
115
|
-
if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[
|
|
135
|
+
if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
|
|
116
136
|
var ref1;
|
|
117
|
-
return parseColorFormat((ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[
|
|
137
|
+
return parseColorFormat((ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier]);
|
|
118
138
|
}
|
|
119
139
|
// TODO: Hoist this up to getMatchingTypes or something
|
|
120
140
|
// We do this here because we need the alpha value (if any)
|
|
121
|
-
let [color, alpha] = splitUtilityModifier(
|
|
141
|
+
let [color, alpha] = splitUtilityModifier(modifier);
|
|
122
142
|
if (alpha !== undefined) {
|
|
123
143
|
var ref2, ref3, ref4;
|
|
124
144
|
var ref5;
|
|
@@ -128,16 +148,14 @@ function asColor(_, options = {}, { tailwindConfig ={} , utilityModifier , rawMo
|
|
|
128
148
|
}
|
|
129
149
|
normalizedColor = parseColorFormat(normalizedColor);
|
|
130
150
|
if (isArbitraryValue(alpha)) {
|
|
131
|
-
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, alpha
|
|
151
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, unwrapArbitraryModifier(alpha));
|
|
132
152
|
}
|
|
133
153
|
if (((ref3 = tailwindConfig.theme) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.opacity) === null || ref4 === void 0 ? void 0 : ref4[alpha]) === undefined) {
|
|
134
154
|
return undefined;
|
|
135
155
|
}
|
|
136
156
|
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, tailwindConfig.theme.opacity[alpha]);
|
|
137
157
|
}
|
|
138
|
-
return asValue(
|
|
139
|
-
rawModifier,
|
|
140
|
-
utilityModifier,
|
|
158
|
+
return asValue(modifier, options, {
|
|
141
159
|
validate: _dataTypes.color
|
|
142
160
|
});
|
|
143
161
|
}
|
|
@@ -146,9 +164,8 @@ function asLookupValue(modifier, options = {}) {
|
|
|
146
164
|
return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
|
147
165
|
}
|
|
148
166
|
function guess(validate) {
|
|
149
|
-
return (modifier, options
|
|
167
|
+
return (modifier, options)=>{
|
|
150
168
|
return asValue(modifier, options, {
|
|
151
|
-
...extras,
|
|
152
169
|
validate
|
|
153
170
|
});
|
|
154
171
|
};
|
|
@@ -184,6 +201,21 @@ function splitAtFirst(input, delim) {
|
|
|
184
201
|
];
|
|
185
202
|
}
|
|
186
203
|
function coerceValue(types, modifier, options, tailwindConfig) {
|
|
204
|
+
if (options.values && modifier in options.values) {
|
|
205
|
+
for (let { type } of types !== null && types !== void 0 ? types : []){
|
|
206
|
+
let result = typeMap[type](modifier, options, {
|
|
207
|
+
tailwindConfig
|
|
208
|
+
});
|
|
209
|
+
if (result === undefined) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
return [
|
|
213
|
+
result,
|
|
214
|
+
type,
|
|
215
|
+
null
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
187
219
|
if (isArbitraryValue(modifier)) {
|
|
188
220
|
let arbitraryValue = modifier.slice(1, -1);
|
|
189
221
|
let [explicitType, value] = splitAtFirst(arbitraryValue, ":");
|
|
@@ -212,11 +244,12 @@ function coerceValue(types, modifier, options, tailwindConfig) {
|
|
|
212
244
|
}
|
|
213
245
|
function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
|
|
214
246
|
let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
215
|
-
let
|
|
216
|
-
let
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
247
|
+
let [modifier, utilityModifier] = splitUtilityModifier(rawModifier);
|
|
248
|
+
let canUseUtilityModifier = modifiersEnabled && options.modifiers != null && (options.modifiers === "any" || typeof options.modifiers === "object" && (utilityModifier && isArbitraryValue(utilityModifier) || utilityModifier in options.modifiers));
|
|
249
|
+
if (!canUseUtilityModifier) {
|
|
250
|
+
modifier = rawModifier;
|
|
251
|
+
utilityModifier = undefined;
|
|
252
|
+
}
|
|
220
253
|
if (utilityModifier !== undefined && modifier === "") {
|
|
221
254
|
modifier = "DEFAULT";
|
|
222
255
|
}
|
|
@@ -230,33 +263,19 @@ function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
|
|
|
230
263
|
if (configValue !== null) {
|
|
231
264
|
utilityModifier = configValue;
|
|
232
265
|
} else if (isArbitraryValue(utilityModifier)) {
|
|
233
|
-
utilityModifier = utilityModifier
|
|
266
|
+
utilityModifier = unwrapArbitraryModifier(utilityModifier);
|
|
234
267
|
}
|
|
235
268
|
}
|
|
236
|
-
let result = asValue(rawModifier, options, {
|
|
237
|
-
rawModifier,
|
|
238
|
-
utilityModifier,
|
|
239
|
-
tailwindConfig
|
|
240
|
-
});
|
|
241
|
-
if (result !== undefined) {
|
|
242
|
-
yield [
|
|
243
|
-
result,
|
|
244
|
-
"any",
|
|
245
|
-
null
|
|
246
|
-
];
|
|
247
|
-
}
|
|
248
269
|
}
|
|
249
|
-
for (
|
|
250
|
-
let
|
|
251
|
-
rawModifier,
|
|
252
|
-
utilityModifier,
|
|
270
|
+
for (let { type } of types !== null && types !== void 0 ? types : []){
|
|
271
|
+
let result = typeMap[type](modifier, options, {
|
|
253
272
|
tailwindConfig
|
|
254
273
|
});
|
|
255
|
-
if (
|
|
274
|
+
if (result === undefined) {
|
|
256
275
|
continue;
|
|
257
276
|
}
|
|
258
277
|
yield [
|
|
259
|
-
|
|
278
|
+
result,
|
|
260
279
|
type,
|
|
261
280
|
utilityModifier !== null && utilityModifier !== void 0 ? utilityModifier : null
|
|
262
281
|
];
|
|
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
|
10
10
|
const _corePluginList = /*#__PURE__*/ _interopRequireDefault(require("../corePluginList"));
|
|
11
11
|
const _configurePlugins = /*#__PURE__*/ _interopRequireDefault(require("./configurePlugins"));
|
|
12
|
-
const _defaultConfigStub = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
|
|
13
12
|
const _colors = /*#__PURE__*/ _interopRequireDefault(require("../public/colors"));
|
|
14
13
|
const _defaults = require("./defaults");
|
|
15
14
|
const _toPath = require("./toPath");
|
|
@@ -27,16 +26,13 @@ function _interopRequireDefault(obj) {
|
|
|
27
26
|
function isFunction(input) {
|
|
28
27
|
return typeof input === "function";
|
|
29
28
|
}
|
|
30
|
-
function isObject(input) {
|
|
31
|
-
return typeof input === "object" && input !== null;
|
|
32
|
-
}
|
|
33
29
|
function mergeWith(target, ...sources) {
|
|
34
30
|
let customizer = sources.pop();
|
|
35
31
|
for (let source of sources){
|
|
36
32
|
for(let k in source){
|
|
37
33
|
let merged = customizer(target[k], source[k]);
|
|
38
34
|
if (merged === undefined) {
|
|
39
|
-
if (
|
|
35
|
+
if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
|
|
40
36
|
target[k] = mergeWith({}, target[k], source[k], customizer);
|
|
41
37
|
} else {
|
|
42
38
|
target[k] = source[k];
|
|
@@ -101,11 +97,11 @@ function mergeThemes(themes) {
|
|
|
101
97
|
}
|
|
102
98
|
function mergeExtensionCustomizer(merged, value) {
|
|
103
99
|
// When we have an array of objects, we do want to merge it
|
|
104
|
-
if (Array.isArray(merged) &&
|
|
100
|
+
if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
|
|
105
101
|
return merged.concat(value);
|
|
106
102
|
}
|
|
107
103
|
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
108
|
-
if (Array.isArray(value) &&
|
|
104
|
+
if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
|
|
109
105
|
return [
|
|
110
106
|
merged,
|
|
111
107
|
...value
|
|
@@ -242,8 +238,7 @@ function resolveConfig(configs) {
|
|
|
242
238
|
{
|
|
243
239
|
prefix: "",
|
|
244
240
|
important: false,
|
|
245
|
-
separator: ":"
|
|
246
|
-
variantOrder: _defaultConfigStub.default.variantOrder
|
|
241
|
+
separator: ":"
|
|
247
242
|
}
|
|
248
243
|
];
|
|
249
244
|
var ref, ref1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "0.0.0-insiders.
|
|
3
|
+
"version": "0.0.0-insiders.cbbfa82",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"test": "jest",
|
|
24
24
|
"test:integrations": "npm run test --prefix ./integrations",
|
|
25
25
|
"install:integrations": "node scripts/install-integrations.js",
|
|
26
|
-
"posttest": "npm run style",
|
|
27
26
|
"generate:plugin-list": "node -r @swc/register scripts/create-plugin-list.js",
|
|
28
27
|
"generate:types": "node -r @swc/register scripts/generate-types.js",
|
|
29
28
|
"generate": "npm run generate:plugin-list && npm run generate:types",
|
|
@@ -45,19 +44,18 @@
|
|
|
45
44
|
],
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@swc/cli": "^0.1.57",
|
|
48
|
-
"@swc/core": "^1.3.
|
|
47
|
+
"@swc/core": "^1.3.11",
|
|
49
48
|
"@swc/jest": "^0.2.23",
|
|
50
49
|
"@swc/register": "^0.1.10",
|
|
51
|
-
"autoprefixer": "^10.4.
|
|
52
|
-
"cssnano": "^5.1.
|
|
53
|
-
"esbuild": "^0.15.
|
|
54
|
-
"eslint": "^8.
|
|
50
|
+
"autoprefixer": "^10.4.13",
|
|
51
|
+
"cssnano": "^5.1.14",
|
|
52
|
+
"esbuild": "^0.15.15",
|
|
53
|
+
"eslint": "^8.27.0",
|
|
55
54
|
"eslint-config-prettier": "^8.5.0",
|
|
56
55
|
"eslint-plugin-prettier": "^4.2.1",
|
|
57
56
|
"jest": "^28.1.3",
|
|
58
57
|
"jest-diff": "^28.1.3",
|
|
59
58
|
"prettier": "^2.7.1",
|
|
60
|
-
"prettier-plugin-tailwindcss": "^0.1.13",
|
|
61
59
|
"rimraf": "^3.0.0",
|
|
62
60
|
"source-map-js": "^1.0.2"
|
|
63
61
|
},
|
|
@@ -75,15 +73,16 @@
|
|
|
75
73
|
"glob-parent": "^6.0.2",
|
|
76
74
|
"is-glob": "^4.0.3",
|
|
77
75
|
"lilconfig": "^2.0.6",
|
|
76
|
+
"micromatch": "^4.0.5",
|
|
78
77
|
"normalize-path": "^3.0.0",
|
|
79
78
|
"object-hash": "^3.0.0",
|
|
80
79
|
"picocolors": "^1.0.0",
|
|
81
|
-
"postcss": "^8.4.
|
|
80
|
+
"postcss": "^8.4.19",
|
|
82
81
|
"postcss-import": "^14.1.0",
|
|
83
82
|
"postcss-js": "^4.0.0",
|
|
84
83
|
"postcss-load-config": "^3.1.4",
|
|
85
84
|
"postcss-nested": "6.0.0",
|
|
86
|
-
"postcss-selector-parser": "^6.0.
|
|
85
|
+
"postcss-selector-parser": "^6.0.11",
|
|
87
86
|
"postcss-value-parser": "^4.2.0",
|
|
88
87
|
"quick-lru": "^5.1.1",
|
|
89
88
|
"resolve": "^1.22.1"
|