tailwindcss 0.0.0-insiders.fda68f7 → 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 +603 -2
- package/LICENSE +1 -2
- package/README.md +14 -6
- package/colors.d.ts +3 -0
- package/colors.js +2 -304
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -4
- package/defaultTheme.d.ts +4 -0
- package/defaultTheme.js +2 -4
- 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 +22 -14
- package/lib/cli.js +217 -743
- package/lib/constants.js +41 -34
- package/lib/corePluginList.js +178 -5
- package/lib/corePlugins.js +3879 -2941
- package/lib/css/preflight.css +22 -9
- package/lib/featureFlags.js +61 -50
- package/lib/index.js +45 -28
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +52 -36
- package/lib/lib/collapseDuplicateDeclarations.js +83 -0
- package/lib/lib/content.js +176 -0
- package/lib/lib/defaultExtractor.js +236 -0
- package/lib/lib/detectNesting.js +37 -0
- package/lib/lib/evaluateTailwindFunctions.js +203 -161
- package/lib/lib/expandApplyAtRules.js +502 -221
- package/lib/lib/expandTailwindAtRules.js +258 -243
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +775 -320
- package/lib/lib/getModuleDependencies.js +44 -46
- package/lib/lib/normalizeTailwindDirectives.js +79 -60
- 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 +150 -94
- package/lib/lib/setupContextUtils.js +1146 -599
- package/lib/lib/setupTrackingContext.js +129 -177
- package/lib/lib/sharedState.js +53 -21
- package/lib/lib/substituteScreenAtRules.js +26 -28
- 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 +58 -53
- package/lib/public/colors.js +331 -0
- package/lib/public/create-plugin.js +15 -0
- package/lib/public/default-config.js +16 -0
- package/lib/public/default-theme.js +16 -0
- package/lib/public/resolve-config.js +22 -0
- package/lib/util/bigSign.js +7 -6
- package/lib/util/buildMediaQuery.js +21 -32
- package/lib/util/cloneDeep.js +16 -14
- package/lib/util/cloneNodes.js +29 -15
- package/lib/util/color.js +90 -66
- package/lib/util/configurePlugins.js +17 -15
- package/lib/util/createPlugin.js +23 -26
- package/lib/util/createUtilityPlugin.js +46 -46
- package/lib/util/dataTypes.js +242 -0
- package/lib/util/defaults.js +20 -15
- package/lib/util/escapeClassName.js +18 -17
- package/lib/util/escapeCommas.js +7 -6
- package/lib/util/flattenColorPalette.js +13 -12
- package/lib/util/formatVariantSelector.js +285 -0
- package/lib/util/getAllConfigs.js +44 -18
- package/lib/util/hashConfig.js +15 -12
- package/lib/util/isKeyframeRule.js +7 -6
- package/lib/util/isPlainObject.js +11 -11
- package/lib/util/isSyntacticallyValidPropertyValue.js +72 -0
- package/lib/util/log.js +52 -33
- package/lib/util/nameClass.js +37 -26
- package/lib/util/negateValue.js +31 -17
- package/lib/util/normalizeConfig.js +281 -0
- package/lib/util/normalizeScreens.js +170 -0
- package/lib/util/parseAnimationValue.js +85 -54
- package/lib/util/parseBoxShadowValue.js +84 -0
- package/lib/util/parseDependency.js +41 -70
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +30 -24
- package/lib/util/pluginUtils.js +252 -287
- package/lib/util/prefixSelector.js +20 -20
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +221 -256
- package/lib/util/resolveConfigPath.js +43 -48
- package/lib/util/responsive.js +18 -14
- package/lib/util/splitAtTopLevelOnly.js +43 -0
- package/lib/util/tap.js +8 -7
- package/lib/util/toColorValue.js +7 -6
- package/lib/util/toPath.js +27 -8
- package/lib/util/transformThemeValue.js +67 -28
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +67 -57
- package/nesting/index.js +2 -12
- package/package.json +60 -65
- package/peers/index.js +76445 -84221
- package/plugin.d.ts +11 -0
- package/plugin.js +1 -2
- package/resolveConfig.d.ts +12 -0
- package/resolveConfig.js +2 -7
- package/scripts/create-plugin-list.js +2 -2
- 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 -575
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +2405 -1948
- package/src/css/preflight.css +22 -9
- package/src/featureFlags.js +26 -10
- package/src/index.js +19 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +93 -0
- package/src/lib/content.js +212 -0
- package/src/lib/defaultExtractor.js +211 -0
- package/src/lib/detectNesting.js +39 -0
- package/src/lib/evaluateTailwindFunctions.js +84 -10
- package/src/lib/expandApplyAtRules.js +508 -153
- package/src/lib/expandTailwindAtRules.js +130 -104
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +596 -70
- package/src/lib/normalizeTailwindDirectives.js +10 -3
- 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 +105 -47
- package/src/lib/setupContextUtils.js +828 -196
- package/src/lib/setupTrackingContext.js +19 -54
- package/src/lib/sharedState.js +45 -7
- package/src/lib/substituteScreenAtRules.js +6 -3
- 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 +19 -2
- package/src/public/colors.js +300 -0
- package/src/public/create-plugin.js +2 -0
- package/src/public/default-config.js +4 -0
- package/src/public/default-theme.js +4 -0
- package/src/public/resolve-config.js +7 -0
- package/src/util/buildMediaQuery.js +14 -16
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +31 -14
- package/src/util/createUtilityPlugin.js +2 -11
- package/src/util/dataTypes.js +256 -0
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +319 -0
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/isSyntacticallyValidPropertyValue.js +61 -0
- package/src/util/log.js +23 -22
- package/src/util/nameClass.js +14 -6
- package/src/util/negateValue.js +15 -5
- package/src/util/normalizeConfig.js +300 -0
- package/src/util/normalizeScreens.js +140 -0
- package/src/util/parseAnimationValue.js +7 -1
- package/src/util/parseBoxShadowValue.js +72 -0
- package/src/util/parseDependency.js +37 -38
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +216 -197
- package/src/util/prefixSelector.js +7 -8
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +86 -91
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +33 -8
- package/src/util/validateConfig.js +13 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +14 -9
- package/stubs/defaultConfig.stub.js +186 -117
- package/stubs/simpleConfig.stub.js +1 -1
- 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/lib/lib/setupWatchingContext.js +0 -331
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -306
package/lib/util/nameClass.js
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
asClass: ()=>asClass,
|
|
13
|
+
default: ()=>nameClass,
|
|
14
|
+
formatClass: ()=>formatClass
|
|
15
|
+
});
|
|
16
|
+
const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("./escapeClassName"));
|
|
17
|
+
const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
|
|
18
|
+
function _interopRequireDefault(obj) {
|
|
19
|
+
return obj && obj.__esModule ? obj : {
|
|
20
|
+
default: obj
|
|
21
|
+
};
|
|
22
|
+
}
|
|
14
23
|
function asClass(name) {
|
|
15
|
-
|
|
24
|
+
return (0, _escapeCommas.default)(`.${(0, _escapeClassName.default)(name)}`);
|
|
16
25
|
}
|
|
17
|
-
|
|
18
26
|
function nameClass(classPrefix, key) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
27
|
+
return asClass(formatClass(classPrefix, key));
|
|
28
|
+
}
|
|
29
|
+
function formatClass(classPrefix, key) {
|
|
30
|
+
if (key === "DEFAULT") {
|
|
31
|
+
return classPrefix;
|
|
32
|
+
}
|
|
33
|
+
if (key === "-" || key === "-DEFAULT") {
|
|
34
|
+
return `-${classPrefix}`;
|
|
35
|
+
}
|
|
36
|
+
if (key.startsWith("-")) {
|
|
37
|
+
return `-${classPrefix}${key}`;
|
|
38
|
+
}
|
|
39
|
+
if (key.startsWith("/")) {
|
|
40
|
+
return `${classPrefix}${key}`;
|
|
41
|
+
}
|
|
42
|
+
return `${classPrefix}-${key}`;
|
|
43
|
+
}
|
package/lib/util/negateValue.js
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>negateValue
|
|
8
|
+
});
|
|
9
|
+
function negateValue(value) {
|
|
10
|
+
value = `${value}`;
|
|
11
|
+
if (value === "0") {
|
|
12
|
+
return "0";
|
|
13
|
+
}
|
|
14
|
+
// Flip sign of numbers
|
|
15
|
+
if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
|
|
16
|
+
return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
|
|
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
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
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) {
|
|
20
|
+
return obj;
|
|
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];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
newObj.default = obj;
|
|
44
|
+
if (cache) {
|
|
45
|
+
cache.set(obj, newObj);
|
|
46
|
+
}
|
|
47
|
+
return newObj;
|
|
48
|
+
}
|
|
49
|
+
function normalizeConfig(config) {
|
|
50
|
+
// Quick structure validation
|
|
51
|
+
/**
|
|
52
|
+
* type FilePath = string
|
|
53
|
+
* type RawFile = { raw: string, extension?: string }
|
|
54
|
+
* type ExtractorFn = (content: string) => Array<string>
|
|
55
|
+
* type TransformerFn = (content: string) => string
|
|
56
|
+
*
|
|
57
|
+
* type Content =
|
|
58
|
+
* | Array<FilePath | RawFile>
|
|
59
|
+
* | {
|
|
60
|
+
* files: Array<FilePath | RawFile>,
|
|
61
|
+
* extract?: ExtractorFn | { [extension: string]: ExtractorFn }
|
|
62
|
+
* transform?: TransformerFn | { [extension: string]: TransformerFn }
|
|
63
|
+
* }
|
|
64
|
+
*/ let valid = (()=>{
|
|
65
|
+
// `config.purge` should not exist anymore
|
|
66
|
+
if (config.purge) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
// `config.content` should exist
|
|
70
|
+
if (!config.content) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
// `config.content` should be an object or an array
|
|
74
|
+
if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
// When `config.content` is an array, it should consist of FilePaths or RawFiles
|
|
78
|
+
if (Array.isArray(config.content)) {
|
|
79
|
+
return config.content.every((path)=>{
|
|
80
|
+
// `path` can be a string
|
|
81
|
+
if (typeof path === "string") return true;
|
|
82
|
+
// `path` can be an object { raw: string, extension?: string }
|
|
83
|
+
// `raw` must be a string
|
|
84
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
85
|
+
// `extension` (if provided) should also be a string
|
|
86
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// When `config.content` is an object
|
|
93
|
+
if (typeof config.content === "object" && config.content !== null) {
|
|
94
|
+
// Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
|
|
95
|
+
if (Object.keys(config.content).some((key)=>![
|
|
96
|
+
"files",
|
|
97
|
+
"relative",
|
|
98
|
+
"extract",
|
|
99
|
+
"transform"
|
|
100
|
+
].includes(key))) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
// `config.content.files` should exist of FilePaths or RawFiles
|
|
104
|
+
if (Array.isArray(config.content.files)) {
|
|
105
|
+
if (!config.content.files.every((path)=>{
|
|
106
|
+
// `path` can be a string
|
|
107
|
+
if (typeof path === "string") return true;
|
|
108
|
+
// `path` can be an object { raw: string, extension?: string }
|
|
109
|
+
// `raw` must be a string
|
|
110
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
111
|
+
// `extension` (if provided) should also be a string
|
|
112
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
})) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
// `config.content.extract` is optional, and can be a Function or a Record<String, Function>
|
|
120
|
+
if (typeof config.content.extract === "object") {
|
|
121
|
+
for (let value of Object.values(config.content.extract)){
|
|
122
|
+
if (typeof value !== "function") {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
|
130
|
+
if (typeof config.content.transform === "object") {
|
|
131
|
+
for (let value1 of Object.values(config.content.transform)){
|
|
132
|
+
if (typeof value1 !== "function") {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
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") {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
})();
|
|
148
|
+
if (!valid) {
|
|
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"
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
// Normalize the `safelist`
|
|
156
|
+
config.safelist = (()=>{
|
|
157
|
+
var ref;
|
|
158
|
+
let { content , purge , safelist } = config;
|
|
159
|
+
if (Array.isArray(safelist)) return safelist;
|
|
160
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
|
|
161
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
|
|
162
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : (ref = purge.options) === null || ref === void 0 ? void 0 : ref.safelist)) return purge.options.safelist;
|
|
163
|
+
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
|
+
}
|
|
177
|
+
return [];
|
|
178
|
+
})();
|
|
179
|
+
// Normalize prefix option
|
|
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"
|
|
185
|
+
]);
|
|
186
|
+
config.prefix = "";
|
|
187
|
+
} else {
|
|
188
|
+
var _prefix;
|
|
189
|
+
config.prefix = (_prefix = config.prefix) !== null && _prefix !== void 0 ? _prefix : "";
|
|
190
|
+
}
|
|
191
|
+
// Normalize the `content`
|
|
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
|
+
})(),
|
|
202
|
+
files: (()=>{
|
|
203
|
+
let { content , purge } = config;
|
|
204
|
+
if (Array.isArray(purge)) return purge;
|
|
205
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
|
|
206
|
+
if (Array.isArray(content)) return content;
|
|
207
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
|
|
208
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
|
|
209
|
+
return [];
|
|
210
|
+
})(),
|
|
211
|
+
extract: (()=>{
|
|
212
|
+
let extract = (()=>{
|
|
213
|
+
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9;
|
|
214
|
+
if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.extract) return config.purge.extract;
|
|
215
|
+
if ((ref1 = config.content) === null || ref1 === void 0 ? void 0 : ref1.extract) return config.content.extract;
|
|
216
|
+
if ((ref2 = config.purge) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.extract) === null || ref3 === void 0 ? void 0 : ref3.DEFAULT) return config.purge.extract.DEFAULT;
|
|
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;
|
|
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;
|
|
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;
|
|
220
|
+
return {};
|
|
221
|
+
})();
|
|
222
|
+
let extractors = {};
|
|
223
|
+
let defaultExtractor = (()=>{
|
|
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) {
|
|
226
|
+
return config.purge.options.defaultExtractor;
|
|
227
|
+
}
|
|
228
|
+
if ((ref2 = config.content) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.options) === null || ref3 === void 0 ? void 0 : ref3.defaultExtractor) {
|
|
229
|
+
return config.content.options.defaultExtractor;
|
|
230
|
+
}
|
|
231
|
+
return undefined;
|
|
232
|
+
})();
|
|
233
|
+
if (defaultExtractor !== undefined) {
|
|
234
|
+
extractors.DEFAULT = defaultExtractor;
|
|
235
|
+
}
|
|
236
|
+
// Functions
|
|
237
|
+
if (typeof extract === "function") {
|
|
238
|
+
extractors.DEFAULT = extract;
|
|
239
|
+
} else if (Array.isArray(extract)) {
|
|
240
|
+
for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
|
|
241
|
+
for (let extension of extensions){
|
|
242
|
+
extractors[extension] = extractor;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
} else if (typeof extract === "object" && extract !== null) {
|
|
246
|
+
Object.assign(extractors, extract);
|
|
247
|
+
}
|
|
248
|
+
return extractors;
|
|
249
|
+
})(),
|
|
250
|
+
transform: (()=>{
|
|
251
|
+
let transform = (()=>{
|
|
252
|
+
var ref, ref1, ref2, ref3, ref4, ref5;
|
|
253
|
+
if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.transform) return config.purge.transform;
|
|
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 {};
|
|
258
|
+
})();
|
|
259
|
+
let transformers = {};
|
|
260
|
+
if (typeof transform === "function") {
|
|
261
|
+
transformers.DEFAULT = transform;
|
|
262
|
+
}
|
|
263
|
+
if (typeof transform === "object" && transform !== null) {
|
|
264
|
+
Object.assign(transformers, transform);
|
|
265
|
+
}
|
|
266
|
+
return transformers;
|
|
267
|
+
})()
|
|
268
|
+
};
|
|
269
|
+
// Validate globs to prevent bogus globs.
|
|
270
|
+
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
|
271
|
+
for (let file of config.content.files){
|
|
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.`
|
|
276
|
+
]);
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return config;
|
|
281
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
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";
|
|
26
|
+
Object.defineProperty(exports, "__esModule", {
|
|
27
|
+
value: true
|
|
28
|
+
});
|
|
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
|
+
});
|
|
41
|
+
function normalizeScreens(screens, root = true) {
|
|
42
|
+
if (Array.isArray(screens)) {
|
|
43
|
+
return screens.map((screen)=>{
|
|
44
|
+
if (root && Array.isArray(screen)) {
|
|
45
|
+
throw new Error("The tuple syntax is not supported for `screens`.");
|
|
46
|
+
}
|
|
47
|
+
if (typeof screen === "string") {
|
|
48
|
+
return {
|
|
49
|
+
name: screen.toString(),
|
|
50
|
+
not: false,
|
|
51
|
+
values: [
|
|
52
|
+
{
|
|
53
|
+
min: screen,
|
|
54
|
+
max: undefined
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
let [name, options] = screen;
|
|
60
|
+
name = name.toString();
|
|
61
|
+
if (typeof options === "string") {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
not: false,
|
|
65
|
+
values: [
|
|
66
|
+
{
|
|
67
|
+
min: options,
|
|
68
|
+
max: undefined
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (Array.isArray(options)) {
|
|
74
|
+
return {
|
|
75
|
+
name,
|
|
76
|
+
not: false,
|
|
77
|
+
values: options.map((option)=>resolveValue(option))
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
name,
|
|
82
|
+
not: false,
|
|
83
|
+
values: [
|
|
84
|
+
resolveValue(options)
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
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
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } = {}) {
|
|
165
|
+
return {
|
|
166
|
+
min,
|
|
167
|
+
max,
|
|
168
|
+
raw
|
|
169
|
+
};
|
|
170
|
+
}
|