tailwindcss 0.0.0-insiders.7c337f2 → 0.0.0-insiders.7d8eb21
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 +246 -6
- package/README.md +13 -9
- package/defaultTheme.d.ts +2 -1
- 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 +18 -5
- package/lib/cli.js +62 -592
- package/lib/constants.js +19 -12
- package/lib/corePluginList.js +5 -3
- package/lib/corePlugins.js +619 -347
- package/lib/css/preflight.css +7 -0
- package/lib/featureFlags.js +34 -22
- package/lib/index.js +16 -9
- package/lib/lib/cacheInvalidation.js +42 -21
- package/lib/lib/collapseAdjacentRules.js +16 -14
- package/lib/lib/collapseDuplicateDeclarations.js +13 -10
- package/lib/lib/content.js +177 -0
- package/lib/lib/defaultExtractor.js +230 -33
- package/lib/lib/detectNesting.js +13 -4
- package/lib/lib/evaluateTailwindFunctions.js +105 -42
- package/lib/lib/expandApplyAtRules.js +151 -92
- package/lib/lib/expandTailwindAtRules.js +134 -149
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +404 -185
- package/lib/lib/getModuleDependencies.js +21 -18
- package/lib/lib/normalizeTailwindDirectives.js +11 -8
- package/lib/lib/offsets.js +285 -0
- package/lib/lib/partitionApplyAtRules.js +14 -11
- package/lib/lib/regex.js +60 -0
- package/lib/lib/remap-bitfield.js +87 -0
- package/lib/lib/resolveDefaultsAtRules.js +97 -79
- package/lib/lib/setupContextUtils.js +567 -242
- package/lib/lib/setupTrackingContext.js +77 -106
- package/lib/lib/sharedState.js +18 -10
- package/lib/lib/substituteScreenAtRules.js +9 -7
- package/lib/postcss-plugins/nesting/index.js +7 -5
- package/lib/postcss-plugins/nesting/plugin.js +10 -8
- package/lib/processTailwindFeatures.js +34 -31
- package/lib/public/colors.js +7 -5
- 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 +13 -10
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +10 -5
- package/lib/util/cloneDeep.js +6 -5
- package/lib/util/cloneNodes.js +9 -2
- package/lib/util/color.js +20 -17
- package/lib/util/configurePlugins.js +5 -2
- package/lib/util/createPlugin.js +6 -5
- package/lib/util/createUtilityPlugin.js +15 -13
- package/lib/util/dataTypes.js +75 -51
- package/lib/util/defaults.js +8 -5
- package/lib/util/escapeClassName.js +13 -10
- package/lib/util/escapeCommas.js +4 -1
- package/lib/util/flattenColorPalette.js +7 -8
- package/lib/util/formatVariantSelector.js +270 -103
- package/lib/util/getAllConfigs.js +34 -15
- package/lib/util/hashConfig.js +10 -7
- package/lib/util/isKeyframeRule.js +4 -1
- package/lib/util/isPlainObject.js +4 -1
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +34 -26
- package/lib/util/log.js +14 -8
- package/lib/util/nameClass.js +19 -8
- package/lib/util/negateValue.js +20 -5
- package/lib/util/normalizeConfig.js +94 -53
- package/lib/util/normalizeScreens.js +115 -4
- package/lib/util/parseAnimationValue.js +43 -41
- package/lib/util/parseBoxShadowValue.js +12 -45
- package/lib/util/parseDependency.js +37 -55
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +15 -12
- package/lib/util/pluginUtils.js +146 -42
- package/lib/util/prefixSelector.js +26 -9
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +104 -105
- package/lib/util/resolveConfigPath.js +20 -17
- package/lib/util/responsive.js +12 -9
- package/lib/util/splitAtTopLevelOnly.js +43 -0
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +4 -1
- package/lib/util/toPath.js +18 -2
- package/lib/util/transformThemeValue.js +23 -11
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +32 -24
- package/package.json +32 -29
- package/peers/index.js +6693 -3036
- package/plugin.d.ts +10 -5
- package/resolveConfig.d.ts +12 -0
- package/scripts/generate-types.js +53 -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 +46 -659
- package/src/corePlugins.js +346 -79
- package/src/css/preflight.css +7 -0
- package/src/featureFlags.js +12 -2
- package/src/index.js +5 -0
- package/src/lib/content.js +213 -0
- package/src/lib/defaultExtractor.js +202 -35
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/evaluateTailwindFunctions.js +78 -7
- package/src/lib/expandApplyAtRules.js +129 -34
- package/src/lib/expandTailwindAtRules.js +12 -50
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +379 -126
- 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 -36
- package/src/lib/setupContextUtils.js +510 -120
- package/src/lib/setupTrackingContext.js +8 -45
- package/src/lib/sharedState.js +2 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +5 -1
- package/src/util/dataTypes.js +51 -26
- package/src/util/formatVariantSelector.js +317 -101
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +1 -1
- 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 -50
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +132 -10
- package/src/util/prefixSelector.js +28 -10
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +70 -62
- 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 +165 -164
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +77 -37
- package/types/generated/default-theme.d.ts +342 -0
- package/types/index.d.ts +7 -1
- package/types.d.ts +0 -1
package/lib/util/nameClass.js
CHANGED
|
@@ -2,21 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function nameClass(classPrefix, key) {
|
|
11
|
-
return asClass(formatClass(classPrefix, key));
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
12
10
|
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
asClass: ()=>asClass,
|
|
13
|
+
default: ()=>nameClass,
|
|
14
|
+
formatClass: ()=>formatClass
|
|
15
|
+
});
|
|
16
|
+
const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("./escapeClassName"));
|
|
17
|
+
const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
|
|
13
18
|
function _interopRequireDefault(obj) {
|
|
14
19
|
return obj && obj.__esModule ? obj : {
|
|
15
20
|
default: obj
|
|
16
21
|
};
|
|
17
22
|
}
|
|
18
23
|
function asClass(name) {
|
|
19
|
-
return (0, _escapeCommas
|
|
24
|
+
return (0, _escapeCommas.default)(`.${(0, _escapeClassName.default)(name)}`);
|
|
25
|
+
}
|
|
26
|
+
function nameClass(classPrefix, key) {
|
|
27
|
+
return asClass(formatClass(classPrefix, key));
|
|
20
28
|
}
|
|
21
29
|
function formatClass(classPrefix, key) {
|
|
22
30
|
if (key === "DEFAULT") {
|
|
@@ -28,5 +36,8 @@ function formatClass(classPrefix, key) {
|
|
|
28
36
|
if (key.startsWith("-")) {
|
|
29
37
|
return `-${classPrefix}${key}`;
|
|
30
38
|
}
|
|
39
|
+
if (key.startsWith("/")) {
|
|
40
|
+
return `${classPrefix}${key}`;
|
|
41
|
+
}
|
|
31
42
|
return `${classPrefix}-${key}`;
|
|
32
43
|
}
|
package/lib/util/negateValue.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
6
9
|
function _default(value) {
|
|
7
10
|
value = `${value}`;
|
|
8
11
|
if (value === "0") {
|
|
@@ -10,10 +13,22 @@ function _default(value) {
|
|
|
10
13
|
}
|
|
11
14
|
// Flip sign of numbers
|
|
12
15
|
if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
|
|
13
|
-
return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-"
|
|
14
|
-
);
|
|
16
|
+
return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
// What functions we support negating numeric values for
|
|
19
|
+
// var() isn't inherently a numeric function but we support it anyway
|
|
20
|
+
// The trigonometric functions are omitted because you'll need to use calc(…) with them _anyway_
|
|
21
|
+
// to produce generally useful results and that will be covered already
|
|
22
|
+
let numericFunctions = [
|
|
23
|
+
"var",
|
|
24
|
+
"calc",
|
|
25
|
+
"min",
|
|
26
|
+
"max",
|
|
27
|
+
"clamp"
|
|
28
|
+
];
|
|
29
|
+
for (const fn of numericFunctions){
|
|
30
|
+
if (value.includes(`${fn}(`)) {
|
|
31
|
+
return `calc(${value} * -1)`;
|
|
32
|
+
}
|
|
18
33
|
}
|
|
19
34
|
}
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Object.defineProperty(exports, "normalizeConfig", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>normalizeConfig
|
|
8
|
+
});
|
|
9
|
+
const _log = /*#__PURE__*/ _interopRequireWildcard(require("./log"));
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
11
|
+
if (typeof WeakMap !== "function") return null;
|
|
12
|
+
var cacheBabelInterop = new WeakMap();
|
|
13
|
+
var cacheNodeInterop = new WeakMap();
|
|
14
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
15
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
16
|
+
})(nodeInterop);
|
|
17
|
+
}
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
19
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
9
20
|
return obj;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
23
|
+
return {
|
|
24
|
+
default: obj
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
28
|
+
if (cache && cache.has(obj)) {
|
|
29
|
+
return cache.get(obj);
|
|
30
|
+
}
|
|
31
|
+
var newObj = {};
|
|
32
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
33
|
+
for(var key in obj){
|
|
34
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
35
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
36
|
+
if (desc && (desc.get || desc.set)) {
|
|
37
|
+
Object.defineProperty(newObj, key, desc);
|
|
38
|
+
} else {
|
|
39
|
+
newObj[key] = obj[key];
|
|
22
40
|
}
|
|
23
41
|
}
|
|
24
|
-
newObj.default = obj;
|
|
25
|
-
return newObj;
|
|
26
42
|
}
|
|
43
|
+
newObj.default = obj;
|
|
44
|
+
if (cache) {
|
|
45
|
+
cache.set(obj, newObj);
|
|
46
|
+
}
|
|
47
|
+
return newObj;
|
|
27
48
|
}
|
|
28
49
|
function normalizeConfig(config) {
|
|
29
50
|
// Quick structure validation
|
|
@@ -70,13 +91,13 @@ function normalizeConfig(config) {
|
|
|
70
91
|
}
|
|
71
92
|
// When `config.content` is an object
|
|
72
93
|
if (typeof config.content === "object" && config.content !== null) {
|
|
73
|
-
// Only `files`, `extract
|
|
94
|
+
// Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
|
|
74
95
|
if (Object.keys(config.content).some((key)=>![
|
|
75
96
|
"files",
|
|
97
|
+
"relative",
|
|
76
98
|
"extract",
|
|
77
99
|
"transform"
|
|
78
|
-
].includes(key)
|
|
79
|
-
)) {
|
|
100
|
+
].includes(key))) {
|
|
80
101
|
return false;
|
|
81
102
|
}
|
|
82
103
|
// `config.content.files` should exist of FilePaths or RawFiles
|
|
@@ -107,14 +128,18 @@ function normalizeConfig(config) {
|
|
|
107
128
|
}
|
|
108
129
|
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
|
109
130
|
if (typeof config.content.transform === "object") {
|
|
110
|
-
for (let
|
|
111
|
-
if (typeof
|
|
131
|
+
for (let value1 of Object.values(config.content.transform)){
|
|
132
|
+
if (typeof value1 !== "function") {
|
|
112
133
|
return false;
|
|
113
134
|
}
|
|
114
135
|
}
|
|
115
136
|
} else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
|
|
116
137
|
return false;
|
|
117
138
|
}
|
|
139
|
+
// `config.content.relative` is optional and can be a boolean
|
|
140
|
+
if (typeof config.content.relative !== "boolean" && typeof config.content.relative !== "undefined") {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
118
143
|
}
|
|
119
144
|
return true;
|
|
120
145
|
}
|
|
@@ -124,17 +149,31 @@ function normalizeConfig(config) {
|
|
|
124
149
|
_log.default.warn("purge-deprecation", [
|
|
125
150
|
"The `purge`/`content` options have changed in Tailwind CSS v3.0.",
|
|
126
151
|
"Update your configuration file to eliminate this warning.",
|
|
127
|
-
"https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
|
|
152
|
+
"https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
|
|
128
153
|
]);
|
|
129
154
|
}
|
|
130
155
|
// Normalize the `safelist`
|
|
131
156
|
config.safelist = (()=>{
|
|
132
|
-
var
|
|
157
|
+
var _purge_options;
|
|
133
158
|
let { content , purge , safelist } = config;
|
|
134
159
|
if (Array.isArray(safelist)) return safelist;
|
|
135
160
|
if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
|
|
136
161
|
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
|
|
137
|
-
if (Array.isArray(purge === null || purge === void 0 ? void 0 : (
|
|
162
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : (_purge_options = purge.options) === null || _purge_options === void 0 ? void 0 : _purge_options.safelist)) return purge.options.safelist;
|
|
163
|
+
return [];
|
|
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
|
+
}
|
|
138
177
|
return [];
|
|
139
178
|
})();
|
|
140
179
|
// Normalize prefix option
|
|
@@ -142,15 +181,24 @@ function normalizeConfig(config) {
|
|
|
142
181
|
_log.default.warn("prefix-function", [
|
|
143
182
|
"As of Tailwind CSS v3.0, `prefix` cannot be a function.",
|
|
144
183
|
"Update `prefix` in your configuration to be a string to eliminate this warning.",
|
|
145
|
-
"https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
|
|
184
|
+
"https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
|
|
146
185
|
]);
|
|
147
186
|
config.prefix = "";
|
|
148
187
|
} else {
|
|
149
|
-
var
|
|
150
|
-
config.prefix = (
|
|
188
|
+
var _config_prefix;
|
|
189
|
+
config.prefix = (_config_prefix = config.prefix) !== null && _config_prefix !== void 0 ? _config_prefix : "";
|
|
151
190
|
}
|
|
152
191
|
// Normalize the `content`
|
|
153
192
|
config.content = {
|
|
193
|
+
relative: (()=>{
|
|
194
|
+
var _config_future;
|
|
195
|
+
let { content } = config;
|
|
196
|
+
if (content === null || content === void 0 ? void 0 : content.relative) {
|
|
197
|
+
return content.relative;
|
|
198
|
+
}
|
|
199
|
+
var _config_future_relativeContentPathsByDefault;
|
|
200
|
+
return (_config_future_relativeContentPathsByDefault = (_config_future = config.future) === null || _config_future === void 0 ? void 0 : _config_future.relativeContentPathsByDefault) !== null && _config_future_relativeContentPathsByDefault !== void 0 ? _config_future_relativeContentPathsByDefault : false;
|
|
201
|
+
})(),
|
|
154
202
|
files: (()=>{
|
|
155
203
|
let { content , purge } = config;
|
|
156
204
|
if (Array.isArray(purge)) return purge;
|
|
@@ -162,22 +210,22 @@ function normalizeConfig(config) {
|
|
|
162
210
|
})(),
|
|
163
211
|
extract: (()=>{
|
|
164
212
|
let extract = (()=>{
|
|
165
|
-
var
|
|
166
|
-
if ((
|
|
167
|
-
if ((
|
|
168
|
-
if ((
|
|
169
|
-
if ((
|
|
170
|
-
if ((
|
|
171
|
-
if ((
|
|
213
|
+
var _config_purge, _config_content, _config_purge1, _config_purge_extract, _config_content1, _config_content_extract, _config_purge2, _config_purge_options, _config_content2, _config_content_options;
|
|
214
|
+
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.extract) return config.purge.extract;
|
|
215
|
+
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.extract) return config.content.extract;
|
|
216
|
+
if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_extract = _config_purge1.extract) === null || _config_purge_extract === void 0 ? void 0 : _config_purge_extract.DEFAULT) return config.purge.extract.DEFAULT;
|
|
217
|
+
if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_extract = _config_content1.extract) === null || _config_content_extract === void 0 ? void 0 : _config_content_extract.DEFAULT) return config.content.extract.DEFAULT;
|
|
218
|
+
if ((_config_purge2 = config.purge) === null || _config_purge2 === void 0 ? void 0 : (_config_purge_options = _config_purge2.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.extractors) return config.purge.options.extractors;
|
|
219
|
+
if ((_config_content2 = config.content) === null || _config_content2 === void 0 ? void 0 : (_config_content_options = _config_content2.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.extractors) return config.content.options.extractors;
|
|
172
220
|
return {};
|
|
173
221
|
})();
|
|
174
222
|
let extractors = {};
|
|
175
223
|
let defaultExtractor = (()=>{
|
|
176
|
-
var
|
|
177
|
-
if ((
|
|
224
|
+
var _config_purge, _config_purge_options, _config_content, _config_content_options;
|
|
225
|
+
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : (_config_purge_options = _config_purge.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.defaultExtractor) {
|
|
178
226
|
return config.purge.options.defaultExtractor;
|
|
179
227
|
}
|
|
180
|
-
if ((
|
|
228
|
+
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : (_config_content_options = _config_content.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.defaultExtractor) {
|
|
181
229
|
return config.content.options.defaultExtractor;
|
|
182
230
|
}
|
|
183
231
|
return undefined;
|
|
@@ -201,11 +249,11 @@ function normalizeConfig(config) {
|
|
|
201
249
|
})(),
|
|
202
250
|
transform: (()=>{
|
|
203
251
|
let transform = (()=>{
|
|
204
|
-
var
|
|
205
|
-
if ((
|
|
206
|
-
if ((
|
|
207
|
-
if ((
|
|
208
|
-
if ((
|
|
252
|
+
var _config_purge, _config_content, _config_purge1, _config_purge_transform, _config_content1, _config_content_transform;
|
|
253
|
+
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.transform) return config.purge.transform;
|
|
254
|
+
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.transform) return config.content.transform;
|
|
255
|
+
if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_transform = _config_purge1.transform) === null || _config_purge_transform === void 0 ? void 0 : _config_purge_transform.DEFAULT) return config.purge.transform.DEFAULT;
|
|
256
|
+
if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_transform = _config_content1.transform) === null || _config_content_transform === void 0 ? void 0 : _config_content_transform.DEFAULT) return config.content.transform.DEFAULT;
|
|
209
257
|
return {};
|
|
210
258
|
})();
|
|
211
259
|
let transformers = {};
|
|
@@ -223,18 +271,11 @@ function normalizeConfig(config) {
|
|
|
223
271
|
for (let file of config.content.files){
|
|
224
272
|
if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
|
|
225
273
|
_log.default.warn("invalid-glob-braces", [
|
|
226
|
-
`The glob pattern ${(0, _log
|
|
227
|
-
`Update it to ${(0, _log
|
|
274
|
+
`The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
|
|
275
|
+
`Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
|
|
228
276
|
]);
|
|
229
277
|
break;
|
|
230
278
|
}
|
|
231
279
|
}
|
|
232
|
-
if (config.content.files.length === 0) {
|
|
233
|
-
_log.default.warn("content-problems", [
|
|
234
|
-
"The `content` option in your Tailwind CSS configuration is missing or empty.",
|
|
235
|
-
"Configure your content sources or your generated CSS will be missing styles.",
|
|
236
|
-
"https://tailwindcss.com/docs/content-configuration",
|
|
237
|
-
]);
|
|
238
|
-
}
|
|
239
280
|
return config;
|
|
240
281
|
}
|
|
@@ -1,8 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} ScreenValue
|
|
3
|
+
* @property {number|undefined} min
|
|
4
|
+
* @property {number|undefined} max
|
|
5
|
+
* @property {string|undefined} raw
|
|
6
|
+
*/ /**
|
|
7
|
+
* @typedef {object} Screen
|
|
8
|
+
* @property {string} name
|
|
9
|
+
* @property {boolean} not
|
|
10
|
+
* @property {ScreenValue[]} values
|
|
11
|
+
*/ /**
|
|
12
|
+
* A function that normalizes the various forms that the screens object can be
|
|
13
|
+
* provided in.
|
|
14
|
+
*
|
|
15
|
+
* Input(s):
|
|
16
|
+
* - ['100px', '200px'] // Raw strings
|
|
17
|
+
* - { sm: '100px', md: '200px' } // Object with string values
|
|
18
|
+
* - { sm: { min: '100px' }, md: { max: '100px' } } // Object with object values
|
|
19
|
+
* - { sm: [{ min: '100px' }, { max: '200px' }] } // Object with object array (multiple values)
|
|
20
|
+
*
|
|
21
|
+
* Output(s):
|
|
22
|
+
* - [{ name: 'sm', values: [{ min: '100px', max: '200px' }] }] // List of objects, that contains multiple values
|
|
23
|
+
*
|
|
24
|
+
* @returns {Screen[]}
|
|
25
|
+
*/ "use strict";
|
|
2
26
|
Object.defineProperty(exports, "__esModule", {
|
|
3
27
|
value: true
|
|
4
28
|
});
|
|
5
|
-
|
|
29
|
+
function _export(target, all) {
|
|
30
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: all[name]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
_export(exports, {
|
|
36
|
+
normalizeScreens: ()=>normalizeScreens,
|
|
37
|
+
isScreenSortable: ()=>isScreenSortable,
|
|
38
|
+
compareScreens: ()=>compareScreens,
|
|
39
|
+
toScreen: ()=>toScreen
|
|
40
|
+
});
|
|
6
41
|
function normalizeScreens(screens, root = true) {
|
|
7
42
|
if (Array.isArray(screens)) {
|
|
8
43
|
return screens.map((screen)=>{
|
|
@@ -12,6 +47,7 @@ function normalizeScreens(screens, root = true) {
|
|
|
12
47
|
if (typeof screen === "string") {
|
|
13
48
|
return {
|
|
14
49
|
name: screen.toString(),
|
|
50
|
+
not: false,
|
|
15
51
|
values: [
|
|
16
52
|
{
|
|
17
53
|
min: screen,
|
|
@@ -25,6 +61,7 @@ function normalizeScreens(screens, root = true) {
|
|
|
25
61
|
if (typeof options === "string") {
|
|
26
62
|
return {
|
|
27
63
|
name,
|
|
64
|
+
not: false,
|
|
28
65
|
values: [
|
|
29
66
|
{
|
|
30
67
|
min: options,
|
|
@@ -36,12 +73,13 @@ function normalizeScreens(screens, root = true) {
|
|
|
36
73
|
if (Array.isArray(options)) {
|
|
37
74
|
return {
|
|
38
75
|
name,
|
|
39
|
-
|
|
40
|
-
)
|
|
76
|
+
not: false,
|
|
77
|
+
values: options.map((option)=>resolveValue(option))
|
|
41
78
|
};
|
|
42
79
|
}
|
|
43
80
|
return {
|
|
44
81
|
name,
|
|
82
|
+
not: false,
|
|
45
83
|
values: [
|
|
46
84
|
resolveValue(options)
|
|
47
85
|
]
|
|
@@ -50,6 +88,79 @@ function normalizeScreens(screens, root = true) {
|
|
|
50
88
|
}
|
|
51
89
|
return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
|
|
52
90
|
}
|
|
91
|
+
function isScreenSortable(screen) {
|
|
92
|
+
if (screen.values.length !== 1) {
|
|
93
|
+
return {
|
|
94
|
+
result: false,
|
|
95
|
+
reason: "multiple-values"
|
|
96
|
+
};
|
|
97
|
+
} else if (screen.values[0].raw !== undefined) {
|
|
98
|
+
return {
|
|
99
|
+
result: false,
|
|
100
|
+
reason: "raw-values"
|
|
101
|
+
};
|
|
102
|
+
} else if (screen.values[0].min !== undefined && screen.values[0].max !== undefined) {
|
|
103
|
+
return {
|
|
104
|
+
result: false,
|
|
105
|
+
reason: "min-and-max"
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
result: true,
|
|
110
|
+
reason: null
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function compareScreens(type, a, z) {
|
|
114
|
+
let aScreen = toScreen(a, type);
|
|
115
|
+
let zScreen = toScreen(z, type);
|
|
116
|
+
let aSorting = isScreenSortable(aScreen);
|
|
117
|
+
let bSorting = isScreenSortable(zScreen);
|
|
118
|
+
// These cases should never happen and indicate a bug in Tailwind CSS itself
|
|
119
|
+
if (aSorting.reason === "multiple-values" || bSorting.reason === "multiple-values") {
|
|
120
|
+
throw new Error("Attempted to sort a screen with multiple values. This should never happen. Please open a bug report.");
|
|
121
|
+
} else if (aSorting.reason === "raw-values" || bSorting.reason === "raw-values") {
|
|
122
|
+
throw new Error("Attempted to sort a screen with raw values. This should never happen. Please open a bug report.");
|
|
123
|
+
} else if (aSorting.reason === "min-and-max" || bSorting.reason === "min-and-max") {
|
|
124
|
+
throw new Error("Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.");
|
|
125
|
+
}
|
|
126
|
+
// Let the sorting begin
|
|
127
|
+
let { min: aMin , max: aMax } = aScreen.values[0];
|
|
128
|
+
let { min: zMin , max: zMax } = zScreen.values[0];
|
|
129
|
+
// Negating screens flip their behavior. Basically `not min-width` is `max-width`
|
|
130
|
+
if (a.not) [aMin, aMax] = [
|
|
131
|
+
aMax,
|
|
132
|
+
aMin
|
|
133
|
+
];
|
|
134
|
+
if (z.not) [zMin, zMax] = [
|
|
135
|
+
zMax,
|
|
136
|
+
zMin
|
|
137
|
+
];
|
|
138
|
+
aMin = aMin === undefined ? aMin : parseFloat(aMin);
|
|
139
|
+
aMax = aMax === undefined ? aMax : parseFloat(aMax);
|
|
140
|
+
zMin = zMin === undefined ? zMin : parseFloat(zMin);
|
|
141
|
+
zMax = zMax === undefined ? zMax : parseFloat(zMax);
|
|
142
|
+
let [aValue, zValue] = type === "min" ? [
|
|
143
|
+
aMin,
|
|
144
|
+
zMin
|
|
145
|
+
] : [
|
|
146
|
+
zMax,
|
|
147
|
+
aMax
|
|
148
|
+
];
|
|
149
|
+
return aValue - zValue;
|
|
150
|
+
}
|
|
151
|
+
function toScreen(value, type) {
|
|
152
|
+
if (typeof value === "object") {
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
name: "arbitrary-screen",
|
|
157
|
+
values: [
|
|
158
|
+
{
|
|
159
|
+
[type]: value
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
53
164
|
function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } = {}) {
|
|
54
165
|
return {
|
|
55
166
|
min,
|
|
@@ -2,7 +2,48 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>parseAnimationValue
|
|
8
|
+
});
|
|
9
|
+
const DIRECTIONS = new Set([
|
|
10
|
+
"normal",
|
|
11
|
+
"reverse",
|
|
12
|
+
"alternate",
|
|
13
|
+
"alternate-reverse"
|
|
14
|
+
]);
|
|
15
|
+
const PLAY_STATES = new Set([
|
|
16
|
+
"running",
|
|
17
|
+
"paused"
|
|
18
|
+
]);
|
|
19
|
+
const FILL_MODES = new Set([
|
|
20
|
+
"none",
|
|
21
|
+
"forwards",
|
|
22
|
+
"backwards",
|
|
23
|
+
"both"
|
|
24
|
+
]);
|
|
25
|
+
const ITERATION_COUNTS = new Set([
|
|
26
|
+
"infinite"
|
|
27
|
+
]);
|
|
28
|
+
const TIMINGS = new Set([
|
|
29
|
+
"linear",
|
|
30
|
+
"ease",
|
|
31
|
+
"ease-in",
|
|
32
|
+
"ease-out",
|
|
33
|
+
"ease-in-out",
|
|
34
|
+
"step-start",
|
|
35
|
+
"step-end"
|
|
36
|
+
]);
|
|
37
|
+
const TIMING_FNS = [
|
|
38
|
+
"cubic-bezier",
|
|
39
|
+
"steps"
|
|
40
|
+
];
|
|
41
|
+
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
42
|
+
;
|
|
43
|
+
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
44
|
+
;
|
|
45
|
+
const TIME = /^(-?[\d.]+m?s)$/;
|
|
46
|
+
const DIGIT = /^(\d+)$/;
|
|
6
47
|
function parseAnimationValue(input) {
|
|
7
48
|
let animations = input.split(COMMA);
|
|
8
49
|
return animations.map((animation)=>{
|
|
@@ -28,8 +69,7 @@ function parseAnimationValue(input) {
|
|
|
28
69
|
} else if (!seen.has("TIMING_FUNCTION") && TIMINGS.has(part)) {
|
|
29
70
|
result.timingFunction = part;
|
|
30
71
|
seen.add("TIMING_FUNCTION");
|
|
31
|
-
} else if (!seen.has("TIMING_FUNCTION") && TIMING_FNS.some((f)=>part.startsWith(`${f}(`)
|
|
32
|
-
)) {
|
|
72
|
+
} else if (!seen.has("TIMING_FUNCTION") && TIMING_FNS.some((f)=>part.startsWith(`${f}(`))) {
|
|
33
73
|
result.timingFunction = part;
|
|
34
74
|
seen.add("TIMING_FUNCTION");
|
|
35
75
|
} else if (!seen.has("DURATION") && TIME.test(part)) {
|
|
@@ -49,41 +89,3 @@ function parseAnimationValue(input) {
|
|
|
49
89
|
return result;
|
|
50
90
|
});
|
|
51
91
|
}
|
|
52
|
-
const DIRECTIONS = new Set([
|
|
53
|
-
"normal",
|
|
54
|
-
"reverse",
|
|
55
|
-
"alternate",
|
|
56
|
-
"alternate-reverse"
|
|
57
|
-
]);
|
|
58
|
-
const PLAY_STATES = new Set([
|
|
59
|
-
"running",
|
|
60
|
-
"paused"
|
|
61
|
-
]);
|
|
62
|
-
const FILL_MODES = new Set([
|
|
63
|
-
"none",
|
|
64
|
-
"forwards",
|
|
65
|
-
"backwards",
|
|
66
|
-
"both"
|
|
67
|
-
]);
|
|
68
|
-
const ITERATION_COUNTS = new Set([
|
|
69
|
-
"infinite"
|
|
70
|
-
]);
|
|
71
|
-
const TIMINGS = new Set([
|
|
72
|
-
"linear",
|
|
73
|
-
"ease",
|
|
74
|
-
"ease-in",
|
|
75
|
-
"ease-out",
|
|
76
|
-
"ease-in-out",
|
|
77
|
-
"step-start",
|
|
78
|
-
"step-end",
|
|
79
|
-
]);
|
|
80
|
-
const TIMING_FNS = [
|
|
81
|
-
"cubic-bezier",
|
|
82
|
-
"steps"
|
|
83
|
-
];
|
|
84
|
-
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
85
|
-
;
|
|
86
|
-
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
87
|
-
;
|
|
88
|
-
const TIME = /^(-?[\d.]+m?s)$/;
|
|
89
|
-
const DIGIT = /^(\d+)$/;
|
|
@@ -2,8 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
parseBoxShadowValue: ()=>parseBoxShadowValue,
|
|
13
|
+
formatBoxShadowValue: ()=>formatBoxShadowValue
|
|
14
|
+
});
|
|
15
|
+
const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
|
|
7
16
|
let KEYWORDS = new Set([
|
|
8
17
|
"inset",
|
|
9
18
|
"inherit",
|
|
@@ -14,50 +23,8 @@ let KEYWORDS = new Set([
|
|
|
14
23
|
let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
15
24
|
;
|
|
16
25
|
let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
|
|
17
|
-
let SPECIALS = /[(),]/g;
|
|
18
|
-
/**
|
|
19
|
-
* This splits a string on top-level commas.
|
|
20
|
-
*
|
|
21
|
-
* Regex doesn't support recursion (at least not the JS-flavored version).
|
|
22
|
-
* So we have to use a tiny state machine to keep track of paren vs comma
|
|
23
|
-
* placement. Before we'd only exclude commas from the inner-most nested
|
|
24
|
-
* set of parens rather than any commas that were not contained in parens
|
|
25
|
-
* at all which is the intended behavior here.
|
|
26
|
-
*
|
|
27
|
-
* Expected behavior:
|
|
28
|
-
* var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
|
|
29
|
-
* ─┬─ ┬ ┬ ┬
|
|
30
|
-
* x x x ╰──────── Split because top-level
|
|
31
|
-
* ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
|
|
32
|
-
*
|
|
33
|
-
* @param {string} input
|
|
34
|
-
*/ function* splitByTopLevelCommas(input) {
|
|
35
|
-
SPECIALS.lastIndex = -1;
|
|
36
|
-
let depth = 0;
|
|
37
|
-
let lastIndex = 0;
|
|
38
|
-
let found = false;
|
|
39
|
-
// Find all parens & commas
|
|
40
|
-
// And only split on commas if they're top-level
|
|
41
|
-
for (let match of input.matchAll(SPECIALS)){
|
|
42
|
-
if (match[0] === "(") depth++;
|
|
43
|
-
if (match[0] === ")") depth--;
|
|
44
|
-
if (match[0] === "," && depth === 0) {
|
|
45
|
-
found = true;
|
|
46
|
-
yield input.substring(lastIndex, match.index);
|
|
47
|
-
lastIndex = match.index + match[0].length;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Provide the last segment of the string if available
|
|
51
|
-
// Otherwise the whole string since no commas were found
|
|
52
|
-
// This mirrors the behavior of string.split()
|
|
53
|
-
if (found) {
|
|
54
|
-
yield input.substring(lastIndex);
|
|
55
|
-
} else {
|
|
56
|
-
yield input;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
26
|
function parseBoxShadowValue(input) {
|
|
60
|
-
let shadows =
|
|
27
|
+
let shadows = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, ",");
|
|
61
28
|
return shadows.map((shadow)=>{
|
|
62
29
|
let value = shadow.trim();
|
|
63
30
|
let result = {
|