tailwindcss 0.0.0-insiders.a3579bc → 0.0.0-insiders.a41c4ec
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 +15 -2
- package/lib/corePluginList.js +3 -0
- package/lib/corePlugins.js +116 -45
- package/lib/css/preflight.css +2 -1
- package/lib/lib/evaluateTailwindFunctions.js +6 -2
- package/lib/lib/expandTailwindAtRules.js +2 -0
- package/lib/lib/generateRules.js +36 -0
- package/lib/lib/setupContextUtils.js +8 -65
- package/lib/lib/substituteScreenAtRules.js +7 -4
- package/lib/util/buildMediaQuery.js +13 -24
- package/lib/util/formatVariantSelector.js +10 -1
- package/lib/util/isValidArbitraryValue.js +64 -0
- package/lib/util/nameClass.js +1 -0
- package/lib/util/normalizeScreens.js +58 -0
- package/package.json +2 -2
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +95 -45
- package/src/css/preflight.css +2 -1
- package/src/lib/evaluateTailwindFunctions.js +5 -2
- package/src/lib/expandTailwindAtRules.js +2 -0
- package/src/lib/generateRules.js +34 -0
- package/src/lib/setupContextUtils.js +6 -58
- package/src/lib/substituteScreenAtRules.js +6 -3
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/formatVariantSelector.js +11 -1
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/nameClass.js +1 -1
- package/src/util/normalizeScreens.js +42 -0
- package/stubs/defaultConfig.stub.js +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,12 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
Nothing yet!
|
|
11
|
-
|
|
12
10
|
### Fixed
|
|
13
11
|
|
|
14
12
|
- Enforce the order of some variants (like `before` and `after`) ([#6018](https://github.com/tailwindlabs/tailwindcss/pull/6018))
|
|
15
13
|
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Add `placeholder` variant ([#6106](https://github.com/tailwindlabs/tailwindcss/pull/6106))
|
|
17
|
+
- Add tuple syntax for configuring screens while guaranteeing order ([#5956](https://github.com/tailwindlabs/tailwindcss/pull/5956))
|
|
18
|
+
- Add combinable `touch-action` support ([#6115](https://github.com/tailwindlabs/tailwindcss/pull/6115))
|
|
19
|
+
- Add support for "arbitrary properties" ([#6161](https://github.com/tailwindlabs/tailwindcss/pull/6161))
|
|
20
|
+
- Add `portrait` and `landscape` variants ([#6046](https://github.com/tailwindlabs/tailwindcss/pull/6046))
|
|
21
|
+
- Add `aspect-attrs` utility by default ([#6178](https://github.com/tailwindlabs/tailwindcss/pull/6178))
|
|
22
|
+
- Add `text-decoration-style`, `text-decoration-thickness`, and `text-underline-offset` utilities ([#6004](https://github.com/tailwindlabs/tailwindcss/pull/6004))
|
|
23
|
+
- Add `menu` reset to preflight ([#6213](https://github.com/tailwindlabs/tailwindcss/pull/6213))
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Deprecate `decoration-slice` and `decoration-break` in favor `box-decoration-slice` and `box-decoration-break` _(non-breaking)_ ([#6004](https://github.com/tailwindlabs/tailwindcss/pull/6004))
|
|
28
|
+
|
|
16
29
|
## [3.0.0-alpha.2] - 2021-11-08
|
|
17
30
|
|
|
18
31
|
### Changed
|
package/lib/corePluginList.js
CHANGED
package/lib/corePlugins.js
CHANGED
|
@@ -16,6 +16,7 @@ var _isPlainObject = _interopRequireDefault(require("./util/isPlainObject"));
|
|
|
16
16
|
var _transformThemeValue = _interopRequireDefault(require("./util/transformThemeValue"));
|
|
17
17
|
var _packageJson = require("../package.json");
|
|
18
18
|
var _log = _interopRequireDefault(require("./util/log"));
|
|
19
|
+
var _normalizeScreens = require("./util/normalizeScreens");
|
|
19
20
|
var _parseBoxShadowValue = require("./util/parseBoxShadowValue");
|
|
20
21
|
function _interopRequireDefault(obj) {
|
|
21
22
|
return obj && obj.__esModule ? obj : {
|
|
@@ -58,6 +59,7 @@ let variantPlugins = {
|
|
|
58
59
|
'&::selection'
|
|
59
60
|
]);
|
|
60
61
|
addVariant('file', '&::file-selector-button');
|
|
62
|
+
addVariant('placeholder', '&::placeholder');
|
|
61
63
|
addVariant('before', ({ container })=>{
|
|
62
64
|
container.walkRules((rule)=>{
|
|
63
65
|
let foundContent = false;
|
|
@@ -197,11 +199,14 @@ let variantPlugins = {
|
|
|
197
199
|
addVariant('print', '@media print');
|
|
198
200
|
},
|
|
199
201
|
screenVariants: ({ theme , addVariant })=>{
|
|
200
|
-
for(let screen
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
addVariant(screen, `@media ${query}`);
|
|
202
|
+
for (let screen of (0, _normalizeScreens).normalizeScreens(theme('screens'))){
|
|
203
|
+
let query = (0, _buildMediaQuery).default(screen);
|
|
204
|
+
addVariant(screen.name, `@media ${query}`);
|
|
204
205
|
}
|
|
206
|
+
},
|
|
207
|
+
orientationVariants: ({ addVariant })=>{
|
|
208
|
+
addVariant('portrait', '@media (orientation: portrait)');
|
|
209
|
+
addVariant('landscape', '@media (orientation: landscape)');
|
|
205
210
|
}
|
|
206
211
|
};
|
|
207
212
|
exports.variantPlugins = variantPlugins;
|
|
@@ -216,27 +221,11 @@ let corePlugins1 = {
|
|
|
216
221
|
]);
|
|
217
222
|
},
|
|
218
223
|
container: (()=>{
|
|
219
|
-
function extractMinWidths(
|
|
220
|
-
return
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
min: breakpoints
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
if (!Array.isArray(breakpoints)) {
|
|
228
|
-
breakpoints = [
|
|
229
|
-
breakpoints
|
|
230
|
-
];
|
|
231
|
-
}
|
|
232
|
-
return breakpoints.filter((breakpoint)=>{
|
|
233
|
-
var ref;
|
|
234
|
-
return (breakpoint === null || breakpoint === void 0 ? void 0 : (ref = breakpoint.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(breakpoint, 'min')) || (breakpoint === null || breakpoint === void 0 ? void 0 : breakpoint.hasOwnProperty('min-width'));
|
|
235
|
-
}).map((breakpoint)=>{
|
|
236
|
-
var ref;
|
|
237
|
-
return (ref = breakpoint['min-width']) !== null && ref !== void 0 ? ref : breakpoint.min;
|
|
238
|
-
});
|
|
239
|
-
});
|
|
224
|
+
function extractMinWidths(breakpoints = []) {
|
|
225
|
+
return breakpoints.flatMap((breakpoint1)=>breakpoint1.values.map((breakpoint)=>breakpoint.min
|
|
226
|
+
)
|
|
227
|
+
).filter((v)=>v !== undefined
|
|
228
|
+
);
|
|
240
229
|
}
|
|
241
230
|
function mapMinWidthsToPadding(minWidths, screens, paddings) {
|
|
242
231
|
if (typeof paddings === 'undefined') {
|
|
@@ -260,25 +249,25 @@ let corePlugins1 = {
|
|
|
260
249
|
});
|
|
261
250
|
}
|
|
262
251
|
for (let minWidth of minWidths){
|
|
263
|
-
for (let
|
|
264
|
-
let
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
252
|
+
for (let screen of screens){
|
|
253
|
+
for (let { min } of screen.values){
|
|
254
|
+
if (min === minWidth) {
|
|
255
|
+
mapping.push({
|
|
256
|
+
minWidth,
|
|
257
|
+
padding: paddings[screen.name]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
271
260
|
}
|
|
272
261
|
}
|
|
273
262
|
}
|
|
274
263
|
return mapping;
|
|
275
264
|
}
|
|
276
265
|
return function({ addComponents , theme }) {
|
|
277
|
-
let screens = theme('container.screens', theme('screens'));
|
|
266
|
+
let screens = (0, _normalizeScreens).normalizeScreens(theme('container.screens', theme('screens')));
|
|
278
267
|
let minWidths = extractMinWidths(screens);
|
|
279
268
|
let paddings = mapMinWidthsToPadding(minWidths, screens, theme('container.padding'));
|
|
280
269
|
let generatePaddingFor = (minWidth)=>{
|
|
281
|
-
let paddingConfig = paddings.find((padding)
|
|
270
|
+
let paddingConfig = paddings.find((padding)=>padding.minWidth === minWidth
|
|
282
271
|
);
|
|
283
272
|
if (!paddingConfig) {
|
|
284
273
|
return {
|
|
@@ -1010,7 +999,15 @@ let corePlugins1 = {
|
|
|
1010
999
|
});
|
|
1011
1000
|
},
|
|
1012
1001
|
cursor: (0, _createUtilityPlugin).default('cursor'),
|
|
1013
|
-
touchAction: ({ addUtilities })=>{
|
|
1002
|
+
touchAction: ({ addBase , addUtilities })=>{
|
|
1003
|
+
addBase({
|
|
1004
|
+
'@defaults touch-action': {
|
|
1005
|
+
'--tw-pan-x': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1006
|
+
'--tw-pan-y': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1007
|
+
'--tw-pinch-zoom': 'var(--tw-empty,/*!*/ /*!*/)',
|
|
1008
|
+
'--tw-touch-action': 'var(--tw-pan-x) var(--tw-pan-y) var(--tw-pinch-zoom)'
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1014
1011
|
addUtilities({
|
|
1015
1012
|
'.touch-auto': {
|
|
1016
1013
|
'touch-action': 'auto'
|
|
@@ -1019,25 +1016,46 @@ let corePlugins1 = {
|
|
|
1019
1016
|
'touch-action': 'none'
|
|
1020
1017
|
},
|
|
1021
1018
|
'.touch-pan-x': {
|
|
1022
|
-
'touch-action':
|
|
1019
|
+
'@defaults touch-action': {
|
|
1020
|
+
},
|
|
1021
|
+
'--tw-pan-x': 'pan-x',
|
|
1022
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1023
1023
|
},
|
|
1024
1024
|
'.touch-pan-left': {
|
|
1025
|
-
'touch-action':
|
|
1025
|
+
'@defaults touch-action': {
|
|
1026
|
+
},
|
|
1027
|
+
'--tw-pan-x': 'pan-left',
|
|
1028
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1026
1029
|
},
|
|
1027
1030
|
'.touch-pan-right': {
|
|
1028
|
-
'touch-action':
|
|
1031
|
+
'@defaults touch-action': {
|
|
1032
|
+
},
|
|
1033
|
+
'--tw-pan-x': 'pan-right',
|
|
1034
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1029
1035
|
},
|
|
1030
1036
|
'.touch-pan-y': {
|
|
1031
|
-
'touch-action':
|
|
1037
|
+
'@defaults touch-action': {
|
|
1038
|
+
},
|
|
1039
|
+
'--tw-pan-y': 'pan-y',
|
|
1040
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1032
1041
|
},
|
|
1033
1042
|
'.touch-pan-up': {
|
|
1034
|
-
'touch-action':
|
|
1043
|
+
'@defaults touch-action': {
|
|
1044
|
+
},
|
|
1045
|
+
'--tw-pan-y': 'pan-up',
|
|
1046
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1035
1047
|
},
|
|
1036
1048
|
'.touch-pan-down': {
|
|
1037
|
-
'touch-action':
|
|
1049
|
+
'@defaults touch-action': {
|
|
1050
|
+
},
|
|
1051
|
+
'--tw-pan-y': 'pan-down',
|
|
1052
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1038
1053
|
},
|
|
1039
1054
|
'.touch-pinch-zoom': {
|
|
1040
|
-
'touch-action':
|
|
1055
|
+
'@defaults touch-action': {
|
|
1056
|
+
},
|
|
1057
|
+
'--tw-pinch-zoom': 'pinch-zoom',
|
|
1058
|
+
'touch-action': 'var(--tw-touch-action)'
|
|
1041
1059
|
},
|
|
1042
1060
|
'.touch-manipulation': {
|
|
1043
1061
|
'touch-action': 'manipulation'
|
|
@@ -2297,6 +2315,12 @@ let corePlugins1 = {
|
|
|
2297
2315
|
},
|
|
2298
2316
|
'.decoration-clone': {
|
|
2299
2317
|
'box-decoration-break': 'clone'
|
|
2318
|
+
},
|
|
2319
|
+
'.box-decoration-slice': {
|
|
2320
|
+
'box-decoration-break': 'slice'
|
|
2321
|
+
},
|
|
2322
|
+
'.box-decoration-clone': {
|
|
2323
|
+
'box-decoration-break': 'clone'
|
|
2300
2324
|
}
|
|
2301
2325
|
});
|
|
2302
2326
|
},
|
|
@@ -2768,6 +2792,9 @@ let corePlugins1 = {
|
|
|
2768
2792
|
'.underline': {
|
|
2769
2793
|
'text-decoration': 'underline'
|
|
2770
2794
|
},
|
|
2795
|
+
'.overline': {
|
|
2796
|
+
'text-decoration': 'overline'
|
|
2797
|
+
},
|
|
2771
2798
|
'.line-through': {
|
|
2772
2799
|
'text-decoration': 'line-through'
|
|
2773
2800
|
},
|
|
@@ -2786,11 +2813,55 @@ let corePlugins1 = {
|
|
|
2786
2813
|
}, {
|
|
2787
2814
|
values: (0, _flattenColorPalette).default(theme('textDecorationColor')),
|
|
2788
2815
|
type: [
|
|
2789
|
-
'color'
|
|
2790
|
-
'any'
|
|
2816
|
+
'color'
|
|
2791
2817
|
]
|
|
2792
2818
|
});
|
|
2793
2819
|
},
|
|
2820
|
+
textDecorationStyle: ({ addUtilities })=>{
|
|
2821
|
+
addUtilities({
|
|
2822
|
+
'.decoration-solid': {
|
|
2823
|
+
'text-decoration-style': 'solid'
|
|
2824
|
+
},
|
|
2825
|
+
'.decoration-double': {
|
|
2826
|
+
'text-decoration-style': 'double'
|
|
2827
|
+
},
|
|
2828
|
+
'.decoration-dotted': {
|
|
2829
|
+
'text-decoration-style': 'dotted'
|
|
2830
|
+
},
|
|
2831
|
+
'.decoration-dashed': {
|
|
2832
|
+
'text-decoration-style': 'dashed'
|
|
2833
|
+
},
|
|
2834
|
+
'.decoration-wavy': {
|
|
2835
|
+
'text-decoration-style': 'wavy'
|
|
2836
|
+
}
|
|
2837
|
+
});
|
|
2838
|
+
},
|
|
2839
|
+
textDecorationThickness: (0, _createUtilityPlugin).default('textDecorationThickness', [
|
|
2840
|
+
[
|
|
2841
|
+
'decoration',
|
|
2842
|
+
[
|
|
2843
|
+
'text-decoration-thickness'
|
|
2844
|
+
]
|
|
2845
|
+
]
|
|
2846
|
+
], {
|
|
2847
|
+
type: [
|
|
2848
|
+
'length',
|
|
2849
|
+
'percentage'
|
|
2850
|
+
]
|
|
2851
|
+
}),
|
|
2852
|
+
textUnderlineOffset: (0, _createUtilityPlugin).default('textUnderlineOffset', [
|
|
2853
|
+
[
|
|
2854
|
+
'underline-offset',
|
|
2855
|
+
[
|
|
2856
|
+
'text-underline-offset'
|
|
2857
|
+
]
|
|
2858
|
+
]
|
|
2859
|
+
], {
|
|
2860
|
+
type: [
|
|
2861
|
+
'length',
|
|
2862
|
+
'percentage'
|
|
2863
|
+
]
|
|
2864
|
+
}),
|
|
2794
2865
|
fontSmoothing: ({ addUtilities })=>{
|
|
2795
2866
|
addUtilities({
|
|
2796
2867
|
'.antialiased': {
|
package/lib/css/preflight.css
CHANGED
|
@@ -7,6 +7,7 @@ var _dlv = _interopRequireDefault(require("dlv"));
|
|
|
7
7
|
var _didyoumean = _interopRequireDefault(require("didyoumean"));
|
|
8
8
|
var _transformThemeValue = _interopRequireDefault(require("../util/transformThemeValue"));
|
|
9
9
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
10
|
+
var _normalizeScreens = require("../util/normalizeScreens");
|
|
10
11
|
var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
|
|
11
12
|
var _toPath = require("../util/toPath");
|
|
12
13
|
function _interopRequireDefault(obj) {
|
|
@@ -149,10 +150,13 @@ function _default({ tailwindConfig: config }) {
|
|
|
149
150
|
},
|
|
150
151
|
screen: (node, screen)=>{
|
|
151
152
|
screen = screen.replace(/^['"]+/g, '').replace(/['"]+$/g, '');
|
|
152
|
-
|
|
153
|
+
let screens = (0, _normalizeScreens).normalizeScreens(config.theme.screens);
|
|
154
|
+
let screenDefinition = screens.find(({ name })=>name === screen
|
|
155
|
+
);
|
|
156
|
+
if (!screenDefinition) {
|
|
153
157
|
throw node.error(`The '${screen}' screen does not exist in your theme.`);
|
|
154
158
|
}
|
|
155
|
-
return (0, _buildMediaQuery).default(
|
|
159
|
+
return (0, _buildMediaQuery).default(screenDefinition);
|
|
156
160
|
}
|
|
157
161
|
};
|
|
158
162
|
return (root)=>{
|
|
@@ -46,6 +46,8 @@ const PATTERNS = [
|
|
|
46
46
|
/([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
|
|
47
47
|
/([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
|
|
48
48
|
/([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
|
|
49
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source,
|
|
50
|
+
/([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source,
|
|
49
51
|
/([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source,
|
|
50
52
|
/([^<>"'`\s]*[^"'`\s:])/.source
|
|
51
53
|
].join('|');
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -11,6 +11,9 @@ var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
|
|
|
11
11
|
var _pluginUtils = require("../util/pluginUtils");
|
|
12
12
|
var _log = _interopRequireDefault(require("../util/log"));
|
|
13
13
|
var _formatVariantSelector = require("../util/formatVariantSelector");
|
|
14
|
+
var _nameClass = require("../util/nameClass");
|
|
15
|
+
var _dataTypes = require("../util/dataTypes");
|
|
16
|
+
var _isValidArbitraryValue = _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
|
14
17
|
function _interopRequireDefault(obj) {
|
|
15
18
|
return obj && obj.__esModule ? obj : {
|
|
16
19
|
default: obj
|
|
@@ -250,6 +253,31 @@ function parseRules(rule, cache, options = {
|
|
|
250
253
|
options
|
|
251
254
|
];
|
|
252
255
|
}
|
|
256
|
+
function extractArbitraryProperty(classCandidate, context) {
|
|
257
|
+
var ref;
|
|
258
|
+
let [, property, value] = (ref = classCandidate.match(/^\[([a-zA-Z0-9-_]+):(\S+)\]$/)) !== null && ref !== void 0 ? ref : [];
|
|
259
|
+
if (value === undefined) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
let normalized = (0, _dataTypes).normalize(value);
|
|
263
|
+
if (!(0, _isValidArbitraryValue).default(normalized)) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
return [
|
|
267
|
+
[
|
|
268
|
+
{
|
|
269
|
+
sort: context.arbitraryPropertiesSort,
|
|
270
|
+
layer: 'utilities'
|
|
271
|
+
},
|
|
272
|
+
()=>({
|
|
273
|
+
[(0, _nameClass).asClass(classCandidate)]: {
|
|
274
|
+
[property]: normalized
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
,
|
|
278
|
+
],
|
|
279
|
+
];
|
|
280
|
+
}
|
|
253
281
|
function* resolveMatchedPlugins(classCandidate, context) {
|
|
254
282
|
if (context.candidateRuleMap.has(classCandidate)) {
|
|
255
283
|
yield [
|
|
@@ -257,6 +285,14 @@ function* resolveMatchedPlugins(classCandidate, context) {
|
|
|
257
285
|
'DEFAULT'
|
|
258
286
|
];
|
|
259
287
|
}
|
|
288
|
+
yield* (function*(arbitraryPropertyRule) {
|
|
289
|
+
if (arbitraryPropertyRule !== null) {
|
|
290
|
+
yield [
|
|
291
|
+
arbitraryPropertyRule,
|
|
292
|
+
'DEFAULT'
|
|
293
|
+
];
|
|
294
|
+
}
|
|
295
|
+
})(extractArbitraryProperty(classCandidate, context));
|
|
260
296
|
let candidatePrefix = classCandidate;
|
|
261
297
|
let negative = false;
|
|
262
298
|
const twConfigPrefix = context.tailwindConfig.prefix;
|
|
@@ -23,6 +23,7 @@ var sharedState = _interopRequireWildcard(require("./sharedState"));
|
|
|
23
23
|
var _toPath = require("../util/toPath");
|
|
24
24
|
var _log = _interopRequireDefault(require("../util/log"));
|
|
25
25
|
var _negateValue = _interopRequireDefault(require("../util/negateValue"));
|
|
26
|
+
var _isValidArbitraryValue = _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
|
26
27
|
function _interopRequireDefault(obj) {
|
|
27
28
|
return obj && obj.__esModule ? obj : {
|
|
28
29
|
default: obj
|
|
@@ -160,68 +161,6 @@ function withIdentifiers(styles) {
|
|
|
160
161
|
});
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
|
-
let matchingBrackets = new Map([
|
|
164
|
-
[
|
|
165
|
-
'{',
|
|
166
|
-
'}'
|
|
167
|
-
],
|
|
168
|
-
[
|
|
169
|
-
'[',
|
|
170
|
-
']'
|
|
171
|
-
],
|
|
172
|
-
[
|
|
173
|
-
'(',
|
|
174
|
-
')'
|
|
175
|
-
],
|
|
176
|
-
]);
|
|
177
|
-
let inverseMatchingBrackets = new Map(Array.from(matchingBrackets.entries()).map(([k, v])=>[
|
|
178
|
-
v,
|
|
179
|
-
k
|
|
180
|
-
]
|
|
181
|
-
));
|
|
182
|
-
let quotes = new Set([
|
|
183
|
-
'"',
|
|
184
|
-
"'",
|
|
185
|
-
'`'
|
|
186
|
-
]);
|
|
187
|
-
// Arbitrary values must contain balanced brackets (), [] and {}. Escaped
|
|
188
|
-
// values don't count, and brackets inside quotes also don't count.
|
|
189
|
-
//
|
|
190
|
-
// E.g.: w-[this-is]w-[weird-and-invalid]
|
|
191
|
-
// E.g.: w-[this-is\\]w-\\[weird-but-valid]
|
|
192
|
-
// E.g.: content-['this-is-also-valid]-weirdly-enough']
|
|
193
|
-
function isValidArbitraryValue(value) {
|
|
194
|
-
let stack = [];
|
|
195
|
-
let inQuotes = false;
|
|
196
|
-
for(let i = 0; i < value.length; i++){
|
|
197
|
-
let char = value[i];
|
|
198
|
-
// Non-escaped quotes allow us to "allow" anything in between
|
|
199
|
-
if (quotes.has(char) && value[i - 1] !== '\\') {
|
|
200
|
-
inQuotes = !inQuotes;
|
|
201
|
-
}
|
|
202
|
-
if (inQuotes) continue;
|
|
203
|
-
if (value[i - 1] === '\\') continue; // Escaped
|
|
204
|
-
if (matchingBrackets.has(char)) {
|
|
205
|
-
stack.push(char);
|
|
206
|
-
} else if (inverseMatchingBrackets.has(char)) {
|
|
207
|
-
let inverse = inverseMatchingBrackets.get(char);
|
|
208
|
-
// Nothing to pop from, therefore it is unbalanced
|
|
209
|
-
if (stack.length <= 0) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
// Popped value must match the inverse value, otherwise it is unbalanced
|
|
213
|
-
if (stack.pop() !== inverse) {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
// If there is still something on the stack, it is also unbalanced
|
|
219
|
-
if (stack.length > 0) {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
// All good, totally balanced!
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
164
|
function buildPluginApi(tailwindConfig, context, { variantList , variantMap , offsets , classList }) {
|
|
226
165
|
function getConfigValue(path, defaultValue) {
|
|
227
166
|
return path ? (0, _dlv).default(tailwindConfig, path, defaultValue) : tailwindConfig;
|
|
@@ -409,7 +348,7 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
409
348
|
if (!type.includes(coercedType) && !isOnlyPlugin) {
|
|
410
349
|
return [];
|
|
411
350
|
}
|
|
412
|
-
if (!
|
|
351
|
+
if (!(0, _isValidArbitraryValue).default(value)) {
|
|
413
352
|
return [];
|
|
414
353
|
}
|
|
415
354
|
let ruleSets = [].concat(rule(value)).filter(Boolean).map((declaration)=>({
|
|
@@ -466,7 +405,7 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
|
|
|
466
405
|
return [];
|
|
467
406
|
}
|
|
468
407
|
}
|
|
469
|
-
if (!
|
|
408
|
+
if (!(0, _isValidArbitraryValue).default(value)) {
|
|
470
409
|
return [];
|
|
471
410
|
}
|
|
472
411
|
let ruleSets = [].concat(rule(value)).filter(Boolean).map((declaration)=>({
|
|
@@ -608,7 +547,8 @@ function resolvePlugins(context, root) {
|
|
|
608
547
|
_corePlugins.variantPlugins['reducedMotionVariants'],
|
|
609
548
|
_corePlugins.variantPlugins['darkVariants'],
|
|
610
549
|
_corePlugins.variantPlugins['printVariant'],
|
|
611
|
-
_corePlugins.variantPlugins['screenVariants'],
|
|
550
|
+
_corePlugins.variantPlugins['screenVariants'],
|
|
551
|
+
_corePlugins.variantPlugins['orientationVariants'],
|
|
612
552
|
];
|
|
613
553
|
return [
|
|
614
554
|
...corePluginList,
|
|
@@ -652,6 +592,9 @@ function registerPlugins(plugins, context) {
|
|
|
652
592
|
offsets.user,
|
|
653
593
|
]);
|
|
654
594
|
let reservedBits = BigInt(highestOffset.toString(2).length);
|
|
595
|
+
// A number one less than the top range of the highest offset area
|
|
596
|
+
// so arbitrary properties are always sorted at the end.
|
|
597
|
+
context.arbitraryPropertiesSort = (1n << reservedBits << 0n) - 1n;
|
|
655
598
|
context.layerOrder = {
|
|
656
599
|
base: 1n << reservedBits << 0n,
|
|
657
600
|
components: 1n << reservedBits << 1n,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.default = _default;
|
|
6
|
+
var _normalizeScreens = require("../util/normalizeScreens");
|
|
6
7
|
var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
|
|
7
8
|
function _interopRequireDefault(obj) {
|
|
8
9
|
return obj && obj.__esModule ? obj : {
|
|
@@ -12,13 +13,15 @@ function _interopRequireDefault(obj) {
|
|
|
12
13
|
function _default({ tailwindConfig: { theme } }) {
|
|
13
14
|
return function(css) {
|
|
14
15
|
css.walkAtRules('screen', (atRule)=>{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
let screen = atRule.params;
|
|
17
|
+
let screens = (0, _normalizeScreens).normalizeScreens(theme.screens);
|
|
18
|
+
let screenDefinition = screens.find(({ name })=>name === screen
|
|
19
|
+
);
|
|
20
|
+
if (!screenDefinition) {
|
|
18
21
|
throw atRule.error(`No \`${screen}\` screen found.`);
|
|
19
22
|
}
|
|
20
23
|
atRule.name = 'media';
|
|
21
|
-
atRule.params = (0, _buildMediaQuery).default(
|
|
24
|
+
atRule.params = (0, _buildMediaQuery).default(screenDefinition);
|
|
22
25
|
});
|
|
23
26
|
};
|
|
24
27
|
}
|
|
@@ -4,28 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.default = buildMediaQuery;
|
|
6
6
|
function buildMediaQuery(screens) {
|
|
7
|
-
|
|
8
|
-
screens
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return screen.raw;
|
|
21
|
-
}
|
|
22
|
-
return Object.entries(screen).map(([feature, value])=>{
|
|
23
|
-
var _feature;
|
|
24
|
-
feature = (_feature = ({
|
|
25
|
-
min: 'min-width',
|
|
26
|
-
max: 'max-width'
|
|
27
|
-
})[feature]) !== null && _feature !== void 0 ? _feature : feature;
|
|
28
|
-
return `(${feature}: ${value})`;
|
|
29
|
-
}).join(' and ');
|
|
30
|
-
}).join(', ');
|
|
7
|
+
screens = Array.isArray(screens) ? screens : [
|
|
8
|
+
screens
|
|
9
|
+
];
|
|
10
|
+
return screens.map((screen1)=>screen1.values.map((screen)=>{
|
|
11
|
+
if (screen.raw !== undefined) {
|
|
12
|
+
return screen.raw;
|
|
13
|
+
}
|
|
14
|
+
return [
|
|
15
|
+
screen.min && `(min-width: ${screen.min})`,
|
|
16
|
+
screen.max && `(max-width: ${screen.max})`,
|
|
17
|
+
].filter(Boolean).join(' and ');
|
|
18
|
+
})
|
|
19
|
+
).join(', ');
|
|
31
20
|
}
|
|
@@ -40,7 +40,16 @@ function formatVariantSelector(current, ...others) {
|
|
|
40
40
|
function finalizeSelector(format, { selector: selector1 , candidate , context }) {
|
|
41
41
|
var ref, ref1;
|
|
42
42
|
var ref2;
|
|
43
|
-
let
|
|
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();
|
|
44
53
|
if (context === null || context === void 0 ? void 0 : (ref1 = context.tailwindConfig) === null || ref1 === void 0 ? void 0 : ref1.prefix) {
|
|
45
54
|
format = (0, _prefixSelector).default(context.tailwindConfig.prefix, format);
|
|
46
55
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
}
|