tailwindcss 0.0.0-insiders.4e21639 → 0.0.0-insiders.4e62334
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 +435 -3
- package/LICENSE +1 -2
- package/README.md +13 -6
- package/colors.d.ts +3 -0
- package/colors.js +2 -1
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -1
- package/defaultTheme.d.ts +4 -0
- package/defaultTheme.js +2 -1
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +460 -259
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +9 -3
- package/lib/corePlugins.js +1840 -1753
- package/lib/css/preflight.css +8 -9
- package/lib/featureFlags.js +29 -20
- package/lib/index.js +22 -11
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +27 -9
- package/lib/lib/collapseDuplicateDeclarations.js +58 -4
- package/lib/lib/defaultExtractor.js +231 -0
- package/lib/lib/detectNesting.js +13 -10
- package/lib/lib/evaluateTailwindFunctions.js +119 -52
- package/lib/lib/expandApplyAtRules.js +440 -161
- package/lib/lib/expandTailwindAtRules.js +130 -128
- package/lib/lib/generateRules.js +410 -171
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +43 -32
- package/lib/lib/offsets.js +199 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +91 -55
- package/lib/lib/setupContextUtils.js +453 -347
- package/lib/lib/setupTrackingContext.js +52 -44
- package/lib/lib/sharedState.js +48 -9
- package/lib/lib/substituteScreenAtRules.js +13 -8
- 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 +36 -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 +16 -25
- package/lib/util/cloneDeep.js +7 -6
- package/lib/util/cloneNodes.js +21 -3
- package/lib/util/color.js +54 -40
- package/lib/util/configurePlugins.js +4 -1
- package/lib/util/createPlugin.js +6 -6
- package/lib/util/createUtilityPlugin.js +12 -14
- package/lib/util/dataTypes.js +119 -102
- package/lib/util/defaults.js +10 -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 +223 -40
- 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 +72 -0
- package/lib/util/log.js +22 -12
- package/lib/util/nameClass.js +17 -8
- package/lib/util/negateValue.js +22 -7
- package/lib/util/normalizeConfig.js +99 -54
- package/lib/util/normalizeScreens.js +73 -0
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +30 -23
- package/lib/util/parseDependency.js +18 -15
- package/lib/util/parseObjectStyles.js +10 -7
- package/lib/util/pluginUtils.js +51 -42
- package/lib/util/prefixSelector.js +10 -8
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +91 -66
- 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 +24 -3
- package/lib/util/transformThemeValue.js +37 -29
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/withAlphaVariable.js +23 -15
- package/nesting/index.js +2 -12
- package/package.json +43 -43
- package/peers/index.js +11543 -8114
- package/plugin.d.ts +11 -0
- package/plugin.js +2 -1
- package/resolveConfig.d.ts +3 -0
- package/resolveConfig.js +2 -1
- package/scripts/generate-types.js +105 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +293 -36
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +428 -285
- package/src/css/preflight.css +8 -9
- package/src/featureFlags.js +9 -5
- package/src/index.js +14 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +66 -1
- package/src/lib/defaultExtractor.js +208 -0
- package/src/lib/evaluateTailwindFunctions.js +84 -10
- package/src/lib/expandApplyAtRules.js +488 -153
- package/src/lib/expandTailwindAtRules.js +82 -80
- package/src/lib/generateRules.js +352 -120
- package/src/lib/normalizeTailwindDirectives.js +7 -1
- package/src/lib/offsets.js +239 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +59 -17
- package/src/lib/setupContextUtils.js +337 -174
- package/src/lib/setupTrackingContext.js +13 -8
- package/src/lib/sharedState.js +42 -4
- 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 +12 -2
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +31 -14
- package/src/util/dataTypes.js +28 -19
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +237 -23
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/log.js +11 -7
- package/src/util/nameClass.js +1 -1
- package/src/util/negateValue.js +10 -2
- package/src/util/normalizeConfig.js +16 -3
- package/src/util/normalizeScreens.js +45 -0
- package/src/util/parseBoxShadowValue.js +4 -3
- package/src/util/pluginUtils.js +14 -2
- package/src/util/prefixSelector.js +7 -5
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +71 -17
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +13 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +24 -3
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +334 -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 +331 -0
- package/types/index.d.ts +7 -0
- package/lib/lib/setupWatchingContext.js +0 -288
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -311
|
@@ -2,12 +2,49 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
11
48
|
}
|
|
12
49
|
function normalizeConfig(config) {
|
|
13
50
|
// Quick structure validation
|
|
@@ -34,45 +71,44 @@ function normalizeConfig(config) {
|
|
|
34
71
|
return false;
|
|
35
72
|
}
|
|
36
73
|
// `config.content` should be an object or an array
|
|
37
|
-
if (!Array.isArray(config.content) && !(typeof config.content ===
|
|
74
|
+
if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
|
|
38
75
|
return false;
|
|
39
76
|
}
|
|
40
77
|
// When `config.content` is an array, it should consist of FilePaths or RawFiles
|
|
41
78
|
if (Array.isArray(config.content)) {
|
|
42
79
|
return config.content.every((path)=>{
|
|
43
80
|
// `path` can be a string
|
|
44
|
-
if (typeof path ===
|
|
81
|
+
if (typeof path === "string") return true;
|
|
45
82
|
// `path` can be an object { raw: string, extension?: string }
|
|
46
83
|
// `raw` must be a string
|
|
47
|
-
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;
|
|
48
85
|
// `extension` (if provided) should also be a string
|
|
49
|
-
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") {
|
|
50
87
|
return false;
|
|
51
88
|
}
|
|
52
89
|
return true;
|
|
53
90
|
});
|
|
54
91
|
}
|
|
55
92
|
// When `config.content` is an object
|
|
56
|
-
if (typeof config.content ===
|
|
93
|
+
if (typeof config.content === "object" && config.content !== null) {
|
|
57
94
|
// Only `files`, `extract` and `transform` can exist in `config.content`
|
|
58
95
|
if (Object.keys(config.content).some((key)=>![
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
].includes(key)
|
|
63
|
-
)) {
|
|
96
|
+
"files",
|
|
97
|
+
"extract",
|
|
98
|
+
"transform"
|
|
99
|
+
].includes(key))) {
|
|
64
100
|
return false;
|
|
65
101
|
}
|
|
66
102
|
// `config.content.files` should exist of FilePaths or RawFiles
|
|
67
103
|
if (Array.isArray(config.content.files)) {
|
|
68
104
|
if (!config.content.files.every((path)=>{
|
|
69
105
|
// `path` can be a string
|
|
70
|
-
if (typeof path ===
|
|
106
|
+
if (typeof path === "string") return true;
|
|
71
107
|
// `path` can be an object { raw: string, extension?: string }
|
|
72
108
|
// `raw` must be a string
|
|
73
|
-
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !==
|
|
109
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
74
110
|
// `extension` (if provided) should also be a string
|
|
75
|
-
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !==
|
|
111
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
76
112
|
return false;
|
|
77
113
|
}
|
|
78
114
|
return true;
|
|
@@ -80,23 +116,23 @@ function normalizeConfig(config) {
|
|
|
80
116
|
return false;
|
|
81
117
|
}
|
|
82
118
|
// `config.content.extract` is optional, and can be a Function or a Record<String, Function>
|
|
83
|
-
if (typeof config.content.extract ===
|
|
119
|
+
if (typeof config.content.extract === "object") {
|
|
84
120
|
for (let value of Object.values(config.content.extract)){
|
|
85
|
-
if (typeof value !==
|
|
121
|
+
if (typeof value !== "function") {
|
|
86
122
|
return false;
|
|
87
123
|
}
|
|
88
124
|
}
|
|
89
|
-
} else if (!(config.content.extract === undefined || typeof config.content.extract ===
|
|
125
|
+
} else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
|
|
90
126
|
return false;
|
|
91
127
|
}
|
|
92
128
|
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
|
93
|
-
if (typeof config.content.transform ===
|
|
94
|
-
for (let
|
|
95
|
-
if (typeof
|
|
129
|
+
if (typeof config.content.transform === "object") {
|
|
130
|
+
for (let value1 of Object.values(config.content.transform)){
|
|
131
|
+
if (typeof value1 !== "function") {
|
|
96
132
|
return false;
|
|
97
133
|
}
|
|
98
134
|
}
|
|
99
|
-
} else if (!(config.content.transform === undefined || typeof config.content.transform ===
|
|
135
|
+
} else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
|
|
100
136
|
return false;
|
|
101
137
|
}
|
|
102
138
|
}
|
|
@@ -105,9 +141,10 @@ function normalizeConfig(config) {
|
|
|
105
141
|
return false;
|
|
106
142
|
})();
|
|
107
143
|
if (!valid) {
|
|
108
|
-
_log.default.warn(
|
|
109
|
-
|
|
110
|
-
|
|
144
|
+
_log.default.warn("purge-deprecation", [
|
|
145
|
+
"The `purge`/`content` options have changed in Tailwind CSS v3.0.",
|
|
146
|
+
"Update your configuration file to eliminate this warning.",
|
|
147
|
+
"https://tailwindcss.com/docs/upgrade-guide#configure-content-sources",
|
|
111
148
|
]);
|
|
112
149
|
}
|
|
113
150
|
// Normalize the `safelist`
|
|
@@ -121,15 +158,16 @@ function normalizeConfig(config) {
|
|
|
121
158
|
return [];
|
|
122
159
|
})();
|
|
123
160
|
// Normalize prefix option
|
|
124
|
-
if (typeof config.prefix ===
|
|
125
|
-
_log.default.warn(
|
|
126
|
-
|
|
127
|
-
|
|
161
|
+
if (typeof config.prefix === "function") {
|
|
162
|
+
_log.default.warn("prefix-function", [
|
|
163
|
+
"As of Tailwind CSS v3.0, `prefix` cannot be a function.",
|
|
164
|
+
"Update `prefix` in your configuration to be a string to eliminate this warning.",
|
|
165
|
+
"https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function",
|
|
128
166
|
]);
|
|
129
|
-
config.prefix =
|
|
167
|
+
config.prefix = "";
|
|
130
168
|
} else {
|
|
131
169
|
var _prefix;
|
|
132
|
-
config.prefix = (_prefix = config.prefix) !== null && _prefix !== void 0 ? _prefix :
|
|
170
|
+
config.prefix = (_prefix = config.prefix) !== null && _prefix !== void 0 ? _prefix : "";
|
|
133
171
|
}
|
|
134
172
|
// Normalize the `content`
|
|
135
173
|
config.content = {
|
|
@@ -151,17 +189,15 @@ function normalizeConfig(config) {
|
|
|
151
189
|
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;
|
|
152
190
|
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;
|
|
153
191
|
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;
|
|
154
|
-
return {
|
|
155
|
-
};
|
|
192
|
+
return {};
|
|
156
193
|
})();
|
|
157
|
-
let extractors = {
|
|
158
|
-
};
|
|
194
|
+
let extractors = {};
|
|
159
195
|
let defaultExtractor = (()=>{
|
|
160
|
-
var ref,
|
|
161
|
-
if ((ref = config.purge) === null || ref === void 0 ? void 0 : (
|
|
196
|
+
var ref, ref1, ref2, ref3;
|
|
197
|
+
if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref1 = ref.options) === null || ref1 === void 0 ? void 0 : ref1.defaultExtractor) {
|
|
162
198
|
return config.purge.options.defaultExtractor;
|
|
163
199
|
}
|
|
164
|
-
if ((
|
|
200
|
+
if ((ref2 = config.content) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.options) === null || ref3 === void 0 ? void 0 : ref3.defaultExtractor) {
|
|
165
201
|
return config.content.options.defaultExtractor;
|
|
166
202
|
}
|
|
167
203
|
return undefined;
|
|
@@ -170,7 +206,7 @@ function normalizeConfig(config) {
|
|
|
170
206
|
extractors.DEFAULT = defaultExtractor;
|
|
171
207
|
}
|
|
172
208
|
// Functions
|
|
173
|
-
if (typeof extract ===
|
|
209
|
+
if (typeof extract === "function") {
|
|
174
210
|
extractors.DEFAULT = extract;
|
|
175
211
|
} else if (Array.isArray(extract)) {
|
|
176
212
|
for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
|
|
@@ -178,31 +214,40 @@ function normalizeConfig(config) {
|
|
|
178
214
|
extractors[extension] = extractor;
|
|
179
215
|
}
|
|
180
216
|
}
|
|
181
|
-
} else if (typeof extract ===
|
|
217
|
+
} else if (typeof extract === "object" && extract !== null) {
|
|
182
218
|
Object.assign(extractors, extract);
|
|
183
219
|
}
|
|
184
220
|
return extractors;
|
|
185
221
|
})(),
|
|
186
222
|
transform: (()=>{
|
|
187
223
|
let transform = (()=>{
|
|
188
|
-
var ref,
|
|
224
|
+
var ref, ref1, ref2, ref3, ref4, ref5;
|
|
189
225
|
if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.transform) return config.purge.transform;
|
|
190
|
-
if ((
|
|
191
|
-
if ((
|
|
192
|
-
if ((
|
|
193
|
-
return {
|
|
194
|
-
};
|
|
226
|
+
if ((ref1 = config.content) === null || ref1 === void 0 ? void 0 : ref1.transform) return config.content.transform;
|
|
227
|
+
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;
|
|
228
|
+
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;
|
|
229
|
+
return {};
|
|
195
230
|
})();
|
|
196
|
-
let transformers = {
|
|
197
|
-
|
|
198
|
-
if (typeof transform === 'function') {
|
|
231
|
+
let transformers = {};
|
|
232
|
+
if (typeof transform === "function") {
|
|
199
233
|
transformers.DEFAULT = transform;
|
|
200
234
|
}
|
|
201
|
-
if (typeof transform ===
|
|
235
|
+
if (typeof transform === "object" && transform !== null) {
|
|
202
236
|
Object.assign(transformers, transform);
|
|
203
237
|
}
|
|
204
238
|
return transformers;
|
|
205
239
|
})()
|
|
206
240
|
};
|
|
241
|
+
// Validate globs to prevent bogus globs.
|
|
242
|
+
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
|
243
|
+
for (let file of config.content.files){
|
|
244
|
+
if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
|
|
245
|
+
_log.default.warn("invalid-glob-braces", [
|
|
246
|
+
`The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
|
|
247
|
+
`Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
|
|
248
|
+
]);
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
207
252
|
return config;
|
|
208
253
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function that normalizes the various forms that the screens object can be
|
|
3
|
+
* provided in.
|
|
4
|
+
*
|
|
5
|
+
* Input(s):
|
|
6
|
+
* - ['100px', '200px'] // Raw strings
|
|
7
|
+
* - { sm: '100px', md: '200px' } // Object with string values
|
|
8
|
+
* - { sm: { min: '100px' }, md: { max: '100px' } } // Object with object values
|
|
9
|
+
* - { sm: [{ min: '100px' }, { max: '200px' }] } // Object with object array (multiple values)
|
|
10
|
+
*
|
|
11
|
+
* Output(s):
|
|
12
|
+
* - [{ name: 'sm', values: [{ min: '100px', max: '200px' }] }] // List of objects, that contains multiple values
|
|
13
|
+
*/ "use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "normalizeScreens", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>normalizeScreens
|
|
20
|
+
});
|
|
21
|
+
function normalizeScreens(screens, root = true) {
|
|
22
|
+
if (Array.isArray(screens)) {
|
|
23
|
+
return screens.map((screen)=>{
|
|
24
|
+
if (root && Array.isArray(screen)) {
|
|
25
|
+
throw new Error("The tuple syntax is not supported for `screens`.");
|
|
26
|
+
}
|
|
27
|
+
if (typeof screen === "string") {
|
|
28
|
+
return {
|
|
29
|
+
name: screen.toString(),
|
|
30
|
+
values: [
|
|
31
|
+
{
|
|
32
|
+
min: screen,
|
|
33
|
+
max: undefined
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
let [name, options] = screen;
|
|
39
|
+
name = name.toString();
|
|
40
|
+
if (typeof options === "string") {
|
|
41
|
+
return {
|
|
42
|
+
name,
|
|
43
|
+
values: [
|
|
44
|
+
{
|
|
45
|
+
min: options,
|
|
46
|
+
max: undefined
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (Array.isArray(options)) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
values: options.map((option)=>resolveValue(option))
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
name,
|
|
59
|
+
values: [
|
|
60
|
+
resolveValue(options)
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
|
|
66
|
+
}
|
|
67
|
+
function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } = {}) {
|
|
68
|
+
return {
|
|
69
|
+
min,
|
|
70
|
+
max,
|
|
71
|
+
raw
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -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);
|
|
@@ -2,22 +2,29 @@
|
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
"inset",
|
|
18
|
+
"inherit",
|
|
19
|
+
"initial",
|
|
20
|
+
"revert",
|
|
21
|
+
"unset"
|
|
13
22
|
]);
|
|
14
|
-
let COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
15
|
-
;
|
|
16
23
|
let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
17
24
|
;
|
|
18
|
-
let LENGTH = /^-?(\d+)(.*?)$/g;
|
|
25
|
+
let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
|
|
19
26
|
function parseBoxShadowValue(input) {
|
|
20
|
-
let shadows =
|
|
27
|
+
let shadows = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, ",");
|
|
21
28
|
return shadows.map((shadow)=>{
|
|
22
29
|
let value = shadow.trim();
|
|
23
30
|
let result = {
|
|
@@ -29,22 +36,22 @@ function parseBoxShadowValue(input) {
|
|
|
29
36
|
// Reset index, since the regex is stateful.
|
|
30
37
|
LENGTH.lastIndex = 0;
|
|
31
38
|
// Keyword
|
|
32
|
-
if (!seen.has(
|
|
39
|
+
if (!seen.has("KEYWORD") && KEYWORDS.has(part)) {
|
|
33
40
|
result.keyword = part;
|
|
34
|
-
seen.add(
|
|
41
|
+
seen.add("KEYWORD");
|
|
35
42
|
} else if (LENGTH.test(part)) {
|
|
36
|
-
if (!seen.has(
|
|
43
|
+
if (!seen.has("X")) {
|
|
37
44
|
result.x = part;
|
|
38
|
-
seen.add(
|
|
39
|
-
} else if (!seen.has(
|
|
45
|
+
seen.add("X");
|
|
46
|
+
} else if (!seen.has("Y")) {
|
|
40
47
|
result.y = part;
|
|
41
|
-
seen.add(
|
|
42
|
-
} else if (!seen.has(
|
|
48
|
+
seen.add("Y");
|
|
49
|
+
} else if (!seen.has("BLUR")) {
|
|
43
50
|
result.blur = part;
|
|
44
|
-
seen.add(
|
|
45
|
-
} else if (!seen.has(
|
|
51
|
+
seen.add("BLUR");
|
|
52
|
+
} else if (!seen.has("SPREAD")) {
|
|
46
53
|
result.spread = part;
|
|
47
|
-
seen.add(
|
|
54
|
+
seen.add("SPREAD");
|
|
48
55
|
}
|
|
49
56
|
} else {
|
|
50
57
|
if (!result.color) {
|
|
@@ -72,6 +79,6 @@ function formatBoxShadowValue(shadows) {
|
|
|
72
79
|
shadow.blur,
|
|
73
80
|
shadow.spread,
|
|
74
81
|
shadow.color
|
|
75
|
-
].filter(Boolean).join(
|
|
76
|
-
}).join(
|
|
82
|
+
].filter(Boolean).join(" ");
|
|
83
|
+
}).join(", ");
|
|
77
84
|
}
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>parseDependency
|
|
8
|
+
});
|
|
9
|
+
const _isGlob = /*#__PURE__*/ _interopRequireDefault(require("is-glob"));
|
|
10
|
+
const _globParent = /*#__PURE__*/ _interopRequireDefault(require("glob-parent"));
|
|
11
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
9
12
|
function _interopRequireDefault(obj) {
|
|
10
13
|
return obj && obj.__esModule ? obj : {
|
|
11
14
|
default: obj
|
|
@@ -15,17 +18,17 @@ function _interopRequireDefault(obj) {
|
|
|
15
18
|
// https://github.com/micromatch/glob-base/blob/master/index.js
|
|
16
19
|
function parseGlob(pattern) {
|
|
17
20
|
let glob = pattern;
|
|
18
|
-
let base = (0, _globParent
|
|
19
|
-
if (base !==
|
|
21
|
+
let base = (0, _globParent.default)(pattern);
|
|
22
|
+
if (base !== ".") {
|
|
20
23
|
glob = pattern.substr(base.length);
|
|
21
|
-
if (glob.charAt(0) ===
|
|
24
|
+
if (glob.charAt(0) === "/") {
|
|
22
25
|
glob = glob.substr(1);
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
|
-
if (glob.substr(0, 2) ===
|
|
28
|
+
if (glob.substr(0, 2) === "./") {
|
|
26
29
|
glob = glob.substr(2);
|
|
27
30
|
}
|
|
28
|
-
if (glob.charAt(0) ===
|
|
31
|
+
if (glob.charAt(0) === "/") {
|
|
29
32
|
glob = glob.substr(1);
|
|
30
33
|
}
|
|
31
34
|
return {
|
|
@@ -34,28 +37,28 @@ function parseGlob(pattern) {
|
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
function parseDependency(normalizedFileOrGlob) {
|
|
37
|
-
if (normalizedFileOrGlob.startsWith(
|
|
40
|
+
if (normalizedFileOrGlob.startsWith("!")) {
|
|
38
41
|
return null;
|
|
39
42
|
}
|
|
40
43
|
let message;
|
|
41
|
-
if ((0, _isGlob
|
|
44
|
+
if ((0, _isGlob.default)(normalizedFileOrGlob)) {
|
|
42
45
|
let { base , glob } = parseGlob(normalizedFileOrGlob);
|
|
43
46
|
message = {
|
|
44
|
-
type:
|
|
47
|
+
type: "dir-dependency",
|
|
45
48
|
dir: _path.default.resolve(base),
|
|
46
49
|
glob
|
|
47
50
|
};
|
|
48
51
|
} else {
|
|
49
52
|
message = {
|
|
50
|
-
type:
|
|
53
|
+
type: "dependency",
|
|
51
54
|
file: _path.default.resolve(normalizedFileOrGlob)
|
|
52
55
|
};
|
|
53
56
|
}
|
|
54
57
|
// rollup-plugin-postcss does not support dir-dependency messages
|
|
55
58
|
// but directories can be watched in the same way as files
|
|
56
|
-
if (message.type ===
|
|
59
|
+
if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
|
|
57
60
|
message = {
|
|
58
|
-
type:
|
|
61
|
+
type: "dependency",
|
|
59
62
|
file: message.dir
|
|
60
63
|
};
|
|
61
64
|
}
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>parseObjectStyles
|
|
8
|
+
});
|
|
9
|
+
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
10
|
+
const _postcssNested = /*#__PURE__*/ _interopRequireDefault(require("postcss-nested"));
|
|
11
|
+
const _postcssJs = /*#__PURE__*/ _interopRequireDefault(require("postcss-js"));
|
|
9
12
|
function _interopRequireDefault(obj) {
|
|
10
13
|
return obj && obj.__esModule ? obj : {
|
|
11
14
|
default: obj
|
|
@@ -18,10 +21,10 @@ function parseObjectStyles(styles) {
|
|
|
18
21
|
]);
|
|
19
22
|
}
|
|
20
23
|
return styles.flatMap((style)=>{
|
|
21
|
-
return (0, _postcss
|
|
22
|
-
(0, _postcssNested
|
|
24
|
+
return (0, _postcss.default)([
|
|
25
|
+
(0, _postcssNested.default)({
|
|
23
26
|
bubble: [
|
|
24
|
-
|
|
27
|
+
"screen"
|
|
25
28
|
]
|
|
26
29
|
}),
|
|
27
30
|
]).process(style, {
|