tailwindcss 0.0.0-insiders.ca1dfd6 → 0.0.0-insiders.cb6e45a
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 +526 -2
- 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/build/deps.js +54 -0
- package/lib/cli/build/index.js +44 -0
- package/lib/cli/build/plugin.js +335 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +113 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +18 -0
- package/lib/cli/init/index.js +46 -0
- package/lib/cli/shared.js +12 -0
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +91 -569
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +16 -4
- package/lib/corePlugins.js +2247 -1873
- package/lib/css/preflight.css +20 -9
- package/lib/featureFlags.js +37 -23
- package/lib/index.js +28 -12
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +27 -9
- package/lib/lib/collapseDuplicateDeclarations.js +83 -0
- package/lib/lib/content.js +167 -0
- package/lib/lib/defaultExtractor.js +236 -0
- package/lib/lib/detectNesting.js +21 -3
- package/lib/lib/evaluateTailwindFunctions.js +117 -50
- package/lib/lib/expandApplyAtRules.js +439 -160
- package/lib/lib/expandTailwindAtRules.js +141 -151
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +572 -105
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +45 -33
- package/lib/lib/offsets.js +217 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +114 -81
- package/lib/lib/setupContextUtils.js +777 -385
- package/lib/lib/setupTrackingContext.js +43 -71
- package/lib/lib/sharedState.js +49 -18
- 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 -21
- package/lib/public/colors.js +250 -252
- 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 +18 -24
- 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 +5 -2
- package/lib/util/createPlugin.js +6 -6
- package/lib/util/createUtilityPlugin.js +11 -13
- package/lib/util/dataTypes.js +137 -100
- 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 +285 -0
- 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 +44 -22
- package/lib/util/nameClass.js +20 -8
- package/lib/util/negateValue.js +23 -6
- package/lib/util/normalizeConfig.js +267 -0
- package/lib/util/normalizeScreens.js +170 -0
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +84 -0
- package/lib/util/parseDependency.js +38 -56
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +11 -8
- package/lib/util/pluginUtils.js +171 -189
- package/lib/util/prefixSelector.js +10 -10
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +92 -126
- 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 +49 -31
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +23 -15
- package/nesting/index.js +2 -12
- package/package.json +48 -46
- package/peers/index.js +14817 -12471
- package/plugin.d.ts +11 -0
- package/plugin.js +2 -1
- package/resolveConfig.d.ts +3 -0
- package/resolveConfig.js +2 -1
- package/scripts/create-plugin-list.js +2 -2
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +45 -0
- package/src/cli/build/plugin.js +397 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +134 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +3 -0
- package/src/cli/init/index.js +50 -0
- package/src/cli/shared.js +5 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +26 -565
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +905 -615
- package/src/css/preflight.css +20 -9
- package/src/featureFlags.js +26 -10
- package/src/index.js +19 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +93 -0
- package/src/lib/content.js +205 -0
- package/src/lib/defaultExtractor.js +211 -0
- package/src/lib/detectNesting.js +22 -3
- package/src/lib/evaluateTailwindFunctions.js +84 -10
- package/src/lib/expandApplyAtRules.js +488 -153
- package/src/lib/expandTailwindAtRules.js +94 -106
- package/src/lib/findAtConfigPath.js +50 -0
- package/src/lib/generateRules.js +589 -67
- package/src/lib/normalizeTailwindDirectives.js +10 -3
- package/src/lib/offsets.js +270 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +98 -60
- package/src/lib/setupContextUtils.js +737 -246
- package/src/lib/setupTrackingContext.js +16 -54
- package/src/lib/sharedState.js +44 -7
- package/src/lib/substituteScreenAtRules.js +6 -3
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +17 -2
- package/src/public/colors.js +4 -9
- package/src/util/buildMediaQuery.js +14 -16
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +31 -14
- package/src/util/createUtilityPlugin.js +2 -2
- package/src/util/dataTypes.js +57 -21
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +319 -0
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/log.js +23 -22
- package/src/util/nameClass.js +6 -2
- package/src/util/negateValue.js +14 -4
- package/src/util/normalizeConfig.js +282 -0
- package/src/util/normalizeScreens.js +140 -0
- package/src/util/parseBoxShadowValue.js +72 -0
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +144 -152
- package/src/util/prefixSelector.js +7 -8
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +82 -81
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +33 -8
- package/src/util/validateConfig.js +13 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/stubs/defaultConfig.stub.js +173 -93
- package/stubs/simpleConfig.stub.js +1 -1
- package/types/config.d.ts +361 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +342 -0
- package/types/index.d.ts +7 -0
- package/lib/lib/setupWatchingContext.js +0 -284
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -306
|
@@ -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
|
}
|
|
@@ -43,22 +51,20 @@ function mergeWith(target, ...sources) {
|
|
|
43
51
|
const configUtils = {
|
|
44
52
|
colors: _colors.default,
|
|
45
53
|
negative (scale) {
|
|
46
|
-
|
|
47
|
-
).reduce((negativeScale, key)=>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
// TODO: Log that this function isn't really needed anymore?
|
|
55
|
+
return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
|
|
56
|
+
let negativeValue = (0, _negateValue.default)(scale[key]);
|
|
57
|
+
if (negativeValue !== undefined) {
|
|
58
|
+
negativeScale[`-${key}`] = negativeValue;
|
|
59
|
+
}
|
|
60
|
+
return negativeScale;
|
|
61
|
+
}, {});
|
|
53
62
|
},
|
|
54
63
|
breakpoints (screens) {
|
|
55
|
-
return Object.keys(screens).filter((key)=>typeof screens[key] ===
|
|
56
|
-
).reduce((breakpoints, key)=>({
|
|
64
|
+
return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
|
|
57
65
|
...breakpoints,
|
|
58
66
|
[`screen-${key}`]: screens[key]
|
|
59
|
-
})
|
|
60
|
-
, {
|
|
61
|
-
});
|
|
67
|
+
}), {});
|
|
62
68
|
}
|
|
63
69
|
};
|
|
64
70
|
function value(valueToResolve, ...args) {
|
|
@@ -83,14 +89,11 @@ function collectExtends(items) {
|
|
|
83
89
|
mergedValue
|
|
84
90
|
];
|
|
85
91
|
});
|
|
86
|
-
}, {
|
|
87
|
-
});
|
|
92
|
+
}, {});
|
|
88
93
|
}
|
|
89
94
|
function mergeThemes(themes) {
|
|
90
95
|
return {
|
|
91
|
-
...themes.reduce((merged, theme)=>(0, _defaults
|
|
92
|
-
, {
|
|
93
|
-
}),
|
|
96
|
+
...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
|
|
94
97
|
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
95
98
|
// into arrays instead of objects so they aren't overridden.
|
|
96
99
|
extend: collectExtends(themes)
|
|
@@ -119,40 +122,68 @@ function mergeExtensions({ extend , ...theme }) {
|
|
|
119
122
|
return mergeWith(theme, extend, (themeValue, extensions)=>{
|
|
120
123
|
// The `extend` property is an array, so we need to check if it contains any functions
|
|
121
124
|
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
122
|
-
return mergeWith({
|
|
123
|
-
}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
125
|
+
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
124
126
|
}
|
|
125
|
-
return (resolveThemePath, utils)=>mergeWith({
|
|
126
|
-
}, ...[
|
|
127
|
+
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
|
127
128
|
themeValue,
|
|
128
129
|
...extensions
|
|
129
|
-
].map((e)=>value(e, resolveThemePath, utils)
|
|
130
|
-
), mergeExtensionCustomizer)
|
|
131
|
-
;
|
|
130
|
+
].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
|
132
131
|
});
|
|
133
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
|
+
}
|
|
134
155
|
function resolveFunctionKeys(object) {
|
|
156
|
+
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
135
157
|
const resolvePath = (key, defaultValue)=>{
|
|
136
|
-
const path
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
+
}
|
|
142
176
|
}
|
|
143
|
-
return
|
|
177
|
+
return defaultValue;
|
|
144
178
|
};
|
|
145
|
-
resolvePath
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
return Object.keys(object).reduce((resolved, key)=>{
|
|
150
|
-
return {
|
|
151
|
-
...resolved,
|
|
152
|
-
[key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
|
|
153
|
-
};
|
|
154
|
-
}, {
|
|
179
|
+
Object.assign(resolvePath, {
|
|
180
|
+
theme: resolvePath,
|
|
181
|
+
...configUtils
|
|
155
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
|
+
}, {});
|
|
156
187
|
}
|
|
157
188
|
function extractPluginConfigs(configs) {
|
|
158
189
|
let allConfigs = [];
|
|
@@ -174,8 +205,7 @@ function extractPluginConfigs(configs) {
|
|
|
174
205
|
allConfigs = [
|
|
175
206
|
...allConfigs,
|
|
176
207
|
...extractPluginConfigs([
|
|
177
|
-
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {
|
|
178
|
-
}
|
|
208
|
+
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
|
|
179
209
|
])
|
|
180
210
|
];
|
|
181
211
|
});
|
|
@@ -191,7 +221,7 @@ function resolveCorePlugins(corePluginConfigs) {
|
|
|
191
221
|
corePlugins: resolved
|
|
192
222
|
});
|
|
193
223
|
}
|
|
194
|
-
return (0, _configurePlugins
|
|
224
|
+
return (0, _configurePlugins.default)(corePluginConfig, resolved);
|
|
195
225
|
}, _corePluginList.default);
|
|
196
226
|
return result;
|
|
197
227
|
}
|
|
@@ -210,84 +240,20 @@ function resolveConfig(configs) {
|
|
|
210
240
|
let allConfigs = [
|
|
211
241
|
...extractPluginConfigs(configs),
|
|
212
242
|
{
|
|
213
|
-
prefix:
|
|
243
|
+
prefix: "",
|
|
214
244
|
important: false,
|
|
215
|
-
separator:
|
|
245
|
+
separator: ":",
|
|
216
246
|
variantOrder: _defaultConfigStub.default.variantOrder
|
|
217
|
-
}
|
|
247
|
+
}
|
|
218
248
|
];
|
|
219
249
|
var ref, ref1;
|
|
220
|
-
return normalizeConfig((0, _defaults
|
|
250
|
+
return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
|
|
221
251
|
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
222
|
-
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
|
|
223
|
-
};
|
|
252
|
+
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
|
|
224
253
|
})))),
|
|
225
|
-
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
|
|
226
|
-
)),
|
|
254
|
+
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
|
227
255
|
plugins: resolvePluginLists(configs.map((c)=>{
|
|
228
256
|
return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
|
|
229
257
|
}))
|
|
230
258
|
}, ...allConfigs));
|
|
231
259
|
}
|
|
232
|
-
let warnedAbout = new Set();
|
|
233
|
-
function normalizeConfig(config) {
|
|
234
|
-
var ref, ref1, ref2, ref3, ref4, ref5;
|
|
235
|
-
if (!warnedAbout.has('purge-deprecation') && config.hasOwnProperty('purge')) {
|
|
236
|
-
_log.default.warn([
|
|
237
|
-
'The `purge` option in your tailwind.config.js file has been deprecated.',
|
|
238
|
-
'Please rename this to `content` instead.',
|
|
239
|
-
]);
|
|
240
|
-
warnedAbout.add('purge-deprecation');
|
|
241
|
-
}
|
|
242
|
-
config.content = {
|
|
243
|
-
content: (()=>{
|
|
244
|
-
let { content , purge } = config;
|
|
245
|
-
if (Array.isArray(purge)) return purge;
|
|
246
|
-
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
|
|
247
|
-
if (Array.isArray(content)) return content;
|
|
248
|
-
if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
|
|
249
|
-
return [];
|
|
250
|
-
})(),
|
|
251
|
-
safelist: (()=>{
|
|
252
|
-
let { content , purge } = config;
|
|
253
|
-
let [safelistKey, safelistPaths] = (()=>{
|
|
254
|
-
var ref;
|
|
255
|
-
if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return [
|
|
256
|
-
'content.safelist',
|
|
257
|
-
content.safelist
|
|
258
|
-
];
|
|
259
|
-
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return [
|
|
260
|
-
'purge.safelist',
|
|
261
|
-
purge.safelist
|
|
262
|
-
];
|
|
263
|
-
if (Array.isArray(purge === null || purge === void 0 ? void 0 : (ref = purge.options) === null || ref === void 0 ? void 0 : ref.safelist)) return [
|
|
264
|
-
'purge.options.safelist',
|
|
265
|
-
purge.options.safelist
|
|
266
|
-
];
|
|
267
|
-
return [
|
|
268
|
-
null,
|
|
269
|
-
[]
|
|
270
|
-
];
|
|
271
|
-
})();
|
|
272
|
-
return safelistPaths.map((content)=>{
|
|
273
|
-
if (typeof content === 'string') {
|
|
274
|
-
return {
|
|
275
|
-
raw: content,
|
|
276
|
-
extension: 'html'
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
if (content instanceof RegExp) {
|
|
280
|
-
throw new Error(`Values inside '${safelistKey}' can only be of type 'string', found 'regex'.`);
|
|
281
|
-
}
|
|
282
|
-
throw new Error(`Values inside '${safelistKey}' can only be of type 'string', found '${typeof content}'.`);
|
|
283
|
-
});
|
|
284
|
-
})(),
|
|
285
|
-
extract: ((ref = config.content) === null || ref === void 0 ? void 0 : ref.extract) || ((ref1 = config.purge) === null || ref1 === void 0 ? void 0 : ref1.extract) || {
|
|
286
|
-
},
|
|
287
|
-
options: ((ref2 = config.content) === null || ref2 === void 0 ? void 0 : ref2.options) || ((ref3 = config.purge) === null || ref3 === void 0 ? void 0 : ref3.options) || {
|
|
288
|
-
},
|
|
289
|
-
transform: ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : ref4.transform) || ((ref5 = config.purge) === null || ref5 === void 0 ? void 0 : ref5.transform) || {
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
return config;
|
|
293
|
-
}
|
|
@@ -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
|
}
|
package/lib/util/toPath.js
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Parse a path string into an array of path segments.
|
|
3
|
+
*
|
|
4
|
+
* Square bracket notation `a[b]` may be used to "escape" dots that would otherwise be interpreted as path separators.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* a -> ['a']
|
|
8
|
+
* a.b.c -> ['a', 'b', 'c']
|
|
9
|
+
* a[b].c -> ['a', 'b', 'c']
|
|
10
|
+
* a[b.c].e.f -> ['a', 'b.c', 'e', 'f']
|
|
11
|
+
* a[b][c][d] -> ['a', 'b', 'c', 'd']
|
|
12
|
+
*
|
|
13
|
+
* @param {string|string[]} path
|
|
14
|
+
**/ "use strict";
|
|
2
15
|
Object.defineProperty(exports, "__esModule", {
|
|
3
16
|
value: true
|
|
4
17
|
});
|
|
5
|
-
exports
|
|
18
|
+
Object.defineProperty(exports, "toPath", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: ()=>toPath
|
|
21
|
+
});
|
|
6
22
|
function toPath(path) {
|
|
7
23
|
if (Array.isArray(path)) return path;
|
|
8
|
-
|
|
24
|
+
let openBrackets = path.split("[").length - 1;
|
|
25
|
+
let closedBrackets = path.split("]").length - 1;
|
|
26
|
+
if (openBrackets !== closedBrackets) {
|
|
27
|
+
throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
|
|
28
|
+
}
|
|
29
|
+
return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
|
|
9
30
|
}
|
|
@@ -2,8 +2,12 @@
|
|
|
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: ()=>transformThemeValue
|
|
8
|
+
});
|
|
9
|
+
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
10
|
+
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
|
|
7
11
|
function _interopRequireDefault(obj) {
|
|
8
12
|
return obj && obj.__esModule ? obj : {
|
|
9
13
|
default: obj
|
|
@@ -11,43 +15,57 @@ function _interopRequireDefault(obj) {
|
|
|
11
15
|
}
|
|
12
16
|
function transformThemeValue(themeSection) {
|
|
13
17
|
if ([
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
"fontSize",
|
|
19
|
+
"outline"
|
|
16
20
|
].includes(themeSection)) {
|
|
17
|
-
return (value)=>
|
|
18
|
-
|
|
21
|
+
return (value)=>{
|
|
22
|
+
if (typeof value === "function") value = value({});
|
|
23
|
+
if (Array.isArray(value)) value = value[0];
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (themeSection === "fontFamily") {
|
|
28
|
+
return (value)=>{
|
|
29
|
+
if (typeof value === "function") value = value({});
|
|
30
|
+
let families = Array.isArray(value) && (0, _isPlainObject.default)(value[1]) ? value[0] : value;
|
|
31
|
+
return Array.isArray(families) ? families.join(", ") : families;
|
|
32
|
+
};
|
|
19
33
|
}
|
|
20
34
|
if ([
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'animation',
|
|
35
|
+
"boxShadow",
|
|
36
|
+
"transitionProperty",
|
|
37
|
+
"transitionDuration",
|
|
38
|
+
"transitionDelay",
|
|
39
|
+
"transitionTimingFunction",
|
|
40
|
+
"backgroundImage",
|
|
41
|
+
"backgroundSize",
|
|
42
|
+
"backgroundColor",
|
|
43
|
+
"cursor",
|
|
44
|
+
"animation"
|
|
32
45
|
].includes(themeSection)) {
|
|
33
|
-
return (value)=>
|
|
34
|
-
|
|
46
|
+
return (value)=>{
|
|
47
|
+
if (typeof value === "function") value = value({});
|
|
48
|
+
if (Array.isArray(value)) value = value.join(", ");
|
|
49
|
+
return value;
|
|
50
|
+
};
|
|
35
51
|
}
|
|
36
52
|
// For backwards compatibility reasons, before we switched to underscores
|
|
37
53
|
// instead of commas for arbitrary values.
|
|
38
54
|
if ([
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
"gridTemplateColumns",
|
|
56
|
+
"gridTemplateRows",
|
|
57
|
+
"objectPosition"
|
|
42
58
|
].includes(themeSection)) {
|
|
43
|
-
return (value)=>
|
|
44
|
-
|
|
59
|
+
return (value)=>{
|
|
60
|
+
if (typeof value === "function") value = value({});
|
|
61
|
+
if (typeof value === "string") value = _postcss.default.list.comma(value).join(" ");
|
|
62
|
+
return value;
|
|
63
|
+
};
|
|
45
64
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
;
|
|
65
|
+
return (value, opts = {})=>{
|
|
66
|
+
if (typeof value === "function") {
|
|
67
|
+
value = value(opts);
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
};
|
|
53
71
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "validateConfig", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>validateConfig
|
|
8
|
+
});
|
|
9
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("./log"));
|
|
10
|
+
function _interopRequireDefault(obj) {
|
|
11
|
+
return obj && obj.__esModule ? obj : {
|
|
12
|
+
default: obj
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function validateConfig(config) {
|
|
16
|
+
if (config.content.files.length === 0) {
|
|
17
|
+
_log.default.warn("content-problems", [
|
|
18
|
+
"The `content` option in your Tailwind CSS configuration is missing or empty.",
|
|
19
|
+
"Configure your content sources or your generated CSS will be missing styles.",
|
|
20
|
+
"https://tailwindcss.com/docs/content-configuration"
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
return config;
|
|
24
|
+
}
|