tailwindcss 0.0.0-insiders.e4a37ce → 0.0.0-insiders.e4af07f
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 +1 -1
- package/index.css +5 -0
- package/lib/cli/build/index.js +3 -0
- package/lib/cli/build/plugin.js +105 -53
- package/lib/cli/index.js +1 -0
- package/lib/cli.js +1 -5
- package/lib/corePluginList.js +1 -0
- package/lib/corePlugins.js +30 -12
- package/lib/css/preflight.css +7 -1
- package/lib/featureFlags.js +10 -9
- package/lib/lib/content.js +27 -1
- package/lib/lib/evaluateTailwindFunctions.js +5 -3
- package/lib/lib/expandTailwindAtRules.js +53 -13
- package/lib/lib/generateRules.js +7 -10
- package/lib/lib/handleImportAtRules.js +50 -0
- package/lib/lib/normalizeTailwindDirectives.js +0 -15
- package/lib/lib/offsets.js +2 -2
- package/lib/lib/setupContextUtils.js +6 -16
- package/lib/lib/setupTrackingContext.js +2 -1
- package/lib/lib/sharedState.js +2 -10
- package/lib/plugin.js +87 -21
- package/lib/util/dataTypes.js +14 -6
- package/lib/util/log.js +17 -0
- package/lib/util/normalizeConfig.js +35 -9
- package/lib/util/pluginUtils.js +1 -3
- package/lib/util/pseudoElements.js +10 -30
- package/lib/util/validateConfig.js +11 -0
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/package.json +28 -37
- package/src/cli/build/index.js +4 -0
- package/src/cli/build/plugin.js +71 -46
- package/src/cli/index.js +1 -0
- package/src/cli.js +1 -5
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +34 -12
- package/src/css/preflight.css +7 -1
- package/src/featureFlags.js +7 -9
- package/src/lib/content.js +33 -1
- package/src/lib/evaluateTailwindFunctions.js +4 -1
- package/src/lib/expandTailwindAtRules.js +58 -26
- package/src/lib/generateRules.js +7 -11
- package/src/lib/handleImportAtRules.js +34 -0
- package/src/lib/normalizeTailwindDirectives.js +0 -27
- package/src/lib/offsets.js +3 -3
- package/src/lib/setupContextUtils.js +6 -15
- package/src/lib/setupTrackingContext.js +1 -3
- package/src/lib/sharedState.js +0 -4
- package/src/plugin.js +83 -57
- package/src/util/dataTypes.js +17 -6
- package/src/util/log.js +24 -0
- package/src/util/normalizeConfig.js +38 -11
- package/src/util/pluginUtils.js +0 -4
- package/src/util/pseudoElements.js +10 -13
- package/src/util/validateConfig.js +10 -0
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/config.full.js +14 -1
- package/stubs/config.simple.js +1 -1
- package/stubs/postcss.config.cjs +0 -1
- package/stubs/postcss.config.js +0 -1
- package/types/config.d.ts +2 -1
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +2 -1
- package/lib/cli/build/deps.js +0 -62
- package/lib/cli-peer-dependencies.js +0 -36
- package/lib/oxide/cli/build/deps.js +0 -89
- package/lib/oxide/cli/build/index.js +0 -53
- package/lib/oxide/cli/build/plugin.js +0 -375
- package/lib/oxide/cli/build/utils.js +0 -87
- package/lib/oxide/cli/build/watching.js +0 -179
- package/lib/oxide/cli/help/index.js +0 -72
- package/lib/oxide/cli/index.js +0 -214
- package/lib/oxide/cli/init/index.js +0 -52
- package/lib/oxide/cli.js +0 -5
- package/lib/oxide/postcss-plugin.js +0 -2
- package/peers/index.js +0 -96419
- package/scripts/swap-engines.js +0 -40
- package/src/cli/build/deps.js +0 -56
- package/src/cli-peer-dependencies.js +0 -15
- package/src/oxide/cli/build/deps.ts +0 -91
- package/src/oxide/cli/build/index.ts +0 -47
- package/src/oxide/cli/build/plugin.ts +0 -442
- package/src/oxide/cli/build/utils.ts +0 -74
- package/src/oxide/cli/build/watching.ts +0 -225
- package/src/oxide/cli/help/index.ts +0 -69
- package/src/oxide/cli/index.ts +0 -204
- package/src/oxide/cli/init/index.ts +0 -59
- package/src/oxide/cli.ts +0 -1
- package/src/oxide/postcss-plugin.ts +0 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
17
|
-
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci
|
|
17
|
+
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=master" alt="Build Status"></a>
|
|
18
18
|
<a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
|
|
19
19
|
<a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
|
|
20
20
|
<a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
|
package/index.css
ADDED
package/lib/cli/build/index.js
CHANGED
|
@@ -34,6 +34,9 @@ async function build(args) {
|
|
|
34
34
|
console.error(`Specified config file ${args["--config"]} does not exist.`);
|
|
35
35
|
process.exit(9);
|
|
36
36
|
}
|
|
37
|
+
if (args["--no-autoprefixer"]) {
|
|
38
|
+
console.error("[deprecation] The --no-autoprefixer flag is deprecated and has no effect.");
|
|
39
|
+
}
|
|
37
40
|
// TODO: Reference the @config path here if exists
|
|
38
41
|
let configPath = args["--config"] ? args["--config"] : (0, _resolveConfigPath.resolveDefaultConfigPath)();
|
|
39
42
|
let processor = await (0, _plugin.createProcessor)(args, configPath);
|
package/lib/cli/build/plugin.js
CHANGED
|
@@ -9,16 +9,19 @@ Object.defineProperty(exports, "createProcessor", {
|
|
|
9
9
|
return createProcessor;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../package.json"));
|
|
12
13
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
14
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
15
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
14
16
|
const _postcssloadconfig = /*#__PURE__*/ _interop_require_default(require("postcss-load-config"));
|
|
17
|
+
const _browserslist = /*#__PURE__*/ _interop_require_default(require("browserslist"));
|
|
18
|
+
const _lightningcss = /*#__PURE__*/ _interop_require_wildcard(require("lightningcss"));
|
|
15
19
|
const _lilconfig = require("lilconfig");
|
|
16
20
|
const _plugins = /*#__PURE__*/ _interop_require_default(require("postcss-load-config/src/plugins" // Little bit scary, looking at private/internal API
|
|
17
21
|
));
|
|
18
22
|
const _options = /*#__PURE__*/ _interop_require_default(require("postcss-load-config/src/options" // Little bit scary, looking at private/internal API
|
|
19
23
|
));
|
|
20
24
|
const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("../../processTailwindFeatures"));
|
|
21
|
-
const _deps = require("./deps");
|
|
22
25
|
const _utils = require("./utils");
|
|
23
26
|
const _sharedState = require("../../lib/sharedState");
|
|
24
27
|
const _resolveConfig = /*#__PURE__*/ _interop_require_default(require("../../../resolveConfig.js"));
|
|
@@ -29,11 +32,91 @@ const _findAtConfigPath = require("../../lib/findAtConfigPath.js");
|
|
|
29
32
|
const _log = /*#__PURE__*/ _interop_require_default(require("../../util/log"));
|
|
30
33
|
const _loadconfig = require("../../lib/load-config");
|
|
31
34
|
const _getModuleDependencies = /*#__PURE__*/ _interop_require_default(require("../../lib/getModuleDependencies"));
|
|
35
|
+
const _validateConfig = require("../../util/validateConfig");
|
|
36
|
+
const _handleImportAtRules = require("../../lib/handleImportAtRules");
|
|
37
|
+
const _featureFlags = require("../../featureFlags");
|
|
32
38
|
function _interop_require_default(obj) {
|
|
33
39
|
return obj && obj.__esModule ? obj : {
|
|
34
40
|
default: obj
|
|
35
41
|
};
|
|
36
42
|
}
|
|
43
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
44
|
+
if (typeof WeakMap !== "function") return null;
|
|
45
|
+
var cacheBabelInterop = new WeakMap();
|
|
46
|
+
var cacheNodeInterop = new WeakMap();
|
|
47
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
48
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
49
|
+
})(nodeInterop);
|
|
50
|
+
}
|
|
51
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
52
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
53
|
+
return obj;
|
|
54
|
+
}
|
|
55
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
56
|
+
return {
|
|
57
|
+
default: obj
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
61
|
+
if (cache && cache.has(obj)) {
|
|
62
|
+
return cache.get(obj);
|
|
63
|
+
}
|
|
64
|
+
var newObj = {};
|
|
65
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
66
|
+
for(var key in obj){
|
|
67
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
68
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
69
|
+
if (desc && (desc.get || desc.set)) {
|
|
70
|
+
Object.defineProperty(newObj, key, desc);
|
|
71
|
+
} else {
|
|
72
|
+
newObj[key] = obj[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
newObj.default = obj;
|
|
77
|
+
if (cache) {
|
|
78
|
+
cache.set(obj, newObj);
|
|
79
|
+
}
|
|
80
|
+
return newObj;
|
|
81
|
+
}
|
|
82
|
+
function license() {
|
|
83
|
+
return `/* ! tailwindcss v${_packagejson.default.version} | MIT License | https://tailwindcss.com */\n`;
|
|
84
|
+
}
|
|
85
|
+
async function lightningcss(result, { map =true , minify =true } = {}) {
|
|
86
|
+
try {
|
|
87
|
+
var _browserslist_findConfig;
|
|
88
|
+
var _result_opts_from;
|
|
89
|
+
let resolvedBrowsersListConfig = (_browserslist_findConfig = _browserslist.default.findConfig((_result_opts_from = result.opts.from) !== null && _result_opts_from !== void 0 ? _result_opts_from : process.cwd())) === null || _browserslist_findConfig === void 0 ? void 0 : _browserslist_findConfig.defaults;
|
|
90
|
+
let defaultBrowsersListConfig = _packagejson.default.browserslist;
|
|
91
|
+
let browsersListConfig = resolvedBrowsersListConfig !== null && resolvedBrowsersListConfig !== void 0 ? resolvedBrowsersListConfig : defaultBrowsersListConfig;
|
|
92
|
+
let transformed = _lightningcss.default.transform({
|
|
93
|
+
filename: result.opts.from || "input.css",
|
|
94
|
+
code: Buffer.from(result.css, "utf-8"),
|
|
95
|
+
minify,
|
|
96
|
+
sourceMap: result.map === undefined ? map : !!result.map,
|
|
97
|
+
inputSourceMap: result.map ? result.map.toString() : undefined,
|
|
98
|
+
targets: _lightningcss.default.browserslistToTargets((0, _browserslist.default)(browsersListConfig)),
|
|
99
|
+
drafts: {
|
|
100
|
+
nesting: true
|
|
101
|
+
},
|
|
102
|
+
include: _lightningcss.Features.Nesting,
|
|
103
|
+
exclude: _lightningcss.Features.LogicalProperties
|
|
104
|
+
});
|
|
105
|
+
return Object.assign(result, {
|
|
106
|
+
css: transformed.code.toString("utf8"),
|
|
107
|
+
map: result.map ? Object.assign(result.map, {
|
|
108
|
+
toString () {
|
|
109
|
+
var _transformed_map;
|
|
110
|
+
return (_transformed_map = transformed.map) === null || _transformed_map === void 0 ? void 0 : _transformed_map.toString();
|
|
111
|
+
}
|
|
112
|
+
}) : result.map
|
|
113
|
+
});
|
|
114
|
+
} catch (err) {
|
|
115
|
+
console.error("Unable to use Lightning CSS. Using raw version instead.");
|
|
116
|
+
console.error(err);
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
37
120
|
/**
|
|
38
121
|
*
|
|
39
122
|
* @param {string} [customPostCssPath ]
|
|
@@ -76,43 +159,11 @@ function _interop_require_default(obj) {
|
|
|
76
159
|
config.options
|
|
77
160
|
];
|
|
78
161
|
}
|
|
79
|
-
function loadBuiltinPostcssPlugins() {
|
|
80
|
-
let postcss = (0, _deps.loadPostcss)();
|
|
81
|
-
let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
|
|
82
|
-
return [
|
|
83
|
-
[
|
|
84
|
-
(root)=>{
|
|
85
|
-
root.walkAtRules("import", (rule)=>{
|
|
86
|
-
if (rule.params.slice(1).startsWith("tailwindcss/")) {
|
|
87
|
-
rule.after(postcss.comment({
|
|
88
|
-
text: IMPORT_COMMENT + rule.params
|
|
89
|
-
}));
|
|
90
|
-
rule.remove();
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
(0, _deps.loadPostcssImport)(),
|
|
95
|
-
(root)=>{
|
|
96
|
-
root.walkComments((rule)=>{
|
|
97
|
-
if (rule.text.startsWith(IMPORT_COMMENT)) {
|
|
98
|
-
rule.after(postcss.atRule({
|
|
99
|
-
name: "import",
|
|
100
|
-
params: rule.text.replace(IMPORT_COMMENT, "")
|
|
101
|
-
}));
|
|
102
|
-
rule.remove();
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
[],
|
|
108
|
-
{}
|
|
109
|
-
];
|
|
110
|
-
}
|
|
111
162
|
let state = {
|
|
112
163
|
/** @type {any} */ context: null,
|
|
113
164
|
/** @type {ReturnType<typeof createWatcher> | null} */ watcher: null,
|
|
114
165
|
/** @type {{content: string, extension: string}[]} */ changedContent: [],
|
|
115
|
-
/** @type {
|
|
166
|
+
/** @type {{config: import('../../../types').Config, dependencies: Set<string>, dispose: Function } | null} */ configBag: null,
|
|
116
167
|
contextDependencies: new Set(),
|
|
117
168
|
/** @type {import('../../lib/content.js').ContentPath[]} */ contentPaths: [],
|
|
118
169
|
refreshContentPaths () {
|
|
@@ -143,12 +194,7 @@ let state = {
|
|
|
143
194
|
}
|
|
144
195
|
}
|
|
145
196
|
};
|
|
146
|
-
|
|
147
|
-
this.configBag.config = (0, _resolveConfig.default)(this.configBag.config, {
|
|
148
|
-
content: {
|
|
149
|
-
files: []
|
|
150
|
-
}
|
|
151
|
-
});
|
|
197
|
+
this.configBag.config = (0, _validateConfig.validateConfig)((0, _resolveConfig.default)(this.configBag.config));
|
|
152
198
|
// Override content files if `--content` has been passed explicitly
|
|
153
199
|
if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
|
|
154
200
|
this.configBag.config.content.files = content;
|
|
@@ -167,7 +213,7 @@ let state = {
|
|
|
167
213
|
// TODO: When we make the postcss plugin async-capable this can become async
|
|
168
214
|
let files = _fastglob.default.sync(this.contentPatterns.all);
|
|
169
215
|
for (let file of files){
|
|
170
|
-
if (
|
|
216
|
+
if ((0, _featureFlags.flagEnabled)(this.config, "oxideParser")) {
|
|
171
217
|
content.push({
|
|
172
218
|
file,
|
|
173
219
|
extension: _path.default.extname(file).slice(1)
|
|
@@ -225,12 +271,16 @@ let state = {
|
|
|
225
271
|
};
|
|
226
272
|
async function createProcessor(args, cliConfigPath) {
|
|
227
273
|
var _args_content;
|
|
228
|
-
let postcss = (0, _deps.loadPostcss)();
|
|
229
274
|
let input = args["--input"];
|
|
230
275
|
let output = args["--output"];
|
|
231
276
|
let includePostCss = args["--postcss"];
|
|
232
277
|
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
|
233
|
-
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) :
|
|
278
|
+
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : [
|
|
279
|
+
[],
|
|
280
|
+
[],
|
|
281
|
+
{}
|
|
282
|
+
];
|
|
283
|
+
beforePlugins.unshift(...(0, _handleImportAtRules.handleImportAtRules)());
|
|
234
284
|
if (args["--purge"]) {
|
|
235
285
|
_log.default.warn("purge-flag-deprecated", [
|
|
236
286
|
"The `--purge` flag has been deprecated.",
|
|
@@ -269,12 +319,10 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
269
319
|
...beforePlugins,
|
|
270
320
|
tailwindPlugin,
|
|
271
321
|
!args["--minify"] && _utils.formatNodes,
|
|
272
|
-
...afterPlugins
|
|
273
|
-
!args["--no-autoprefixer"] && (0, _deps.loadAutoprefixer)(),
|
|
274
|
-
args["--minify"] && (0, _deps.loadCssNano)()
|
|
322
|
+
...afterPlugins
|
|
275
323
|
].filter(Boolean);
|
|
276
324
|
/** @type {import('postcss').Processor} */ // @ts-ignore
|
|
277
|
-
let processor =
|
|
325
|
+
let processor = (0, _postcss.default)(plugins);
|
|
278
326
|
async function readInput() {
|
|
279
327
|
// Piping in data, let's drain the stdin
|
|
280
328
|
if (input === "-") {
|
|
@@ -289,10 +337,14 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
289
337
|
}
|
|
290
338
|
async function build() {
|
|
291
339
|
let start = process.hrtime.bigint();
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
340
|
+
let options = {
|
|
341
|
+
...postcssOptions,
|
|
342
|
+
from: input,
|
|
343
|
+
to: output
|
|
344
|
+
};
|
|
345
|
+
return readInput().then((css)=>processor.process(css, options)).then((result)=>lightningcss(result, {
|
|
346
|
+
...options,
|
|
347
|
+
minify: !!args["--minify"]
|
|
296
348
|
})).then((result)=>{
|
|
297
349
|
if (!state.watcher) {
|
|
298
350
|
return result;
|
|
@@ -311,11 +363,11 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
311
363
|
return result;
|
|
312
364
|
}).then((result)=>{
|
|
313
365
|
if (!output) {
|
|
314
|
-
process.stdout.write(result.css);
|
|
366
|
+
process.stdout.write(license() + result.css);
|
|
315
367
|
return;
|
|
316
368
|
}
|
|
317
369
|
return Promise.all([
|
|
318
|
-
(0, _utils.outputFile)(result.opts.to, result.css),
|
|
370
|
+
(0, _utils.outputFile)(result.opts.to, license() + result.css),
|
|
319
371
|
result.map && (0, _utils.outputFile)(result.opts.to + ".map", result.map.toString())
|
|
320
372
|
]);
|
|
321
373
|
}).then(()=>{
|
package/lib/cli/index.js
CHANGED
package/lib/cli.js
CHANGED
package/lib/corePluginList.js
CHANGED
package/lib/corePlugins.js
CHANGED
|
@@ -28,7 +28,6 @@ const _withAlphaVariable = /*#__PURE__*/ _interop_require_wildcard(require("./ut
|
|
|
28
28
|
const _toColorValue = /*#__PURE__*/ _interop_require_default(require("./util/toColorValue"));
|
|
29
29
|
const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("./util/isPlainObject"));
|
|
30
30
|
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("./util/transformThemeValue"));
|
|
31
|
-
const _packagejson = require("../package.json");
|
|
32
31
|
const _log = /*#__PURE__*/ _interop_require_default(require("./util/log"));
|
|
33
32
|
const _normalizeScreens = require("./util/normalizeScreens");
|
|
34
33
|
const _parseBoxShadowValue = require("./util/parseBoxShadowValue");
|
|
@@ -415,6 +414,17 @@ let variantPlugins = {
|
|
|
415
414
|
values: (_theme = theme("supports")) !== null && _theme !== void 0 ? _theme : {}
|
|
416
415
|
});
|
|
417
416
|
},
|
|
417
|
+
hasVariants: ({ matchVariant })=>{
|
|
418
|
+
matchVariant("has", (value)=>`&:has(${(0, _dataTypes.normalize)(value)})`, {
|
|
419
|
+
values: {}
|
|
420
|
+
});
|
|
421
|
+
matchVariant("group-has", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) &` : `:merge(.group):has(${(0, _dataTypes.normalize)(value)}) &`, {
|
|
422
|
+
values: {}
|
|
423
|
+
});
|
|
424
|
+
matchVariant("peer-has", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) ~ &` : `:merge(.peer):has(${(0, _dataTypes.normalize)(value)}) ~ &`, {
|
|
425
|
+
values: {}
|
|
426
|
+
});
|
|
427
|
+
},
|
|
418
428
|
ariaVariants: ({ matchVariant , theme })=>{
|
|
419
429
|
var _theme;
|
|
420
430
|
matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
|
|
@@ -485,12 +495,7 @@ let cssBackdropFilterValue = [
|
|
|
485
495
|
let corePlugins = {
|
|
486
496
|
preflight: ({ addBase })=>{
|
|
487
497
|
let preflightStyles = _postcss.default.parse(_fs.default.readFileSync(_path.join(__dirname, "./css/preflight.css"), "utf8"));
|
|
488
|
-
addBase(
|
|
489
|
-
_postcss.default.comment({
|
|
490
|
-
text: `! tailwindcss v${_packagejson.version} | MIT License | https://tailwindcss.com`
|
|
491
|
-
}),
|
|
492
|
-
...preflightStyles.nodes
|
|
493
|
-
]);
|
|
498
|
+
addBase(preflightStyles.nodes);
|
|
494
499
|
},
|
|
495
500
|
container: (()=>{
|
|
496
501
|
function extractMinWidths(breakpoints = []) {
|
|
@@ -1283,7 +1288,7 @@ let corePlugins = {
|
|
|
1283
1288
|
});
|
|
1284
1289
|
},
|
|
1285
1290
|
animation: ({ matchUtilities , theme , config })=>{
|
|
1286
|
-
let prefixName = (name)
|
|
1291
|
+
let prefixName = (name)=>(0, _escapeClassName.default)(config("prefix") + name);
|
|
1287
1292
|
var _theme;
|
|
1288
1293
|
let keyframes = Object.fromEntries(Object.entries((_theme = theme("keyframes")) !== null && _theme !== void 0 ? _theme : {}).map(([key, value])=>{
|
|
1289
1294
|
return [
|
|
@@ -1935,11 +1940,11 @@ let corePlugins = {
|
|
|
1935
1940
|
]
|
|
1936
1941
|
]
|
|
1937
1942
|
]),
|
|
1938
|
-
space: ({ matchUtilities , addUtilities , theme })=>{
|
|
1943
|
+
space: ({ matchUtilities , addUtilities , theme , config })=>{
|
|
1939
1944
|
matchUtilities({
|
|
1940
1945
|
"space-x": (value)=>{
|
|
1941
1946
|
value = value === "0" ? "0px" : value;
|
|
1942
|
-
if (
|
|
1947
|
+
if ((0, _featureFlags.flagEnabled)(config(), "logicalSiblingUtilities")) {
|
|
1943
1948
|
return {
|
|
1944
1949
|
"& > :not([hidden]) ~ :not([hidden])": {
|
|
1945
1950
|
"--tw-space-x-reverse": "0",
|
|
@@ -1979,11 +1984,11 @@ let corePlugins = {
|
|
|
1979
1984
|
}
|
|
1980
1985
|
});
|
|
1981
1986
|
},
|
|
1982
|
-
divideWidth: ({ matchUtilities , addUtilities , theme })=>{
|
|
1987
|
+
divideWidth: ({ matchUtilities , addUtilities , theme , config })=>{
|
|
1983
1988
|
matchUtilities({
|
|
1984
1989
|
"divide-x": (value)=>{
|
|
1985
1990
|
value = value === "0" ? "0px" : value;
|
|
1986
|
-
if (
|
|
1991
|
+
if ((0, _featureFlags.flagEnabled)(config(), "logicalSiblingUtilities")) {
|
|
1987
1992
|
return {
|
|
1988
1993
|
"& > :not([hidden]) ~ :not([hidden])": {
|
|
1989
1994
|
"@defaults border-width": {},
|
|
@@ -2293,6 +2298,19 @@ let corePlugins = {
|
|
|
2293
2298
|
}
|
|
2294
2299
|
});
|
|
2295
2300
|
},
|
|
2301
|
+
textWrap: ({ addUtilities })=>{
|
|
2302
|
+
addUtilities({
|
|
2303
|
+
".text-wrap": {
|
|
2304
|
+
"text-wrap": "wrap"
|
|
2305
|
+
},
|
|
2306
|
+
".text-nowrap": {
|
|
2307
|
+
"text-wrap": "nowrap"
|
|
2308
|
+
},
|
|
2309
|
+
".text-balance": {
|
|
2310
|
+
"text-wrap": "balance"
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
},
|
|
2296
2314
|
wordBreak: ({ addUtilities })=>{
|
|
2297
2315
|
addUtilities({
|
|
2298
2316
|
".break-normal": {
|
package/lib/css/preflight.css
CHANGED
|
@@ -163,6 +163,8 @@ optgroup,
|
|
|
163
163
|
select,
|
|
164
164
|
textarea {
|
|
165
165
|
font-family: inherit; /* 1 */
|
|
166
|
+
font-feature-settings: inherit; /* 1 */
|
|
167
|
+
font-variation-settings: inherit; /* 1 */
|
|
166
168
|
font-size: 100%; /* 1 */
|
|
167
169
|
font-weight: inherit; /* 1 */
|
|
168
170
|
line-height: inherit; /* 1 */
|
|
@@ -264,7 +266,7 @@ summary {
|
|
|
264
266
|
}
|
|
265
267
|
|
|
266
268
|
/*
|
|
267
|
-
Removes the default spacing
|
|
269
|
+
Removes the default spacing for appropriate elements.
|
|
268
270
|
*/
|
|
269
271
|
|
|
270
272
|
blockquote,
|
|
@@ -300,6 +302,10 @@ menu {
|
|
|
300
302
|
padding: 0;
|
|
301
303
|
}
|
|
302
304
|
|
|
305
|
+
dialog {
|
|
306
|
+
padding: 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
303
309
|
/*
|
|
304
310
|
Prevent resizing textareas horizontally by default.
|
|
305
311
|
*/
|
package/lib/featureFlags.js
CHANGED
|
@@ -9,6 +9,9 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
featureFlags: function() {
|
|
13
|
+
return featureFlags;
|
|
14
|
+
},
|
|
12
15
|
flagEnabled: function() {
|
|
13
16
|
return flagEnabled;
|
|
14
17
|
},
|
|
@@ -28,24 +31,22 @@ function _interop_require_default(obj) {
|
|
|
28
31
|
}
|
|
29
32
|
let defaults = {
|
|
30
33
|
optimizeUniversalDefaults: false,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
get relativeContentPathsByDefault () {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
34
|
+
disableColorOpacityUtilitiesByDefault: false,
|
|
35
|
+
relativeContentPathsByDefault: false,
|
|
36
|
+
oxideParser: true,
|
|
37
|
+
logicalSiblingUtilities: false
|
|
38
38
|
};
|
|
39
39
|
let featureFlags = {
|
|
40
40
|
future: [
|
|
41
41
|
"hoverOnlyWhenSupported",
|
|
42
42
|
"respectDefaultRingColorOpacity",
|
|
43
43
|
"disableColorOpacityUtilitiesByDefault",
|
|
44
|
-
"relativeContentPathsByDefault"
|
|
44
|
+
"relativeContentPathsByDefault",
|
|
45
|
+
"logicalSiblingUtilities"
|
|
45
46
|
],
|
|
46
47
|
experimental: [
|
|
47
48
|
"optimizeUniversalDefaults",
|
|
48
|
-
"
|
|
49
|
+
"oxideParser"
|
|
49
50
|
]
|
|
50
51
|
};
|
|
51
52
|
function flagEnabled(config, flag) {
|
package/lib/lib/content.js
CHANGED
|
@@ -24,13 +24,39 @@ const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
|
|
|
24
24
|
const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
|
|
25
25
|
const _parseGlob = require("../util/parseGlob");
|
|
26
26
|
const _sharedState = require("./sharedState");
|
|
27
|
+
const _oxide = require("@tailwindcss/oxide");
|
|
27
28
|
function _interop_require_default(obj) {
|
|
28
29
|
return obj && obj.__esModule ? obj : {
|
|
29
30
|
default: obj
|
|
30
31
|
};
|
|
31
32
|
}
|
|
33
|
+
/** @typedef {import('../../types/config.js').RawFile} RawFile */ /** @typedef {import('../../types/config.js').FilePath} FilePath */ /*
|
|
34
|
+
* @param {import('tailwindcss').Config} tailwindConfig
|
|
35
|
+
* @param {{skip:string[]}} options
|
|
36
|
+
* @returns {ContentPath[]}
|
|
37
|
+
*/ function resolveContentFiles(tailwindConfig, { skip =[] } = {}) {
|
|
38
|
+
if (Array.isArray(tailwindConfig.content.files) && tailwindConfig.content.files.includes("auto")) {
|
|
39
|
+
let idx = tailwindConfig.content.files.indexOf("auto");
|
|
40
|
+
if (idx !== -1) {
|
|
41
|
+
_sharedState.env.DEBUG && console.time("Calculating resolve content paths");
|
|
42
|
+
let resolved = (0, _oxide.resolveContentPaths)({
|
|
43
|
+
base: process.cwd()
|
|
44
|
+
});
|
|
45
|
+
_sharedState.env.DEBUG && console.timeEnd("Calculating resolve content paths");
|
|
46
|
+
tailwindConfig.content.files.splice(idx, 1, ...resolved);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (skip.length > 0) {
|
|
50
|
+
tailwindConfig.content.files = tailwindConfig.content.files.filter((filePath)=>!skip.includes(filePath));
|
|
51
|
+
}
|
|
52
|
+
return tailwindConfig.content.files;
|
|
53
|
+
}
|
|
32
54
|
function parseCandidateFiles(context, tailwindConfig) {
|
|
33
|
-
let files = tailwindConfig
|
|
55
|
+
let files = resolveContentFiles(tailwindConfig, {
|
|
56
|
+
skip: [
|
|
57
|
+
context.userConfigPath
|
|
58
|
+
]
|
|
59
|
+
});
|
|
34
60
|
// Normalize the file globs
|
|
35
61
|
files = files.filter((filePath)=>typeof filePath === "string");
|
|
36
62
|
files = files.map(_normalizepath.default);
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
|
|
12
12
|
const _didyoumean = /*#__PURE__*/ _interop_require_default(require("didyoumean"));
|
|
13
13
|
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
|
|
14
|
-
const
|
|
14
|
+
const _index = /*#__PURE__*/ _interop_require_default(require("../value-parser/index"));
|
|
15
15
|
const _normalizeScreens = require("../util/normalizeScreens");
|
|
16
16
|
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
|
|
17
17
|
const _toPath = require("../util/toPath");
|
|
@@ -121,7 +121,7 @@ function extractArgs(node, vNodes, functions) {
|
|
|
121
121
|
if (vNode.type === "div" && vNode.value === ",") {
|
|
122
122
|
args.push("");
|
|
123
123
|
} else {
|
|
124
|
-
args[args.length - 1] +=
|
|
124
|
+
args[args.length - 1] += _index.default.stringify(vNode);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
return args;
|
|
@@ -135,7 +135,9 @@ function resolveVNode(node, vNode, functions) {
|
|
|
135
135
|
return vNode;
|
|
136
136
|
}
|
|
137
137
|
function resolveFunctions(node, input, functions) {
|
|
138
|
-
|
|
138
|
+
let hasAnyFn = Object.keys(functions).some((fn)=>input.includes(`${fn}(`));
|
|
139
|
+
if (!hasAnyFn) return input;
|
|
140
|
+
return (0, _index.default)(input).walk((vNode)=>{
|
|
139
141
|
resolveVNode(node, vNode, functions);
|
|
140
142
|
}).toString();
|
|
141
143
|
}
|
|
@@ -10,11 +10,13 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
12
|
const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
|
|
13
|
+
const _oxide = require("@tailwindcss/oxide");
|
|
13
14
|
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
14
15
|
const _generateRules = require("./generateRules");
|
|
15
16
|
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
16
17
|
const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
|
|
17
18
|
const _defaultExtractor = require("./defaultExtractor");
|
|
19
|
+
const _featureFlags = require("../featureFlags");
|
|
18
20
|
function _interop_require_default(obj) {
|
|
19
21
|
return obj && obj.__esModule ? obj : {
|
|
20
22
|
default: obj
|
|
@@ -69,7 +71,12 @@ const builtInTransformers = {
|
|
|
69
71
|
};
|
|
70
72
|
function getExtractor(context, fileExtension) {
|
|
71
73
|
let extractors = context.tailwindConfig.content.extract;
|
|
72
|
-
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] ||
|
|
74
|
+
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || // Because we call `DEFAULT(context)`, the returning function is always a new function without a
|
|
75
|
+
// stable identity. Marking it with `DEFAULT_EXTRACTOR` allows us to check if it is the default
|
|
76
|
+
// extractor without relying on the function identity.
|
|
77
|
+
Object.assign(builtInExtractors.DEFAULT(context), {
|
|
78
|
+
DEFAULT_EXTRACTOR: true
|
|
79
|
+
});
|
|
73
80
|
}
|
|
74
81
|
function getTransformer(tailwindConfig, fileExtension) {
|
|
75
82
|
let transformers = tailwindConfig.content.transform;
|
|
@@ -154,16 +161,35 @@ function expandTailwindAtRules(context) {
|
|
|
154
161
|
]);
|
|
155
162
|
let seen = new Set();
|
|
156
163
|
env.DEBUG && console.time("Reading changed files");
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "oxideParser")) {
|
|
165
|
+
let rustParserContent = [];
|
|
166
|
+
let regexParserContent = [];
|
|
167
|
+
for (let item of context.changedContent){
|
|
168
|
+
let transformer = getTransformer(context.tailwindConfig, item.extension);
|
|
169
|
+
let extractor = getExtractor(context, item.extension);
|
|
170
|
+
if (transformer === builtInTransformers.DEFAULT && (extractor === null || extractor === void 0 ? void 0 : extractor.DEFAULT_EXTRACTOR) === true) {
|
|
171
|
+
rustParserContent.push(item);
|
|
172
|
+
} else {
|
|
173
|
+
regexParserContent.push([
|
|
174
|
+
item,
|
|
175
|
+
{
|
|
176
|
+
transformer,
|
|
177
|
+
extractor
|
|
178
|
+
}
|
|
179
|
+
]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (rustParserContent.length > 0) {
|
|
183
|
+
for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
|
|
184
|
+
candidates.add(candidate);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (regexParserContent.length > 0) {
|
|
188
|
+
for (let [{ file , content }, { transformer , extractor }] of regexParserContent){
|
|
189
|
+
content = file ? _fs.default.readFileSync(file, "utf8") : content;
|
|
190
|
+
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
191
|
+
}
|
|
161
192
|
}
|
|
162
|
-
// for (let { file, content, extension } of context.changedContent) {
|
|
163
|
-
// let transformer = getTransformer(context.tailwindConfig, extension)
|
|
164
|
-
// let extractor = getExtractor(context, extension)
|
|
165
|
-
// getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
|
|
166
|
-
// }
|
|
167
193
|
} else {
|
|
168
194
|
for (let { file , content , extension } of context.changedContent){
|
|
169
195
|
let transformer = getTransformer(context.tailwindConfig, extension);
|
|
@@ -178,7 +204,10 @@ function expandTailwindAtRules(context) {
|
|
|
178
204
|
let classCacheCount = context.classCache.size;
|
|
179
205
|
env.DEBUG && console.time("Generate rules");
|
|
180
206
|
env.DEBUG && console.time("Sorting candidates");
|
|
181
|
-
|
|
207
|
+
// TODO: only sort if we are not using the oxide parser (flagEnabled(context.tailwindConfig,
|
|
208
|
+
// 'oxideParser')) AND if we got all the candidates form the oxideParser alone. This will not
|
|
209
|
+
// be the case currently if you have custom transformers / extractors.
|
|
210
|
+
let sortedCandidates = new Set([
|
|
182
211
|
...candidates
|
|
183
212
|
].sort((a, z)=>{
|
|
184
213
|
if (a === z) return 0;
|
|
@@ -242,9 +271,20 @@ function expandTailwindAtRules(context) {
|
|
|
242
271
|
}));
|
|
243
272
|
layerNodes.variants.remove();
|
|
244
273
|
} else if (variantNodes.length > 0) {
|
|
245
|
-
|
|
274
|
+
let cloned = (0, _cloneNodes.default)(variantNodes, undefined, {
|
|
246
275
|
layer: "variants"
|
|
247
|
-
})
|
|
276
|
+
});
|
|
277
|
+
cloned.forEach((node)=>{
|
|
278
|
+
var _node_raws_tailwind;
|
|
279
|
+
var _node_raws_tailwind_parentLayer;
|
|
280
|
+
let parentLayer = (_node_raws_tailwind_parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) !== null && _node_raws_tailwind_parentLayer !== void 0 ? _node_raws_tailwind_parentLayer : null;
|
|
281
|
+
node.walk((n)=>{
|
|
282
|
+
if (!n.source) {
|
|
283
|
+
n.source = layerNodes[parentLayer].source;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
root.append(cloned);
|
|
248
288
|
}
|
|
249
289
|
// If we've got a utility layer and no utilities are generated there's likely something wrong
|
|
250
290
|
const hasUtilityVariants = variantNodes.some((node)=>{
|