tailwindcss 0.0.0-insiders.2cae042 → 0.0.0-insiders.2cd6fad
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 +44 -24
- package/README.md +6 -5
- package/lib/cli/build/plugin.js +38 -4
- package/lib/cli/build/watching.js +1 -1
- package/lib/corePlugins.js +21 -13
- package/lib/lib/content.js +9 -1
- package/lib/lib/findAtConfigPath.js +4 -4
- package/lib/lib/generateRules.js +18 -5
- package/lib/lib/setupContextUtils.js +151 -12
- package/lib/lib/sharedState.js +2 -0
- package/lib/util/pluginUtils.js +6 -5
- package/package.json +8 -7
- package/peers/index.js +2 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/src/cli/build/plugin.js +49 -4
- package/src/cli/build/watching.js +1 -1
- package/src/corePlugins.js +29 -16
- package/src/lib/content.js +10 -3
- package/src/lib/findAtConfigPath.js +4 -6
- package/src/lib/generateRules.js +19 -6
- package/src/lib/setupContextUtils.js +176 -24
- package/src/lib/sharedState.js +2 -0
- package/src/util/pluginUtils.js +11 -5
- package/stubs/defaultConfig.stub.js +3 -2
- package/types/config.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,51 +7,69 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Escape special characters in resolved content base paths ([#9650](https://github.com/tailwindlabs/tailwindcss/pull/9650))
|
|
13
|
+
- Don't reuse container for array returning variant functions ([#9644](https://github.com/tailwindlabs/tailwindcss/pull/9644))
|
|
14
|
+
|
|
15
|
+
## [3.2.1] - 2022-10-21
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fix missing `supports` in types ([#9616](https://github.com/tailwindlabs/tailwindcss/pull/9616))
|
|
20
|
+
- Fix missing PostCSS dependencies in the CLI ([#9617](https://github.com/tailwindlabs/tailwindcss/pull/9617))
|
|
21
|
+
- Ensure `micromatch` is a proper CLI dependency ([#9620](https://github.com/tailwindlabs/tailwindcss/pull/9620))
|
|
22
|
+
- Ensure modifier values exist when using a `modifiers` object for `matchVariant` ([ba6551db0f2726461371b4f3c6cd4c7090888504](https://github.com/tailwindlabs/tailwindcss/commit/ba6551db0f2726461371b4f3c6cd4c7090888504))
|
|
23
|
+
|
|
24
|
+
## [3.2.0] - 2022-10-19
|
|
25
|
+
|
|
10
26
|
### Added
|
|
11
27
|
|
|
28
|
+
- Add new `@config` directive ([#9405](https://github.com/tailwindlabs/tailwindcss/pull/9405))
|
|
29
|
+
- Add new `relative: true` option to resolve content paths relative to the config file ([#9396](https://github.com/tailwindlabs/tailwindcss/pull/9396))
|
|
30
|
+
- Add new `supports-*` variant ([#9453](https://github.com/tailwindlabs/tailwindcss/pull/9453))
|
|
31
|
+
- Add new `min-*` and `max-*` variants ([#9558](https://github.com/tailwindlabs/tailwindcss/pull/9558))
|
|
32
|
+
- Add new `aria-*` variants ([#9557](https://github.com/tailwindlabs/tailwindcss/pull/9557), [#9588](https://github.com/tailwindlabs/tailwindcss/pull/9588))
|
|
33
|
+
- Add new `data-*` variants ([#9559](https://github.com/tailwindlabs/tailwindcss/pull/9559), [#9588](https://github.com/tailwindlabs/tailwindcss/pull/9588))
|
|
12
34
|
- Add new `break-keep` utility for `word-break: keep-all` ([#9393](https://github.com/tailwindlabs/tailwindcss/pull/9393))
|
|
35
|
+
- Add new `collapse` utility for `visibility: collapse` ([#9181](https://github.com/tailwindlabs/tailwindcss/pull/9181))
|
|
36
|
+
- Add new `fill-none` utility for `fill: none` ([#9403](https://github.com/tailwindlabs/tailwindcss/pull/9403))
|
|
37
|
+
- Add new `stroke-none` utility for `stroke: none` ([#9403](https://github.com/tailwindlabs/tailwindcss/pull/9403))
|
|
38
|
+
- Add new `place-content-baseline` utility for `place-content: baseline` ([#9498](https://github.com/tailwindlabs/tailwindcss/pull/9498))
|
|
39
|
+
- Add new `place-items-baseline` utility for `place-items: baseline` ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
|
|
40
|
+
- Add new `content-baseline` utility for `align-content: baseline` ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
|
|
13
41
|
- Add support for configuring default `font-feature-settings` for a font family ([#9039](https://github.com/tailwindlabs/tailwindcss/pull/9039))
|
|
14
|
-
- Add
|
|
42
|
+
- Add standalone CLI build for 32-bit Linux on ARM (`node16-linux-armv7`) ([#9084](https://github.com/tailwindlabs/tailwindcss/pull/9084))
|
|
15
43
|
- Add future flag to disable color opacity utility plugins ([#9088](https://github.com/tailwindlabs/tailwindcss/pull/9088))
|
|
16
44
|
- Add negative value support for `outline-offset` ([#9136](https://github.com/tailwindlabs/tailwindcss/pull/9136))
|
|
17
|
-
- Allow negating utilities using min/max/clamp ([#9237](https://github.com/tailwindlabs/tailwindcss/pull/9237))
|
|
18
|
-
- Add new `collapse` utility for `visibility: collapse` ([#9181](https://github.com/tailwindlabs/tailwindcss/pull/9181))
|
|
19
|
-
- Allow resolving content paths relative to the config file ([#9396](https://github.com/tailwindlabs/tailwindcss/pull/9396))
|
|
20
|
-
- Add `@config` support ([#9405](https://github.com/tailwindlabs/tailwindcss/pull/9405))
|
|
21
|
-
- Add `fill-none` and `stroke-none` utilities by default ([#9403](https://github.com/tailwindlabs/tailwindcss/pull/9403))
|
|
22
|
-
- Support `sort` function in `matchVariant` ([#9423](https://github.com/tailwindlabs/tailwindcss/pull/9423))
|
|
23
|
-
- Implement the `supports` variant ([#9453](https://github.com/tailwindlabs/tailwindcss/pull/9453))
|
|
24
|
-
- Add experimental `label`s for variants ([#9456](https://github.com/tailwindlabs/tailwindcss/pull/9456), [#9520](https://github.com/tailwindlabs/tailwindcss/pull/9520))
|
|
25
|
-
- Added 'place-content-baseline' utility ([#9498](https://github.com/tailwindlabs/tailwindcss/pull/9498))
|
|
26
|
-
- Added 'place-items-baseline' utility ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
|
|
27
|
-
- Added 'content-baseline' utility ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
|
|
28
|
-
- Prepare for container queries setup ([#9526](https://github.com/tailwindlabs/tailwindcss/pull/9526))
|
|
29
45
|
- Add support for modifiers to `matchUtilities` ([#9541](https://github.com/tailwindlabs/tailwindcss/pull/9541))
|
|
30
|
-
-
|
|
31
|
-
-
|
|
46
|
+
- Allow negating utilities using `min`/`max`/`clamp` ([#9237](https://github.com/tailwindlabs/tailwindcss/pull/9237))
|
|
47
|
+
- Implement fallback plugins when there is ambiguity between plugins when using arbitrary values ([#9376](https://github.com/tailwindlabs/tailwindcss/pull/9376))
|
|
48
|
+
- Support `sort` function in `matchVariant` ([#9423](https://github.com/tailwindlabs/tailwindcss/pull/9423))
|
|
49
|
+
- Upgrade to `postcss-nested` v6.0 ([#9546](https://github.com/tailwindlabs/tailwindcss/pull/9546))
|
|
32
50
|
|
|
33
51
|
### Fixed
|
|
34
52
|
|
|
35
53
|
- Use absolute paths when resolving changed files for resilience against working directory changes ([#9032](https://github.com/tailwindlabs/tailwindcss/pull/9032))
|
|
36
54
|
- Fix ring color utility generation when using `respectDefaultRingColorOpacity` ([#9070](https://github.com/tailwindlabs/tailwindcss/pull/9070))
|
|
37
|
-
- Sort tags before classes when `@
|
|
55
|
+
- Sort tags before classes when `@apply`-ing a selector with joined classes ([#9107](https://github.com/tailwindlabs/tailwindcss/pull/9107))
|
|
38
56
|
- Remove invalid `outline-hidden` utility ([#9147](https://github.com/tailwindlabs/tailwindcss/pull/9147))
|
|
39
57
|
- Honor the `hidden` attribute on elements in preflight ([#9174](https://github.com/tailwindlabs/tailwindcss/pull/9174))
|
|
40
58
|
- Don't stop watching atomically renamed files ([#9173](https://github.com/tailwindlabs/tailwindcss/pull/9173), [#9215](https://github.com/tailwindlabs/tailwindcss/pull/9215))
|
|
41
|
-
-
|
|
42
|
-
- Don't output duplicate utilities ([#9208](https://github.com/tailwindlabs/tailwindcss/pull/9208))
|
|
59
|
+
- Fix duplicate utilities issue causing memory leaks ([#9208](https://github.com/tailwindlabs/tailwindcss/pull/9208))
|
|
43
60
|
- Fix `fontFamily` config TypeScript types ([#9214](https://github.com/tailwindlabs/tailwindcss/pull/9214))
|
|
44
61
|
- Handle variants on complex selector utilities ([#9262](https://github.com/tailwindlabs/tailwindcss/pull/9262))
|
|
45
|
-
-
|
|
62
|
+
- Fix shared config mutation issue ([#9294](https://github.com/tailwindlabs/tailwindcss/pull/9294))
|
|
46
63
|
- Fix ordering of parallel variants ([#9282](https://github.com/tailwindlabs/tailwindcss/pull/9282))
|
|
47
64
|
- Handle variants in utility selectors using `:where()` and `:has()` ([#9309](https://github.com/tailwindlabs/tailwindcss/pull/9309))
|
|
48
|
-
- Improve data type
|
|
65
|
+
- Improve data type analysis for arbitrary values ([#9320](https://github.com/tailwindlabs/tailwindcss/pull/9320))
|
|
49
66
|
- Don't emit generated utilities with invalid uses of theme functions ([#9319](https://github.com/tailwindlabs/tailwindcss/pull/9319))
|
|
50
67
|
- Revert change that only listened for stdin close on TTYs ([#9331](https://github.com/tailwindlabs/tailwindcss/pull/9331))
|
|
51
68
|
- Ignore unset values (like `null` or `undefined`) when resolving the classList for intellisense ([#9385](https://github.com/tailwindlabs/tailwindcss/pull/9385))
|
|
52
|
-
- Implement fallback plugins when arbitrary values result in css from multiple plugins ([#9376](https://github.com/tailwindlabs/tailwindcss/pull/9376))
|
|
53
69
|
- Improve type checking for formal syntax ([#9349](https://github.com/tailwindlabs/tailwindcss/pull/9349), [#9448](https://github.com/tailwindlabs/tailwindcss/pull/9448))
|
|
54
|
-
-
|
|
70
|
+
- Fix incorrect required `content` key in custom plugin configs ([#9502](https://github.com/tailwindlabs/tailwindcss/pull/9502), [#9545](https://github.com/tailwindlabs/tailwindcss/pull/9545))
|
|
71
|
+
- Fix content path detection on Windows ([#9569](https://github.com/tailwindlabs/tailwindcss/pull/9569))
|
|
72
|
+
- Ensure `--content` is used in the CLI when passed ([#9587](https://github.com/tailwindlabs/tailwindcss/pull/9587))
|
|
55
73
|
|
|
56
74
|
## [3.1.8] - 2022-08-05
|
|
57
75
|
|
|
@@ -148,7 +166,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
148
166
|
- Move `important` selector to the front when `@apply`-ing selector-modifying variants in custom utilities ([#8313](https://github.com/tailwindlabs/tailwindcss/pull/8313))
|
|
149
167
|
- Error when registering an invalid custom variant ([#8345](https://github.com/tailwindlabs/tailwindcss/pull/8345))
|
|
150
168
|
- Create tailwind.config.cjs file in ESM package when running init ([#8363](https://github.com/tailwindlabs/tailwindcss/pull/8363))
|
|
151
|
-
- Fix `
|
|
169
|
+
- Fix `matchVariant` that use at-rules and placeholders ([#8392](https://github.com/tailwindlabs/tailwindcss/pull/8392))
|
|
152
170
|
- Improve types of the `tailwindcss/plugin` ([#8400](https://github.com/tailwindlabs/tailwindcss/pull/8400))
|
|
153
171
|
- Allow returning parallel variants from `addVariant` or `matchVariant` callback functions ([#8455](https://github.com/tailwindlabs/tailwindcss/pull/8455))
|
|
154
172
|
- Try using local `postcss` installation first in the CLI ([#8270](https://github.com/tailwindlabs/tailwindcss/pull/8270))
|
|
@@ -2073,7 +2091,9 @@ No release notes
|
|
|
2073
2091
|
|
|
2074
2092
|
- Everything!
|
|
2075
2093
|
|
|
2076
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1
|
|
2094
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.1...HEAD
|
|
2095
|
+
[3.2.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.0...v3.2.1
|
|
2096
|
+
[3.2.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.8...v3.2.0
|
|
2077
2097
|
[3.1.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.7...v3.1.8
|
|
2078
2098
|
[3.1.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.6...v3.1.7
|
|
2079
2099
|
[3.1.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.5...v3.1.6
|
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://tailwindcss.com
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<a href="https://tailwindcss.com" target="_blank">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-dark.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg">
|
|
6
|
+
<img alt="Tailwind CSS" src="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
|
|
7
|
+
</picture>
|
|
7
8
|
</a>
|
|
8
9
|
</p>
|
|
9
10
|
|
package/lib/cli/build/plugin.js
CHANGED
|
@@ -25,6 +25,7 @@ const _contentJs = require("../../lib/content.js");
|
|
|
25
25
|
const _watchingJs = require("./watching.js");
|
|
26
26
|
const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob"));
|
|
27
27
|
const _findAtConfigPathJs = require("../../lib/findAtConfigPath.js");
|
|
28
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("../../util/log"));
|
|
28
29
|
function _interopRequireDefault(obj) {
|
|
29
30
|
return obj && obj.__esModule ? obj : {
|
|
30
31
|
default: obj
|
|
@@ -124,7 +125,7 @@ let state = {
|
|
|
124
125
|
dynamic: this.contentPaths.filter((contentPath)=>contentPath.glob !== undefined).map((contentPath)=>contentPath.pattern)
|
|
125
126
|
};
|
|
126
127
|
},
|
|
127
|
-
loadConfig (configPath) {
|
|
128
|
+
loadConfig (configPath, content) {
|
|
128
129
|
if (this.watcher && configPath) {
|
|
129
130
|
this.refreshConfigDependencies(configPath);
|
|
130
131
|
}
|
|
@@ -135,6 +136,10 @@ let state = {
|
|
|
135
136
|
files: []
|
|
136
137
|
}
|
|
137
138
|
});
|
|
139
|
+
// Override content files if `--content` has been passed explicitly
|
|
140
|
+
if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
|
|
141
|
+
config.content.files = content;
|
|
142
|
+
}
|
|
138
143
|
return config;
|
|
139
144
|
},
|
|
140
145
|
refreshConfigDependencies (configPath) {
|
|
@@ -173,7 +178,7 @@ let state = {
|
|
|
173
178
|
}
|
|
174
179
|
return content;
|
|
175
180
|
},
|
|
176
|
-
getContext ({ createContext , cliConfigPath , root , result }) {
|
|
181
|
+
getContext ({ createContext , cliConfigPath , root , result , content }) {
|
|
177
182
|
if (this.context) {
|
|
178
183
|
this.context.changedContent = this.changedContent.splice(0);
|
|
179
184
|
return this.context;
|
|
@@ -183,7 +188,7 @@ let state = {
|
|
|
183
188
|
let configPath = (ref = (0, _findAtConfigPathJs.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : cliConfigPath;
|
|
184
189
|
_shared.env.DEBUG && console.timeEnd("Searching for config");
|
|
185
190
|
_shared.env.DEBUG && console.time("Loading config");
|
|
186
|
-
let config = this.loadConfig(configPath);
|
|
191
|
+
let config = this.loadConfig(configPath, content);
|
|
187
192
|
_shared.env.DEBUG && console.timeEnd("Loading config");
|
|
188
193
|
_shared.env.DEBUG && console.time("Creating context");
|
|
189
194
|
this.context = createContext(config, []);
|
|
@@ -208,12 +213,24 @@ let state = {
|
|
|
208
213
|
}
|
|
209
214
|
};
|
|
210
215
|
async function createProcessor(args, cliConfigPath) {
|
|
216
|
+
var ref;
|
|
211
217
|
let postcss = (0, _deps.loadPostcss)();
|
|
212
218
|
let input = args["--input"];
|
|
213
219
|
let output = args["--output"];
|
|
214
220
|
let includePostCss = args["--postcss"];
|
|
215
221
|
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
|
216
222
|
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : loadBuiltinPostcssPlugins();
|
|
223
|
+
if (args["--purge"]) {
|
|
224
|
+
_log.default.warn("purge-flag-deprecated", [
|
|
225
|
+
"The `--purge` flag has been deprecated.",
|
|
226
|
+
"Please use `--content` instead."
|
|
227
|
+
]);
|
|
228
|
+
if (!args["--content"]) {
|
|
229
|
+
args["--content"] = args["--purge"];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
var ref1;
|
|
233
|
+
let content = (ref1 = (ref = args["--content"]) === null || ref === void 0 ? void 0 : ref.split(/(?<!{[^}]+),/)) !== null && ref1 !== void 0 ? ref1 : [];
|
|
217
234
|
let tailwindPlugin = ()=>{
|
|
218
235
|
return {
|
|
219
236
|
postcssPlugin: "tailwindcss",
|
|
@@ -227,7 +244,8 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
227
244
|
createContext,
|
|
228
245
|
cliConfigPath,
|
|
229
246
|
root,
|
|
230
|
-
result
|
|
247
|
+
result,
|
|
248
|
+
content
|
|
231
249
|
});
|
|
232
250
|
};
|
|
233
251
|
})(root, result);
|
|
@@ -265,6 +283,22 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
265
283
|
from: input,
|
|
266
284
|
to: output
|
|
267
285
|
})).then((result)=>{
|
|
286
|
+
if (!state.watcher) {
|
|
287
|
+
return result;
|
|
288
|
+
}
|
|
289
|
+
_shared.env.DEBUG && console.time("Recording PostCSS dependencies");
|
|
290
|
+
for (let message of result.messages){
|
|
291
|
+
if (message.type === "dependency") {
|
|
292
|
+
state.contextDependencies.add(message.file);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
_shared.env.DEBUG && console.timeEnd("Recording PostCSS dependencies");
|
|
296
|
+
// TODO: This needs to be in a different spot
|
|
297
|
+
_shared.env.DEBUG && console.time("Watch new files");
|
|
298
|
+
state.watcher.refreshWatchedFiles();
|
|
299
|
+
_shared.env.DEBUG && console.timeEnd("Watch new files");
|
|
300
|
+
return result;
|
|
301
|
+
}).then((result)=>{
|
|
268
302
|
if (!output) {
|
|
269
303
|
process.stdout.write(result.css);
|
|
270
304
|
return;
|
|
@@ -52,7 +52,7 @@ function createWatcher(args, { state , rebuild }) {
|
|
|
52
52
|
content,
|
|
53
53
|
extension: _path.default.extname(file).slice(1)
|
|
54
54
|
});
|
|
55
|
-
chain = chain.then(()=>rebuild(changedContent));
|
|
55
|
+
chain = chain.then(()=>rebuild(changedContent.splice(0)));
|
|
56
56
|
return chain;
|
|
57
57
|
}
|
|
58
58
|
watcher.on("change", (file)=>recordChangedFile(file));
|
package/lib/corePlugins.js
CHANGED
|
@@ -228,12 +228,6 @@ let variantPlugins = {
|
|
|
228
228
|
};
|
|
229
229
|
for (let [name, fn] of Object.entries(variants)){
|
|
230
230
|
matchVariant(name, (value = "", extra)=>{
|
|
231
|
-
if (extra.modifier) {
|
|
232
|
-
_log.default.warn(`modifier-${name}-experimental`, [
|
|
233
|
-
`The ${name} variant modifier feature in Tailwind CSS is currently in preview.`,
|
|
234
|
-
"Preview features are not covered by semver, and may be improved in breaking ways at any time."
|
|
235
|
-
]);
|
|
236
|
-
}
|
|
237
231
|
let result = (0, _dataTypes.normalize)(typeof value === "function" ? value(extra) : value);
|
|
238
232
|
if (!result.includes("&")) result = "&" + result;
|
|
239
233
|
let [a, b] = fn("", extra);
|
|
@@ -352,17 +346,17 @@ let variantPlugins = {
|
|
|
352
346
|
return (value)=>{
|
|
353
347
|
if (!areSimpleScreens) {
|
|
354
348
|
_log.default.warn("complex-screen-config", [
|
|
355
|
-
"The min and max variants are not supported with a
|
|
349
|
+
"The `min-*` and `max-*` variants are not supported with a `screens` configuration containing objects."
|
|
356
350
|
]);
|
|
357
351
|
return [];
|
|
358
352
|
} else if (!screensUseConsistentUnits) {
|
|
359
353
|
_log.default.warn("mixed-screen-units", [
|
|
360
|
-
"The min and max variants are not supported with a
|
|
354
|
+
"The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units."
|
|
361
355
|
]);
|
|
362
356
|
return [];
|
|
363
357
|
} else if (typeof value === "string" && !canUseUnits(value)) {
|
|
364
358
|
_log.default.warn("minmax-have-mixed-units", [
|
|
365
|
-
"The min and max variants are not supported with a
|
|
359
|
+
"The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units."
|
|
366
360
|
]);
|
|
367
361
|
return [];
|
|
368
362
|
}
|
|
@@ -406,25 +400,39 @@ let variantPlugins = {
|
|
|
406
400
|
if (!(check.startsWith("(") && check.endsWith(")"))) {
|
|
407
401
|
check = `(${check})`;
|
|
408
402
|
}
|
|
409
|
-
return `@supports ${check}
|
|
403
|
+
return `@supports ${check}`;
|
|
410
404
|
}, {
|
|
411
405
|
values: (ref = theme("supports")) !== null && ref !== void 0 ? ref : {}
|
|
412
406
|
});
|
|
413
407
|
},
|
|
414
408
|
ariaVariants: ({ matchVariant , theme })=>{
|
|
415
409
|
var ref;
|
|
416
|
-
matchVariant("aria", (value)=>`&[aria-${value}]`, {
|
|
410
|
+
matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
|
|
417
411
|
values: (ref = theme("aria")) !== null && ref !== void 0 ? ref : {}
|
|
418
412
|
});
|
|
419
413
|
var ref1;
|
|
420
|
-
matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${value}] &` : `:merge(.group)[aria-${value}] &`, {
|
|
414
|
+
matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[aria-${(0, _dataTypes.normalize)(value)}] &`, {
|
|
421
415
|
values: (ref1 = theme("aria")) !== null && ref1 !== void 0 ? ref1 : {}
|
|
422
416
|
});
|
|
423
417
|
var ref2;
|
|
424
|
-
matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${value}] ~ &` : `:merge(.peer)[aria-${value}] ~ &`, {
|
|
418
|
+
matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[aria-${(0, _dataTypes.normalize)(value)}] ~ &`, {
|
|
425
419
|
values: (ref2 = theme("aria")) !== null && ref2 !== void 0 ? ref2 : {}
|
|
426
420
|
});
|
|
427
421
|
},
|
|
422
|
+
dataVariants: ({ matchVariant , theme })=>{
|
|
423
|
+
var ref;
|
|
424
|
+
matchVariant("data", (value)=>`&[data-${(0, _dataTypes.normalize)(value)}]`, {
|
|
425
|
+
values: (ref = theme("data")) !== null && ref !== void 0 ? ref : {}
|
|
426
|
+
});
|
|
427
|
+
var ref1;
|
|
428
|
+
matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[data-${(0, _dataTypes.normalize)(value)}] &`, {
|
|
429
|
+
values: (ref1 = theme("data")) !== null && ref1 !== void 0 ? ref1 : {}
|
|
430
|
+
});
|
|
431
|
+
var ref2;
|
|
432
|
+
matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[data-${(0, _dataTypes.normalize)(value)}] ~ &`, {
|
|
433
|
+
values: (ref2 = theme("data")) !== null && ref2 !== void 0 ? ref2 : {}
|
|
434
|
+
});
|
|
435
|
+
},
|
|
428
436
|
orientationVariants: ({ addVariant })=>{
|
|
429
437
|
addVariant("portrait", "@media (orientation: portrait)");
|
|
430
438
|
addVariant("landscape", "@media (orientation: landscape)");
|
package/lib/lib/content.js
CHANGED
|
@@ -73,7 +73,15 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
73
73
|
* @param {ContentPath} contentPath
|
|
74
74
|
* @returns {ContentPath}
|
|
75
75
|
*/ function resolveGlobPattern(contentPath) {
|
|
76
|
-
|
|
76
|
+
// This is required for Windows support to properly pick up Glob paths.
|
|
77
|
+
// Afaik, this technically shouldn't be needed but there's probably
|
|
78
|
+
// some internal, direct path matching with a normalized path in
|
|
79
|
+
// a package which can't handle mixed directory separators
|
|
80
|
+
let base = (0, _normalizePath.default)(contentPath.base);
|
|
81
|
+
// If the user's file path contains any special characters (like parens) for instance fast-glob
|
|
82
|
+
// is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
|
|
83
|
+
base = _fastGlob.default.escapePath(base);
|
|
84
|
+
contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
|
|
77
85
|
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
|
|
78
86
|
return contentPath;
|
|
79
87
|
}
|
|
@@ -21,18 +21,18 @@ function findAtConfigPath(root, result) {
|
|
|
21
21
|
var _file, ref1;
|
|
22
22
|
relativeTo = (ref1 = (_file = (ref = rule.source) === null || ref === void 0 ? void 0 : ref.input.file) !== null && _file !== void 0 ? _file : result.opts.from) !== null && ref1 !== void 0 ? ref1 : null;
|
|
23
23
|
if (relativeTo === null) {
|
|
24
|
-
throw rule.error("The `@config`
|
|
24
|
+
throw rule.error("The `@config` directive cannot be used without setting `from` in your PostCSS config.");
|
|
25
25
|
}
|
|
26
26
|
if (configPath) {
|
|
27
|
-
throw rule.error("Only `@config`
|
|
27
|
+
throw rule.error("Only one `@config` directive is allowed per file.");
|
|
28
28
|
}
|
|
29
29
|
let matches = rule.params.match(/(['"])(.*?)\1/);
|
|
30
30
|
if (!matches) {
|
|
31
|
-
throw rule.error("
|
|
31
|
+
throw rule.error("A path is required when using the `@config` directive.");
|
|
32
32
|
}
|
|
33
33
|
let inputPath = matches[2];
|
|
34
34
|
if (_path.default.isAbsolute(inputPath)) {
|
|
35
|
-
throw rule.error("The `@config`
|
|
35
|
+
throw rule.error("The `@config` directive cannot be used with an absolute path.");
|
|
36
36
|
}
|
|
37
37
|
configPath = _path.default.resolve(_path.default.dirname(relativeTo), inputPath);
|
|
38
38
|
if (!_fs.default.existsSync(configPath)) {
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -9,6 +9,7 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
getClassNameFromSelector: ()=>getClassNameFromSelector,
|
|
12
13
|
resolveMatches: ()=>resolveMatches,
|
|
13
14
|
generateRules: ()=>generateRules
|
|
14
15
|
});
|
|
@@ -193,7 +194,7 @@ function applyVariant(variant, matches, context) {
|
|
|
193
194
|
}
|
|
194
195
|
/** @type {{modifier: string | null, value: string | null}} */ let args = {
|
|
195
196
|
modifier: null,
|
|
196
|
-
value:
|
|
197
|
+
value: _sharedState.NONE
|
|
197
198
|
};
|
|
198
199
|
// Retrieve "modifier"
|
|
199
200
|
{
|
|
@@ -208,10 +209,22 @@ function applyVariant(variant, matches, context) {
|
|
|
208
209
|
}
|
|
209
210
|
// Retrieve "arbitrary value"
|
|
210
211
|
if (variant.endsWith("]") && !variant.startsWith("[")) {
|
|
211
|
-
|
|
212
|
+
// We either have:
|
|
213
|
+
// @[200px]
|
|
214
|
+
// group-[:hover]
|
|
215
|
+
//
|
|
216
|
+
// But we don't want:
|
|
217
|
+
// @-[200px] (`-` is incorrect)
|
|
218
|
+
// group[:hover] (`-` is missing)
|
|
219
|
+
let match1 = /(.)(-?)\[(.*)\]/g.exec(variant);
|
|
212
220
|
if (match1) {
|
|
213
|
-
|
|
214
|
-
|
|
221
|
+
let [, char, seperator, value] = match1;
|
|
222
|
+
// @-[200px] case
|
|
223
|
+
if (char === "@" && seperator === "-") return [];
|
|
224
|
+
// group[:hover] case
|
|
225
|
+
if (char !== "@" && seperator === "") return [];
|
|
226
|
+
variant = variant.replace(`${seperator}[${value}]`, "");
|
|
227
|
+
args.value = value;
|
|
215
228
|
}
|
|
216
229
|
}
|
|
217
230
|
// Register arbitrary variants
|
|
@@ -243,7 +256,7 @@ function applyVariant(variant, matches, context) {
|
|
|
243
256
|
]
|
|
244
257
|
});
|
|
245
258
|
for (let [variantSort, variantFunction, containerFromArray] of variantFunctionTuples){
|
|
246
|
-
let clone = containerFromArray !== null && containerFromArray !== void 0 ? containerFromArray : container.clone();
|
|
259
|
+
let clone = (containerFromArray !== null && containerFromArray !== void 0 ? containerFromArray : container).clone();
|
|
247
260
|
let collectedFormats = [];
|
|
248
261
|
function prepareBackup() {
|
|
249
262
|
// Already prepared, chicken out
|
|
@@ -37,6 +37,7 @@ const _generateRules = require("./generateRules");
|
|
|
37
37
|
const _cacheInvalidationJs = require("./cacheInvalidation.js");
|
|
38
38
|
const _offsetsJs = require("./offsets.js");
|
|
39
39
|
const _featureFlagsJs = require("../featureFlags.js");
|
|
40
|
+
const _formatVariantSelector = require("../util/formatVariantSelector");
|
|
40
41
|
function _interopRequireDefault(obj) {
|
|
41
42
|
return obj && obj.__esModule ? obj : {
|
|
42
43
|
default: obj
|
|
@@ -81,7 +82,14 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
81
82
|
}
|
|
82
83
|
return newObj;
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
+
const VARIANT_TYPES = {
|
|
86
|
+
AddVariant: Symbol.for("ADD_VARIANT"),
|
|
87
|
+
MatchVariant: Symbol.for("MATCH_VARIANT")
|
|
88
|
+
};
|
|
89
|
+
const VARIANT_INFO = {
|
|
90
|
+
Base: 1 << 0,
|
|
91
|
+
Dynamic: 1 << 1
|
|
92
|
+
};
|
|
85
93
|
function prefix(context, selector) {
|
|
86
94
|
let prefix = context.tailwindConfig.prefix;
|
|
87
95
|
return typeof prefix === "function" ? prefix(selector) : prefix + selector;
|
|
@@ -531,7 +539,7 @@ function parseVariant(variant) {
|
|
|
531
539
|
modifySelectors,
|
|
532
540
|
container,
|
|
533
541
|
separator
|
|
534
|
-
},
|
|
542
|
+
}, options.type === VARIANT_TYPES.MatchVariant && {
|
|
535
543
|
args,
|
|
536
544
|
wrap,
|
|
537
545
|
format
|
|
@@ -565,29 +573,37 @@ function parseVariant(variant) {
|
|
|
565
573
|
let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
566
574
|
var ref1;
|
|
567
575
|
for (let [key, value] of Object.entries((ref1 = options === null || options === void 0 ? void 0 : options.values) !== null && ref1 !== void 0 ? ref1 : {})){
|
|
568
|
-
|
|
576
|
+
if (key === "DEFAULT") continue;
|
|
577
|
+
api.addVariant(isSpecial ? `${variant}${key}` : `${variant}-${key}`, ({ args , container })=>variantFn(value, modifiersEnabled ? {
|
|
569
578
|
modifier: args.modifier,
|
|
570
579
|
container
|
|
571
580
|
} : {
|
|
572
581
|
container
|
|
573
582
|
}), {
|
|
574
|
-
[MATCH_VARIANT]: true
|
|
575
|
-
}), {
|
|
576
583
|
...options,
|
|
577
584
|
value,
|
|
578
|
-
id
|
|
585
|
+
id,
|
|
586
|
+
type: VARIANT_TYPES.MatchVariant,
|
|
587
|
+
variantInfo: VARIANT_INFO.Base
|
|
579
588
|
});
|
|
580
589
|
}
|
|
581
|
-
|
|
590
|
+
var ref2;
|
|
591
|
+
let hasDefault = "DEFAULT" in ((ref2 = options === null || options === void 0 ? void 0 : options.values) !== null && ref2 !== void 0 ? ref2 : {});
|
|
592
|
+
api.addVariant(variant, ({ args , container })=>{
|
|
593
|
+
if (args.value === _sharedState.NONE && !hasDefault) {
|
|
594
|
+
return null;
|
|
595
|
+
}
|
|
596
|
+
return variantFn(args.value === _sharedState.NONE ? options.values.DEFAULT : args.value, modifiersEnabled ? {
|
|
582
597
|
modifier: args.modifier,
|
|
583
598
|
container
|
|
584
599
|
} : {
|
|
585
600
|
container
|
|
586
|
-
})
|
|
587
|
-
|
|
588
|
-
}), {
|
|
601
|
+
});
|
|
602
|
+
}, {
|
|
589
603
|
...options,
|
|
590
|
-
id
|
|
604
|
+
id,
|
|
605
|
+
type: VARIANT_TYPES.MatchVariant,
|
|
606
|
+
variantInfo: VARIANT_INFO.Dynamic
|
|
591
607
|
});
|
|
592
608
|
}
|
|
593
609
|
};
|
|
@@ -702,7 +718,8 @@ function resolvePlugins(context, root) {
|
|
|
702
718
|
let beforeVariants = [
|
|
703
719
|
_corePlugins.variantPlugins["pseudoElementVariants"],
|
|
704
720
|
_corePlugins.variantPlugins["pseudoClassVariants"],
|
|
705
|
-
_corePlugins.variantPlugins["ariaVariants"]
|
|
721
|
+
_corePlugins.variantPlugins["ariaVariants"],
|
|
722
|
+
_corePlugins.variantPlugins["dataVariants"]
|
|
706
723
|
];
|
|
707
724
|
let afterVariants = [
|
|
708
725
|
_corePlugins.variantPlugins["supportsVariants"],
|
|
@@ -910,6 +927,128 @@ function registerPlugins(plugins, context) {
|
|
|
910
927
|
}
|
|
911
928
|
return output;
|
|
912
929
|
};
|
|
930
|
+
// Generate a list of available variants with meta information of the type of variant.
|
|
931
|
+
context.getVariants = function getVariants() {
|
|
932
|
+
let result = [];
|
|
933
|
+
for (let [name, options] of context.variantOptions.entries()){
|
|
934
|
+
if (options.variantInfo === VARIANT_INFO.Base) continue;
|
|
935
|
+
var _values;
|
|
936
|
+
result.push({
|
|
937
|
+
name,
|
|
938
|
+
isArbitrary: options.type === Symbol.for("MATCH_VARIANT"),
|
|
939
|
+
values: Object.keys((_values = options.values) !== null && _values !== void 0 ? _values : {}),
|
|
940
|
+
hasDash: name !== "@",
|
|
941
|
+
selectors ({ modifier , value } = {}) {
|
|
942
|
+
let candidate = "__TAILWIND_PLACEHOLDER__";
|
|
943
|
+
let rule = _postcss.default.rule({
|
|
944
|
+
selector: `.${candidate}`
|
|
945
|
+
});
|
|
946
|
+
let container = _postcss.default.root({
|
|
947
|
+
nodes: [
|
|
948
|
+
rule.clone()
|
|
949
|
+
]
|
|
950
|
+
});
|
|
951
|
+
let before = container.toString();
|
|
952
|
+
var ref;
|
|
953
|
+
let fns = ((ref = context.variantMap.get(name)) !== null && ref !== void 0 ? ref : []).flatMap(([_, fn])=>fn);
|
|
954
|
+
let formatStrings = [];
|
|
955
|
+
for (let fn of fns){
|
|
956
|
+
var ref1;
|
|
957
|
+
let localFormatStrings = [];
|
|
958
|
+
var ref2;
|
|
959
|
+
let api = {
|
|
960
|
+
args: {
|
|
961
|
+
modifier,
|
|
962
|
+
value: (ref2 = (ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[value]) !== null && ref2 !== void 0 ? ref2 : value
|
|
963
|
+
},
|
|
964
|
+
separator: context.tailwindConfig.separator,
|
|
965
|
+
modifySelectors (modifierFunction) {
|
|
966
|
+
// Run the modifierFunction over each rule
|
|
967
|
+
container.each((rule)=>{
|
|
968
|
+
if (rule.type !== "rule") {
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
rule.selectors = rule.selectors.map((selector)=>{
|
|
972
|
+
return modifierFunction({
|
|
973
|
+
get className () {
|
|
974
|
+
return (0, _generateRules.getClassNameFromSelector)(selector);
|
|
975
|
+
},
|
|
976
|
+
selector
|
|
977
|
+
});
|
|
978
|
+
});
|
|
979
|
+
});
|
|
980
|
+
return container;
|
|
981
|
+
},
|
|
982
|
+
format (str) {
|
|
983
|
+
localFormatStrings.push(str);
|
|
984
|
+
},
|
|
985
|
+
wrap (wrapper) {
|
|
986
|
+
localFormatStrings.push(`@${wrapper.name} ${wrapper.params} { & }`);
|
|
987
|
+
},
|
|
988
|
+
container
|
|
989
|
+
};
|
|
990
|
+
let ruleWithVariant = fn(api);
|
|
991
|
+
if (localFormatStrings.length > 0) {
|
|
992
|
+
formatStrings.push(localFormatStrings);
|
|
993
|
+
}
|
|
994
|
+
if (Array.isArray(ruleWithVariant)) {
|
|
995
|
+
for (let variantFunction of ruleWithVariant){
|
|
996
|
+
localFormatStrings = [];
|
|
997
|
+
variantFunction(api);
|
|
998
|
+
formatStrings.push(localFormatStrings);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
// Reverse engineer the result of the `container`
|
|
1003
|
+
let manualFormatStrings = [];
|
|
1004
|
+
let after = container.toString();
|
|
1005
|
+
if (before !== after) {
|
|
1006
|
+
// Figure out all selectors
|
|
1007
|
+
container.walkRules((rule)=>{
|
|
1008
|
+
let modified = rule.selector;
|
|
1009
|
+
// Rebuild the base selector, this is what plugin authors would do
|
|
1010
|
+
// as well. E.g.: `${variant}${separator}${className}`.
|
|
1011
|
+
// However, plugin authors probably also prepend or append certain
|
|
1012
|
+
// classes, pseudos, ids, ...
|
|
1013
|
+
let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
|
|
1014
|
+
selectors.walkClasses((classNode)=>{
|
|
1015
|
+
classNode.value = `${name}${context.tailwindConfig.separator}${classNode.value}`;
|
|
1016
|
+
});
|
|
1017
|
+
}).processSync(modified);
|
|
1018
|
+
// Now that we know the original selector, the new selector, and
|
|
1019
|
+
// the rebuild part in between, we can replace the part that plugin
|
|
1020
|
+
// authors need to rebuild with `&`, and eventually store it in the
|
|
1021
|
+
// collectedFormats. Similar to what `format('...')` would do.
|
|
1022
|
+
//
|
|
1023
|
+
// E.g.:
|
|
1024
|
+
// variant: foo
|
|
1025
|
+
// selector: .markdown > p
|
|
1026
|
+
// modified (by plugin): .foo .foo\\:markdown > p
|
|
1027
|
+
// rebuiltBase (internal): .foo\\:markdown > p
|
|
1028
|
+
// format: .foo &
|
|
1029
|
+
manualFormatStrings.push(modified.replace(rebuiltBase, "&").replace(candidate, "&"));
|
|
1030
|
+
});
|
|
1031
|
+
// Figure out all atrules
|
|
1032
|
+
container.walkAtRules((atrule)=>{
|
|
1033
|
+
manualFormatStrings.push(`@${atrule.name} (${atrule.params}) { & }`);
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
var _values;
|
|
1037
|
+
let result = formatStrings.map((formatString)=>(0, _formatVariantSelector.finalizeSelector)((0, _formatVariantSelector.formatVariantSelector)("&", ...formatString), {
|
|
1038
|
+
selector: `.${candidate}`,
|
|
1039
|
+
candidate,
|
|
1040
|
+
context,
|
|
1041
|
+
isArbitraryVariant: !(value in ((_values = options.values) !== null && _values !== void 0 ? _values : {}))
|
|
1042
|
+
}).replace(`.${candidate}`, "&").replace("{ & }", "").trim());
|
|
1043
|
+
if (manualFormatStrings.length > 0) {
|
|
1044
|
+
result.push((0, _formatVariantSelector.formatVariantSelector)("&", ...manualFormatStrings));
|
|
1045
|
+
}
|
|
1046
|
+
return result;
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
return result;
|
|
1051
|
+
};
|
|
913
1052
|
}
|
|
914
1053
|
/**
|
|
915
1054
|
* Mark as class as retroactively invalid
|