tailwindcss 0.0.0-insiders.bbafc8e → 0.0.0-insiders.bbc2f3f
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 -13
- package/dist/chunk-5C7JPVMO.mjs +10 -0
- package/dist/chunk-AZANAYY2.mjs +1 -0
- package/dist/chunk-V2K3XTS4.mjs +1 -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 +1 -0
- package/dist/flatten-color-palette.mjs +1 -0
- package/dist/lib.d.mts +260 -0
- package/dist/lib.d.ts +3 -0
- package/dist/lib.js +33 -0
- package/dist/lib.mjs +24 -0
- package/dist/plugin.d.mts +11 -0
- package/dist/plugin.d.ts +104 -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-B254mqw1.d.mts +98 -0
- package/index.css +865 -0
- package/package.json +73 -95
- package/preflight.css +383 -0
- package/theme.css +453 -0
- package/CHANGELOG.md +0 -2084
- package/base.css +0 -1
- package/colors.js +0 -2
- package/components.css +0 -1
- package/defaultConfig.js +0 -2
- package/defaultTheme.js +0 -2
- package/lib/cli-peer-dependencies.js +0 -15
- package/lib/cli.js +0 -741
- package/lib/constants.js +0 -37
- package/lib/corePluginList.js +0 -178
- package/lib/corePlugins.js +0 -3587
- package/lib/css/LICENSE +0 -25
- package/lib/css/preflight.css +0 -367
- package/lib/featureFlags.js +0 -59
- package/lib/index.js +0 -41
- package/lib/lib/cacheInvalidation.js +0 -69
- package/lib/lib/collapseAdjacentRules.js +0 -54
- package/lib/lib/collapseDuplicateDeclarations.js +0 -80
- package/lib/lib/defaultExtractor.js +0 -44
- package/lib/lib/detectNesting.js +0 -34
- package/lib/lib/evaluateTailwindFunctions.js +0 -171
- package/lib/lib/expandApplyAtRules.js +0 -433
- package/lib/lib/expandTailwindAtRules.js +0 -262
- package/lib/lib/generateRules.js +0 -631
- package/lib/lib/getModuleDependencies.js +0 -48
- package/lib/lib/normalizeTailwindDirectives.js +0 -84
- package/lib/lib/partitionApplyAtRules.js +0 -53
- package/lib/lib/resolveDefaultsAtRules.js +0 -143
- package/lib/lib/setupContextUtils.js +0 -859
- package/lib/lib/setupTrackingContext.js +0 -171
- package/lib/lib/sharedState.js +0 -52
- package/lib/lib/substituteScreenAtRules.js +0 -27
- 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 -85
- 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 -20
- package/lib/util/cloneDeep.js +0 -19
- package/lib/util/cloneNodes.js +0 -25
- package/lib/util/color.js +0 -99
- package/lib/util/configurePlugins.js +0 -18
- package/lib/util/createPlugin.js +0 -29
- package/lib/util/createUtilityPlugin.js +0 -49
- package/lib/util/dataTypes.js +0 -233
- 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 -17
- package/lib/util/formatVariantSelector.js +0 -186
- package/lib/util/getAllConfigs.js +0 -29
- 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 -64
- package/lib/util/log.js +0 -51
- package/lib/util/nameClass.js +0 -32
- package/lib/util/negateValue.js +0 -19
- package/lib/util/normalizeConfig.js +0 -240
- package/lib/util/normalizeScreens.js +0 -59
- package/lib/util/parseAnimationValue.js +0 -89
- package/lib/util/parseBoxShadowValue.js +0 -117
- package/lib/util/parseDependency.js +0 -63
- package/lib/util/parseObjectStyles.js +0 -31
- package/lib/util/pluginUtils.js +0 -179
- package/lib/util/prefixSelector.js +0 -20
- package/lib/util/resolveConfig.js +0 -255
- package/lib/util/resolveConfigPath.js +0 -51
- package/lib/util/responsive.js +0 -19
- 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 -59
- package/lib/util/withAlphaVariable.js +0 -67
- package/nesting/index.js +0 -2
- package/peers/index.js +0 -75077
- 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/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli-peer-dependencies.js +0 -9
- package/src/cli.js +0 -815
- package/src/constants.js +0 -17
- package/src/corePluginList.js +0 -1
- package/src/corePlugins.js +0 -2365
- package/src/css/LICENSE +0 -25
- package/src/css/preflight.css +0 -367
- 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 -54
- package/src/lib/collapseDuplicateDeclarations.js +0 -93
- package/src/lib/defaultExtractor.js +0 -50
- package/src/lib/detectNesting.js +0 -39
- package/src/lib/evaluateTailwindFunctions.js +0 -198
- package/src/lib/expandApplyAtRules.js +0 -480
- package/src/lib/expandTailwindAtRules.js +0 -292
- package/src/lib/generateRules.js +0 -623
- package/src/lib/getModuleDependencies.js +0 -39
- package/src/lib/normalizeTailwindDirectives.js +0 -84
- package/src/lib/partitionApplyAtRules.js +0 -52
- package/src/lib/resolveDefaultsAtRules.js +0 -146
- package/src/lib/setupContextUtils.js +0 -883
- package/src/lib/setupTrackingContext.js +0 -183
- 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 -69
- 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 -248
- 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 -196
- package/src/util/getAllConfigs.js +0 -19
- 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 -270
- package/src/util/normalizeScreens.js +0 -45
- package/src/util/parseAnimationValue.js +0 -68
- package/src/util/parseBoxShadowValue.js +0 -119
- package/src/util/parseDependency.js +0 -49
- package/src/util/parseObjectStyles.js +0 -19
- package/src/util/pluginUtils.js +0 -192
- package/src/util/prefixSelector.js +0 -14
- package/src/util/resolveConfig.js +0 -269
- package/src/util/resolveConfigPath.js +0 -55
- package/src/util/responsive.js +0 -10
- 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 -52
- package/src/util/withAlphaVariable.js +0 -49
- package/stubs/defaultConfig.stub.js +0 -950
- package/stubs/defaultPostCssConfig.stub.js +0 -6
- package/stubs/simpleConfig.stub.js +0 -7
- package/tailwind.css +0 -5
- package/variants.css +0 -1
package/lib/util/dataTypes.js
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.normalize = normalize;
|
|
6
|
-
exports.url = url;
|
|
7
|
-
exports.number = number;
|
|
8
|
-
exports.percentage = percentage;
|
|
9
|
-
exports.length = length;
|
|
10
|
-
exports.lineWidth = lineWidth;
|
|
11
|
-
exports.shadow = shadow;
|
|
12
|
-
exports.color = color;
|
|
13
|
-
exports.image = image;
|
|
14
|
-
exports.gradient = gradient;
|
|
15
|
-
exports.position = position;
|
|
16
|
-
exports.familyName = familyName;
|
|
17
|
-
exports.genericName = genericName;
|
|
18
|
-
exports.absoluteSize = absoluteSize;
|
|
19
|
-
exports.relativeSize = relativeSize;
|
|
20
|
-
var _color = require("./color");
|
|
21
|
-
var _parseBoxShadowValue = require("./parseBoxShadowValue");
|
|
22
|
-
let cssFunctions = [
|
|
23
|
-
'min',
|
|
24
|
-
'max',
|
|
25
|
-
'clamp',
|
|
26
|
-
'calc'
|
|
27
|
-
];
|
|
28
|
-
// Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types
|
|
29
|
-
let COMMA = /,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
|
|
30
|
-
;
|
|
31
|
-
let UNDERSCORE = /_(?![^(]*\))/g // Underscore separator that is not located between brackets. E.g.: `rgba(255,_255,_255)_black` these don't count.
|
|
32
|
-
;
|
|
33
|
-
function normalize(value, isRoot = true) {
|
|
34
|
-
// Keep raw strings if it starts with `url(`
|
|
35
|
-
if (value.includes('url(')) {
|
|
36
|
-
return value.split(/(url\(.*?\))/g).filter(Boolean).map((part)=>{
|
|
37
|
-
if (/^url\(.*?\)$/.test(part)) {
|
|
38
|
-
return part;
|
|
39
|
-
}
|
|
40
|
-
return normalize(part, false);
|
|
41
|
-
}).join('');
|
|
42
|
-
}
|
|
43
|
-
// Convert `_` to ` `, except for escaped underscores `\_`
|
|
44
|
-
value = value.replace(/([^\\])_+/g, (fullMatch, characterBefore)=>characterBefore + ' '.repeat(fullMatch.length - 1)
|
|
45
|
-
).replace(/^_/g, ' ').replace(/\\_/g, '_');
|
|
46
|
-
// Remove leftover whitespace
|
|
47
|
-
if (isRoot) {
|
|
48
|
-
value = value.trim();
|
|
49
|
-
}
|
|
50
|
-
// Add spaces around operators inside calc() that do not follow an operator
|
|
51
|
-
// or '('.
|
|
52
|
-
return value.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, '$1 $2 ');
|
|
53
|
-
}
|
|
54
|
-
function url(value) {
|
|
55
|
-
return value.startsWith('url(');
|
|
56
|
-
}
|
|
57
|
-
function number(value) {
|
|
58
|
-
return !isNaN(Number(value)) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?`).test(value)
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
function percentage(value) {
|
|
62
|
-
return /%$/g.test(value) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?%`).test(value)
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
let lengthUnits = [
|
|
66
|
-
'cm',
|
|
67
|
-
'mm',
|
|
68
|
-
'Q',
|
|
69
|
-
'in',
|
|
70
|
-
'pc',
|
|
71
|
-
'pt',
|
|
72
|
-
'px',
|
|
73
|
-
'em',
|
|
74
|
-
'ex',
|
|
75
|
-
'ch',
|
|
76
|
-
'rem',
|
|
77
|
-
'lh',
|
|
78
|
-
'vw',
|
|
79
|
-
'vh',
|
|
80
|
-
'vmin',
|
|
81
|
-
'vmax',
|
|
82
|
-
];
|
|
83
|
-
let lengthUnitsPattern = `(?:${lengthUnits.join('|')})`;
|
|
84
|
-
function length(value) {
|
|
85
|
-
return value.split(UNDERSCORE).every((part)=>{
|
|
86
|
-
return part === '0' || new RegExp(`${lengthUnitsPattern}$`).test(part) || cssFunctions.some((fn)=>new RegExp(`^${fn}\\(.+?${lengthUnitsPattern}`).test(part)
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
let lineWidths = new Set([
|
|
91
|
-
'thin',
|
|
92
|
-
'medium',
|
|
93
|
-
'thick'
|
|
94
|
-
]);
|
|
95
|
-
function lineWidth(value) {
|
|
96
|
-
return lineWidths.has(value);
|
|
97
|
-
}
|
|
98
|
-
function shadow(value) {
|
|
99
|
-
let parsedShadows = (0, _parseBoxShadowValue).parseBoxShadowValue(normalize(value));
|
|
100
|
-
for (let parsedShadow of parsedShadows){
|
|
101
|
-
if (!parsedShadow.valid) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
function color(value) {
|
|
108
|
-
let colors = 0;
|
|
109
|
-
let result = value.split(UNDERSCORE).every((part)=>{
|
|
110
|
-
part = normalize(part);
|
|
111
|
-
if (part.startsWith('var(')) return true;
|
|
112
|
-
if ((0, _color).parseColor(part) !== null) return colors++, true;
|
|
113
|
-
return false;
|
|
114
|
-
});
|
|
115
|
-
if (!result) return false;
|
|
116
|
-
return colors > 0;
|
|
117
|
-
}
|
|
118
|
-
function image(value) {
|
|
119
|
-
let images = 0;
|
|
120
|
-
let result = value.split(COMMA).every((part)=>{
|
|
121
|
-
part = normalize(part);
|
|
122
|
-
if (part.startsWith('var(')) return true;
|
|
123
|
-
if (url(part) || gradient(part) || [
|
|
124
|
-
'element(',
|
|
125
|
-
'image(',
|
|
126
|
-
'cross-fade(',
|
|
127
|
-
'image-set('
|
|
128
|
-
].some((fn)=>part.startsWith(fn)
|
|
129
|
-
)) {
|
|
130
|
-
images++;
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
return false;
|
|
134
|
-
});
|
|
135
|
-
if (!result) return false;
|
|
136
|
-
return images > 0;
|
|
137
|
-
}
|
|
138
|
-
let gradientTypes = new Set([
|
|
139
|
-
'linear-gradient',
|
|
140
|
-
'radial-gradient',
|
|
141
|
-
'repeating-linear-gradient',
|
|
142
|
-
'repeating-radial-gradient',
|
|
143
|
-
'conic-gradient',
|
|
144
|
-
]);
|
|
145
|
-
function gradient(value) {
|
|
146
|
-
value = normalize(value);
|
|
147
|
-
for (let type of gradientTypes){
|
|
148
|
-
if (value.startsWith(`${type}(`)) {
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
let validPositions = new Set([
|
|
155
|
-
'center',
|
|
156
|
-
'top',
|
|
157
|
-
'right',
|
|
158
|
-
'bottom',
|
|
159
|
-
'left'
|
|
160
|
-
]);
|
|
161
|
-
function position(value) {
|
|
162
|
-
let positions = 0;
|
|
163
|
-
let result = value.split(UNDERSCORE).every((part)=>{
|
|
164
|
-
part = normalize(part);
|
|
165
|
-
if (part.startsWith('var(')) return true;
|
|
166
|
-
if (validPositions.has(part) || length(part) || percentage(part)) {
|
|
167
|
-
positions++;
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
return false;
|
|
171
|
-
});
|
|
172
|
-
if (!result) return false;
|
|
173
|
-
return positions > 0;
|
|
174
|
-
}
|
|
175
|
-
function familyName(value) {
|
|
176
|
-
let fonts = 0;
|
|
177
|
-
let result = value.split(COMMA).every((part)=>{
|
|
178
|
-
part = normalize(part);
|
|
179
|
-
if (part.startsWith('var(')) return true;
|
|
180
|
-
// If it contains spaces, then it should be quoted
|
|
181
|
-
if (part.includes(' ')) {
|
|
182
|
-
if (!/(['"])([^"']+)\1/g.test(part)) {
|
|
183
|
-
return false;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
// If it starts with a number, it's invalid
|
|
187
|
-
if (/^\d/g.test(part)) {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
fonts++;
|
|
191
|
-
return true;
|
|
192
|
-
});
|
|
193
|
-
if (!result) return false;
|
|
194
|
-
return fonts > 0;
|
|
195
|
-
}
|
|
196
|
-
let genericNames = new Set([
|
|
197
|
-
'serif',
|
|
198
|
-
'sans-serif',
|
|
199
|
-
'monospace',
|
|
200
|
-
'cursive',
|
|
201
|
-
'fantasy',
|
|
202
|
-
'system-ui',
|
|
203
|
-
'ui-serif',
|
|
204
|
-
'ui-sans-serif',
|
|
205
|
-
'ui-monospace',
|
|
206
|
-
'ui-rounded',
|
|
207
|
-
'math',
|
|
208
|
-
'emoji',
|
|
209
|
-
'fangsong',
|
|
210
|
-
]);
|
|
211
|
-
function genericName(value) {
|
|
212
|
-
return genericNames.has(value);
|
|
213
|
-
}
|
|
214
|
-
let absoluteSizes = new Set([
|
|
215
|
-
'xx-small',
|
|
216
|
-
'x-small',
|
|
217
|
-
'small',
|
|
218
|
-
'medium',
|
|
219
|
-
'large',
|
|
220
|
-
'x-large',
|
|
221
|
-
'x-large',
|
|
222
|
-
'xxx-large',
|
|
223
|
-
]);
|
|
224
|
-
function absoluteSize(value) {
|
|
225
|
-
return absoluteSizes.has(value);
|
|
226
|
-
}
|
|
227
|
-
let relativeSizes = new Set([
|
|
228
|
-
'larger',
|
|
229
|
-
'smaller'
|
|
230
|
-
]);
|
|
231
|
-
function relativeSize(value) {
|
|
232
|
-
return relativeSizes.has(value);
|
|
233
|
-
}
|
package/lib/util/defaults.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.defaults = defaults;
|
|
6
|
-
function defaults(target, ...sources) {
|
|
7
|
-
for (let source of sources){
|
|
8
|
-
for(let k in source){
|
|
9
|
-
var ref;
|
|
10
|
-
if (!(target === null || target === void 0 ? void 0 : (ref = target.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(target, k))) {
|
|
11
|
-
target[k] = source[k];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
for (let k1 of Object.getOwnPropertySymbols(source)){
|
|
15
|
-
var ref1;
|
|
16
|
-
if (!(target === null || target === void 0 ? void 0 : (ref1 = target.hasOwnProperty) === null || ref1 === void 0 ? void 0 : ref1.call(target, k1))) {
|
|
17
|
-
target[k1] = source[k1];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return target;
|
|
22
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = escapeClassName;
|
|
6
|
-
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
|
7
|
-
var _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
|
|
8
|
-
function _interopRequireDefault(obj) {
|
|
9
|
-
return obj && obj.__esModule ? obj : {
|
|
10
|
-
default: obj
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function escapeClassName(className) {
|
|
14
|
-
var ref;
|
|
15
|
-
let node = _postcssSelectorParser.default.className();
|
|
16
|
-
node.value = className;
|
|
17
|
-
var ref1;
|
|
18
|
-
return (0, _escapeCommas).default((ref1 = node === null || node === void 0 ? void 0 : (ref = node.raws) === null || ref === void 0 ? void 0 : ref.value) !== null && ref1 !== void 0 ? ref1 : node.value);
|
|
19
|
-
}
|
package/lib/util/escapeCommas.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
const flattenColorPalette = (colors)=>Object.assign({}, ...Object.entries(colors !== null && colors !== void 0 ? colors : {}).flatMap(([color, values])=>typeof values == 'object' ? Object.entries(flattenColorPalette(values)).map(([number, hex])=>({
|
|
7
|
-
[color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex
|
|
8
|
-
})
|
|
9
|
-
) : [
|
|
10
|
-
{
|
|
11
|
-
[`${color}`]: values
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
))
|
|
15
|
-
;
|
|
16
|
-
var _default = flattenColorPalette;
|
|
17
|
-
exports.default = _default;
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.formatVariantSelector = formatVariantSelector;
|
|
6
|
-
exports.finalizeSelector = finalizeSelector;
|
|
7
|
-
exports.selectorFunctions = void 0;
|
|
8
|
-
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
|
9
|
-
var _unesc = _interopRequireDefault(require("postcss-selector-parser/dist/util/unesc"));
|
|
10
|
-
var _escapeClassName = _interopRequireDefault(require("../util/escapeClassName"));
|
|
11
|
-
var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
|
|
12
|
-
function _interopRequireDefault(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
let MERGE = ':merge';
|
|
18
|
-
let PARENT = '&';
|
|
19
|
-
let selectorFunctions = new Set([
|
|
20
|
-
MERGE
|
|
21
|
-
]);
|
|
22
|
-
exports.selectorFunctions = selectorFunctions;
|
|
23
|
-
function formatVariantSelector(current, ...others) {
|
|
24
|
-
for (let other of others){
|
|
25
|
-
let incomingValue = resolveFunctionArgument(other, MERGE);
|
|
26
|
-
if (incomingValue !== null) {
|
|
27
|
-
let existingValue = resolveFunctionArgument(current, MERGE, incomingValue);
|
|
28
|
-
if (existingValue !== null) {
|
|
29
|
-
let existingTarget = `${MERGE}(${incomingValue})`;
|
|
30
|
-
let splitIdx = other.indexOf(existingTarget);
|
|
31
|
-
let addition = other.slice(splitIdx + existingTarget.length).split(' ')[0];
|
|
32
|
-
current = current.replace(existingTarget, existingTarget + addition);
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
current = other.replace(PARENT, current);
|
|
37
|
-
}
|
|
38
|
-
return current;
|
|
39
|
-
}
|
|
40
|
-
function finalizeSelector(format, { selector: selector1 , candidate , context }) {
|
|
41
|
-
var ref, ref1;
|
|
42
|
-
var ref2;
|
|
43
|
-
let separator = (ref2 = context === null || context === void 0 ? void 0 : (ref = context.tailwindConfig) === null || ref === void 0 ? void 0 : ref.separator) !== null && ref2 !== void 0 ? ref2 : ':';
|
|
44
|
-
// Split by the separator, but ignore the separator inside square brackets:
|
|
45
|
-
//
|
|
46
|
-
// E.g.: dark:lg:hover:[paint-order:markers]
|
|
47
|
-
// ┬ ┬ ┬ ┬
|
|
48
|
-
// │ │ │ ╰── We will not split here
|
|
49
|
-
// ╰──┴─────┴─────────────── We will split here
|
|
50
|
-
//
|
|
51
|
-
let splitter = new RegExp(`\\${separator}(?![^[]*\\])`);
|
|
52
|
-
let base = candidate.split(splitter).pop();
|
|
53
|
-
if (context === null || context === void 0 ? void 0 : (ref1 = context.tailwindConfig) === null || ref1 === void 0 ? void 0 : ref1.prefix) {
|
|
54
|
-
format = (0, _prefixSelector).default(context.tailwindConfig.prefix, format);
|
|
55
|
-
}
|
|
56
|
-
format = format.replace(PARENT, `.${(0, _escapeClassName).default(candidate)}`);
|
|
57
|
-
// Normalize escaped classes, e.g.:
|
|
58
|
-
//
|
|
59
|
-
// The idea would be to replace the escaped `base` in the selector with the
|
|
60
|
-
// `format`. However, in css you can escape the same selector in a few
|
|
61
|
-
// different ways. This would result in different strings and therefore we
|
|
62
|
-
// can't replace it properly.
|
|
63
|
-
//
|
|
64
|
-
// base: bg-[rgb(255,0,0)]
|
|
65
|
-
// base in selector: bg-\\[rgb\\(255\\,0\\,0\\)\\]
|
|
66
|
-
// escaped base: bg-\\[rgb\\(255\\2c 0\\2c 0\\)\\]
|
|
67
|
-
//
|
|
68
|
-
selector1 = (0, _postcssSelectorParser).default((selectors)=>{
|
|
69
|
-
return selectors.walkClasses((node)=>{
|
|
70
|
-
if (node.raws && node.value.includes(base)) {
|
|
71
|
-
node.raws.value = (0, _escapeClassName).default((0, _unesc).default(node.raws.value));
|
|
72
|
-
}
|
|
73
|
-
return node;
|
|
74
|
-
});
|
|
75
|
-
}).processSync(selector1);
|
|
76
|
-
// We can safely replace the escaped base now, since the `base` section is
|
|
77
|
-
// now in a normalized escaped value.
|
|
78
|
-
selector1 = selector1.replace(`.${(0, _escapeClassName).default(base)}`, format);
|
|
79
|
-
// Remove unnecessary pseudo selectors that we used as placeholders
|
|
80
|
-
return (0, _postcssSelectorParser).default((selectors)=>{
|
|
81
|
-
return selectors.map((selector2)=>{
|
|
82
|
-
selector2.walkPseudos((p)=>{
|
|
83
|
-
if (selectorFunctions.has(p.value)) {
|
|
84
|
-
p.replaceWith(p.nodes);
|
|
85
|
-
}
|
|
86
|
-
return p;
|
|
87
|
-
});
|
|
88
|
-
// This will make sure to move pseudo's to the correct spot (the end for
|
|
89
|
-
// pseudo elements) because otherwise the selector will never work
|
|
90
|
-
// anyway.
|
|
91
|
-
//
|
|
92
|
-
// E.g.:
|
|
93
|
-
// - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
|
94
|
-
// - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
|
95
|
-
//
|
|
96
|
-
// `::before:hover` doesn't work, which means that we can make it work for you by flipping the order.
|
|
97
|
-
function collectPseudoElements(selector) {
|
|
98
|
-
let nodes = [];
|
|
99
|
-
for (let node of selector.nodes){
|
|
100
|
-
if (isPseudoElement(node)) {
|
|
101
|
-
nodes.push(node);
|
|
102
|
-
selector.removeChild(node);
|
|
103
|
-
}
|
|
104
|
-
if (node === null || node === void 0 ? void 0 : node.nodes) {
|
|
105
|
-
nodes.push(...collectPseudoElements(node));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return nodes;
|
|
109
|
-
}
|
|
110
|
-
let pseudoElements = collectPseudoElements(selector2);
|
|
111
|
-
if (pseudoElements.length > 0) {
|
|
112
|
-
selector2.nodes.push(pseudoElements.sort(sortSelector));
|
|
113
|
-
}
|
|
114
|
-
return selector2;
|
|
115
|
-
});
|
|
116
|
-
}).processSync(selector1);
|
|
117
|
-
}
|
|
118
|
-
// Note: As a rule, double colons (::) should be used instead of a single colon
|
|
119
|
-
// (:). This distinguishes pseudo-classes from pseudo-elements. However, since
|
|
120
|
-
// this distinction was not present in older versions of the W3C spec, most
|
|
121
|
-
// browsers support both syntaxes for the original pseudo-elements.
|
|
122
|
-
let pseudoElementsBC = [
|
|
123
|
-
':before',
|
|
124
|
-
':after',
|
|
125
|
-
':first-line',
|
|
126
|
-
':first-letter'
|
|
127
|
-
];
|
|
128
|
-
// These pseudo-elements _can_ be combined with other pseudo selectors AND the order does matter.
|
|
129
|
-
let pseudoElementExceptions = [
|
|
130
|
-
'::file-selector-button'
|
|
131
|
-
];
|
|
132
|
-
// This will make sure to move pseudo's to the correct spot (the end for
|
|
133
|
-
// pseudo elements) because otherwise the selector will never work
|
|
134
|
-
// anyway.
|
|
135
|
-
//
|
|
136
|
-
// E.g.:
|
|
137
|
-
// - `before:hover:text-center` would result in `.before\:hover\:text-center:hover::before`
|
|
138
|
-
// - `hover:before:text-center` would result in `.hover\:before\:text-center:hover::before`
|
|
139
|
-
//
|
|
140
|
-
// `::before:hover` doesn't work, which means that we can make it work
|
|
141
|
-
// for you by flipping the order.
|
|
142
|
-
function sortSelector(a, z) {
|
|
143
|
-
// Both nodes are non-pseudo's so we can safely ignore them and keep
|
|
144
|
-
// them in the same order.
|
|
145
|
-
if (a.type !== 'pseudo' && z.type !== 'pseudo') {
|
|
146
|
-
return 0;
|
|
147
|
-
}
|
|
148
|
-
// If one of them is a combinator, we need to keep it in the same order
|
|
149
|
-
// because that means it will start a new "section" in the selector.
|
|
150
|
-
if (a.type === 'combinator' ^ z.type === 'combinator') {
|
|
151
|
-
return 0;
|
|
152
|
-
}
|
|
153
|
-
// One of the items is a pseudo and the other one isn't. Let's move
|
|
154
|
-
// the pseudo to the right.
|
|
155
|
-
if (a.type === 'pseudo' ^ z.type === 'pseudo') {
|
|
156
|
-
return (a.type === 'pseudo') - (z.type === 'pseudo');
|
|
157
|
-
}
|
|
158
|
-
// Both are pseudo's, move the pseudo elements (except for
|
|
159
|
-
// ::file-selector-button) to the right.
|
|
160
|
-
return isPseudoElement(a) - isPseudoElement(z);
|
|
161
|
-
}
|
|
162
|
-
function isPseudoElement(node) {
|
|
163
|
-
if (node.type !== 'pseudo') return false;
|
|
164
|
-
if (pseudoElementExceptions.includes(node.value)) return false;
|
|
165
|
-
return node.value.startsWith('::') || pseudoElementsBC.includes(node.value);
|
|
166
|
-
}
|
|
167
|
-
function resolveFunctionArgument(haystack, needle, arg) {
|
|
168
|
-
let startIdx = haystack.indexOf(arg ? `${needle}(${arg})` : needle);
|
|
169
|
-
if (startIdx === -1) return null;
|
|
170
|
-
// Start inside the `(`
|
|
171
|
-
startIdx += needle.length + 1;
|
|
172
|
-
let target = '';
|
|
173
|
-
let count = 0;
|
|
174
|
-
for (let char of haystack.slice(startIdx)){
|
|
175
|
-
if (char !== '(' && char !== ')') {
|
|
176
|
-
target += char;
|
|
177
|
-
} else if (char === '(') {
|
|
178
|
-
target += char;
|
|
179
|
-
count++;
|
|
180
|
-
} else if (char === ')') {
|
|
181
|
-
if (--count < 0) break; // unbalanced
|
|
182
|
-
target += char;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return target;
|
|
186
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = getAllConfigs;
|
|
6
|
-
var _defaultConfigStubJs = _interopRequireDefault(require("../../stubs/defaultConfig.stub.js"));
|
|
7
|
-
var _featureFlags = require("../featureFlags");
|
|
8
|
-
function _interopRequireDefault(obj) {
|
|
9
|
-
return obj && obj.__esModule ? obj : {
|
|
10
|
-
default: obj
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function getAllConfigs(config) {
|
|
14
|
-
var ref;
|
|
15
|
-
const configs = ((ref = config === null || config === void 0 ? void 0 : config.presets) !== null && ref !== void 0 ? ref : [
|
|
16
|
-
_defaultConfigStubJs.default
|
|
17
|
-
]).slice().reverse().flatMap((preset)=>getAllConfigs(preset instanceof Function ? preset() : preset)
|
|
18
|
-
);
|
|
19
|
-
const features = {
|
|
20
|
-
};
|
|
21
|
-
const experimentals = Object.keys(features).filter((feature)=>(0, _featureFlags).flagEnabled(config, feature)
|
|
22
|
-
).map((feature)=>features[feature]
|
|
23
|
-
);
|
|
24
|
-
return [
|
|
25
|
-
config,
|
|
26
|
-
...experimentals,
|
|
27
|
-
...configs
|
|
28
|
-
];
|
|
29
|
-
}
|
package/lib/util/hashConfig.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = hashConfig;
|
|
6
|
-
var _objectHash = _interopRequireDefault(require("object-hash"));
|
|
7
|
-
function _interopRequireDefault(obj) {
|
|
8
|
-
return obj && obj.__esModule ? obj : {
|
|
9
|
-
default: obj
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function hashConfig(config) {
|
|
13
|
-
return (0, _objectHash).default(config, {
|
|
14
|
-
ignoreUnknown: true
|
|
15
|
-
});
|
|
16
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = isPlainObject;
|
|
6
|
-
function isPlainObject(value) {
|
|
7
|
-
if (Object.prototype.toString.call(value) !== '[object Object]') {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
const prototype = Object.getPrototypeOf(value);
|
|
11
|
-
return prototype === null || prototype === Object.prototype;
|
|
12
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.default = isValidArbitraryValue;
|
|
6
|
-
let matchingBrackets = new Map([
|
|
7
|
-
[
|
|
8
|
-
'{',
|
|
9
|
-
'}'
|
|
10
|
-
],
|
|
11
|
-
[
|
|
12
|
-
'[',
|
|
13
|
-
']'
|
|
14
|
-
],
|
|
15
|
-
[
|
|
16
|
-
'(',
|
|
17
|
-
')'
|
|
18
|
-
],
|
|
19
|
-
]);
|
|
20
|
-
let inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v])=>[
|
|
21
|
-
v,
|
|
22
|
-
k
|
|
23
|
-
]
|
|
24
|
-
));
|
|
25
|
-
let quotes = new Set([
|
|
26
|
-
'"',
|
|
27
|
-
"'",
|
|
28
|
-
'`'
|
|
29
|
-
]);
|
|
30
|
-
function isValidArbitraryValue(value) {
|
|
31
|
-
let stack = [];
|
|
32
|
-
let inQuotes = false;
|
|
33
|
-
for(let i = 0; i < value.length; i++){
|
|
34
|
-
let char = value[i];
|
|
35
|
-
if (char === ':' && !inQuotes && stack.length === 0) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
// Non-escaped quotes allow us to "allow" anything in between
|
|
39
|
-
if (quotes.has(char) && value[i - 1] !== '\\') {
|
|
40
|
-
inQuotes = !inQuotes;
|
|
41
|
-
}
|
|
42
|
-
if (inQuotes) continue;
|
|
43
|
-
if (value[i - 1] === '\\') continue; // Escaped
|
|
44
|
-
if (matchingBrackets.has(char)) {
|
|
45
|
-
stack.push(char);
|
|
46
|
-
} else if (inverseMatchingBrackets.has(char)) {
|
|
47
|
-
let inverse = inverseMatchingBrackets.get(char);
|
|
48
|
-
// Nothing to pop from, therefore it is unbalanced
|
|
49
|
-
if (stack.length <= 0) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
// Popped value must match the inverse value, otherwise it is unbalanced
|
|
53
|
-
if (stack.pop() !== inverse) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// If there is still something on the stack, it is also unbalanced
|
|
59
|
-
if (stack.length > 0) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
// All good, totally balanced!
|
|
63
|
-
return true;
|
|
64
|
-
}
|
package/lib/util/log.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.dim = dim;
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _picocolors = _interopRequireDefault(require("picocolors"));
|
|
8
|
-
function _interopRequireDefault(obj) {
|
|
9
|
-
return obj && obj.__esModule ? obj : {
|
|
10
|
-
default: obj
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
let alreadyShown = new Set();
|
|
14
|
-
function log(type, messages, key) {
|
|
15
|
-
if (process.env.JEST_WORKER_ID !== undefined) return;
|
|
16
|
-
if (key && alreadyShown.has(key)) return;
|
|
17
|
-
if (key) alreadyShown.add(key);
|
|
18
|
-
console.warn('');
|
|
19
|
-
messages.forEach((message)=>console.warn(type, '-', message)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function dim(input) {
|
|
23
|
-
return _picocolors.default.dim(input);
|
|
24
|
-
}
|
|
25
|
-
var _default = {
|
|
26
|
-
info (key, messages) {
|
|
27
|
-
log(_picocolors.default.bold(_picocolors.default.cyan('info')), ...Array.isArray(key) ? [
|
|
28
|
-
key
|
|
29
|
-
] : [
|
|
30
|
-
messages,
|
|
31
|
-
key
|
|
32
|
-
]);
|
|
33
|
-
},
|
|
34
|
-
warn (key, messages) {
|
|
35
|
-
log(_picocolors.default.bold(_picocolors.default.yellow('warn')), ...Array.isArray(key) ? [
|
|
36
|
-
key
|
|
37
|
-
] : [
|
|
38
|
-
messages,
|
|
39
|
-
key
|
|
40
|
-
]);
|
|
41
|
-
},
|
|
42
|
-
risk (key, messages) {
|
|
43
|
-
log(_picocolors.default.bold(_picocolors.default.magenta('risk')), ...Array.isArray(key) ? [
|
|
44
|
-
key
|
|
45
|
-
] : [
|
|
46
|
-
messages,
|
|
47
|
-
key
|
|
48
|
-
]);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
exports.default = _default;
|