tailwindcss 3.0.2 → 3.0.6
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 +1905 -0
- package/lib/corePlugins.js +99 -117
- package/lib/css/preflight.css +2 -2
- package/lib/lib/evaluateTailwindFunctions.js +1 -1
- package/lib/lib/expandTailwindAtRules.js +25 -1
- package/lib/lib/generateRules.js +19 -2
- package/lib/lib/setupContextUtils.js +40 -6
- package/lib/util/defaults.js +6 -0
- package/lib/util/log.js +4 -0
- package/lib/util/normalizeConfig.js +34 -5
- package/lib/util/toPath.js +6 -1
- package/package.json +4 -3
- package/peers/index.js +148 -72
- package/src/corePlugins.js +100 -114
- package/src/css/preflight.css +2 -2
- package/src/lib/evaluateTailwindFunctions.js +1 -1
- package/src/lib/expandTailwindAtRules.js +23 -0
- package/src/lib/generateRules.js +24 -2
- package/src/lib/setupContextUtils.js +39 -6
- package/src/util/defaults.js +6 -0
- package/src/util/log.js +4 -0
- package/src/util/normalizeConfig.js +14 -1
- package/src/util/toPath.js +23 -1
- package/stubs/defaultConfig.stub.js +2 -2
- package/peers/.svgo.yml +0 -75
- package/peers/orders/concentric-css.json +0 -299
- package/peers/orders/smacss.json +0 -299
- package/peers/orders/source.json +0 -295
- package/src/.DS_Store +0 -0
package/lib/corePlugins.js
CHANGED
|
@@ -914,26 +914,24 @@ let corePlugins = {
|
|
|
914
914
|
], {
|
|
915
915
|
supportsNegativeValues: true
|
|
916
916
|
}),
|
|
917
|
-
transform: ({
|
|
918
|
-
|
|
919
|
-
'
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
'--tw-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
].join(' ')
|
|
936
|
-
}
|
|
917
|
+
transform: ({ addDefaults , addUtilities })=>{
|
|
918
|
+
addDefaults('transform', {
|
|
919
|
+
'--tw-translate-x': '0',
|
|
920
|
+
'--tw-translate-y': '0',
|
|
921
|
+
'--tw-rotate': '0',
|
|
922
|
+
'--tw-skew-x': '0',
|
|
923
|
+
'--tw-skew-y': '0',
|
|
924
|
+
'--tw-scale-x': '1',
|
|
925
|
+
'--tw-scale-y': '1',
|
|
926
|
+
'--tw-transform': [
|
|
927
|
+
'translateX(var(--tw-translate-x))',
|
|
928
|
+
'translateY(var(--tw-translate-y))',
|
|
929
|
+
'rotate(var(--tw-rotate))',
|
|
930
|
+
'skewX(var(--tw-skew-x))',
|
|
931
|
+
'skewY(var(--tw-skew-y))',
|
|
932
|
+
'scaleX(var(--tw-scale-x))',
|
|
933
|
+
'scaleY(var(--tw-scale-y))',
|
|
934
|
+
].join(' ')
|
|
937
935
|
});
|
|
938
936
|
addUtilities({
|
|
939
937
|
'.transform': {
|
|
@@ -1001,14 +999,12 @@ let corePlugins = {
|
|
|
1001
999
|
});
|
|
1002
1000
|
},
|
|
1003
1001
|
cursor: (0, _createUtilityPlugin).default('cursor'),
|
|
1004
|
-
touchAction: ({
|
|
1005
|
-
|
|
1006
|
-
'
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
'--tw-touch-action': 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)'
|
|
1011
|
-
}
|
|
1002
|
+
touchAction: ({ addDefaults , addUtilities })=>{
|
|
1003
|
+
addDefaults('touch-action', {
|
|
1004
|
+
'--tw-pan-x': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1005
|
+
'--tw-pan-y': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1006
|
+
'--tw-pinch-zoom': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1007
|
+
'--tw-touch-action': 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)'
|
|
1012
1008
|
});
|
|
1013
1009
|
addUtilities({
|
|
1014
1010
|
'.touch-auto': {
|
|
@@ -1096,11 +1092,9 @@ let corePlugins = {
|
|
|
1096
1092
|
}
|
|
1097
1093
|
});
|
|
1098
1094
|
},
|
|
1099
|
-
scrollSnapType: ({
|
|
1100
|
-
|
|
1101
|
-
'
|
|
1102
|
-
'--tw-scroll-snap-strictness': 'proximity'
|
|
1103
|
-
}
|
|
1095
|
+
scrollSnapType: ({ addDefaults , addUtilities })=>{
|
|
1096
|
+
addDefaults('scroll-snap-type', {
|
|
1097
|
+
'--tw-scroll-snap-strictness': 'proximity'
|
|
1104
1098
|
});
|
|
1105
1099
|
addUtilities({
|
|
1106
1100
|
'.snap-none': {
|
|
@@ -2095,22 +2089,18 @@ let corePlugins = {
|
|
|
2095
2089
|
}
|
|
2096
2090
|
});
|
|
2097
2091
|
},
|
|
2098
|
-
borderColor: ({
|
|
2092
|
+
borderColor: ({ addDefaults , matchUtilities , theme , corePlugins: corePlugins2 })=>{
|
|
2099
2093
|
if (!corePlugins2('borderOpacity')) {
|
|
2100
2094
|
let value = theme('borderColor.DEFAULT', 'currentColor');
|
|
2101
|
-
|
|
2102
|
-
'
|
|
2103
|
-
'border-color': (0, _toColorValue).default(value)
|
|
2104
|
-
}
|
|
2095
|
+
addDefaults('border-width', {
|
|
2096
|
+
'border-color': (0, _toColorValue).default(value)
|
|
2105
2097
|
});
|
|
2106
2098
|
} else {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
})
|
|
2113
|
-
});
|
|
2099
|
+
addDefaults('border-width', (0, _withAlphaVariable).default({
|
|
2100
|
+
color: theme('borderColor.DEFAULT', 'currentColor'),
|
|
2101
|
+
property: 'border-color',
|
|
2102
|
+
variable: '--tw-border-opacity'
|
|
2103
|
+
}));
|
|
2114
2104
|
}
|
|
2115
2105
|
matchUtilities({
|
|
2116
2106
|
border: (value)=>{
|
|
@@ -2792,16 +2782,16 @@ let corePlugins = {
|
|
|
2792
2782
|
textDecoration: ({ addUtilities })=>{
|
|
2793
2783
|
addUtilities({
|
|
2794
2784
|
'.underline': {
|
|
2795
|
-
'text-decoration': 'underline'
|
|
2785
|
+
'text-decoration-line': 'underline'
|
|
2796
2786
|
},
|
|
2797
2787
|
'.overline': {
|
|
2798
|
-
'text-decoration': 'overline'
|
|
2788
|
+
'text-decoration-line': 'overline'
|
|
2799
2789
|
},
|
|
2800
2790
|
'.line-through': {
|
|
2801
|
-
'text-decoration': 'line-through'
|
|
2791
|
+
'text-decoration-line': 'line-through'
|
|
2802
2792
|
},
|
|
2803
2793
|
'.no-underline': {
|
|
2804
|
-
'text-decoration': 'none'
|
|
2794
|
+
'text-decoration-line': 'none'
|
|
2805
2795
|
}
|
|
2806
2796
|
});
|
|
2807
2797
|
},
|
|
@@ -3064,14 +3054,12 @@ let corePlugins = {
|
|
|
3064
3054
|
`var(--tw-ring-shadow, 0 0 #0000)`,
|
|
3065
3055
|
`var(--tw-shadow)`,
|
|
3066
3056
|
].join(', ');
|
|
3067
|
-
return function({ matchUtilities ,
|
|
3068
|
-
|
|
3069
|
-
'
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
'--tw-shadow-colored': '0 0 #0000'
|
|
3074
|
-
}
|
|
3057
|
+
return function({ matchUtilities , addDefaults , theme }) {
|
|
3058
|
+
addDefaults(' box-shadow', {
|
|
3059
|
+
'--tw-ring-offset-shadow': '0 0 #0000',
|
|
3060
|
+
'--tw-ring-shadow': '0 0 #0000',
|
|
3061
|
+
'--tw-shadow': '0 0 #0000',
|
|
3062
|
+
'--tw-shadow-colored': '0 0 #0000'
|
|
3075
3063
|
});
|
|
3076
3064
|
matchUtilities({
|
|
3077
3065
|
shadow: (value)=>{
|
|
@@ -3180,20 +3168,18 @@ let corePlugins = {
|
|
|
3180
3168
|
]
|
|
3181
3169
|
});
|
|
3182
3170
|
},
|
|
3183
|
-
ringWidth: ({ matchUtilities ,
|
|
3171
|
+
ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme })=>{
|
|
3184
3172
|
let ringOpacityDefault = theme('ringOpacity.DEFAULT', '0.5');
|
|
3185
3173
|
let ringColorDefault = (0, _withAlphaVariable).withAlphaValue(theme('ringColor.DEFAULT'), ringOpacityDefault, `rgb(147 197 253 / ${ringOpacityDefault})`);
|
|
3186
|
-
|
|
3187
|
-
'
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
'--tw-shadow-colored': '0 0 #0000'
|
|
3196
|
-
}
|
|
3174
|
+
addDefaults('ring-width', {
|
|
3175
|
+
'--tw-ring-inset': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3176
|
+
'--tw-ring-offset-width': theme('ringOffsetWidth.DEFAULT', '0px'),
|
|
3177
|
+
'--tw-ring-offset-color': theme('ringOffsetColor.DEFAULT', '#fff'),
|
|
3178
|
+
'--tw-ring-color': ringColorDefault,
|
|
3179
|
+
'--tw-ring-offset-shadow': '0 0 #0000',
|
|
3180
|
+
'--tw-ring-shadow': '0 0 #0000',
|
|
3181
|
+
'--tw-shadow': '0 0 #0000',
|
|
3182
|
+
'--tw-shadow-colored': '0 0 #0000'
|
|
3197
3183
|
});
|
|
3198
3184
|
matchUtilities({
|
|
3199
3185
|
ring: (value)=>{
|
|
@@ -3396,30 +3382,28 @@ let corePlugins = {
|
|
|
3396
3382
|
values: theme('sepia')
|
|
3397
3383
|
});
|
|
3398
3384
|
},
|
|
3399
|
-
filter: ({
|
|
3400
|
-
|
|
3401
|
-
'
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
'--tw-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
].join(' ')
|
|
3422
|
-
}
|
|
3385
|
+
filter: ({ addDefaults , addUtilities })=>{
|
|
3386
|
+
addDefaults('filter', {
|
|
3387
|
+
'--tw-blur': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3388
|
+
'--tw-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3389
|
+
'--tw-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3390
|
+
'--tw-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3391
|
+
'--tw-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3392
|
+
'--tw-invert': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3393
|
+
'--tw-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3394
|
+
'--tw-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3395
|
+
'--tw-drop-shadow': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3396
|
+
'--tw-filter': [
|
|
3397
|
+
'var(--tw-blur)',
|
|
3398
|
+
'var(--tw-brightness)',
|
|
3399
|
+
'var(--tw-contrast)',
|
|
3400
|
+
'var(--tw-grayscale)',
|
|
3401
|
+
'var(--tw-hue-rotate)',
|
|
3402
|
+
'var(--tw-invert)',
|
|
3403
|
+
'var(--tw-saturate)',
|
|
3404
|
+
'var(--tw-sepia)',
|
|
3405
|
+
'var(--tw-drop-shadow)',
|
|
3406
|
+
].join(' ')
|
|
3423
3407
|
});
|
|
3424
3408
|
addUtilities({
|
|
3425
3409
|
'.filter': {
|
|
@@ -3559,30 +3543,28 @@ let corePlugins = {
|
|
|
3559
3543
|
values: theme('backdropSepia')
|
|
3560
3544
|
});
|
|
3561
3545
|
},
|
|
3562
|
-
backdropFilter: ({
|
|
3563
|
-
|
|
3564
|
-
'
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
'--tw-backdrop-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
].join(' ')
|
|
3585
|
-
}
|
|
3546
|
+
backdropFilter: ({ addDefaults , addUtilities })=>{
|
|
3547
|
+
addDefaults('backdrop-filter', {
|
|
3548
|
+
'--tw-backdrop-blur': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3549
|
+
'--tw-backdrop-brightness': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3550
|
+
'--tw-backdrop-contrast': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3551
|
+
'--tw-backdrop-grayscale': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3552
|
+
'--tw-backdrop-hue-rotate': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3553
|
+
'--tw-backdrop-invert': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3554
|
+
'--tw-backdrop-opacity': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3555
|
+
'--tw-backdrop-saturate': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3556
|
+
'--tw-backdrop-sepia': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
3557
|
+
'--tw-backdrop-filter': [
|
|
3558
|
+
'var(--tw-backdrop-blur)',
|
|
3559
|
+
'var(--tw-backdrop-brightness)',
|
|
3560
|
+
'var(--tw-backdrop-contrast)',
|
|
3561
|
+
'var(--tw-backdrop-grayscale)',
|
|
3562
|
+
'var(--tw-backdrop-hue-rotate)',
|
|
3563
|
+
'var(--tw-backdrop-invert)',
|
|
3564
|
+
'var(--tw-backdrop-opacity)',
|
|
3565
|
+
'var(--tw-backdrop-saturate)',
|
|
3566
|
+
'var(--tw-backdrop-sepia)',
|
|
3567
|
+
].join(' ')
|
|
3586
3568
|
});
|
|
3587
3569
|
addUtilities({
|
|
3588
3570
|
'.backdrop-filter': {
|
package/lib/css/preflight.css
CHANGED
|
@@ -144,7 +144,7 @@ sup {
|
|
|
144
144
|
table {
|
|
145
145
|
text-indent: 0; /* 1 */
|
|
146
146
|
border-color: inherit; /* 2 */
|
|
147
|
-
border-collapse: collapse;
|
|
147
|
+
border-collapse: collapse; /* 3 */
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/*
|
|
@@ -310,7 +310,7 @@ textarea {
|
|
|
310
310
|
|
|
311
311
|
input::placeholder,
|
|
312
312
|
textarea::placeholder {
|
|
313
|
-
opacity: 1;
|
|
313
|
+
opacity: 1; /* 1 */
|
|
314
314
|
color: theme('colors.gray.400', #9ca3af); /* 2 */
|
|
315
315
|
}
|
|
316
316
|
|
|
@@ -43,7 +43,7 @@ function listKeys(obj) {
|
|
|
43
43
|
function validatePath(config, path, defaultValue) {
|
|
44
44
|
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+/g, '').replace(/['"]+$/g, '');
|
|
45
45
|
const pathSegments = Array.isArray(path) ? path : (0, _toPath).toPath(pathString);
|
|
46
|
-
const value = (0, _dlv).default(config.theme,
|
|
46
|
+
const value = (0, _dlv).default(config.theme, pathSegments, defaultValue);
|
|
47
47
|
if (value === undefined) {
|
|
48
48
|
let error = `'${pathString}' does not exist in your theme config.`;
|
|
49
49
|
const parentSegments = pathSegments.slice(0, -1);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = expandTailwindAtRules;
|
|
6
|
+
exports.DEFAULTS_LAYER = void 0;
|
|
6
7
|
var _quickLru = _interopRequireDefault(require("quick-lru"));
|
|
7
8
|
var sharedState = _interopRequireWildcard(require("./sharedState"));
|
|
8
9
|
var _generateRules = require("./generateRules");
|
|
@@ -112,6 +113,7 @@ function buildStylesheet(rules, context) {
|
|
|
112
113
|
);
|
|
113
114
|
let returnValue = {
|
|
114
115
|
base: new Set(),
|
|
116
|
+
defaults: new Set(),
|
|
115
117
|
components: new Set(),
|
|
116
118
|
utilities: new Set(),
|
|
117
119
|
variants: new Set(),
|
|
@@ -134,6 +136,10 @@ function buildStylesheet(rules, context) {
|
|
|
134
136
|
returnValue.base.add(rule);
|
|
135
137
|
continue;
|
|
136
138
|
}
|
|
139
|
+
if (sort & context.layerOrder.defaults) {
|
|
140
|
+
returnValue.defaults.add(rule);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
137
143
|
if (sort & context.layerOrder.components) {
|
|
138
144
|
returnValue.components.add(rule);
|
|
139
145
|
continue;
|
|
@@ -149,6 +155,8 @@ function buildStylesheet(rules, context) {
|
|
|
149
155
|
}
|
|
150
156
|
return returnValue;
|
|
151
157
|
}
|
|
158
|
+
const DEFAULTS_LAYER = Symbol('defaults-layer');
|
|
159
|
+
exports.DEFAULTS_LAYER = DEFAULTS_LAYER;
|
|
152
160
|
function expandTailwindAtRules(context) {
|
|
153
161
|
return (root)=>{
|
|
154
162
|
let layerNodes = {
|
|
@@ -199,13 +207,29 @@ function expandTailwindAtRules(context) {
|
|
|
199
207
|
], context);
|
|
200
208
|
}
|
|
201
209
|
env.DEBUG && console.timeEnd('Build stylesheet');
|
|
202
|
-
let { base: baseNodes , components: componentNodes , utilities: utilityNodes , variants: screenNodes , } = context.stylesheetCache;
|
|
210
|
+
let { defaults: defaultNodes , base: baseNodes , components: componentNodes , utilities: utilityNodes , variants: screenNodes , } = context.stylesheetCache;
|
|
203
211
|
// ---
|
|
204
212
|
// Replace any Tailwind directives with generated CSS
|
|
205
213
|
if (layerNodes.base) {
|
|
206
214
|
layerNodes.base.before((0, _cloneNodes).default([
|
|
207
215
|
...baseNodes
|
|
208
216
|
], layerNodes.base.source));
|
|
217
|
+
}
|
|
218
|
+
// @defaults rules are unconditionally added first to ensure that
|
|
219
|
+
// using any utility that relies on defaults will work even when
|
|
220
|
+
// compiled in an isolated environment like CSS modules
|
|
221
|
+
if (context.tailwindConfig[DEFAULTS_LAYER] !== false) {
|
|
222
|
+
if (layerNodes.base) {
|
|
223
|
+
layerNodes.base.after((0, _cloneNodes).default([
|
|
224
|
+
...defaultNodes
|
|
225
|
+
], root.source));
|
|
226
|
+
} else {
|
|
227
|
+
root.prepend((0, _cloneNodes).default([
|
|
228
|
+
...defaultNodes
|
|
229
|
+
], root.source));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (layerNodes.base) {
|
|
209
233
|
layerNodes.base.remove();
|
|
210
234
|
}
|
|
211
235
|
if (layerNodes.components) {
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -253,14 +253,32 @@ function parseRules(rule, cache, options = {
|
|
|
253
253
|
options
|
|
254
254
|
];
|
|
255
255
|
}
|
|
256
|
+
const IS_VALID_PROPERTY_NAME = /^[a-z_-]/;
|
|
257
|
+
function isValidPropName(name) {
|
|
258
|
+
return IS_VALID_PROPERTY_NAME.test(name);
|
|
259
|
+
}
|
|
260
|
+
function isParsableCssValue(property, value) {
|
|
261
|
+
try {
|
|
262
|
+
_postcss.default.parse(`a{${property}:${value}}`).toResult();
|
|
263
|
+
return true;
|
|
264
|
+
} catch (err) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
256
268
|
function extractArbitraryProperty(classCandidate, context) {
|
|
257
269
|
var ref;
|
|
258
270
|
let [, property, value] = (ref = classCandidate.match(/^\[([a-zA-Z0-9-_]+):(\S+)\]$/)) !== null && ref !== void 0 ? ref : [];
|
|
259
271
|
if (value === undefined) {
|
|
260
272
|
return null;
|
|
261
273
|
}
|
|
274
|
+
if (!isValidPropName(property)) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
if (!(0, _isValidArbitraryValue).default(value)) {
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
262
280
|
let normalized = (0, _dataTypes).normalize(value);
|
|
263
|
-
if (!(
|
|
281
|
+
if (!isParsableCssValue(property, normalized)) {
|
|
264
282
|
return null;
|
|
265
283
|
}
|
|
266
284
|
return [
|
|
@@ -313,7 +331,6 @@ function* resolveMatchedPlugins(classCandidate, context) {
|
|
|
313
331
|
context.candidateRuleMap.get(prefix),
|
|
314
332
|
negative ? `-${modifier}` : modifier
|
|
315
333
|
];
|
|
316
|
-
return;
|
|
317
334
|
}
|
|
318
335
|
}
|
|
319
336
|
}
|
|
@@ -271,6 +271,29 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
271
271
|
]);
|
|
272
272
|
}
|
|
273
273
|
},
|
|
274
|
+
/**
|
|
275
|
+
* @param {string} group
|
|
276
|
+
* @param {Record<string, string | string[]>} declarations
|
|
277
|
+
*/ addDefaults (group, declarations) {
|
|
278
|
+
const groups = {
|
|
279
|
+
[`@defaults ${group}`]: declarations
|
|
280
|
+
};
|
|
281
|
+
for (let [identifier, rule] of withIdentifiers(groups)){
|
|
282
|
+
let prefixedIdentifier = prefixIdentifier(identifier, {
|
|
283
|
+
});
|
|
284
|
+
let offset = offsets.base++;
|
|
285
|
+
if (!context.candidateRuleMap.has(prefixedIdentifier)) {
|
|
286
|
+
context.candidateRuleMap.set(prefixedIdentifier, []);
|
|
287
|
+
}
|
|
288
|
+
context.candidateRuleMap.get(prefixedIdentifier).push([
|
|
289
|
+
{
|
|
290
|
+
sort: offset,
|
|
291
|
+
layer: 'defaults'
|
|
292
|
+
},
|
|
293
|
+
rule
|
|
294
|
+
]);
|
|
295
|
+
}
|
|
296
|
+
},
|
|
274
297
|
addComponents (components, options) {
|
|
275
298
|
let defaultOptions = {
|
|
276
299
|
respectPrefix: true,
|
|
@@ -562,6 +585,7 @@ function registerPlugins(plugins, context) {
|
|
|
562
585
|
let variantList = [];
|
|
563
586
|
let variantMap = new Map();
|
|
564
587
|
let offsets = {
|
|
588
|
+
defaults: 0n,
|
|
565
589
|
base: 0n,
|
|
566
590
|
components: 0n,
|
|
567
591
|
utilities: 0n,
|
|
@@ -587,6 +611,7 @@ function registerPlugins(plugins, context) {
|
|
|
587
611
|
)
|
|
588
612
|
)([
|
|
589
613
|
offsets.base,
|
|
614
|
+
offsets.defaults,
|
|
590
615
|
offsets.components,
|
|
591
616
|
offsets.utilities,
|
|
592
617
|
offsets.user,
|
|
@@ -596,12 +621,13 @@ function registerPlugins(plugins, context) {
|
|
|
596
621
|
// so arbitrary properties are always sorted at the end.
|
|
597
622
|
context.arbitraryPropertiesSort = (1n << reservedBits << 0n) - 1n;
|
|
598
623
|
context.layerOrder = {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
624
|
+
defaults: 1n << reservedBits << 0n,
|
|
625
|
+
base: 1n << reservedBits << 1n,
|
|
626
|
+
components: 1n << reservedBits << 2n,
|
|
627
|
+
utilities: 1n << reservedBits << 3n,
|
|
628
|
+
user: 1n << reservedBits << 4n
|
|
603
629
|
};
|
|
604
|
-
reservedBits +=
|
|
630
|
+
reservedBits += 5n;
|
|
605
631
|
let offset = 0;
|
|
606
632
|
context.variantOrder = new Map(variantList.map((variant, i)=>{
|
|
607
633
|
let variantFunctions = variantMap.get(variant).length;
|
|
@@ -652,9 +678,17 @@ function registerPlugins(plugins, context) {
|
|
|
652
678
|
let utils = Array.isArray(util) ? (()=>{
|
|
653
679
|
let [utilName, options] = util;
|
|
654
680
|
var ref;
|
|
655
|
-
|
|
681
|
+
let classes = Object.keys((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {
|
|
656
682
|
}).map((value)=>(0, _nameClass).formatClass(utilName, value)
|
|
657
683
|
);
|
|
684
|
+
if (options === null || options === void 0 ? void 0 : options.supportsNegativeValues) {
|
|
685
|
+
classes = [
|
|
686
|
+
...classes,
|
|
687
|
+
...classes.map((cls)=>'-' + cls
|
|
688
|
+
)
|
|
689
|
+
];
|
|
690
|
+
}
|
|
691
|
+
return classes;
|
|
658
692
|
})() : [
|
|
659
693
|
util
|
|
660
694
|
];
|
package/lib/util/defaults.js
CHANGED
|
@@ -11,6 +11,12 @@ function defaults(target, ...sources) {
|
|
|
11
11
|
target[k] = source[k];
|
|
12
12
|
}
|
|
13
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
|
+
}
|
|
14
20
|
}
|
|
15
21
|
return target;
|
|
16
22
|
}
|
package/lib/util/log.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
exports.dim = dim;
|
|
5
6
|
exports.default = void 0;
|
|
6
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
7
8
|
function _interopRequireDefault(obj) {
|
|
@@ -18,6 +19,9 @@ function log(chalk, messages, key) {
|
|
|
18
19
|
messages.forEach((message)=>console.warn(chalk, '-', message)
|
|
19
20
|
);
|
|
20
21
|
}
|
|
22
|
+
function dim(input) {
|
|
23
|
+
return _chalk.default.dim(input);
|
|
24
|
+
}
|
|
21
25
|
var _default = {
|
|
22
26
|
info (key, messages) {
|
|
23
27
|
log(_chalk.default.bold.cyan('info'), ...Array.isArray(key) ? [
|
|
@@ -3,11 +3,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.normalizeConfig = normalizeConfig;
|
|
6
|
-
var _log =
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
var _log = _interopRequireWildcard(require("./log"));
|
|
7
|
+
function _interopRequireWildcard(obj) {
|
|
8
|
+
if (obj && obj.__esModule) {
|
|
9
|
+
return obj;
|
|
10
|
+
} else {
|
|
11
|
+
var newObj = {
|
|
12
|
+
};
|
|
13
|
+
if (obj != null) {
|
|
14
|
+
for(var key in obj){
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
16
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
|
|
17
|
+
};
|
|
18
|
+
if (desc.get || desc.set) {
|
|
19
|
+
Object.defineProperty(newObj, key, desc);
|
|
20
|
+
} else {
|
|
21
|
+
newObj[key] = obj[key];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
newObj.default = obj;
|
|
27
|
+
return newObj;
|
|
28
|
+
}
|
|
11
29
|
}
|
|
12
30
|
function normalizeConfig(config) {
|
|
13
31
|
// Quick structure validation
|
|
@@ -204,5 +222,16 @@ function normalizeConfig(config) {
|
|
|
204
222
|
return transformers;
|
|
205
223
|
})()
|
|
206
224
|
};
|
|
225
|
+
// Validate globs to prevent bogus globs.
|
|
226
|
+
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
|
227
|
+
for (let file of config.content.files){
|
|
228
|
+
if (typeof file === 'string' && /{([^,]*?)}/g.test(file)) {
|
|
229
|
+
_log.default.warn('invalid-glob-braces', [
|
|
230
|
+
`The glob pattern ${(0, _log).dim(file)} in your config is invalid.`,
|
|
231
|
+
` Update it to ${(0, _log).dim(file.replace(/{([^,]*?)}/g, '$1'))} to silence this warning.`
|
|
232
|
+
]);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
207
236
|
return config;
|
|
208
237
|
}
|
package/lib/util/toPath.js
CHANGED
|
@@ -5,5 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.toPath = toPath;
|
|
6
6
|
function toPath(path) {
|
|
7
7
|
if (Array.isArray(path)) return path;
|
|
8
|
-
|
|
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);
|
|
9
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"postcss-js": "^3.0.3",
|
|
83
83
|
"postcss-load-config": "^3.1.0",
|
|
84
84
|
"postcss-nested": "5.0.6",
|
|
85
|
-
"postcss-selector-parser": "^6.0.
|
|
85
|
+
"postcss-selector-parser": "^6.0.7",
|
|
86
86
|
"postcss-value-parser": "^4.2.0",
|
|
87
87
|
"quick-lru": "^5.1.1",
|
|
88
88
|
"resolve": "^1.20.0",
|
|
@@ -101,7 +101,8 @@
|
|
|
101
101
|
],
|
|
102
102
|
"testPathIgnorePatterns": [
|
|
103
103
|
"/node_modules/",
|
|
104
|
-
"/integrations/"
|
|
104
|
+
"/integrations/",
|
|
105
|
+
"/standalone-cli/"
|
|
105
106
|
],
|
|
106
107
|
"transform": {
|
|
107
108
|
"\\.js$": "@swc/jest"
|