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
package/lib/util/pluginUtils.js
CHANGED
|
@@ -2,32 +2,41 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
updateAllClasses: ()=>updateAllClasses,
|
|
13
|
+
asValue: ()=>asValue,
|
|
14
|
+
parseColorFormat: ()=>parseColorFormat,
|
|
15
|
+
asColor: ()=>asColor,
|
|
16
|
+
asLookupValue: ()=>asLookupValue,
|
|
17
|
+
coerceValue: ()=>coerceValue
|
|
18
|
+
});
|
|
19
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
20
|
+
const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
|
|
21
|
+
const _withAlphaVariable = require("./withAlphaVariable");
|
|
22
|
+
const _dataTypes = require("./dataTypes");
|
|
23
|
+
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
|
15
24
|
function _interopRequireDefault(obj) {
|
|
16
25
|
return obj && obj.__esModule ? obj : {
|
|
17
26
|
default: obj
|
|
18
27
|
};
|
|
19
28
|
}
|
|
20
|
-
function updateAllClasses(
|
|
21
|
-
let parser = (0, _postcssSelectorParser
|
|
29
|
+
function updateAllClasses(selectors, updateClass) {
|
|
30
|
+
let parser = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
22
31
|
selectors.walkClasses((sel)=>{
|
|
23
32
|
let updatedClass = updateClass(sel.value);
|
|
24
33
|
sel.value = updatedClass;
|
|
25
34
|
if (sel.raws && sel.raws.value) {
|
|
26
|
-
sel.raws.value = (0, _escapeCommas
|
|
35
|
+
sel.raws.value = (0, _escapeCommas.default)(sel.raws.value);
|
|
27
36
|
}
|
|
28
37
|
});
|
|
29
38
|
});
|
|
30
|
-
let result = parser.processSync(
|
|
39
|
+
let result = parser.processSync(selectors);
|
|
31
40
|
return result;
|
|
32
41
|
}
|
|
33
42
|
function resolveArbitraryValue(modifier, validate) {
|
|
@@ -38,41 +47,37 @@ function resolveArbitraryValue(modifier, validate) {
|
|
|
38
47
|
if (!validate(value)) {
|
|
39
48
|
return undefined;
|
|
40
49
|
}
|
|
41
|
-
return (0, _dataTypes
|
|
50
|
+
return (0, _dataTypes.normalize)(value);
|
|
42
51
|
}
|
|
43
|
-
function asNegativeValue(modifier, lookup = {
|
|
44
|
-
}, validate) {
|
|
52
|
+
function asNegativeValue(modifier, lookup = {}, validate) {
|
|
45
53
|
let positiveValue = lookup[modifier];
|
|
46
54
|
if (positiveValue !== undefined) {
|
|
47
|
-
return (0, _negateValue
|
|
55
|
+
return (0, _negateValue.default)(positiveValue);
|
|
48
56
|
}
|
|
49
57
|
if (isArbitraryValue(modifier)) {
|
|
50
58
|
let resolved = resolveArbitraryValue(modifier, validate);
|
|
51
59
|
if (resolved === undefined) {
|
|
52
60
|
return undefined;
|
|
53
61
|
}
|
|
54
|
-
return (0, _negateValue
|
|
62
|
+
return (0, _negateValue.default)(resolved);
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
|
-
function asValue(modifier, options = {
|
|
58
|
-
}, { validate =()=>true
|
|
59
|
-
} = {
|
|
60
|
-
}) {
|
|
65
|
+
function asValue(modifier, options = {}, { validate =()=>true } = {}) {
|
|
61
66
|
var ref;
|
|
62
67
|
let value = (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
|
63
68
|
if (value !== undefined) {
|
|
64
69
|
return value;
|
|
65
70
|
}
|
|
66
|
-
if (options.supportsNegativeValues && modifier.startsWith(
|
|
71
|
+
if (options.supportsNegativeValues && modifier.startsWith("-")) {
|
|
67
72
|
return asNegativeValue(modifier.slice(1), options.values, validate);
|
|
68
73
|
}
|
|
69
74
|
return resolveArbitraryValue(modifier, validate);
|
|
70
75
|
}
|
|
71
76
|
function isArbitraryValue(input) {
|
|
72
|
-
return input.startsWith(
|
|
77
|
+
return input.startsWith("[") && input.endsWith("]");
|
|
73
78
|
}
|
|
74
79
|
function splitAlpha(modifier) {
|
|
75
|
-
let slashIdx = modifier.lastIndexOf(
|
|
80
|
+
let slashIdx = modifier.lastIndexOf("/");
|
|
76
81
|
if (slashIdx === -1 || slashIdx === modifier.length - 1) {
|
|
77
82
|
return [
|
|
78
83
|
modifier
|
|
@@ -83,14 +88,18 @@ function splitAlpha(modifier) {
|
|
|
83
88
|
modifier.slice(slashIdx + 1)
|
|
84
89
|
];
|
|
85
90
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
91
|
+
function parseColorFormat(value) {
|
|
92
|
+
if (typeof value === "string" && value.includes("<alpha-value>")) {
|
|
93
|
+
let oldValue = value;
|
|
94
|
+
return ({ opacityValue =1 })=>oldValue.replace("<alpha-value>", opacityValue);
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
90
99
|
var ref;
|
|
91
100
|
if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
|
|
92
101
|
var ref1;
|
|
93
|
-
return (ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier];
|
|
102
|
+
return parseColorFormat((ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier]);
|
|
94
103
|
}
|
|
95
104
|
let [color, alpha] = splitAlpha(modifier);
|
|
96
105
|
if (alpha !== undefined) {
|
|
@@ -100,20 +109,20 @@ function asColor(modifier, options = {
|
|
|
100
109
|
if (normalizedColor === undefined) {
|
|
101
110
|
return undefined;
|
|
102
111
|
}
|
|
112
|
+
normalizedColor = parseColorFormat(normalizedColor);
|
|
103
113
|
if (isArbitraryValue(alpha)) {
|
|
104
|
-
return (0, _withAlphaVariable
|
|
114
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, alpha.slice(1, -1));
|
|
105
115
|
}
|
|
106
116
|
if (((ref3 = tailwindConfig.theme) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.opacity) === null || ref4 === void 0 ? void 0 : ref4[alpha]) === undefined) {
|
|
107
117
|
return undefined;
|
|
108
118
|
}
|
|
109
|
-
return (0, _withAlphaVariable
|
|
119
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, tailwindConfig.theme.opacity[alpha]);
|
|
110
120
|
}
|
|
111
121
|
return asValue(modifier, options, {
|
|
112
122
|
validate: _dataTypes.color
|
|
113
123
|
});
|
|
114
124
|
}
|
|
115
|
-
function asLookupValue(modifier, options = {
|
|
116
|
-
}) {
|
|
125
|
+
function asLookupValue(modifier, options = {}) {
|
|
117
126
|
var ref;
|
|
118
127
|
return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
|
119
128
|
}
|
|
@@ -133,12 +142,12 @@ let typeMap = {
|
|
|
133
142
|
percentage: guess(_dataTypes.percentage),
|
|
134
143
|
position: guess(_dataTypes.position),
|
|
135
144
|
lookup: asLookupValue,
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
"generic-name": guess(_dataTypes.genericName),
|
|
146
|
+
"family-name": guess(_dataTypes.familyName),
|
|
138
147
|
number: guess(_dataTypes.number),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
148
|
+
"line-width": guess(_dataTypes.lineWidth),
|
|
149
|
+
"absolute-size": guess(_dataTypes.absoluteSize),
|
|
150
|
+
"relative-size": guess(_dataTypes.relativeSize),
|
|
142
151
|
shadow: guess(_dataTypes.shadow)
|
|
143
152
|
};
|
|
144
153
|
let supportedTypes = Object.keys(typeMap);
|
|
@@ -156,7 +165,7 @@ function splitAtFirst(input, delim) {
|
|
|
156
165
|
function coerceValue(types, modifier, options, tailwindConfig) {
|
|
157
166
|
if (isArbitraryValue(modifier)) {
|
|
158
167
|
let arbitraryValue = modifier.slice(1, -1);
|
|
159
|
-
let [explicitType, value] = splitAtFirst(arbitraryValue,
|
|
168
|
+
let [explicitType, value] = splitAtFirst(arbitraryValue, ":");
|
|
160
169
|
// It could be that this resolves to `url(https` which is not a valid
|
|
161
170
|
// identifier. We currently only support "simple" words with dashes or
|
|
162
171
|
// underscores. E.g.: family-name
|
|
@@ -177,7 +186,7 @@ function coerceValue(types, modifier, options, tailwindConfig) {
|
|
|
177
186
|
let result = typeMap[type](modifier, options, {
|
|
178
187
|
tailwindConfig
|
|
179
188
|
});
|
|
180
|
-
if (result) return [
|
|
189
|
+
if (result !== undefined) return [
|
|
181
190
|
result,
|
|
182
191
|
type
|
|
183
192
|
];
|
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
9
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
8
10
|
function _interopRequireDefault(obj) {
|
|
9
11
|
return obj && obj.__esModule ? obj : {
|
|
10
12
|
default: obj
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
|
-
function _default(prefix, selector) {
|
|
14
|
-
return (0, _postcssSelectorParser
|
|
15
|
+
function _default(prefix, selector, prependNegative = false) {
|
|
16
|
+
return (0, _postcssSelectorParser.default)((selectors)=>{
|
|
15
17
|
selectors.walkClasses((classSelector)=>{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
18
|
+
let baseClass = classSelector.value;
|
|
19
|
+
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
|
|
20
|
+
classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
|
|
19
21
|
});
|
|
20
22
|
}).processSync(selector);
|
|
21
23
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function removes any uses of CSS variables used as an alpha channel
|
|
3
|
+
*
|
|
4
|
+
* This is required for selectors like `:visited` which do not allow
|
|
5
|
+
* changes in opacity or external control using CSS variables.
|
|
6
|
+
*
|
|
7
|
+
* @param {import('postcss').Container} container
|
|
8
|
+
* @param {string[]} toRemove
|
|
9
|
+
*/ "use strict";
|
|
10
|
+
Object.defineProperty(exports, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "removeAlphaVariables", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: ()=>removeAlphaVariables
|
|
16
|
+
});
|
|
17
|
+
function removeAlphaVariables(container, toRemove) {
|
|
18
|
+
container.walkDecls((decl)=>{
|
|
19
|
+
if (toRemove.includes(decl.prop)) {
|
|
20
|
+
decl.remove();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
for (let varName of toRemove){
|
|
24
|
+
if (decl.value.includes(`/ var(${varName})`)) {
|
|
25
|
+
decl.value = decl.value.replace(`/ var(${varName})`, "");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -2,25 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>resolveConfig
|
|
8
|
+
});
|
|
9
|
+
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
|
10
|
+
const _corePluginList = /*#__PURE__*/ _interopRequireDefault(require("../corePluginList"));
|
|
11
|
+
const _configurePlugins = /*#__PURE__*/ _interopRequireDefault(require("./configurePlugins"));
|
|
12
|
+
const _defaultConfigStub = /*#__PURE__*/ _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
|
|
13
|
+
const _colors = /*#__PURE__*/ _interopRequireDefault(require("../public/colors"));
|
|
14
|
+
const _defaults = require("./defaults");
|
|
15
|
+
const _toPath = require("./toPath");
|
|
16
|
+
const _normalizeConfig = require("./normalizeConfig");
|
|
17
|
+
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
|
|
18
|
+
const _cloneDeep = require("./cloneDeep");
|
|
19
|
+
const _pluginUtils = require("./pluginUtils");
|
|
20
|
+
const _withAlphaVariable = require("./withAlphaVariable");
|
|
21
|
+
const _toColorValue = /*#__PURE__*/ _interopRequireDefault(require("./toColorValue"));
|
|
14
22
|
function _interopRequireDefault(obj) {
|
|
15
23
|
return obj && obj.__esModule ? obj : {
|
|
16
24
|
default: obj
|
|
17
25
|
};
|
|
18
26
|
}
|
|
19
27
|
function isFunction(input) {
|
|
20
|
-
return typeof input ===
|
|
28
|
+
return typeof input === "function";
|
|
21
29
|
}
|
|
22
30
|
function isObject(input) {
|
|
23
|
-
return typeof input ===
|
|
31
|
+
return typeof input === "object" && input !== null;
|
|
24
32
|
}
|
|
25
33
|
function mergeWith(target, ...sources) {
|
|
26
34
|
let customizer = sources.pop();
|
|
@@ -29,7 +37,7 @@ function mergeWith(target, ...sources) {
|
|
|
29
37
|
let merged = customizer(target[k], source[k]);
|
|
30
38
|
if (merged === undefined) {
|
|
31
39
|
if (isObject(target[k]) && isObject(source[k])) {
|
|
32
|
-
target[k] = mergeWith(target[k], source[k], customizer);
|
|
40
|
+
target[k] = mergeWith({}, target[k], source[k], customizer);
|
|
33
41
|
} else {
|
|
34
42
|
target[k] = source[k];
|
|
35
43
|
}
|
|
@@ -44,27 +52,22 @@ const configUtils = {
|
|
|
44
52
|
colors: _colors.default,
|
|
45
53
|
negative (scale) {
|
|
46
54
|
// TODO: Log that this function isn't really needed anymore?
|
|
47
|
-
return Object.keys(scale).filter((key)=>scale[key] !==
|
|
48
|
-
|
|
49
|
-
let negativeValue = (0, _negateValue).default(scale[key]);
|
|
55
|
+
return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
|
|
56
|
+
let negativeValue = (0, _negateValue.default)(scale[key]);
|
|
50
57
|
if (negativeValue !== undefined) {
|
|
51
58
|
negativeScale[`-${key}`] = negativeValue;
|
|
52
59
|
}
|
|
53
60
|
return negativeScale;
|
|
54
|
-
}, {
|
|
55
|
-
});
|
|
61
|
+
}, {});
|
|
56
62
|
},
|
|
57
63
|
breakpoints (screens) {
|
|
58
|
-
return Object.keys(screens).filter((key)=>typeof screens[key] ===
|
|
59
|
-
).reduce((breakpoints, key)=>({
|
|
64
|
+
return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
|
|
60
65
|
...breakpoints,
|
|
61
66
|
[`screen-${key}`]: screens[key]
|
|
62
|
-
})
|
|
63
|
-
, {
|
|
64
|
-
});
|
|
67
|
+
}), {});
|
|
65
68
|
}
|
|
66
69
|
};
|
|
67
|
-
function
|
|
70
|
+
function value(valueToResolve, ...args) {
|
|
68
71
|
return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
|
|
69
72
|
}
|
|
70
73
|
function collectExtends(items) {
|
|
@@ -86,14 +89,11 @@ function collectExtends(items) {
|
|
|
86
89
|
mergedValue
|
|
87
90
|
];
|
|
88
91
|
});
|
|
89
|
-
}, {
|
|
90
|
-
});
|
|
92
|
+
}, {});
|
|
91
93
|
}
|
|
92
94
|
function mergeThemes(themes) {
|
|
93
95
|
return {
|
|
94
|
-
...themes.reduce((merged, theme)=>(0, _defaults
|
|
95
|
-
, {
|
|
96
|
-
}),
|
|
96
|
+
...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
|
|
97
97
|
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
98
98
|
// into arrays instead of objects so they aren't overridden.
|
|
99
99
|
extend: collectExtends(themes)
|
|
@@ -122,40 +122,68 @@ function mergeExtensions({ extend , ...theme }) {
|
|
|
122
122
|
return mergeWith(theme, extend, (themeValue, extensions)=>{
|
|
123
123
|
// The `extend` property is an array, so we need to check if it contains any functions
|
|
124
124
|
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
125
|
-
return mergeWith({
|
|
126
|
-
}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
125
|
+
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
127
126
|
}
|
|
128
|
-
return (resolveThemePath, utils)=>mergeWith({
|
|
129
|
-
}, ...[
|
|
127
|
+
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
|
130
128
|
themeValue,
|
|
131
129
|
...extensions
|
|
132
|
-
].map((e)=>
|
|
133
|
-
), mergeExtensionCustomizer)
|
|
134
|
-
;
|
|
130
|
+
].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
|
135
131
|
});
|
|
136
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* @param {string} key
|
|
136
|
+
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
137
|
+
*/ function* toPaths(key) {
|
|
138
|
+
let path = (0, _toPath.toPath)(key);
|
|
139
|
+
if (path.length === 0) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
yield path;
|
|
143
|
+
if (Array.isArray(key)) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
|
|
147
|
+
let matches = key.match(pattern);
|
|
148
|
+
if (matches !== null) {
|
|
149
|
+
let [, prefix, alpha] = matches;
|
|
150
|
+
let newPath = (0, _toPath.toPath)(prefix);
|
|
151
|
+
newPath.alpha = alpha;
|
|
152
|
+
yield newPath;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
137
155
|
function resolveFunctionKeys(object) {
|
|
156
|
+
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
138
157
|
const resolvePath = (key, defaultValue)=>{
|
|
139
|
-
const path
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
158
|
+
for (const path of toPaths(key)){
|
|
159
|
+
let index = 0;
|
|
160
|
+
let val = object;
|
|
161
|
+
while(val !== undefined && val !== null && index < path.length){
|
|
162
|
+
val = val[path[index++]];
|
|
163
|
+
let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
|
|
164
|
+
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
|
|
165
|
+
}
|
|
166
|
+
if (val !== undefined) {
|
|
167
|
+
if (path.alpha !== undefined) {
|
|
168
|
+
let normalized = (0, _pluginUtils.parseColorFormat)(val);
|
|
169
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
|
|
170
|
+
}
|
|
171
|
+
if ((0, _isPlainObject.default)(val)) {
|
|
172
|
+
return (0, _cloneDeep.cloneDeep)(val);
|
|
173
|
+
}
|
|
174
|
+
return val;
|
|
175
|
+
}
|
|
145
176
|
}
|
|
146
|
-
return
|
|
177
|
+
return defaultValue;
|
|
147
178
|
};
|
|
148
|
-
resolvePath
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
return Object.keys(object).reduce((resolved, key)=>{
|
|
153
|
-
return {
|
|
154
|
-
...resolved,
|
|
155
|
-
[key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
|
|
156
|
-
};
|
|
157
|
-
}, {
|
|
179
|
+
Object.assign(resolvePath, {
|
|
180
|
+
theme: resolvePath,
|
|
181
|
+
...configUtils
|
|
158
182
|
});
|
|
183
|
+
return Object.keys(object).reduce((resolved, key)=>{
|
|
184
|
+
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
|
|
185
|
+
return resolved;
|
|
186
|
+
}, {});
|
|
159
187
|
}
|
|
160
188
|
function extractPluginConfigs(configs) {
|
|
161
189
|
let allConfigs = [];
|
|
@@ -164,8 +192,8 @@ function extractPluginConfigs(configs) {
|
|
|
164
192
|
...allConfigs,
|
|
165
193
|
config
|
|
166
194
|
];
|
|
167
|
-
var
|
|
168
|
-
const plugins = (
|
|
195
|
+
var ref;
|
|
196
|
+
const plugins = (ref = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref !== void 0 ? ref : [];
|
|
169
197
|
if (plugins.length === 0) {
|
|
170
198
|
return;
|
|
171
199
|
}
|
|
@@ -177,8 +205,7 @@ function extractPluginConfigs(configs) {
|
|
|
177
205
|
allConfigs = [
|
|
178
206
|
...allConfigs,
|
|
179
207
|
...extractPluginConfigs([
|
|
180
|
-
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {
|
|
181
|
-
}
|
|
208
|
+
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
|
|
182
209
|
])
|
|
183
210
|
];
|
|
184
211
|
});
|
|
@@ -194,7 +221,7 @@ function resolveCorePlugins(corePluginConfigs) {
|
|
|
194
221
|
corePlugins: resolved
|
|
195
222
|
});
|
|
196
223
|
}
|
|
197
|
-
return (0, _configurePlugins
|
|
224
|
+
return (0, _configurePlugins.default)(corePluginConfig, resolved);
|
|
198
225
|
}, _corePluginList.default);
|
|
199
226
|
return result;
|
|
200
227
|
}
|
|
@@ -213,22 +240,20 @@ function resolveConfig(configs) {
|
|
|
213
240
|
let allConfigs = [
|
|
214
241
|
...extractPluginConfigs(configs),
|
|
215
242
|
{
|
|
216
|
-
prefix:
|
|
243
|
+
prefix: "",
|
|
217
244
|
important: false,
|
|
218
|
-
separator:
|
|
245
|
+
separator: ":",
|
|
219
246
|
variantOrder: _defaultConfigStub.default.variantOrder
|
|
220
247
|
},
|
|
221
248
|
];
|
|
222
|
-
var ref,
|
|
223
|
-
return (0, _normalizeConfig
|
|
249
|
+
var ref, ref1;
|
|
250
|
+
return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
|
|
224
251
|
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
225
|
-
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
|
|
226
|
-
};
|
|
252
|
+
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
|
|
227
253
|
})))),
|
|
228
|
-
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
|
|
229
|
-
)),
|
|
254
|
+
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
|
230
255
|
plugins: resolvePluginLists(configs.map((c)=>{
|
|
231
|
-
return (
|
|
256
|
+
return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
|
|
232
257
|
}))
|
|
233
258
|
}, ...allConfigs));
|
|
234
259
|
}
|
|
@@ -2,22 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>resolveConfigPath
|
|
8
|
+
});
|
|
9
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
10
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
8
11
|
function _interopRequireDefault(obj) {
|
|
9
12
|
return obj && obj.__esModule ? obj : {
|
|
10
13
|
default: obj
|
|
11
14
|
};
|
|
12
15
|
}
|
|
13
16
|
function isObject(value) {
|
|
14
|
-
return typeof value ===
|
|
17
|
+
return typeof value === "object" && value !== null;
|
|
15
18
|
}
|
|
16
19
|
function isEmpty(obj) {
|
|
17
20
|
return Object.keys(obj).length === 0;
|
|
18
21
|
}
|
|
19
22
|
function isString(value) {
|
|
20
|
-
return typeof value ===
|
|
23
|
+
return typeof value === "string" || value instanceof String;
|
|
21
24
|
}
|
|
22
25
|
function resolveConfigPath(pathOrConfig) {
|
|
23
26
|
// require('tailwindcss')({ theme: ..., variants: ... })
|
|
@@ -38,15 +41,14 @@ function resolveConfigPath(pathOrConfig) {
|
|
|
38
41
|
}
|
|
39
42
|
// require('tailwindcss')
|
|
40
43
|
for (const configFile of [
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
"./tailwind.config.js",
|
|
45
|
+
"./tailwind.config.cjs"
|
|
43
46
|
]){
|
|
44
47
|
try {
|
|
45
48
|
const configPath = _path.default.resolve(configFile);
|
|
46
49
|
_fs.default.accessSync(configPath);
|
|
47
50
|
return configPath;
|
|
48
|
-
} catch (err) {
|
|
49
|
-
}
|
|
51
|
+
} catch (err) {}
|
|
50
52
|
}
|
|
51
53
|
return null;
|
|
52
54
|
}
|
package/lib/util/responsive.js
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>responsive
|
|
8
|
+
});
|
|
9
|
+
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
10
|
+
const _cloneNodes = /*#__PURE__*/ _interopRequireDefault(require("./cloneNodes"));
|
|
8
11
|
function _interopRequireDefault(obj) {
|
|
9
12
|
return obj && obj.__esModule ? obj : {
|
|
10
13
|
default: obj
|
|
@@ -12,8 +15,8 @@ function _interopRequireDefault(obj) {
|
|
|
12
15
|
}
|
|
13
16
|
function responsive(rules) {
|
|
14
17
|
return _postcss.default.atRule({
|
|
15
|
-
name:
|
|
16
|
-
}).append((0, _cloneNodes
|
|
18
|
+
name: "responsive"
|
|
19
|
+
}).append((0, _cloneNodes.default)(Array.isArray(rules) ? rules : [
|
|
17
20
|
rules
|
|
18
21
|
]));
|
|
19
22
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This splits a string on a top-level character.
|
|
3
|
+
*
|
|
4
|
+
* Regex doesn't support recursion (at least not the JS-flavored version).
|
|
5
|
+
* So we have to use a tiny state machine to keep track of paren placement.
|
|
6
|
+
*
|
|
7
|
+
* Expected behavior using commas:
|
|
8
|
+
* var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
|
|
9
|
+
* ─┬─ ┬ ┬ ┬
|
|
10
|
+
* x x x ╰──────── Split because top-level
|
|
11
|
+
* ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
|
|
12
|
+
*
|
|
13
|
+
* @param {string} input
|
|
14
|
+
* @param {string} separator
|
|
15
|
+
*/ "use strict";
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "splitAtTopLevelOnly", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: ()=>splitAtTopLevelOnly
|
|
22
|
+
});
|
|
23
|
+
function splitAtTopLevelOnly(input, separator) {
|
|
24
|
+
let stack = [];
|
|
25
|
+
let parts = [];
|
|
26
|
+
let lastPos = 0;
|
|
27
|
+
for(let idx = 0; idx < input.length; idx++){
|
|
28
|
+
let char = input[idx];
|
|
29
|
+
if (stack.length === 0 && char === separator[0]) {
|
|
30
|
+
if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
|
|
31
|
+
parts.push(input.slice(lastPos, idx));
|
|
32
|
+
lastPos = idx + separator.length;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (char === "(" || char === "[" || char === "{") {
|
|
36
|
+
stack.push(char);
|
|
37
|
+
} else if (char === ")" && stack[stack.length - 1] === "(" || char === "]" && stack[stack.length - 1] === "[" || char === "}" && stack[stack.length - 1] === "{") {
|
|
38
|
+
stack.pop();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
parts.push(input.slice(lastPos));
|
|
42
|
+
return parts;
|
|
43
|
+
}
|
package/lib/util/tap.js
CHANGED
package/lib/util/toColorValue.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>toColorValue
|
|
8
|
+
});
|
|
6
9
|
function toColorValue(maybeFunction) {
|
|
7
|
-
return typeof maybeFunction ===
|
|
8
|
-
}) : maybeFunction;
|
|
10
|
+
return typeof maybeFunction === "function" ? maybeFunction({}) : maybeFunction;
|
|
9
11
|
}
|