tailwindcss 0.0.0-insiders.fe08e91 → 0.0.0-oxide.6bf5e56
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 +379 -3
- package/LICENSE +1 -2
- package/README.md +12 -8
- 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 +367 -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 +13 -0
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +107 -611
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +6 -3
- package/lib/corePlugins.js +2064 -1811
- package/lib/css/preflight.css +5 -5
- package/lib/featureFlags.js +31 -22
- package/lib/index.js +28 -10
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +27 -9
- package/lib/lib/collapseDuplicateDeclarations.js +12 -9
- package/lib/lib/content.js +176 -0
- package/lib/lib/defaultExtractor.js +225 -31
- package/lib/lib/detectNesting.js +13 -10
- package/lib/lib/evaluateTailwindFunctions.js +118 -55
- package/lib/lib/expandApplyAtRules.js +439 -190
- package/lib/lib/expandTailwindAtRules.js +151 -134
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +454 -187
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +36 -32
- package/lib/lib/offsets.js +217 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +89 -67
- package/lib/lib/setupContextUtils.js +667 -376
- package/lib/lib/setupTrackingContext.js +38 -67
- package/lib/lib/sharedState.js +27 -14
- package/lib/lib/substituteScreenAtRules.js +11 -9
- package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +19 -0
- package/lib/postcss-plugins/nesting/plugin.js +87 -0
- package/lib/processTailwindFeatures.js +35 -25
- 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 -6
- package/lib/util/createUtilityPlugin.js +12 -14
- package/lib/util/dataTypes.js +119 -110
- package/lib/util/defaults.js +4 -1
- package/lib/util/escapeClassName.js +7 -4
- package/lib/util/escapeCommas.js +5 -2
- package/lib/util/flattenColorPalette.js +9 -12
- package/lib/util/formatVariantSelector.js +184 -85
- package/lib/util/getAllConfigs.js +27 -8
- 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 +23 -8
- package/lib/util/normalizeConfig.js +116 -72
- package/lib/util/normalizeScreens.js +120 -11
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +30 -23
- 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 +147 -50
- package/lib/util/prefixSelector.js +10 -8
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +97 -85
- package/lib/util/resolveConfigPath.js +11 -9
- 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 -3
- package/lib/util/toPath.js +20 -4
- package/lib/util/transformThemeValue.js +37 -29
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +23 -15
- package/nesting/index.js +2 -12
- package/package.json +47 -42
- package/peers/index.js +11381 -7950
- 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 +439 -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 +6 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +50 -629
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +532 -217
- package/src/css/preflight.css +5 -5
- package/src/featureFlags.js +15 -9
- 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 +212 -0
- package/src/lib/defaultExtractor.js +196 -33
- package/src/lib/evaluateTailwindFunctions.js +78 -7
- package/src/lib/expandApplyAtRules.js +482 -183
- package/src/lib/expandTailwindAtRules.js +106 -85
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +418 -129
- package/src/lib/normalizeTailwindDirectives.js +1 -0
- package/src/lib/offsets.js +270 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +51 -30
- package/src/lib/setupContextUtils.js +556 -208
- package/src/lib/setupTrackingContext.js +11 -48
- package/src/lib/sharedState.js +5 -0
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +8 -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 +29 -21
- package/src/util/formatVariantSelector.js +184 -61
- 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 +11 -3
- package/src/util/normalizeConfig.js +44 -6
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +4 -3
- 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 +7 -5
- 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 +23 -20
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +362 -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/nesting/plugin.js +0 -41
package/lib/util/negateValue.js
CHANGED
|
@@ -2,18 +2,33 @@
|
|
|
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: ()=>negateValue
|
|
8
|
+
});
|
|
9
|
+
function negateValue(value) {
|
|
7
10
|
value = `${value}`;
|
|
8
|
-
if (value ===
|
|
9
|
-
return
|
|
11
|
+
if (value === "0") {
|
|
12
|
+
return "0";
|
|
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,30 +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
|
-
|
|
21
|
+
}
|
|
22
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
23
|
+
return {
|
|
24
|
+
default: obj
|
|
12
25
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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];
|
|
24
40
|
}
|
|
25
41
|
}
|
|
26
|
-
newObj.default = obj;
|
|
27
|
-
return newObj;
|
|
28
42
|
}
|
|
43
|
+
newObj.default = obj;
|
|
44
|
+
if (cache) {
|
|
45
|
+
cache.set(obj, newObj);
|
|
46
|
+
}
|
|
47
|
+
return newObj;
|
|
29
48
|
}
|
|
30
49
|
function normalizeConfig(config) {
|
|
31
50
|
// Quick structure validation
|
|
@@ -52,45 +71,45 @@ function normalizeConfig(config) {
|
|
|
52
71
|
return false;
|
|
53
72
|
}
|
|
54
73
|
// `config.content` should be an object or an array
|
|
55
|
-
if (!Array.isArray(config.content) && !(typeof config.content ===
|
|
74
|
+
if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
|
|
56
75
|
return false;
|
|
57
76
|
}
|
|
58
77
|
// When `config.content` is an array, it should consist of FilePaths or RawFiles
|
|
59
78
|
if (Array.isArray(config.content)) {
|
|
60
79
|
return config.content.every((path)=>{
|
|
61
80
|
// `path` can be a string
|
|
62
|
-
if (typeof path ===
|
|
81
|
+
if (typeof path === "string") return true;
|
|
63
82
|
// `path` can be an object { raw: string, extension?: string }
|
|
64
83
|
// `raw` must be a string
|
|
65
|
-
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !==
|
|
84
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
66
85
|
// `extension` (if provided) should also be a string
|
|
67
|
-
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !==
|
|
86
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
68
87
|
return false;
|
|
69
88
|
}
|
|
70
89
|
return true;
|
|
71
90
|
});
|
|
72
91
|
}
|
|
73
92
|
// When `config.content` is an object
|
|
74
|
-
if (typeof config.content ===
|
|
75
|
-
// Only `files`, `extract
|
|
93
|
+
if (typeof config.content === "object" && config.content !== null) {
|
|
94
|
+
// Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
|
|
76
95
|
if (Object.keys(config.content).some((key)=>![
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
"files",
|
|
97
|
+
"relative",
|
|
98
|
+
"extract",
|
|
99
|
+
"transform"
|
|
100
|
+
].includes(key))) {
|
|
82
101
|
return false;
|
|
83
102
|
}
|
|
84
103
|
// `config.content.files` should exist of FilePaths or RawFiles
|
|
85
104
|
if (Array.isArray(config.content.files)) {
|
|
86
105
|
if (!config.content.files.every((path)=>{
|
|
87
106
|
// `path` can be a string
|
|
88
|
-
if (typeof path ===
|
|
107
|
+
if (typeof path === "string") return true;
|
|
89
108
|
// `path` can be an object { raw: string, extension?: string }
|
|
90
109
|
// `raw` must be a string
|
|
91
|
-
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !==
|
|
110
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
92
111
|
// `extension` (if provided) should also be a string
|
|
93
|
-
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !==
|
|
112
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
94
113
|
return false;
|
|
95
114
|
}
|
|
96
115
|
return true;
|
|
@@ -98,23 +117,27 @@ function normalizeConfig(config) {
|
|
|
98
117
|
return false;
|
|
99
118
|
}
|
|
100
119
|
// `config.content.extract` is optional, and can be a Function or a Record<String, Function>
|
|
101
|
-
if (typeof config.content.extract ===
|
|
120
|
+
if (typeof config.content.extract === "object") {
|
|
102
121
|
for (let value of Object.values(config.content.extract)){
|
|
103
|
-
if (typeof value !==
|
|
122
|
+
if (typeof value !== "function") {
|
|
104
123
|
return false;
|
|
105
124
|
}
|
|
106
125
|
}
|
|
107
|
-
} else if (!(config.content.extract === undefined || typeof config.content.extract ===
|
|
126
|
+
} else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
|
|
108
127
|
return false;
|
|
109
128
|
}
|
|
110
129
|
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
|
111
|
-
if (typeof config.content.transform ===
|
|
112
|
-
for (let
|
|
113
|
-
if (typeof
|
|
130
|
+
if (typeof config.content.transform === "object") {
|
|
131
|
+
for (let value1 of Object.values(config.content.transform)){
|
|
132
|
+
if (typeof value1 !== "function") {
|
|
114
133
|
return false;
|
|
115
134
|
}
|
|
116
135
|
}
|
|
117
|
-
} else if (!(config.content.transform === undefined || typeof config.content.transform ===
|
|
136
|
+
} else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
// `config.content.relative` is optional and can be a boolean
|
|
140
|
+
if (typeof config.content.relative !== "boolean" && typeof config.content.relative !== "undefined") {
|
|
118
141
|
return false;
|
|
119
142
|
}
|
|
120
143
|
}
|
|
@@ -123,9 +146,10 @@ function normalizeConfig(config) {
|
|
|
123
146
|
return false;
|
|
124
147
|
})();
|
|
125
148
|
if (!valid) {
|
|
126
|
-
_log.default.warn(
|
|
127
|
-
|
|
128
|
-
|
|
149
|
+
_log.default.warn("purge-deprecation", [
|
|
150
|
+
"The `purge`/`content` options have changed in Tailwind CSS v3.0.",
|
|
151
|
+
"Update your configuration file to eliminate this warning.",
|
|
152
|
+
"https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
|
|
129
153
|
]);
|
|
130
154
|
}
|
|
131
155
|
// Normalize the `safelist`
|
|
@@ -138,19 +162,43 @@ function normalizeConfig(config) {
|
|
|
138
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;
|
|
139
163
|
return [];
|
|
140
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
|
+
})();
|
|
141
179
|
// Normalize prefix option
|
|
142
|
-
if (typeof config.prefix ===
|
|
143
|
-
_log.default.warn(
|
|
144
|
-
|
|
145
|
-
|
|
180
|
+
if (typeof config.prefix === "function") {
|
|
181
|
+
_log.default.warn("prefix-function", [
|
|
182
|
+
"As of Tailwind CSS v3.0, `prefix` cannot be a function.",
|
|
183
|
+
"Update `prefix` in your configuration to be a string to eliminate this warning.",
|
|
184
|
+
"https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
|
|
146
185
|
]);
|
|
147
|
-
config.prefix =
|
|
186
|
+
config.prefix = "";
|
|
148
187
|
} else {
|
|
149
188
|
var _prefix;
|
|
150
|
-
config.prefix = (_prefix = config.prefix) !== null && _prefix !== void 0 ? _prefix :
|
|
189
|
+
config.prefix = (_prefix = config.prefix) !== null && _prefix !== void 0 ? _prefix : "";
|
|
151
190
|
}
|
|
152
191
|
// Normalize the `content`
|
|
153
192
|
config.content = {
|
|
193
|
+
relative: (()=>{
|
|
194
|
+
var ref;
|
|
195
|
+
let { content } = config;
|
|
196
|
+
if (content === null || content === void 0 ? void 0 : content.relative) {
|
|
197
|
+
return content.relative;
|
|
198
|
+
}
|
|
199
|
+
var ref1;
|
|
200
|
+
return (ref1 = (ref = config.future) === null || ref === void 0 ? void 0 : ref.relativeContentPathsByDefault) !== null && ref1 !== void 0 ? ref1 : false;
|
|
201
|
+
})(),
|
|
154
202
|
files: (()=>{
|
|
155
203
|
let { content , purge } = config;
|
|
156
204
|
if (Array.isArray(purge)) return purge;
|
|
@@ -169,17 +217,15 @@ function normalizeConfig(config) {
|
|
|
169
217
|
if ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.extract) === null || ref5 === void 0 ? void 0 : ref5.DEFAULT) return config.content.extract.DEFAULT;
|
|
170
218
|
if ((ref6 = config.purge) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.options) === null || ref7 === void 0 ? void 0 : ref7.extractors) return config.purge.options.extractors;
|
|
171
219
|
if ((ref8 = config.content) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.options) === null || ref9 === void 0 ? void 0 : ref9.extractors) return config.content.options.extractors;
|
|
172
|
-
return {
|
|
173
|
-
};
|
|
220
|
+
return {};
|
|
174
221
|
})();
|
|
175
|
-
let extractors = {
|
|
176
|
-
};
|
|
222
|
+
let extractors = {};
|
|
177
223
|
let defaultExtractor = (()=>{
|
|
178
|
-
var ref,
|
|
179
|
-
if ((ref = config.purge) === null || ref === void 0 ? void 0 : (
|
|
224
|
+
var ref, ref1, ref2, ref3;
|
|
225
|
+
if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref1 = ref.options) === null || ref1 === void 0 ? void 0 : ref1.defaultExtractor) {
|
|
180
226
|
return config.purge.options.defaultExtractor;
|
|
181
227
|
}
|
|
182
|
-
if ((
|
|
228
|
+
if ((ref2 = config.content) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.options) === null || ref3 === void 0 ? void 0 : ref3.defaultExtractor) {
|
|
183
229
|
return config.content.options.defaultExtractor;
|
|
184
230
|
}
|
|
185
231
|
return undefined;
|
|
@@ -188,7 +234,7 @@ function normalizeConfig(config) {
|
|
|
188
234
|
extractors.DEFAULT = defaultExtractor;
|
|
189
235
|
}
|
|
190
236
|
// Functions
|
|
191
|
-
if (typeof extract ===
|
|
237
|
+
if (typeof extract === "function") {
|
|
192
238
|
extractors.DEFAULT = extract;
|
|
193
239
|
} else if (Array.isArray(extract)) {
|
|
194
240
|
for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
|
|
@@ -196,27 +242,25 @@ function normalizeConfig(config) {
|
|
|
196
242
|
extractors[extension] = extractor;
|
|
197
243
|
}
|
|
198
244
|
}
|
|
199
|
-
} else if (typeof extract ===
|
|
245
|
+
} else if (typeof extract === "object" && extract !== null) {
|
|
200
246
|
Object.assign(extractors, extract);
|
|
201
247
|
}
|
|
202
248
|
return extractors;
|
|
203
249
|
})(),
|
|
204
250
|
transform: (()=>{
|
|
205
251
|
let transform = (()=>{
|
|
206
|
-
var ref,
|
|
252
|
+
var ref, ref1, ref2, ref3, ref4, ref5;
|
|
207
253
|
if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.transform) return config.purge.transform;
|
|
208
|
-
if ((
|
|
209
|
-
if ((
|
|
210
|
-
if ((
|
|
211
|
-
return {
|
|
212
|
-
};
|
|
254
|
+
if ((ref1 = config.content) === null || ref1 === void 0 ? void 0 : ref1.transform) return config.content.transform;
|
|
255
|
+
if ((ref2 = config.purge) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.transform) === null || ref3 === void 0 ? void 0 : ref3.DEFAULT) return config.purge.transform.DEFAULT;
|
|
256
|
+
if ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.transform) === null || ref5 === void 0 ? void 0 : ref5.DEFAULT) return config.content.transform.DEFAULT;
|
|
257
|
+
return {};
|
|
213
258
|
})();
|
|
214
|
-
let transformers = {
|
|
215
|
-
|
|
216
|
-
if (typeof transform === 'function') {
|
|
259
|
+
let transformers = {};
|
|
260
|
+
if (typeof transform === "function") {
|
|
217
261
|
transformers.DEFAULT = transform;
|
|
218
262
|
}
|
|
219
|
-
if (typeof transform ===
|
|
263
|
+
if (typeof transform === "object" && transform !== null) {
|
|
220
264
|
Object.assign(transformers, transform);
|
|
221
265
|
}
|
|
222
266
|
return transformers;
|
|
@@ -225,10 +269,10 @@ function normalizeConfig(config) {
|
|
|
225
269
|
// Validate globs to prevent bogus globs.
|
|
226
270
|
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
|
227
271
|
for (let file of config.content.files){
|
|
228
|
-
if (typeof file ===
|
|
229
|
-
_log.default.warn(
|
|
230
|
-
`The glob pattern ${(0, _log
|
|
231
|
-
`
|
|
272
|
+
if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
|
|
273
|
+
_log.default.warn("invalid-glob-braces", [
|
|
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.`
|
|
232
276
|
]);
|
|
233
277
|
break;
|
|
234
278
|
}
|
|
@@ -1,17 +1,53 @@
|
|
|
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)=>{
|
|
9
44
|
if (root && Array.isArray(screen)) {
|
|
10
|
-
throw new Error(
|
|
45
|
+
throw new Error("The tuple syntax is not supported for `screens`.");
|
|
11
46
|
}
|
|
12
|
-
if (typeof screen ===
|
|
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,
|
|
@@ -22,9 +58,10 @@ function normalizeScreens(screens, root = true) {
|
|
|
22
58
|
}
|
|
23
59
|
let [name, options] = screen;
|
|
24
60
|
name = name.toString();
|
|
25
|
-
if (typeof options ===
|
|
61
|
+
if (typeof options === "string") {
|
|
26
62
|
return {
|
|
27
63
|
name,
|
|
64
|
+
not: false,
|
|
28
65
|
values: [
|
|
29
66
|
{
|
|
30
67
|
min: options,
|
|
@@ -36,23 +73,95 @@ 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
|
]
|
|
48
86
|
};
|
|
49
87
|
});
|
|
50
88
|
}
|
|
51
|
-
return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {
|
|
52
|
-
|
|
89
|
+
return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
|
|
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
|
+
};
|
|
53
163
|
}
|
|
54
|
-
function resolveValue({
|
|
55
|
-
}) {
|
|
164
|
+
function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } = {}) {
|
|
56
165
|
return {
|
|
57
166
|
min,
|
|
58
167
|
max,
|
|
@@ -2,38 +2,41 @@
|
|
|
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
|
+
});
|
|
6
9
|
const DIRECTIONS = new Set([
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
"normal",
|
|
11
|
+
"reverse",
|
|
12
|
+
"alternate",
|
|
13
|
+
"alternate-reverse"
|
|
11
14
|
]);
|
|
12
15
|
const PLAY_STATES = new Set([
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
"running",
|
|
17
|
+
"paused"
|
|
15
18
|
]);
|
|
16
19
|
const FILL_MODES = new Set([
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
"none",
|
|
21
|
+
"forwards",
|
|
22
|
+
"backwards",
|
|
23
|
+
"both"
|
|
21
24
|
]);
|
|
22
25
|
const ITERATION_COUNTS = new Set([
|
|
23
|
-
|
|
26
|
+
"infinite"
|
|
24
27
|
]);
|
|
25
28
|
const TIMINGS = new Set([
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
"linear",
|
|
30
|
+
"ease",
|
|
31
|
+
"ease-in",
|
|
32
|
+
"ease-out",
|
|
33
|
+
"ease-in-out",
|
|
34
|
+
"step-start",
|
|
35
|
+
"step-end"
|
|
33
36
|
]);
|
|
34
37
|
const TIMING_FNS = [
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
"cubic-bezier",
|
|
39
|
+
"steps"
|
|
37
40
|
];
|
|
38
41
|
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
39
42
|
;
|
|
@@ -51,34 +54,33 @@ function parseAnimationValue(input) {
|
|
|
51
54
|
let parts = value.split(SPACE);
|
|
52
55
|
let seen = new Set();
|
|
53
56
|
for (let part of parts){
|
|
54
|
-
if (!seen.has(
|
|
57
|
+
if (!seen.has("DIRECTIONS") && DIRECTIONS.has(part)) {
|
|
55
58
|
result.direction = part;
|
|
56
|
-
seen.add(
|
|
57
|
-
} else if (!seen.has(
|
|
59
|
+
seen.add("DIRECTIONS");
|
|
60
|
+
} else if (!seen.has("PLAY_STATES") && PLAY_STATES.has(part)) {
|
|
58
61
|
result.playState = part;
|
|
59
|
-
seen.add(
|
|
60
|
-
} else if (!seen.has(
|
|
62
|
+
seen.add("PLAY_STATES");
|
|
63
|
+
} else if (!seen.has("FILL_MODES") && FILL_MODES.has(part)) {
|
|
61
64
|
result.fillMode = part;
|
|
62
|
-
seen.add(
|
|
63
|
-
} else if (!seen.has(
|
|
65
|
+
seen.add("FILL_MODES");
|
|
66
|
+
} else if (!seen.has("ITERATION_COUNTS") && (ITERATION_COUNTS.has(part) || DIGIT.test(part))) {
|
|
64
67
|
result.iterationCount = part;
|
|
65
|
-
seen.add(
|
|
66
|
-
} else if (!seen.has(
|
|
68
|
+
seen.add("ITERATION_COUNTS");
|
|
69
|
+
} else if (!seen.has("TIMING_FUNCTION") && TIMINGS.has(part)) {
|
|
67
70
|
result.timingFunction = part;
|
|
68
|
-
seen.add(
|
|
69
|
-
} else if (!seen.has(
|
|
70
|
-
)) {
|
|
71
|
+
seen.add("TIMING_FUNCTION");
|
|
72
|
+
} else if (!seen.has("TIMING_FUNCTION") && TIMING_FNS.some((f)=>part.startsWith(`${f}(`))) {
|
|
71
73
|
result.timingFunction = part;
|
|
72
|
-
seen.add(
|
|
73
|
-
} else if (!seen.has(
|
|
74
|
+
seen.add("TIMING_FUNCTION");
|
|
75
|
+
} else if (!seen.has("DURATION") && TIME.test(part)) {
|
|
74
76
|
result.duration = part;
|
|
75
|
-
seen.add(
|
|
76
|
-
} else if (!seen.has(
|
|
77
|
+
seen.add("DURATION");
|
|
78
|
+
} else if (!seen.has("DELAY") && TIME.test(part)) {
|
|
77
79
|
result.delay = part;
|
|
78
|
-
seen.add(
|
|
79
|
-
} else if (!seen.has(
|
|
80
|
+
seen.add("DELAY");
|
|
81
|
+
} else if (!seen.has("NAME")) {
|
|
80
82
|
result.name = part;
|
|
81
|
-
seen.add(
|
|
83
|
+
seen.add("NAME");
|
|
82
84
|
} else {
|
|
83
85
|
if (!result.unknown) result.unknown = [];
|
|
84
86
|
result.unknown.push(part);
|