tailwindcss 0.0.0-insiders.93e0fdf → 0.0.0-insiders.941ef21
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 +293 -5
- package/README.md +13 -9
- package/colors.d.ts +3 -0
- package/defaultConfig.d.ts +3 -0
- package/defaultTheme.d.ts +4 -0
- package/lib/cli/build/deps.js +54 -0
- package/lib/cli/build/index.js +48 -0
- package/lib/cli/build/plugin.js +362 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +178 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +18 -0
- package/lib/cli/init/index.js +46 -0
- package/lib/cli/shared.js +12 -0
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +109 -611
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +6 -3
- package/lib/corePlugins.js +2005 -1686
- package/lib/css/preflight.css +4 -4
- package/lib/featureFlags.js +36 -24
- package/lib/index.js +28 -10
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +28 -10
- package/lib/lib/collapseDuplicateDeclarations.js +14 -11
- package/lib/lib/content.js +177 -0
- package/lib/lib/defaultExtractor.js +225 -33
- package/lib/lib/detectNesting.js +13 -10
- package/lib/lib/evaluateTailwindFunctions.js +118 -55
- package/lib/lib/expandApplyAtRules.js +439 -193
- package/lib/lib/expandTailwindAtRules.js +104 -109
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +405 -197
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +35 -32
- package/lib/lib/offsets.js +285 -0
- package/lib/lib/partitionApplyAtRules.js +11 -8
- package/lib/lib/regex.js +60 -0
- package/lib/lib/remap-bitfield.js +87 -0
- package/lib/lib/resolveDefaultsAtRules.js +89 -67
- package/lib/lib/setupContextUtils.js +617 -309
- package/lib/lib/setupTrackingContext.js +38 -67
- package/lib/lib/sharedState.js +25 -15
- package/lib/lib/substituteScreenAtRules.js +11 -9
- package/lib/postcss-plugins/nesting/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +8 -6
- package/lib/postcss-plugins/nesting/plugin.js +48 -14
- package/lib/processTailwindFeatures.js +31 -28
- package/lib/public/colors.js +247 -245
- package/lib/public/create-plugin.js +6 -4
- package/lib/public/default-config.js +7 -5
- package/lib/public/default-theme.js +7 -5
- package/lib/public/resolve-config.js +8 -5
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +11 -6
- package/lib/util/cloneDeep.js +7 -6
- package/lib/util/cloneNodes.js +21 -3
- package/lib/util/color.js +53 -54
- package/lib/util/configurePlugins.js +5 -2
- package/lib/util/createPlugin.js +6 -5
- package/lib/util/createUtilityPlugin.js +10 -8
- package/lib/util/dataTypes.js +143 -110
- package/lib/util/defaults.js +8 -5
- package/lib/util/escapeClassName.js +9 -6
- package/lib/util/escapeCommas.js +5 -2
- package/lib/util/flattenColorPalette.js +9 -10
- package/lib/util/formatVariantSelector.js +193 -86
- package/lib/util/getAllConfigs.js +29 -10
- package/lib/util/hashConfig.js +6 -3
- package/lib/util/isKeyframeRule.js +5 -2
- package/lib/util/isPlainObject.js +5 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +23 -15
- package/lib/util/log.js +20 -14
- package/lib/util/nameClass.js +20 -9
- package/lib/util/negateValue.js +22 -7
- package/lib/util/normalizeConfig.js +124 -83
- package/lib/util/normalizeScreens.js +119 -8
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +29 -22
- package/lib/util/parseDependency.js +38 -56
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +11 -8
- package/lib/util/pluginUtils.js +155 -51
- package/lib/util/prefixSelector.js +7 -4
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +93 -72
- package/lib/util/resolveConfigPath.js +10 -7
- package/lib/util/responsive.js +8 -5
- package/lib/util/splitAtTopLevelOnly.js +43 -0
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +5 -2
- package/lib/util/toPath.js +20 -4
- package/lib/util/transformThemeValue.js +37 -25
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +23 -15
- package/package.json +44 -37
- package/peers/index.js +11099 -7475
- package/plugin.d.ts +11 -0
- package/resolveConfig.d.ts +12 -0
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +49 -0
- package/src/cli/build/plugin.js +434 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +227 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +3 -0
- package/src/cli/init/index.js +50 -0
- package/src/cli/shared.js +5 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +50 -631
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +399 -84
- package/src/css/preflight.css +4 -4
- package/src/featureFlags.js +14 -4
- package/src/index.js +20 -1
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/content.js +213 -0
- package/src/lib/defaultExtractor.js +196 -35
- package/src/lib/evaluateTailwindFunctions.js +78 -7
- package/src/lib/expandApplyAtRules.js +482 -183
- package/src/lib/expandTailwindAtRules.js +37 -55
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +359 -112
- package/src/lib/offsets.js +351 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/resolveDefaultsAtRules.js +53 -32
- package/src/lib/setupContextUtils.js +517 -146
- package/src/lib/setupTrackingContext.js +11 -48
- package/src/lib/sharedState.js +3 -0
- package/src/postcss-plugins/nesting/README.md +2 -2
- package/src/postcss-plugins/nesting/plugin.js +36 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +25 -21
- package/src/util/dataTypes.js +54 -21
- package/src/util/formatVariantSelector.js +196 -62
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +8 -8
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +10 -2
- package/src/util/normalizeConfig.js +40 -10
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +3 -2
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +132 -10
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +70 -32
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +1 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +13 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +168 -164
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +363 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +342 -0
- package/types/index.d.ts +7 -0
package/lib/util/pluginUtils.js
CHANGED
|
@@ -2,32 +2,58 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
updateAllClasses: ()=>updateAllClasses,
|
|
13
|
+
filterSelectorsForClass: ()=>filterSelectorsForClass,
|
|
14
|
+
asValue: ()=>asValue,
|
|
15
|
+
parseColorFormat: ()=>parseColorFormat,
|
|
16
|
+
asColor: ()=>asColor,
|
|
17
|
+
asLookupValue: ()=>asLookupValue,
|
|
18
|
+
typeMap: ()=>typeMap,
|
|
19
|
+
coerceValue: ()=>coerceValue,
|
|
20
|
+
getMatchingTypes: ()=>getMatchingTypes
|
|
21
|
+
});
|
|
22
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
23
|
+
const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
|
|
24
|
+
const _withAlphaVariable = require("./withAlphaVariable");
|
|
25
|
+
const _dataTypes = require("./dataTypes");
|
|
26
|
+
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
|
27
|
+
const _validateFormalSyntax = require("./validateFormalSyntax");
|
|
28
|
+
const _featureFlagsJs = require("../featureFlags.js");
|
|
15
29
|
function _interopRequireDefault(obj) {
|
|
16
30
|
return obj && obj.__esModule ? obj : {
|
|
17
31
|
default: obj
|
|
18
32
|
};
|
|
19
33
|
}
|
|
20
|
-
function updateAllClasses(
|
|
21
|
-
let parser = (0, _postcssSelectorParser
|
|
34
|
+
function updateAllClasses(selectors, updateClass) {
|
|
35
|
+
let parser = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
22
36
|
selectors.walkClasses((sel)=>{
|
|
23
37
|
let updatedClass = updateClass(sel.value);
|
|
24
38
|
sel.value = updatedClass;
|
|
25
39
|
if (sel.raws && sel.raws.value) {
|
|
26
|
-
sel.raws.value = (0, _escapeCommas
|
|
40
|
+
sel.raws.value = (0, _escapeCommas.default)(sel.raws.value);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
let result = parser.processSync(selectors);
|
|
45
|
+
return result;
|
|
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();
|
|
27
53
|
}
|
|
28
54
|
});
|
|
29
55
|
});
|
|
30
|
-
let result = parser.processSync(
|
|
56
|
+
let result = parser.processSync(selectors);
|
|
31
57
|
return result;
|
|
32
58
|
}
|
|
33
59
|
function resolveArbitraryValue(modifier, validate) {
|
|
@@ -38,41 +64,51 @@ function resolveArbitraryValue(modifier, validate) {
|
|
|
38
64
|
if (!validate(value)) {
|
|
39
65
|
return undefined;
|
|
40
66
|
}
|
|
41
|
-
return (0, _dataTypes
|
|
67
|
+
return (0, _dataTypes.normalize)(value);
|
|
42
68
|
}
|
|
43
69
|
function asNegativeValue(modifier, lookup = {}, validate) {
|
|
44
70
|
let positiveValue = lookup[modifier];
|
|
45
71
|
if (positiveValue !== undefined) {
|
|
46
|
-
return (0, _negateValue
|
|
72
|
+
return (0, _negateValue.default)(positiveValue);
|
|
47
73
|
}
|
|
48
74
|
if (isArbitraryValue(modifier)) {
|
|
49
75
|
let resolved = resolveArbitraryValue(modifier, validate);
|
|
50
76
|
if (resolved === undefined) {
|
|
51
77
|
return undefined;
|
|
52
78
|
}
|
|
53
|
-
return (0, _negateValue
|
|
79
|
+
return (0, _negateValue.default)(resolved);
|
|
54
80
|
}
|
|
55
81
|
}
|
|
56
|
-
function asValue(modifier, options = {}, { validate =()=>true
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let value = (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
|
82
|
+
function asValue(modifier, options = {}, { validate =()=>true } = {}) {
|
|
83
|
+
var _options_values;
|
|
84
|
+
let value = (_options_values = options.values) === null || _options_values === void 0 ? void 0 : _options_values[modifier];
|
|
60
85
|
if (value !== undefined) {
|
|
61
86
|
return value;
|
|
62
87
|
}
|
|
63
|
-
if (options.supportsNegativeValues && modifier.startsWith(
|
|
88
|
+
if (options.supportsNegativeValues && modifier.startsWith("-")) {
|
|
64
89
|
return asNegativeValue(modifier.slice(1), options.values, validate);
|
|
65
90
|
}
|
|
66
91
|
return resolveArbitraryValue(modifier, validate);
|
|
67
92
|
}
|
|
68
93
|
function isArbitraryValue(input) {
|
|
69
|
-
return input.startsWith(
|
|
94
|
+
return input.startsWith("[") && input.endsWith("]");
|
|
70
95
|
}
|
|
71
|
-
function
|
|
72
|
-
let slashIdx = modifier.lastIndexOf(
|
|
96
|
+
function splitUtilityModifier(modifier) {
|
|
97
|
+
let slashIdx = modifier.lastIndexOf("/");
|
|
73
98
|
if (slashIdx === -1 || slashIdx === modifier.length - 1) {
|
|
74
99
|
return [
|
|
75
|
-
modifier
|
|
100
|
+
modifier,
|
|
101
|
+
undefined
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
let arbitrary = isArbitraryValue(modifier);
|
|
105
|
+
// The modifier could be of the form `[foo]/[bar]`
|
|
106
|
+
// We want to handle this case properly
|
|
107
|
+
// without affecting `[foo/bar]`
|
|
108
|
+
if (arbitrary && !modifier.includes("]/[")) {
|
|
109
|
+
return [
|
|
110
|
+
modifier,
|
|
111
|
+
undefined
|
|
76
112
|
];
|
|
77
113
|
}
|
|
78
114
|
return [
|
|
@@ -80,35 +116,52 @@ function splitAlpha(modifier) {
|
|
|
80
116
|
modifier.slice(slashIdx + 1)
|
|
81
117
|
];
|
|
82
118
|
}
|
|
119
|
+
function parseColorFormat(value) {
|
|
120
|
+
if (typeof value === "string" && value.includes("<alpha-value>")) {
|
|
121
|
+
let oldValue = value;
|
|
122
|
+
return ({ opacityValue =1 })=>oldValue.replace("<alpha-value>", opacityValue);
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
function unwrapArbitraryModifier(modifier) {
|
|
127
|
+
modifier = modifier.slice(1, -1);
|
|
128
|
+
if (modifier.startsWith("--")) {
|
|
129
|
+
modifier = `var(${modifier})`;
|
|
130
|
+
}
|
|
131
|
+
return modifier;
|
|
132
|
+
}
|
|
83
133
|
function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
84
|
-
var
|
|
85
|
-
if (((
|
|
86
|
-
var
|
|
87
|
-
return (
|
|
134
|
+
var _options_values;
|
|
135
|
+
if (((_options_values = options.values) === null || _options_values === void 0 ? void 0 : _options_values[modifier]) !== undefined) {
|
|
136
|
+
var _options_values1;
|
|
137
|
+
return parseColorFormat((_options_values1 = options.values) === null || _options_values1 === void 0 ? void 0 : _options_values1[modifier]);
|
|
88
138
|
}
|
|
89
|
-
|
|
139
|
+
// TODO: Hoist this up to getMatchingTypes or something
|
|
140
|
+
// We do this here because we need the alpha value (if any)
|
|
141
|
+
let [color, alpha] = splitUtilityModifier(modifier);
|
|
90
142
|
if (alpha !== undefined) {
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
let normalizedColor = (
|
|
143
|
+
var _options_values2, _tailwindConfig_theme, _tailwindConfig_theme_opacity;
|
|
144
|
+
var _options_values_color;
|
|
145
|
+
let normalizedColor = (_options_values_color = (_options_values2 = options.values) === null || _options_values2 === void 0 ? void 0 : _options_values2[color]) !== null && _options_values_color !== void 0 ? _options_values_color : isArbitraryValue(color) ? color.slice(1, -1) : undefined;
|
|
94
146
|
if (normalizedColor === undefined) {
|
|
95
147
|
return undefined;
|
|
96
148
|
}
|
|
149
|
+
normalizedColor = parseColorFormat(normalizedColor);
|
|
97
150
|
if (isArbitraryValue(alpha)) {
|
|
98
|
-
return (0, _withAlphaVariable
|
|
151
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, unwrapArbitraryModifier(alpha));
|
|
99
152
|
}
|
|
100
|
-
if (((
|
|
153
|
+
if (((_tailwindConfig_theme = tailwindConfig.theme) === null || _tailwindConfig_theme === void 0 ? void 0 : (_tailwindConfig_theme_opacity = _tailwindConfig_theme.opacity) === null || _tailwindConfig_theme_opacity === void 0 ? void 0 : _tailwindConfig_theme_opacity[alpha]) === undefined) {
|
|
101
154
|
return undefined;
|
|
102
155
|
}
|
|
103
|
-
return (0, _withAlphaVariable
|
|
156
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, tailwindConfig.theme.opacity[alpha]);
|
|
104
157
|
}
|
|
105
158
|
return asValue(modifier, options, {
|
|
106
159
|
validate: _dataTypes.color
|
|
107
160
|
});
|
|
108
161
|
}
|
|
109
162
|
function asLookupValue(modifier, options = {}) {
|
|
110
|
-
var
|
|
111
|
-
return (
|
|
163
|
+
var _options_values;
|
|
164
|
+
return (_options_values = options.values) === null || _options_values === void 0 ? void 0 : _options_values[modifier];
|
|
112
165
|
}
|
|
113
166
|
function guess(validate) {
|
|
114
167
|
return (modifier, options)=>{
|
|
@@ -126,13 +179,14 @@ let typeMap = {
|
|
|
126
179
|
percentage: guess(_dataTypes.percentage),
|
|
127
180
|
position: guess(_dataTypes.position),
|
|
128
181
|
lookup: asLookupValue,
|
|
129
|
-
|
|
130
|
-
|
|
182
|
+
"generic-name": guess(_dataTypes.genericName),
|
|
183
|
+
"family-name": guess(_dataTypes.familyName),
|
|
131
184
|
number: guess(_dataTypes.number),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
shadow: guess(_dataTypes.shadow)
|
|
185
|
+
"line-width": guess(_dataTypes.lineWidth),
|
|
186
|
+
"absolute-size": guess(_dataTypes.absoluteSize),
|
|
187
|
+
"relative-size": guess(_dataTypes.relativeSize),
|
|
188
|
+
shadow: guess(_dataTypes.shadow),
|
|
189
|
+
size: guess(_validateFormalSyntax.backgroundSize)
|
|
136
190
|
};
|
|
137
191
|
let supportedTypes = Object.keys(typeMap);
|
|
138
192
|
function splitAtFirst(input, delim) {
|
|
@@ -147,9 +201,24 @@ function splitAtFirst(input, delim) {
|
|
|
147
201
|
];
|
|
148
202
|
}
|
|
149
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
|
+
}
|
|
150
219
|
if (isArbitraryValue(modifier)) {
|
|
151
220
|
let arbitraryValue = modifier.slice(1, -1);
|
|
152
|
-
let [explicitType, value] = splitAtFirst(arbitraryValue,
|
|
221
|
+
let [explicitType, value] = splitAtFirst(arbitraryValue, ":");
|
|
153
222
|
// It could be that this resolves to `url(https` which is not a valid
|
|
154
223
|
// identifier. We currently only support "simple" words with dashes or
|
|
155
224
|
// underscores. E.g.: family-name
|
|
@@ -161,19 +230,54 @@ function coerceValue(types, modifier, options, tailwindConfig) {
|
|
|
161
230
|
if (value.length > 0 && supportedTypes.includes(explicitType)) {
|
|
162
231
|
return [
|
|
163
232
|
asValue(`[${value}]`, options),
|
|
164
|
-
explicitType
|
|
233
|
+
explicitType,
|
|
234
|
+
null
|
|
165
235
|
];
|
|
166
236
|
}
|
|
167
237
|
}
|
|
238
|
+
let matches = getMatchingTypes(types, modifier, options, tailwindConfig);
|
|
168
239
|
// Find first matching type
|
|
169
|
-
for (let
|
|
240
|
+
for (let match of matches){
|
|
241
|
+
return match;
|
|
242
|
+
}
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
function* getMatchingTypes(types, rawModifier, options, tailwindConfig) {
|
|
246
|
+
let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
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
|
+
}
|
|
253
|
+
if (utilityModifier !== undefined && modifier === "") {
|
|
254
|
+
modifier = "DEFAULT";
|
|
255
|
+
}
|
|
256
|
+
// Check the full value first
|
|
257
|
+
// TODO: Move to asValue… somehow
|
|
258
|
+
if (utilityModifier !== undefined) {
|
|
259
|
+
if (typeof options.modifiers === "object") {
|
|
260
|
+
var _options_modifiers;
|
|
261
|
+
var _options_modifiers_utilityModifier;
|
|
262
|
+
let configValue = (_options_modifiers_utilityModifier = (_options_modifiers = options.modifiers) === null || _options_modifiers === void 0 ? void 0 : _options_modifiers[utilityModifier]) !== null && _options_modifiers_utilityModifier !== void 0 ? _options_modifiers_utilityModifier : null;
|
|
263
|
+
if (configValue !== null) {
|
|
264
|
+
utilityModifier = configValue;
|
|
265
|
+
} else if (isArbitraryValue(utilityModifier)) {
|
|
266
|
+
utilityModifier = unwrapArbitraryModifier(utilityModifier);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
for (let { type } of types !== null && types !== void 0 ? types : []){
|
|
170
271
|
let result = typeMap[type](modifier, options, {
|
|
171
272
|
tailwindConfig
|
|
172
273
|
});
|
|
173
|
-
if (result
|
|
274
|
+
if (result === undefined) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
yield [
|
|
174
278
|
result,
|
|
175
|
-
type
|
|
279
|
+
type,
|
|
280
|
+
utilityModifier !== null && utilityModifier !== void 0 ? utilityModifier : null
|
|
176
281
|
];
|
|
177
282
|
}
|
|
178
|
-
return [];
|
|
179
283
|
}
|
|
@@ -2,18 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
9
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
7
10
|
function _interopRequireDefault(obj) {
|
|
8
11
|
return obj && obj.__esModule ? obj : {
|
|
9
12
|
default: obj
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
15
|
function _default(prefix, selector, prependNegative = false) {
|
|
13
|
-
return (0, _postcssSelectorParser
|
|
16
|
+
return (0, _postcssSelectorParser.default)((selectors)=>{
|
|
14
17
|
selectors.walkClasses((classSelector)=>{
|
|
15
18
|
let baseClass = classSelector.value;
|
|
16
|
-
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith(
|
|
19
|
+
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
|
|
17
20
|
classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
|
|
18
21
|
});
|
|
19
22
|
}).processSync(selector);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function removes any uses of CSS variables used as an alpha channel
|
|
3
|
+
*
|
|
4
|
+
* This is required for selectors like `:visited` which do not allow
|
|
5
|
+
* changes in opacity or external control using CSS variables.
|
|
6
|
+
*
|
|
7
|
+
* @param {import('postcss').Container} container
|
|
8
|
+
* @param {string[]} toRemove
|
|
9
|
+
*/ "use strict";
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "removeAlphaVariables", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: ()=>removeAlphaVariables
|
|
16
|
+
});
|
|
17
|
+
function removeAlphaVariables(container, toRemove) {
|
|
18
|
+
container.walkDecls((decl)=>{
|
|
19
|
+
if (toRemove.includes(decl.prop)) {
|
|
20
|
+
decl.remove();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
for (let varName of toRemove){
|
|
24
|
+
if (decl.value.includes(`/ var(${varName})`)) {
|
|
25
|
+
decl.value = decl.value.replace(`/ var(${varName})`, "");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -2,27 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>resolveConfig
|
|
8
|
+
});
|
|
9
|
+
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
|
10
|
+
const _corePluginList = /*#__PURE__*/ _interopRequireDefault(require("../corePluginList"));
|
|
11
|
+
const _configurePlugins = /*#__PURE__*/ _interopRequireDefault(require("./configurePlugins"));
|
|
12
|
+
const _colors = /*#__PURE__*/ _interopRequireDefault(require("../public/colors"));
|
|
13
|
+
const _defaults = require("./defaults");
|
|
14
|
+
const _toPath = require("./toPath");
|
|
15
|
+
const _normalizeConfig = require("./normalizeConfig");
|
|
16
|
+
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
|
|
17
|
+
const _cloneDeep = require("./cloneDeep");
|
|
18
|
+
const _pluginUtils = require("./pluginUtils");
|
|
19
|
+
const _withAlphaVariable = require("./withAlphaVariable");
|
|
20
|
+
const _toColorValue = /*#__PURE__*/ _interopRequireDefault(require("./toColorValue"));
|
|
16
21
|
function _interopRequireDefault(obj) {
|
|
17
22
|
return obj && obj.__esModule ? obj : {
|
|
18
23
|
default: obj
|
|
19
24
|
};
|
|
20
25
|
}
|
|
21
26
|
function isFunction(input) {
|
|
22
|
-
return typeof input ===
|
|
23
|
-
}
|
|
24
|
-
function isObject(input) {
|
|
25
|
-
return typeof input === 'object' && input !== null;
|
|
27
|
+
return typeof input === "function";
|
|
26
28
|
}
|
|
27
29
|
function mergeWith(target, ...sources) {
|
|
28
30
|
let customizer = sources.pop();
|
|
@@ -30,8 +32,8 @@ function mergeWith(target, ...sources) {
|
|
|
30
32
|
for(let k in source){
|
|
31
33
|
let merged = customizer(target[k], source[k]);
|
|
32
34
|
if (merged === undefined) {
|
|
33
|
-
if (
|
|
34
|
-
target[k] = mergeWith(target[k], source[k], customizer);
|
|
35
|
+
if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
|
|
36
|
+
target[k] = mergeWith({}, target[k], source[k], customizer);
|
|
35
37
|
} else {
|
|
36
38
|
target[k] = source[k];
|
|
37
39
|
}
|
|
@@ -46,9 +48,8 @@ const configUtils = {
|
|
|
46
48
|
colors: _colors.default,
|
|
47
49
|
negative (scale) {
|
|
48
50
|
// TODO: Log that this function isn't really needed anymore?
|
|
49
|
-
return Object.keys(scale).filter((key)=>scale[key] !==
|
|
50
|
-
|
|
51
|
-
let negativeValue = (0, _negateValue).default(scale[key]);
|
|
51
|
+
return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
|
|
52
|
+
let negativeValue = (0, _negateValue.default)(scale[key]);
|
|
52
53
|
if (negativeValue !== undefined) {
|
|
53
54
|
negativeScale[`-${key}`] = negativeValue;
|
|
54
55
|
}
|
|
@@ -56,12 +57,10 @@ const configUtils = {
|
|
|
56
57
|
}, {});
|
|
57
58
|
},
|
|
58
59
|
breakpoints (screens) {
|
|
59
|
-
return Object.keys(screens).filter((key)=>typeof screens[key] ===
|
|
60
|
-
).reduce((breakpoints, key)=>({
|
|
60
|
+
return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
|
|
61
61
|
...breakpoints,
|
|
62
62
|
[`screen-${key}`]: screens[key]
|
|
63
|
-
})
|
|
64
|
-
, {});
|
|
63
|
+
}), {});
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
66
|
function value(valueToResolve, ...args) {
|
|
@@ -90,28 +89,27 @@ function collectExtends(items) {
|
|
|
90
89
|
}
|
|
91
90
|
function mergeThemes(themes) {
|
|
92
91
|
return {
|
|
93
|
-
...themes.reduce((merged, theme)=>(0, _defaults
|
|
94
|
-
, {}),
|
|
92
|
+
...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
|
|
95
93
|
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
96
94
|
// into arrays instead of objects so they aren't overridden.
|
|
97
95
|
extend: collectExtends(themes)
|
|
98
96
|
};
|
|
99
97
|
}
|
|
100
|
-
function mergeExtensionCustomizer(merged,
|
|
98
|
+
function mergeExtensionCustomizer(merged, value) {
|
|
101
99
|
// When we have an array of objects, we do want to merge it
|
|
102
|
-
if (Array.isArray(merged) &&
|
|
103
|
-
return merged.concat(
|
|
100
|
+
if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
|
|
101
|
+
return merged.concat(value);
|
|
104
102
|
}
|
|
105
103
|
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
106
|
-
if (Array.isArray(
|
|
104
|
+
if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
|
|
107
105
|
return [
|
|
108
106
|
merged,
|
|
109
|
-
...
|
|
107
|
+
...value
|
|
110
108
|
];
|
|
111
109
|
}
|
|
112
110
|
// Override arrays (for example for font-families, box-shadows, ...)
|
|
113
|
-
if (Array.isArray(
|
|
114
|
-
return
|
|
111
|
+
if (Array.isArray(value)) {
|
|
112
|
+
return value;
|
|
115
113
|
}
|
|
116
114
|
// Execute default behaviour
|
|
117
115
|
return undefined;
|
|
@@ -125,37 +123,62 @@ function mergeExtensions({ extend , ...theme }) {
|
|
|
125
123
|
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
|
126
124
|
themeValue,
|
|
127
125
|
...extensions
|
|
128
|
-
].map((e)=>value(e, resolveThemePath, utils)
|
|
129
|
-
), mergeExtensionCustomizer)
|
|
130
|
-
;
|
|
126
|
+
].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
|
131
127
|
});
|
|
132
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param {string} key
|
|
132
|
+
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
133
|
+
*/ function* toPaths(key) {
|
|
134
|
+
let path = (0, _toPath.toPath)(key);
|
|
135
|
+
if (path.length === 0) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
yield path;
|
|
139
|
+
if (Array.isArray(key)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
|
|
143
|
+
let matches = key.match(pattern);
|
|
144
|
+
if (matches !== null) {
|
|
145
|
+
let [, prefix, alpha] = matches;
|
|
146
|
+
let newPath = (0, _toPath.toPath)(prefix);
|
|
147
|
+
newPath.alpha = alpha;
|
|
148
|
+
yield newPath;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
133
151
|
function resolveFunctionKeys(object) {
|
|
152
|
+
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
134
153
|
const resolvePath = (key, defaultValue)=>{
|
|
135
|
-
const path
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
154
|
+
for (const path of toPaths(key)){
|
|
155
|
+
let index = 0;
|
|
156
|
+
let val = object;
|
|
157
|
+
while(val !== undefined && val !== null && index < path.length){
|
|
158
|
+
val = val[path[index++]];
|
|
159
|
+
let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
|
|
160
|
+
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
|
|
161
|
+
}
|
|
162
|
+
if (val !== undefined) {
|
|
163
|
+
if (path.alpha !== undefined) {
|
|
164
|
+
let normalized = (0, _pluginUtils.parseColorFormat)(val);
|
|
165
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
|
|
166
|
+
}
|
|
167
|
+
if ((0, _isPlainObject.default)(val)) {
|
|
168
|
+
return (0, _cloneDeep.cloneDeep)(val);
|
|
169
|
+
}
|
|
170
|
+
return val;
|
|
171
|
+
}
|
|
147
172
|
}
|
|
148
|
-
return
|
|
173
|
+
return defaultValue;
|
|
149
174
|
};
|
|
150
|
-
resolvePath
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
175
|
+
Object.assign(resolvePath, {
|
|
176
|
+
theme: resolvePath,
|
|
177
|
+
...configUtils
|
|
178
|
+
});
|
|
154
179
|
return Object.keys(object).reduce((resolved, key)=>{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
[key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
|
|
158
|
-
};
|
|
180
|
+
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
|
|
181
|
+
return resolved;
|
|
159
182
|
}, {});
|
|
160
183
|
}
|
|
161
184
|
function extractPluginConfigs(configs) {
|
|
@@ -165,8 +188,8 @@ function extractPluginConfigs(configs) {
|
|
|
165
188
|
...allConfigs,
|
|
166
189
|
config
|
|
167
190
|
];
|
|
168
|
-
var
|
|
169
|
-
const plugins = (
|
|
191
|
+
var _config_plugins;
|
|
192
|
+
const plugins = (_config_plugins = config === null || config === void 0 ? void 0 : config.plugins) !== null && _config_plugins !== void 0 ? _config_plugins : [];
|
|
170
193
|
if (plugins.length === 0) {
|
|
171
194
|
return;
|
|
172
195
|
}
|
|
@@ -174,11 +197,11 @@ function extractPluginConfigs(configs) {
|
|
|
174
197
|
if (plugin.__isOptionsFunction) {
|
|
175
198
|
plugin = plugin();
|
|
176
199
|
}
|
|
177
|
-
var
|
|
200
|
+
var _plugin_config;
|
|
178
201
|
allConfigs = [
|
|
179
202
|
...allConfigs,
|
|
180
203
|
...extractPluginConfigs([
|
|
181
|
-
(
|
|
204
|
+
(_plugin_config = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && _plugin_config !== void 0 ? _plugin_config : {}
|
|
182
205
|
])
|
|
183
206
|
];
|
|
184
207
|
});
|
|
@@ -194,7 +217,7 @@ function resolveCorePlugins(corePluginConfigs) {
|
|
|
194
217
|
corePlugins: resolved
|
|
195
218
|
});
|
|
196
219
|
}
|
|
197
|
-
return (0, _configurePlugins
|
|
220
|
+
return (0, _configurePlugins.default)(corePluginConfig, resolved);
|
|
198
221
|
}, _corePluginList.default);
|
|
199
222
|
return result;
|
|
200
223
|
}
|
|
@@ -213,21 +236,19 @@ function resolveConfig(configs) {
|
|
|
213
236
|
let allConfigs = [
|
|
214
237
|
...extractPluginConfigs(configs),
|
|
215
238
|
{
|
|
216
|
-
prefix:
|
|
239
|
+
prefix: "",
|
|
217
240
|
important: false,
|
|
218
|
-
separator:
|
|
219
|
-
|
|
220
|
-
},
|
|
241
|
+
separator: ":"
|
|
242
|
+
}
|
|
221
243
|
];
|
|
222
|
-
var
|
|
223
|
-
return (0, _normalizeConfig
|
|
244
|
+
var _t_theme, _c_plugins;
|
|
245
|
+
return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
|
|
224
246
|
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
225
|
-
return (
|
|
247
|
+
return (_t_theme = t === null || t === void 0 ? void 0 : t.theme) !== null && _t_theme !== void 0 ? _t_theme : {};
|
|
226
248
|
})))),
|
|
227
|
-
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
|
|
228
|
-
)),
|
|
249
|
+
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
|
229
250
|
plugins: resolvePluginLists(configs.map((c)=>{
|
|
230
|
-
return (
|
|
251
|
+
return (_c_plugins = c === null || c === void 0 ? void 0 : c.plugins) !== null && _c_plugins !== void 0 ? _c_plugins : [];
|
|
231
252
|
}))
|
|
232
253
|
}, ...allConfigs));
|
|
233
254
|
}
|