tailwindcss 3.1.4 → 3.1.7
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 +37 -2
- package/defaultTheme.d.ts +2 -1
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +78 -75
- package/lib/constants.js +19 -12
- package/lib/corePluginList.js +5 -3
- package/lib/corePlugins.js +197 -187
- package/lib/featureFlags.js +14 -7
- package/lib/index.js +9 -6
- package/lib/lib/cacheInvalidation.js +18 -15
- package/lib/lib/collapseAdjacentRules.js +14 -11
- package/lib/lib/collapseDuplicateDeclarations.js +11 -8
- package/lib/lib/defaultExtractor.js +41 -33
- package/lib/lib/detectNesting.js +4 -1
- package/lib/lib/evaluateTailwindFunctions.js +75 -44
- package/lib/lib/expandApplyAtRules.js +45 -42
- package/lib/lib/expandTailwindAtRules.js +153 -150
- package/lib/lib/generateRules.js +84 -70
- package/lib/lib/getModuleDependencies.js +21 -18
- package/lib/lib/normalizeTailwindDirectives.js +10 -7
- package/lib/lib/partitionApplyAtRules.js +14 -11
- package/lib/lib/regex.js +15 -7
- package/lib/lib/resolveDefaultsAtRules.js +92 -85
- package/lib/lib/setupContextUtils.js +115 -97
- package/lib/lib/setupTrackingContext.js +82 -75
- package/lib/lib/sharedState.js +15 -8
- package/lib/lib/substituteScreenAtRules.js +8 -5
- package/lib/postcss-plugins/nesting/index.js +7 -5
- package/lib/postcss-plugins/nesting/plugin.js +7 -4
- package/lib/processTailwindFeatures.js +34 -31
- package/lib/public/colors.js +6 -4
- package/lib/public/create-plugin.js +6 -4
- package/lib/public/default-config.js +7 -5
- package/lib/public/default-theme.js +7 -5
- package/lib/public/resolve-config.js +13 -10
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +5 -2
- package/lib/util/cloneDeep.js +4 -1
- package/lib/util/cloneNodes.js +9 -2
- package/lib/util/color.js +11 -3
- package/lib/util/configurePlugins.js +4 -1
- package/lib/util/createPlugin.js +5 -3
- package/lib/util/createUtilityPlugin.js +13 -10
- package/lib/util/dataTypes.js +27 -19
- package/lib/util/defaults.js +4 -1
- package/lib/util/escapeClassName.js +12 -9
- package/lib/util/escapeCommas.js +4 -1
- package/lib/util/flattenColorPalette.js +5 -3
- package/lib/util/formatVariantSelector.js +23 -15
- package/lib/util/getAllConfigs.js +12 -9
- package/lib/util/hashConfig.js +10 -7
- package/lib/util/isKeyframeRule.js +4 -1
- package/lib/util/isPlainObject.js +4 -1
- package/lib/util/isValidArbitraryValue.js +33 -24
- package/lib/util/log.js +12 -5
- package/lib/util/nameClass.js +16 -8
- package/lib/util/negateValue.js +4 -1
- package/lib/util/normalizeConfig.js +26 -23
- package/lib/util/normalizeScreens.js +17 -2
- package/lib/util/parseAnimationValue.js +42 -39
- package/lib/util/parseBoxShadowValue.js +12 -4
- package/lib/util/parseDependency.js +35 -32
- package/lib/util/parseObjectStyles.js +14 -11
- package/lib/util/pluginUtils.js +28 -20
- package/lib/util/prefixSelector.js +6 -3
- package/lib/util/removeAlphaVariables.js +13 -2
- package/lib/util/resolveConfig.js +55 -52
- package/lib/util/resolveConfigPath.js +20 -17
- package/lib/util/responsive.js +12 -9
- package/lib/util/splitAtTopLevelOnly.js +16 -13
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +4 -1
- package/lib/util/toPath.js +18 -2
- package/lib/util/transformThemeValue.js +10 -7
- package/lib/util/validateConfig.js +5 -2
- package/lib/util/withAlphaVariable.js +30 -22
- package/package.json +12 -12
- package/peers/index.js +24 -10
- package/resolveConfig.d.ts +3 -0
- package/scripts/generate-types.js +53 -0
- package/scripts/type-utils.js +27 -0
- package/src/corePlugins.js +2 -1
- package/src/lib/defaultExtractor.js +7 -1
- package/src/lib/evaluateTailwindFunctions.js +41 -15
- package/src/lib/generateRules.js +10 -1
- package/src/lib/setupContextUtils.js +15 -2
- package/src/util/cloneNodes.js +5 -1
- package/src/util/formatVariantSelector.js +3 -1
- package/types/config.d.ts +7 -5
- package/types/generated/default-theme.d.ts +331 -0
|
@@ -2,7 +2,48 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>parseAnimationValue
|
|
8
|
+
});
|
|
9
|
+
const DIRECTIONS = new Set([
|
|
10
|
+
"normal",
|
|
11
|
+
"reverse",
|
|
12
|
+
"alternate",
|
|
13
|
+
"alternate-reverse"
|
|
14
|
+
]);
|
|
15
|
+
const PLAY_STATES = new Set([
|
|
16
|
+
"running",
|
|
17
|
+
"paused"
|
|
18
|
+
]);
|
|
19
|
+
const FILL_MODES = new Set([
|
|
20
|
+
"none",
|
|
21
|
+
"forwards",
|
|
22
|
+
"backwards",
|
|
23
|
+
"both"
|
|
24
|
+
]);
|
|
25
|
+
const ITERATION_COUNTS = new Set([
|
|
26
|
+
"infinite"
|
|
27
|
+
]);
|
|
28
|
+
const TIMINGS = new Set([
|
|
29
|
+
"linear",
|
|
30
|
+
"ease",
|
|
31
|
+
"ease-in",
|
|
32
|
+
"ease-out",
|
|
33
|
+
"ease-in-out",
|
|
34
|
+
"step-start",
|
|
35
|
+
"step-end",
|
|
36
|
+
]);
|
|
37
|
+
const TIMING_FNS = [
|
|
38
|
+
"cubic-bezier",
|
|
39
|
+
"steps"
|
|
40
|
+
];
|
|
41
|
+
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
42
|
+
;
|
|
43
|
+
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
44
|
+
;
|
|
45
|
+
const TIME = /^(-?[\d.]+m?s)$/;
|
|
46
|
+
const DIGIT = /^(\d+)$/;
|
|
6
47
|
function parseAnimationValue(input) {
|
|
7
48
|
let animations = input.split(COMMA);
|
|
8
49
|
return animations.map((animation)=>{
|
|
@@ -48,41 +89,3 @@ function parseAnimationValue(input) {
|
|
|
48
89
|
return result;
|
|
49
90
|
});
|
|
50
91
|
}
|
|
51
|
-
const DIRECTIONS = new Set([
|
|
52
|
-
"normal",
|
|
53
|
-
"reverse",
|
|
54
|
-
"alternate",
|
|
55
|
-
"alternate-reverse"
|
|
56
|
-
]);
|
|
57
|
-
const PLAY_STATES = new Set([
|
|
58
|
-
"running",
|
|
59
|
-
"paused"
|
|
60
|
-
]);
|
|
61
|
-
const FILL_MODES = new Set([
|
|
62
|
-
"none",
|
|
63
|
-
"forwards",
|
|
64
|
-
"backwards",
|
|
65
|
-
"both"
|
|
66
|
-
]);
|
|
67
|
-
const ITERATION_COUNTS = new Set([
|
|
68
|
-
"infinite"
|
|
69
|
-
]);
|
|
70
|
-
const TIMINGS = new Set([
|
|
71
|
-
"linear",
|
|
72
|
-
"ease",
|
|
73
|
-
"ease-in",
|
|
74
|
-
"ease-out",
|
|
75
|
-
"ease-in-out",
|
|
76
|
-
"step-start",
|
|
77
|
-
"step-end",
|
|
78
|
-
]);
|
|
79
|
-
const TIMING_FNS = [
|
|
80
|
-
"cubic-bezier",
|
|
81
|
-
"steps"
|
|
82
|
-
];
|
|
83
|
-
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
84
|
-
;
|
|
85
|
-
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
|
|
86
|
-
;
|
|
87
|
-
const TIME = /^(-?[\d.]+m?s)$/;
|
|
88
|
-
const DIGIT = /^(\d+)$/;
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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");
|
|
8
16
|
let KEYWORDS = new Set([
|
|
9
17
|
"inset",
|
|
10
18
|
"inherit",
|
|
@@ -16,7 +24,7 @@ let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces inste
|
|
|
16
24
|
;
|
|
17
25
|
let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
|
|
18
26
|
function parseBoxShadowValue(input) {
|
|
19
|
-
let shadows = Array.from((0, _splitAtTopLevelOnly
|
|
27
|
+
let shadows = Array.from((0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, ","));
|
|
20
28
|
return shadows.map((shadow)=>{
|
|
21
29
|
let value = shadow.trim();
|
|
22
30
|
let result = {
|
|
@@ -2,16 +2,46 @@
|
|
|
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"));
|
|
12
|
+
function _interopRequireDefault(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
// Based on `glob-base`
|
|
18
|
+
// https://github.com/micromatch/glob-base/blob/master/index.js
|
|
19
|
+
function parseGlob(pattern) {
|
|
20
|
+
let glob = pattern;
|
|
21
|
+
let base = (0, _globParent.default)(pattern);
|
|
22
|
+
if (base !== ".") {
|
|
23
|
+
glob = pattern.substr(base.length);
|
|
24
|
+
if (glob.charAt(0) === "/") {
|
|
25
|
+
glob = glob.substr(1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (glob.substr(0, 2) === "./") {
|
|
29
|
+
glob = glob.substr(2);
|
|
30
|
+
}
|
|
31
|
+
if (glob.charAt(0) === "/") {
|
|
32
|
+
glob = glob.substr(1);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
base,
|
|
36
|
+
glob
|
|
37
|
+
};
|
|
38
|
+
}
|
|
9
39
|
function parseDependency(normalizedFileOrGlob) {
|
|
10
40
|
if (normalizedFileOrGlob.startsWith("!")) {
|
|
11
41
|
return null;
|
|
12
42
|
}
|
|
13
43
|
let message;
|
|
14
|
-
if ((0, _isGlob
|
|
44
|
+
if ((0, _isGlob.default)(normalizedFileOrGlob)) {
|
|
15
45
|
let { base , glob } = parseGlob(normalizedFileOrGlob);
|
|
16
46
|
message = {
|
|
17
47
|
type: "dir-dependency",
|
|
@@ -34,30 +64,3 @@ function parseDependency(normalizedFileOrGlob) {
|
|
|
34
64
|
}
|
|
35
65
|
return message;
|
|
36
66
|
}
|
|
37
|
-
function _interopRequireDefault(obj) {
|
|
38
|
-
return obj && obj.__esModule ? obj : {
|
|
39
|
-
default: obj
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
// Based on `glob-base`
|
|
43
|
-
// https://github.com/micromatch/glob-base/blob/master/index.js
|
|
44
|
-
function parseGlob(pattern) {
|
|
45
|
-
let glob = pattern;
|
|
46
|
-
let base = (0, _globParent).default(pattern);
|
|
47
|
-
if (base !== ".") {
|
|
48
|
-
glob = pattern.substr(base.length);
|
|
49
|
-
if (glob.charAt(0) === "/") {
|
|
50
|
-
glob = glob.substr(1);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (glob.substr(0, 2) === "./") {
|
|
54
|
-
glob = glob.substr(2);
|
|
55
|
-
}
|
|
56
|
-
if (glob.charAt(0) === "/") {
|
|
57
|
-
glob = glob.substr(1);
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
base,
|
|
61
|
-
glob
|
|
62
|
-
};
|
|
63
|
-
}
|
|
@@ -2,10 +2,18 @@
|
|
|
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"));
|
|
12
|
+
function _interopRequireDefault(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
9
17
|
function parseObjectStyles(styles) {
|
|
10
18
|
if (!Array.isArray(styles)) {
|
|
11
19
|
return parseObjectStyles([
|
|
@@ -13,8 +21,8 @@ function parseObjectStyles(styles) {
|
|
|
13
21
|
]);
|
|
14
22
|
}
|
|
15
23
|
return styles.flatMap((style)=>{
|
|
16
|
-
return (0, _postcss
|
|
17
|
-
(0, _postcssNested
|
|
24
|
+
return (0, _postcss.default)([
|
|
25
|
+
(0, _postcssNested.default)({
|
|
18
26
|
bubble: [
|
|
19
27
|
"screen"
|
|
20
28
|
]
|
|
@@ -24,8 +32,3 @@ function parseObjectStyles(styles) {
|
|
|
24
32
|
}).root.nodes;
|
|
25
33
|
});
|
|
26
34
|
}
|
|
27
|
-
function _interopRequireDefault(obj) {
|
|
28
|
-
return obj && obj.__esModule ? obj : {
|
|
29
|
-
default: obj
|
|
30
|
-
};
|
|
31
|
-
}
|
package/lib/util/pluginUtils.js
CHANGED
|
@@ -2,33 +2,41 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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"));
|
|
16
24
|
function _interopRequireDefault(obj) {
|
|
17
25
|
return obj && obj.__esModule ? obj : {
|
|
18
26
|
default: obj
|
|
19
27
|
};
|
|
20
28
|
}
|
|
21
|
-
function updateAllClasses(
|
|
22
|
-
let parser = (0, _postcssSelectorParser
|
|
29
|
+
function updateAllClasses(selectors, updateClass) {
|
|
30
|
+
let parser = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
23
31
|
selectors.walkClasses((sel)=>{
|
|
24
32
|
let updatedClass = updateClass(sel.value);
|
|
25
33
|
sel.value = updatedClass;
|
|
26
34
|
if (sel.raws && sel.raws.value) {
|
|
27
|
-
sel.raws.value = (0, _escapeCommas
|
|
35
|
+
sel.raws.value = (0, _escapeCommas.default)(sel.raws.value);
|
|
28
36
|
}
|
|
29
37
|
});
|
|
30
38
|
});
|
|
31
|
-
let result = parser.processSync(
|
|
39
|
+
let result = parser.processSync(selectors);
|
|
32
40
|
return result;
|
|
33
41
|
}
|
|
34
42
|
function resolveArbitraryValue(modifier, validate) {
|
|
@@ -39,19 +47,19 @@ function resolveArbitraryValue(modifier, validate) {
|
|
|
39
47
|
if (!validate(value)) {
|
|
40
48
|
return undefined;
|
|
41
49
|
}
|
|
42
|
-
return (0, _dataTypes
|
|
50
|
+
return (0, _dataTypes.normalize)(value);
|
|
43
51
|
}
|
|
44
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
65
|
function asValue(modifier, options = {}, { validate =()=>true } = {}) {
|
|
@@ -103,12 +111,12 @@ function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
|
103
111
|
}
|
|
104
112
|
normalizedColor = parseColorFormat(normalizedColor);
|
|
105
113
|
if (isArbitraryValue(alpha)) {
|
|
106
|
-
return (0, _withAlphaVariable
|
|
114
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, alpha.slice(1, -1));
|
|
107
115
|
}
|
|
108
116
|
if (((ref3 = tailwindConfig.theme) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.opacity) === null || ref4 === void 0 ? void 0 : ref4[alpha]) === undefined) {
|
|
109
117
|
return undefined;
|
|
110
118
|
}
|
|
111
|
-
return (0, _withAlphaVariable
|
|
119
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalizedColor, tailwindConfig.theme.opacity[alpha]);
|
|
112
120
|
}
|
|
113
121
|
return asValue(modifier, options, {
|
|
114
122
|
validate: _dataTypes.color
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
9
|
+
const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
|
|
7
10
|
function _interopRequireDefault(obj) {
|
|
8
11
|
return obj && obj.__esModule ? obj : {
|
|
9
12
|
default: obj
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
15
|
function _default(prefix, selector, prependNegative = false) {
|
|
13
|
-
return (0, _postcssSelectorParser
|
|
16
|
+
return (0, _postcssSelectorParser.default)((selectors)=>{
|
|
14
17
|
selectors.walkClasses((classSelector)=>{
|
|
15
18
|
let baseClass = classSelector.value;
|
|
16
19
|
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
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";
|
|
2
10
|
Object.defineProperty(exports, "__esModule", {
|
|
3
11
|
value: true
|
|
4
12
|
});
|
|
5
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "removeAlphaVariables", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: ()=>removeAlphaVariables
|
|
16
|
+
});
|
|
6
17
|
function removeAlphaVariables(container, toRemove) {
|
|
7
18
|
container.walkDecls((decl)=>{
|
|
8
19
|
if (toRemove.includes(decl.prop)) {
|
|
@@ -2,41 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
prefix: "",
|
|
24
|
-
important: false,
|
|
25
|
-
separator: ":",
|
|
26
|
-
variantOrder: _defaultConfigStub.default.variantOrder
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
var ref, ref1;
|
|
30
|
-
return (0, _normalizeConfig).normalizeConfig((0, _defaults).defaults({
|
|
31
|
-
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
32
|
-
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
|
|
33
|
-
})))),
|
|
34
|
-
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
|
35
|
-
plugins: resolvePluginLists(configs.map((c)=>{
|
|
36
|
-
return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
|
|
37
|
-
}))
|
|
38
|
-
}, ...allConfigs));
|
|
39
|
-
}
|
|
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"));
|
|
40
22
|
function _interopRequireDefault(obj) {
|
|
41
23
|
return obj && obj.__esModule ? obj : {
|
|
42
24
|
default: obj
|
|
@@ -71,7 +53,7 @@ const configUtils = {
|
|
|
71
53
|
negative (scale) {
|
|
72
54
|
// TODO: Log that this function isn't really needed anymore?
|
|
73
55
|
return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
|
|
74
|
-
let negativeValue = (0, _negateValue
|
|
56
|
+
let negativeValue = (0, _negateValue.default)(scale[key]);
|
|
75
57
|
if (negativeValue !== undefined) {
|
|
76
58
|
negativeScale[`-${key}`] = negativeValue;
|
|
77
59
|
}
|
|
@@ -111,27 +93,27 @@ function collectExtends(items) {
|
|
|
111
93
|
}
|
|
112
94
|
function mergeThemes(themes) {
|
|
113
95
|
return {
|
|
114
|
-
...themes.reduce((merged, theme)=>(0, _defaults
|
|
96
|
+
...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
|
|
115
97
|
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
116
98
|
// into arrays instead of objects so they aren't overridden.
|
|
117
99
|
extend: collectExtends(themes)
|
|
118
100
|
};
|
|
119
101
|
}
|
|
120
|
-
function mergeExtensionCustomizer(merged,
|
|
102
|
+
function mergeExtensionCustomizer(merged, value) {
|
|
121
103
|
// When we have an array of objects, we do want to merge it
|
|
122
104
|
if (Array.isArray(merged) && isObject(merged[0])) {
|
|
123
|
-
return merged.concat(
|
|
105
|
+
return merged.concat(value);
|
|
124
106
|
}
|
|
125
107
|
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
126
|
-
if (Array.isArray(
|
|
108
|
+
if (Array.isArray(value) && isObject(value[0]) && isObject(merged)) {
|
|
127
109
|
return [
|
|
128
110
|
merged,
|
|
129
|
-
...
|
|
111
|
+
...value
|
|
130
112
|
];
|
|
131
113
|
}
|
|
132
114
|
// Override arrays (for example for font-families, box-shadows, ...)
|
|
133
|
-
if (Array.isArray(
|
|
134
|
-
return
|
|
115
|
+
if (Array.isArray(value)) {
|
|
116
|
+
return value;
|
|
135
117
|
}
|
|
136
118
|
// Execute default behaviour
|
|
137
119
|
return undefined;
|
|
@@ -153,7 +135,7 @@ function mergeExtensions({ extend , ...theme }) {
|
|
|
153
135
|
* @param {string} key
|
|
154
136
|
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
155
137
|
*/ function* toPaths(key) {
|
|
156
|
-
let path = (0, _toPath
|
|
138
|
+
let path = (0, _toPath.toPath)(key);
|
|
157
139
|
if (path.length === 0) {
|
|
158
140
|
return;
|
|
159
141
|
}
|
|
@@ -165,7 +147,7 @@ function mergeExtensions({ extend , ...theme }) {
|
|
|
165
147
|
let matches = key.match(pattern);
|
|
166
148
|
if (matches !== null) {
|
|
167
149
|
let [, prefix, alpha] = matches;
|
|
168
|
-
let newPath = (0, _toPath
|
|
150
|
+
let newPath = (0, _toPath.toPath)(prefix);
|
|
169
151
|
newPath.alpha = alpha;
|
|
170
152
|
yield newPath;
|
|
171
153
|
}
|
|
@@ -183,11 +165,11 @@ function resolveFunctionKeys(object) {
|
|
|
183
165
|
}
|
|
184
166
|
if (val !== undefined) {
|
|
185
167
|
if (path.alpha !== undefined) {
|
|
186
|
-
let normalized = (0, _pluginUtils
|
|
187
|
-
return (0, _withAlphaVariable
|
|
168
|
+
let normalized = (0, _pluginUtils.parseColorFormat)(val);
|
|
169
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
|
|
188
170
|
}
|
|
189
|
-
if ((0, _isPlainObject
|
|
190
|
-
return (0, _cloneDeep
|
|
171
|
+
if ((0, _isPlainObject.default)(val)) {
|
|
172
|
+
return (0, _cloneDeep.cloneDeep)(val);
|
|
191
173
|
}
|
|
192
174
|
return val;
|
|
193
175
|
}
|
|
@@ -210,8 +192,8 @@ function extractPluginConfigs(configs) {
|
|
|
210
192
|
...allConfigs,
|
|
211
193
|
config
|
|
212
194
|
];
|
|
213
|
-
var
|
|
214
|
-
const plugins = (
|
|
195
|
+
var ref;
|
|
196
|
+
const plugins = (ref = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref !== void 0 ? ref : [];
|
|
215
197
|
if (plugins.length === 0) {
|
|
216
198
|
return;
|
|
217
199
|
}
|
|
@@ -239,7 +221,7 @@ function resolveCorePlugins(corePluginConfigs) {
|
|
|
239
221
|
corePlugins: resolved
|
|
240
222
|
});
|
|
241
223
|
}
|
|
242
|
-
return (0, _configurePlugins
|
|
224
|
+
return (0, _configurePlugins.default)(corePluginConfig, resolved);
|
|
243
225
|
}, _corePluginList.default);
|
|
244
226
|
return result;
|
|
245
227
|
}
|
|
@@ -254,3 +236,24 @@ function resolvePluginLists(pluginLists) {
|
|
|
254
236
|
}, []);
|
|
255
237
|
return result;
|
|
256
238
|
}
|
|
239
|
+
function resolveConfig(configs) {
|
|
240
|
+
let allConfigs = [
|
|
241
|
+
...extractPluginConfigs(configs),
|
|
242
|
+
{
|
|
243
|
+
prefix: "",
|
|
244
|
+
important: false,
|
|
245
|
+
separator: ":",
|
|
246
|
+
variantOrder: _defaultConfigStub.default.variantOrder
|
|
247
|
+
},
|
|
248
|
+
];
|
|
249
|
+
var ref, ref1;
|
|
250
|
+
return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
|
|
251
|
+
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
252
|
+
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
|
|
253
|
+
})))),
|
|
254
|
+
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
|
255
|
+
plugins: resolvePluginLists(configs.map((c)=>{
|
|
256
|
+
return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
|
|
257
|
+
}))
|
|
258
|
+
}, ...allConfigs));
|
|
259
|
+
}
|
|
@@ -2,9 +2,26 @@
|
|
|
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"));
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function isObject(value) {
|
|
17
|
+
return typeof value === "object" && value !== null;
|
|
18
|
+
}
|
|
19
|
+
function isEmpty(obj) {
|
|
20
|
+
return Object.keys(obj).length === 0;
|
|
21
|
+
}
|
|
22
|
+
function isString(value) {
|
|
23
|
+
return typeof value === "string" || value instanceof String;
|
|
24
|
+
}
|
|
8
25
|
function resolveConfigPath(pathOrConfig) {
|
|
9
26
|
// require('tailwindcss')({ theme: ..., variants: ... })
|
|
10
27
|
if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
|
|
@@ -35,17 +52,3 @@ function resolveConfigPath(pathOrConfig) {
|
|
|
35
52
|
}
|
|
36
53
|
return null;
|
|
37
54
|
}
|
|
38
|
-
function _interopRequireDefault(obj) {
|
|
39
|
-
return obj && obj.__esModule ? obj : {
|
|
40
|
-
default: obj
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function isObject(value) {
|
|
44
|
-
return typeof value === "object" && value !== null;
|
|
45
|
-
}
|
|
46
|
-
function isEmpty(obj) {
|
|
47
|
-
return Object.keys(obj).length === 0;
|
|
48
|
-
}
|
|
49
|
-
function isString(value) {
|
|
50
|
-
return typeof value === "string" || value instanceof String;
|
|
51
|
-
}
|
package/lib/util/responsive.js
CHANGED
|
@@ -2,18 +2,21 @@
|
|
|
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"));
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
8
16
|
function responsive(rules) {
|
|
9
17
|
return _postcss.default.atRule({
|
|
10
18
|
name: "responsive"
|
|
11
|
-
}).append((0, _cloneNodes
|
|
19
|
+
}).append((0, _cloneNodes.default)(Array.isArray(rules) ? rules : [
|
|
12
20
|
rules
|
|
13
21
|
]));
|
|
14
22
|
}
|
|
15
|
-
function _interopRequireDefault(obj) {
|
|
16
|
-
return obj && obj.__esModule ? obj : {
|
|
17
|
-
default: obj
|
|
18
|
-
};
|
|
19
|
-
}
|