tailwindcss 0.0.0-oxide.1 → 0.0.0-oxide.3
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/dist/{chunk-J6HTTNZH.mjs → chunk-YL27VW7G.mjs} +2587 -1738
- package/dist/cli.d.mts +1 -2
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +2239 -1396
- package/dist/cli.mjs +5 -11
- package/dist/lib.d.mts +102 -22
- package/dist/lib.d.ts +102 -22
- package/dist/lib.js +2174 -1257
- package/dist/lib.mjs +1 -1
- package/package.json +2 -3
- package/preflight.css +1 -3
- package/theme.css +0 -3
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
var parse = require('mri');
|
|
@@ -92,7 +93,7 @@ function convertNumber(value) {
|
|
|
92
93
|
}
|
|
93
94
|
{
|
|
94
95
|
let valueAsNumber = Number(value);
|
|
95
|
-
if (!isNaN(valueAsNumber)) {
|
|
96
|
+
if (!Number.isNaN(valueAsNumber)) {
|
|
96
97
|
return valueAsNumber;
|
|
97
98
|
}
|
|
98
99
|
}
|
|
@@ -102,75 +103,7 @@ function convertString(value) {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
// package.json
|
|
105
|
-
var version = "0.0.0-oxide.
|
|
106
|
-
var package_default = {
|
|
107
|
-
name: "tailwindcss",
|
|
108
|
-
version,
|
|
109
|
-
description: "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
110
|
-
license: "MIT",
|
|
111
|
-
repository: "https://github.com/tailwindlabs/tailwindcss.git",
|
|
112
|
-
bugs: "https://github.com/tailwindlabs/tailwindcss/issues",
|
|
113
|
-
homepage: "https://tailwindcss.com",
|
|
114
|
-
scripts: {
|
|
115
|
-
lint: "tsc --noEmit",
|
|
116
|
-
build: "tsup-node --env.NODE_ENV production",
|
|
117
|
-
dev: "tsup-node --env.NODE_ENV development --watch",
|
|
118
|
-
"test:ui": "playwright test"
|
|
119
|
-
},
|
|
120
|
-
bin: {
|
|
121
|
-
tailwindcss: "./dist/cli.js"
|
|
122
|
-
},
|
|
123
|
-
exports: {
|
|
124
|
-
".": {
|
|
125
|
-
style: "./index.css",
|
|
126
|
-
types: "./src/index.ts",
|
|
127
|
-
require: "./dist/lib.js",
|
|
128
|
-
import: "./src/index.ts"
|
|
129
|
-
},
|
|
130
|
-
"./package.json": "./package.json",
|
|
131
|
-
"./index.css": "./index.css",
|
|
132
|
-
"./preflight.css": "./preflight.css",
|
|
133
|
-
"./theme.css": "./theme.css",
|
|
134
|
-
"./utilities.css": "./utilities.css"
|
|
135
|
-
},
|
|
136
|
-
publishConfig: {
|
|
137
|
-
exports: {
|
|
138
|
-
".": {
|
|
139
|
-
types: "./dist/lib.d.mts",
|
|
140
|
-
style: "./index.css",
|
|
141
|
-
require: "./dist/lib.js",
|
|
142
|
-
import: "./dist/lib.mjs"
|
|
143
|
-
},
|
|
144
|
-
"./package.json": "./package.json",
|
|
145
|
-
"./index.css": "./index.css",
|
|
146
|
-
"./preflight.css": "./preflight.css",
|
|
147
|
-
"./theme.css": "./theme.css",
|
|
148
|
-
"./utilities.css": "./utilities.css"
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
style: "index.css",
|
|
152
|
-
files: [
|
|
153
|
-
"dist",
|
|
154
|
-
"index.css",
|
|
155
|
-
"preflight.css",
|
|
156
|
-
"theme.css",
|
|
157
|
-
"utilities.css"
|
|
158
|
-
],
|
|
159
|
-
dependencies: {
|
|
160
|
-
"@parcel/watcher": "^2.4.1",
|
|
161
|
-
lightningcss: "^1.24.0",
|
|
162
|
-
mri: "^1.2.0",
|
|
163
|
-
picocolors: "^1.0.0",
|
|
164
|
-
postcss: "8.4.24",
|
|
165
|
-
"postcss-import": "^16.0.0"
|
|
166
|
-
},
|
|
167
|
-
devDependencies: {
|
|
168
|
-
"@tailwindcss/oxide": "workspace:^",
|
|
169
|
-
"@types/node": "^20.10.8",
|
|
170
|
-
"@types/postcss-import": "^14.0.3",
|
|
171
|
-
"fast-glob": "^3.3.2"
|
|
172
|
-
}
|
|
173
|
-
};
|
|
106
|
+
var version = "0.0.0-oxide.3";
|
|
174
107
|
|
|
175
108
|
// src/ast.ts
|
|
176
109
|
function rule(selector, nodes) {
|
|
@@ -210,183 +143,33 @@ function walk(ast, visit) {
|
|
|
210
143
|
}
|
|
211
144
|
}
|
|
212
145
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
function
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
let current = "";
|
|
222
|
-
let closingBracketStack = "";
|
|
223
|
-
for (let i = 0; i < input.length; i++) {
|
|
224
|
-
let char = input[i];
|
|
225
|
-
if (char === "\\") {
|
|
226
|
-
current += input.slice(i, i + 2);
|
|
227
|
-
i += 1;
|
|
228
|
-
} else if (char === "/" && input[i + 1] === "*") {
|
|
229
|
-
let start = i;
|
|
230
|
-
for (let j = i + 2; j < input.length; j++) {
|
|
231
|
-
if (input[j] === "\\") {
|
|
232
|
-
j += 1;
|
|
233
|
-
} else if (input[j] === "*" && input[j + 1] === "/") {
|
|
234
|
-
i = j + 1;
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
let commentString = input.slice(start, i + 1);
|
|
239
|
-
if (commentString[2] === "!") {
|
|
240
|
-
licenseComments.push(comment(commentString.slice(2, -2)));
|
|
241
|
-
}
|
|
242
|
-
} else if (char === '"' || char === "'") {
|
|
243
|
-
let start = i;
|
|
244
|
-
for (let j = i + 1; j < input.length; j++) {
|
|
245
|
-
if (input[j] === "\\") {
|
|
246
|
-
j += 1;
|
|
247
|
-
} else if (input[j] === char) {
|
|
248
|
-
i = j;
|
|
249
|
-
break;
|
|
250
|
-
} else if (input[j] === ";" && input[j + 1] === "\n") {
|
|
251
|
-
throw new Error(`Unterminated string: ${input.slice(start, j + 1) + char}`);
|
|
252
|
-
} else if (input[j] === "\n") {
|
|
253
|
-
throw new Error(`Unterminated string: ${input.slice(start, j) + char}`);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
current += input.slice(start, i + 1);
|
|
257
|
-
} else if ((char === " " || char === "\n" || char === " ") && (input[i + 1] === " " || input[i + 1] === "\n" || input[i + 1] === " ")) {
|
|
258
|
-
continue;
|
|
259
|
-
} else if (char === "-" && input[i + 1] === "-" && current.length === 0) {
|
|
260
|
-
let closingBracketStack2 = "";
|
|
261
|
-
let start = i;
|
|
262
|
-
let colonIdx = -1;
|
|
263
|
-
for (let j = i + 2; j < input.length; j++) {
|
|
264
|
-
if (input[j] === "\\") {
|
|
265
|
-
j += 1;
|
|
266
|
-
} else if (input[j] === "/" && input[j + 1] === "*") {
|
|
267
|
-
for (let k = j + 2; k < input.length; k++) {
|
|
268
|
-
if (input[k] === "\\") {
|
|
269
|
-
k += 1;
|
|
270
|
-
} else if (input[k] === "*" && input[k + 1] === "/") {
|
|
271
|
-
j = k + 1;
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
} else if (colonIdx === -1 && input[j] === ":") {
|
|
276
|
-
colonIdx = current.length + j - start;
|
|
277
|
-
} else if (input[j] === ";" && closingBracketStack2.length === 0) {
|
|
278
|
-
current += input.slice(start, j);
|
|
279
|
-
i = j;
|
|
280
|
-
break;
|
|
281
|
-
} else if (input[j] === "(") {
|
|
282
|
-
closingBracketStack2 += ")";
|
|
283
|
-
} else if (input[j] === "[") {
|
|
284
|
-
closingBracketStack2 += "]";
|
|
285
|
-
} else if (input[j] === "{") {
|
|
286
|
-
closingBracketStack2 += "}";
|
|
287
|
-
} else if ((input[j] === "}" || input.length - 1 === j) && closingBracketStack2.length === 0) {
|
|
288
|
-
i = j - 1;
|
|
289
|
-
current += input.slice(start, j);
|
|
290
|
-
break;
|
|
291
|
-
} else if (input[j] === ")" || input[j] === "]" || input[j] === "}") {
|
|
292
|
-
if (closingBracketStack2.length > 0 && input[j] === closingBracketStack2[closingBracketStack2.length - 1]) {
|
|
293
|
-
closingBracketStack2 = closingBracketStack2.slice(0, -1);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
let declaration = parseDeclaration(current, colonIdx);
|
|
298
|
-
if (parent) {
|
|
299
|
-
parent.nodes.push(declaration);
|
|
300
|
-
} else {
|
|
301
|
-
ast.push(declaration);
|
|
302
|
-
}
|
|
303
|
-
current = "";
|
|
304
|
-
} else if (char === ";" && current[0] === "@") {
|
|
305
|
-
node = rule(current, []);
|
|
306
|
-
if (parent) {
|
|
307
|
-
parent.nodes.push(node);
|
|
308
|
-
} else {
|
|
309
|
-
ast.push(node);
|
|
310
|
-
}
|
|
311
|
-
current = "";
|
|
312
|
-
node = null;
|
|
313
|
-
} else if (char === ";") {
|
|
314
|
-
let declaration = parseDeclaration(current);
|
|
315
|
-
if (parent) {
|
|
316
|
-
parent.nodes.push(declaration);
|
|
317
|
-
} else {
|
|
318
|
-
ast.push(declaration);
|
|
319
|
-
}
|
|
320
|
-
current = "";
|
|
321
|
-
} else if (char === "{") {
|
|
322
|
-
closingBracketStack += "}";
|
|
323
|
-
node = rule(current.trim(), []);
|
|
324
|
-
if (parent) {
|
|
325
|
-
parent.nodes.push(node);
|
|
326
|
-
}
|
|
327
|
-
stack.push(parent);
|
|
328
|
-
parent = node;
|
|
329
|
-
current = "";
|
|
330
|
-
node = null;
|
|
331
|
-
} else if (char === "}") {
|
|
332
|
-
if (closingBracketStack === "") {
|
|
333
|
-
throw new Error(`Missing opening {`);
|
|
334
|
-
} else {
|
|
335
|
-
closingBracketStack = closingBracketStack.slice(0, -1);
|
|
336
|
-
}
|
|
337
|
-
if (current.length > 0) {
|
|
338
|
-
if (current[0] === "@") {
|
|
339
|
-
node = rule(current.trim(), []);
|
|
340
|
-
if (parent) {
|
|
341
|
-
parent.nodes.push(node);
|
|
342
|
-
} else {
|
|
343
|
-
ast.push(node);
|
|
344
|
-
}
|
|
345
|
-
current = "";
|
|
346
|
-
node = null;
|
|
347
|
-
} else {
|
|
348
|
-
let colonIdx = current.indexOf(":");
|
|
349
|
-
if (parent) {
|
|
350
|
-
let importantIdx = current.indexOf("!important", colonIdx + 1);
|
|
351
|
-
parent.nodes.push({
|
|
352
|
-
kind: "declaration",
|
|
353
|
-
property: current.slice(0, colonIdx).trim(),
|
|
354
|
-
value: current.slice(colonIdx + 1, importantIdx === -1 ? current.length : importantIdx).trim(),
|
|
355
|
-
important: importantIdx !== -1
|
|
356
|
-
});
|
|
357
|
-
}
|
|
146
|
+
function toCss(ast) {
|
|
147
|
+
let atRoots = [];
|
|
148
|
+
return ast.map(function stringify(node) {
|
|
149
|
+
let css2 = "";
|
|
150
|
+
if (node.kind === "rule") {
|
|
151
|
+
if (node.selector === "@at-root") {
|
|
152
|
+
for (let child of node.nodes) {
|
|
153
|
+
atRoots.push(stringify(child));
|
|
358
154
|
}
|
|
155
|
+
return css2;
|
|
359
156
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
ast.push(parent);
|
|
157
|
+
if (node.selector[0] === "@" && node.nodes.length === 0) {
|
|
158
|
+
return `${node.selector};`;
|
|
363
159
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
} else {
|
|
368
|
-
if (current.length === 0 && (char === " " || char === "\n" || char === " ")) {
|
|
369
|
-
continue;
|
|
160
|
+
css2 += `${node.selector}{`;
|
|
161
|
+
for (let child of node.nodes) {
|
|
162
|
+
css2 += stringify(child);
|
|
370
163
|
}
|
|
371
|
-
|
|
164
|
+
css2 += "}";
|
|
165
|
+
} else if (node.kind === "comment") {
|
|
166
|
+
css2 += `/*${node.value}*/
|
|
167
|
+
`;
|
|
168
|
+
} else if (node.property !== "--tw-sort" && node.value !== void 0 && node.value !== null) {
|
|
169
|
+
css2 += `${node.property}:${node.value}${node.important ? "!important" : ""};`;
|
|
372
170
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
throw new Error(`Missing closing } at ${parent.selector}`);
|
|
376
|
-
}
|
|
377
|
-
if (licenseComments.length > 0) {
|
|
378
|
-
return licenseComments.concat(ast);
|
|
379
|
-
}
|
|
380
|
-
return ast;
|
|
381
|
-
}
|
|
382
|
-
function parseDeclaration(current, colonIdx = current.indexOf(":")) {
|
|
383
|
-
let importantIdx = current.indexOf("!important", colonIdx + 1);
|
|
384
|
-
return {
|
|
385
|
-
kind: "declaration",
|
|
386
|
-
property: current.slice(0, colonIdx).trim(),
|
|
387
|
-
value: current.slice(colonIdx + 1, importantIdx === -1 ? current.length : importantIdx).trim(),
|
|
388
|
-
important: importantIdx !== -1
|
|
389
|
-
};
|
|
171
|
+
return css2;
|
|
172
|
+
}).concat(atRoots).join("\n");
|
|
390
173
|
}
|
|
391
174
|
|
|
392
175
|
// src/utils/math-operators.ts
|
|
@@ -545,52 +328,184 @@ function segment(input, separator) {
|
|
|
545
328
|
}
|
|
546
329
|
|
|
547
330
|
// src/candidate.ts
|
|
548
|
-
function
|
|
549
|
-
let
|
|
550
|
-
let
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
331
|
+
function parseCandidate(input, utilities, parsedVariants) {
|
|
332
|
+
let rawVariants = segment(input, ":");
|
|
333
|
+
let base = rawVariants.pop();
|
|
334
|
+
let parsedCandidateVariants = [];
|
|
335
|
+
for (let variant of rawVariants) {
|
|
336
|
+
let parsedVariant = parsedVariants.get(variant);
|
|
337
|
+
if (parsedVariant === null)
|
|
338
|
+
return null;
|
|
339
|
+
switch (variant) {
|
|
340
|
+
case "after":
|
|
341
|
+
case "backdrop":
|
|
342
|
+
case "before":
|
|
343
|
+
case "first-letter":
|
|
344
|
+
case "first-line":
|
|
345
|
+
case "marker":
|
|
346
|
+
case "placeholder":
|
|
347
|
+
case "selection":
|
|
348
|
+
parsedCandidateVariants.unshift(parsedVariant);
|
|
349
|
+
break;
|
|
350
|
+
default:
|
|
351
|
+
parsedCandidateVariants.push(parsedVariant);
|
|
568
352
|
}
|
|
569
353
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
354
|
+
let state = {
|
|
355
|
+
important: false,
|
|
356
|
+
negative: false
|
|
357
|
+
};
|
|
358
|
+
if (base[base.length - 1] === "!") {
|
|
359
|
+
state.important = true;
|
|
360
|
+
base = base.slice(0, -1);
|
|
361
|
+
}
|
|
362
|
+
if (base[0] === "[") {
|
|
363
|
+
let [baseWithoutModifier, modifierSegment2 = null] = segment(base, "/");
|
|
364
|
+
if (baseWithoutModifier[baseWithoutModifier.length - 1] !== "]")
|
|
575
365
|
return null;
|
|
576
|
-
let
|
|
577
|
-
if (
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
366
|
+
let charCode = baseWithoutModifier.charCodeAt(1);
|
|
367
|
+
if (charCode !== 45 && !(charCode >= 97 && charCode <= 122))
|
|
368
|
+
return null;
|
|
369
|
+
baseWithoutModifier = baseWithoutModifier.slice(1, -1);
|
|
370
|
+
let idx = baseWithoutModifier.indexOf(":");
|
|
371
|
+
if (idx === -1 || idx === 0 || idx === baseWithoutModifier.length - 1)
|
|
372
|
+
return null;
|
|
373
|
+
let property2 = baseWithoutModifier.slice(0, idx);
|
|
374
|
+
let value2 = decodeArbitraryValue(baseWithoutModifier.slice(idx + 1));
|
|
582
375
|
return {
|
|
583
376
|
kind: "arbitrary",
|
|
584
|
-
|
|
585
|
-
|
|
377
|
+
property: property2,
|
|
378
|
+
value: value2,
|
|
379
|
+
modifier: modifierSegment2 === null ? null : parseModifier(modifierSegment2),
|
|
380
|
+
variants: parsedCandidateVariants,
|
|
381
|
+
important: state.important
|
|
586
382
|
};
|
|
587
383
|
}
|
|
588
|
-
{
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
384
|
+
if (base[0] === "-") {
|
|
385
|
+
state.negative = true;
|
|
386
|
+
base = base.slice(1);
|
|
387
|
+
}
|
|
388
|
+
let [root, value] = findRoot(base, utilities);
|
|
389
|
+
let modifierSegment = null;
|
|
390
|
+
if (root === null && base.includes("/")) {
|
|
391
|
+
let [rootWithoutModifier, rootModifierSegment = null] = segment(base, "/");
|
|
392
|
+
modifierSegment = rootModifierSegment;
|
|
393
|
+
[root, value] = findRoot(rootWithoutModifier, utilities);
|
|
394
|
+
}
|
|
395
|
+
if (root === null)
|
|
396
|
+
return null;
|
|
397
|
+
let kind = utilities.kind(root);
|
|
398
|
+
if (kind === "static") {
|
|
399
|
+
if (value !== null)
|
|
400
|
+
return null;
|
|
401
|
+
return {
|
|
402
|
+
kind: "static",
|
|
403
|
+
root,
|
|
404
|
+
variants: parsedCandidateVariants,
|
|
405
|
+
negative: state.negative,
|
|
406
|
+
important: state.important
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
let candidate = {
|
|
410
|
+
kind: "functional",
|
|
411
|
+
root,
|
|
412
|
+
modifier: modifierSegment === null ? null : parseModifier(modifierSegment),
|
|
413
|
+
value: null,
|
|
414
|
+
variants: parsedCandidateVariants,
|
|
415
|
+
negative: state.negative,
|
|
416
|
+
important: state.important
|
|
417
|
+
};
|
|
418
|
+
if (value === null)
|
|
419
|
+
return candidate;
|
|
420
|
+
{
|
|
421
|
+
let [valueWithoutModifier, modifierSegment2 = null] = segment(value, "/");
|
|
422
|
+
if (modifierSegment2 !== null) {
|
|
423
|
+
candidate.modifier = parseModifier(modifierSegment2);
|
|
424
|
+
}
|
|
425
|
+
let startArbitraryIdx = valueWithoutModifier.indexOf("[");
|
|
426
|
+
let valueIsArbitrary = startArbitraryIdx !== -1;
|
|
427
|
+
if (valueIsArbitrary) {
|
|
428
|
+
let arbitraryValue = valueWithoutModifier.slice(startArbitraryIdx + 1, -1);
|
|
429
|
+
let typehint = "";
|
|
430
|
+
for (let i = 0; i < arbitraryValue.length; i++) {
|
|
431
|
+
let code = arbitraryValue.charCodeAt(i);
|
|
432
|
+
if (code === 58) {
|
|
433
|
+
typehint = arbitraryValue.slice(0, i);
|
|
434
|
+
arbitraryValue = arbitraryValue.slice(i + 1);
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
if (code === 45 || code >= 97 && code <= 122) {
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
let dashedIdent = null;
|
|
443
|
+
if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
|
|
444
|
+
dashedIdent = arbitraryValue;
|
|
445
|
+
arbitraryValue = `var(${arbitraryValue})`;
|
|
446
|
+
} else {
|
|
447
|
+
arbitraryValue = decodeArbitraryValue(arbitraryValue);
|
|
448
|
+
}
|
|
449
|
+
candidate.value = {
|
|
450
|
+
kind: "arbitrary",
|
|
451
|
+
dataType: typehint || null,
|
|
452
|
+
value: arbitraryValue,
|
|
453
|
+
dashedIdent
|
|
454
|
+
};
|
|
455
|
+
} else {
|
|
456
|
+
let fraction = modifierSegment2 === null || candidate.modifier?.kind === "arbitrary" ? null : value.slice(valueWithoutModifier.lastIndexOf("-") + 1);
|
|
457
|
+
candidate.value = {
|
|
458
|
+
kind: "named",
|
|
459
|
+
value: valueWithoutModifier,
|
|
460
|
+
fraction
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return candidate;
|
|
465
|
+
}
|
|
466
|
+
function parseModifier(modifier) {
|
|
467
|
+
if (modifier[0] === "[" && modifier[modifier.length - 1] === "]") {
|
|
468
|
+
let arbitraryValue = modifier.slice(1, -1);
|
|
469
|
+
let dashedIdent = null;
|
|
470
|
+
if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
|
|
471
|
+
dashedIdent = arbitraryValue;
|
|
472
|
+
arbitraryValue = `var(${arbitraryValue})`;
|
|
473
|
+
} else {
|
|
474
|
+
arbitraryValue = decodeArbitraryValue(arbitraryValue);
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
kind: "arbitrary",
|
|
478
|
+
value: arbitraryValue,
|
|
479
|
+
dashedIdent
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
return {
|
|
483
|
+
kind: "named",
|
|
484
|
+
value: modifier
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
function parseVariant(variant, variants, parsedVariants) {
|
|
488
|
+
if (variant[0] === "[" && variant[variant.length - 1] === "]") {
|
|
489
|
+
if (variant[1] === "@" && variant.includes("&"))
|
|
490
|
+
return null;
|
|
491
|
+
let selector = decodeArbitraryValue(variant.slice(1, -1));
|
|
492
|
+
if (selector[0] !== "@") {
|
|
493
|
+
if (!selector.includes("&")) {
|
|
494
|
+
selector = `&:is(${selector})`;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return {
|
|
498
|
+
kind: "arbitrary",
|
|
499
|
+
selector,
|
|
500
|
+
compounds: true
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
{
|
|
504
|
+
let [variantWithoutModifier, modifier = null, additionalModifier] = segment(variant, "/");
|
|
505
|
+
if (additionalModifier)
|
|
506
|
+
return null;
|
|
507
|
+
let [root, value] = findRoot(variantWithoutModifier, variants);
|
|
508
|
+
if (root === null)
|
|
594
509
|
return null;
|
|
595
510
|
switch (variants.kind(root)) {
|
|
596
511
|
case "static": {
|
|
@@ -609,20 +524,21 @@ function parseVariant(variant, variants, parsedVariants) {
|
|
|
609
524
|
return {
|
|
610
525
|
kind: "functional",
|
|
611
526
|
root,
|
|
527
|
+
modifier: modifier === null ? null : parseModifier(modifier),
|
|
612
528
|
value: {
|
|
613
529
|
kind: "arbitrary",
|
|
614
530
|
value: decodeArbitraryValue(value.slice(1, -1))
|
|
615
531
|
},
|
|
616
532
|
compounds: variants.compounds(root)
|
|
617
533
|
};
|
|
618
|
-
} else {
|
|
619
|
-
return {
|
|
620
|
-
kind: "functional",
|
|
621
|
-
root,
|
|
622
|
-
value: { kind: "named", value },
|
|
623
|
-
compounds: variants.compounds(root)
|
|
624
|
-
};
|
|
625
534
|
}
|
|
535
|
+
return {
|
|
536
|
+
kind: "functional",
|
|
537
|
+
root,
|
|
538
|
+
modifier: modifier === null ? null : parseModifier(modifier),
|
|
539
|
+
value: { kind: "named", value },
|
|
540
|
+
compounds: variants.compounds(root)
|
|
541
|
+
};
|
|
626
542
|
}
|
|
627
543
|
case "compound": {
|
|
628
544
|
if (value === null)
|
|
@@ -644,657 +560,136 @@ function parseVariant(variant, variants, parsedVariants) {
|
|
|
644
560
|
}
|
|
645
561
|
return null;
|
|
646
562
|
}
|
|
647
|
-
function
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
let
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
return null;
|
|
655
|
-
switch (variant) {
|
|
656
|
-
case "after":
|
|
657
|
-
case "backdrop":
|
|
658
|
-
case "before":
|
|
659
|
-
case "first-letter":
|
|
660
|
-
case "first-line":
|
|
661
|
-
case "marker":
|
|
662
|
-
case "placeholder":
|
|
663
|
-
case "selection":
|
|
664
|
-
parsedCandidateVariants.unshift(parsedVariant);
|
|
665
|
-
break;
|
|
666
|
-
default:
|
|
667
|
-
parsedCandidateVariants.push(parsedVariant);
|
|
563
|
+
function findRoot(input, lookup) {
|
|
564
|
+
if (lookup.has(input))
|
|
565
|
+
return [input, null];
|
|
566
|
+
let idx = input.lastIndexOf("-");
|
|
567
|
+
if (idx === -1) {
|
|
568
|
+
if (input[0] === "@" && lookup.has("@")) {
|
|
569
|
+
return ["@", input.slice(1)];
|
|
668
570
|
}
|
|
571
|
+
return [null, null];
|
|
669
572
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
return null;
|
|
686
|
-
let property2 = base.slice(0, idx);
|
|
687
|
-
let value2 = decodeArbitraryValue(base.slice(idx + 1));
|
|
688
|
-
return {
|
|
689
|
-
kind: "arbitrary",
|
|
690
|
-
property: property2,
|
|
691
|
-
value: value2,
|
|
692
|
-
variants: parsedCandidateVariants,
|
|
693
|
-
important: state.important
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
if (base[0] === "-") {
|
|
697
|
-
state.negative = true;
|
|
698
|
-
base = base.slice(1);
|
|
699
|
-
}
|
|
700
|
-
let [root, value] = findRoot(base, utilities);
|
|
701
|
-
if (root === null)
|
|
702
|
-
return null;
|
|
703
|
-
let kind = utilities.kind(root);
|
|
704
|
-
if (kind === "static") {
|
|
705
|
-
if (value !== null)
|
|
706
|
-
return null;
|
|
707
|
-
return {
|
|
708
|
-
kind: "static",
|
|
709
|
-
root,
|
|
710
|
-
variants: parsedCandidateVariants,
|
|
711
|
-
negative: state.negative,
|
|
712
|
-
important: state.important
|
|
713
|
-
};
|
|
573
|
+
do {
|
|
574
|
+
let maybeRoot = input.slice(0, idx);
|
|
575
|
+
if (lookup.has(maybeRoot)) {
|
|
576
|
+
return [maybeRoot, input.slice(idx + 1)];
|
|
577
|
+
}
|
|
578
|
+
idx = input.lastIndexOf("-", idx - 1);
|
|
579
|
+
} while (idx > 0);
|
|
580
|
+
return [null, null];
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// src/utils/default-map.ts
|
|
584
|
+
var DefaultMap = class extends Map {
|
|
585
|
+
constructor(factory) {
|
|
586
|
+
super();
|
|
587
|
+
this.factory = factory;
|
|
714
588
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
important: state.important
|
|
723
|
-
};
|
|
724
|
-
if (value === null) {
|
|
725
|
-
return candidate;
|
|
589
|
+
get(key) {
|
|
590
|
+
let value = super.get(key);
|
|
591
|
+
if (value === void 0) {
|
|
592
|
+
value = this.factory(key, this);
|
|
593
|
+
this.set(key, value);
|
|
594
|
+
}
|
|
595
|
+
return value;
|
|
726
596
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
// src/intellisense.ts
|
|
600
|
+
function getClassList(design) {
|
|
601
|
+
let list = [];
|
|
602
|
+
for (let [utility, fn] of design.utilities.entries()) {
|
|
603
|
+
if (typeof utility !== "string") {
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
if (fn.kind === "static") {
|
|
607
|
+
list.push([utility, { modifiers: [] }]);
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
let completions = design.utilities.getCompletions(utility);
|
|
611
|
+
for (let group of completions) {
|
|
612
|
+
for (let value of group.values) {
|
|
613
|
+
let name = value === null ? utility : `${utility}-${value}`;
|
|
614
|
+
list.push([name, { modifiers: group.modifiers }]);
|
|
615
|
+
if (group.supportsNegative) {
|
|
616
|
+
list.push([`-${name}`, { modifiers: group.modifiers }]);
|
|
617
|
+
}
|
|
740
618
|
}
|
|
741
|
-
candidate.modifier = {
|
|
742
|
-
kind: "arbitrary",
|
|
743
|
-
value: arbitraryValue,
|
|
744
|
-
dashedIdent
|
|
745
|
-
};
|
|
746
|
-
} else {
|
|
747
|
-
candidate.modifier = {
|
|
748
|
-
kind: "named",
|
|
749
|
-
value: modifierSegment
|
|
750
|
-
};
|
|
751
619
|
}
|
|
752
620
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
621
|
+
list.sort((a, b) => a[0].localeCompare(b[0]));
|
|
622
|
+
return list;
|
|
623
|
+
}
|
|
624
|
+
function getVariants(design) {
|
|
625
|
+
let list = [];
|
|
626
|
+
let parsedVariants = new DefaultMap(
|
|
627
|
+
(variant, map) => parseVariant(variant, design.variants, map)
|
|
628
|
+
);
|
|
629
|
+
for (let [root, variant] of design.variants.entries()) {
|
|
630
|
+
let selectors2 = function({ value, modifier } = {}) {
|
|
631
|
+
let name = root;
|
|
632
|
+
if (value)
|
|
633
|
+
name += `-${value}`;
|
|
634
|
+
if (modifier)
|
|
635
|
+
name += `/${modifier}`;
|
|
636
|
+
let variant2 = parsedVariants.get(name);
|
|
637
|
+
if (!variant2)
|
|
638
|
+
return [];
|
|
639
|
+
let node = rule(".__placeholder__", [decl("color", "red")]);
|
|
640
|
+
if (applyVariant(node, variant2, design.variants) === null) {
|
|
641
|
+
return [];
|
|
642
|
+
}
|
|
643
|
+
let selectors3 = [];
|
|
644
|
+
for (let child of node.nodes) {
|
|
645
|
+
if (child.kind === "rule") {
|
|
646
|
+
selectors3.push(child.selector);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
return selectors3;
|
|
650
|
+
};
|
|
651
|
+
if (variant.kind === "arbitrary")
|
|
652
|
+
continue;
|
|
653
|
+
let values = design.variants.getCompletions(root);
|
|
654
|
+
switch (variant.kind) {
|
|
655
|
+
case "static": {
|
|
656
|
+
list.push({
|
|
657
|
+
name: root,
|
|
658
|
+
values,
|
|
659
|
+
isArbitrary: false,
|
|
660
|
+
hasDash: true,
|
|
661
|
+
selectors: selectors2
|
|
662
|
+
});
|
|
761
663
|
break;
|
|
762
664
|
}
|
|
763
|
-
|
|
764
|
-
|
|
665
|
+
case "functional": {
|
|
666
|
+
list.push({
|
|
667
|
+
name: root,
|
|
668
|
+
values,
|
|
669
|
+
isArbitrary: true,
|
|
670
|
+
hasDash: true,
|
|
671
|
+
selectors: selectors2
|
|
672
|
+
});
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
case "compound": {
|
|
676
|
+
list.push({
|
|
677
|
+
name: root,
|
|
678
|
+
values,
|
|
679
|
+
isArbitrary: true,
|
|
680
|
+
hasDash: true,
|
|
681
|
+
selectors: selectors2
|
|
682
|
+
});
|
|
683
|
+
break;
|
|
765
684
|
}
|
|
766
|
-
break;
|
|
767
|
-
}
|
|
768
|
-
let dashedIdent = null;
|
|
769
|
-
if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
|
|
770
|
-
dashedIdent = arbitraryValue;
|
|
771
|
-
arbitraryValue = `var(${arbitraryValue})`;
|
|
772
|
-
} else {
|
|
773
|
-
arbitraryValue = decodeArbitraryValue(arbitraryValue);
|
|
774
685
|
}
|
|
775
|
-
candidate.value = {
|
|
776
|
-
kind: "arbitrary",
|
|
777
|
-
dataType: typehint || null,
|
|
778
|
-
value: arbitraryValue,
|
|
779
|
-
dashedIdent
|
|
780
|
-
};
|
|
781
|
-
} else {
|
|
782
|
-
let fraction = modifierSegment === null || modifierIsArbitrary ? null : value.slice(valueWithoutModifier.lastIndexOf("-") + 1);
|
|
783
|
-
candidate.value = {
|
|
784
|
-
kind: "named",
|
|
785
|
-
value: valueWithoutModifier,
|
|
786
|
-
fraction
|
|
787
|
-
};
|
|
788
686
|
}
|
|
789
|
-
return
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// src/property-order.ts
|
|
793
|
-
var property_order_default = [
|
|
794
|
-
"pointer-events",
|
|
795
|
-
"visibility",
|
|
796
|
-
"position",
|
|
797
|
-
// How do we make `inset-x-0` come before `top-0`?
|
|
798
|
-
"inset",
|
|
799
|
-
"inset-inline",
|
|
800
|
-
"inset-block",
|
|
801
|
-
"inset-inline-start",
|
|
802
|
-
"inset-inline-end",
|
|
803
|
-
"top",
|
|
804
|
-
"right",
|
|
805
|
-
"bottom",
|
|
806
|
-
"left",
|
|
807
|
-
"isolation",
|
|
808
|
-
"z-index",
|
|
809
|
-
"order",
|
|
810
|
-
"grid-column",
|
|
811
|
-
"grid-column-start",
|
|
812
|
-
"grid-column-end",
|
|
813
|
-
"grid-row",
|
|
814
|
-
"grid-row-start",
|
|
815
|
-
"grid-row-end",
|
|
816
|
-
"float",
|
|
817
|
-
"clear",
|
|
818
|
-
// How do we make `mx-0` come before `mt-0`?
|
|
819
|
-
// Idea: `margin-x` property that we compile away with a Visitor plugin?
|
|
820
|
-
"margin",
|
|
821
|
-
"margin-inline",
|
|
822
|
-
"margin-block",
|
|
823
|
-
"margin-inline-start",
|
|
824
|
-
"margin-inline-end",
|
|
825
|
-
"margin-top",
|
|
826
|
-
"margin-right",
|
|
827
|
-
"margin-bottom",
|
|
828
|
-
"margin-left",
|
|
829
|
-
"box-sizing",
|
|
830
|
-
"display",
|
|
831
|
-
"aspect-ratio",
|
|
832
|
-
"height",
|
|
833
|
-
"max-height",
|
|
834
|
-
"min-height",
|
|
835
|
-
"width",
|
|
836
|
-
"max-width",
|
|
837
|
-
"min-width",
|
|
838
|
-
"flex",
|
|
839
|
-
"flex-shrink",
|
|
840
|
-
"flex-grow",
|
|
841
|
-
"flex-basis",
|
|
842
|
-
"table-layout",
|
|
843
|
-
"caption-side",
|
|
844
|
-
"border-collapse",
|
|
845
|
-
// There's no `border-spacing-x` property, we use variables, how to sort?
|
|
846
|
-
"border-spacing",
|
|
847
|
-
// '--tw-border-spacing-x',
|
|
848
|
-
// '--tw-border-spacing-y',
|
|
849
|
-
"transform-origin",
|
|
850
|
-
// '--tw-translate-x',
|
|
851
|
-
// '--tw-translate-y',
|
|
852
|
-
"translate",
|
|
853
|
-
"rotate",
|
|
854
|
-
// '--tw-rotate',
|
|
855
|
-
"--tw-skew-x",
|
|
856
|
-
"--tw-skew-y",
|
|
857
|
-
"scale",
|
|
858
|
-
// '--tw-scale-x',
|
|
859
|
-
// '--tw-scale-y',
|
|
860
|
-
"transform",
|
|
861
|
-
"animation",
|
|
862
|
-
"cursor",
|
|
863
|
-
"touch-action",
|
|
864
|
-
"--tw-pan-x",
|
|
865
|
-
"--tw-pan-y",
|
|
866
|
-
"--tw-pinch-zoom",
|
|
867
|
-
"resize",
|
|
868
|
-
"scroll-snap-type",
|
|
869
|
-
"--tw-scroll-snap-strictness",
|
|
870
|
-
"scroll-snap-align",
|
|
871
|
-
"scroll-snap-stop",
|
|
872
|
-
"scroll-margin",
|
|
873
|
-
"scroll-margin-inline-start",
|
|
874
|
-
"scroll-margin-inline-end",
|
|
875
|
-
"scroll-margin-top",
|
|
876
|
-
"scroll-margin-right",
|
|
877
|
-
"scroll-margin-bottom",
|
|
878
|
-
"scroll-margin-left",
|
|
879
|
-
"scroll-padding",
|
|
880
|
-
"scroll-padding-inline-start",
|
|
881
|
-
"scroll-padding-inline-end",
|
|
882
|
-
"scroll-padding-top",
|
|
883
|
-
"scroll-padding-right",
|
|
884
|
-
"scroll-padding-bottom",
|
|
885
|
-
"scroll-padding-left",
|
|
886
|
-
"list-style-position",
|
|
887
|
-
"list-style-type",
|
|
888
|
-
"list-style-image",
|
|
889
|
-
"appearance",
|
|
890
|
-
"columns",
|
|
891
|
-
"break-before",
|
|
892
|
-
"break-inside",
|
|
893
|
-
"break-after",
|
|
894
|
-
"grid-auto-columns",
|
|
895
|
-
"grid-auto-flow",
|
|
896
|
-
"grid-auto-rows",
|
|
897
|
-
"grid-template-columns",
|
|
898
|
-
"grid-template-rows",
|
|
899
|
-
"flex-direction",
|
|
900
|
-
"flex-wrap",
|
|
901
|
-
"place-content",
|
|
902
|
-
"place-items",
|
|
903
|
-
"align-content",
|
|
904
|
-
"align-items",
|
|
905
|
-
"justify-content",
|
|
906
|
-
"justify-items",
|
|
907
|
-
"gap",
|
|
908
|
-
"column-gap",
|
|
909
|
-
"row-gap",
|
|
910
|
-
"--tw-space-x-reverse",
|
|
911
|
-
"--tw-space-y-reverse",
|
|
912
|
-
// Is there a more "real" property we could use for this?
|
|
913
|
-
"divide-x-width",
|
|
914
|
-
"divide-y-width",
|
|
915
|
-
"--tw-divide-y-reverse",
|
|
916
|
-
"divide-style",
|
|
917
|
-
"divide-color",
|
|
918
|
-
"--tw-divide-opacity",
|
|
919
|
-
"place-self",
|
|
920
|
-
"align-self",
|
|
921
|
-
"justify-self",
|
|
922
|
-
"overflow",
|
|
923
|
-
"overflow-x",
|
|
924
|
-
"overflow-y",
|
|
925
|
-
"overscroll-behavior",
|
|
926
|
-
"overscroll-behavior-x",
|
|
927
|
-
"overscroll-behavior-y",
|
|
928
|
-
"scroll-behavior",
|
|
929
|
-
"text-overflow",
|
|
930
|
-
"hyphens",
|
|
931
|
-
"white-space",
|
|
932
|
-
"text-wrap",
|
|
933
|
-
"overflow-wrap",
|
|
934
|
-
"work-break",
|
|
935
|
-
"border-radius",
|
|
936
|
-
"border-start-radius",
|
|
937
|
-
// Not real
|
|
938
|
-
"border-end-radius",
|
|
939
|
-
// Not real
|
|
940
|
-
"border-top-radius",
|
|
941
|
-
// Not real
|
|
942
|
-
"border-right-radius",
|
|
943
|
-
// Not real
|
|
944
|
-
"border-bottom-radius",
|
|
945
|
-
// Not real
|
|
946
|
-
"border-left-radius",
|
|
947
|
-
// Not real
|
|
948
|
-
"border-start-start-radius",
|
|
949
|
-
"border-start-end-radius",
|
|
950
|
-
"border-end-end-radius",
|
|
951
|
-
"border-end-start-radius",
|
|
952
|
-
"border-top-left-radius",
|
|
953
|
-
"border-top-right-radius",
|
|
954
|
-
"border-bottom-right-radius",
|
|
955
|
-
"border-bottom-left-radius",
|
|
956
|
-
"border-width",
|
|
957
|
-
"border-inline-width",
|
|
958
|
-
// Not real
|
|
959
|
-
"border-inline-start-width",
|
|
960
|
-
"border-inline-end-width",
|
|
961
|
-
"border-top-width",
|
|
962
|
-
"border-right-width",
|
|
963
|
-
"border-bottom-width",
|
|
964
|
-
"border-left-width",
|
|
965
|
-
"border-style",
|
|
966
|
-
"border-color",
|
|
967
|
-
"border-x-color",
|
|
968
|
-
// Not real
|
|
969
|
-
"border-y-color",
|
|
970
|
-
// Not real
|
|
971
|
-
"border-inline-start-color",
|
|
972
|
-
"border-inline-end-color",
|
|
973
|
-
"border-top-color",
|
|
974
|
-
"border-right-color",
|
|
975
|
-
"border-bottom-color",
|
|
976
|
-
"border-left-color",
|
|
977
|
-
"--tw-border-opacity",
|
|
978
|
-
"background-color",
|
|
979
|
-
"--tw-bg-opacity",
|
|
980
|
-
"background-image",
|
|
981
|
-
"--tw-gradient-stops",
|
|
982
|
-
"--tw-gradient-via-stops",
|
|
983
|
-
"--tw-gradient-from",
|
|
984
|
-
"--tw-gradient-from-position",
|
|
985
|
-
"--tw-gradient-via",
|
|
986
|
-
"--tw-gradient-via-position",
|
|
987
|
-
"--tw-gradient-to",
|
|
988
|
-
"--tw-gradient-to-position",
|
|
989
|
-
"box-decoration-break",
|
|
990
|
-
"background-size",
|
|
991
|
-
"background-attachment",
|
|
992
|
-
"background-clip",
|
|
993
|
-
"background-position",
|
|
994
|
-
"background-repeat",
|
|
995
|
-
"background-origin",
|
|
996
|
-
"fill",
|
|
997
|
-
"stroke",
|
|
998
|
-
"stroke-width",
|
|
999
|
-
"object-fit",
|
|
1000
|
-
"object-position",
|
|
1001
|
-
"padding",
|
|
1002
|
-
"padding-inline",
|
|
1003
|
-
"padding-block",
|
|
1004
|
-
"padding-inline-start",
|
|
1005
|
-
"padding-inline-end",
|
|
1006
|
-
"padding-top",
|
|
1007
|
-
"padding-right",
|
|
1008
|
-
"padding-bottom",
|
|
1009
|
-
"padding-left",
|
|
1010
|
-
"text-align",
|
|
1011
|
-
"text-indent",
|
|
1012
|
-
"vertical-align",
|
|
1013
|
-
"font-family",
|
|
1014
|
-
"font-size",
|
|
1015
|
-
"font-weight",
|
|
1016
|
-
"text-transform",
|
|
1017
|
-
"font-style",
|
|
1018
|
-
"font-variant-numeric",
|
|
1019
|
-
"line-height",
|
|
1020
|
-
"letter-spacing",
|
|
1021
|
-
"color",
|
|
1022
|
-
"--tw-text-opacity",
|
|
1023
|
-
"text-decoration-line",
|
|
1024
|
-
"text-decoration-color",
|
|
1025
|
-
"text-decoration-style",
|
|
1026
|
-
"text-decoration-thickness",
|
|
1027
|
-
"text-underline-offset",
|
|
1028
|
-
"-webkit-font-smoothing",
|
|
1029
|
-
"placeholder-color",
|
|
1030
|
-
// Not real
|
|
1031
|
-
"--tw-placeholder-opacity",
|
|
1032
|
-
"caret-color",
|
|
1033
|
-
"accent-color",
|
|
1034
|
-
"opacity",
|
|
1035
|
-
"background-blend-mode",
|
|
1036
|
-
"mix-blend-mode",
|
|
1037
|
-
"box-shadow",
|
|
1038
|
-
"--tw-shadow",
|
|
1039
|
-
"--tw-shadow-color",
|
|
1040
|
-
"--tw-ring-shadow",
|
|
1041
|
-
"--tw-ring-color",
|
|
1042
|
-
"--tw-inset-shadow",
|
|
1043
|
-
"--tw-inset-shadow-color",
|
|
1044
|
-
"--tw-inset-ring-shadow",
|
|
1045
|
-
"--tw-inset-ring-color",
|
|
1046
|
-
"--tw-ring-opacity",
|
|
1047
|
-
"--tw-ring-offset-width",
|
|
1048
|
-
"--tw-ring-offset-color",
|
|
1049
|
-
"outline",
|
|
1050
|
-
"outline-width",
|
|
1051
|
-
"outline-offset",
|
|
1052
|
-
"outline-color",
|
|
1053
|
-
"--tw-blur",
|
|
1054
|
-
"--tw-brightness",
|
|
1055
|
-
"--tw-contast",
|
|
1056
|
-
"--tw-drop-shadow",
|
|
1057
|
-
"--tw-grayscale",
|
|
1058
|
-
"--tw-hue-rotate",
|
|
1059
|
-
"--tw-invert",
|
|
1060
|
-
"--tw-saturate",
|
|
1061
|
-
"--tw-sepia",
|
|
1062
|
-
"filter",
|
|
1063
|
-
"--tw-backdrop-blur",
|
|
1064
|
-
"--tw-backdrop-brightness",
|
|
1065
|
-
"--tw-backdrop-contast",
|
|
1066
|
-
"--tw-backdrop-grayscale",
|
|
1067
|
-
"--tw-backdrop-hue-rotate",
|
|
1068
|
-
"--tw-backdrop-invert",
|
|
1069
|
-
"--tw-backdrop-opacity",
|
|
1070
|
-
"--tw-backdrop-saturate",
|
|
1071
|
-
"--tw-backdrop-sepia",
|
|
1072
|
-
"backdrop-filter",
|
|
1073
|
-
"transition-property",
|
|
1074
|
-
"transition-delay",
|
|
1075
|
-
"transition-duration",
|
|
1076
|
-
"transition-timing-function",
|
|
1077
|
-
"will-change",
|
|
1078
|
-
"contain",
|
|
1079
|
-
"content",
|
|
1080
|
-
"forced-color-adjust"
|
|
1081
|
-
];
|
|
1082
|
-
|
|
1083
|
-
// src/utils/default-map.ts
|
|
1084
|
-
var DefaultMap = class extends Map {
|
|
1085
|
-
constructor(factory) {
|
|
1086
|
-
super();
|
|
1087
|
-
this.factory = factory;
|
|
1088
|
-
}
|
|
1089
|
-
get(key) {
|
|
1090
|
-
let value = super.get(key);
|
|
1091
|
-
if (value === void 0) {
|
|
1092
|
-
value = this.factory(key, this);
|
|
1093
|
-
this.set(key, value);
|
|
1094
|
-
}
|
|
1095
|
-
return value;
|
|
1096
|
-
}
|
|
1097
|
-
};
|
|
1098
|
-
|
|
1099
|
-
// src/utils/escape.ts
|
|
1100
|
-
function escape(value) {
|
|
1101
|
-
if (arguments.length == 0) {
|
|
1102
|
-
throw new TypeError("`CSS.escape` requires an argument.");
|
|
1103
|
-
}
|
|
1104
|
-
var string = String(value);
|
|
1105
|
-
var length = string.length;
|
|
1106
|
-
var index = -1;
|
|
1107
|
-
var codeUnit;
|
|
1108
|
-
var result = "";
|
|
1109
|
-
var firstCodeUnit = string.charCodeAt(0);
|
|
1110
|
-
if (
|
|
1111
|
-
// If the character is the first character and is a `-` (U+002D), and
|
|
1112
|
-
// there is no second character, […]
|
|
1113
|
-
length == 1 && firstCodeUnit == 45
|
|
1114
|
-
) {
|
|
1115
|
-
return "\\" + string;
|
|
1116
|
-
}
|
|
1117
|
-
while (++index < length) {
|
|
1118
|
-
codeUnit = string.charCodeAt(index);
|
|
1119
|
-
if (codeUnit == 0) {
|
|
1120
|
-
result += "\uFFFD";
|
|
1121
|
-
continue;
|
|
1122
|
-
}
|
|
1123
|
-
if (
|
|
1124
|
-
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
|
|
1125
|
-
// U+007F, […]
|
|
1126
|
-
codeUnit >= 1 && codeUnit <= 31 || codeUnit == 127 || // If the character is the first character and is in the range [0-9]
|
|
1127
|
-
// (U+0030 to U+0039), […]
|
|
1128
|
-
index == 0 && codeUnit >= 48 && codeUnit <= 57 || // If the character is the second character and is in the range [0-9]
|
|
1129
|
-
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
|
|
1130
|
-
index == 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit == 45
|
|
1131
|
-
) {
|
|
1132
|
-
result += "\\" + codeUnit.toString(16) + " ";
|
|
1133
|
-
continue;
|
|
1134
|
-
}
|
|
1135
|
-
if (codeUnit >= 128 || codeUnit == 45 || codeUnit == 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) {
|
|
1136
|
-
result += string.charAt(index);
|
|
1137
|
-
continue;
|
|
1138
|
-
}
|
|
1139
|
-
result += "\\" + string.charAt(index);
|
|
1140
|
-
}
|
|
1141
|
-
return result;
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
// src/parse.ts
|
|
1145
|
-
function applyImportant(ast) {
|
|
1146
|
-
for (let node of ast) {
|
|
1147
|
-
if (node.kind === "rule" && node.selector === "@at-root") {
|
|
1148
|
-
continue;
|
|
1149
|
-
}
|
|
1150
|
-
if (node.kind === "declaration") {
|
|
1151
|
-
node.important = true;
|
|
1152
|
-
} else if (node.kind === "rule") {
|
|
1153
|
-
applyImportant(node.nodes);
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
function applyVariant(node, variant, variants) {
|
|
1158
|
-
if (variant.kind === "arbitrary") {
|
|
1159
|
-
node.nodes = [rule(variant.selector, node.nodes)];
|
|
1160
|
-
return;
|
|
1161
|
-
}
|
|
1162
|
-
let applyVariantFn = variants.get(variant.root);
|
|
1163
|
-
if (variant.kind === "compound") {
|
|
1164
|
-
let result2 = applyVariant(node, variant.variant, variants);
|
|
1165
|
-
if (result2 === null)
|
|
1166
|
-
return null;
|
|
1167
|
-
for (let child of node.nodes) {
|
|
1168
|
-
let result3 = applyVariantFn(child, variant);
|
|
1169
|
-
if (result3 === null)
|
|
1170
|
-
return null;
|
|
1171
|
-
}
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
let result = applyVariantFn(node, variant);
|
|
1175
|
-
if (result === null)
|
|
1176
|
-
return null;
|
|
1177
|
-
}
|
|
1178
|
-
function parse3(rawCandidates, designSystem, { throwOnInvalidCandidate = false } = {}) {
|
|
1179
|
-
rawCandidates.sort();
|
|
1180
|
-
let nodeSorting = /* @__PURE__ */ new Map();
|
|
1181
|
-
let astNodes = [];
|
|
1182
|
-
let parsedVariants = new DefaultMap((variant, map) => {
|
|
1183
|
-
return parseVariant(variant, designSystem.variants, map);
|
|
1184
|
-
});
|
|
1185
|
-
let candidates = /* @__PURE__ */ new Map();
|
|
1186
|
-
next:
|
|
1187
|
-
for (let rawCandidate of rawCandidates) {
|
|
1188
|
-
let candidate = parseCandidate(rawCandidate, designSystem.utilities, parsedVariants);
|
|
1189
|
-
if (candidate === null) {
|
|
1190
|
-
if (throwOnInvalidCandidate) {
|
|
1191
|
-
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
1192
|
-
} else {
|
|
1193
|
-
continue next;
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
candidates.set(candidate, rawCandidate);
|
|
1197
|
-
}
|
|
1198
|
-
let variants = Array.from(parsedVariants.values()).sort((a, z) => {
|
|
1199
|
-
return designSystem.variants.compare(a, z);
|
|
1200
|
-
});
|
|
1201
|
-
next:
|
|
1202
|
-
for (let [candidate, rawCandidate] of candidates) {
|
|
1203
|
-
let ruleNodes = [];
|
|
1204
|
-
if (candidate.kind === "arbitrary") {
|
|
1205
|
-
ruleNodes = [decl(candidate.property, candidate.value)];
|
|
1206
|
-
} else if (candidate.kind === "static" || candidate.kind === "functional") {
|
|
1207
|
-
let { matchFn } = designSystem.utilities.get(candidate.root);
|
|
1208
|
-
let matchNodes = matchFn(candidate);
|
|
1209
|
-
if (matchNodes === void 0) {
|
|
1210
|
-
if (throwOnInvalidCandidate) {
|
|
1211
|
-
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
1212
|
-
} else {
|
|
1213
|
-
continue next;
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
ruleNodes = matchNodes;
|
|
1217
|
-
}
|
|
1218
|
-
let propertySort = getPropertySort(ruleNodes);
|
|
1219
|
-
if (candidate.important) {
|
|
1220
|
-
applyImportant(ruleNodes);
|
|
1221
|
-
}
|
|
1222
|
-
let node = {
|
|
1223
|
-
kind: "rule",
|
|
1224
|
-
selector: `.${escape(rawCandidate)}`,
|
|
1225
|
-
nodes: ruleNodes
|
|
1226
|
-
};
|
|
1227
|
-
let variantOrder = 0n;
|
|
1228
|
-
for (let variant of candidate.variants) {
|
|
1229
|
-
let result = applyVariant(node, variant, designSystem.variants);
|
|
1230
|
-
if (result === null) {
|
|
1231
|
-
if (throwOnInvalidCandidate) {
|
|
1232
|
-
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
1233
|
-
} else {
|
|
1234
|
-
continue next;
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
variantOrder |= 1n << BigInt(variants.indexOf(variant));
|
|
1238
|
-
}
|
|
1239
|
-
nodeSorting.set(node, {
|
|
1240
|
-
properties: propertySort,
|
|
1241
|
-
variants: variantOrder,
|
|
1242
|
-
candidate: rawCandidate
|
|
1243
|
-
});
|
|
1244
|
-
astNodes.push(node);
|
|
1245
|
-
}
|
|
1246
|
-
astNodes.sort((a, z) => {
|
|
1247
|
-
let aSorting = nodeSorting.get(a);
|
|
1248
|
-
let zSorting = nodeSorting.get(z);
|
|
1249
|
-
if (aSorting.variants - zSorting.variants !== 0n) {
|
|
1250
|
-
return Number(aSorting.variants - zSorting.variants);
|
|
1251
|
-
}
|
|
1252
|
-
let offset = 0;
|
|
1253
|
-
while (aSorting.properties.length < offset && zSorting.properties.length < offset && aSorting.properties[offset] === zSorting.properties[offset]) {
|
|
1254
|
-
offset += 1;
|
|
1255
|
-
}
|
|
1256
|
-
return (
|
|
1257
|
-
// Sort by lowest property index first
|
|
1258
|
-
(aSorting.properties[offset] ?? Infinity) - (zSorting.properties[offset] ?? Infinity) || // Sort by most properties first, then by least properties
|
|
1259
|
-
zSorting.properties.length - aSorting.properties.length
|
|
1260
|
-
);
|
|
1261
|
-
});
|
|
1262
|
-
return {
|
|
1263
|
-
astNodes,
|
|
1264
|
-
nodeSorting
|
|
1265
|
-
};
|
|
1266
|
-
}
|
|
1267
|
-
function getPropertySort(nodes) {
|
|
1268
|
-
let propertySort = /* @__PURE__ */ new Set();
|
|
1269
|
-
let q = nodes.slice();
|
|
1270
|
-
next:
|
|
1271
|
-
while (q.length > 0) {
|
|
1272
|
-
let node = q.shift();
|
|
1273
|
-
if (node.kind === "declaration") {
|
|
1274
|
-
if (node.property === "--tw-sort") {
|
|
1275
|
-
let idx2 = property_order_default.indexOf(node.value);
|
|
1276
|
-
if (idx2 !== -1) {
|
|
1277
|
-
propertySort.add(idx2);
|
|
1278
|
-
break next;
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
let idx = property_order_default.indexOf(node.property);
|
|
1282
|
-
if (idx !== -1)
|
|
1283
|
-
propertySort.add(idx);
|
|
1284
|
-
} else if (node.kind === "rule") {
|
|
1285
|
-
if (node.selector === "@at-root")
|
|
1286
|
-
continue;
|
|
1287
|
-
for (let child of node.nodes) {
|
|
1288
|
-
q.push(child);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
return Array.from(propertySort).sort((a, z) => a - z);
|
|
687
|
+
return list;
|
|
1293
688
|
}
|
|
1294
689
|
|
|
1295
690
|
// src/sort.ts
|
|
1296
691
|
function getClassOrder(design, classes) {
|
|
1297
|
-
let { astNodes, nodeSorting } =
|
|
692
|
+
let { astNodes, nodeSorting } = compileCandidates(Array.from(classes), design, {
|
|
1298
693
|
throwOnInvalidCandidate: false
|
|
1299
694
|
});
|
|
1300
695
|
let sorted = new Map(classes.map((className) => [className, null]));
|
|
@@ -1699,13 +1094,18 @@ function replaceShadowColors(input, replacement) {
|
|
|
1699
1094
|
}
|
|
1700
1095
|
|
|
1701
1096
|
// src/utilities.ts
|
|
1097
|
+
var ARBITRARY_VARIANT = Symbol("ARBITRARY_VARIANT");
|
|
1702
1098
|
var Utilities = class {
|
|
1703
1099
|
utilities = /* @__PURE__ */ new Map();
|
|
1704
|
-
|
|
1705
|
-
|
|
1100
|
+
completions = /* @__PURE__ */ new Map();
|
|
1101
|
+
static(name, compileFn) {
|
|
1102
|
+
this.set(name, { kind: "static", compileFn });
|
|
1103
|
+
}
|
|
1104
|
+
functional(name, compileFn) {
|
|
1105
|
+
this.set(name, { kind: "functional", compileFn });
|
|
1706
1106
|
}
|
|
1707
|
-
|
|
1708
|
-
this.set(
|
|
1107
|
+
arbitrary(compileFn) {
|
|
1108
|
+
this.set(ARBITRARY_VARIANT, { kind: "arbitrary", compileFn });
|
|
1709
1109
|
}
|
|
1710
1110
|
has(name) {
|
|
1711
1111
|
return this.utilities.has(name);
|
|
@@ -1716,13 +1116,25 @@ var Utilities = class {
|
|
|
1716
1116
|
kind(name) {
|
|
1717
1117
|
return this.utilities.get(name).kind;
|
|
1718
1118
|
}
|
|
1119
|
+
getCompletions(name) {
|
|
1120
|
+
return this.completions.get(name)?.() ?? [];
|
|
1121
|
+
}
|
|
1122
|
+
suggest(name, groups) {
|
|
1123
|
+
this.completions.set(name, groups);
|
|
1124
|
+
}
|
|
1719
1125
|
keys() {
|
|
1720
1126
|
return this.utilities.keys();
|
|
1721
1127
|
}
|
|
1722
|
-
|
|
1128
|
+
entries() {
|
|
1129
|
+
return this.utilities.entries();
|
|
1130
|
+
}
|
|
1131
|
+
getArbitrary() {
|
|
1132
|
+
return this.get(ARBITRARY_VARIANT).compileFn;
|
|
1133
|
+
}
|
|
1134
|
+
set(name, { kind, compileFn }) {
|
|
1723
1135
|
this.utilities.set(name, {
|
|
1724
1136
|
kind,
|
|
1725
|
-
|
|
1137
|
+
compileFn
|
|
1726
1138
|
});
|
|
1727
1139
|
}
|
|
1728
1140
|
};
|
|
@@ -1742,19 +1154,17 @@ function property(ident, initialValue, syntax) {
|
|
|
1742
1154
|
]);
|
|
1743
1155
|
}
|
|
1744
1156
|
function withAlpha(value, alpha) {
|
|
1745
|
-
if (alpha === null)
|
|
1157
|
+
if (alpha === null)
|
|
1746
1158
|
return value;
|
|
1747
|
-
}
|
|
1748
1159
|
let alphaAsNumber = Number(alpha);
|
|
1749
|
-
if (!isNaN(alphaAsNumber)) {
|
|
1160
|
+
if (!Number.isNaN(alphaAsNumber)) {
|
|
1750
1161
|
alpha = `${alphaAsNumber * 100}%`;
|
|
1751
1162
|
}
|
|
1752
1163
|
return `color-mix(in srgb, ${value} ${alpha}, transparent)`;
|
|
1753
1164
|
}
|
|
1754
1165
|
function asColor(value, modifier, theme) {
|
|
1755
|
-
if (!modifier)
|
|
1166
|
+
if (!modifier)
|
|
1756
1167
|
return value;
|
|
1757
|
-
}
|
|
1758
1168
|
if (modifier.kind === "arbitrary") {
|
|
1759
1169
|
return withAlpha(value, modifier.value);
|
|
1760
1170
|
}
|
|
@@ -1762,6 +1172,9 @@ function asColor(value, modifier, theme) {
|
|
|
1762
1172
|
if (alpha) {
|
|
1763
1173
|
return withAlpha(value, alpha);
|
|
1764
1174
|
}
|
|
1175
|
+
if (Number.isNaN(Number(modifier.value))) {
|
|
1176
|
+
return null;
|
|
1177
|
+
}
|
|
1765
1178
|
return withAlpha(value, `${modifier.value}%`);
|
|
1766
1179
|
}
|
|
1767
1180
|
function withNegative(value, candidate) {
|
|
@@ -1787,11 +1200,45 @@ function resolveThemeColor(candidate, theme, themeKeys) {
|
|
|
1787
1200
|
}
|
|
1788
1201
|
function createUtilities(theme) {
|
|
1789
1202
|
let utilities = new Utilities();
|
|
1203
|
+
utilities.arbitrary((candidate) => {
|
|
1204
|
+
let value = candidate.value;
|
|
1205
|
+
if (candidate.modifier) {
|
|
1206
|
+
value = asColor(value, candidate.modifier, theme);
|
|
1207
|
+
}
|
|
1208
|
+
if (value === null)
|
|
1209
|
+
return;
|
|
1210
|
+
return [decl(candidate.property, value)];
|
|
1211
|
+
});
|
|
1212
|
+
function suggest(classRoot, defns) {
|
|
1213
|
+
function* resolve2(themeKeys) {
|
|
1214
|
+
for (let value of theme.keysInNamespaces(themeKeys)) {
|
|
1215
|
+
yield value.replaceAll("_", ".");
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
utilities.suggest(classRoot, () => {
|
|
1219
|
+
let groups = [];
|
|
1220
|
+
for (let defn of defns()) {
|
|
1221
|
+
if (typeof defn === "string") {
|
|
1222
|
+
groups.push({ values: [defn], modifiers: [] });
|
|
1223
|
+
continue;
|
|
1224
|
+
}
|
|
1225
|
+
let values = [
|
|
1226
|
+
...defn.values ?? [],
|
|
1227
|
+
...resolve2(defn.valueThemeKeys ?? [])
|
|
1228
|
+
];
|
|
1229
|
+
let modifiers = [...defn.modifiers ?? [], ...resolve2(defn.modifierThemeKeys ?? [])];
|
|
1230
|
+
if (defn.hasDefaultValue) {
|
|
1231
|
+
values.unshift(null);
|
|
1232
|
+
}
|
|
1233
|
+
groups.push({ supportsNegative: defn.supportsNegative, values, modifiers });
|
|
1234
|
+
}
|
|
1235
|
+
return groups;
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1790
1238
|
function staticUtility(className, declarations) {
|
|
1791
1239
|
utilities.static(className, (candidate) => {
|
|
1792
|
-
if (candidate.negative)
|
|
1240
|
+
if (candidate.negative)
|
|
1793
1241
|
return;
|
|
1794
|
-
}
|
|
1795
1242
|
return declarations.map((node) => {
|
|
1796
1243
|
return typeof node === "function" ? node() : decl(node[0], node[1]);
|
|
1797
1244
|
});
|
|
@@ -1808,17 +1255,24 @@ function createUtilities(theme) {
|
|
|
1808
1255
|
value = candidate.value.value;
|
|
1809
1256
|
} else {
|
|
1810
1257
|
value = theme.resolve(candidate.value.fraction ?? candidate.value.value, desc.themeKeys);
|
|
1811
|
-
if (
|
|
1258
|
+
if (value === null && desc.supportsFractions && candidate.value.fraction) {
|
|
1812
1259
|
value = `calc(${candidate.value.fraction} * 100%)`;
|
|
1813
1260
|
}
|
|
1814
|
-
if (
|
|
1261
|
+
if (value === null && desc.handleBareValue) {
|
|
1815
1262
|
value = desc.handleBareValue(candidate.value);
|
|
1816
1263
|
}
|
|
1817
1264
|
}
|
|
1818
|
-
if (
|
|
1265
|
+
if (value === null)
|
|
1819
1266
|
return;
|
|
1820
1267
|
return desc.handle(withNegative(value, candidate));
|
|
1821
1268
|
});
|
|
1269
|
+
suggest(classRoot, () => [
|
|
1270
|
+
{
|
|
1271
|
+
supportsNegative: desc.supportsNegative,
|
|
1272
|
+
valueThemeKeys: desc.themeKeys,
|
|
1273
|
+
hasDefaultValue: desc.defaultValue !== void 0 && desc.defaultValue !== null
|
|
1274
|
+
}
|
|
1275
|
+
]);
|
|
1822
1276
|
}
|
|
1823
1277
|
function colorUtility(classRoot, desc) {
|
|
1824
1278
|
utilities.functional(classRoot, (candidate) => {
|
|
@@ -1832,11 +1286,19 @@ function createUtilities(theme) {
|
|
|
1832
1286
|
value = asColor(value, candidate.modifier, theme);
|
|
1833
1287
|
} else {
|
|
1834
1288
|
value = resolveThemeColor(candidate, theme, desc.themeKeys);
|
|
1835
|
-
if (!value)
|
|
1836
|
-
return;
|
|
1837
1289
|
}
|
|
1290
|
+
if (value === null)
|
|
1291
|
+
return;
|
|
1838
1292
|
return desc.handle(value);
|
|
1839
1293
|
});
|
|
1294
|
+
suggest(classRoot, () => [
|
|
1295
|
+
{
|
|
1296
|
+
values: ["current", "transparent"],
|
|
1297
|
+
valueThemeKeys: desc.themeKeys,
|
|
1298
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
1299
|
+
modifierThemeKeys: ["--opacity"]
|
|
1300
|
+
}
|
|
1301
|
+
]);
|
|
1840
1302
|
}
|
|
1841
1303
|
staticUtility("sr-only", [
|
|
1842
1304
|
["position", "absolute"],
|
|
@@ -1993,6 +1455,13 @@ function createUtilities(theme) {
|
|
|
1993
1455
|
themeKeys: ["--z-index"],
|
|
1994
1456
|
handle: (value) => [decl("z-index", value)]
|
|
1995
1457
|
});
|
|
1458
|
+
suggest("z", () => [
|
|
1459
|
+
{
|
|
1460
|
+
supportsNegative: true,
|
|
1461
|
+
values: ["0", "10", "20", "30", "40", "50"],
|
|
1462
|
+
valueThemeKeys: ["--z-index"]
|
|
1463
|
+
}
|
|
1464
|
+
]);
|
|
1996
1465
|
staticUtility("order-first", [["order", "calc(-infinity)"]]);
|
|
1997
1466
|
staticUtility("order-last", [["order", "calc(infinity)"]]);
|
|
1998
1467
|
staticUtility("order-none", [["order", "0"]]);
|
|
@@ -2002,6 +1471,13 @@ function createUtilities(theme) {
|
|
|
2002
1471
|
themeKeys: ["--order"],
|
|
2003
1472
|
handle: (value) => [decl("order", value)]
|
|
2004
1473
|
});
|
|
1474
|
+
suggest("order", () => [
|
|
1475
|
+
{
|
|
1476
|
+
supportsNegative: true,
|
|
1477
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
1478
|
+
valueThemeKeys: ["--order"]
|
|
1479
|
+
}
|
|
1480
|
+
]);
|
|
2005
1481
|
staticUtility("col-auto", [["grid-column", "auto"]]);
|
|
2006
1482
|
functionalUtility("col", {
|
|
2007
1483
|
themeKeys: ["--grid-column"],
|
|
@@ -2025,6 +1501,24 @@ function createUtilities(theme) {
|
|
|
2025
1501
|
themeKeys: ["--grid-column-end"],
|
|
2026
1502
|
handle: (value) => [decl("grid-column-end", value)]
|
|
2027
1503
|
});
|
|
1504
|
+
suggest("col-span", () => [
|
|
1505
|
+
{
|
|
1506
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
1507
|
+
valueThemeKeys: []
|
|
1508
|
+
}
|
|
1509
|
+
]);
|
|
1510
|
+
suggest("col-start", () => [
|
|
1511
|
+
{
|
|
1512
|
+
values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
|
|
1513
|
+
valueThemeKeys: ["--grid-column-start"]
|
|
1514
|
+
}
|
|
1515
|
+
]);
|
|
1516
|
+
suggest("col-end", () => [
|
|
1517
|
+
{
|
|
1518
|
+
values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
|
|
1519
|
+
valueThemeKeys: ["--grid-column-end"]
|
|
1520
|
+
}
|
|
1521
|
+
]);
|
|
2028
1522
|
staticUtility("row-auto", [["grid-row", "auto"]]);
|
|
2029
1523
|
functionalUtility("row", {
|
|
2030
1524
|
themeKeys: ["--grid-row"],
|
|
@@ -2048,6 +1542,24 @@ function createUtilities(theme) {
|
|
|
2048
1542
|
themeKeys: ["--grid-row-end"],
|
|
2049
1543
|
handle: (value) => [decl("grid-row-end", value)]
|
|
2050
1544
|
});
|
|
1545
|
+
suggest("row-span", () => [
|
|
1546
|
+
{
|
|
1547
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
1548
|
+
valueThemeKeys: []
|
|
1549
|
+
}
|
|
1550
|
+
]);
|
|
1551
|
+
suggest("row-start", () => [
|
|
1552
|
+
{
|
|
1553
|
+
values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
|
|
1554
|
+
valueThemeKeys: ["--grid-row-start"]
|
|
1555
|
+
}
|
|
1556
|
+
]);
|
|
1557
|
+
suggest("row-end", () => [
|
|
1558
|
+
{
|
|
1559
|
+
values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
|
|
1560
|
+
valueThemeKeys: ["--grid-row-end"]
|
|
1561
|
+
}
|
|
1562
|
+
]);
|
|
2051
1563
|
staticUtility("float-start", [["float", "start"]]);
|
|
2052
1564
|
staticUtility("float-end", [["float", "end"]]);
|
|
2053
1565
|
staticUtility("float-right", [["float", "right"]]);
|
|
@@ -2101,6 +1613,12 @@ function createUtilities(theme) {
|
|
|
2101
1613
|
decl("-webkit-line-clamp", value)
|
|
2102
1614
|
]
|
|
2103
1615
|
});
|
|
1616
|
+
suggest("line-clamp", () => [
|
|
1617
|
+
{
|
|
1618
|
+
values: ["1", "2", "3", "4", "5", "6"],
|
|
1619
|
+
valueThemeKeys: ["--line-clamp"]
|
|
1620
|
+
}
|
|
1621
|
+
]);
|
|
2104
1622
|
staticUtility("block", [["display", "block"]]);
|
|
2105
1623
|
staticUtility("inline-block", [["display", "inline-block"]]);
|
|
2106
1624
|
staticUtility("inline", [["display", "inline"]]);
|
|
@@ -2272,6 +1790,20 @@ function createUtilities(theme) {
|
|
|
2272
1790
|
handleBareValue: ({ value }) => value,
|
|
2273
1791
|
handle: (value) => [decl("flex-grow", value)]
|
|
2274
1792
|
});
|
|
1793
|
+
suggest("shrink", () => [
|
|
1794
|
+
{
|
|
1795
|
+
values: ["0"],
|
|
1796
|
+
valueThemeKeys: [],
|
|
1797
|
+
hasDefaultValue: true
|
|
1798
|
+
}
|
|
1799
|
+
]);
|
|
1800
|
+
suggest("grow", () => [
|
|
1801
|
+
{
|
|
1802
|
+
values: ["0"],
|
|
1803
|
+
valueThemeKeys: [],
|
|
1804
|
+
hasDefaultValue: true
|
|
1805
|
+
}
|
|
1806
|
+
]);
|
|
2275
1807
|
staticUtility("basis-auto", [["flex-basis", "auto"]]);
|
|
2276
1808
|
staticUtility("basis-full", [["flex-basis", "100%"]]);
|
|
2277
1809
|
functionalUtility("basis", {
|
|
@@ -2348,7 +1880,7 @@ function createUtilities(theme) {
|
|
|
2348
1880
|
translateProperties(),
|
|
2349
1881
|
decl("--tw-translate-x", value),
|
|
2350
1882
|
decl("--tw-translate-y", value),
|
|
2351
|
-
decl("translate",
|
|
1883
|
+
decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
|
|
2352
1884
|
]
|
|
2353
1885
|
});
|
|
2354
1886
|
utilities.static("translate-x-full", (candidate) => {
|
|
@@ -2366,7 +1898,7 @@ function createUtilities(theme) {
|
|
|
2366
1898
|
handle: (value) => [
|
|
2367
1899
|
translateProperties(),
|
|
2368
1900
|
decl("--tw-translate-x", value),
|
|
2369
|
-
decl("translate",
|
|
1901
|
+
decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
|
|
2370
1902
|
]
|
|
2371
1903
|
});
|
|
2372
1904
|
utilities.static("translate-y-full", (candidate) => {
|
|
@@ -2384,7 +1916,7 @@ function createUtilities(theme) {
|
|
|
2384
1916
|
handle: (value) => [
|
|
2385
1917
|
translateProperties(),
|
|
2386
1918
|
decl("--tw-translate-y", value),
|
|
2387
|
-
decl("translate",
|
|
1919
|
+
decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
|
|
2388
1920
|
]
|
|
2389
1921
|
});
|
|
2390
1922
|
functionalUtility("rotate", {
|
|
@@ -2393,6 +1925,13 @@ function createUtilities(theme) {
|
|
|
2393
1925
|
handleBareValue: ({ value }) => `${value}deg`,
|
|
2394
1926
|
handle: (value) => [decl("rotate", value)]
|
|
2395
1927
|
});
|
|
1928
|
+
suggest("rotate", () => [
|
|
1929
|
+
{
|
|
1930
|
+
supportsNegative: true,
|
|
1931
|
+
values: ["0", "1", "2", "3", "6", "12", "45", "90", "180"],
|
|
1932
|
+
valueThemeKeys: ["--rotate"]
|
|
1933
|
+
}
|
|
1934
|
+
]);
|
|
2396
1935
|
let skewProperties = () => atRoot([property("--tw-skew-x", "0deg", "<angle>"), property("--tw-skew-y", "0deg", "<angle>")]);
|
|
2397
1936
|
functionalUtility("skew", {
|
|
2398
1937
|
supportsNegative: true,
|
|
@@ -2425,6 +1964,27 @@ function createUtilities(theme) {
|
|
|
2425
1964
|
decl("transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))")
|
|
2426
1965
|
]
|
|
2427
1966
|
});
|
|
1967
|
+
suggest("skew", () => [
|
|
1968
|
+
{
|
|
1969
|
+
supportsNegative: true,
|
|
1970
|
+
values: ["0", "1", "2", "3", "6", "12"],
|
|
1971
|
+
valueThemeKeys: ["--skew"]
|
|
1972
|
+
}
|
|
1973
|
+
]);
|
|
1974
|
+
suggest("skew-x", () => [
|
|
1975
|
+
{
|
|
1976
|
+
supportsNegative: true,
|
|
1977
|
+
values: ["0", "1", "2", "3", "6", "12"],
|
|
1978
|
+
valueThemeKeys: ["--skew"]
|
|
1979
|
+
}
|
|
1980
|
+
]);
|
|
1981
|
+
suggest("skew-y", () => [
|
|
1982
|
+
{
|
|
1983
|
+
supportsNegative: true,
|
|
1984
|
+
values: ["0", "1", "2", "3", "6", "12"],
|
|
1985
|
+
valueThemeKeys: ["--skew"]
|
|
1986
|
+
}
|
|
1987
|
+
]);
|
|
2428
1988
|
let scaleProperties = () => atRoot([property("--tw-scale-x", "1", "<number>"), property("--tw-scale-y", "1", "<number>")]);
|
|
2429
1989
|
functionalUtility("scale", {
|
|
2430
1990
|
supportsNegative: true,
|
|
@@ -2457,6 +2017,27 @@ function createUtilities(theme) {
|
|
|
2457
2017
|
decl("scale", "var(--tw-scale-x) var(--tw-scale-y)")
|
|
2458
2018
|
]
|
|
2459
2019
|
});
|
|
2020
|
+
suggest("scale", () => [
|
|
2021
|
+
{
|
|
2022
|
+
supportsNegative: true,
|
|
2023
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
2024
|
+
valueThemeKeys: ["--scale"]
|
|
2025
|
+
}
|
|
2026
|
+
]);
|
|
2027
|
+
suggest("scale-x", () => [
|
|
2028
|
+
{
|
|
2029
|
+
supportsNegative: true,
|
|
2030
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
2031
|
+
valueThemeKeys: ["--scale"]
|
|
2032
|
+
}
|
|
2033
|
+
]);
|
|
2034
|
+
suggest("scale-y", () => [
|
|
2035
|
+
{
|
|
2036
|
+
supportsNegative: true,
|
|
2037
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
2038
|
+
valueThemeKeys: ["--scale"]
|
|
2039
|
+
}
|
|
2040
|
+
]);
|
|
2460
2041
|
staticUtility("transform", [
|
|
2461
2042
|
skewProperties,
|
|
2462
2043
|
["transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))"]
|
|
@@ -2542,11 +2123,11 @@ function createUtilities(theme) {
|
|
|
2542
2123
|
["user-select", value]
|
|
2543
2124
|
]);
|
|
2544
2125
|
}
|
|
2545
|
-
staticUtility(
|
|
2546
|
-
staticUtility(
|
|
2547
|
-
staticUtility(
|
|
2548
|
-
staticUtility(
|
|
2549
|
-
staticUtility(
|
|
2126
|
+
staticUtility("resize-none", [["resize", "none"]]);
|
|
2127
|
+
staticUtility("resize-both", [["resize", "both"]]);
|
|
2128
|
+
staticUtility("resize-x", [["resize", "horizontal"]]);
|
|
2129
|
+
staticUtility("resize-y", [["resize", "vertical"]]);
|
|
2130
|
+
staticUtility("snap-none", [["scroll-snap-type", "none"]]);
|
|
2550
2131
|
let snapProperties = () => atRoot([property("--tw-scroll-snap-strictness", "proximity", "*")]);
|
|
2551
2132
|
for (let value of ["x", "y", "both"]) {
|
|
2552
2133
|
staticUtility(`snap-${value}`, [
|
|
@@ -2554,8 +2135,8 @@ function createUtilities(theme) {
|
|
|
2554
2135
|
["scroll-snap-type", `${value} var(--tw-scroll-snap-strictness)`]
|
|
2555
2136
|
]);
|
|
2556
2137
|
}
|
|
2557
|
-
staticUtility(
|
|
2558
|
-
staticUtility(
|
|
2138
|
+
staticUtility("snap-mandatory", [snapProperties, ["--tw-scroll-snap-strictness", "mandatory"]]);
|
|
2139
|
+
staticUtility("snap-proximity", [snapProperties, ["--tw-scroll-snap-strictness", "proximity"]]);
|
|
2559
2140
|
staticUtility("snap-align-none", [["scroll-snap-align", "none"]]);
|
|
2560
2141
|
staticUtility("snap-start", [["scroll-snap-align", "start"]]);
|
|
2561
2142
|
staticUtility("snap-end", [["scroll-snap-align", "end"]]);
|
|
@@ -2674,6 +2255,12 @@ function createUtilities(theme) {
|
|
|
2674
2255
|
handleBareValue: ({ value }) => value,
|
|
2675
2256
|
handle: (value) => [decl("columns", value)]
|
|
2676
2257
|
});
|
|
2258
|
+
suggest("columns", () => [
|
|
2259
|
+
{
|
|
2260
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
2261
|
+
valueThemeKeys: ["--columns", "--width"]
|
|
2262
|
+
}
|
|
2263
|
+
]);
|
|
2677
2264
|
for (let value of ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"]) {
|
|
2678
2265
|
staticUtility(`break-before-${value}`, [["break-before", value]]);
|
|
2679
2266
|
}
|
|
@@ -2718,6 +2305,18 @@ function createUtilities(theme) {
|
|
|
2718
2305
|
handleBareValue: ({ value }) => `repeat(${value}, minmax(0, 1fr))`,
|
|
2719
2306
|
handle: (value) => [decl("grid-template-rows", value)]
|
|
2720
2307
|
});
|
|
2308
|
+
suggest("grid-cols", () => [
|
|
2309
|
+
{
|
|
2310
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
2311
|
+
valueThemeKeys: ["--grid-template-columns"]
|
|
2312
|
+
}
|
|
2313
|
+
]);
|
|
2314
|
+
suggest("grid-rows", () => [
|
|
2315
|
+
{
|
|
2316
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
2317
|
+
valueThemeKeys: ["--grid-template-rows"]
|
|
2318
|
+
}
|
|
2319
|
+
]);
|
|
2721
2320
|
staticUtility("flex-row", [["flex-direction", "row"]]);
|
|
2722
2321
|
staticUtility("flex-row-reverse", [["flex-direction", "row-reverse"]]);
|
|
2723
2322
|
staticUtility("flex-col", [["flex-direction", "column"]]);
|
|
@@ -2804,60 +2403,18 @@ function createUtilities(theme) {
|
|
|
2804
2403
|
});
|
|
2805
2404
|
staticUtility("space-x-reverse", [
|
|
2806
2405
|
() => atRoot([property("--tw-space-x-reverse", "0", "<number>")]),
|
|
2807
|
-
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2808
|
-
decl("--tw-sort", "row-gap"),
|
|
2809
|
-
decl("--tw-space-x-reverse", "1")
|
|
2810
|
-
])
|
|
2811
|
-
]);
|
|
2812
|
-
staticUtility("space-y-reverse", [
|
|
2813
|
-
() => atRoot([property("--tw-space-y-reverse", "0", "<number>")]),
|
|
2814
|
-
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2815
|
-
decl("--tw-sort", "column-gap"),
|
|
2816
|
-
decl("--tw-space-y-reverse", "1")
|
|
2817
|
-
])
|
|
2818
|
-
]);
|
|
2819
|
-
functionalUtility("divide-x", {
|
|
2820
|
-
defaultValue: theme.get(["--default-border-width"]) ?? "1px",
|
|
2821
|
-
themeKeys: ["--divide-width", "--border-width"],
|
|
2822
|
-
handleBareValue: ({ value }) => `${value}px`,
|
|
2823
|
-
handle: (value) => [
|
|
2824
|
-
atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
|
|
2825
|
-
rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2826
|
-
decl("--tw-sort", "divide-x-width"),
|
|
2827
|
-
decl("border-inline-end-width", `calc(${value} * var(--tw-divide-x-reverse))`),
|
|
2828
|
-
decl("border-inline-start-width", `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`)
|
|
2829
|
-
])
|
|
2830
|
-
]
|
|
2831
|
-
});
|
|
2832
|
-
functionalUtility("divide-y", {
|
|
2833
|
-
defaultValue: theme.get(["--default-border-width"]) ?? "1px",
|
|
2834
|
-
themeKeys: ["--divide-width", "--border-width"],
|
|
2835
|
-
handleBareValue: ({ value }) => `${value}px`,
|
|
2836
|
-
handle: (value) => [
|
|
2837
|
-
atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
|
|
2838
|
-
rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2839
|
-
decl("--tw-sort", "divide-y-width"),
|
|
2840
|
-
decl("border-bottom-width", `calc(${value} * var(--tw-divide-y-reverse))`),
|
|
2841
|
-
decl("border-top-width", `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`)
|
|
2842
|
-
])
|
|
2843
|
-
]
|
|
2844
|
-
});
|
|
2845
|
-
staticUtility("divide-x-reverse", [
|
|
2846
|
-
() => atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
|
|
2847
|
-
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-x-reverse", "1")])
|
|
2406
|
+
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2407
|
+
decl("--tw-sort", "row-gap"),
|
|
2408
|
+
decl("--tw-space-x-reverse", "1")
|
|
2409
|
+
])
|
|
2848
2410
|
]);
|
|
2849
|
-
staticUtility("
|
|
2850
|
-
() => atRoot([property("--tw-
|
|
2851
|
-
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2411
|
+
staticUtility("space-y-reverse", [
|
|
2412
|
+
() => atRoot([property("--tw-space-y-reverse", "0", "<number>")]),
|
|
2413
|
+
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2414
|
+
decl("--tw-sort", "column-gap"),
|
|
2415
|
+
decl("--tw-space-y-reverse", "1")
|
|
2416
|
+
])
|
|
2852
2417
|
]);
|
|
2853
|
-
for (let value of ["solid", "dashed", "dotted", "double", "none"]) {
|
|
2854
|
-
staticUtility(`divide-${value}`, [
|
|
2855
|
-
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2856
|
-
decl("--tw-sort", "divide-style"),
|
|
2857
|
-
decl("border-style", value)
|
|
2858
|
-
])
|
|
2859
|
-
]);
|
|
2860
|
-
}
|
|
2861
2418
|
colorUtility("accent", {
|
|
2862
2419
|
themeKeys: ["--accent-color", "--color"],
|
|
2863
2420
|
handle: (value) => [decl("accent-color", value)]
|
|
@@ -2901,33 +2458,33 @@ function createUtilities(theme) {
|
|
|
2901
2458
|
staticUtility(`overscroll-x-${value}`, [["overscroll-behavior-x", value]]);
|
|
2902
2459
|
staticUtility(`overscroll-y-${value}`, [["overscroll-behavior-y", value]]);
|
|
2903
2460
|
}
|
|
2904
|
-
staticUtility(
|
|
2905
|
-
staticUtility(
|
|
2906
|
-
staticUtility(
|
|
2461
|
+
staticUtility("scroll-auto", [["scroll-behavior", "auto"]]);
|
|
2462
|
+
staticUtility("scroll-smooth", [["scroll-behavior", "smooth"]]);
|
|
2463
|
+
staticUtility("truncate", [
|
|
2907
2464
|
["overflow", "hidden"],
|
|
2908
2465
|
["text-overflow", "ellipsis"],
|
|
2909
2466
|
["white-space", "nowrap"]
|
|
2910
2467
|
]);
|
|
2911
|
-
staticUtility(
|
|
2912
|
-
staticUtility(
|
|
2913
|
-
staticUtility(
|
|
2468
|
+
staticUtility("text-ellipsis", [["text-overflow", "ellipsis"]]);
|
|
2469
|
+
staticUtility("text-clip", [["text-overflow", "clip"]]);
|
|
2470
|
+
staticUtility("hyphens-none", [
|
|
2914
2471
|
["-webkit-hyphens", "none"],
|
|
2915
2472
|
["hyphens", "none"]
|
|
2916
2473
|
]);
|
|
2917
|
-
staticUtility(
|
|
2474
|
+
staticUtility("hyphens-manual", [
|
|
2918
2475
|
["-webkit-hyphens", "manual"],
|
|
2919
2476
|
["hyphens", "manual"]
|
|
2920
2477
|
]);
|
|
2921
|
-
staticUtility(
|
|
2478
|
+
staticUtility("hyphens-auto", [
|
|
2922
2479
|
["-webkit-hyphens", "auto"],
|
|
2923
2480
|
["hyphens", "auto"]
|
|
2924
2481
|
]);
|
|
2925
|
-
staticUtility(
|
|
2926
|
-
staticUtility(
|
|
2927
|
-
staticUtility(
|
|
2928
|
-
staticUtility(
|
|
2929
|
-
staticUtility(
|
|
2930
|
-
staticUtility(
|
|
2482
|
+
staticUtility("whitespace-normal", [["white-space", "normal"]]);
|
|
2483
|
+
staticUtility("whitespace-nowrap", [["white-space", "nowrap"]]);
|
|
2484
|
+
staticUtility("whitespace-pre", [["white-space", "pre"]]);
|
|
2485
|
+
staticUtility("whitespace-pre-line", [["white-space", "pre-line"]]);
|
|
2486
|
+
staticUtility("whitespace-pre-wrap", [["white-space", "pre-wrap"]]);
|
|
2487
|
+
staticUtility("whitespace-break-spaces", [["white-space", "break-spaces"]]);
|
|
2931
2488
|
staticUtility("text-wrap", [["text-wrap", "wrap"]]);
|
|
2932
2489
|
staticUtility("text-nowrap", [["text-wrap", "nowrap"]]);
|
|
2933
2490
|
staticUtility("text-balance", [["text-wrap", "balance"]]);
|
|
@@ -3017,88 +2574,201 @@ function createUtilities(theme) {
|
|
|
3017
2574
|
themeKeys: ["--radius"],
|
|
3018
2575
|
handle: (value) => [decl("border-bottom-left-radius", value)]
|
|
3019
2576
|
});
|
|
3020
|
-
staticUtility("border-solid", [
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
staticUtility("border-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
2577
|
+
staticUtility("border-solid", [
|
|
2578
|
+
["--tw-border-style", "solid"],
|
|
2579
|
+
["border-style", "solid"]
|
|
2580
|
+
]);
|
|
2581
|
+
staticUtility("border-dashed", [
|
|
2582
|
+
["--tw-border-style", "dashed"],
|
|
2583
|
+
["border-style", "dashed"]
|
|
2584
|
+
]);
|
|
2585
|
+
staticUtility("border-dotted", [
|
|
2586
|
+
["--tw-border-style", "dotted"],
|
|
2587
|
+
["border-style", "dotted"]
|
|
2588
|
+
]);
|
|
2589
|
+
staticUtility("border-double", [
|
|
2590
|
+
["--tw-border-style", "double"],
|
|
2591
|
+
["border-style", "double"]
|
|
2592
|
+
]);
|
|
2593
|
+
staticUtility("border-hidden", [
|
|
2594
|
+
["--tw-border-style", "hidden"],
|
|
2595
|
+
["border-style", "hidden"]
|
|
2596
|
+
]);
|
|
2597
|
+
staticUtility("border-none", [
|
|
2598
|
+
["--tw-border-style", "none"],
|
|
2599
|
+
["border-style", "none"]
|
|
2600
|
+
]);
|
|
2601
|
+
{
|
|
2602
|
+
let borderSideUtility2 = function(classRoot, desc) {
|
|
2603
|
+
utilities.functional(classRoot, (candidate) => {
|
|
2604
|
+
if (candidate.negative)
|
|
2605
|
+
return;
|
|
2606
|
+
if (!candidate.value) {
|
|
2607
|
+
let value = theme.get(["--default-border-width"]) ?? "1px";
|
|
2608
|
+
let decls = desc.width(value);
|
|
2609
|
+
if (!decls)
|
|
2610
|
+
return;
|
|
2611
|
+
return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
|
|
2612
|
+
}
|
|
2613
|
+
if (candidate.value.kind === "arbitrary") {
|
|
2614
|
+
let value = candidate.value.value;
|
|
2615
|
+
let type = candidate.value.dataType ?? inferDataType(value, ["color", "line-width", "length"]);
|
|
2616
|
+
switch (type) {
|
|
2617
|
+
case "line-width":
|
|
2618
|
+
case "length": {
|
|
2619
|
+
let decls = desc.width(value);
|
|
2620
|
+
if (!decls)
|
|
2621
|
+
return;
|
|
2622
|
+
return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
|
|
2623
|
+
}
|
|
2624
|
+
default: {
|
|
2625
|
+
value = asColor(value, candidate.modifier, theme);
|
|
2626
|
+
if (value === null)
|
|
2627
|
+
return;
|
|
2628
|
+
return desc.color(value);
|
|
2629
|
+
}
|
|
3042
2630
|
}
|
|
3043
|
-
|
|
3044
|
-
|
|
2631
|
+
}
|
|
2632
|
+
{
|
|
2633
|
+
let value = resolveThemeColor(candidate, theme, ["--border-color", "--color"]);
|
|
2634
|
+
if (value) {
|
|
3045
2635
|
return desc.color(value);
|
|
3046
2636
|
}
|
|
3047
2637
|
}
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
2638
|
+
{
|
|
2639
|
+
let value = theme.resolve(candidate.value.value, ["--border-width"]);
|
|
2640
|
+
if (value) {
|
|
2641
|
+
let decls = desc.width(value);
|
|
2642
|
+
if (!decls)
|
|
2643
|
+
return;
|
|
2644
|
+
return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
|
|
2645
|
+
}
|
|
2646
|
+
if (!Number.isNaN(Number(candidate.value.value))) {
|
|
2647
|
+
let decls = desc.width(`${candidate.value.value}px`);
|
|
2648
|
+
if (!decls)
|
|
2649
|
+
return;
|
|
2650
|
+
return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
suggest(classRoot, () => [
|
|
2655
|
+
{
|
|
2656
|
+
values: ["current", "transparent"],
|
|
2657
|
+
valueThemeKeys: ["--border-color", "--color"],
|
|
2658
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
2659
|
+
modifierThemeKeys: ["--opacity"],
|
|
2660
|
+
hasDefaultValue: true
|
|
2661
|
+
},
|
|
2662
|
+
{
|
|
2663
|
+
values: [],
|
|
2664
|
+
valueThemeKeys: ["--border-width"]
|
|
3053
2665
|
}
|
|
2666
|
+
]);
|
|
2667
|
+
};
|
|
2668
|
+
let borderProperties = () => {
|
|
2669
|
+
return atRoot([property("--tw-border-style", "solid", "<custom-ident>")]);
|
|
2670
|
+
};
|
|
2671
|
+
borderSideUtility2("border", {
|
|
2672
|
+
width: (value) => [decl("border-width", value)],
|
|
2673
|
+
color: (value) => [decl("border-color", value)]
|
|
2674
|
+
});
|
|
2675
|
+
borderSideUtility2("border-x", {
|
|
2676
|
+
width: (value) => [decl("border-left-width", value), decl("border-right-width", value)],
|
|
2677
|
+
color: (value) => [decl("border-left-color", value), decl("border-right-color", value)]
|
|
2678
|
+
});
|
|
2679
|
+
borderSideUtility2("border-y", {
|
|
2680
|
+
width: (value) => [decl("border-top-width", value), decl("border-bottom-width", value)],
|
|
2681
|
+
color: (value) => [decl("border-top-color", value), decl("border-bottom-color", value)]
|
|
2682
|
+
});
|
|
2683
|
+
borderSideUtility2("border-s", {
|
|
2684
|
+
width: (value) => [decl("border-inline-start-width", value)],
|
|
2685
|
+
color: (value) => [decl("border-inline-start-color", value)]
|
|
2686
|
+
});
|
|
2687
|
+
borderSideUtility2("border-e", {
|
|
2688
|
+
width: (value) => [decl("border-inline-end-width", value)],
|
|
2689
|
+
color: (value) => [decl("border-inline-end-color", value)]
|
|
2690
|
+
});
|
|
2691
|
+
borderSideUtility2("border-t", {
|
|
2692
|
+
width: (value) => [decl("border-top-width", value)],
|
|
2693
|
+
color: (value) => [decl("border-top-color", value)]
|
|
2694
|
+
});
|
|
2695
|
+
borderSideUtility2("border-r", {
|
|
2696
|
+
width: (value) => [decl("border-right-width", value)],
|
|
2697
|
+
color: (value) => [decl("border-right-color", value)]
|
|
2698
|
+
});
|
|
2699
|
+
borderSideUtility2("border-b", {
|
|
2700
|
+
width: (value) => [decl("border-bottom-width", value)],
|
|
2701
|
+
color: (value) => [decl("border-bottom-color", value)]
|
|
2702
|
+
});
|
|
2703
|
+
borderSideUtility2("border-l", {
|
|
2704
|
+
width: (value) => [decl("border-left-width", value)],
|
|
2705
|
+
color: (value) => [decl("border-left-color", value)]
|
|
2706
|
+
});
|
|
2707
|
+
functionalUtility("divide-x", {
|
|
2708
|
+
defaultValue: theme.get(["--default-border-width"]) ?? "1px",
|
|
2709
|
+
themeKeys: ["--divide-width", "--border-width"],
|
|
2710
|
+
handleBareValue: ({ value }) => `${value}px`,
|
|
2711
|
+
handle: (value) => [
|
|
2712
|
+
atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
|
|
2713
|
+
rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2714
|
+
decl("--tw-sort", "divide-x-width"),
|
|
2715
|
+
borderProperties(),
|
|
2716
|
+
decl("border-style", "var(--tw-border-style)"),
|
|
2717
|
+
decl("border-inline-end-width", `calc(${value} * var(--tw-divide-x-reverse))`),
|
|
2718
|
+
decl(
|
|
2719
|
+
"border-inline-start-width",
|
|
2720
|
+
`calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`
|
|
2721
|
+
)
|
|
2722
|
+
])
|
|
2723
|
+
]
|
|
2724
|
+
});
|
|
2725
|
+
functionalUtility("divide-y", {
|
|
2726
|
+
defaultValue: theme.get(["--default-border-width"]) ?? "1px",
|
|
2727
|
+
themeKeys: ["--divide-width", "--border-width"],
|
|
2728
|
+
handleBareValue: ({ value }) => `${value}px`,
|
|
2729
|
+
handle: (value) => [
|
|
2730
|
+
atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
|
|
2731
|
+
rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2732
|
+
decl("--tw-sort", "divide-y-width"),
|
|
2733
|
+
borderProperties(),
|
|
2734
|
+
decl("border-style", "var(--tw-border-style)"),
|
|
2735
|
+
decl("border-bottom-width", `calc(${value} * var(--tw-divide-y-reverse))`),
|
|
2736
|
+
decl("border-top-width", `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`)
|
|
2737
|
+
])
|
|
2738
|
+
]
|
|
2739
|
+
});
|
|
2740
|
+
suggest("divide-x", () => [
|
|
2741
|
+
{
|
|
2742
|
+
values: ["0", "2", "4", "8"],
|
|
2743
|
+
valueThemeKeys: ["--divide-width", "--border-width"],
|
|
2744
|
+
hasDefaultValue: true
|
|
3054
2745
|
}
|
|
2746
|
+
]);
|
|
2747
|
+
suggest("divide-y", () => [
|
|
3055
2748
|
{
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
}
|
|
3060
|
-
if (!isNaN(Number(candidate.value.value))) {
|
|
3061
|
-
return desc.width(`${candidate.value.value}px`);
|
|
3062
|
-
}
|
|
2749
|
+
values: ["0", "2", "4", "8"],
|
|
2750
|
+
valueThemeKeys: ["--divide-width", "--border-width"],
|
|
2751
|
+
hasDefaultValue: true
|
|
3063
2752
|
}
|
|
3064
|
-
|
|
2753
|
+
]);
|
|
2754
|
+
staticUtility("divide-x-reverse", [
|
|
2755
|
+
() => atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
|
|
2756
|
+
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-x-reverse", "1")])
|
|
2757
|
+
]);
|
|
2758
|
+
staticUtility("divide-y-reverse", [
|
|
2759
|
+
() => atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
|
|
2760
|
+
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-y-reverse", "1")])
|
|
2761
|
+
]);
|
|
2762
|
+
for (let value of ["solid", "dashed", "dotted", "double", "none"]) {
|
|
2763
|
+
staticUtility(`divide-${value}`, [
|
|
2764
|
+
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2765
|
+
decl("--tw-sort", "divide-style"),
|
|
2766
|
+
decl("--tw-border-style", value),
|
|
2767
|
+
decl("border-style", value)
|
|
2768
|
+
])
|
|
2769
|
+
]);
|
|
2770
|
+
}
|
|
3065
2771
|
}
|
|
3066
|
-
borderSideUtility("border", {
|
|
3067
|
-
width: (value) => [decl("border-width", value)],
|
|
3068
|
-
color: (value) => [decl("border-color", value)]
|
|
3069
|
-
});
|
|
3070
|
-
borderSideUtility("border-x", {
|
|
3071
|
-
width: (value) => [decl("border-left-width", value), decl("border-right-width", value)],
|
|
3072
|
-
color: (value) => [decl("border-left-color", value), decl("border-right-color", value)]
|
|
3073
|
-
});
|
|
3074
|
-
borderSideUtility("border-y", {
|
|
3075
|
-
width: (value) => [decl("border-top-width", value), decl("border-bottom-width", value)],
|
|
3076
|
-
color: (value) => [decl("border-top-color", value), decl("border-bottom-color", value)]
|
|
3077
|
-
});
|
|
3078
|
-
borderSideUtility("border-s", {
|
|
3079
|
-
width: (value) => [decl("border-inline-start-width", value)],
|
|
3080
|
-
color: (value) => [decl("border-inline-start-color", value)]
|
|
3081
|
-
});
|
|
3082
|
-
borderSideUtility("border-e", {
|
|
3083
|
-
width: (value) => [decl("border-inline-end-width", value)],
|
|
3084
|
-
color: (value) => [decl("border-inline-end-color", value)]
|
|
3085
|
-
});
|
|
3086
|
-
borderSideUtility("border-t", {
|
|
3087
|
-
width: (value) => [decl("border-top-width", value)],
|
|
3088
|
-
color: (value) => [decl("border-top-color", value)]
|
|
3089
|
-
});
|
|
3090
|
-
borderSideUtility("border-r", {
|
|
3091
|
-
width: (value) => [decl("border-right-width", value)],
|
|
3092
|
-
color: (value) => [decl("border-right-color", value)]
|
|
3093
|
-
});
|
|
3094
|
-
borderSideUtility("border-b", {
|
|
3095
|
-
width: (value) => [decl("border-bottom-width", value)],
|
|
3096
|
-
color: (value) => [decl("border-bottom-color", value)]
|
|
3097
|
-
});
|
|
3098
|
-
borderSideUtility("border-l", {
|
|
3099
|
-
width: (value) => [decl("border-left-width", value)],
|
|
3100
|
-
color: (value) => [decl("border-left-color", value)]
|
|
3101
|
-
});
|
|
3102
2772
|
staticUtility("bg-inherit", [["background-color", "inherit"]]);
|
|
3103
2773
|
staticUtility("bg-transparent", [["background-color", "transparent"]]);
|
|
3104
2774
|
staticUtility("bg-auto", [["background-size", "auto"]]);
|
|
@@ -3138,9 +2808,8 @@ function createUtilities(theme) {
|
|
|
3138
2808
|
]);
|
|
3139
2809
|
}
|
|
3140
2810
|
utilities.functional("bg", (candidate) => {
|
|
3141
|
-
if (candidate.negative || !candidate.value)
|
|
2811
|
+
if (candidate.negative || !candidate.value)
|
|
3142
2812
|
return;
|
|
3143
|
-
}
|
|
3144
2813
|
if (candidate.value.kind === "arbitrary") {
|
|
3145
2814
|
let value = candidate.value.value;
|
|
3146
2815
|
let type = candidate.value.dataType ?? inferDataType(value, [
|
|
@@ -3168,6 +2837,8 @@ function createUtilities(theme) {
|
|
|
3168
2837
|
}
|
|
3169
2838
|
default: {
|
|
3170
2839
|
value = asColor(value, candidate.modifier, theme);
|
|
2840
|
+
if (value === null)
|
|
2841
|
+
return;
|
|
3171
2842
|
return [decl("background-color", value)];
|
|
3172
2843
|
}
|
|
3173
2844
|
}
|
|
@@ -3185,6 +2856,18 @@ function createUtilities(theme) {
|
|
|
3185
2856
|
}
|
|
3186
2857
|
}
|
|
3187
2858
|
});
|
|
2859
|
+
suggest("bg", () => [
|
|
2860
|
+
{
|
|
2861
|
+
values: ["current", "transparent"],
|
|
2862
|
+
valueThemeKeys: ["--background-color", "--color"],
|
|
2863
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
2864
|
+
modifierThemeKeys: ["--opacity"]
|
|
2865
|
+
},
|
|
2866
|
+
{
|
|
2867
|
+
values: [],
|
|
2868
|
+
valueThemeKeys: ["--background-image"]
|
|
2869
|
+
}
|
|
2870
|
+
]);
|
|
3188
2871
|
let gradientStopProperties = () => {
|
|
3189
2872
|
return atRoot([
|
|
3190
2873
|
property("--tw-gradient-from", "#0000", "<color>"),
|
|
@@ -3201,9 +2884,8 @@ function createUtilities(theme) {
|
|
|
3201
2884
|
};
|
|
3202
2885
|
function gradientStopUtility(classRoot, desc) {
|
|
3203
2886
|
utilities.functional(classRoot, (candidate) => {
|
|
3204
|
-
if (candidate.negative || !candidate.value)
|
|
2887
|
+
if (candidate.negative || !candidate.value)
|
|
3205
2888
|
return;
|
|
3206
|
-
}
|
|
3207
2889
|
if (candidate.value.kind === "arbitrary") {
|
|
3208
2890
|
let value = candidate.value.value;
|
|
3209
2891
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage"]);
|
|
@@ -3214,6 +2896,8 @@ function createUtilities(theme) {
|
|
|
3214
2896
|
}
|
|
3215
2897
|
default: {
|
|
3216
2898
|
value = asColor(value, candidate.modifier, theme);
|
|
2899
|
+
if (value === null)
|
|
2900
|
+
return;
|
|
3217
2901
|
return desc.color(value);
|
|
3218
2902
|
}
|
|
3219
2903
|
}
|
|
@@ -3233,6 +2917,18 @@ function createUtilities(theme) {
|
|
|
3233
2917
|
}
|
|
3234
2918
|
}
|
|
3235
2919
|
});
|
|
2920
|
+
suggest(classRoot, () => [
|
|
2921
|
+
{
|
|
2922
|
+
values: ["current", "transparent"],
|
|
2923
|
+
valueThemeKeys: ["--background-color", "--color"],
|
|
2924
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
2925
|
+
modifierThemeKeys: ["--opacity"]
|
|
2926
|
+
},
|
|
2927
|
+
{
|
|
2928
|
+
values: Array.from({ length: 21 }, (_, index) => `${index * 5}%`),
|
|
2929
|
+
valueThemeKeys: ["--gradient-color-stop-positions"]
|
|
2930
|
+
}
|
|
2931
|
+
]);
|
|
3236
2932
|
}
|
|
3237
2933
|
gradientStopUtility("from", {
|
|
3238
2934
|
color: (value) => [
|
|
@@ -3254,9 +2950,9 @@ function createUtilities(theme) {
|
|
|
3254
2950
|
decl("--tw-gradient-via", value),
|
|
3255
2951
|
decl(
|
|
3256
2952
|
"--tw-gradient-via-stops",
|
|
3257
|
-
|
|
2953
|
+
"var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position)"
|
|
3258
2954
|
),
|
|
3259
|
-
decl("--tw-gradient-stops",
|
|
2955
|
+
decl("--tw-gradient-stops", "var(--tw-gradient-via-stops)")
|
|
3260
2956
|
],
|
|
3261
2957
|
position: (value) => [gradientStopProperties(), decl("--tw-gradient-via-position", value)]
|
|
3262
2958
|
});
|
|
@@ -3316,25 +3012,34 @@ function createUtilities(theme) {
|
|
|
3316
3012
|
staticUtility(`bg-blend-${value}`, [["background-blend-mode", value]]);
|
|
3317
3013
|
staticUtility(`mix-blend-${value}`, [["mix-blend-mode", value]]);
|
|
3318
3014
|
}
|
|
3319
|
-
staticUtility(
|
|
3320
|
-
staticUtility(
|
|
3015
|
+
staticUtility("mix-blend-plus-darker", [["mix-blend-mode", "plus-darker"]]);
|
|
3016
|
+
staticUtility("mix-blend-plus-lighter", [["mix-blend-mode", "plus-lighter"]]);
|
|
3321
3017
|
utilities.functional("fill", (candidate) => {
|
|
3322
|
-
if (candidate.negative || !candidate.value)
|
|
3018
|
+
if (candidate.negative || !candidate.value)
|
|
3323
3019
|
return;
|
|
3324
|
-
}
|
|
3325
3020
|
if (candidate.value.kind === "arbitrary") {
|
|
3326
|
-
|
|
3021
|
+
let value2 = asColor(candidate.value.value, candidate.modifier, theme);
|
|
3022
|
+
if (value2 === null)
|
|
3023
|
+
return;
|
|
3024
|
+
return [decl("fill", value2)];
|
|
3327
3025
|
}
|
|
3328
3026
|
let value = resolveThemeColor(candidate, theme, ["--fill", "--color"]);
|
|
3329
3027
|
if (value) {
|
|
3330
3028
|
return [decl("fill", value)];
|
|
3331
3029
|
}
|
|
3332
3030
|
});
|
|
3031
|
+
suggest("fill", () => [
|
|
3032
|
+
{
|
|
3033
|
+
values: ["current", "transparent"],
|
|
3034
|
+
valueThemeKeys: ["--fill", "--color"],
|
|
3035
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
3036
|
+
modifierThemeKeys: ["--opacity"]
|
|
3037
|
+
}
|
|
3038
|
+
]);
|
|
3333
3039
|
staticUtility("stroke-none", [["stroke", "none"]]);
|
|
3334
3040
|
utilities.functional("stroke", (candidate) => {
|
|
3335
|
-
if (candidate.negative || !candidate.value)
|
|
3041
|
+
if (candidate.negative || !candidate.value)
|
|
3336
3042
|
return;
|
|
3337
|
-
}
|
|
3338
3043
|
if (candidate.value.kind === "arbitrary") {
|
|
3339
3044
|
let value = candidate.value.value;
|
|
3340
3045
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "number", "length", "percentage"]);
|
|
@@ -3346,6 +3051,8 @@ function createUtilities(theme) {
|
|
|
3346
3051
|
}
|
|
3347
3052
|
default: {
|
|
3348
3053
|
value = asColor(candidate.value.value, candidate.modifier, theme);
|
|
3054
|
+
if (value === null)
|
|
3055
|
+
return;
|
|
3349
3056
|
return [decl("stroke", value)];
|
|
3350
3057
|
}
|
|
3351
3058
|
}
|
|
@@ -3360,11 +3067,23 @@ function createUtilities(theme) {
|
|
|
3360
3067
|
let value = theme.resolve(candidate.value.value, ["--stroke-width"]);
|
|
3361
3068
|
if (value) {
|
|
3362
3069
|
return [decl("stroke-width", value)];
|
|
3363
|
-
} else if (!isNaN(Number(candidate.value.value))) {
|
|
3070
|
+
} else if (!Number.isNaN(Number(candidate.value.value))) {
|
|
3364
3071
|
return [decl("stroke-width", candidate.value.value)];
|
|
3365
3072
|
}
|
|
3366
3073
|
}
|
|
3367
3074
|
});
|
|
3075
|
+
suggest("stroke", () => [
|
|
3076
|
+
{
|
|
3077
|
+
values: ["current", "transparent"],
|
|
3078
|
+
valueThemeKeys: ["--stroke", "--color"],
|
|
3079
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
3080
|
+
modifierThemeKeys: ["--opacity"]
|
|
3081
|
+
},
|
|
3082
|
+
{
|
|
3083
|
+
values: ["0", "1", "2", "3"],
|
|
3084
|
+
valueThemeKeys: ["--stroke-width"]
|
|
3085
|
+
}
|
|
3086
|
+
]);
|
|
3368
3087
|
staticUtility("object-contain", [["object-fit", "contain"]]);
|
|
3369
3088
|
staticUtility("object-cover", [["object-fit", "cover"]]);
|
|
3370
3089
|
staticUtility("object-fill", [["object-fit", "fill"]]);
|
|
@@ -3443,9 +3162,8 @@ function createUtilities(theme) {
|
|
|
3443
3162
|
handle: (value) => [decl("vertical-align", value)]
|
|
3444
3163
|
});
|
|
3445
3164
|
utilities.functional("font", (candidate) => {
|
|
3446
|
-
if (candidate.negative || !candidate.value)
|
|
3165
|
+
if (candidate.negative || !candidate.value)
|
|
3447
3166
|
return;
|
|
3448
|
-
}
|
|
3449
3167
|
if (candidate.value.kind === "arbitrary") {
|
|
3450
3168
|
let value = candidate.value.value;
|
|
3451
3169
|
let type = candidate.value.dataType ?? inferDataType(value, ["number", "generic-name", "family-name"]);
|
|
@@ -3513,6 +3231,26 @@ function createUtilities(theme) {
|
|
|
3513
3231
|
}
|
|
3514
3232
|
}
|
|
3515
3233
|
});
|
|
3234
|
+
suggest("font", () => [
|
|
3235
|
+
{
|
|
3236
|
+
values: [],
|
|
3237
|
+
valueThemeKeys: ["--font-family"]
|
|
3238
|
+
},
|
|
3239
|
+
{
|
|
3240
|
+
values: [
|
|
3241
|
+
"thin",
|
|
3242
|
+
"extralight",
|
|
3243
|
+
"light",
|
|
3244
|
+
"normal",
|
|
3245
|
+
"medium",
|
|
3246
|
+
"semibold",
|
|
3247
|
+
"bold",
|
|
3248
|
+
"extrabold",
|
|
3249
|
+
"black"
|
|
3250
|
+
],
|
|
3251
|
+
valueThemeKeys: ["--font-weight"]
|
|
3252
|
+
}
|
|
3253
|
+
]);
|
|
3516
3254
|
staticUtility("uppercase", [["text-transform", "uppercase"]]);
|
|
3517
3255
|
staticUtility("lowercase", [["text-transform", "lowercase"]]);
|
|
3518
3256
|
staticUtility("capitalize", [["text-transform", "capitalize"]]);
|
|
@@ -3537,9 +3275,8 @@ function createUtilities(theme) {
|
|
|
3537
3275
|
staticUtility("decoration-auto", [["text-decoration-thickness", "auto"]]);
|
|
3538
3276
|
staticUtility("decoration-from-font", [["text-decoration-thickness", "from-font"]]);
|
|
3539
3277
|
utilities.functional("decoration", (candidate) => {
|
|
3540
|
-
if (candidate.negative || !candidate.value)
|
|
3278
|
+
if (candidate.negative || !candidate.value)
|
|
3541
3279
|
return;
|
|
3542
|
-
}
|
|
3543
3280
|
if (candidate.value.kind === "arbitrary") {
|
|
3544
3281
|
let value = candidate.value.value;
|
|
3545
3282
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage"]);
|
|
@@ -3550,6 +3287,8 @@ function createUtilities(theme) {
|
|
|
3550
3287
|
}
|
|
3551
3288
|
default: {
|
|
3552
3289
|
value = asColor(value, candidate.modifier, theme);
|
|
3290
|
+
if (value === null)
|
|
3291
|
+
return;
|
|
3553
3292
|
return [decl("text-decoration-color", value)];
|
|
3554
3293
|
}
|
|
3555
3294
|
}
|
|
@@ -3559,7 +3298,7 @@ function createUtilities(theme) {
|
|
|
3559
3298
|
if (value) {
|
|
3560
3299
|
return [decl("text-decoration-thickness", value)];
|
|
3561
3300
|
}
|
|
3562
|
-
if (!isNaN(Number(candidate.value.value))) {
|
|
3301
|
+
if (!Number.isNaN(Number(candidate.value.value))) {
|
|
3563
3302
|
return [decl("text-decoration-thickness", `${candidate.value.value}px`)];
|
|
3564
3303
|
}
|
|
3565
3304
|
}
|
|
@@ -3570,6 +3309,18 @@ function createUtilities(theme) {
|
|
|
3570
3309
|
}
|
|
3571
3310
|
}
|
|
3572
3311
|
});
|
|
3312
|
+
suggest("decoration", () => [
|
|
3313
|
+
{
|
|
3314
|
+
values: ["current", "transparent"],
|
|
3315
|
+
valueThemeKeys: ["--text-decoration-color", "--color"],
|
|
3316
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
3317
|
+
modifierThemeKeys: ["--opacity"]
|
|
3318
|
+
},
|
|
3319
|
+
{
|
|
3320
|
+
values: ["0", "1", "2"],
|
|
3321
|
+
valueThemeKeys: ["--text-decoration-thickness"]
|
|
3322
|
+
}
|
|
3323
|
+
]);
|
|
3573
3324
|
staticUtility("animate-none", [["animation", "none"]]);
|
|
3574
3325
|
functionalUtility("animate", {
|
|
3575
3326
|
themeKeys: ["--animate"],
|
|
@@ -3625,14 +3376,13 @@ function createUtilities(theme) {
|
|
|
3625
3376
|
]);
|
|
3626
3377
|
};
|
|
3627
3378
|
utilities.functional("filter", (candidate) => {
|
|
3628
|
-
if (candidate.negative)
|
|
3379
|
+
if (candidate.negative)
|
|
3629
3380
|
return;
|
|
3630
|
-
}
|
|
3631
3381
|
if (candidate.value === null) {
|
|
3632
3382
|
return [filterProperties(), decl("filter", cssFilterValue)];
|
|
3633
3383
|
}
|
|
3634
3384
|
if (candidate.value.kind === "arbitrary") {
|
|
3635
|
-
return;
|
|
3385
|
+
return [decl("filter", candidate.value.value)];
|
|
3636
3386
|
}
|
|
3637
3387
|
switch (candidate.value.value) {
|
|
3638
3388
|
case "none":
|
|
@@ -3640,9 +3390,8 @@ function createUtilities(theme) {
|
|
|
3640
3390
|
}
|
|
3641
3391
|
});
|
|
3642
3392
|
utilities.functional("backdrop-filter", (candidate) => {
|
|
3643
|
-
if (candidate.negative)
|
|
3393
|
+
if (candidate.negative)
|
|
3644
3394
|
return;
|
|
3645
|
-
}
|
|
3646
3395
|
if (candidate.value === null) {
|
|
3647
3396
|
return [
|
|
3648
3397
|
backdropFilterProperties(),
|
|
@@ -3651,7 +3400,10 @@ function createUtilities(theme) {
|
|
|
3651
3400
|
];
|
|
3652
3401
|
}
|
|
3653
3402
|
if (candidate.value.kind === "arbitrary") {
|
|
3654
|
-
return
|
|
3403
|
+
return [
|
|
3404
|
+
decl("-webkit-backdrop-filter", candidate.value.value),
|
|
3405
|
+
decl("backdrop-filter", candidate.value.value)
|
|
3406
|
+
];
|
|
3655
3407
|
}
|
|
3656
3408
|
switch (candidate.value.value) {
|
|
3657
3409
|
case "none":
|
|
@@ -3694,6 +3446,18 @@ function createUtilities(theme) {
|
|
|
3694
3446
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3695
3447
|
]
|
|
3696
3448
|
});
|
|
3449
|
+
suggest("brightness", () => [
|
|
3450
|
+
{
|
|
3451
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
3452
|
+
valueThemeKeys: ["--brightness"]
|
|
3453
|
+
}
|
|
3454
|
+
]);
|
|
3455
|
+
suggest("backdrop-brightness", () => [
|
|
3456
|
+
{
|
|
3457
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
3458
|
+
valueThemeKeys: ["--backdrop-brightness", "--brightness"]
|
|
3459
|
+
}
|
|
3460
|
+
]);
|
|
3697
3461
|
functionalUtility("contrast", {
|
|
3698
3462
|
themeKeys: ["--contrast"],
|
|
3699
3463
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -3713,6 +3477,18 @@ function createUtilities(theme) {
|
|
|
3713
3477
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3714
3478
|
]
|
|
3715
3479
|
});
|
|
3480
|
+
suggest("contrast", () => [
|
|
3481
|
+
{
|
|
3482
|
+
values: ["0", "50", "75", "100", "125", "150", "200"],
|
|
3483
|
+
valueThemeKeys: ["--contrast"]
|
|
3484
|
+
}
|
|
3485
|
+
]);
|
|
3486
|
+
suggest("backdrop-contrast", () => [
|
|
3487
|
+
{
|
|
3488
|
+
values: ["0", "50", "75", "100", "125", "150", "200"],
|
|
3489
|
+
valueThemeKeys: ["--backdrop-contrast", "--contrast"]
|
|
3490
|
+
}
|
|
3491
|
+
]);
|
|
3716
3492
|
functionalUtility("grayscale", {
|
|
3717
3493
|
themeKeys: ["--grayscale"],
|
|
3718
3494
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -3734,6 +3510,20 @@ function createUtilities(theme) {
|
|
|
3734
3510
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3735
3511
|
]
|
|
3736
3512
|
});
|
|
3513
|
+
suggest("grayscale", () => [
|
|
3514
|
+
{
|
|
3515
|
+
values: ["0", "25", "50", "75", "100"],
|
|
3516
|
+
valueThemeKeys: ["--grayscale"],
|
|
3517
|
+
hasDefaultValue: true
|
|
3518
|
+
}
|
|
3519
|
+
]);
|
|
3520
|
+
suggest("backdrop-grayscale", () => [
|
|
3521
|
+
{
|
|
3522
|
+
values: ["0", "25", "50", "75", "100"],
|
|
3523
|
+
valueThemeKeys: ["--backdrop-grayscale", "--grayscale"],
|
|
3524
|
+
hasDefaultValue: true
|
|
3525
|
+
}
|
|
3526
|
+
]);
|
|
3737
3527
|
functionalUtility("hue-rotate", {
|
|
3738
3528
|
themeKeys: ["--hue-rotate"],
|
|
3739
3529
|
handleBareValue: ({ value }) => `${value}deg`,
|
|
@@ -3753,6 +3543,18 @@ function createUtilities(theme) {
|
|
|
3753
3543
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3754
3544
|
]
|
|
3755
3545
|
});
|
|
3546
|
+
suggest("hue-rotate", () => [
|
|
3547
|
+
{
|
|
3548
|
+
values: ["0", "15", "30", "60", "90", "180"],
|
|
3549
|
+
valueThemeKeys: ["--hue-rotate"]
|
|
3550
|
+
}
|
|
3551
|
+
]);
|
|
3552
|
+
suggest("backdrop-hue-rotate", () => [
|
|
3553
|
+
{
|
|
3554
|
+
values: ["0", "15", "30", "60", "90", "180"],
|
|
3555
|
+
valueThemeKeys: ["--backdrop-hue-rotate", "--hue-rotate"]
|
|
3556
|
+
}
|
|
3557
|
+
]);
|
|
3756
3558
|
functionalUtility("invert", {
|
|
3757
3559
|
themeKeys: ["--invert"],
|
|
3758
3560
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -3774,6 +3576,20 @@ function createUtilities(theme) {
|
|
|
3774
3576
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3775
3577
|
]
|
|
3776
3578
|
});
|
|
3579
|
+
suggest("invert", () => [
|
|
3580
|
+
{
|
|
3581
|
+
values: ["0", "25", "50", "75", "100"],
|
|
3582
|
+
valueThemeKeys: ["--invert"],
|
|
3583
|
+
hasDefaultValue: true
|
|
3584
|
+
}
|
|
3585
|
+
]);
|
|
3586
|
+
suggest("backdrop-invert", () => [
|
|
3587
|
+
{
|
|
3588
|
+
values: ["0", "25", "50", "75", "100"],
|
|
3589
|
+
valueThemeKeys: ["--backdrop-invert", "--invert"],
|
|
3590
|
+
hasDefaultValue: true
|
|
3591
|
+
}
|
|
3592
|
+
]);
|
|
3777
3593
|
functionalUtility("saturate", {
|
|
3778
3594
|
themeKeys: ["--saturate"],
|
|
3779
3595
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -3793,6 +3609,18 @@ function createUtilities(theme) {
|
|
|
3793
3609
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3794
3610
|
]
|
|
3795
3611
|
});
|
|
3612
|
+
suggest("saturate", () => [
|
|
3613
|
+
{
|
|
3614
|
+
values: ["0", "50", "100", "150", "200"],
|
|
3615
|
+
valueThemeKeys: ["--saturate"]
|
|
3616
|
+
}
|
|
3617
|
+
]);
|
|
3618
|
+
suggest("backdrop-saturate", () => [
|
|
3619
|
+
{
|
|
3620
|
+
values: ["0", "50", "100", "150", "200"],
|
|
3621
|
+
valueThemeKeys: ["--backdrop-saturate", "--saturate"]
|
|
3622
|
+
}
|
|
3623
|
+
]);
|
|
3796
3624
|
functionalUtility("sepia", {
|
|
3797
3625
|
themeKeys: ["--sepia"],
|
|
3798
3626
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -3814,6 +3642,20 @@ function createUtilities(theme) {
|
|
|
3814
3642
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3815
3643
|
]
|
|
3816
3644
|
});
|
|
3645
|
+
suggest("sepia", () => [
|
|
3646
|
+
{
|
|
3647
|
+
values: ["0", "50", "100"],
|
|
3648
|
+
valueThemeKeys: ["--sepia"],
|
|
3649
|
+
hasDefaultValue: true
|
|
3650
|
+
}
|
|
3651
|
+
]);
|
|
3652
|
+
suggest("backdrop-sepia", () => [
|
|
3653
|
+
{
|
|
3654
|
+
values: ["0", "50", "100"],
|
|
3655
|
+
valueThemeKeys: ["--backdrop-sepia", "--sepia"],
|
|
3656
|
+
hasDefaultValue: true
|
|
3657
|
+
}
|
|
3658
|
+
]);
|
|
3817
3659
|
functionalUtility("drop-shadow", {
|
|
3818
3660
|
themeKeys: ["--drop-shadow"],
|
|
3819
3661
|
handle: (value) => [
|
|
@@ -3828,7 +3670,6 @@ function createUtilities(theme) {
|
|
|
3828
3670
|
functionalUtility("backdrop-opacity", {
|
|
3829
3671
|
themeKeys: ["--backdrop-opacity", "--opacity"],
|
|
3830
3672
|
handleBareValue: ({ value }) => `${value}%`,
|
|
3831
|
-
defaultValue: "100%",
|
|
3832
3673
|
handle: (value) => [
|
|
3833
3674
|
backdropFilterProperties(),
|
|
3834
3675
|
decl("--tw-backdrop-opacity", `opacity(${value})`),
|
|
@@ -3836,6 +3677,12 @@ function createUtilities(theme) {
|
|
|
3836
3677
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3837
3678
|
]
|
|
3838
3679
|
});
|
|
3680
|
+
suggest("backdrop-opacity", () => [
|
|
3681
|
+
{
|
|
3682
|
+
values: Array.from({ length: 21 }, (_, i) => `${i * 5}`),
|
|
3683
|
+
valueThemeKeys: ["--backdrop-opacity", "--opacity"]
|
|
3684
|
+
}
|
|
3685
|
+
]);
|
|
3839
3686
|
}
|
|
3840
3687
|
{
|
|
3841
3688
|
let defaultTimingFunction = "var(--default-transition-timing-function)";
|
|
@@ -3895,14 +3742,26 @@ function createUtilities(theme) {
|
|
|
3895
3742
|
value = theme.resolve(candidate.value.fraction ?? candidate.value.value, [
|
|
3896
3743
|
"--transition-duration"
|
|
3897
3744
|
]);
|
|
3898
|
-
if (
|
|
3745
|
+
if (value === null && !Number.isNaN(Number(candidate.value.value))) {
|
|
3899
3746
|
value = `${candidate.value.value}ms`;
|
|
3900
3747
|
}
|
|
3901
|
-
if (!value)
|
|
3902
|
-
return;
|
|
3903
3748
|
}
|
|
3749
|
+
if (value === null)
|
|
3750
|
+
return;
|
|
3904
3751
|
return [decl("transition-duration", value)];
|
|
3905
3752
|
});
|
|
3753
|
+
suggest("delay", () => [
|
|
3754
|
+
{
|
|
3755
|
+
values: ["75", "100", "150", "200", "300", "500", "700", "1000"],
|
|
3756
|
+
valueThemeKeys: ["--transition-delay"]
|
|
3757
|
+
}
|
|
3758
|
+
]);
|
|
3759
|
+
suggest("duration", () => [
|
|
3760
|
+
{
|
|
3761
|
+
values: ["75", "100", "150", "200", "300", "500", "700", "1000"],
|
|
3762
|
+
valueThemeKeys: ["--transition-duration"]
|
|
3763
|
+
}
|
|
3764
|
+
]);
|
|
3906
3765
|
}
|
|
3907
3766
|
functionalUtility("ease", {
|
|
3908
3767
|
themeKeys: ["--transition-timing-function"],
|
|
@@ -4040,61 +3899,121 @@ function createUtilities(theme) {
|
|
|
4040
3899
|
["font-variant-numeric", cssFontVariantNumericValue]
|
|
4041
3900
|
]);
|
|
4042
3901
|
}
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
3902
|
+
{
|
|
3903
|
+
let outlineProperties = () => {
|
|
3904
|
+
return atRoot([property("--tw-outline-style", "solid", "<custom-ident>")]);
|
|
3905
|
+
};
|
|
3906
|
+
staticUtility("outline-none", [
|
|
3907
|
+
["outline", "2px solid transparent"],
|
|
3908
|
+
["outline-offset", "2px"]
|
|
3909
|
+
]);
|
|
3910
|
+
staticUtility("outline-solid", [
|
|
3911
|
+
["--tw-outline-style", "solid"],
|
|
3912
|
+
["outline-style", "solid"]
|
|
3913
|
+
]);
|
|
3914
|
+
staticUtility("outline-dashed", [
|
|
3915
|
+
["--tw-outline-style", "dashed"],
|
|
3916
|
+
["outline-style", "dashed"]
|
|
3917
|
+
]);
|
|
3918
|
+
staticUtility("outline-dotted", [
|
|
3919
|
+
["--tw-outline-style", "dotted"],
|
|
3920
|
+
["outline-style", "dotted"]
|
|
3921
|
+
]);
|
|
3922
|
+
staticUtility("outline-double", [
|
|
3923
|
+
["--tw-outline-style", "double"],
|
|
3924
|
+
["outline-style", "double"]
|
|
3925
|
+
]);
|
|
3926
|
+
utilities.functional("outline", (candidate) => {
|
|
3927
|
+
if (candidate.negative)
|
|
3928
|
+
return;
|
|
3929
|
+
if (candidate.value === null) {
|
|
3930
|
+
return [
|
|
3931
|
+
outlineProperties(),
|
|
3932
|
+
decl("outline-style", "var(--tw-outline-style)"),
|
|
3933
|
+
decl("outline-width", "1px")
|
|
3934
|
+
];
|
|
3935
|
+
}
|
|
3936
|
+
if (candidate.value.kind === "arbitrary") {
|
|
3937
|
+
let value = candidate.value.value;
|
|
3938
|
+
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "number", "percentage"]);
|
|
3939
|
+
switch (type) {
|
|
3940
|
+
case "length":
|
|
3941
|
+
case "number":
|
|
3942
|
+
case "percentage": {
|
|
3943
|
+
return [
|
|
3944
|
+
outlineProperties(),
|
|
3945
|
+
decl("outline-style", "var(--tw-outline-style)"),
|
|
3946
|
+
decl("outline-width", value)
|
|
3947
|
+
];
|
|
3948
|
+
}
|
|
3949
|
+
default: {
|
|
3950
|
+
value = asColor(value, candidate.modifier, theme);
|
|
3951
|
+
if (value === null)
|
|
3952
|
+
return;
|
|
3953
|
+
return [decl("outline-color", value)];
|
|
3954
|
+
}
|
|
4065
3955
|
}
|
|
4066
|
-
|
|
4067
|
-
|
|
3956
|
+
}
|
|
3957
|
+
{
|
|
3958
|
+
let value = resolveThemeColor(candidate, theme, ["--outline-color", "--color"]);
|
|
3959
|
+
if (value) {
|
|
4068
3960
|
return [decl("outline-color", value)];
|
|
4069
3961
|
}
|
|
4070
3962
|
}
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
3963
|
+
{
|
|
3964
|
+
let value = theme.resolve(candidate.value.value, ["--outline-width"]);
|
|
3965
|
+
if (value) {
|
|
3966
|
+
return [
|
|
3967
|
+
outlineProperties(),
|
|
3968
|
+
decl("outline-style", "var(--tw-outline-style)"),
|
|
3969
|
+
decl("outline-width", value)
|
|
3970
|
+
];
|
|
3971
|
+
} else if (!Number.isNaN(Number(candidate.value.value))) {
|
|
3972
|
+
return [
|
|
3973
|
+
outlineProperties(),
|
|
3974
|
+
decl("outline-style", "var(--tw-outline-style)"),
|
|
3975
|
+
decl("outline-width", `${candidate.value.value}px`)
|
|
3976
|
+
];
|
|
3977
|
+
}
|
|
4076
3978
|
}
|
|
4077
|
-
}
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
3979
|
+
});
|
|
3980
|
+
suggest("outline", () => [
|
|
3981
|
+
{
|
|
3982
|
+
values: ["current", "transparent"],
|
|
3983
|
+
valueThemeKeys: ["--outline-color", "--color"],
|
|
3984
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
3985
|
+
modifierThemeKeys: ["--opacity"],
|
|
3986
|
+
hasDefaultValue: true
|
|
3987
|
+
},
|
|
3988
|
+
{
|
|
3989
|
+
values: ["0", "1", "2", "4", "8"],
|
|
3990
|
+
valueThemeKeys: ["--outline-width"]
|
|
4084
3991
|
}
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
3992
|
+
]);
|
|
3993
|
+
functionalUtility("outline-offset", {
|
|
3994
|
+
supportsNegative: true,
|
|
3995
|
+
themeKeys: ["--outline-offset"],
|
|
3996
|
+
handleBareValue: ({ value }) => `${value}px`,
|
|
3997
|
+
handle: (value) => [decl("outline-offset", value)]
|
|
3998
|
+
});
|
|
3999
|
+
suggest("outline-offset", () => [
|
|
4000
|
+
{
|
|
4001
|
+
values: ["0", "1", "2", "4", "8"],
|
|
4002
|
+
valueThemeKeys: ["--outline-offset"]
|
|
4003
|
+
}
|
|
4004
|
+
]);
|
|
4005
|
+
}
|
|
4093
4006
|
functionalUtility("opacity", {
|
|
4094
4007
|
themeKeys: ["--opacity"],
|
|
4095
4008
|
handleBareValue: ({ value }) => `${value}%`,
|
|
4096
4009
|
handle: (value) => [decl("opacity", value)]
|
|
4097
4010
|
});
|
|
4011
|
+
suggest("opacity", () => [
|
|
4012
|
+
{
|
|
4013
|
+
values: Array.from({ length: 21 }, (_, i) => `${i * 5}`),
|
|
4014
|
+
valueThemeKeys: ["--opacity"]
|
|
4015
|
+
}
|
|
4016
|
+
]);
|
|
4098
4017
|
staticUtility("underline-offset-auto", [["text-underline-offset", "auto"]]);
|
|
4099
4018
|
functionalUtility("underline-offset", {
|
|
4100
4019
|
supportsNegative: true,
|
|
@@ -4102,10 +4021,16 @@ function createUtilities(theme) {
|
|
|
4102
4021
|
handleBareValue: ({ value }) => `${value}px`,
|
|
4103
4022
|
handle: (value) => [decl("text-underline-offset", value)]
|
|
4104
4023
|
});
|
|
4024
|
+
suggest("underline-offset", () => [
|
|
4025
|
+
{
|
|
4026
|
+
supportsNegative: true,
|
|
4027
|
+
values: ["0", "1", "2", "4", "8"],
|
|
4028
|
+
valueThemeKeys: ["--text-underline-offset"]
|
|
4029
|
+
}
|
|
4030
|
+
]);
|
|
4105
4031
|
utilities.functional("text", (candidate) => {
|
|
4106
|
-
if (candidate.negative || !candidate.value)
|
|
4032
|
+
if (candidate.negative || !candidate.value)
|
|
4107
4033
|
return;
|
|
4108
|
-
}
|
|
4109
4034
|
if (candidate.value.kind === "arbitrary") {
|
|
4110
4035
|
let value = candidate.value.value;
|
|
4111
4036
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage", "absolute-size", "relative-size"]);
|
|
@@ -4125,6 +4050,8 @@ function createUtilities(theme) {
|
|
|
4125
4050
|
}
|
|
4126
4051
|
default: {
|
|
4127
4052
|
value = asColor(value, candidate.modifier, theme);
|
|
4053
|
+
if (value === null)
|
|
4054
|
+
return;
|
|
4128
4055
|
return [decl("color", value)];
|
|
4129
4056
|
}
|
|
4130
4057
|
}
|
|
@@ -4161,18 +4088,32 @@ function createUtilities(theme) {
|
|
|
4161
4088
|
}
|
|
4162
4089
|
}
|
|
4163
4090
|
});
|
|
4091
|
+
suggest("text", () => [
|
|
4092
|
+
{
|
|
4093
|
+
values: ["current", "transparent"],
|
|
4094
|
+
valueThemeKeys: ["--text-color", "--color"],
|
|
4095
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4096
|
+
modifierThemeKeys: ["--opacity"]
|
|
4097
|
+
},
|
|
4098
|
+
{
|
|
4099
|
+
values: [],
|
|
4100
|
+
valueThemeKeys: ["--font-size"],
|
|
4101
|
+
modifiers: [],
|
|
4102
|
+
modifierThemeKeys: ["--line-height"]
|
|
4103
|
+
}
|
|
4104
|
+
]);
|
|
4164
4105
|
{
|
|
4165
4106
|
let ringShadowValue2 = function(value) {
|
|
4166
|
-
return `var(--tw-ring-inset,) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color,
|
|
4107
|
+
return `var(--tw-ring-inset,) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color, ${defaultRingColor})`;
|
|
4167
4108
|
}, insetRingShadowValue2 = function(value) {
|
|
4168
4109
|
return `inset 0 0 0 ${value} var(--tw-inset-ring-color, currentColor)`;
|
|
4169
4110
|
};
|
|
4170
4111
|
let cssBoxShadowValue = [
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4112
|
+
"var(--tw-inset-shadow)",
|
|
4113
|
+
"var(--tw-inset-ring-shadow)",
|
|
4114
|
+
"var(--tw-ring-offset-shadow)",
|
|
4115
|
+
"var(--tw-ring-shadow)",
|
|
4116
|
+
"var(--tw-shadow)"
|
|
4176
4117
|
].join(", ");
|
|
4177
4118
|
let nullShadow = "0 0 #0000";
|
|
4178
4119
|
let boxShadowProperties = () => {
|
|
@@ -4193,12 +4134,11 @@ function createUtilities(theme) {
|
|
|
4193
4134
|
]);
|
|
4194
4135
|
};
|
|
4195
4136
|
utilities.functional("shadow", (candidate) => {
|
|
4196
|
-
if (candidate.negative)
|
|
4137
|
+
if (candidate.negative)
|
|
4197
4138
|
return;
|
|
4198
|
-
}
|
|
4199
4139
|
if (!candidate.value) {
|
|
4200
4140
|
let value = theme.get(["--shadow"]);
|
|
4201
|
-
if (
|
|
4141
|
+
if (value === null)
|
|
4202
4142
|
return;
|
|
4203
4143
|
return [
|
|
4204
4144
|
boxShadowProperties(),
|
|
@@ -4213,6 +4153,8 @@ function createUtilities(theme) {
|
|
|
4213
4153
|
switch (type) {
|
|
4214
4154
|
case "color": {
|
|
4215
4155
|
value = asColor(value, candidate.modifier, theme);
|
|
4156
|
+
if (value === null)
|
|
4157
|
+
return;
|
|
4216
4158
|
return [
|
|
4217
4159
|
boxShadowProperties(),
|
|
4218
4160
|
decl("--tw-shadow-color", value),
|
|
@@ -4260,13 +4202,25 @@ function createUtilities(theme) {
|
|
|
4260
4202
|
}
|
|
4261
4203
|
}
|
|
4262
4204
|
});
|
|
4205
|
+
suggest("shadow", () => [
|
|
4206
|
+
{
|
|
4207
|
+
values: ["current", "transparent"],
|
|
4208
|
+
valueThemeKeys: ["--box-shadow-color", "--color"],
|
|
4209
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4210
|
+
modifierThemeKeys: ["--opacity"]
|
|
4211
|
+
},
|
|
4212
|
+
{
|
|
4213
|
+
values: [],
|
|
4214
|
+
valueThemeKeys: ["--shadow"],
|
|
4215
|
+
hasDefaultValue: true
|
|
4216
|
+
}
|
|
4217
|
+
]);
|
|
4263
4218
|
utilities.functional("inset-shadow", (candidate) => {
|
|
4264
|
-
if (candidate.negative)
|
|
4219
|
+
if (candidate.negative)
|
|
4265
4220
|
return;
|
|
4266
|
-
}
|
|
4267
4221
|
if (!candidate.value) {
|
|
4268
4222
|
let value = theme.get(["--inset-shadow"]);
|
|
4269
|
-
if (
|
|
4223
|
+
if (value === null)
|
|
4270
4224
|
return;
|
|
4271
4225
|
return [
|
|
4272
4226
|
boxShadowProperties(),
|
|
@@ -4284,6 +4238,8 @@ function createUtilities(theme) {
|
|
|
4284
4238
|
switch (type) {
|
|
4285
4239
|
case "color": {
|
|
4286
4240
|
value = asColor(value, candidate.modifier, theme);
|
|
4241
|
+
if (value === null)
|
|
4242
|
+
return;
|
|
4287
4243
|
return [
|
|
4288
4244
|
boxShadowProperties(),
|
|
4289
4245
|
decl("--tw-inset-shadow-color", value),
|
|
@@ -4337,14 +4293,29 @@ function createUtilities(theme) {
|
|
|
4337
4293
|
}
|
|
4338
4294
|
}
|
|
4339
4295
|
});
|
|
4296
|
+
suggest("inset-shadow", () => [
|
|
4297
|
+
{
|
|
4298
|
+
values: ["current", "transparent"],
|
|
4299
|
+
valueThemeKeys: ["--box-shadow-color", "--color"],
|
|
4300
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4301
|
+
modifierThemeKeys: ["--opacity"]
|
|
4302
|
+
},
|
|
4303
|
+
{
|
|
4304
|
+
values: [],
|
|
4305
|
+
valueThemeKeys: ["--shadow"],
|
|
4306
|
+
hasDefaultValue: true
|
|
4307
|
+
}
|
|
4308
|
+
]);
|
|
4340
4309
|
staticUtility("ring-inset", [boxShadowProperties, ["--tw-ring-inset", "inset"]]);
|
|
4310
|
+
let defaultRingColor = theme.get(["--default-ring-color"]) ?? "currentColor";
|
|
4341
4311
|
utilities.functional("ring", (candidate) => {
|
|
4342
4312
|
if (candidate.negative)
|
|
4343
4313
|
return;
|
|
4344
4314
|
if (!candidate.value) {
|
|
4315
|
+
let value = theme.get(["--default-ring-width"]) ?? "1px";
|
|
4345
4316
|
return [
|
|
4346
4317
|
boxShadowProperties(),
|
|
4347
|
-
decl("--tw-ring-shadow", ringShadowValue2(
|
|
4318
|
+
decl("--tw-ring-shadow", ringShadowValue2(value)),
|
|
4348
4319
|
decl("box-shadow", cssBoxShadowValue)
|
|
4349
4320
|
];
|
|
4350
4321
|
}
|
|
@@ -4361,6 +4332,8 @@ function createUtilities(theme) {
|
|
|
4361
4332
|
}
|
|
4362
4333
|
default: {
|
|
4363
4334
|
value = asColor(value, candidate.modifier, theme);
|
|
4335
|
+
if (value === null)
|
|
4336
|
+
return;
|
|
4364
4337
|
return [decl("--tw-ring-color", value)];
|
|
4365
4338
|
}
|
|
4366
4339
|
}
|
|
@@ -4373,7 +4346,7 @@ function createUtilities(theme) {
|
|
|
4373
4346
|
}
|
|
4374
4347
|
{
|
|
4375
4348
|
let value = theme.resolve(candidate.value.value, ["--ring-width"]);
|
|
4376
|
-
if (
|
|
4349
|
+
if (value === null && !Number.isNaN(Number(candidate.value.value))) {
|
|
4377
4350
|
value = `${candidate.value.value}px`;
|
|
4378
4351
|
}
|
|
4379
4352
|
if (value) {
|
|
@@ -4385,6 +4358,19 @@ function createUtilities(theme) {
|
|
|
4385
4358
|
}
|
|
4386
4359
|
}
|
|
4387
4360
|
});
|
|
4361
|
+
suggest("ring", () => [
|
|
4362
|
+
{
|
|
4363
|
+
values: ["current", "transparent"],
|
|
4364
|
+
valueThemeKeys: ["--ring-color", "--color"],
|
|
4365
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4366
|
+
modifierThemeKeys: ["--opacity"]
|
|
4367
|
+
},
|
|
4368
|
+
{
|
|
4369
|
+
values: ["0", "1", "2", "4", "8"],
|
|
4370
|
+
valueThemeKeys: ["--ring-width"],
|
|
4371
|
+
hasDefaultValue: true
|
|
4372
|
+
}
|
|
4373
|
+
]);
|
|
4388
4374
|
utilities.functional("inset-ring", (candidate) => {
|
|
4389
4375
|
if (candidate.negative)
|
|
4390
4376
|
return;
|
|
@@ -4408,6 +4394,8 @@ function createUtilities(theme) {
|
|
|
4408
4394
|
}
|
|
4409
4395
|
default: {
|
|
4410
4396
|
value = asColor(value, candidate.modifier, theme);
|
|
4397
|
+
if (value === null)
|
|
4398
|
+
return;
|
|
4411
4399
|
return [decl("--tw-inset-ring-color", value)];
|
|
4412
4400
|
}
|
|
4413
4401
|
}
|
|
@@ -4420,7 +4408,7 @@ function createUtilities(theme) {
|
|
|
4420
4408
|
}
|
|
4421
4409
|
{
|
|
4422
4410
|
let value = theme.resolve(candidate.value.value, ["--ring-width"]);
|
|
4423
|
-
if (
|
|
4411
|
+
if (value === null && !Number.isNaN(Number(candidate.value.value))) {
|
|
4424
4412
|
value = `${candidate.value.value}px`;
|
|
4425
4413
|
}
|
|
4426
4414
|
if (value) {
|
|
@@ -4432,11 +4420,23 @@ function createUtilities(theme) {
|
|
|
4432
4420
|
}
|
|
4433
4421
|
}
|
|
4434
4422
|
});
|
|
4423
|
+
suggest("inset-ring", () => [
|
|
4424
|
+
{
|
|
4425
|
+
values: ["current", "transparent"],
|
|
4426
|
+
valueThemeKeys: ["--ring-color", "--color"],
|
|
4427
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4428
|
+
modifierThemeKeys: ["--opacity"]
|
|
4429
|
+
},
|
|
4430
|
+
{
|
|
4431
|
+
values: ["0", "1", "2", "4", "8"],
|
|
4432
|
+
valueThemeKeys: ["--ring-width"],
|
|
4433
|
+
hasDefaultValue: true
|
|
4434
|
+
}
|
|
4435
|
+
]);
|
|
4435
4436
|
let ringOffsetShadowValue = "var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)";
|
|
4436
4437
|
utilities.functional("ring-offset", (candidate) => {
|
|
4437
|
-
if (candidate.negative || !candidate.value)
|
|
4438
|
+
if (candidate.negative || !candidate.value)
|
|
4438
4439
|
return;
|
|
4439
|
-
}
|
|
4440
4440
|
if (candidate.value.kind === "arbitrary") {
|
|
4441
4441
|
let value = candidate.value.value;
|
|
4442
4442
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length"]);
|
|
@@ -4449,6 +4449,8 @@ function createUtilities(theme) {
|
|
|
4449
4449
|
}
|
|
4450
4450
|
default: {
|
|
4451
4451
|
value = asColor(value, candidate.modifier, theme);
|
|
4452
|
+
if (value === null)
|
|
4453
|
+
return;
|
|
4452
4454
|
return [decl("--tw-ring-offset-color", value)];
|
|
4453
4455
|
}
|
|
4454
4456
|
}
|
|
@@ -4460,7 +4462,7 @@ function createUtilities(theme) {
|
|
|
4460
4462
|
decl("--tw-ring-offset-width", value),
|
|
4461
4463
|
decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
|
|
4462
4464
|
];
|
|
4463
|
-
} else if (!isNaN(Number(candidate.value.value))) {
|
|
4465
|
+
} else if (!Number.isNaN(Number(candidate.value.value))) {
|
|
4464
4466
|
return [
|
|
4465
4467
|
decl("--tw-ring-offset-width", `${candidate.value.value}px`),
|
|
4466
4468
|
decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
|
|
@@ -4475,6 +4477,43 @@ function createUtilities(theme) {
|
|
|
4475
4477
|
}
|
|
4476
4478
|
});
|
|
4477
4479
|
}
|
|
4480
|
+
suggest("ring-offset", () => [
|
|
4481
|
+
{
|
|
4482
|
+
values: ["current", "transparent"],
|
|
4483
|
+
valueThemeKeys: ["--ring-offset-color", "--color"],
|
|
4484
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4485
|
+
modifierThemeKeys: ["--opacity"]
|
|
4486
|
+
},
|
|
4487
|
+
{
|
|
4488
|
+
values: ["0", "1", "2", "4", "8"],
|
|
4489
|
+
valueThemeKeys: ["--ring-offset-width"]
|
|
4490
|
+
}
|
|
4491
|
+
]);
|
|
4492
|
+
utilities.functional("@container", (candidate) => {
|
|
4493
|
+
if (candidate.negative)
|
|
4494
|
+
return;
|
|
4495
|
+
let value = null;
|
|
4496
|
+
if (candidate.value === null) {
|
|
4497
|
+
value = "inline-size";
|
|
4498
|
+
} else if (candidate.value.kind === "arbitrary") {
|
|
4499
|
+
value = candidate.value.value;
|
|
4500
|
+
} else if (candidate.value.kind === "named" && candidate.value.value === "normal") {
|
|
4501
|
+
value = "normal";
|
|
4502
|
+
}
|
|
4503
|
+
if (value === null)
|
|
4504
|
+
return;
|
|
4505
|
+
if (candidate.modifier) {
|
|
4506
|
+
return [decl("container-type", value), decl("container-name", candidate.modifier.value)];
|
|
4507
|
+
}
|
|
4508
|
+
return [decl("container-type", value)];
|
|
4509
|
+
});
|
|
4510
|
+
suggest("@container", () => [
|
|
4511
|
+
{
|
|
4512
|
+
values: ["normal"],
|
|
4513
|
+
valueThemeKeys: [],
|
|
4514
|
+
hasDefaultValue: false
|
|
4515
|
+
}
|
|
4516
|
+
]);
|
|
4478
4517
|
return utilities;
|
|
4479
4518
|
}
|
|
4480
4519
|
|
|
@@ -4482,6 +4521,7 @@ function createUtilities(theme) {
|
|
|
4482
4521
|
var Variants = class {
|
|
4483
4522
|
compareFns = /* @__PURE__ */ new Map();
|
|
4484
4523
|
variants = /* @__PURE__ */ new Map();
|
|
4524
|
+
completions = /* @__PURE__ */ new Map();
|
|
4485
4525
|
/**
|
|
4486
4526
|
* Registering a group of variants should result in the same sort number for
|
|
4487
4527
|
* all the variants. This is to ensure that the variants are applied in the
|
|
@@ -4513,7 +4553,7 @@ var Variants = class {
|
|
|
4513
4553
|
return this.variants.has(name);
|
|
4514
4554
|
}
|
|
4515
4555
|
get(name) {
|
|
4516
|
-
return this.variants.get(name)
|
|
4556
|
+
return this.variants.get(name);
|
|
4517
4557
|
}
|
|
4518
4558
|
kind(name) {
|
|
4519
4559
|
return this.variants.get(name)?.kind;
|
|
@@ -4521,6 +4561,12 @@ var Variants = class {
|
|
|
4521
4561
|
compounds(name) {
|
|
4522
4562
|
return this.variants.get(name)?.compounds;
|
|
4523
4563
|
}
|
|
4564
|
+
suggest(name, suggestions) {
|
|
4565
|
+
this.completions.set(name, suggestions);
|
|
4566
|
+
}
|
|
4567
|
+
getCompletions(name) {
|
|
4568
|
+
return this.completions.get(name)?.() ?? [];
|
|
4569
|
+
}
|
|
4524
4570
|
compare(a, z) {
|
|
4525
4571
|
if (a === z)
|
|
4526
4572
|
return 0;
|
|
@@ -4551,6 +4597,9 @@ var Variants = class {
|
|
|
4551
4597
|
keys() {
|
|
4552
4598
|
return this.variants.keys();
|
|
4553
4599
|
}
|
|
4600
|
+
entries() {
|
|
4601
|
+
return this.variants.entries();
|
|
4602
|
+
}
|
|
4554
4603
|
set(name, { kind, applyFn, compounds }) {
|
|
4555
4604
|
this.lastOrder = this.nextOrder();
|
|
4556
4605
|
this.variants.set(name, {
|
|
@@ -4586,11 +4635,21 @@ function createVariants(theme) {
|
|
|
4586
4635
|
ruleNode.selector = ruleNode.selector.replace("&", groupSelector);
|
|
4587
4636
|
ruleNode.selector = `&:is(${ruleNode.selector} *)`;
|
|
4588
4637
|
});
|
|
4638
|
+
variants.suggest("group", () => {
|
|
4639
|
+
return Array.from(variants.keys()).filter((name) => {
|
|
4640
|
+
return variants.get(name)?.compounds ?? false;
|
|
4641
|
+
});
|
|
4642
|
+
});
|
|
4589
4643
|
variants.compound("peer", (ruleNode, variant) => {
|
|
4590
4644
|
let peerSelector = variant.modifier ? `:where(.peer\\/${variant.modifier.value})` : ":where(.peer)";
|
|
4591
4645
|
ruleNode.selector = ruleNode.selector.replace("&", peerSelector);
|
|
4592
4646
|
ruleNode.selector = `&:is(${ruleNode.selector} ~ *)`;
|
|
4593
4647
|
});
|
|
4648
|
+
variants.suggest("peer", () => {
|
|
4649
|
+
return Array.from(variants.keys()).filter((name) => {
|
|
4650
|
+
return variants.get(name)?.compounds ?? false;
|
|
4651
|
+
});
|
|
4652
|
+
});
|
|
4594
4653
|
staticVariant("first-letter", ["&::first-letter"], { compounds: false });
|
|
4595
4654
|
staticVariant("first-line", ["&::first-line"], { compounds: false });
|
|
4596
4655
|
staticVariant("marker", ["& *::marker", "&::marker"], { compounds: false });
|
|
@@ -4684,177 +4743,980 @@ function createVariants(theme) {
|
|
|
4684
4743
|
for (let [key, value] of pseudos) {
|
|
4685
4744
|
staticVariant(key, [value]);
|
|
4686
4745
|
}
|
|
4687
|
-
variants.compound("has", (ruleNode) => {
|
|
4688
|
-
ruleNode.selector = `&:has(${ruleNode.selector.replace("&", "*")})`;
|
|
4746
|
+
variants.compound("has", (ruleNode) => {
|
|
4747
|
+
ruleNode.selector = `&:has(${ruleNode.selector.replace("&", "*")})`;
|
|
4748
|
+
});
|
|
4749
|
+
variants.suggest("has", () => {
|
|
4750
|
+
return Array.from(variants.keys()).filter((name) => {
|
|
4751
|
+
return variants.get(name)?.compounds ?? false;
|
|
4752
|
+
});
|
|
4753
|
+
});
|
|
4754
|
+
variants.functional("aria", (ruleNode, variant) => {
|
|
4755
|
+
if (variant.value === null)
|
|
4756
|
+
return null;
|
|
4757
|
+
if (variant.value.kind === "arbitrary") {
|
|
4758
|
+
ruleNode.nodes = [rule(`&[aria-${variant.value.value}]`, ruleNode.nodes)];
|
|
4759
|
+
} else {
|
|
4760
|
+
ruleNode.nodes = [rule(`&[aria-${variant.value.value}="true"]`, ruleNode.nodes)];
|
|
4761
|
+
}
|
|
4762
|
+
});
|
|
4763
|
+
variants.suggest("aria", () => [
|
|
4764
|
+
"busy",
|
|
4765
|
+
"checked",
|
|
4766
|
+
"disabled",
|
|
4767
|
+
"expanded",
|
|
4768
|
+
"hidden",
|
|
4769
|
+
"pressed",
|
|
4770
|
+
"readonly",
|
|
4771
|
+
"required",
|
|
4772
|
+
"selected"
|
|
4773
|
+
]);
|
|
4774
|
+
variants.functional("data", (ruleNode, variant) => {
|
|
4775
|
+
if (variant.value === null)
|
|
4776
|
+
return null;
|
|
4777
|
+
ruleNode.nodes = [rule(`&[data-${variant.value.value}]`, ruleNode.nodes)];
|
|
4778
|
+
});
|
|
4779
|
+
variants.functional(
|
|
4780
|
+
"supports",
|
|
4781
|
+
(ruleNode, variant) => {
|
|
4782
|
+
if (variant.value === null)
|
|
4783
|
+
return null;
|
|
4784
|
+
let value = variant.value.value;
|
|
4785
|
+
if (value === null)
|
|
4786
|
+
return null;
|
|
4787
|
+
if (/^\w*\s*\(/.test(value)) {
|
|
4788
|
+
let query = value.replace(/\b(and|or|not)\b/g, " $1 ");
|
|
4789
|
+
ruleNode.nodes = [rule(`@supports ${query}`, ruleNode.nodes)];
|
|
4790
|
+
return;
|
|
4791
|
+
}
|
|
4792
|
+
if (!value.includes(":")) {
|
|
4793
|
+
value = `${value}: var(--tw)`;
|
|
4794
|
+
}
|
|
4795
|
+
if (value[0] !== "(" || value[value.length - 1] !== ")") {
|
|
4796
|
+
value = `(${value})`;
|
|
4797
|
+
}
|
|
4798
|
+
ruleNode.nodes = [rule(`@supports ${value}`, ruleNode.nodes)];
|
|
4799
|
+
},
|
|
4800
|
+
{ compounds: false }
|
|
4801
|
+
);
|
|
4802
|
+
staticVariant("motion-safe", ["@media (prefers-reduced-motion: no-preference)"], {
|
|
4803
|
+
compounds: false
|
|
4804
|
+
});
|
|
4805
|
+
staticVariant("motion-reduce", ["@media (prefers-reduced-motion: reduce)"], { compounds: false });
|
|
4806
|
+
staticVariant("contrast-more", ["@media (prefers-contrast: more)"], { compounds: false });
|
|
4807
|
+
staticVariant("contrast-less", ["@media (prefers-contrast: less)"], { compounds: false });
|
|
4808
|
+
{
|
|
4809
|
+
let compareBreakpoints2 = function(a, z, direction, lookup) {
|
|
4810
|
+
if (a === z)
|
|
4811
|
+
return 0;
|
|
4812
|
+
let aValue = lookup.get(a);
|
|
4813
|
+
if (aValue === null)
|
|
4814
|
+
return direction === "asc" ? -1 : 1;
|
|
4815
|
+
let zValue = lookup.get(z);
|
|
4816
|
+
if (zValue === null)
|
|
4817
|
+
return direction === "asc" ? 1 : -1;
|
|
4818
|
+
if (aValue === zValue)
|
|
4819
|
+
return 0;
|
|
4820
|
+
let aIsCssFunction = aValue.indexOf("(");
|
|
4821
|
+
let zIsCssFunction = zValue.indexOf("(");
|
|
4822
|
+
let aBucket = aIsCssFunction === -1 ? (
|
|
4823
|
+
// No CSS function found, bucket by unit instead
|
|
4824
|
+
aValue.replace(/[\d.]+/g, "")
|
|
4825
|
+
) : (
|
|
4826
|
+
// CSS function found, bucket by function name
|
|
4827
|
+
aValue.slice(0, aIsCssFunction)
|
|
4828
|
+
);
|
|
4829
|
+
let zBucket = zIsCssFunction === -1 ? (
|
|
4830
|
+
// No CSS function found, bucket by unit
|
|
4831
|
+
zValue.replace(/[\d.]+/g, "")
|
|
4832
|
+
) : (
|
|
4833
|
+
// CSS function found, bucket by function name
|
|
4834
|
+
zValue.slice(0, zIsCssFunction)
|
|
4835
|
+
);
|
|
4836
|
+
let order = (
|
|
4837
|
+
// Compare by bucket name
|
|
4838
|
+
aBucket.localeCompare(zBucket) || // If bucket names are the same, compare by value
|
|
4839
|
+
(direction === "asc" ? parseInt(aValue) - parseInt(zValue) : parseInt(zValue) - parseInt(aValue))
|
|
4840
|
+
);
|
|
4841
|
+
if (Number.isNaN(order)) {
|
|
4842
|
+
return aValue.localeCompare(zValue);
|
|
4843
|
+
}
|
|
4844
|
+
return order;
|
|
4845
|
+
};
|
|
4846
|
+
{
|
|
4847
|
+
let breakpoints = theme.namespace("--breakpoint");
|
|
4848
|
+
let resolvedBreakpoints = new DefaultMap((variant) => {
|
|
4849
|
+
switch (variant.kind) {
|
|
4850
|
+
case "static": {
|
|
4851
|
+
return breakpoints.get(variant.root) ?? null;
|
|
4852
|
+
}
|
|
4853
|
+
case "functional": {
|
|
4854
|
+
if (variant.value === null)
|
|
4855
|
+
return null;
|
|
4856
|
+
let value = null;
|
|
4857
|
+
if (variant.value.kind === "arbitrary") {
|
|
4858
|
+
value = variant.value.value;
|
|
4859
|
+
} else if (variant.value.kind === "named") {
|
|
4860
|
+
value = theme.resolve(variant.value.value, ["--breakpoint"]);
|
|
4861
|
+
}
|
|
4862
|
+
if (!value)
|
|
4863
|
+
return null;
|
|
4864
|
+
if (value.includes("var("))
|
|
4865
|
+
return null;
|
|
4866
|
+
return value;
|
|
4867
|
+
}
|
|
4868
|
+
case "arbitrary":
|
|
4869
|
+
case "compound":
|
|
4870
|
+
return null;
|
|
4871
|
+
}
|
|
4872
|
+
});
|
|
4873
|
+
variants.group(
|
|
4874
|
+
() => {
|
|
4875
|
+
variants.functional(
|
|
4876
|
+
"max",
|
|
4877
|
+
(ruleNode, variant) => {
|
|
4878
|
+
let value = resolvedBreakpoints.get(variant);
|
|
4879
|
+
if (value === null)
|
|
4880
|
+
return null;
|
|
4881
|
+
ruleNode.nodes = [rule(`@media (width < ${value})`, ruleNode.nodes)];
|
|
4882
|
+
},
|
|
4883
|
+
{ compounds: false }
|
|
4884
|
+
);
|
|
4885
|
+
},
|
|
4886
|
+
(a, z) => compareBreakpoints2(a, z, "desc", resolvedBreakpoints)
|
|
4887
|
+
);
|
|
4888
|
+
variants.suggest(
|
|
4889
|
+
"max",
|
|
4890
|
+
() => Array.from(breakpoints.keys()).filter((key) => key !== null)
|
|
4891
|
+
);
|
|
4892
|
+
variants.group(
|
|
4893
|
+
() => {
|
|
4894
|
+
for (let [key, value] of theme.namespace("--breakpoint")) {
|
|
4895
|
+
if (key === null)
|
|
4896
|
+
continue;
|
|
4897
|
+
variants.static(
|
|
4898
|
+
key,
|
|
4899
|
+
(ruleNode) => {
|
|
4900
|
+
ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
|
|
4901
|
+
},
|
|
4902
|
+
{ compounds: false }
|
|
4903
|
+
);
|
|
4904
|
+
}
|
|
4905
|
+
variants.functional(
|
|
4906
|
+
"min",
|
|
4907
|
+
(ruleNode, variant) => {
|
|
4908
|
+
let value = resolvedBreakpoints.get(variant);
|
|
4909
|
+
if (value === null)
|
|
4910
|
+
return null;
|
|
4911
|
+
ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
|
|
4912
|
+
},
|
|
4913
|
+
{ compounds: false }
|
|
4914
|
+
);
|
|
4915
|
+
},
|
|
4916
|
+
(a, z) => compareBreakpoints2(a, z, "asc", resolvedBreakpoints)
|
|
4917
|
+
);
|
|
4918
|
+
variants.suggest(
|
|
4919
|
+
"min",
|
|
4920
|
+
() => Array.from(breakpoints.keys()).filter((key) => key !== null)
|
|
4921
|
+
);
|
|
4922
|
+
}
|
|
4923
|
+
{
|
|
4924
|
+
let widths = theme.namespace("--width");
|
|
4925
|
+
let resolvedWidths = new DefaultMap((variant) => {
|
|
4926
|
+
switch (variant.kind) {
|
|
4927
|
+
case "functional": {
|
|
4928
|
+
if (variant.value === null)
|
|
4929
|
+
return null;
|
|
4930
|
+
let value = null;
|
|
4931
|
+
if (variant.value.kind === "arbitrary") {
|
|
4932
|
+
value = variant.value.value;
|
|
4933
|
+
} else if (variant.value.kind === "named") {
|
|
4934
|
+
value = theme.resolve(variant.value.value, ["--width"]);
|
|
4935
|
+
}
|
|
4936
|
+
if (!value)
|
|
4937
|
+
return null;
|
|
4938
|
+
if (value.includes("var("))
|
|
4939
|
+
return null;
|
|
4940
|
+
return value;
|
|
4941
|
+
}
|
|
4942
|
+
case "static":
|
|
4943
|
+
case "arbitrary":
|
|
4944
|
+
case "compound":
|
|
4945
|
+
return null;
|
|
4946
|
+
}
|
|
4947
|
+
});
|
|
4948
|
+
variants.group(
|
|
4949
|
+
() => {
|
|
4950
|
+
variants.functional(
|
|
4951
|
+
"@max",
|
|
4952
|
+
(ruleNode, variant) => {
|
|
4953
|
+
let value = resolvedWidths.get(variant);
|
|
4954
|
+
if (value === null)
|
|
4955
|
+
return null;
|
|
4956
|
+
ruleNode.nodes = [
|
|
4957
|
+
rule(
|
|
4958
|
+
variant.modifier ? `@container ${variant.modifier.value} (width < ${value})` : `@container (width < ${value})`,
|
|
4959
|
+
ruleNode.nodes
|
|
4960
|
+
)
|
|
4961
|
+
];
|
|
4962
|
+
},
|
|
4963
|
+
{ compounds: false }
|
|
4964
|
+
);
|
|
4965
|
+
},
|
|
4966
|
+
(a, z) => compareBreakpoints2(a, z, "desc", resolvedWidths)
|
|
4967
|
+
);
|
|
4968
|
+
variants.suggest(
|
|
4969
|
+
"@max",
|
|
4970
|
+
() => Array.from(widths.keys()).filter((key) => key !== null)
|
|
4971
|
+
);
|
|
4972
|
+
variants.group(
|
|
4973
|
+
() => {
|
|
4974
|
+
variants.functional(
|
|
4975
|
+
"@",
|
|
4976
|
+
(ruleNode, variant) => {
|
|
4977
|
+
let value = resolvedWidths.get(variant);
|
|
4978
|
+
if (value === null)
|
|
4979
|
+
return null;
|
|
4980
|
+
ruleNode.nodes = [
|
|
4981
|
+
rule(
|
|
4982
|
+
variant.modifier ? `@container ${variant.modifier.value} (width >= ${value})` : `@container (width >= ${value})`,
|
|
4983
|
+
ruleNode.nodes
|
|
4984
|
+
)
|
|
4985
|
+
];
|
|
4986
|
+
},
|
|
4987
|
+
{ compounds: false }
|
|
4988
|
+
);
|
|
4989
|
+
variants.functional(
|
|
4990
|
+
"@min",
|
|
4991
|
+
(ruleNode, variant) => {
|
|
4992
|
+
let value = resolvedWidths.get(variant);
|
|
4993
|
+
if (value === null)
|
|
4994
|
+
return null;
|
|
4995
|
+
ruleNode.nodes = [
|
|
4996
|
+
rule(
|
|
4997
|
+
variant.modifier ? `@container ${variant.modifier.value} (width >= ${value})` : `@container (width >= ${value})`,
|
|
4998
|
+
ruleNode.nodes
|
|
4999
|
+
)
|
|
5000
|
+
];
|
|
5001
|
+
},
|
|
5002
|
+
{ compounds: false }
|
|
5003
|
+
);
|
|
5004
|
+
},
|
|
5005
|
+
(a, z) => compareBreakpoints2(a, z, "asc", resolvedWidths)
|
|
5006
|
+
);
|
|
5007
|
+
variants.suggest(
|
|
5008
|
+
"@min",
|
|
5009
|
+
() => Array.from(widths.keys()).filter((key) => key !== null)
|
|
5010
|
+
);
|
|
5011
|
+
}
|
|
5012
|
+
}
|
|
5013
|
+
staticVariant("portrait", ["@media (orientation: portrait)"], { compounds: false });
|
|
5014
|
+
staticVariant("landscape", ["@media (orientation: landscape)"], { compounds: false });
|
|
5015
|
+
staticVariant("ltr", ['&:where([dir="ltr"], [dir="ltr"] *)']);
|
|
5016
|
+
staticVariant("rtl", ['&:where([dir="rtl"], [dir="rtl"] *)']);
|
|
5017
|
+
staticVariant("dark", ["@media (prefers-color-scheme: dark)"], { compounds: false });
|
|
5018
|
+
staticVariant("print", ["@media print"], { compounds: false });
|
|
5019
|
+
staticVariant("forced-colors", ["@media (forced-colors: active)"], { compounds: false });
|
|
5020
|
+
return variants;
|
|
5021
|
+
}
|
|
5022
|
+
|
|
5023
|
+
// src/design-system.ts
|
|
5024
|
+
function buildDesignSystem(theme) {
|
|
5025
|
+
return {
|
|
5026
|
+
theme,
|
|
5027
|
+
utilities: createUtilities(theme),
|
|
5028
|
+
variants: createVariants(theme),
|
|
5029
|
+
candidatesToCss(classes) {
|
|
5030
|
+
let result = [];
|
|
5031
|
+
for (let className of classes) {
|
|
5032
|
+
let { astNodes } = compileCandidates([className], this, { throwOnInvalidCandidate: false });
|
|
5033
|
+
if (astNodes.length === 0) {
|
|
5034
|
+
result.push(null);
|
|
5035
|
+
} else {
|
|
5036
|
+
result.push(toCss(astNodes));
|
|
5037
|
+
}
|
|
5038
|
+
}
|
|
5039
|
+
return result;
|
|
5040
|
+
},
|
|
5041
|
+
getClassOrder(classes) {
|
|
5042
|
+
return getClassOrder(this, classes);
|
|
5043
|
+
},
|
|
5044
|
+
getClassList() {
|
|
5045
|
+
return getClassList(this);
|
|
5046
|
+
},
|
|
5047
|
+
getVariants() {
|
|
5048
|
+
return getVariants(this);
|
|
5049
|
+
}
|
|
5050
|
+
};
|
|
5051
|
+
}
|
|
5052
|
+
|
|
5053
|
+
// src/property-order.ts
|
|
5054
|
+
var property_order_default = [
|
|
5055
|
+
"container-type",
|
|
5056
|
+
"pointer-events",
|
|
5057
|
+
"visibility",
|
|
5058
|
+
"position",
|
|
5059
|
+
// How do we make `inset-x-0` come before `top-0`?
|
|
5060
|
+
"inset",
|
|
5061
|
+
"inset-inline",
|
|
5062
|
+
"inset-block",
|
|
5063
|
+
"inset-inline-start",
|
|
5064
|
+
"inset-inline-end",
|
|
5065
|
+
"top",
|
|
5066
|
+
"right",
|
|
5067
|
+
"bottom",
|
|
5068
|
+
"left",
|
|
5069
|
+
"isolation",
|
|
5070
|
+
"z-index",
|
|
5071
|
+
"order",
|
|
5072
|
+
"grid-column",
|
|
5073
|
+
"grid-column-start",
|
|
5074
|
+
"grid-column-end",
|
|
5075
|
+
"grid-row",
|
|
5076
|
+
"grid-row-start",
|
|
5077
|
+
"grid-row-end",
|
|
5078
|
+
"float",
|
|
5079
|
+
"clear",
|
|
5080
|
+
// How do we make `mx-0` come before `mt-0`?
|
|
5081
|
+
// Idea: `margin-x` property that we compile away with a Visitor plugin?
|
|
5082
|
+
"margin",
|
|
5083
|
+
"margin-inline",
|
|
5084
|
+
"margin-block",
|
|
5085
|
+
"margin-inline-start",
|
|
5086
|
+
"margin-inline-end",
|
|
5087
|
+
"margin-top",
|
|
5088
|
+
"margin-right",
|
|
5089
|
+
"margin-bottom",
|
|
5090
|
+
"margin-left",
|
|
5091
|
+
"box-sizing",
|
|
5092
|
+
"display",
|
|
5093
|
+
"aspect-ratio",
|
|
5094
|
+
"height",
|
|
5095
|
+
"max-height",
|
|
5096
|
+
"min-height",
|
|
5097
|
+
"width",
|
|
5098
|
+
"max-width",
|
|
5099
|
+
"min-width",
|
|
5100
|
+
"flex",
|
|
5101
|
+
"flex-shrink",
|
|
5102
|
+
"flex-grow",
|
|
5103
|
+
"flex-basis",
|
|
5104
|
+
"table-layout",
|
|
5105
|
+
"caption-side",
|
|
5106
|
+
"border-collapse",
|
|
5107
|
+
// There's no `border-spacing-x` property, we use variables, how to sort?
|
|
5108
|
+
"border-spacing",
|
|
5109
|
+
// '--tw-border-spacing-x',
|
|
5110
|
+
// '--tw-border-spacing-y',
|
|
5111
|
+
"transform-origin",
|
|
5112
|
+
// '--tw-translate-x',
|
|
5113
|
+
// '--tw-translate-y',
|
|
5114
|
+
"translate",
|
|
5115
|
+
"rotate",
|
|
5116
|
+
// '--tw-rotate',
|
|
5117
|
+
"--tw-skew-x",
|
|
5118
|
+
"--tw-skew-y",
|
|
5119
|
+
"scale",
|
|
5120
|
+
// '--tw-scale-x',
|
|
5121
|
+
// '--tw-scale-y',
|
|
5122
|
+
"transform",
|
|
5123
|
+
"animation",
|
|
5124
|
+
"cursor",
|
|
5125
|
+
"touch-action",
|
|
5126
|
+
"--tw-pan-x",
|
|
5127
|
+
"--tw-pan-y",
|
|
5128
|
+
"--tw-pinch-zoom",
|
|
5129
|
+
"resize",
|
|
5130
|
+
"scroll-snap-type",
|
|
5131
|
+
"--tw-scroll-snap-strictness",
|
|
5132
|
+
"scroll-snap-align",
|
|
5133
|
+
"scroll-snap-stop",
|
|
5134
|
+
"scroll-margin",
|
|
5135
|
+
"scroll-margin-inline-start",
|
|
5136
|
+
"scroll-margin-inline-end",
|
|
5137
|
+
"scroll-margin-top",
|
|
5138
|
+
"scroll-margin-right",
|
|
5139
|
+
"scroll-margin-bottom",
|
|
5140
|
+
"scroll-margin-left",
|
|
5141
|
+
"scroll-padding",
|
|
5142
|
+
"scroll-padding-inline-start",
|
|
5143
|
+
"scroll-padding-inline-end",
|
|
5144
|
+
"scroll-padding-top",
|
|
5145
|
+
"scroll-padding-right",
|
|
5146
|
+
"scroll-padding-bottom",
|
|
5147
|
+
"scroll-padding-left",
|
|
5148
|
+
"list-style-position",
|
|
5149
|
+
"list-style-type",
|
|
5150
|
+
"list-style-image",
|
|
5151
|
+
"appearance",
|
|
5152
|
+
"columns",
|
|
5153
|
+
"break-before",
|
|
5154
|
+
"break-inside",
|
|
5155
|
+
"break-after",
|
|
5156
|
+
"grid-auto-columns",
|
|
5157
|
+
"grid-auto-flow",
|
|
5158
|
+
"grid-auto-rows",
|
|
5159
|
+
"grid-template-columns",
|
|
5160
|
+
"grid-template-rows",
|
|
5161
|
+
"flex-direction",
|
|
5162
|
+
"flex-wrap",
|
|
5163
|
+
"place-content",
|
|
5164
|
+
"place-items",
|
|
5165
|
+
"align-content",
|
|
5166
|
+
"align-items",
|
|
5167
|
+
"justify-content",
|
|
5168
|
+
"justify-items",
|
|
5169
|
+
"gap",
|
|
5170
|
+
"column-gap",
|
|
5171
|
+
"row-gap",
|
|
5172
|
+
"--tw-space-x-reverse",
|
|
5173
|
+
"--tw-space-y-reverse",
|
|
5174
|
+
// Is there a more "real" property we could use for this?
|
|
5175
|
+
"divide-x-width",
|
|
5176
|
+
"divide-y-width",
|
|
5177
|
+
"--tw-divide-y-reverse",
|
|
5178
|
+
"divide-style",
|
|
5179
|
+
"divide-color",
|
|
5180
|
+
"--tw-divide-opacity",
|
|
5181
|
+
"place-self",
|
|
5182
|
+
"align-self",
|
|
5183
|
+
"justify-self",
|
|
5184
|
+
"overflow",
|
|
5185
|
+
"overflow-x",
|
|
5186
|
+
"overflow-y",
|
|
5187
|
+
"overscroll-behavior",
|
|
5188
|
+
"overscroll-behavior-x",
|
|
5189
|
+
"overscroll-behavior-y",
|
|
5190
|
+
"scroll-behavior",
|
|
5191
|
+
"text-overflow",
|
|
5192
|
+
"hyphens",
|
|
5193
|
+
"white-space",
|
|
5194
|
+
"text-wrap",
|
|
5195
|
+
"overflow-wrap",
|
|
5196
|
+
"work-break",
|
|
5197
|
+
"border-radius",
|
|
5198
|
+
"border-start-radius",
|
|
5199
|
+
// Not real
|
|
5200
|
+
"border-end-radius",
|
|
5201
|
+
// Not real
|
|
5202
|
+
"border-top-radius",
|
|
5203
|
+
// Not real
|
|
5204
|
+
"border-right-radius",
|
|
5205
|
+
// Not real
|
|
5206
|
+
"border-bottom-radius",
|
|
5207
|
+
// Not real
|
|
5208
|
+
"border-left-radius",
|
|
5209
|
+
// Not real
|
|
5210
|
+
"border-start-start-radius",
|
|
5211
|
+
"border-start-end-radius",
|
|
5212
|
+
"border-end-end-radius",
|
|
5213
|
+
"border-end-start-radius",
|
|
5214
|
+
"border-top-left-radius",
|
|
5215
|
+
"border-top-right-radius",
|
|
5216
|
+
"border-bottom-right-radius",
|
|
5217
|
+
"border-bottom-left-radius",
|
|
5218
|
+
"border-width",
|
|
5219
|
+
"border-inline-width",
|
|
5220
|
+
// Not real
|
|
5221
|
+
"border-inline-start-width",
|
|
5222
|
+
"border-inline-end-width",
|
|
5223
|
+
"border-top-width",
|
|
5224
|
+
"border-right-width",
|
|
5225
|
+
"border-bottom-width",
|
|
5226
|
+
"border-left-width",
|
|
5227
|
+
"border-style",
|
|
5228
|
+
"border-color",
|
|
5229
|
+
"border-x-color",
|
|
5230
|
+
// Not real
|
|
5231
|
+
"border-y-color",
|
|
5232
|
+
// Not real
|
|
5233
|
+
"border-inline-start-color",
|
|
5234
|
+
"border-inline-end-color",
|
|
5235
|
+
"border-top-color",
|
|
5236
|
+
"border-right-color",
|
|
5237
|
+
"border-bottom-color",
|
|
5238
|
+
"border-left-color",
|
|
5239
|
+
"--tw-border-opacity",
|
|
5240
|
+
"background-color",
|
|
5241
|
+
"--tw-bg-opacity",
|
|
5242
|
+
"background-image",
|
|
5243
|
+
"--tw-gradient-stops",
|
|
5244
|
+
"--tw-gradient-via-stops",
|
|
5245
|
+
"--tw-gradient-from",
|
|
5246
|
+
"--tw-gradient-from-position",
|
|
5247
|
+
"--tw-gradient-via",
|
|
5248
|
+
"--tw-gradient-via-position",
|
|
5249
|
+
"--tw-gradient-to",
|
|
5250
|
+
"--tw-gradient-to-position",
|
|
5251
|
+
"box-decoration-break",
|
|
5252
|
+
"background-size",
|
|
5253
|
+
"background-attachment",
|
|
5254
|
+
"background-clip",
|
|
5255
|
+
"background-position",
|
|
5256
|
+
"background-repeat",
|
|
5257
|
+
"background-origin",
|
|
5258
|
+
"fill",
|
|
5259
|
+
"stroke",
|
|
5260
|
+
"stroke-width",
|
|
5261
|
+
"object-fit",
|
|
5262
|
+
"object-position",
|
|
5263
|
+
"padding",
|
|
5264
|
+
"padding-inline",
|
|
5265
|
+
"padding-block",
|
|
5266
|
+
"padding-inline-start",
|
|
5267
|
+
"padding-inline-end",
|
|
5268
|
+
"padding-top",
|
|
5269
|
+
"padding-right",
|
|
5270
|
+
"padding-bottom",
|
|
5271
|
+
"padding-left",
|
|
5272
|
+
"text-align",
|
|
5273
|
+
"text-indent",
|
|
5274
|
+
"vertical-align",
|
|
5275
|
+
"font-family",
|
|
5276
|
+
"font-size",
|
|
5277
|
+
"font-weight",
|
|
5278
|
+
"text-transform",
|
|
5279
|
+
"font-style",
|
|
5280
|
+
"font-variant-numeric",
|
|
5281
|
+
"line-height",
|
|
5282
|
+
"letter-spacing",
|
|
5283
|
+
"color",
|
|
5284
|
+
"--tw-text-opacity",
|
|
5285
|
+
"text-decoration-line",
|
|
5286
|
+
"text-decoration-color",
|
|
5287
|
+
"text-decoration-style",
|
|
5288
|
+
"text-decoration-thickness",
|
|
5289
|
+
"text-underline-offset",
|
|
5290
|
+
"-webkit-font-smoothing",
|
|
5291
|
+
"placeholder-color",
|
|
5292
|
+
// Not real
|
|
5293
|
+
"--tw-placeholder-opacity",
|
|
5294
|
+
"caret-color",
|
|
5295
|
+
"accent-color",
|
|
5296
|
+
"opacity",
|
|
5297
|
+
"background-blend-mode",
|
|
5298
|
+
"mix-blend-mode",
|
|
5299
|
+
"box-shadow",
|
|
5300
|
+
"--tw-shadow",
|
|
5301
|
+
"--tw-shadow-color",
|
|
5302
|
+
"--tw-ring-shadow",
|
|
5303
|
+
"--tw-ring-color",
|
|
5304
|
+
"--tw-inset-shadow",
|
|
5305
|
+
"--tw-inset-shadow-color",
|
|
5306
|
+
"--tw-inset-ring-shadow",
|
|
5307
|
+
"--tw-inset-ring-color",
|
|
5308
|
+
"--tw-ring-opacity",
|
|
5309
|
+
"--tw-ring-offset-width",
|
|
5310
|
+
"--tw-ring-offset-color",
|
|
5311
|
+
"outline",
|
|
5312
|
+
"outline-width",
|
|
5313
|
+
"outline-offset",
|
|
5314
|
+
"outline-color",
|
|
5315
|
+
"--tw-blur",
|
|
5316
|
+
"--tw-brightness",
|
|
5317
|
+
"--tw-contast",
|
|
5318
|
+
"--tw-drop-shadow",
|
|
5319
|
+
"--tw-grayscale",
|
|
5320
|
+
"--tw-hue-rotate",
|
|
5321
|
+
"--tw-invert",
|
|
5322
|
+
"--tw-saturate",
|
|
5323
|
+
"--tw-sepia",
|
|
5324
|
+
"filter",
|
|
5325
|
+
"--tw-backdrop-blur",
|
|
5326
|
+
"--tw-backdrop-brightness",
|
|
5327
|
+
"--tw-backdrop-contast",
|
|
5328
|
+
"--tw-backdrop-grayscale",
|
|
5329
|
+
"--tw-backdrop-hue-rotate",
|
|
5330
|
+
"--tw-backdrop-invert",
|
|
5331
|
+
"--tw-backdrop-opacity",
|
|
5332
|
+
"--tw-backdrop-saturate",
|
|
5333
|
+
"--tw-backdrop-sepia",
|
|
5334
|
+
"backdrop-filter",
|
|
5335
|
+
"transition-property",
|
|
5336
|
+
"transition-delay",
|
|
5337
|
+
"transition-duration",
|
|
5338
|
+
"transition-timing-function",
|
|
5339
|
+
"will-change",
|
|
5340
|
+
"contain",
|
|
5341
|
+
"content",
|
|
5342
|
+
"forced-color-adjust"
|
|
5343
|
+
];
|
|
5344
|
+
|
|
5345
|
+
// src/utils/escape.ts
|
|
5346
|
+
function escape(value) {
|
|
5347
|
+
if (arguments.length == 0) {
|
|
5348
|
+
throw new TypeError("`CSS.escape` requires an argument.");
|
|
5349
|
+
}
|
|
5350
|
+
var string = String(value);
|
|
5351
|
+
var length = string.length;
|
|
5352
|
+
var index = -1;
|
|
5353
|
+
var codeUnit;
|
|
5354
|
+
var result = "";
|
|
5355
|
+
var firstCodeUnit = string.charCodeAt(0);
|
|
5356
|
+
if (
|
|
5357
|
+
// If the character is the first character and is a `-` (U+002D), and
|
|
5358
|
+
// there is no second character, […]
|
|
5359
|
+
length == 1 && firstCodeUnit == 45
|
|
5360
|
+
) {
|
|
5361
|
+
return "\\" + string;
|
|
5362
|
+
}
|
|
5363
|
+
while (++index < length) {
|
|
5364
|
+
codeUnit = string.charCodeAt(index);
|
|
5365
|
+
if (codeUnit == 0) {
|
|
5366
|
+
result += "\uFFFD";
|
|
5367
|
+
continue;
|
|
5368
|
+
}
|
|
5369
|
+
if (
|
|
5370
|
+
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
|
|
5371
|
+
// U+007F, […]
|
|
5372
|
+
codeUnit >= 1 && codeUnit <= 31 || codeUnit == 127 || // If the character is the first character and is in the range [0-9]
|
|
5373
|
+
// (U+0030 to U+0039), […]
|
|
5374
|
+
index == 0 && codeUnit >= 48 && codeUnit <= 57 || // If the character is the second character and is in the range [0-9]
|
|
5375
|
+
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
|
|
5376
|
+
index == 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit == 45
|
|
5377
|
+
) {
|
|
5378
|
+
result += "\\" + codeUnit.toString(16) + " ";
|
|
5379
|
+
continue;
|
|
5380
|
+
}
|
|
5381
|
+
if (codeUnit >= 128 || codeUnit == 45 || codeUnit == 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) {
|
|
5382
|
+
result += string.charAt(index);
|
|
5383
|
+
continue;
|
|
5384
|
+
}
|
|
5385
|
+
result += "\\" + string.charAt(index);
|
|
5386
|
+
}
|
|
5387
|
+
return result;
|
|
5388
|
+
}
|
|
5389
|
+
|
|
5390
|
+
// src/compile.ts
|
|
5391
|
+
function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidate = false } = {}) {
|
|
5392
|
+
rawCandidates.sort();
|
|
5393
|
+
let nodeSorting = /* @__PURE__ */ new Map();
|
|
5394
|
+
let astNodes = [];
|
|
5395
|
+
let parsedVariants = new DefaultMap((variant, map) => {
|
|
5396
|
+
return parseVariant(variant, designSystem.variants, map);
|
|
4689
5397
|
});
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
if (
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
5398
|
+
let candidates = /* @__PURE__ */ new Map();
|
|
5399
|
+
for (let rawCandidate of rawCandidates) {
|
|
5400
|
+
let candidate = parseCandidate(rawCandidate, designSystem.utilities, parsedVariants);
|
|
5401
|
+
if (candidate === null) {
|
|
5402
|
+
if (throwOnInvalidCandidate) {
|
|
5403
|
+
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
5404
|
+
}
|
|
5405
|
+
continue;
|
|
4697
5406
|
}
|
|
5407
|
+
candidates.set(candidate, rawCandidate);
|
|
5408
|
+
}
|
|
5409
|
+
let variants = Array.from(parsedVariants.values()).sort((a, z) => {
|
|
5410
|
+
return designSystem.variants.compare(a, z);
|
|
4698
5411
|
});
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
5412
|
+
next:
|
|
5413
|
+
for (let [candidate, rawCandidate] of candidates) {
|
|
5414
|
+
let nodes = [];
|
|
5415
|
+
if (candidate.kind === "arbitrary") {
|
|
5416
|
+
let compileFn = designSystem.utilities.getArbitrary();
|
|
5417
|
+
let compiledNodes = compileFn(candidate);
|
|
5418
|
+
if (compiledNodes === void 0) {
|
|
5419
|
+
if (throwOnInvalidCandidate) {
|
|
5420
|
+
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
5421
|
+
}
|
|
5422
|
+
continue next;
|
|
5423
|
+
}
|
|
5424
|
+
nodes = compiledNodes;
|
|
5425
|
+
} else if (candidate.kind === "static" || candidate.kind === "functional") {
|
|
5426
|
+
let { compileFn } = designSystem.utilities.get(candidate.root);
|
|
5427
|
+
let compiledNodes = compileFn(candidate);
|
|
5428
|
+
if (compiledNodes === void 0) {
|
|
5429
|
+
if (throwOnInvalidCandidate) {
|
|
5430
|
+
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
5431
|
+
}
|
|
5432
|
+
continue next;
|
|
5433
|
+
}
|
|
5434
|
+
nodes = compiledNodes;
|
|
5435
|
+
}
|
|
5436
|
+
let propertySort = getPropertySort(nodes);
|
|
5437
|
+
if (candidate.important) {
|
|
5438
|
+
applyImportant(nodes);
|
|
5439
|
+
}
|
|
5440
|
+
let node = {
|
|
5441
|
+
kind: "rule",
|
|
5442
|
+
selector: `.${escape(rawCandidate)}`,
|
|
5443
|
+
nodes
|
|
5444
|
+
};
|
|
5445
|
+
let variantOrder = 0n;
|
|
5446
|
+
for (let variant of candidate.variants) {
|
|
5447
|
+
let result = applyVariant(node, variant, designSystem.variants);
|
|
5448
|
+
if (result === null) {
|
|
5449
|
+
if (throwOnInvalidCandidate) {
|
|
5450
|
+
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
5451
|
+
}
|
|
5452
|
+
continue next;
|
|
5453
|
+
}
|
|
5454
|
+
variantOrder |= 1n << BigInt(variants.indexOf(variant));
|
|
5455
|
+
}
|
|
5456
|
+
nodeSorting.set(node, {
|
|
5457
|
+
properties: propertySort,
|
|
5458
|
+
variants: variantOrder,
|
|
5459
|
+
candidate: rawCandidate
|
|
5460
|
+
});
|
|
5461
|
+
astNodes.push(node);
|
|
5462
|
+
}
|
|
5463
|
+
astNodes.sort((a, z) => {
|
|
5464
|
+
let aSorting = nodeSorting.get(a);
|
|
5465
|
+
let zSorting = nodeSorting.get(z);
|
|
5466
|
+
if (aSorting.variants - zSorting.variants !== 0n) {
|
|
5467
|
+
return Number(aSorting.variants - zSorting.variants);
|
|
5468
|
+
}
|
|
5469
|
+
let offset = 0;
|
|
5470
|
+
while (aSorting.properties.length < offset && zSorting.properties.length < offset && aSorting.properties[offset] === zSorting.properties[offset]) {
|
|
5471
|
+
offset += 1;
|
|
5472
|
+
}
|
|
5473
|
+
return (
|
|
5474
|
+
// Sort by lowest property index first
|
|
5475
|
+
(aSorting.properties[offset] ?? Infinity) - (zSorting.properties[offset] ?? Infinity) || // Sort by most properties first, then by least properties
|
|
5476
|
+
zSorting.properties.length - aSorting.properties.length
|
|
5477
|
+
);
|
|
4703
5478
|
});
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
5479
|
+
return {
|
|
5480
|
+
astNodes,
|
|
5481
|
+
nodeSorting
|
|
5482
|
+
};
|
|
5483
|
+
}
|
|
5484
|
+
function applyVariant(node, variant, variants) {
|
|
5485
|
+
if (variant.kind === "arbitrary") {
|
|
5486
|
+
node.nodes = [rule(variant.selector, node.nodes)];
|
|
5487
|
+
return;
|
|
5488
|
+
}
|
|
5489
|
+
let { applyFn } = variants.get(variant.root);
|
|
5490
|
+
if (variant.kind === "compound") {
|
|
5491
|
+
let result2 = applyVariant(node, variant.variant, variants);
|
|
5492
|
+
if (result2 === null)
|
|
5493
|
+
return null;
|
|
5494
|
+
for (let child of node.nodes) {
|
|
5495
|
+
if (child.kind !== "rule")
|
|
4708
5496
|
return null;
|
|
4709
|
-
let
|
|
4710
|
-
if (
|
|
5497
|
+
let result3 = applyFn(child, variant);
|
|
5498
|
+
if (result3 === null)
|
|
4711
5499
|
return null;
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
5500
|
+
}
|
|
5501
|
+
return;
|
|
5502
|
+
}
|
|
5503
|
+
let result = applyFn(node, variant);
|
|
5504
|
+
if (result === null)
|
|
5505
|
+
return null;
|
|
5506
|
+
}
|
|
5507
|
+
function applyImportant(ast) {
|
|
5508
|
+
for (let node of ast) {
|
|
5509
|
+
if (node.kind === "rule" && node.selector === "@at-root") {
|
|
5510
|
+
continue;
|
|
5511
|
+
}
|
|
5512
|
+
if (node.kind === "declaration") {
|
|
5513
|
+
node.important = true;
|
|
5514
|
+
} else if (node.kind === "rule") {
|
|
5515
|
+
applyImportant(node.nodes);
|
|
5516
|
+
}
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
function getPropertySort(nodes) {
|
|
5520
|
+
let propertySort = /* @__PURE__ */ new Set();
|
|
5521
|
+
let q = nodes.slice();
|
|
5522
|
+
while (q.length > 0) {
|
|
5523
|
+
let node = q.shift();
|
|
5524
|
+
if (node.kind === "declaration") {
|
|
5525
|
+
if (node.property === "--tw-sort") {
|
|
5526
|
+
let idx2 = property_order_default.indexOf(node.value);
|
|
5527
|
+
if (idx2 !== -1) {
|
|
5528
|
+
propertySort.add(idx2);
|
|
5529
|
+
break;
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5532
|
+
let idx = property_order_default.indexOf(node.property);
|
|
5533
|
+
if (idx !== -1)
|
|
5534
|
+
propertySort.add(idx);
|
|
5535
|
+
} else if (node.kind === "rule") {
|
|
5536
|
+
if (node.selector === "@at-root")
|
|
5537
|
+
continue;
|
|
5538
|
+
for (let child of node.nodes) {
|
|
5539
|
+
q.push(child);
|
|
5540
|
+
}
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
return Array.from(propertySort).sort((a, z) => a - z);
|
|
5544
|
+
}
|
|
5545
|
+
|
|
5546
|
+
// src/css-parser.ts
|
|
5547
|
+
function parse2(input) {
|
|
5548
|
+
let ast = [];
|
|
5549
|
+
let licenseComments = [];
|
|
5550
|
+
let stack = [];
|
|
5551
|
+
let parent = null;
|
|
5552
|
+
let node = null;
|
|
5553
|
+
let current = "";
|
|
5554
|
+
let closingBracketStack = "";
|
|
5555
|
+
for (let i = 0; i < input.length; i++) {
|
|
5556
|
+
let char = input[i];
|
|
5557
|
+
if (char === "\\") {
|
|
5558
|
+
current += input.slice(i, i + 2);
|
|
5559
|
+
i += 1;
|
|
5560
|
+
} else if (char === "/" && input[i + 1] === "*") {
|
|
5561
|
+
let start = i;
|
|
5562
|
+
for (let j = i + 2; j < input.length; j++) {
|
|
5563
|
+
if (input[j] === "\\") {
|
|
5564
|
+
j += 1;
|
|
5565
|
+
} else if (input[j] === "*" && input[j + 1] === "/") {
|
|
5566
|
+
i = j + 1;
|
|
5567
|
+
break;
|
|
5568
|
+
}
|
|
5569
|
+
}
|
|
5570
|
+
let commentString = input.slice(start, i + 1);
|
|
5571
|
+
if (commentString[2] === "!") {
|
|
5572
|
+
licenseComments.push(comment(commentString.slice(2, -2)));
|
|
5573
|
+
}
|
|
5574
|
+
} else if (char === '"' || char === "'") {
|
|
5575
|
+
let start = i;
|
|
5576
|
+
for (let j = i + 1; j < input.length; j++) {
|
|
5577
|
+
if (input[j] === "\\") {
|
|
5578
|
+
j += 1;
|
|
5579
|
+
} else if (input[j] === char) {
|
|
5580
|
+
i = j;
|
|
5581
|
+
break;
|
|
5582
|
+
} else if (input[j] === ";" && input[j + 1] === "\n") {
|
|
5583
|
+
throw new Error(`Unterminated string: ${input.slice(start, j + 1) + char}`);
|
|
5584
|
+
} else if (input[j] === "\n") {
|
|
5585
|
+
throw new Error(`Unterminated string: ${input.slice(start, j) + char}`);
|
|
5586
|
+
}
|
|
5587
|
+
}
|
|
5588
|
+
current += input.slice(start, i + 1);
|
|
5589
|
+
} else if ((char === " " || char === "\n" || char === " ") && (input[i + 1] === " " || input[i + 1] === "\n" || input[i + 1] === " ")) {
|
|
5590
|
+
continue;
|
|
5591
|
+
} else if (char === "-" && input[i + 1] === "-" && current.length === 0) {
|
|
5592
|
+
let closingBracketStack2 = "";
|
|
5593
|
+
let start = i;
|
|
5594
|
+
let colonIdx = -1;
|
|
5595
|
+
for (let j = i + 2; j < input.length; j++) {
|
|
5596
|
+
if (input[j] === "\\") {
|
|
5597
|
+
j += 1;
|
|
5598
|
+
} else if (input[j] === "/" && input[j + 1] === "*") {
|
|
5599
|
+
for (let k = j + 2; k < input.length; k++) {
|
|
5600
|
+
if (input[k] === "\\") {
|
|
5601
|
+
k += 1;
|
|
5602
|
+
} else if (input[k] === "*" && input[k + 1] === "/") {
|
|
5603
|
+
j = k + 1;
|
|
5604
|
+
break;
|
|
5605
|
+
}
|
|
5606
|
+
}
|
|
5607
|
+
} else if (colonIdx === -1 && input[j] === ":") {
|
|
5608
|
+
colonIdx = current.length + j - start;
|
|
5609
|
+
} else if (input[j] === ";" && closingBracketStack2.length === 0) {
|
|
5610
|
+
current += input.slice(start, j);
|
|
5611
|
+
i = j;
|
|
5612
|
+
break;
|
|
5613
|
+
} else if (input[j] === "(") {
|
|
5614
|
+
closingBracketStack2 += ")";
|
|
5615
|
+
} else if (input[j] === "[") {
|
|
5616
|
+
closingBracketStack2 += "]";
|
|
5617
|
+
} else if (input[j] === "{") {
|
|
5618
|
+
closingBracketStack2 += "}";
|
|
5619
|
+
} else if ((input[j] === "}" || input.length - 1 === j) && closingBracketStack2.length === 0) {
|
|
5620
|
+
i = j - 1;
|
|
5621
|
+
current += input.slice(start, j);
|
|
5622
|
+
break;
|
|
5623
|
+
} else if (input[j] === ")" || input[j] === "]" || input[j] === "}") {
|
|
5624
|
+
if (closingBracketStack2.length > 0 && input[j] === closingBracketStack2[closingBracketStack2.length - 1]) {
|
|
5625
|
+
closingBracketStack2 = closingBracketStack2.slice(0, -1);
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
4716
5628
|
}
|
|
4717
|
-
|
|
4718
|
-
|
|
5629
|
+
let declaration = parseDeclaration(current, colonIdx);
|
|
5630
|
+
if (parent) {
|
|
5631
|
+
parent.nodes.push(declaration);
|
|
5632
|
+
} else {
|
|
5633
|
+
ast.push(declaration);
|
|
4719
5634
|
}
|
|
4720
|
-
|
|
4721
|
-
|
|
5635
|
+
current = "";
|
|
5636
|
+
} else if (char === ";" && current[0] === "@") {
|
|
5637
|
+
node = rule(current, []);
|
|
5638
|
+
if (parent) {
|
|
5639
|
+
parent.nodes.push(node);
|
|
5640
|
+
} else {
|
|
5641
|
+
ast.push(node);
|
|
4722
5642
|
}
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
staticVariant("contrast-more", ["@media (prefers-contrast: more)"], { compounds: false });
|
|
4732
|
-
staticVariant("contrast-less", ["@media (prefers-contrast: less)"], { compounds: false });
|
|
4733
|
-
{
|
|
4734
|
-
let compareBreakpoints2 = function(a, z, direction) {
|
|
4735
|
-
if (a === z)
|
|
4736
|
-
return 0;
|
|
4737
|
-
let aValue = resolvedBreakpoints.get(a);
|
|
4738
|
-
if (aValue === null)
|
|
4739
|
-
return direction === "asc" ? -1 : 1;
|
|
4740
|
-
let zValue = resolvedBreakpoints.get(z);
|
|
4741
|
-
if (zValue === null)
|
|
4742
|
-
return direction === "asc" ? 1 : -1;
|
|
4743
|
-
if (aValue === zValue)
|
|
4744
|
-
return 0;
|
|
4745
|
-
let aIsCssFunction = aValue.indexOf("(");
|
|
4746
|
-
let zIsCssFunction = zValue.indexOf("(");
|
|
4747
|
-
let aBucket = aIsCssFunction === -1 ? (
|
|
4748
|
-
// No CSS function found, bucket by unit instead
|
|
4749
|
-
aValue.replace(/[\d.]+/g, "")
|
|
4750
|
-
) : (
|
|
4751
|
-
// CSS function found, bucket by function name
|
|
4752
|
-
aValue.slice(0, aIsCssFunction)
|
|
4753
|
-
);
|
|
4754
|
-
let zBucket = zIsCssFunction === -1 ? (
|
|
4755
|
-
// No CSS function found, bucket by unit
|
|
4756
|
-
zValue.replace(/[\d.]+/g, "")
|
|
4757
|
-
) : (
|
|
4758
|
-
// CSS function found, bucket by function name
|
|
4759
|
-
zValue.slice(0, zIsCssFunction)
|
|
4760
|
-
);
|
|
4761
|
-
let order = (
|
|
4762
|
-
// Compare by bucket name
|
|
4763
|
-
aBucket.localeCompare(zBucket) || // If bucket names are the same, compare by value
|
|
4764
|
-
(direction === "asc" ? parseInt(aValue) - parseInt(zValue) : parseInt(zValue) - parseInt(aValue))
|
|
4765
|
-
);
|
|
4766
|
-
if (isNaN(order)) {
|
|
4767
|
-
return aValue.localeCompare(zValue);
|
|
5643
|
+
current = "";
|
|
5644
|
+
node = null;
|
|
5645
|
+
} else if (char === ";") {
|
|
5646
|
+
let declaration = parseDeclaration(current);
|
|
5647
|
+
if (parent) {
|
|
5648
|
+
parent.nodes.push(declaration);
|
|
5649
|
+
} else {
|
|
5650
|
+
ast.push(declaration);
|
|
4768
5651
|
}
|
|
4769
|
-
|
|
4770
|
-
}
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
5652
|
+
current = "";
|
|
5653
|
+
} else if (char === "{") {
|
|
5654
|
+
closingBracketStack += "}";
|
|
5655
|
+
node = rule(current.trim(), []);
|
|
5656
|
+
if (parent) {
|
|
5657
|
+
parent.nodes.push(node);
|
|
5658
|
+
}
|
|
5659
|
+
stack.push(parent);
|
|
5660
|
+
parent = node;
|
|
5661
|
+
current = "";
|
|
5662
|
+
node = null;
|
|
5663
|
+
} else if (char === "}") {
|
|
5664
|
+
if (closingBracketStack === "") {
|
|
5665
|
+
throw new Error("Missing opening {");
|
|
5666
|
+
}
|
|
5667
|
+
closingBracketStack = closingBracketStack.slice(0, -1);
|
|
5668
|
+
if (current.length > 0) {
|
|
5669
|
+
if (current[0] === "@") {
|
|
5670
|
+
node = rule(current.trim(), []);
|
|
5671
|
+
if (parent) {
|
|
5672
|
+
parent.nodes.push(node);
|
|
5673
|
+
} else {
|
|
5674
|
+
ast.push(node);
|
|
4786
5675
|
}
|
|
4787
|
-
|
|
4788
|
-
|
|
5676
|
+
current = "";
|
|
5677
|
+
node = null;
|
|
5678
|
+
} else {
|
|
5679
|
+
let colonIdx = current.indexOf(":");
|
|
5680
|
+
if (parent) {
|
|
5681
|
+
let importantIdx = current.indexOf("!important", colonIdx + 1);
|
|
5682
|
+
parent.nodes.push({
|
|
5683
|
+
kind: "declaration",
|
|
5684
|
+
property: current.slice(0, colonIdx).trim(),
|
|
5685
|
+
value: current.slice(colonIdx + 1, importantIdx === -1 ? current.length : importantIdx).trim(),
|
|
5686
|
+
important: importantIdx !== -1
|
|
5687
|
+
});
|
|
4789
5688
|
}
|
|
4790
|
-
return value;
|
|
4791
5689
|
}
|
|
4792
|
-
case "arbitrary":
|
|
4793
|
-
case "compound":
|
|
4794
|
-
return null;
|
|
4795
5690
|
}
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
},
|
|
4810
|
-
(a, z) => compareBreakpoints2(a, z, "desc")
|
|
4811
|
-
);
|
|
4812
|
-
variants.group(
|
|
4813
|
-
() => {
|
|
4814
|
-
for (let [key, value] of theme.namespace("--breakpoint")) {
|
|
4815
|
-
if (key === null)
|
|
4816
|
-
continue;
|
|
4817
|
-
variants.static(
|
|
4818
|
-
key,
|
|
4819
|
-
(ruleNode) => {
|
|
4820
|
-
ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
|
|
4821
|
-
},
|
|
4822
|
-
{ compounds: false }
|
|
4823
|
-
);
|
|
4824
|
-
}
|
|
4825
|
-
variants.functional(
|
|
4826
|
-
"min",
|
|
4827
|
-
(ruleNode, variant) => {
|
|
4828
|
-
let value = resolvedBreakpoints.get(variant);
|
|
4829
|
-
if (value === null)
|
|
4830
|
-
return null;
|
|
4831
|
-
ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
|
|
4832
|
-
},
|
|
4833
|
-
{ compounds: false }
|
|
4834
|
-
);
|
|
4835
|
-
},
|
|
4836
|
-
(a, z) => compareBreakpoints2(a, z, "asc")
|
|
4837
|
-
);
|
|
5691
|
+
let grandParent = stack.pop() ?? null;
|
|
5692
|
+
if (grandParent === null && parent) {
|
|
5693
|
+
ast.push(parent);
|
|
5694
|
+
}
|
|
5695
|
+
parent = grandParent;
|
|
5696
|
+
current = "";
|
|
5697
|
+
node = null;
|
|
5698
|
+
} else {
|
|
5699
|
+
if (current.length === 0 && (char === " " || char === "\n" || char === " ")) {
|
|
5700
|
+
continue;
|
|
5701
|
+
}
|
|
5702
|
+
current += char;
|
|
5703
|
+
}
|
|
4838
5704
|
}
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
return variants;
|
|
5705
|
+
if (closingBracketStack.length > 0 && parent) {
|
|
5706
|
+
throw new Error(`Missing closing } at ${parent.selector}`);
|
|
5707
|
+
}
|
|
5708
|
+
if (licenseComments.length > 0) {
|
|
5709
|
+
return licenseComments.concat(ast);
|
|
5710
|
+
}
|
|
5711
|
+
return ast;
|
|
4847
5712
|
}
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
function buildDesignSystem(theme) {
|
|
5713
|
+
function parseDeclaration(current, colonIdx = current.indexOf(":")) {
|
|
5714
|
+
let importantIdx = current.indexOf("!important", colonIdx + 1);
|
|
4851
5715
|
return {
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
return getClassOrder(this, classes);
|
|
4857
|
-
}
|
|
5716
|
+
kind: "declaration",
|
|
5717
|
+
property: current.slice(0, colonIdx).trim(),
|
|
5718
|
+
value: current.slice(colonIdx + 1, importantIdx === -1 ? current.length : importantIdx).trim(),
|
|
5719
|
+
important: importantIdx !== -1
|
|
4858
5720
|
};
|
|
4859
5721
|
}
|
|
4860
5722
|
|
|
@@ -4880,6 +5742,21 @@ var Theme = class {
|
|
|
4880
5742
|
this.values.set(key, value);
|
|
4881
5743
|
}
|
|
4882
5744
|
}
|
|
5745
|
+
keysInNamespaces(themeKeys) {
|
|
5746
|
+
let keys = [];
|
|
5747
|
+
for (let prefix of themeKeys) {
|
|
5748
|
+
let namespace = `${prefix}-`;
|
|
5749
|
+
for (let key of this.values.keys()) {
|
|
5750
|
+
if (key.startsWith(namespace)) {
|
|
5751
|
+
if (key.indexOf("--", 2) !== -1) {
|
|
5752
|
+
continue;
|
|
5753
|
+
}
|
|
5754
|
+
keys.push(key.slice(namespace.length));
|
|
5755
|
+
}
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
return keys;
|
|
5759
|
+
}
|
|
4883
5760
|
get(themeKeys) {
|
|
4884
5761
|
for (let key of themeKeys) {
|
|
4885
5762
|
let value = this.values.get(key);
|
|
@@ -4942,53 +5819,6 @@ var Theme = class {
|
|
|
4942
5819
|
};
|
|
4943
5820
|
|
|
4944
5821
|
// src/index.ts
|
|
4945
|
-
function toCss(ast) {
|
|
4946
|
-
let atRoots = [];
|
|
4947
|
-
return ast.map(function stringify(node) {
|
|
4948
|
-
let css2 = "";
|
|
4949
|
-
if (node.kind === "rule") {
|
|
4950
|
-
if (node.selector === "@at-root") {
|
|
4951
|
-
for (let child of node.nodes) {
|
|
4952
|
-
atRoots.push(stringify(child));
|
|
4953
|
-
}
|
|
4954
|
-
return css2;
|
|
4955
|
-
}
|
|
4956
|
-
if (node.selector[0] === "@" && node.nodes.length === 0) {
|
|
4957
|
-
return `${node.selector};`;
|
|
4958
|
-
}
|
|
4959
|
-
css2 += `${node.selector}{`;
|
|
4960
|
-
for (let child of node.nodes) {
|
|
4961
|
-
css2 += stringify(child);
|
|
4962
|
-
}
|
|
4963
|
-
css2 += "}";
|
|
4964
|
-
} else if (node.kind === "comment") {
|
|
4965
|
-
css2 += `/*${node.value}*/
|
|
4966
|
-
`;
|
|
4967
|
-
} else if (node.property !== "--tw-sort" && node.value !== void 0 && node.value !== null) {
|
|
4968
|
-
css2 += `${node.property}:${node.value}${node.important ? "!important" : ""};`;
|
|
4969
|
-
}
|
|
4970
|
-
return css2;
|
|
4971
|
-
}).concat(atRoots).join("\n");
|
|
4972
|
-
}
|
|
4973
|
-
function optimizeCss(input, { file = "input.css", minify = false } = {}) {
|
|
4974
|
-
return lightningcss.transform({
|
|
4975
|
-
filename: file,
|
|
4976
|
-
code: Buffer.from(input),
|
|
4977
|
-
minify,
|
|
4978
|
-
sourceMap: false,
|
|
4979
|
-
drafts: {
|
|
4980
|
-
customMedia: true
|
|
4981
|
-
},
|
|
4982
|
-
nonStandard: {
|
|
4983
|
-
deepSelectorCombinator: true
|
|
4984
|
-
},
|
|
4985
|
-
include: lightningcss.Features.Nesting,
|
|
4986
|
-
exclude: lightningcss.Features.LogicalProperties,
|
|
4987
|
-
targets: {
|
|
4988
|
-
safari: 16 << 16 | 4 << 8
|
|
4989
|
-
}
|
|
4990
|
-
}).code.toString();
|
|
4991
|
-
}
|
|
4992
5822
|
function compile(css2, rawCandidates) {
|
|
4993
5823
|
let ast = parse2(css2);
|
|
4994
5824
|
{
|
|
@@ -5049,7 +5879,7 @@ function compile(css2, rawCandidates) {
|
|
|
5049
5879
|
let designSystem = buildDesignSystem(theme);
|
|
5050
5880
|
walk(ast, (node, { replaceWith }) => {
|
|
5051
5881
|
if (node.kind === "rule" && node.selector === "@tailwind utilities") {
|
|
5052
|
-
replaceWith(
|
|
5882
|
+
replaceWith(compileCandidates(rawCandidates, designSystem).astNodes);
|
|
5053
5883
|
return false;
|
|
5054
5884
|
}
|
|
5055
5885
|
});
|
|
@@ -5061,7 +5891,7 @@ function compile(css2, rawCandidates) {
|
|
|
5061
5891
|
/* Ignore `@apply ` when parsing the selector */
|
|
5062
5892
|
).split(/\s+/g);
|
|
5063
5893
|
{
|
|
5064
|
-
let candidateAst =
|
|
5894
|
+
let candidateAst = compileCandidates(candidates, designSystem, {
|
|
5065
5895
|
throwOnInvalidCandidate: true
|
|
5066
5896
|
}).astNodes;
|
|
5067
5897
|
let newNodes = [];
|
|
@@ -5088,6 +5918,26 @@ function compile(css2, rawCandidates) {
|
|
|
5088
5918
|
}
|
|
5089
5919
|
return toCss(ast);
|
|
5090
5920
|
}
|
|
5921
|
+
function optimizeCss(input, { file = "input.css", minify = false } = {}) {
|
|
5922
|
+
return lightningcss.transform({
|
|
5923
|
+
filename: file,
|
|
5924
|
+
code: Buffer.from(input),
|
|
5925
|
+
minify,
|
|
5926
|
+
sourceMap: false,
|
|
5927
|
+
drafts: {
|
|
5928
|
+
customMedia: true
|
|
5929
|
+
},
|
|
5930
|
+
nonStandard: {
|
|
5931
|
+
deepSelectorCombinator: true
|
|
5932
|
+
},
|
|
5933
|
+
include: lightningcss.Features.Nesting,
|
|
5934
|
+
exclude: lightningcss.Features.LogicalProperties,
|
|
5935
|
+
targets: {
|
|
5936
|
+
safari: 16 << 16 | 4 << 8
|
|
5937
|
+
},
|
|
5938
|
+
errorRecovery: true
|
|
5939
|
+
}).code.toString();
|
|
5940
|
+
}
|
|
5091
5941
|
|
|
5092
5942
|
// src/cli/utils/format-ns.ts
|
|
5093
5943
|
function formatNanoseconds(input) {
|
|
@@ -5118,7 +5968,7 @@ var UI = {
|
|
|
5118
5968
|
indent: 2
|
|
5119
5969
|
};
|
|
5120
5970
|
function header() {
|
|
5121
|
-
return `${pc__default.default.italic(pc__default.default.bold(pc__default.default.blue("\u2248")))} tailwindcss ${pc__default.default.blue(
|
|
5971
|
+
return `${pc__default.default.italic(pc__default.default.bold(pc__default.default.blue("\u2248")))} tailwindcss ${pc__default.default.blue(`v${version}`)}`;
|
|
5122
5972
|
}
|
|
5123
5973
|
function highlight(file) {
|
|
5124
5974
|
return `${pc__default.default.dim(pc__default.default.blue("`"))}${pc__default.default.blue(file)}${pc__default.default.dim(pc__default.default.blue("`"))}`;
|
|
@@ -5429,18 +6279,11 @@ if (command) {
|
|
|
5429
6279
|
});
|
|
5430
6280
|
process.exit(1);
|
|
5431
6281
|
}
|
|
5432
|
-
if (process.stdout.isTTY && !process.argv.slice(2).includes("-o")) {
|
|
6282
|
+
if (process.stdout.isTTY && !process.argv.slice(2).includes("-o") || shared["--help"]) {
|
|
5433
6283
|
help({
|
|
5434
6284
|
usage: ["tailwindcss [--input input.css] [--output output.css] [--watch] [options\u2026]"],
|
|
5435
6285
|
options: { ...options(), ...sharedOptions }
|
|
5436
6286
|
});
|
|
5437
6287
|
process.exit(0);
|
|
5438
6288
|
}
|
|
5439
|
-
if (shared["--help"]) {
|
|
5440
|
-
help({
|
|
5441
|
-
usage: [`tailwindcss ${command} [options]`],
|
|
5442
|
-
options: { ...options(), ...sharedOptions }
|
|
5443
|
-
});
|
|
5444
|
-
process.exit(0);
|
|
5445
|
-
}
|
|
5446
6289
|
handle(args(options()));
|