tailwindcss 0.0.0-insiders.deefbf5 → 0.0.0-insiders.df96ea5
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/README.md +16 -17
- package/dist/chunk-GFBUASX3.mjs +1 -0
- package/dist/chunk-HTB5LLOP.mjs +1 -0
- package/dist/chunk-KV2PFGBW.mjs +38 -0
- package/dist/colors-b_6i0Oi7.d.ts +295 -0
- package/dist/colors.d.mts +295 -0
- package/dist/colors.d.ts +5 -0
- package/dist/colors.js +1 -0
- package/dist/colors.mjs +1 -0
- package/dist/default-theme.d.mts +1147 -0
- package/dist/default-theme.d.ts +1147 -0
- package/dist/default-theme.js +1 -0
- package/dist/default-theme.mjs +1 -0
- package/dist/flatten-color-palette.d.mts +6 -0
- package/dist/flatten-color-palette.d.ts +6 -0
- package/dist/flatten-color-palette.js +3 -0
- package/dist/flatten-color-palette.mjs +1 -0
- package/dist/lib.d.mts +378 -0
- package/dist/lib.d.ts +3 -0
- package/dist/lib.js +38 -0
- package/dist/lib.mjs +1 -0
- package/dist/plugin.d.mts +11 -0
- package/dist/plugin.d.ts +134 -0
- package/dist/plugin.js +1 -0
- package/dist/plugin.mjs +1 -0
- package/dist/resolve-config-BIFUA2FY.d.ts +29 -0
- package/dist/resolve-config-QUZ9b-Gn.d.mts +190 -0
- package/dist/types-CJYAW1ql.d.mts +128 -0
- package/index.css +896 -0
- package/package.json +76 -100
- package/preflight.css +393 -0
- package/theme.css +462 -0
- package/CHANGELOG.md +0 -2206
- package/base.css +0 -1
- package/colors.d.ts +0 -3
- package/colors.js +0 -2
- package/components.css +0 -1
- package/defaultConfig.d.ts +0 -3
- package/defaultConfig.js +0 -2
- package/defaultTheme.d.ts +0 -4
- package/defaultTheme.js +0 -2
- package/lib/cli-peer-dependencies.js +0 -20
- package/lib/cli.js +0 -805
- package/lib/constants.js +0 -37
- package/lib/corePluginList.js +0 -179
- package/lib/corePlugins.js +0 -3662
- package/lib/css/LICENSE +0 -25
- package/lib/css/preflight.css +0 -360
- package/lib/featureFlags.js +0 -61
- package/lib/index.js +0 -40
- package/lib/lib/cacheInvalidation.js +0 -87
- package/lib/lib/collapseAdjacentRules.js +0 -56
- package/lib/lib/collapseDuplicateDeclarations.js +0 -80
- package/lib/lib/defaultExtractor.js +0 -228
- package/lib/lib/detectNesting.js +0 -34
- package/lib/lib/evaluateTailwindFunctions.js +0 -215
- package/lib/lib/expandApplyAtRules.js +0 -470
- package/lib/lib/expandTailwindAtRules.js +0 -276
- package/lib/lib/generateRules.js +0 -722
- package/lib/lib/getModuleDependencies.js +0 -48
- package/lib/lib/normalizeTailwindDirectives.js +0 -84
- package/lib/lib/partitionApplyAtRules.js +0 -53
- package/lib/lib/regex.js +0 -52
- package/lib/lib/resolveDefaultsAtRules.js +0 -154
- package/lib/lib/setupContextUtils.js +0 -932
- package/lib/lib/setupTrackingContext.js +0 -169
- package/lib/lib/sharedState.js +0 -51
- package/lib/lib/substituteScreenAtRules.js +0 -26
- package/lib/postcss-plugins/nesting/README.md +0 -42
- package/lib/postcss-plugins/nesting/index.js +0 -17
- package/lib/postcss-plugins/nesting/plugin.js +0 -84
- package/lib/processTailwindFeatures.js +0 -59
- package/lib/public/colors.js +0 -329
- package/lib/public/create-plugin.js +0 -13
- package/lib/public/default-config.js +0 -14
- package/lib/public/default-theme.js +0 -14
- package/lib/public/resolve-config.js +0 -19
- package/lib/util/bigSign.js +0 -8
- package/lib/util/buildMediaQuery.js +0 -19
- package/lib/util/cloneDeep.js +0 -17
- package/lib/util/cloneNodes.js +0 -25
- package/lib/util/color.js +0 -90
- package/lib/util/configurePlugins.js +0 -18
- package/lib/util/createPlugin.js +0 -28
- package/lib/util/createUtilityPlugin.js +0 -48
- package/lib/util/dataTypes.js +0 -235
- package/lib/util/defaults.js +0 -22
- package/lib/util/escapeClassName.js +0 -19
- package/lib/util/escapeCommas.js +0 -8
- package/lib/util/flattenColorPalette.js +0 -14
- package/lib/util/formatVariantSelector.js +0 -194
- package/lib/util/getAllConfigs.js +0 -34
- package/lib/util/hashConfig.js +0 -16
- package/lib/util/isKeyframeRule.js +0 -8
- package/lib/util/isPlainObject.js +0 -12
- package/lib/util/isValidArbitraryValue.js +0 -63
- package/lib/util/log.js +0 -50
- package/lib/util/nameClass.js +0 -32
- package/lib/util/negateValue.js +0 -18
- package/lib/util/normalizeConfig.js +0 -250
- package/lib/util/normalizeScreens.js +0 -58
- package/lib/util/parseAnimationValue.js +0 -88
- package/lib/util/parseBoxShadowValue.js +0 -76
- package/lib/util/parseDependency.js +0 -63
- package/lib/util/parseObjectStyles.js +0 -31
- package/lib/util/pluginUtils.js +0 -187
- package/lib/util/prefixSelector.js +0 -20
- package/lib/util/removeAlphaVariables.js +0 -18
- package/lib/util/resolveConfig.js +0 -256
- package/lib/util/resolveConfigPath.js +0 -51
- package/lib/util/responsive.js +0 -19
- package/lib/util/splitAtTopLevelOnly.js +0 -90
- package/lib/util/tap.js +0 -9
- package/lib/util/toColorValue.js +0 -8
- package/lib/util/toPath.js +0 -14
- package/lib/util/transformThemeValue.js +0 -61
- package/lib/util/validateConfig.js +0 -21
- package/lib/util/withAlphaVariable.js +0 -67
- package/nesting/index.js +0 -2
- package/peers/index.js +0 -77956
- package/plugin.d.ts +0 -11
- package/plugin.js +0 -2
- package/prettier.config.js +0 -19
- package/resolveConfig.js +0 -2
- package/screens.css +0 -1
- package/scripts/create-plugin-list.js +0 -10
- package/scripts/generate-types.js +0 -105
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/scripts/type-utils.js +0 -27
- package/src/cli-peer-dependencies.js +0 -15
- package/src/cli.js +0 -915
- package/src/constants.js +0 -17
- package/src/corePluginList.js +0 -1
- package/src/corePlugins.js +0 -2442
- package/src/css/LICENSE +0 -25
- package/src/css/preflight.css +0 -360
- package/src/featureFlags.js +0 -54
- package/src/index.js +0 -42
- package/src/lib/cacheInvalidation.js +0 -52
- package/src/lib/collapseAdjacentRules.js +0 -58
- package/src/lib/collapseDuplicateDeclarations.js +0 -93
- package/src/lib/defaultExtractor.js +0 -208
- package/src/lib/detectNesting.js +0 -39
- package/src/lib/evaluateTailwindFunctions.js +0 -248
- package/src/lib/expandApplyAtRules.js +0 -539
- package/src/lib/expandTailwindAtRules.js +0 -292
- package/src/lib/generateRules.js +0 -719
- package/src/lib/getModuleDependencies.js +0 -39
- package/src/lib/normalizeTailwindDirectives.js +0 -84
- package/src/lib/partitionApplyAtRules.js +0 -52
- package/src/lib/regex.js +0 -74
- package/src/lib/resolveDefaultsAtRules.js +0 -163
- package/src/lib/setupContextUtils.js +0 -977
- package/src/lib/setupTrackingContext.js +0 -187
- package/src/lib/sharedState.js +0 -48
- package/src/lib/substituteScreenAtRules.js +0 -19
- package/src/postcss-plugins/nesting/README.md +0 -42
- package/src/postcss-plugins/nesting/index.js +0 -13
- package/src/postcss-plugins/nesting/plugin.js +0 -80
- package/src/processTailwindFeatures.js +0 -58
- package/src/public/colors.js +0 -300
- package/src/public/create-plugin.js +0 -2
- package/src/public/default-config.js +0 -4
- package/src/public/default-theme.js +0 -4
- package/src/public/resolve-config.js +0 -7
- package/src/util/bigSign.js +0 -3
- package/src/util/buildMediaQuery.js +0 -20
- package/src/util/cloneDeep.js +0 -11
- package/src/util/cloneNodes.js +0 -24
- package/src/util/color.js +0 -73
- package/src/util/configurePlugins.js +0 -23
- package/src/util/createPlugin.js +0 -27
- package/src/util/createUtilityPlugin.js +0 -37
- package/src/util/dataTypes.js +0 -254
- package/src/util/defaults.js +0 -17
- package/src/util/escapeClassName.js +0 -8
- package/src/util/escapeCommas.js +0 -3
- package/src/util/flattenColorPalette.js +0 -13
- package/src/util/formatVariantSelector.js +0 -215
- package/src/util/getAllConfigs.js +0 -26
- package/src/util/hashConfig.js +0 -5
- package/src/util/isKeyframeRule.js +0 -3
- package/src/util/isPlainObject.js +0 -8
- package/src/util/isValidArbitraryValue.js +0 -61
- package/src/util/log.js +0 -29
- package/src/util/nameClass.js +0 -26
- package/src/util/negateValue.js +0 -16
- package/src/util/normalizeConfig.js +0 -262
- package/src/util/normalizeScreens.js +0 -45
- package/src/util/parseAnimationValue.js +0 -68
- package/src/util/parseBoxShadowValue.js +0 -72
- package/src/util/parseDependency.js +0 -49
- package/src/util/parseObjectStyles.js +0 -19
- package/src/util/pluginUtils.js +0 -204
- package/src/util/prefixSelector.js +0 -14
- package/src/util/removeAlphaVariables.js +0 -24
- package/src/util/resolveConfig.js +0 -283
- package/src/util/resolveConfigPath.js +0 -55
- package/src/util/responsive.js +0 -10
- package/src/util/splitAtTopLevelOnly.js +0 -71
- package/src/util/tap.js +0 -4
- package/src/util/toColorValue.js +0 -3
- package/src/util/toPath.js +0 -26
- package/src/util/transformThemeValue.js +0 -54
- package/src/util/validateConfig.js +0 -13
- package/src/util/withAlphaVariable.js +0 -49
- package/stubs/defaultConfig.stub.js +0 -954
- package/stubs/defaultPostCssConfig.stub.js +0 -6
- package/stubs/simpleConfig.stub.js +0 -8
- package/tailwind.css +0 -5
- package/types/config.d.ts +0 -327
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +0 -276
- package/types/generated/corePluginList.d.ts +0 -1
- package/types/generated/default-theme.d.ts +0 -331
- package/types/index.d.ts +0 -7
- package/variants.css +0 -1
package/lib/util/pluginUtils.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.updateAllClasses = updateAllClasses;
|
|
6
|
-
exports.asValue = asValue;
|
|
7
|
-
exports.parseColorFormat = parseColorFormat;
|
|
8
|
-
exports.asColor = asColor;
|
|
9
|
-
exports.asLookupValue = asLookupValue;
|
|
10
|
-
exports.coerceValue = coerceValue;
|
|
11
|
-
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
|
12
|
-
var _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
|
|
13
|
-
var _withAlphaVariable = require("./withAlphaVariable");
|
|
14
|
-
var _dataTypes = require("./dataTypes");
|
|
15
|
-
var _negateValue = _interopRequireDefault(require("./negateValue"));
|
|
16
|
-
function _interopRequireDefault(obj) {
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function updateAllClasses(selectors1, updateClass) {
|
|
22
|
-
let parser = (0, _postcssSelectorParser).default((selectors)=>{
|
|
23
|
-
selectors.walkClasses((sel)=>{
|
|
24
|
-
let updatedClass = updateClass(sel.value);
|
|
25
|
-
sel.value = updatedClass;
|
|
26
|
-
if (sel.raws && sel.raws.value) {
|
|
27
|
-
sel.raws.value = (0, _escapeCommas).default(sel.raws.value);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
let result = parser.processSync(selectors1);
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
function resolveArbitraryValue(modifier, validate) {
|
|
35
|
-
if (!isArbitraryValue(modifier)) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
let value = modifier.slice(1, -1);
|
|
39
|
-
if (!validate(value)) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
return (0, _dataTypes).normalize(value);
|
|
43
|
-
}
|
|
44
|
-
function asNegativeValue(modifier, lookup = {}, validate) {
|
|
45
|
-
let positiveValue = lookup[modifier];
|
|
46
|
-
if (positiveValue !== undefined) {
|
|
47
|
-
return (0, _negateValue).default(positiveValue);
|
|
48
|
-
}
|
|
49
|
-
if (isArbitraryValue(modifier)) {
|
|
50
|
-
let resolved = resolveArbitraryValue(modifier, validate);
|
|
51
|
-
if (resolved === undefined) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
return (0, _negateValue).default(resolved);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function asValue(modifier, options = {}, { validate =()=>true } = {}) {
|
|
58
|
-
var ref;
|
|
59
|
-
let value = (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
|
60
|
-
if (value !== undefined) {
|
|
61
|
-
return value;
|
|
62
|
-
}
|
|
63
|
-
if (options.supportsNegativeValues && modifier.startsWith("-")) {
|
|
64
|
-
return asNegativeValue(modifier.slice(1), options.values, validate);
|
|
65
|
-
}
|
|
66
|
-
return resolveArbitraryValue(modifier, validate);
|
|
67
|
-
}
|
|
68
|
-
function isArbitraryValue(input) {
|
|
69
|
-
return input.startsWith("[") && input.endsWith("]");
|
|
70
|
-
}
|
|
71
|
-
function splitAlpha(modifier) {
|
|
72
|
-
let slashIdx = modifier.lastIndexOf("/");
|
|
73
|
-
if (slashIdx === -1 || slashIdx === modifier.length - 1) {
|
|
74
|
-
return [
|
|
75
|
-
modifier
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
return [
|
|
79
|
-
modifier.slice(0, slashIdx),
|
|
80
|
-
modifier.slice(slashIdx + 1)
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
function parseColorFormat(value) {
|
|
84
|
-
if (typeof value === "string" && value.includes("<alpha-value>")) {
|
|
85
|
-
let oldValue = value;
|
|
86
|
-
return ({ opacityValue =1 })=>oldValue.replace("<alpha-value>", opacityValue);
|
|
87
|
-
}
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
function asColor(modifier, options = {}, { tailwindConfig ={} } = {}) {
|
|
91
|
-
var ref;
|
|
92
|
-
if (((ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier]) !== undefined) {
|
|
93
|
-
var ref1;
|
|
94
|
-
return parseColorFormat((ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[modifier]);
|
|
95
|
-
}
|
|
96
|
-
let [color, alpha] = splitAlpha(modifier);
|
|
97
|
-
if (alpha !== undefined) {
|
|
98
|
-
var ref2, ref3, ref4;
|
|
99
|
-
var ref5;
|
|
100
|
-
let normalizedColor = (ref5 = (ref2 = options.values) === null || ref2 === void 0 ? void 0 : ref2[color]) !== null && ref5 !== void 0 ? ref5 : isArbitraryValue(color) ? color.slice(1, -1) : undefined;
|
|
101
|
-
if (normalizedColor === undefined) {
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
normalizedColor = parseColorFormat(normalizedColor);
|
|
105
|
-
if (isArbitraryValue(alpha)) {
|
|
106
|
-
return (0, _withAlphaVariable).withAlphaValue(normalizedColor, alpha.slice(1, -1));
|
|
107
|
-
}
|
|
108
|
-
if (((ref3 = tailwindConfig.theme) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.opacity) === null || ref4 === void 0 ? void 0 : ref4[alpha]) === undefined) {
|
|
109
|
-
return undefined;
|
|
110
|
-
}
|
|
111
|
-
return (0, _withAlphaVariable).withAlphaValue(normalizedColor, tailwindConfig.theme.opacity[alpha]);
|
|
112
|
-
}
|
|
113
|
-
return asValue(modifier, options, {
|
|
114
|
-
validate: _dataTypes.color
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function asLookupValue(modifier, options = {}) {
|
|
118
|
-
var ref;
|
|
119
|
-
return (ref = options.values) === null || ref === void 0 ? void 0 : ref[modifier];
|
|
120
|
-
}
|
|
121
|
-
function guess(validate) {
|
|
122
|
-
return (modifier, options)=>{
|
|
123
|
-
return asValue(modifier, options, {
|
|
124
|
-
validate
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
let typeMap = {
|
|
129
|
-
any: asValue,
|
|
130
|
-
color: asColor,
|
|
131
|
-
url: guess(_dataTypes.url),
|
|
132
|
-
image: guess(_dataTypes.image),
|
|
133
|
-
length: guess(_dataTypes.length),
|
|
134
|
-
percentage: guess(_dataTypes.percentage),
|
|
135
|
-
position: guess(_dataTypes.position),
|
|
136
|
-
lookup: asLookupValue,
|
|
137
|
-
"generic-name": guess(_dataTypes.genericName),
|
|
138
|
-
"family-name": guess(_dataTypes.familyName),
|
|
139
|
-
number: guess(_dataTypes.number),
|
|
140
|
-
"line-width": guess(_dataTypes.lineWidth),
|
|
141
|
-
"absolute-size": guess(_dataTypes.absoluteSize),
|
|
142
|
-
"relative-size": guess(_dataTypes.relativeSize),
|
|
143
|
-
shadow: guess(_dataTypes.shadow)
|
|
144
|
-
};
|
|
145
|
-
let supportedTypes = Object.keys(typeMap);
|
|
146
|
-
function splitAtFirst(input, delim) {
|
|
147
|
-
let idx = input.indexOf(delim);
|
|
148
|
-
if (idx === -1) return [
|
|
149
|
-
undefined,
|
|
150
|
-
input
|
|
151
|
-
];
|
|
152
|
-
return [
|
|
153
|
-
input.slice(0, idx),
|
|
154
|
-
input.slice(idx + 1)
|
|
155
|
-
];
|
|
156
|
-
}
|
|
157
|
-
function coerceValue(types, modifier, options, tailwindConfig) {
|
|
158
|
-
if (isArbitraryValue(modifier)) {
|
|
159
|
-
let arbitraryValue = modifier.slice(1, -1);
|
|
160
|
-
let [explicitType, value] = splitAtFirst(arbitraryValue, ":");
|
|
161
|
-
// It could be that this resolves to `url(https` which is not a valid
|
|
162
|
-
// identifier. We currently only support "simple" words with dashes or
|
|
163
|
-
// underscores. E.g.: family-name
|
|
164
|
-
if (!/^[\w-_]+$/g.test(explicitType)) {
|
|
165
|
-
value = arbitraryValue;
|
|
166
|
-
} else if (explicitType !== undefined && !supportedTypes.includes(explicitType)) {
|
|
167
|
-
return [];
|
|
168
|
-
}
|
|
169
|
-
if (value.length > 0 && supportedTypes.includes(explicitType)) {
|
|
170
|
-
return [
|
|
171
|
-
asValue(`[${value}]`, options),
|
|
172
|
-
explicitType
|
|
173
|
-
];
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
// Find first matching type
|
|
177
|
-
for (let type of [].concat(types)){
|
|
178
|
-
let result = typeMap[type](modifier, options, {
|
|
179
|
-
tailwindConfig
|
|
180
|
-
});
|
|
181
|
-
if (result !== undefined) return [
|
|
182
|
-
result,
|
|
183
|
-
type
|
|
184
|
-
];
|
|
185
|
-
}
|
|
186
|
-
return [];
|
|
187
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = _default;
|
|
6
|
-
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
|
7
|
-
function _interopRequireDefault(obj) {
|
|
8
|
-
return obj && obj.__esModule ? obj : {
|
|
9
|
-
default: obj
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function _default(prefix, selector, prependNegative = false) {
|
|
13
|
-
return (0, _postcssSelectorParser).default((selectors)=>{
|
|
14
|
-
selectors.walkClasses((classSelector)=>{
|
|
15
|
-
let baseClass = classSelector.value;
|
|
16
|
-
let shouldPlaceNegativeBeforePrefix = prependNegative && baseClass.startsWith("-");
|
|
17
|
-
classSelector.value = shouldPlaceNegativeBeforePrefix ? `-${prefix}${baseClass.slice(1)}` : `${prefix}${baseClass}`;
|
|
18
|
-
});
|
|
19
|
-
}).processSync(selector);
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.removeAlphaVariables = removeAlphaVariables;
|
|
6
|
-
function removeAlphaVariables(container, toRemove) {
|
|
7
|
-
container.walkDecls((decl)=>{
|
|
8
|
-
if (toRemove.includes(decl.prop)) {
|
|
9
|
-
decl.remove();
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
for (let varName of toRemove){
|
|
13
|
-
if (decl.value.includes(`/ var(${varName})`)) {
|
|
14
|
-
decl.value = decl.value.replace(`/ var(${varName})`, "");
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = resolveConfig;
|
|
6
|
-
var _negateValue = _interopRequireDefault(require("./negateValue"));
|
|
7
|
-
var _corePluginList = _interopRequireDefault(require("../corePluginList"));
|
|
8
|
-
var _configurePlugins = _interopRequireDefault(require("./configurePlugins"));
|
|
9
|
-
var _defaultConfigStub = _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
|
|
10
|
-
var _colors = _interopRequireDefault(require("../public/colors"));
|
|
11
|
-
var _defaults = require("./defaults");
|
|
12
|
-
var _toPath = require("./toPath");
|
|
13
|
-
var _normalizeConfig = require("./normalizeConfig");
|
|
14
|
-
var _isPlainObject = _interopRequireDefault(require("./isPlainObject"));
|
|
15
|
-
var _cloneDeep = require("./cloneDeep");
|
|
16
|
-
var _pluginUtils = require("./pluginUtils");
|
|
17
|
-
var _withAlphaVariable = require("./withAlphaVariable");
|
|
18
|
-
var _toColorValue = _interopRequireDefault(require("./toColorValue"));
|
|
19
|
-
function resolveConfig(configs) {
|
|
20
|
-
let allConfigs = [
|
|
21
|
-
...extractPluginConfigs(configs),
|
|
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
|
-
}
|
|
40
|
-
function _interopRequireDefault(obj) {
|
|
41
|
-
return obj && obj.__esModule ? obj : {
|
|
42
|
-
default: obj
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function isFunction(input) {
|
|
46
|
-
return typeof input === "function";
|
|
47
|
-
}
|
|
48
|
-
function isObject(input) {
|
|
49
|
-
return typeof input === "object" && input !== null;
|
|
50
|
-
}
|
|
51
|
-
function mergeWith(target, ...sources) {
|
|
52
|
-
let customizer = sources.pop();
|
|
53
|
-
for (let source of sources){
|
|
54
|
-
for(let k in source){
|
|
55
|
-
let merged = customizer(target[k], source[k]);
|
|
56
|
-
if (merged === undefined) {
|
|
57
|
-
if (isObject(target[k]) && isObject(source[k])) {
|
|
58
|
-
target[k] = mergeWith(target[k], source[k], customizer);
|
|
59
|
-
} else {
|
|
60
|
-
target[k] = source[k];
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
target[k] = merged;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return target;
|
|
68
|
-
}
|
|
69
|
-
const configUtils = {
|
|
70
|
-
colors: _colors.default,
|
|
71
|
-
negative (scale) {
|
|
72
|
-
// TODO: Log that this function isn't really needed anymore?
|
|
73
|
-
return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
|
|
74
|
-
let negativeValue = (0, _negateValue).default(scale[key]);
|
|
75
|
-
if (negativeValue !== undefined) {
|
|
76
|
-
negativeScale[`-${key}`] = negativeValue;
|
|
77
|
-
}
|
|
78
|
-
return negativeScale;
|
|
79
|
-
}, {});
|
|
80
|
-
},
|
|
81
|
-
breakpoints (screens) {
|
|
82
|
-
return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
|
|
83
|
-
...breakpoints,
|
|
84
|
-
[`screen-${key}`]: screens[key]
|
|
85
|
-
}), {});
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
function value(valueToResolve, ...args) {
|
|
89
|
-
return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
|
|
90
|
-
}
|
|
91
|
-
function collectExtends(items) {
|
|
92
|
-
return items.reduce((merged, { extend })=>{
|
|
93
|
-
return mergeWith(merged, extend, (mergedValue, extendValue)=>{
|
|
94
|
-
if (mergedValue === undefined) {
|
|
95
|
-
return [
|
|
96
|
-
extendValue
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
if (Array.isArray(mergedValue)) {
|
|
100
|
-
return [
|
|
101
|
-
extendValue,
|
|
102
|
-
...mergedValue
|
|
103
|
-
];
|
|
104
|
-
}
|
|
105
|
-
return [
|
|
106
|
-
extendValue,
|
|
107
|
-
mergedValue
|
|
108
|
-
];
|
|
109
|
-
});
|
|
110
|
-
}, {});
|
|
111
|
-
}
|
|
112
|
-
function mergeThemes(themes) {
|
|
113
|
-
return {
|
|
114
|
-
...themes.reduce((merged, theme)=>(0, _defaults).defaults(merged, theme), {}),
|
|
115
|
-
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
116
|
-
// into arrays instead of objects so they aren't overridden.
|
|
117
|
-
extend: collectExtends(themes)
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function mergeExtensionCustomizer(merged, value1) {
|
|
121
|
-
// When we have an array of objects, we do want to merge it
|
|
122
|
-
if (Array.isArray(merged) && isObject(merged[0])) {
|
|
123
|
-
return merged.concat(value1);
|
|
124
|
-
}
|
|
125
|
-
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
126
|
-
if (Array.isArray(value1) && isObject(value1[0]) && isObject(merged)) {
|
|
127
|
-
return [
|
|
128
|
-
merged,
|
|
129
|
-
...value1
|
|
130
|
-
];
|
|
131
|
-
}
|
|
132
|
-
// Override arrays (for example for font-families, box-shadows, ...)
|
|
133
|
-
if (Array.isArray(value1)) {
|
|
134
|
-
return value1;
|
|
135
|
-
}
|
|
136
|
-
// Execute default behaviour
|
|
137
|
-
return undefined;
|
|
138
|
-
}
|
|
139
|
-
function mergeExtensions({ extend , ...theme }) {
|
|
140
|
-
return mergeWith(theme, extend, (themeValue, extensions)=>{
|
|
141
|
-
// The `extend` property is an array, so we need to check if it contains any functions
|
|
142
|
-
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
143
|
-
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
144
|
-
}
|
|
145
|
-
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
|
146
|
-
themeValue,
|
|
147
|
-
...extensions
|
|
148
|
-
].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
*
|
|
153
|
-
* @param {string} key
|
|
154
|
-
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
155
|
-
*/ function* toPaths(key) {
|
|
156
|
-
let path = (0, _toPath).toPath(key);
|
|
157
|
-
if (path.length === 0) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
yield path;
|
|
161
|
-
if (Array.isArray(key)) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
|
|
165
|
-
let matches = key.match(pattern);
|
|
166
|
-
if (matches !== null) {
|
|
167
|
-
let [, prefix, alpha] = matches;
|
|
168
|
-
let newPath = (0, _toPath).toPath(prefix);
|
|
169
|
-
newPath.alpha = alpha;
|
|
170
|
-
yield newPath;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
function resolveFunctionKeys(object) {
|
|
174
|
-
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
175
|
-
const resolvePath = (key, defaultValue)=>{
|
|
176
|
-
for (const path of toPaths(key)){
|
|
177
|
-
let index = 0;
|
|
178
|
-
let val = object;
|
|
179
|
-
while(val !== undefined && val !== null && index < path.length){
|
|
180
|
-
val = val[path[index++]];
|
|
181
|
-
let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index < path.length - 1);
|
|
182
|
-
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
|
|
183
|
-
}
|
|
184
|
-
if (val !== undefined) {
|
|
185
|
-
if (path.alpha !== undefined) {
|
|
186
|
-
let normalized = (0, _pluginUtils).parseColorFormat(val);
|
|
187
|
-
return (0, _withAlphaVariable).withAlphaValue(normalized, path.alpha, (0, _toColorValue).default(normalized));
|
|
188
|
-
}
|
|
189
|
-
if ((0, _isPlainObject).default(val)) {
|
|
190
|
-
return (0, _cloneDeep).cloneDeep(val);
|
|
191
|
-
}
|
|
192
|
-
return val;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return defaultValue;
|
|
196
|
-
};
|
|
197
|
-
Object.assign(resolvePath, {
|
|
198
|
-
theme: resolvePath,
|
|
199
|
-
...configUtils
|
|
200
|
-
});
|
|
201
|
-
return Object.keys(object).reduce((resolved, key)=>{
|
|
202
|
-
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
|
|
203
|
-
return resolved;
|
|
204
|
-
}, {});
|
|
205
|
-
}
|
|
206
|
-
function extractPluginConfigs(configs) {
|
|
207
|
-
let allConfigs = [];
|
|
208
|
-
configs.forEach((config)=>{
|
|
209
|
-
allConfigs = [
|
|
210
|
-
...allConfigs,
|
|
211
|
-
config
|
|
212
|
-
];
|
|
213
|
-
var ref2;
|
|
214
|
-
const plugins = (ref2 = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref2 !== void 0 ? ref2 : [];
|
|
215
|
-
if (plugins.length === 0) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
plugins.forEach((plugin)=>{
|
|
219
|
-
if (plugin.__isOptionsFunction) {
|
|
220
|
-
plugin = plugin();
|
|
221
|
-
}
|
|
222
|
-
var ref;
|
|
223
|
-
allConfigs = [
|
|
224
|
-
...allConfigs,
|
|
225
|
-
...extractPluginConfigs([
|
|
226
|
-
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
|
|
227
|
-
])
|
|
228
|
-
];
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
return allConfigs;
|
|
232
|
-
}
|
|
233
|
-
function resolveCorePlugins(corePluginConfigs) {
|
|
234
|
-
const result = [
|
|
235
|
-
...corePluginConfigs
|
|
236
|
-
].reduceRight((resolved, corePluginConfig)=>{
|
|
237
|
-
if (isFunction(corePluginConfig)) {
|
|
238
|
-
return corePluginConfig({
|
|
239
|
-
corePlugins: resolved
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
return (0, _configurePlugins).default(corePluginConfig, resolved);
|
|
243
|
-
}, _corePluginList.default);
|
|
244
|
-
return result;
|
|
245
|
-
}
|
|
246
|
-
function resolvePluginLists(pluginLists) {
|
|
247
|
-
const result = [
|
|
248
|
-
...pluginLists
|
|
249
|
-
].reduceRight((resolved, pluginList)=>{
|
|
250
|
-
return [
|
|
251
|
-
...resolved,
|
|
252
|
-
...pluginList
|
|
253
|
-
];
|
|
254
|
-
}, []);
|
|
255
|
-
return result;
|
|
256
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = resolveConfigPath;
|
|
6
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
function resolveConfigPath(pathOrConfig) {
|
|
9
|
-
// require('tailwindcss')({ theme: ..., variants: ... })
|
|
10
|
-
if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
// require('tailwindcss')({ config: 'custom-config.js' })
|
|
14
|
-
if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
|
|
15
|
-
return _path.default.resolve(pathOrConfig.config);
|
|
16
|
-
}
|
|
17
|
-
// require('tailwindcss')({ config: { theme: ..., variants: ... } })
|
|
18
|
-
if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
// require('tailwindcss')('custom-config.js')
|
|
22
|
-
if (isString(pathOrConfig)) {
|
|
23
|
-
return _path.default.resolve(pathOrConfig);
|
|
24
|
-
}
|
|
25
|
-
// require('tailwindcss')
|
|
26
|
-
for (const configFile of [
|
|
27
|
-
"./tailwind.config.js",
|
|
28
|
-
"./tailwind.config.cjs"
|
|
29
|
-
]){
|
|
30
|
-
try {
|
|
31
|
-
const configPath = _path.default.resolve(configFile);
|
|
32
|
-
_fs.default.accessSync(configPath);
|
|
33
|
-
return configPath;
|
|
34
|
-
} catch (err) {}
|
|
35
|
-
}
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
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
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = responsive;
|
|
6
|
-
var _postcss = _interopRequireDefault(require("postcss"));
|
|
7
|
-
var _cloneNodes = _interopRequireDefault(require("./cloneNodes"));
|
|
8
|
-
function responsive(rules) {
|
|
9
|
-
return _postcss.default.atRule({
|
|
10
|
-
name: "responsive"
|
|
11
|
-
}).append((0, _cloneNodes).default(Array.isArray(rules) ? rules : [
|
|
12
|
-
rules
|
|
13
|
-
]));
|
|
14
|
-
}
|
|
15
|
-
function _interopRequireDefault(obj) {
|
|
16
|
-
return obj && obj.__esModule ? obj : {
|
|
17
|
-
default: obj
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.splitAtTopLevelOnly = splitAtTopLevelOnly;
|
|
6
|
-
var regex = _interopRequireWildcard(require("../lib/regex"));
|
|
7
|
-
function _getRequireWildcardCache() {
|
|
8
|
-
if (typeof WeakMap !== "function") return null;
|
|
9
|
-
var cache = new WeakMap();
|
|
10
|
-
_getRequireWildcardCache = function() {
|
|
11
|
-
return cache;
|
|
12
|
-
};
|
|
13
|
-
return cache;
|
|
14
|
-
}
|
|
15
|
-
function _interopRequireWildcard(obj) {
|
|
16
|
-
if (obj && obj.__esModule) {
|
|
17
|
-
return obj;
|
|
18
|
-
}
|
|
19
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
20
|
-
return {
|
|
21
|
-
default: obj
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
var cache = _getRequireWildcardCache();
|
|
25
|
-
if (cache && cache.has(obj)) {
|
|
26
|
-
return cache.get(obj);
|
|
27
|
-
}
|
|
28
|
-
var newObj = {};
|
|
29
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
30
|
-
for(var key in obj){
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
32
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
33
|
-
if (desc && (desc.get || desc.set)) {
|
|
34
|
-
Object.defineProperty(newObj, key, desc);
|
|
35
|
-
} else {
|
|
36
|
-
newObj[key] = obj[key];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
newObj.default = obj;
|
|
41
|
-
if (cache) {
|
|
42
|
-
cache.set(obj, newObj);
|
|
43
|
-
}
|
|
44
|
-
return newObj;
|
|
45
|
-
}
|
|
46
|
-
function* splitAtTopLevelOnly(input, separator) {
|
|
47
|
-
let SPECIALS = new RegExp(`[(){}\\[\\]${regex.escape(separator)}]`, "g");
|
|
48
|
-
let depth = 0;
|
|
49
|
-
let lastIndex = 0;
|
|
50
|
-
let found = false;
|
|
51
|
-
let separatorIndex = 0;
|
|
52
|
-
let separatorStart = 0;
|
|
53
|
-
let separatorLength = separator.length;
|
|
54
|
-
// Find all paren-like things & character
|
|
55
|
-
// And only split on commas if they're top-level
|
|
56
|
-
for (let match of input.matchAll(SPECIALS)){
|
|
57
|
-
let matchesSeparator = match[0] === separator[separatorIndex];
|
|
58
|
-
let atEndOfSeparator = separatorIndex === separatorLength - 1;
|
|
59
|
-
let matchesFullSeparator = matchesSeparator && atEndOfSeparator;
|
|
60
|
-
if (match[0] === "(") depth++;
|
|
61
|
-
if (match[0] === ")") depth--;
|
|
62
|
-
if (match[0] === "[") depth++;
|
|
63
|
-
if (match[0] === "]") depth--;
|
|
64
|
-
if (match[0] === "{") depth++;
|
|
65
|
-
if (match[0] === "}") depth--;
|
|
66
|
-
if (matchesSeparator && depth === 0) {
|
|
67
|
-
if (separatorStart === 0) {
|
|
68
|
-
separatorStart = match.index;
|
|
69
|
-
}
|
|
70
|
-
separatorIndex++;
|
|
71
|
-
}
|
|
72
|
-
if (matchesFullSeparator && depth === 0) {
|
|
73
|
-
found = true;
|
|
74
|
-
yield input.substring(lastIndex, separatorStart);
|
|
75
|
-
lastIndex = separatorStart + separatorLength;
|
|
76
|
-
}
|
|
77
|
-
if (separatorIndex === separatorLength) {
|
|
78
|
-
separatorIndex = 0;
|
|
79
|
-
separatorStart = 0;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Provide the last segment of the string if available
|
|
83
|
-
// Otherwise the whole string since no `char`s were found
|
|
84
|
-
// This mirrors the behavior of string.split()
|
|
85
|
-
if (found) {
|
|
86
|
-
yield input.substring(lastIndex);
|
|
87
|
-
} else {
|
|
88
|
-
yield input;
|
|
89
|
-
}
|
|
90
|
-
}
|
package/lib/util/tap.js
DELETED
package/lib/util/toColorValue.js
DELETED
package/lib/util/toPath.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.toPath = toPath;
|
|
6
|
-
function toPath(path) {
|
|
7
|
-
if (Array.isArray(path)) return path;
|
|
8
|
-
let openBrackets = path.split("[").length - 1;
|
|
9
|
-
let closedBrackets = path.split("]").length - 1;
|
|
10
|
-
if (openBrackets !== closedBrackets) {
|
|
11
|
-
throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
|
|
12
|
-
}
|
|
13
|
-
return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
|
|
14
|
-
}
|