tailwindcss 0.0.0-insiders.fe08e91 → 0.0.0-oxide.956419c
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 +384 -3
- package/LICENSE +1 -2
- package/README.md +12 -8
- package/colors.d.ts +3 -0
- package/defaultConfig.d.ts +3 -0
- package/defaultTheme.d.ts +4 -0
- package/lib/cli/build/deps.js +54 -0
- package/lib/cli/build/index.js +48 -0
- package/lib/cli/build/plugin.js +367 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +178 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +239 -0
- package/lib/cli/init/index.js +46 -0
- package/lib/cli/shared.js +13 -0
- package/lib/cli-peer-dependencies.js +20 -7
- package/lib/cli.js +4 -740
- package/lib/constants.js +27 -20
- package/lib/corePluginList.js +6 -3
- package/lib/corePlugins.js +2064 -1811
- package/lib/css/preflight.css +5 -5
- package/lib/featureFlags.js +31 -22
- package/lib/index.js +4 -28
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +27 -9
- package/lib/lib/collapseDuplicateDeclarations.js +12 -9
- package/lib/lib/content.js +176 -0
- package/lib/lib/defaultExtractor.js +225 -31
- package/lib/lib/detectNesting.js +13 -10
- package/lib/lib/evaluateTailwindFunctions.js +118 -55
- package/lib/lib/expandApplyAtRules.js +439 -190
- package/lib/lib/expandTailwindAtRules.js +151 -134
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +454 -187
- package/lib/lib/getModuleDependencies.js +11 -8
- package/lib/lib/normalizeTailwindDirectives.js +36 -32
- 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 +89 -67
- package/lib/lib/setupContextUtils.js +667 -376
- package/lib/lib/setupTrackingContext.js +38 -67
- package/lib/lib/sharedState.js +27 -14
- package/lib/lib/substituteScreenAtRules.js +11 -9
- package/lib/oxide/cli.d.js +1 -0
- package/lib/oxide/cli.js +2 -0
- package/lib/oxide/postcss-plugin.d.js +1 -0
- package/lib/oxide/postcss-plugin.js +2 -0
- package/lib/plugin.js +48 -0
- 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 +35 -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 +11 -6
- package/lib/util/cloneDeep.js +7 -6
- package/lib/util/cloneNodes.js +21 -3
- package/lib/util/color.js +53 -54
- package/lib/util/configurePlugins.js +5 -2
- package/lib/util/createPlugin.js +6 -6
- package/lib/util/createUtilityPlugin.js +12 -14
- package/lib/util/dataTypes.js +119 -110
- package/lib/util/defaults.js +4 -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 +184 -85
- 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 → isSyntacticallyValidPropertyValue.js} +23 -15
- package/lib/util/log.js +20 -14
- package/lib/util/nameClass.js +20 -9
- package/lib/util/negateValue.js +23 -8
- package/lib/util/normalizeConfig.js +116 -72
- package/lib/util/normalizeScreens.js +120 -11
- package/lib/util/parseAnimationValue.js +42 -40
- package/lib/util/parseBoxShadowValue.js +30 -23
- 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 +147 -50
- package/lib/util/prefixSelector.js +10 -8
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +97 -85
- 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 +20 -4
- package/lib/util/transformThemeValue.js +37 -29
- 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 +50 -45
- package/peers/index.js +11381 -7950
- package/plugin.d.ts +11 -0
- package/resolveConfig.d.ts +12 -0
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +49 -0
- package/src/cli/build/plugin.js +439 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +227 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +234 -0
- package/src/cli/init/index.js +50 -0
- package/src/cli/shared.js +6 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +4 -810
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +532 -217
- package/src/css/preflight.css +5 -5
- package/src/featureFlags.js +15 -9
- package/src/index.js +4 -27
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/content.js +212 -0
- package/src/lib/defaultExtractor.js +196 -33
- package/src/lib/evaluateTailwindFunctions.js +78 -7
- package/src/lib/expandApplyAtRules.js +482 -183
- package/src/lib/expandTailwindAtRules.js +106 -85
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +418 -129
- package/src/lib/normalizeTailwindDirectives.js +1 -0
- 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 +51 -30
- package/src/lib/setupContextUtils.js +556 -208
- package/src/lib/setupTrackingContext.js +11 -48
- package/src/lib/sharedState.js +5 -0
- package/src/oxide/cli.d.ts +0 -0
- package/src/oxide/cli.ts +1 -0
- package/src/oxide/postcss-plugin.d.ts +0 -0
- package/src/oxide/postcss-plugin.ts +1 -0
- package/src/plugin.js +47 -0
- 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 +8 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +25 -21
- package/src/util/dataTypes.js +29 -21
- package/src/util/formatVariantSelector.js +184 -61
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +8 -8
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +11 -3
- package/src/util/normalizeConfig.js +44 -6
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +4 -3
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +132 -10
- package/src/util/prefixSelector.js +7 -5
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +70 -32
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +1 -1
- package/src/util/transformThemeValue.js +13 -3
- 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 +167 -164
- package/stubs/simpleConfig.stub.js +1 -0
- package/types/config.d.ts +362 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +342 -0
- package/types/index.d.ts +7 -0
- package/nesting/plugin.js +0 -41
|
@@ -2,27 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 _colors = /*#__PURE__*/ _interopRequireDefault(require("../public/colors"));
|
|
13
|
+
const _defaults = require("./defaults");
|
|
14
|
+
const _toPath = require("./toPath");
|
|
15
|
+
const _normalizeConfig = require("./normalizeConfig");
|
|
16
|
+
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
|
|
17
|
+
const _cloneDeep = require("./cloneDeep");
|
|
18
|
+
const _pluginUtils = require("./pluginUtils");
|
|
19
|
+
const _withAlphaVariable = require("./withAlphaVariable");
|
|
20
|
+
const _toColorValue = /*#__PURE__*/ _interopRequireDefault(require("./toColorValue"));
|
|
16
21
|
function _interopRequireDefault(obj) {
|
|
17
22
|
return obj && obj.__esModule ? obj : {
|
|
18
23
|
default: obj
|
|
19
24
|
};
|
|
20
25
|
}
|
|
21
26
|
function isFunction(input) {
|
|
22
|
-
return typeof input ===
|
|
23
|
-
}
|
|
24
|
-
function isObject(input) {
|
|
25
|
-
return typeof input === 'object' && input !== null;
|
|
27
|
+
return typeof input === "function";
|
|
26
28
|
}
|
|
27
29
|
function mergeWith(target, ...sources) {
|
|
28
30
|
let customizer = sources.pop();
|
|
@@ -30,8 +32,8 @@ function mergeWith(target, ...sources) {
|
|
|
30
32
|
for(let k in source){
|
|
31
33
|
let merged = customizer(target[k], source[k]);
|
|
32
34
|
if (merged === undefined) {
|
|
33
|
-
if (
|
|
34
|
-
target[k] = mergeWith(target[k], source[k], customizer);
|
|
35
|
+
if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
|
|
36
|
+
target[k] = mergeWith({}, target[k], source[k], customizer);
|
|
35
37
|
} else {
|
|
36
38
|
target[k] = source[k];
|
|
37
39
|
}
|
|
@@ -46,24 +48,19 @@ const configUtils = {
|
|
|
46
48
|
colors: _colors.default,
|
|
47
49
|
negative (scale) {
|
|
48
50
|
// TODO: Log that this function isn't really needed anymore?
|
|
49
|
-
return Object.keys(scale).filter((key)=>scale[key] !==
|
|
50
|
-
|
|
51
|
-
let negativeValue = (0, _negateValue).default(scale[key]);
|
|
51
|
+
return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
|
|
52
|
+
let negativeValue = (0, _negateValue.default)(scale[key]);
|
|
52
53
|
if (negativeValue !== undefined) {
|
|
53
54
|
negativeScale[`-${key}`] = negativeValue;
|
|
54
55
|
}
|
|
55
56
|
return negativeScale;
|
|
56
|
-
}, {
|
|
57
|
-
});
|
|
57
|
+
}, {});
|
|
58
58
|
},
|
|
59
59
|
breakpoints (screens) {
|
|
60
|
-
return Object.keys(screens).filter((key)=>typeof screens[key] ===
|
|
61
|
-
).reduce((breakpoints, key)=>({
|
|
60
|
+
return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
|
|
62
61
|
...breakpoints,
|
|
63
62
|
[`screen-${key}`]: screens[key]
|
|
64
|
-
})
|
|
65
|
-
, {
|
|
66
|
-
});
|
|
63
|
+
}), {});
|
|
67
64
|
}
|
|
68
65
|
};
|
|
69
66
|
function value(valueToResolve, ...args) {
|
|
@@ -88,34 +85,31 @@ function collectExtends(items) {
|
|
|
88
85
|
mergedValue
|
|
89
86
|
];
|
|
90
87
|
});
|
|
91
|
-
}, {
|
|
92
|
-
});
|
|
88
|
+
}, {});
|
|
93
89
|
}
|
|
94
90
|
function mergeThemes(themes) {
|
|
95
91
|
return {
|
|
96
|
-
...themes.reduce((merged, theme)=>(0, _defaults
|
|
97
|
-
, {
|
|
98
|
-
}),
|
|
92
|
+
...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
|
|
99
93
|
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
100
94
|
// into arrays instead of objects so they aren't overridden.
|
|
101
95
|
extend: collectExtends(themes)
|
|
102
96
|
};
|
|
103
97
|
}
|
|
104
|
-
function mergeExtensionCustomizer(merged,
|
|
98
|
+
function mergeExtensionCustomizer(merged, value) {
|
|
105
99
|
// When we have an array of objects, we do want to merge it
|
|
106
|
-
if (Array.isArray(merged) &&
|
|
107
|
-
return merged.concat(
|
|
100
|
+
if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
|
|
101
|
+
return merged.concat(value);
|
|
108
102
|
}
|
|
109
103
|
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
110
|
-
if (Array.isArray(
|
|
104
|
+
if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
|
|
111
105
|
return [
|
|
112
106
|
merged,
|
|
113
|
-
...
|
|
107
|
+
...value
|
|
114
108
|
];
|
|
115
109
|
}
|
|
116
110
|
// Override arrays (for example for font-families, box-shadows, ...)
|
|
117
|
-
if (Array.isArray(
|
|
118
|
-
return
|
|
111
|
+
if (Array.isArray(value)) {
|
|
112
|
+
return value;
|
|
119
113
|
}
|
|
120
114
|
// Execute default behaviour
|
|
121
115
|
return undefined;
|
|
@@ -124,46 +118,68 @@ function mergeExtensions({ extend , ...theme }) {
|
|
|
124
118
|
return mergeWith(theme, extend, (themeValue, extensions)=>{
|
|
125
119
|
// The `extend` property is an array, so we need to check if it contains any functions
|
|
126
120
|
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
127
|
-
return mergeWith({
|
|
128
|
-
}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
121
|
+
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
129
122
|
}
|
|
130
|
-
return (resolveThemePath, utils)=>mergeWith({
|
|
131
|
-
}, ...[
|
|
123
|
+
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
|
132
124
|
themeValue,
|
|
133
125
|
...extensions
|
|
134
|
-
].map((e)=>value(e, resolveThemePath, utils)
|
|
135
|
-
), mergeExtensionCustomizer)
|
|
136
|
-
;
|
|
126
|
+
].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
|
137
127
|
});
|
|
138
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param {string} key
|
|
132
|
+
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
133
|
+
*/ function* toPaths(key) {
|
|
134
|
+
let path = (0, _toPath.toPath)(key);
|
|
135
|
+
if (path.length === 0) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
yield path;
|
|
139
|
+
if (Array.isArray(key)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
|
|
143
|
+
let matches = key.match(pattern);
|
|
144
|
+
if (matches !== null) {
|
|
145
|
+
let [, prefix, alpha] = matches;
|
|
146
|
+
let newPath = (0, _toPath.toPath)(prefix);
|
|
147
|
+
newPath.alpha = alpha;
|
|
148
|
+
yield newPath;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
139
151
|
function resolveFunctionKeys(object) {
|
|
152
|
+
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
140
153
|
const resolvePath = (key, defaultValue)=>{
|
|
141
|
-
const path
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
for (const path of toPaths(key)){
|
|
155
|
+
let index = 0;
|
|
156
|
+
let val = object;
|
|
157
|
+
while(val !== undefined && val !== null && index < path.length){
|
|
158
|
+
val = val[path[index++]];
|
|
159
|
+
let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
|
|
160
|
+
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
|
|
161
|
+
}
|
|
162
|
+
if (val !== undefined) {
|
|
163
|
+
if (path.alpha !== undefined) {
|
|
164
|
+
let normalized = (0, _pluginUtils.parseColorFormat)(val);
|
|
165
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
|
|
166
|
+
}
|
|
167
|
+
if ((0, _isPlainObject.default)(val)) {
|
|
168
|
+
return (0, _cloneDeep.cloneDeep)(val);
|
|
169
|
+
}
|
|
170
|
+
return val;
|
|
171
|
+
}
|
|
153
172
|
}
|
|
154
|
-
return
|
|
173
|
+
return defaultValue;
|
|
155
174
|
};
|
|
156
|
-
resolvePath
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
return Object.keys(object).reduce((resolved, key)=>{
|
|
161
|
-
return {
|
|
162
|
-
...resolved,
|
|
163
|
-
[key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
|
|
164
|
-
};
|
|
165
|
-
}, {
|
|
175
|
+
Object.assign(resolvePath, {
|
|
176
|
+
theme: resolvePath,
|
|
177
|
+
...configUtils
|
|
166
178
|
});
|
|
179
|
+
return Object.keys(object).reduce((resolved, key)=>{
|
|
180
|
+
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
|
|
181
|
+
return resolved;
|
|
182
|
+
}, {});
|
|
167
183
|
}
|
|
168
184
|
function extractPluginConfigs(configs) {
|
|
169
185
|
let allConfigs = [];
|
|
@@ -172,8 +188,8 @@ function extractPluginConfigs(configs) {
|
|
|
172
188
|
...allConfigs,
|
|
173
189
|
config
|
|
174
190
|
];
|
|
175
|
-
var
|
|
176
|
-
const plugins = (
|
|
191
|
+
var ref;
|
|
192
|
+
const plugins = (ref = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref !== void 0 ? ref : [];
|
|
177
193
|
if (plugins.length === 0) {
|
|
178
194
|
return;
|
|
179
195
|
}
|
|
@@ -185,8 +201,7 @@ function extractPluginConfigs(configs) {
|
|
|
185
201
|
allConfigs = [
|
|
186
202
|
...allConfigs,
|
|
187
203
|
...extractPluginConfigs([
|
|
188
|
-
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {
|
|
189
|
-
}
|
|
204
|
+
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
|
|
190
205
|
])
|
|
191
206
|
];
|
|
192
207
|
});
|
|
@@ -202,7 +217,7 @@ function resolveCorePlugins(corePluginConfigs) {
|
|
|
202
217
|
corePlugins: resolved
|
|
203
218
|
});
|
|
204
219
|
}
|
|
205
|
-
return (0, _configurePlugins
|
|
220
|
+
return (0, _configurePlugins.default)(corePluginConfig, resolved);
|
|
206
221
|
}, _corePluginList.default);
|
|
207
222
|
return result;
|
|
208
223
|
}
|
|
@@ -221,22 +236,19 @@ function resolveConfig(configs) {
|
|
|
221
236
|
let allConfigs = [
|
|
222
237
|
...extractPluginConfigs(configs),
|
|
223
238
|
{
|
|
224
|
-
prefix:
|
|
239
|
+
prefix: "",
|
|
225
240
|
important: false,
|
|
226
|
-
separator:
|
|
227
|
-
|
|
228
|
-
},
|
|
241
|
+
separator: ":"
|
|
242
|
+
}
|
|
229
243
|
];
|
|
230
|
-
var ref,
|
|
231
|
-
return (0, _normalizeConfig
|
|
244
|
+
var ref, ref1;
|
|
245
|
+
return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
|
|
232
246
|
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
233
|
-
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
|
|
234
|
-
};
|
|
247
|
+
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
|
|
235
248
|
})))),
|
|
236
|
-
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
|
|
237
|
-
)),
|
|
249
|
+
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
|
238
250
|
plugins: resolvePluginLists(configs.map((c)=>{
|
|
239
|
-
return (
|
|
251
|
+
return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
|
|
240
252
|
}))
|
|
241
253
|
}, ...allConfigs));
|
|
242
254
|
}
|
|
@@ -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,12 +1,28 @@
|
|
|
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
|
-
let openBrackets = path.split(
|
|
9
|
-
let closedBrackets = path.split(
|
|
24
|
+
let openBrackets = path.split("[").length - 1;
|
|
25
|
+
let closedBrackets = path.split("]").length - 1;
|
|
10
26
|
if (openBrackets !== closedBrackets) {
|
|
11
27
|
throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
|
|
12
28
|
}
|
|
@@ -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,53 +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
21
|
return (value)=>{
|
|
18
|
-
if (typeof value ===
|
|
19
|
-
});
|
|
22
|
+
if (typeof value === "function") value = value({});
|
|
20
23
|
if (Array.isArray(value)) value = value[0];
|
|
21
24
|
return value;
|
|
22
25
|
};
|
|
23
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
|
+
};
|
|
33
|
+
}
|
|
24
34
|
if ([
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'animation',
|
|
35
|
+
"boxShadow",
|
|
36
|
+
"transitionProperty",
|
|
37
|
+
"transitionDuration",
|
|
38
|
+
"transitionDelay",
|
|
39
|
+
"transitionTimingFunction",
|
|
40
|
+
"backgroundImage",
|
|
41
|
+
"backgroundSize",
|
|
42
|
+
"backgroundColor",
|
|
43
|
+
"cursor",
|
|
44
|
+
"animation"
|
|
36
45
|
].includes(themeSection)) {
|
|
37
46
|
return (value)=>{
|
|
38
|
-
if (typeof value ===
|
|
39
|
-
|
|
40
|
-
if (Array.isArray(value)) value = value.join(', ');
|
|
47
|
+
if (typeof value === "function") value = value({});
|
|
48
|
+
if (Array.isArray(value)) value = value.join(", ");
|
|
41
49
|
return value;
|
|
42
50
|
};
|
|
43
51
|
}
|
|
44
52
|
// For backwards compatibility reasons, before we switched to underscores
|
|
45
53
|
// instead of commas for arbitrary values.
|
|
46
54
|
if ([
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
"gridTemplateColumns",
|
|
56
|
+
"gridTemplateRows",
|
|
57
|
+
"objectPosition"
|
|
50
58
|
].includes(themeSection)) {
|
|
51
59
|
return (value)=>{
|
|
52
|
-
if (typeof value ===
|
|
53
|
-
|
|
54
|
-
if (typeof value === 'string') value = _postcss.default.list.comma(value).join(' ');
|
|
60
|
+
if (typeof value === "function") value = value({});
|
|
61
|
+
if (typeof value === "string") value = _postcss.default.list.comma(value).join(" ");
|
|
55
62
|
return value;
|
|
56
63
|
};
|
|
57
64
|
}
|
|
58
|
-
return (value)=>{
|
|
59
|
-
if (typeof value ===
|
|
60
|
-
|
|
65
|
+
return (value, opts = {})=>{
|
|
66
|
+
if (typeof value === "function") {
|
|
67
|
+
value = value(opts);
|
|
68
|
+
}
|
|
61
69
|
return value;
|
|
62
70
|
};
|
|
63
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
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "backgroundSize", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>backgroundSize
|
|
8
|
+
});
|
|
9
|
+
const _dataTypes = require("./dataTypes");
|
|
10
|
+
const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
|
|
11
|
+
function backgroundSize(value) {
|
|
12
|
+
let keywordValues = [
|
|
13
|
+
"cover",
|
|
14
|
+
"contain"
|
|
15
|
+
];
|
|
16
|
+
// the <length-percentage> type will probably be a css function
|
|
17
|
+
// so we have to use `splitAtTopLevelOnly`
|
|
18
|
+
return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(value, ",").every((part)=>{
|
|
19
|
+
let sizes = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(part, "_").filter(Boolean);
|
|
20
|
+
if (sizes.length === 1 && keywordValues.includes(sizes[0])) return true;
|
|
21
|
+
if (sizes.length !== 1 && sizes.length !== 2) return false;
|
|
22
|
+
return sizes.every((size)=>(0, _dataTypes.length)(size) || (0, _dataTypes.percentage)(size) || size === "auto");
|
|
23
|
+
});
|
|
24
|
+
}
|