tailwindcss 0.0.0-oxide.2 → 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-VA4PAOBV.mjs → chunk-YL27VW7G.mjs} +1504 -655
- package/dist/cli.d.mts +1 -2
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +1506 -663
- package/dist/cli.mjs +5 -11
- package/dist/lib.d.mts +98 -18
- package/dist/lib.d.ts +98 -18
- package/dist/lib.js +1504 -587
- package/dist/lib.mjs +1 -1
- package/package.json +2 -3
- package/preflight.css +1 -3
- package/theme.css +0 -3
|
@@ -9,75 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
// package.json
|
|
12
|
-
var version = "0.0.0-oxide.
|
|
13
|
-
var package_default = {
|
|
14
|
-
name: "tailwindcss",
|
|
15
|
-
version,
|
|
16
|
-
description: "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
17
|
-
license: "MIT",
|
|
18
|
-
repository: "https://github.com/tailwindlabs/tailwindcss.git",
|
|
19
|
-
bugs: "https://github.com/tailwindlabs/tailwindcss/issues",
|
|
20
|
-
homepage: "https://tailwindcss.com",
|
|
21
|
-
scripts: {
|
|
22
|
-
lint: "tsc --noEmit",
|
|
23
|
-
build: "tsup-node --env.NODE_ENV production",
|
|
24
|
-
dev: "tsup-node --env.NODE_ENV development --watch",
|
|
25
|
-
"test:ui": "playwright test"
|
|
26
|
-
},
|
|
27
|
-
bin: {
|
|
28
|
-
tailwindcss: "./dist/cli.js"
|
|
29
|
-
},
|
|
30
|
-
exports: {
|
|
31
|
-
".": {
|
|
32
|
-
style: "./index.css",
|
|
33
|
-
types: "./src/index.ts",
|
|
34
|
-
require: "./dist/lib.js",
|
|
35
|
-
import: "./src/index.ts"
|
|
36
|
-
},
|
|
37
|
-
"./package.json": "./package.json",
|
|
38
|
-
"./index.css": "./index.css",
|
|
39
|
-
"./preflight.css": "./preflight.css",
|
|
40
|
-
"./theme.css": "./theme.css",
|
|
41
|
-
"./utilities.css": "./utilities.css"
|
|
42
|
-
},
|
|
43
|
-
publishConfig: {
|
|
44
|
-
exports: {
|
|
45
|
-
".": {
|
|
46
|
-
types: "./dist/lib.d.mts",
|
|
47
|
-
style: "./index.css",
|
|
48
|
-
require: "./dist/lib.js",
|
|
49
|
-
import: "./dist/lib.mjs"
|
|
50
|
-
},
|
|
51
|
-
"./package.json": "./package.json",
|
|
52
|
-
"./index.css": "./index.css",
|
|
53
|
-
"./preflight.css": "./preflight.css",
|
|
54
|
-
"./theme.css": "./theme.css",
|
|
55
|
-
"./utilities.css": "./utilities.css"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
style: "index.css",
|
|
59
|
-
files: [
|
|
60
|
-
"dist",
|
|
61
|
-
"index.css",
|
|
62
|
-
"preflight.css",
|
|
63
|
-
"theme.css",
|
|
64
|
-
"utilities.css"
|
|
65
|
-
],
|
|
66
|
-
dependencies: {
|
|
67
|
-
"@parcel/watcher": "^2.4.1",
|
|
68
|
-
lightningcss: "^1.24.0",
|
|
69
|
-
mri: "^1.2.0",
|
|
70
|
-
picocolors: "^1.0.0",
|
|
71
|
-
postcss: "8.4.24",
|
|
72
|
-
"postcss-import": "^16.0.0"
|
|
73
|
-
},
|
|
74
|
-
devDependencies: {
|
|
75
|
-
"@tailwindcss/oxide": "workspace:^",
|
|
76
|
-
"@types/node": "^20.10.8",
|
|
77
|
-
"@types/postcss-import": "^14.0.3",
|
|
78
|
-
"fast-glob": "^3.3.2"
|
|
79
|
-
}
|
|
80
|
-
};
|
|
12
|
+
var version = "0.0.0-oxide.3";
|
|
81
13
|
|
|
82
14
|
// src/ast.ts
|
|
83
15
|
function rule(selector, nodes) {
|
|
@@ -117,6 +49,34 @@ function walk(ast, visit) {
|
|
|
117
49
|
}
|
|
118
50
|
}
|
|
119
51
|
}
|
|
52
|
+
function toCss(ast) {
|
|
53
|
+
let atRoots = [];
|
|
54
|
+
return ast.map(function stringify(node) {
|
|
55
|
+
let css = "";
|
|
56
|
+
if (node.kind === "rule") {
|
|
57
|
+
if (node.selector === "@at-root") {
|
|
58
|
+
for (let child of node.nodes) {
|
|
59
|
+
atRoots.push(stringify(child));
|
|
60
|
+
}
|
|
61
|
+
return css;
|
|
62
|
+
}
|
|
63
|
+
if (node.selector[0] === "@" && node.nodes.length === 0) {
|
|
64
|
+
return `${node.selector};`;
|
|
65
|
+
}
|
|
66
|
+
css += `${node.selector}{`;
|
|
67
|
+
for (let child of node.nodes) {
|
|
68
|
+
css += stringify(child);
|
|
69
|
+
}
|
|
70
|
+
css += "}";
|
|
71
|
+
} else if (node.kind === "comment") {
|
|
72
|
+
css += `/*${node.value}*/
|
|
73
|
+
`;
|
|
74
|
+
} else if (node.property !== "--tw-sort" && node.value !== void 0 && node.value !== null) {
|
|
75
|
+
css += `${node.property}:${node.value}${node.important ? "!important" : ""};`;
|
|
76
|
+
}
|
|
77
|
+
return css;
|
|
78
|
+
}).concat(atRoots).join("\n");
|
|
79
|
+
}
|
|
120
80
|
|
|
121
81
|
// src/utils/math-operators.ts
|
|
122
82
|
var mathFunctions = [
|
|
@@ -274,105 +234,6 @@ function segment(input, separator) {
|
|
|
274
234
|
}
|
|
275
235
|
|
|
276
236
|
// src/candidate.ts
|
|
277
|
-
function findRoot(input, lookup) {
|
|
278
|
-
let root = null;
|
|
279
|
-
let value = null;
|
|
280
|
-
{
|
|
281
|
-
if (lookup.has(input)) {
|
|
282
|
-
root = input;
|
|
283
|
-
value = null;
|
|
284
|
-
} else {
|
|
285
|
-
let idx = input.lastIndexOf("-");
|
|
286
|
-
if (idx === -1)
|
|
287
|
-
return [null, null];
|
|
288
|
-
do {
|
|
289
|
-
let maybeRoot = input.slice(0, idx);
|
|
290
|
-
if (lookup.has(maybeRoot)) {
|
|
291
|
-
root = maybeRoot;
|
|
292
|
-
value = input.slice(idx + 1);
|
|
293
|
-
break;
|
|
294
|
-
}
|
|
295
|
-
idx = input.lastIndexOf("-", idx - 1);
|
|
296
|
-
} while (idx > 0);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return [root, value];
|
|
300
|
-
}
|
|
301
|
-
function parseVariant(variant, variants, parsedVariants) {
|
|
302
|
-
if (variant[0] === "[" && variant[variant.length - 1] === "]") {
|
|
303
|
-
if (variant[1] === "@" && variant.includes("&"))
|
|
304
|
-
return null;
|
|
305
|
-
let selector = decodeArbitraryValue(variant.slice(1, -1));
|
|
306
|
-
if (selector[0] !== "@") {
|
|
307
|
-
if (!selector.includes("&")) {
|
|
308
|
-
selector = `&:is(${selector})`;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return {
|
|
312
|
-
kind: "arbitrary",
|
|
313
|
-
selector,
|
|
314
|
-
compounds: true
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
{
|
|
318
|
-
let [variantWithoutModifier, modifier = null, additionalModifier] = segment(variant, "/");
|
|
319
|
-
if (additionalModifier)
|
|
320
|
-
return null;
|
|
321
|
-
let [root, value] = findRoot(variantWithoutModifier, variants);
|
|
322
|
-
if (root === null)
|
|
323
|
-
return null;
|
|
324
|
-
switch (variants.kind(root)) {
|
|
325
|
-
case "static": {
|
|
326
|
-
if (value !== null)
|
|
327
|
-
return null;
|
|
328
|
-
return {
|
|
329
|
-
kind: "static",
|
|
330
|
-
root,
|
|
331
|
-
compounds: variants.compounds(root)
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
case "functional": {
|
|
335
|
-
if (value === null)
|
|
336
|
-
return null;
|
|
337
|
-
if (value[0] === "[" && value[value.length - 1] === "]") {
|
|
338
|
-
return {
|
|
339
|
-
kind: "functional",
|
|
340
|
-
root,
|
|
341
|
-
value: {
|
|
342
|
-
kind: "arbitrary",
|
|
343
|
-
value: decodeArbitraryValue(value.slice(1, -1))
|
|
344
|
-
},
|
|
345
|
-
compounds: variants.compounds(root)
|
|
346
|
-
};
|
|
347
|
-
} else {
|
|
348
|
-
return {
|
|
349
|
-
kind: "functional",
|
|
350
|
-
root,
|
|
351
|
-
value: { kind: "named", value },
|
|
352
|
-
compounds: variants.compounds(root)
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
case "compound": {
|
|
357
|
-
if (value === null)
|
|
358
|
-
return null;
|
|
359
|
-
let subVariant = parsedVariants.get(value);
|
|
360
|
-
if (subVariant === null)
|
|
361
|
-
return null;
|
|
362
|
-
if (subVariant.compounds === false)
|
|
363
|
-
return null;
|
|
364
|
-
return {
|
|
365
|
-
kind: "compound",
|
|
366
|
-
root,
|
|
367
|
-
modifier: modifier === null ? null : { kind: "named", value: modifier },
|
|
368
|
-
variant: subVariant,
|
|
369
|
-
compounds: variants.compounds(root)
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
237
|
function parseCandidate(input, utilities, parsedVariants) {
|
|
377
238
|
let rawVariants = segment(input, ":");
|
|
378
239
|
let base = rawVariants.pop();
|
|
@@ -404,20 +265,24 @@ function parseCandidate(input, utilities, parsedVariants) {
|
|
|
404
265
|
state.important = true;
|
|
405
266
|
base = base.slice(0, -1);
|
|
406
267
|
}
|
|
407
|
-
if (base[0] === "["
|
|
408
|
-
let
|
|
268
|
+
if (base[0] === "[") {
|
|
269
|
+
let [baseWithoutModifier, modifierSegment2 = null] = segment(base, "/");
|
|
270
|
+
if (baseWithoutModifier[baseWithoutModifier.length - 1] !== "]")
|
|
271
|
+
return null;
|
|
272
|
+
let charCode = baseWithoutModifier.charCodeAt(1);
|
|
409
273
|
if (charCode !== 45 && !(charCode >= 97 && charCode <= 122))
|
|
410
274
|
return null;
|
|
411
|
-
|
|
412
|
-
let idx =
|
|
413
|
-
if (idx === -1 || idx === 0 || idx ===
|
|
275
|
+
baseWithoutModifier = baseWithoutModifier.slice(1, -1);
|
|
276
|
+
let idx = baseWithoutModifier.indexOf(":");
|
|
277
|
+
if (idx === -1 || idx === 0 || idx === baseWithoutModifier.length - 1)
|
|
414
278
|
return null;
|
|
415
|
-
let property2 =
|
|
416
|
-
let value2 = decodeArbitraryValue(
|
|
279
|
+
let property2 = baseWithoutModifier.slice(0, idx);
|
|
280
|
+
let value2 = decodeArbitraryValue(baseWithoutModifier.slice(idx + 1));
|
|
417
281
|
return {
|
|
418
282
|
kind: "arbitrary",
|
|
419
283
|
property: property2,
|
|
420
284
|
value: value2,
|
|
285
|
+
modifier: modifierSegment2 === null ? null : parseModifier(modifierSegment2),
|
|
421
286
|
variants: parsedCandidateVariants,
|
|
422
287
|
important: state.important
|
|
423
288
|
};
|
|
@@ -427,6 +292,12 @@ function parseCandidate(input, utilities, parsedVariants) {
|
|
|
427
292
|
base = base.slice(1);
|
|
428
293
|
}
|
|
429
294
|
let [root, value] = findRoot(base, utilities);
|
|
295
|
+
let modifierSegment = null;
|
|
296
|
+
if (root === null && base.includes("/")) {
|
|
297
|
+
let [rootWithoutModifier, rootModifierSegment = null] = segment(base, "/");
|
|
298
|
+
modifierSegment = rootModifierSegment;
|
|
299
|
+
[root, value] = findRoot(rootWithoutModifier, utilities);
|
|
300
|
+
}
|
|
430
301
|
if (root === null)
|
|
431
302
|
return null;
|
|
432
303
|
let kind = utilities.kind(root);
|
|
@@ -444,22 +315,36 @@ function parseCandidate(input, utilities, parsedVariants) {
|
|
|
444
315
|
let candidate = {
|
|
445
316
|
kind: "functional",
|
|
446
317
|
root,
|
|
447
|
-
modifier: null,
|
|
318
|
+
modifier: modifierSegment === null ? null : parseModifier(modifierSegment),
|
|
448
319
|
value: null,
|
|
449
320
|
variants: parsedCandidateVariants,
|
|
450
321
|
negative: state.negative,
|
|
451
322
|
important: state.important
|
|
452
323
|
};
|
|
453
|
-
if (value === null)
|
|
324
|
+
if (value === null)
|
|
454
325
|
return candidate;
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
326
|
+
{
|
|
327
|
+
let [valueWithoutModifier, modifierSegment2 = null] = segment(value, "/");
|
|
328
|
+
if (modifierSegment2 !== null) {
|
|
329
|
+
candidate.modifier = parseModifier(modifierSegment2);
|
|
330
|
+
}
|
|
331
|
+
let startArbitraryIdx = valueWithoutModifier.indexOf("[");
|
|
332
|
+
let valueIsArbitrary = startArbitraryIdx !== -1;
|
|
333
|
+
if (valueIsArbitrary) {
|
|
334
|
+
let arbitraryValue = valueWithoutModifier.slice(startArbitraryIdx + 1, -1);
|
|
335
|
+
let typehint = "";
|
|
336
|
+
for (let i = 0; i < arbitraryValue.length; i++) {
|
|
337
|
+
let code = arbitraryValue.charCodeAt(i);
|
|
338
|
+
if (code === 58) {
|
|
339
|
+
typehint = arbitraryValue.slice(0, i);
|
|
340
|
+
arbitraryValue = arbitraryValue.slice(i + 1);
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
if (code === 45 || code >= 97 && code <= 122) {
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
463
348
|
let dashedIdent = null;
|
|
464
349
|
if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
|
|
465
350
|
dashedIdent = arbitraryValue;
|
|
@@ -467,33 +352,26 @@ function parseCandidate(input, utilities, parsedVariants) {
|
|
|
467
352
|
} else {
|
|
468
353
|
arbitraryValue = decodeArbitraryValue(arbitraryValue);
|
|
469
354
|
}
|
|
470
|
-
candidate.
|
|
355
|
+
candidate.value = {
|
|
471
356
|
kind: "arbitrary",
|
|
357
|
+
dataType: typehint || null,
|
|
472
358
|
value: arbitraryValue,
|
|
473
359
|
dashedIdent
|
|
474
360
|
};
|
|
475
361
|
} else {
|
|
476
|
-
candidate.modifier
|
|
362
|
+
let fraction = modifierSegment2 === null || candidate.modifier?.kind === "arbitrary" ? null : value.slice(valueWithoutModifier.lastIndexOf("-") + 1);
|
|
363
|
+
candidate.value = {
|
|
477
364
|
kind: "named",
|
|
478
|
-
value:
|
|
365
|
+
value: valueWithoutModifier,
|
|
366
|
+
fraction
|
|
479
367
|
};
|
|
480
368
|
}
|
|
481
369
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
if (code === 58) {
|
|
488
|
-
typehint = arbitraryValue.slice(0, i);
|
|
489
|
-
arbitraryValue = arbitraryValue.slice(i + 1);
|
|
490
|
-
break;
|
|
491
|
-
}
|
|
492
|
-
if (code === 45 || code >= 97 && code <= 122) {
|
|
493
|
-
continue;
|
|
494
|
-
}
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
370
|
+
return candidate;
|
|
371
|
+
}
|
|
372
|
+
function parseModifier(modifier) {
|
|
373
|
+
if (modifier[0] === "[" && modifier[modifier.length - 1] === "]") {
|
|
374
|
+
let arbitraryValue = modifier.slice(1, -1);
|
|
497
375
|
let dashedIdent = null;
|
|
498
376
|
if (arbitraryValue[0] === "-" && arbitraryValue[1] === "-") {
|
|
499
377
|
dashedIdent = arbitraryValue;
|
|
@@ -501,21 +379,218 @@ function parseCandidate(input, utilities, parsedVariants) {
|
|
|
501
379
|
} else {
|
|
502
380
|
arbitraryValue = decodeArbitraryValue(arbitraryValue);
|
|
503
381
|
}
|
|
504
|
-
|
|
382
|
+
return {
|
|
505
383
|
kind: "arbitrary",
|
|
506
|
-
dataType: typehint || null,
|
|
507
384
|
value: arbitraryValue,
|
|
508
385
|
dashedIdent
|
|
509
386
|
};
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
kind: "named",
|
|
390
|
+
value: modifier
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function parseVariant(variant, variants, parsedVariants) {
|
|
394
|
+
if (variant[0] === "[" && variant[variant.length - 1] === "]") {
|
|
395
|
+
if (variant[1] === "@" && variant.includes("&"))
|
|
396
|
+
return null;
|
|
397
|
+
let selector = decodeArbitraryValue(variant.slice(1, -1));
|
|
398
|
+
if (selector[0] !== "@") {
|
|
399
|
+
if (!selector.includes("&")) {
|
|
400
|
+
selector = `&:is(${selector})`;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
kind: "arbitrary",
|
|
405
|
+
selector,
|
|
406
|
+
compounds: true
|
|
516
407
|
};
|
|
517
408
|
}
|
|
518
|
-
|
|
409
|
+
{
|
|
410
|
+
let [variantWithoutModifier, modifier = null, additionalModifier] = segment(variant, "/");
|
|
411
|
+
if (additionalModifier)
|
|
412
|
+
return null;
|
|
413
|
+
let [root, value] = findRoot(variantWithoutModifier, variants);
|
|
414
|
+
if (root === null)
|
|
415
|
+
return null;
|
|
416
|
+
switch (variants.kind(root)) {
|
|
417
|
+
case "static": {
|
|
418
|
+
if (value !== null)
|
|
419
|
+
return null;
|
|
420
|
+
return {
|
|
421
|
+
kind: "static",
|
|
422
|
+
root,
|
|
423
|
+
compounds: variants.compounds(root)
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
case "functional": {
|
|
427
|
+
if (value === null)
|
|
428
|
+
return null;
|
|
429
|
+
if (value[0] === "[" && value[value.length - 1] === "]") {
|
|
430
|
+
return {
|
|
431
|
+
kind: "functional",
|
|
432
|
+
root,
|
|
433
|
+
modifier: modifier === null ? null : parseModifier(modifier),
|
|
434
|
+
value: {
|
|
435
|
+
kind: "arbitrary",
|
|
436
|
+
value: decodeArbitraryValue(value.slice(1, -1))
|
|
437
|
+
},
|
|
438
|
+
compounds: variants.compounds(root)
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
return {
|
|
442
|
+
kind: "functional",
|
|
443
|
+
root,
|
|
444
|
+
modifier: modifier === null ? null : parseModifier(modifier),
|
|
445
|
+
value: { kind: "named", value },
|
|
446
|
+
compounds: variants.compounds(root)
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
case "compound": {
|
|
450
|
+
if (value === null)
|
|
451
|
+
return null;
|
|
452
|
+
let subVariant = parsedVariants.get(value);
|
|
453
|
+
if (subVariant === null)
|
|
454
|
+
return null;
|
|
455
|
+
if (subVariant.compounds === false)
|
|
456
|
+
return null;
|
|
457
|
+
return {
|
|
458
|
+
kind: "compound",
|
|
459
|
+
root,
|
|
460
|
+
modifier: modifier === null ? null : { kind: "named", value: modifier },
|
|
461
|
+
variant: subVariant,
|
|
462
|
+
compounds: variants.compounds(root)
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
function findRoot(input, lookup) {
|
|
470
|
+
if (lookup.has(input))
|
|
471
|
+
return [input, null];
|
|
472
|
+
let idx = input.lastIndexOf("-");
|
|
473
|
+
if (idx === -1) {
|
|
474
|
+
if (input[0] === "@" && lookup.has("@")) {
|
|
475
|
+
return ["@", input.slice(1)];
|
|
476
|
+
}
|
|
477
|
+
return [null, null];
|
|
478
|
+
}
|
|
479
|
+
do {
|
|
480
|
+
let maybeRoot = input.slice(0, idx);
|
|
481
|
+
if (lookup.has(maybeRoot)) {
|
|
482
|
+
return [maybeRoot, input.slice(idx + 1)];
|
|
483
|
+
}
|
|
484
|
+
idx = input.lastIndexOf("-", idx - 1);
|
|
485
|
+
} while (idx > 0);
|
|
486
|
+
return [null, null];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// src/utils/default-map.ts
|
|
490
|
+
var DefaultMap = class extends Map {
|
|
491
|
+
constructor(factory) {
|
|
492
|
+
super();
|
|
493
|
+
this.factory = factory;
|
|
494
|
+
}
|
|
495
|
+
get(key) {
|
|
496
|
+
let value = super.get(key);
|
|
497
|
+
if (value === void 0) {
|
|
498
|
+
value = this.factory(key, this);
|
|
499
|
+
this.set(key, value);
|
|
500
|
+
}
|
|
501
|
+
return value;
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
// src/intellisense.ts
|
|
506
|
+
function getClassList(design) {
|
|
507
|
+
let list = [];
|
|
508
|
+
for (let [utility, fn] of design.utilities.entries()) {
|
|
509
|
+
if (typeof utility !== "string") {
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
if (fn.kind === "static") {
|
|
513
|
+
list.push([utility, { modifiers: [] }]);
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
let completions = design.utilities.getCompletions(utility);
|
|
517
|
+
for (let group of completions) {
|
|
518
|
+
for (let value of group.values) {
|
|
519
|
+
let name = value === null ? utility : `${utility}-${value}`;
|
|
520
|
+
list.push([name, { modifiers: group.modifiers }]);
|
|
521
|
+
if (group.supportsNegative) {
|
|
522
|
+
list.push([`-${name}`, { modifiers: group.modifiers }]);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
list.sort((a, b) => a[0].localeCompare(b[0]));
|
|
528
|
+
return list;
|
|
529
|
+
}
|
|
530
|
+
function getVariants(design) {
|
|
531
|
+
let list = [];
|
|
532
|
+
let parsedVariants = new DefaultMap(
|
|
533
|
+
(variant, map) => parseVariant(variant, design.variants, map)
|
|
534
|
+
);
|
|
535
|
+
for (let [root, variant] of design.variants.entries()) {
|
|
536
|
+
let selectors2 = function({ value, modifier } = {}) {
|
|
537
|
+
let name = root;
|
|
538
|
+
if (value)
|
|
539
|
+
name += `-${value}`;
|
|
540
|
+
if (modifier)
|
|
541
|
+
name += `/${modifier}`;
|
|
542
|
+
let variant2 = parsedVariants.get(name);
|
|
543
|
+
if (!variant2)
|
|
544
|
+
return [];
|
|
545
|
+
let node = rule(".__placeholder__", [decl("color", "red")]);
|
|
546
|
+
if (applyVariant(node, variant2, design.variants) === null) {
|
|
547
|
+
return [];
|
|
548
|
+
}
|
|
549
|
+
let selectors3 = [];
|
|
550
|
+
for (let child of node.nodes) {
|
|
551
|
+
if (child.kind === "rule") {
|
|
552
|
+
selectors3.push(child.selector);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return selectors3;
|
|
556
|
+
};
|
|
557
|
+
if (variant.kind === "arbitrary")
|
|
558
|
+
continue;
|
|
559
|
+
let values = design.variants.getCompletions(root);
|
|
560
|
+
switch (variant.kind) {
|
|
561
|
+
case "static": {
|
|
562
|
+
list.push({
|
|
563
|
+
name: root,
|
|
564
|
+
values,
|
|
565
|
+
isArbitrary: false,
|
|
566
|
+
hasDash: true,
|
|
567
|
+
selectors: selectors2
|
|
568
|
+
});
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
case "functional": {
|
|
572
|
+
list.push({
|
|
573
|
+
name: root,
|
|
574
|
+
values,
|
|
575
|
+
isArbitrary: true,
|
|
576
|
+
hasDash: true,
|
|
577
|
+
selectors: selectors2
|
|
578
|
+
});
|
|
579
|
+
break;
|
|
580
|
+
}
|
|
581
|
+
case "compound": {
|
|
582
|
+
list.push({
|
|
583
|
+
name: root,
|
|
584
|
+
values,
|
|
585
|
+
isArbitrary: true,
|
|
586
|
+
hasDash: true,
|
|
587
|
+
selectors: selectors2
|
|
588
|
+
});
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return list;
|
|
519
594
|
}
|
|
520
595
|
|
|
521
596
|
// src/sort.ts
|
|
@@ -925,14 +1000,19 @@ function replaceShadowColors(input, replacement) {
|
|
|
925
1000
|
}
|
|
926
1001
|
|
|
927
1002
|
// src/utilities.ts
|
|
1003
|
+
var ARBITRARY_VARIANT = Symbol("ARBITRARY_VARIANT");
|
|
928
1004
|
var Utilities = class {
|
|
929
1005
|
utilities = /* @__PURE__ */ new Map();
|
|
1006
|
+
completions = /* @__PURE__ */ new Map();
|
|
930
1007
|
static(name, compileFn) {
|
|
931
1008
|
this.set(name, { kind: "static", compileFn });
|
|
932
1009
|
}
|
|
933
1010
|
functional(name, compileFn) {
|
|
934
1011
|
this.set(name, { kind: "functional", compileFn });
|
|
935
1012
|
}
|
|
1013
|
+
arbitrary(compileFn) {
|
|
1014
|
+
this.set(ARBITRARY_VARIANT, { kind: "arbitrary", compileFn });
|
|
1015
|
+
}
|
|
936
1016
|
has(name) {
|
|
937
1017
|
return this.utilities.has(name);
|
|
938
1018
|
}
|
|
@@ -942,9 +1022,21 @@ var Utilities = class {
|
|
|
942
1022
|
kind(name) {
|
|
943
1023
|
return this.utilities.get(name).kind;
|
|
944
1024
|
}
|
|
1025
|
+
getCompletions(name) {
|
|
1026
|
+
return this.completions.get(name)?.() ?? [];
|
|
1027
|
+
}
|
|
1028
|
+
suggest(name, groups) {
|
|
1029
|
+
this.completions.set(name, groups);
|
|
1030
|
+
}
|
|
945
1031
|
keys() {
|
|
946
1032
|
return this.utilities.keys();
|
|
947
1033
|
}
|
|
1034
|
+
entries() {
|
|
1035
|
+
return this.utilities.entries();
|
|
1036
|
+
}
|
|
1037
|
+
getArbitrary() {
|
|
1038
|
+
return this.get(ARBITRARY_VARIANT).compileFn;
|
|
1039
|
+
}
|
|
948
1040
|
set(name, { kind, compileFn }) {
|
|
949
1041
|
this.utilities.set(name, {
|
|
950
1042
|
kind,
|
|
@@ -968,19 +1060,17 @@ function property(ident, initialValue, syntax) {
|
|
|
968
1060
|
]);
|
|
969
1061
|
}
|
|
970
1062
|
function withAlpha(value, alpha) {
|
|
971
|
-
if (alpha === null)
|
|
1063
|
+
if (alpha === null)
|
|
972
1064
|
return value;
|
|
973
|
-
}
|
|
974
1065
|
let alphaAsNumber = Number(alpha);
|
|
975
|
-
if (!isNaN(alphaAsNumber)) {
|
|
1066
|
+
if (!Number.isNaN(alphaAsNumber)) {
|
|
976
1067
|
alpha = `${alphaAsNumber * 100}%`;
|
|
977
1068
|
}
|
|
978
1069
|
return `color-mix(in srgb, ${value} ${alpha}, transparent)`;
|
|
979
1070
|
}
|
|
980
1071
|
function asColor(value, modifier, theme) {
|
|
981
|
-
if (!modifier)
|
|
1072
|
+
if (!modifier)
|
|
982
1073
|
return value;
|
|
983
|
-
}
|
|
984
1074
|
if (modifier.kind === "arbitrary") {
|
|
985
1075
|
return withAlpha(value, modifier.value);
|
|
986
1076
|
}
|
|
@@ -988,6 +1078,9 @@ function asColor(value, modifier, theme) {
|
|
|
988
1078
|
if (alpha) {
|
|
989
1079
|
return withAlpha(value, alpha);
|
|
990
1080
|
}
|
|
1081
|
+
if (Number.isNaN(Number(modifier.value))) {
|
|
1082
|
+
return null;
|
|
1083
|
+
}
|
|
991
1084
|
return withAlpha(value, `${modifier.value}%`);
|
|
992
1085
|
}
|
|
993
1086
|
function withNegative(value, candidate) {
|
|
@@ -1013,11 +1106,45 @@ function resolveThemeColor(candidate, theme, themeKeys) {
|
|
|
1013
1106
|
}
|
|
1014
1107
|
function createUtilities(theme) {
|
|
1015
1108
|
let utilities = new Utilities();
|
|
1109
|
+
utilities.arbitrary((candidate) => {
|
|
1110
|
+
let value = candidate.value;
|
|
1111
|
+
if (candidate.modifier) {
|
|
1112
|
+
value = asColor(value, candidate.modifier, theme);
|
|
1113
|
+
}
|
|
1114
|
+
if (value === null)
|
|
1115
|
+
return;
|
|
1116
|
+
return [decl(candidate.property, value)];
|
|
1117
|
+
});
|
|
1118
|
+
function suggest(classRoot, defns) {
|
|
1119
|
+
function* resolve(themeKeys) {
|
|
1120
|
+
for (let value of theme.keysInNamespaces(themeKeys)) {
|
|
1121
|
+
yield value.replaceAll("_", ".");
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
utilities.suggest(classRoot, () => {
|
|
1125
|
+
let groups = [];
|
|
1126
|
+
for (let defn of defns()) {
|
|
1127
|
+
if (typeof defn === "string") {
|
|
1128
|
+
groups.push({ values: [defn], modifiers: [] });
|
|
1129
|
+
continue;
|
|
1130
|
+
}
|
|
1131
|
+
let values = [
|
|
1132
|
+
...defn.values ?? [],
|
|
1133
|
+
...resolve(defn.valueThemeKeys ?? [])
|
|
1134
|
+
];
|
|
1135
|
+
let modifiers = [...defn.modifiers ?? [], ...resolve(defn.modifierThemeKeys ?? [])];
|
|
1136
|
+
if (defn.hasDefaultValue) {
|
|
1137
|
+
values.unshift(null);
|
|
1138
|
+
}
|
|
1139
|
+
groups.push({ supportsNegative: defn.supportsNegative, values, modifiers });
|
|
1140
|
+
}
|
|
1141
|
+
return groups;
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1016
1144
|
function staticUtility(className, declarations) {
|
|
1017
1145
|
utilities.static(className, (candidate) => {
|
|
1018
|
-
if (candidate.negative)
|
|
1146
|
+
if (candidate.negative)
|
|
1019
1147
|
return;
|
|
1020
|
-
}
|
|
1021
1148
|
return declarations.map((node) => {
|
|
1022
1149
|
return typeof node === "function" ? node() : decl(node[0], node[1]);
|
|
1023
1150
|
});
|
|
@@ -1034,17 +1161,24 @@ function createUtilities(theme) {
|
|
|
1034
1161
|
value = candidate.value.value;
|
|
1035
1162
|
} else {
|
|
1036
1163
|
value = theme.resolve(candidate.value.fraction ?? candidate.value.value, desc.themeKeys);
|
|
1037
|
-
if (
|
|
1164
|
+
if (value === null && desc.supportsFractions && candidate.value.fraction) {
|
|
1038
1165
|
value = `calc(${candidate.value.fraction} * 100%)`;
|
|
1039
1166
|
}
|
|
1040
|
-
if (
|
|
1167
|
+
if (value === null && desc.handleBareValue) {
|
|
1041
1168
|
value = desc.handleBareValue(candidate.value);
|
|
1042
1169
|
}
|
|
1043
1170
|
}
|
|
1044
|
-
if (
|
|
1171
|
+
if (value === null)
|
|
1045
1172
|
return;
|
|
1046
1173
|
return desc.handle(withNegative(value, candidate));
|
|
1047
1174
|
});
|
|
1175
|
+
suggest(classRoot, () => [
|
|
1176
|
+
{
|
|
1177
|
+
supportsNegative: desc.supportsNegative,
|
|
1178
|
+
valueThemeKeys: desc.themeKeys,
|
|
1179
|
+
hasDefaultValue: desc.defaultValue !== void 0 && desc.defaultValue !== null
|
|
1180
|
+
}
|
|
1181
|
+
]);
|
|
1048
1182
|
}
|
|
1049
1183
|
function colorUtility(classRoot, desc) {
|
|
1050
1184
|
utilities.functional(classRoot, (candidate) => {
|
|
@@ -1058,11 +1192,19 @@ function createUtilities(theme) {
|
|
|
1058
1192
|
value = asColor(value, candidate.modifier, theme);
|
|
1059
1193
|
} else {
|
|
1060
1194
|
value = resolveThemeColor(candidate, theme, desc.themeKeys);
|
|
1061
|
-
if (!value)
|
|
1062
|
-
return;
|
|
1063
1195
|
}
|
|
1196
|
+
if (value === null)
|
|
1197
|
+
return;
|
|
1064
1198
|
return desc.handle(value);
|
|
1065
1199
|
});
|
|
1200
|
+
suggest(classRoot, () => [
|
|
1201
|
+
{
|
|
1202
|
+
values: ["current", "transparent"],
|
|
1203
|
+
valueThemeKeys: desc.themeKeys,
|
|
1204
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
1205
|
+
modifierThemeKeys: ["--opacity"]
|
|
1206
|
+
}
|
|
1207
|
+
]);
|
|
1066
1208
|
}
|
|
1067
1209
|
staticUtility("sr-only", [
|
|
1068
1210
|
["position", "absolute"],
|
|
@@ -1219,6 +1361,13 @@ function createUtilities(theme) {
|
|
|
1219
1361
|
themeKeys: ["--z-index"],
|
|
1220
1362
|
handle: (value) => [decl("z-index", value)]
|
|
1221
1363
|
});
|
|
1364
|
+
suggest("z", () => [
|
|
1365
|
+
{
|
|
1366
|
+
supportsNegative: true,
|
|
1367
|
+
values: ["0", "10", "20", "30", "40", "50"],
|
|
1368
|
+
valueThemeKeys: ["--z-index"]
|
|
1369
|
+
}
|
|
1370
|
+
]);
|
|
1222
1371
|
staticUtility("order-first", [["order", "calc(-infinity)"]]);
|
|
1223
1372
|
staticUtility("order-last", [["order", "calc(infinity)"]]);
|
|
1224
1373
|
staticUtility("order-none", [["order", "0"]]);
|
|
@@ -1228,6 +1377,13 @@ function createUtilities(theme) {
|
|
|
1228
1377
|
themeKeys: ["--order"],
|
|
1229
1378
|
handle: (value) => [decl("order", value)]
|
|
1230
1379
|
});
|
|
1380
|
+
suggest("order", () => [
|
|
1381
|
+
{
|
|
1382
|
+
supportsNegative: true,
|
|
1383
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
1384
|
+
valueThemeKeys: ["--order"]
|
|
1385
|
+
}
|
|
1386
|
+
]);
|
|
1231
1387
|
staticUtility("col-auto", [["grid-column", "auto"]]);
|
|
1232
1388
|
functionalUtility("col", {
|
|
1233
1389
|
themeKeys: ["--grid-column"],
|
|
@@ -1251,6 +1407,24 @@ function createUtilities(theme) {
|
|
|
1251
1407
|
themeKeys: ["--grid-column-end"],
|
|
1252
1408
|
handle: (value) => [decl("grid-column-end", value)]
|
|
1253
1409
|
});
|
|
1410
|
+
suggest("col-span", () => [
|
|
1411
|
+
{
|
|
1412
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
1413
|
+
valueThemeKeys: []
|
|
1414
|
+
}
|
|
1415
|
+
]);
|
|
1416
|
+
suggest("col-start", () => [
|
|
1417
|
+
{
|
|
1418
|
+
values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
|
|
1419
|
+
valueThemeKeys: ["--grid-column-start"]
|
|
1420
|
+
}
|
|
1421
|
+
]);
|
|
1422
|
+
suggest("col-end", () => [
|
|
1423
|
+
{
|
|
1424
|
+
values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
|
|
1425
|
+
valueThemeKeys: ["--grid-column-end"]
|
|
1426
|
+
}
|
|
1427
|
+
]);
|
|
1254
1428
|
staticUtility("row-auto", [["grid-row", "auto"]]);
|
|
1255
1429
|
functionalUtility("row", {
|
|
1256
1430
|
themeKeys: ["--grid-row"],
|
|
@@ -1274,6 +1448,24 @@ function createUtilities(theme) {
|
|
|
1274
1448
|
themeKeys: ["--grid-row-end"],
|
|
1275
1449
|
handle: (value) => [decl("grid-row-end", value)]
|
|
1276
1450
|
});
|
|
1451
|
+
suggest("row-span", () => [
|
|
1452
|
+
{
|
|
1453
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
1454
|
+
valueThemeKeys: []
|
|
1455
|
+
}
|
|
1456
|
+
]);
|
|
1457
|
+
suggest("row-start", () => [
|
|
1458
|
+
{
|
|
1459
|
+
values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
|
|
1460
|
+
valueThemeKeys: ["--grid-row-start"]
|
|
1461
|
+
}
|
|
1462
|
+
]);
|
|
1463
|
+
suggest("row-end", () => [
|
|
1464
|
+
{
|
|
1465
|
+
values: Array.from({ length: 13 }, (_, i) => `${i + 1}`),
|
|
1466
|
+
valueThemeKeys: ["--grid-row-end"]
|
|
1467
|
+
}
|
|
1468
|
+
]);
|
|
1277
1469
|
staticUtility("float-start", [["float", "start"]]);
|
|
1278
1470
|
staticUtility("float-end", [["float", "end"]]);
|
|
1279
1471
|
staticUtility("float-right", [["float", "right"]]);
|
|
@@ -1327,6 +1519,12 @@ function createUtilities(theme) {
|
|
|
1327
1519
|
decl("-webkit-line-clamp", value)
|
|
1328
1520
|
]
|
|
1329
1521
|
});
|
|
1522
|
+
suggest("line-clamp", () => [
|
|
1523
|
+
{
|
|
1524
|
+
values: ["1", "2", "3", "4", "5", "6"],
|
|
1525
|
+
valueThemeKeys: ["--line-clamp"]
|
|
1526
|
+
}
|
|
1527
|
+
]);
|
|
1330
1528
|
staticUtility("block", [["display", "block"]]);
|
|
1331
1529
|
staticUtility("inline-block", [["display", "inline-block"]]);
|
|
1332
1530
|
staticUtility("inline", [["display", "inline"]]);
|
|
@@ -1498,6 +1696,20 @@ function createUtilities(theme) {
|
|
|
1498
1696
|
handleBareValue: ({ value }) => value,
|
|
1499
1697
|
handle: (value) => [decl("flex-grow", value)]
|
|
1500
1698
|
});
|
|
1699
|
+
suggest("shrink", () => [
|
|
1700
|
+
{
|
|
1701
|
+
values: ["0"],
|
|
1702
|
+
valueThemeKeys: [],
|
|
1703
|
+
hasDefaultValue: true
|
|
1704
|
+
}
|
|
1705
|
+
]);
|
|
1706
|
+
suggest("grow", () => [
|
|
1707
|
+
{
|
|
1708
|
+
values: ["0"],
|
|
1709
|
+
valueThemeKeys: [],
|
|
1710
|
+
hasDefaultValue: true
|
|
1711
|
+
}
|
|
1712
|
+
]);
|
|
1501
1713
|
staticUtility("basis-auto", [["flex-basis", "auto"]]);
|
|
1502
1714
|
staticUtility("basis-full", [["flex-basis", "100%"]]);
|
|
1503
1715
|
functionalUtility("basis", {
|
|
@@ -1574,7 +1786,7 @@ function createUtilities(theme) {
|
|
|
1574
1786
|
translateProperties(),
|
|
1575
1787
|
decl("--tw-translate-x", value),
|
|
1576
1788
|
decl("--tw-translate-y", value),
|
|
1577
|
-
decl("translate",
|
|
1789
|
+
decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
|
|
1578
1790
|
]
|
|
1579
1791
|
});
|
|
1580
1792
|
utilities.static("translate-x-full", (candidate) => {
|
|
@@ -1592,7 +1804,7 @@ function createUtilities(theme) {
|
|
|
1592
1804
|
handle: (value) => [
|
|
1593
1805
|
translateProperties(),
|
|
1594
1806
|
decl("--tw-translate-x", value),
|
|
1595
|
-
decl("translate",
|
|
1807
|
+
decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
|
|
1596
1808
|
]
|
|
1597
1809
|
});
|
|
1598
1810
|
utilities.static("translate-y-full", (candidate) => {
|
|
@@ -1610,7 +1822,7 @@ function createUtilities(theme) {
|
|
|
1610
1822
|
handle: (value) => [
|
|
1611
1823
|
translateProperties(),
|
|
1612
1824
|
decl("--tw-translate-y", value),
|
|
1613
|
-
decl("translate",
|
|
1825
|
+
decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
|
|
1614
1826
|
]
|
|
1615
1827
|
});
|
|
1616
1828
|
functionalUtility("rotate", {
|
|
@@ -1619,6 +1831,13 @@ function createUtilities(theme) {
|
|
|
1619
1831
|
handleBareValue: ({ value }) => `${value}deg`,
|
|
1620
1832
|
handle: (value) => [decl("rotate", value)]
|
|
1621
1833
|
});
|
|
1834
|
+
suggest("rotate", () => [
|
|
1835
|
+
{
|
|
1836
|
+
supportsNegative: true,
|
|
1837
|
+
values: ["0", "1", "2", "3", "6", "12", "45", "90", "180"],
|
|
1838
|
+
valueThemeKeys: ["--rotate"]
|
|
1839
|
+
}
|
|
1840
|
+
]);
|
|
1622
1841
|
let skewProperties = () => atRoot([property("--tw-skew-x", "0deg", "<angle>"), property("--tw-skew-y", "0deg", "<angle>")]);
|
|
1623
1842
|
functionalUtility("skew", {
|
|
1624
1843
|
supportsNegative: true,
|
|
@@ -1651,6 +1870,27 @@ function createUtilities(theme) {
|
|
|
1651
1870
|
decl("transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))")
|
|
1652
1871
|
]
|
|
1653
1872
|
});
|
|
1873
|
+
suggest("skew", () => [
|
|
1874
|
+
{
|
|
1875
|
+
supportsNegative: true,
|
|
1876
|
+
values: ["0", "1", "2", "3", "6", "12"],
|
|
1877
|
+
valueThemeKeys: ["--skew"]
|
|
1878
|
+
}
|
|
1879
|
+
]);
|
|
1880
|
+
suggest("skew-x", () => [
|
|
1881
|
+
{
|
|
1882
|
+
supportsNegative: true,
|
|
1883
|
+
values: ["0", "1", "2", "3", "6", "12"],
|
|
1884
|
+
valueThemeKeys: ["--skew"]
|
|
1885
|
+
}
|
|
1886
|
+
]);
|
|
1887
|
+
suggest("skew-y", () => [
|
|
1888
|
+
{
|
|
1889
|
+
supportsNegative: true,
|
|
1890
|
+
values: ["0", "1", "2", "3", "6", "12"],
|
|
1891
|
+
valueThemeKeys: ["--skew"]
|
|
1892
|
+
}
|
|
1893
|
+
]);
|
|
1654
1894
|
let scaleProperties = () => atRoot([property("--tw-scale-x", "1", "<number>"), property("--tw-scale-y", "1", "<number>")]);
|
|
1655
1895
|
functionalUtility("scale", {
|
|
1656
1896
|
supportsNegative: true,
|
|
@@ -1683,6 +1923,27 @@ function createUtilities(theme) {
|
|
|
1683
1923
|
decl("scale", "var(--tw-scale-x) var(--tw-scale-y)")
|
|
1684
1924
|
]
|
|
1685
1925
|
});
|
|
1926
|
+
suggest("scale", () => [
|
|
1927
|
+
{
|
|
1928
|
+
supportsNegative: true,
|
|
1929
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
1930
|
+
valueThemeKeys: ["--scale"]
|
|
1931
|
+
}
|
|
1932
|
+
]);
|
|
1933
|
+
suggest("scale-x", () => [
|
|
1934
|
+
{
|
|
1935
|
+
supportsNegative: true,
|
|
1936
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
1937
|
+
valueThemeKeys: ["--scale"]
|
|
1938
|
+
}
|
|
1939
|
+
]);
|
|
1940
|
+
suggest("scale-y", () => [
|
|
1941
|
+
{
|
|
1942
|
+
supportsNegative: true,
|
|
1943
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
1944
|
+
valueThemeKeys: ["--scale"]
|
|
1945
|
+
}
|
|
1946
|
+
]);
|
|
1686
1947
|
staticUtility("transform", [
|
|
1687
1948
|
skewProperties,
|
|
1688
1949
|
["transform", "skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))"]
|
|
@@ -1768,11 +2029,11 @@ function createUtilities(theme) {
|
|
|
1768
2029
|
["user-select", value]
|
|
1769
2030
|
]);
|
|
1770
2031
|
}
|
|
1771
|
-
staticUtility(
|
|
1772
|
-
staticUtility(
|
|
1773
|
-
staticUtility(
|
|
1774
|
-
staticUtility(
|
|
1775
|
-
staticUtility(
|
|
2032
|
+
staticUtility("resize-none", [["resize", "none"]]);
|
|
2033
|
+
staticUtility("resize-both", [["resize", "both"]]);
|
|
2034
|
+
staticUtility("resize-x", [["resize", "horizontal"]]);
|
|
2035
|
+
staticUtility("resize-y", [["resize", "vertical"]]);
|
|
2036
|
+
staticUtility("snap-none", [["scroll-snap-type", "none"]]);
|
|
1776
2037
|
let snapProperties = () => atRoot([property("--tw-scroll-snap-strictness", "proximity", "*")]);
|
|
1777
2038
|
for (let value of ["x", "y", "both"]) {
|
|
1778
2039
|
staticUtility(`snap-${value}`, [
|
|
@@ -1780,8 +2041,8 @@ function createUtilities(theme) {
|
|
|
1780
2041
|
["scroll-snap-type", `${value} var(--tw-scroll-snap-strictness)`]
|
|
1781
2042
|
]);
|
|
1782
2043
|
}
|
|
1783
|
-
staticUtility(
|
|
1784
|
-
staticUtility(
|
|
2044
|
+
staticUtility("snap-mandatory", [snapProperties, ["--tw-scroll-snap-strictness", "mandatory"]]);
|
|
2045
|
+
staticUtility("snap-proximity", [snapProperties, ["--tw-scroll-snap-strictness", "proximity"]]);
|
|
1785
2046
|
staticUtility("snap-align-none", [["scroll-snap-align", "none"]]);
|
|
1786
2047
|
staticUtility("snap-start", [["scroll-snap-align", "start"]]);
|
|
1787
2048
|
staticUtility("snap-end", [["scroll-snap-align", "end"]]);
|
|
@@ -1900,6 +2161,12 @@ function createUtilities(theme) {
|
|
|
1900
2161
|
handleBareValue: ({ value }) => value,
|
|
1901
2162
|
handle: (value) => [decl("columns", value)]
|
|
1902
2163
|
});
|
|
2164
|
+
suggest("columns", () => [
|
|
2165
|
+
{
|
|
2166
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
2167
|
+
valueThemeKeys: ["--columns", "--width"]
|
|
2168
|
+
}
|
|
2169
|
+
]);
|
|
1903
2170
|
for (let value of ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"]) {
|
|
1904
2171
|
staticUtility(`break-before-${value}`, [["break-before", value]]);
|
|
1905
2172
|
}
|
|
@@ -1944,6 +2211,18 @@ function createUtilities(theme) {
|
|
|
1944
2211
|
handleBareValue: ({ value }) => `repeat(${value}, minmax(0, 1fr))`,
|
|
1945
2212
|
handle: (value) => [decl("grid-template-rows", value)]
|
|
1946
2213
|
});
|
|
2214
|
+
suggest("grid-cols", () => [
|
|
2215
|
+
{
|
|
2216
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
2217
|
+
valueThemeKeys: ["--grid-template-columns"]
|
|
2218
|
+
}
|
|
2219
|
+
]);
|
|
2220
|
+
suggest("grid-rows", () => [
|
|
2221
|
+
{
|
|
2222
|
+
values: Array.from({ length: 12 }, (_, i) => `${i + 1}`),
|
|
2223
|
+
valueThemeKeys: ["--grid-template-rows"]
|
|
2224
|
+
}
|
|
2225
|
+
]);
|
|
1947
2226
|
staticUtility("flex-row", [["flex-direction", "row"]]);
|
|
1948
2227
|
staticUtility("flex-row-reverse", [["flex-direction", "row-reverse"]]);
|
|
1949
2228
|
staticUtility("flex-col", [["flex-direction", "column"]]);
|
|
@@ -2042,48 +2321,6 @@ function createUtilities(theme) {
|
|
|
2042
2321
|
decl("--tw-space-y-reverse", "1")
|
|
2043
2322
|
])
|
|
2044
2323
|
]);
|
|
2045
|
-
functionalUtility("divide-x", {
|
|
2046
|
-
defaultValue: theme.get(["--default-border-width"]) ?? "1px",
|
|
2047
|
-
themeKeys: ["--divide-width", "--border-width"],
|
|
2048
|
-
handleBareValue: ({ value }) => `${value}px`,
|
|
2049
|
-
handle: (value) => [
|
|
2050
|
-
atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
|
|
2051
|
-
rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2052
|
-
decl("--tw-sort", "divide-x-width"),
|
|
2053
|
-
decl("border-inline-end-width", `calc(${value} * var(--tw-divide-x-reverse))`),
|
|
2054
|
-
decl("border-inline-start-width", `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`)
|
|
2055
|
-
])
|
|
2056
|
-
]
|
|
2057
|
-
});
|
|
2058
|
-
functionalUtility("divide-y", {
|
|
2059
|
-
defaultValue: theme.get(["--default-border-width"]) ?? "1px",
|
|
2060
|
-
themeKeys: ["--divide-width", "--border-width"],
|
|
2061
|
-
handleBareValue: ({ value }) => `${value}px`,
|
|
2062
|
-
handle: (value) => [
|
|
2063
|
-
atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
|
|
2064
|
-
rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2065
|
-
decl("--tw-sort", "divide-y-width"),
|
|
2066
|
-
decl("border-bottom-width", `calc(${value} * var(--tw-divide-y-reverse))`),
|
|
2067
|
-
decl("border-top-width", `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`)
|
|
2068
|
-
])
|
|
2069
|
-
]
|
|
2070
|
-
});
|
|
2071
|
-
staticUtility("divide-x-reverse", [
|
|
2072
|
-
() => atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
|
|
2073
|
-
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-x-reverse", "1")])
|
|
2074
|
-
]);
|
|
2075
|
-
staticUtility("divide-y-reverse", [
|
|
2076
|
-
() => atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
|
|
2077
|
-
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-y-reverse", "1")])
|
|
2078
|
-
]);
|
|
2079
|
-
for (let value of ["solid", "dashed", "dotted", "double", "none"]) {
|
|
2080
|
-
staticUtility(`divide-${value}`, [
|
|
2081
|
-
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2082
|
-
decl("--tw-sort", "divide-style"),
|
|
2083
|
-
decl("border-style", value)
|
|
2084
|
-
])
|
|
2085
|
-
]);
|
|
2086
|
-
}
|
|
2087
2324
|
colorUtility("accent", {
|
|
2088
2325
|
themeKeys: ["--accent-color", "--color"],
|
|
2089
2326
|
handle: (value) => [decl("accent-color", value)]
|
|
@@ -2127,33 +2364,33 @@ function createUtilities(theme) {
|
|
|
2127
2364
|
staticUtility(`overscroll-x-${value}`, [["overscroll-behavior-x", value]]);
|
|
2128
2365
|
staticUtility(`overscroll-y-${value}`, [["overscroll-behavior-y", value]]);
|
|
2129
2366
|
}
|
|
2130
|
-
staticUtility(
|
|
2131
|
-
staticUtility(
|
|
2132
|
-
staticUtility(
|
|
2367
|
+
staticUtility("scroll-auto", [["scroll-behavior", "auto"]]);
|
|
2368
|
+
staticUtility("scroll-smooth", [["scroll-behavior", "smooth"]]);
|
|
2369
|
+
staticUtility("truncate", [
|
|
2133
2370
|
["overflow", "hidden"],
|
|
2134
2371
|
["text-overflow", "ellipsis"],
|
|
2135
2372
|
["white-space", "nowrap"]
|
|
2136
2373
|
]);
|
|
2137
|
-
staticUtility(
|
|
2138
|
-
staticUtility(
|
|
2139
|
-
staticUtility(
|
|
2374
|
+
staticUtility("text-ellipsis", [["text-overflow", "ellipsis"]]);
|
|
2375
|
+
staticUtility("text-clip", [["text-overflow", "clip"]]);
|
|
2376
|
+
staticUtility("hyphens-none", [
|
|
2140
2377
|
["-webkit-hyphens", "none"],
|
|
2141
2378
|
["hyphens", "none"]
|
|
2142
2379
|
]);
|
|
2143
|
-
staticUtility(
|
|
2380
|
+
staticUtility("hyphens-manual", [
|
|
2144
2381
|
["-webkit-hyphens", "manual"],
|
|
2145
2382
|
["hyphens", "manual"]
|
|
2146
2383
|
]);
|
|
2147
|
-
staticUtility(
|
|
2384
|
+
staticUtility("hyphens-auto", [
|
|
2148
2385
|
["-webkit-hyphens", "auto"],
|
|
2149
2386
|
["hyphens", "auto"]
|
|
2150
2387
|
]);
|
|
2151
|
-
staticUtility(
|
|
2152
|
-
staticUtility(
|
|
2153
|
-
staticUtility(
|
|
2154
|
-
staticUtility(
|
|
2155
|
-
staticUtility(
|
|
2156
|
-
staticUtility(
|
|
2388
|
+
staticUtility("whitespace-normal", [["white-space", "normal"]]);
|
|
2389
|
+
staticUtility("whitespace-nowrap", [["white-space", "nowrap"]]);
|
|
2390
|
+
staticUtility("whitespace-pre", [["white-space", "pre"]]);
|
|
2391
|
+
staticUtility("whitespace-pre-line", [["white-space", "pre-line"]]);
|
|
2392
|
+
staticUtility("whitespace-pre-wrap", [["white-space", "pre-wrap"]]);
|
|
2393
|
+
staticUtility("whitespace-break-spaces", [["white-space", "break-spaces"]]);
|
|
2157
2394
|
staticUtility("text-wrap", [["text-wrap", "wrap"]]);
|
|
2158
2395
|
staticUtility("text-nowrap", [["text-wrap", "nowrap"]]);
|
|
2159
2396
|
staticUtility("text-balance", [["text-wrap", "balance"]]);
|
|
@@ -2243,88 +2480,201 @@ function createUtilities(theme) {
|
|
|
2243
2480
|
themeKeys: ["--radius"],
|
|
2244
2481
|
handle: (value) => [decl("border-bottom-left-radius", value)]
|
|
2245
2482
|
});
|
|
2246
|
-
staticUtility("border-solid", [
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
staticUtility("border-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2483
|
+
staticUtility("border-solid", [
|
|
2484
|
+
["--tw-border-style", "solid"],
|
|
2485
|
+
["border-style", "solid"]
|
|
2486
|
+
]);
|
|
2487
|
+
staticUtility("border-dashed", [
|
|
2488
|
+
["--tw-border-style", "dashed"],
|
|
2489
|
+
["border-style", "dashed"]
|
|
2490
|
+
]);
|
|
2491
|
+
staticUtility("border-dotted", [
|
|
2492
|
+
["--tw-border-style", "dotted"],
|
|
2493
|
+
["border-style", "dotted"]
|
|
2494
|
+
]);
|
|
2495
|
+
staticUtility("border-double", [
|
|
2496
|
+
["--tw-border-style", "double"],
|
|
2497
|
+
["border-style", "double"]
|
|
2498
|
+
]);
|
|
2499
|
+
staticUtility("border-hidden", [
|
|
2500
|
+
["--tw-border-style", "hidden"],
|
|
2501
|
+
["border-style", "hidden"]
|
|
2502
|
+
]);
|
|
2503
|
+
staticUtility("border-none", [
|
|
2504
|
+
["--tw-border-style", "none"],
|
|
2505
|
+
["border-style", "none"]
|
|
2506
|
+
]);
|
|
2507
|
+
{
|
|
2508
|
+
let borderSideUtility2 = function(classRoot, desc) {
|
|
2509
|
+
utilities.functional(classRoot, (candidate) => {
|
|
2510
|
+
if (candidate.negative)
|
|
2511
|
+
return;
|
|
2512
|
+
if (!candidate.value) {
|
|
2513
|
+
let value = theme.get(["--default-border-width"]) ?? "1px";
|
|
2514
|
+
let decls = desc.width(value);
|
|
2515
|
+
if (!decls)
|
|
2516
|
+
return;
|
|
2517
|
+
return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
|
|
2518
|
+
}
|
|
2519
|
+
if (candidate.value.kind === "arbitrary") {
|
|
2520
|
+
let value = candidate.value.value;
|
|
2521
|
+
let type = candidate.value.dataType ?? inferDataType(value, ["color", "line-width", "length"]);
|
|
2522
|
+
switch (type) {
|
|
2523
|
+
case "line-width":
|
|
2524
|
+
case "length": {
|
|
2525
|
+
let decls = desc.width(value);
|
|
2526
|
+
if (!decls)
|
|
2527
|
+
return;
|
|
2528
|
+
return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
|
|
2529
|
+
}
|
|
2530
|
+
default: {
|
|
2531
|
+
value = asColor(value, candidate.modifier, theme);
|
|
2532
|
+
if (value === null)
|
|
2533
|
+
return;
|
|
2534
|
+
return desc.color(value);
|
|
2535
|
+
}
|
|
2268
2536
|
}
|
|
2269
|
-
|
|
2270
|
-
|
|
2537
|
+
}
|
|
2538
|
+
{
|
|
2539
|
+
let value = resolveThemeColor(candidate, theme, ["--border-color", "--color"]);
|
|
2540
|
+
if (value) {
|
|
2271
2541
|
return desc.color(value);
|
|
2272
2542
|
}
|
|
2273
2543
|
}
|
|
2274
|
-
|
|
2544
|
+
{
|
|
2545
|
+
let value = theme.resolve(candidate.value.value, ["--border-width"]);
|
|
2546
|
+
if (value) {
|
|
2547
|
+
let decls = desc.width(value);
|
|
2548
|
+
if (!decls)
|
|
2549
|
+
return;
|
|
2550
|
+
return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
|
|
2551
|
+
}
|
|
2552
|
+
if (!Number.isNaN(Number(candidate.value.value))) {
|
|
2553
|
+
let decls = desc.width(`${candidate.value.value}px`);
|
|
2554
|
+
if (!decls)
|
|
2555
|
+
return;
|
|
2556
|
+
return [borderProperties(), decl("border-style", "var(--tw-border-style)"), ...decls];
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
});
|
|
2560
|
+
suggest(classRoot, () => [
|
|
2561
|
+
{
|
|
2562
|
+
values: ["current", "transparent"],
|
|
2563
|
+
valueThemeKeys: ["--border-color", "--color"],
|
|
2564
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
2565
|
+
modifierThemeKeys: ["--opacity"],
|
|
2566
|
+
hasDefaultValue: true
|
|
2567
|
+
},
|
|
2568
|
+
{
|
|
2569
|
+
values: [],
|
|
2570
|
+
valueThemeKeys: ["--border-width"]
|
|
2571
|
+
}
|
|
2572
|
+
]);
|
|
2573
|
+
};
|
|
2574
|
+
let borderProperties = () => {
|
|
2575
|
+
return atRoot([property("--tw-border-style", "solid", "<custom-ident>")]);
|
|
2576
|
+
};
|
|
2577
|
+
borderSideUtility2("border", {
|
|
2578
|
+
width: (value) => [decl("border-width", value)],
|
|
2579
|
+
color: (value) => [decl("border-color", value)]
|
|
2580
|
+
});
|
|
2581
|
+
borderSideUtility2("border-x", {
|
|
2582
|
+
width: (value) => [decl("border-left-width", value), decl("border-right-width", value)],
|
|
2583
|
+
color: (value) => [decl("border-left-color", value), decl("border-right-color", value)]
|
|
2584
|
+
});
|
|
2585
|
+
borderSideUtility2("border-y", {
|
|
2586
|
+
width: (value) => [decl("border-top-width", value), decl("border-bottom-width", value)],
|
|
2587
|
+
color: (value) => [decl("border-top-color", value), decl("border-bottom-color", value)]
|
|
2588
|
+
});
|
|
2589
|
+
borderSideUtility2("border-s", {
|
|
2590
|
+
width: (value) => [decl("border-inline-start-width", value)],
|
|
2591
|
+
color: (value) => [decl("border-inline-start-color", value)]
|
|
2592
|
+
});
|
|
2593
|
+
borderSideUtility2("border-e", {
|
|
2594
|
+
width: (value) => [decl("border-inline-end-width", value)],
|
|
2595
|
+
color: (value) => [decl("border-inline-end-color", value)]
|
|
2596
|
+
});
|
|
2597
|
+
borderSideUtility2("border-t", {
|
|
2598
|
+
width: (value) => [decl("border-top-width", value)],
|
|
2599
|
+
color: (value) => [decl("border-top-color", value)]
|
|
2600
|
+
});
|
|
2601
|
+
borderSideUtility2("border-r", {
|
|
2602
|
+
width: (value) => [decl("border-right-width", value)],
|
|
2603
|
+
color: (value) => [decl("border-right-color", value)]
|
|
2604
|
+
});
|
|
2605
|
+
borderSideUtility2("border-b", {
|
|
2606
|
+
width: (value) => [decl("border-bottom-width", value)],
|
|
2607
|
+
color: (value) => [decl("border-bottom-color", value)]
|
|
2608
|
+
});
|
|
2609
|
+
borderSideUtility2("border-l", {
|
|
2610
|
+
width: (value) => [decl("border-left-width", value)],
|
|
2611
|
+
color: (value) => [decl("border-left-color", value)]
|
|
2612
|
+
});
|
|
2613
|
+
functionalUtility("divide-x", {
|
|
2614
|
+
defaultValue: theme.get(["--default-border-width"]) ?? "1px",
|
|
2615
|
+
themeKeys: ["--divide-width", "--border-width"],
|
|
2616
|
+
handleBareValue: ({ value }) => `${value}px`,
|
|
2617
|
+
handle: (value) => [
|
|
2618
|
+
atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
|
|
2619
|
+
rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2620
|
+
decl("--tw-sort", "divide-x-width"),
|
|
2621
|
+
borderProperties(),
|
|
2622
|
+
decl("border-style", "var(--tw-border-style)"),
|
|
2623
|
+
decl("border-inline-end-width", `calc(${value} * var(--tw-divide-x-reverse))`),
|
|
2624
|
+
decl(
|
|
2625
|
+
"border-inline-start-width",
|
|
2626
|
+
`calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`
|
|
2627
|
+
)
|
|
2628
|
+
])
|
|
2629
|
+
]
|
|
2630
|
+
});
|
|
2631
|
+
functionalUtility("divide-y", {
|
|
2632
|
+
defaultValue: theme.get(["--default-border-width"]) ?? "1px",
|
|
2633
|
+
themeKeys: ["--divide-width", "--border-width"],
|
|
2634
|
+
handleBareValue: ({ value }) => `${value}px`,
|
|
2635
|
+
handle: (value) => [
|
|
2636
|
+
atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
|
|
2637
|
+
rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2638
|
+
decl("--tw-sort", "divide-y-width"),
|
|
2639
|
+
borderProperties(),
|
|
2640
|
+
decl("border-style", "var(--tw-border-style)"),
|
|
2641
|
+
decl("border-bottom-width", `calc(${value} * var(--tw-divide-y-reverse))`),
|
|
2642
|
+
decl("border-top-width", `calc(${value} * calc(1 - var(--tw-divide-y-reverse)))`)
|
|
2643
|
+
])
|
|
2644
|
+
]
|
|
2645
|
+
});
|
|
2646
|
+
suggest("divide-x", () => [
|
|
2275
2647
|
{
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
}
|
|
2648
|
+
values: ["0", "2", "4", "8"],
|
|
2649
|
+
valueThemeKeys: ["--divide-width", "--border-width"],
|
|
2650
|
+
hasDefaultValue: true
|
|
2280
2651
|
}
|
|
2652
|
+
]);
|
|
2653
|
+
suggest("divide-y", () => [
|
|
2281
2654
|
{
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
}
|
|
2286
|
-
if (!isNaN(Number(candidate.value.value))) {
|
|
2287
|
-
return desc.width(`${candidate.value.value}px`);
|
|
2288
|
-
}
|
|
2655
|
+
values: ["0", "2", "4", "8"],
|
|
2656
|
+
valueThemeKeys: ["--divide-width", "--border-width"],
|
|
2657
|
+
hasDefaultValue: true
|
|
2289
2658
|
}
|
|
2290
|
-
|
|
2659
|
+
]);
|
|
2660
|
+
staticUtility("divide-x-reverse", [
|
|
2661
|
+
() => atRoot([property("--tw-divide-x-reverse", "0", "<number>")]),
|
|
2662
|
+
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-x-reverse", "1")])
|
|
2663
|
+
]);
|
|
2664
|
+
staticUtility("divide-y-reverse", [
|
|
2665
|
+
() => atRoot([property("--tw-divide-y-reverse", "0", "<number>")]),
|
|
2666
|
+
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [decl("--tw-divide-y-reverse", "1")])
|
|
2667
|
+
]);
|
|
2668
|
+
for (let value of ["solid", "dashed", "dotted", "double", "none"]) {
|
|
2669
|
+
staticUtility(`divide-${value}`, [
|
|
2670
|
+
() => rule(":where(& > :not([hidden]) ~ :not([hidden]))", [
|
|
2671
|
+
decl("--tw-sort", "divide-style"),
|
|
2672
|
+
decl("--tw-border-style", value),
|
|
2673
|
+
decl("border-style", value)
|
|
2674
|
+
])
|
|
2675
|
+
]);
|
|
2676
|
+
}
|
|
2291
2677
|
}
|
|
2292
|
-
borderSideUtility("border", {
|
|
2293
|
-
width: (value) => [decl("border-width", value)],
|
|
2294
|
-
color: (value) => [decl("border-color", value)]
|
|
2295
|
-
});
|
|
2296
|
-
borderSideUtility("border-x", {
|
|
2297
|
-
width: (value) => [decl("border-left-width", value), decl("border-right-width", value)],
|
|
2298
|
-
color: (value) => [decl("border-left-color", value), decl("border-right-color", value)]
|
|
2299
|
-
});
|
|
2300
|
-
borderSideUtility("border-y", {
|
|
2301
|
-
width: (value) => [decl("border-top-width", value), decl("border-bottom-width", value)],
|
|
2302
|
-
color: (value) => [decl("border-top-color", value), decl("border-bottom-color", value)]
|
|
2303
|
-
});
|
|
2304
|
-
borderSideUtility("border-s", {
|
|
2305
|
-
width: (value) => [decl("border-inline-start-width", value)],
|
|
2306
|
-
color: (value) => [decl("border-inline-start-color", value)]
|
|
2307
|
-
});
|
|
2308
|
-
borderSideUtility("border-e", {
|
|
2309
|
-
width: (value) => [decl("border-inline-end-width", value)],
|
|
2310
|
-
color: (value) => [decl("border-inline-end-color", value)]
|
|
2311
|
-
});
|
|
2312
|
-
borderSideUtility("border-t", {
|
|
2313
|
-
width: (value) => [decl("border-top-width", value)],
|
|
2314
|
-
color: (value) => [decl("border-top-color", value)]
|
|
2315
|
-
});
|
|
2316
|
-
borderSideUtility("border-r", {
|
|
2317
|
-
width: (value) => [decl("border-right-width", value)],
|
|
2318
|
-
color: (value) => [decl("border-right-color", value)]
|
|
2319
|
-
});
|
|
2320
|
-
borderSideUtility("border-b", {
|
|
2321
|
-
width: (value) => [decl("border-bottom-width", value)],
|
|
2322
|
-
color: (value) => [decl("border-bottom-color", value)]
|
|
2323
|
-
});
|
|
2324
|
-
borderSideUtility("border-l", {
|
|
2325
|
-
width: (value) => [decl("border-left-width", value)],
|
|
2326
|
-
color: (value) => [decl("border-left-color", value)]
|
|
2327
|
-
});
|
|
2328
2678
|
staticUtility("bg-inherit", [["background-color", "inherit"]]);
|
|
2329
2679
|
staticUtility("bg-transparent", [["background-color", "transparent"]]);
|
|
2330
2680
|
staticUtility("bg-auto", [["background-size", "auto"]]);
|
|
@@ -2364,9 +2714,8 @@ function createUtilities(theme) {
|
|
|
2364
2714
|
]);
|
|
2365
2715
|
}
|
|
2366
2716
|
utilities.functional("bg", (candidate) => {
|
|
2367
|
-
if (candidate.negative || !candidate.value)
|
|
2717
|
+
if (candidate.negative || !candidate.value)
|
|
2368
2718
|
return;
|
|
2369
|
-
}
|
|
2370
2719
|
if (candidate.value.kind === "arbitrary") {
|
|
2371
2720
|
let value = candidate.value.value;
|
|
2372
2721
|
let type = candidate.value.dataType ?? inferDataType(value, [
|
|
@@ -2394,6 +2743,8 @@ function createUtilities(theme) {
|
|
|
2394
2743
|
}
|
|
2395
2744
|
default: {
|
|
2396
2745
|
value = asColor(value, candidate.modifier, theme);
|
|
2746
|
+
if (value === null)
|
|
2747
|
+
return;
|
|
2397
2748
|
return [decl("background-color", value)];
|
|
2398
2749
|
}
|
|
2399
2750
|
}
|
|
@@ -2411,6 +2762,18 @@ function createUtilities(theme) {
|
|
|
2411
2762
|
}
|
|
2412
2763
|
}
|
|
2413
2764
|
});
|
|
2765
|
+
suggest("bg", () => [
|
|
2766
|
+
{
|
|
2767
|
+
values: ["current", "transparent"],
|
|
2768
|
+
valueThemeKeys: ["--background-color", "--color"],
|
|
2769
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
2770
|
+
modifierThemeKeys: ["--opacity"]
|
|
2771
|
+
},
|
|
2772
|
+
{
|
|
2773
|
+
values: [],
|
|
2774
|
+
valueThemeKeys: ["--background-image"]
|
|
2775
|
+
}
|
|
2776
|
+
]);
|
|
2414
2777
|
let gradientStopProperties = () => {
|
|
2415
2778
|
return atRoot([
|
|
2416
2779
|
property("--tw-gradient-from", "#0000", "<color>"),
|
|
@@ -2427,9 +2790,8 @@ function createUtilities(theme) {
|
|
|
2427
2790
|
};
|
|
2428
2791
|
function gradientStopUtility(classRoot, desc) {
|
|
2429
2792
|
utilities.functional(classRoot, (candidate) => {
|
|
2430
|
-
if (candidate.negative || !candidate.value)
|
|
2793
|
+
if (candidate.negative || !candidate.value)
|
|
2431
2794
|
return;
|
|
2432
|
-
}
|
|
2433
2795
|
if (candidate.value.kind === "arbitrary") {
|
|
2434
2796
|
let value = candidate.value.value;
|
|
2435
2797
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage"]);
|
|
@@ -2440,6 +2802,8 @@ function createUtilities(theme) {
|
|
|
2440
2802
|
}
|
|
2441
2803
|
default: {
|
|
2442
2804
|
value = asColor(value, candidate.modifier, theme);
|
|
2805
|
+
if (value === null)
|
|
2806
|
+
return;
|
|
2443
2807
|
return desc.color(value);
|
|
2444
2808
|
}
|
|
2445
2809
|
}
|
|
@@ -2459,6 +2823,18 @@ function createUtilities(theme) {
|
|
|
2459
2823
|
}
|
|
2460
2824
|
}
|
|
2461
2825
|
});
|
|
2826
|
+
suggest(classRoot, () => [
|
|
2827
|
+
{
|
|
2828
|
+
values: ["current", "transparent"],
|
|
2829
|
+
valueThemeKeys: ["--background-color", "--color"],
|
|
2830
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
2831
|
+
modifierThemeKeys: ["--opacity"]
|
|
2832
|
+
},
|
|
2833
|
+
{
|
|
2834
|
+
values: Array.from({ length: 21 }, (_, index) => `${index * 5}%`),
|
|
2835
|
+
valueThemeKeys: ["--gradient-color-stop-positions"]
|
|
2836
|
+
}
|
|
2837
|
+
]);
|
|
2462
2838
|
}
|
|
2463
2839
|
gradientStopUtility("from", {
|
|
2464
2840
|
color: (value) => [
|
|
@@ -2480,9 +2856,9 @@ function createUtilities(theme) {
|
|
|
2480
2856
|
decl("--tw-gradient-via", value),
|
|
2481
2857
|
decl(
|
|
2482
2858
|
"--tw-gradient-via-stops",
|
|
2483
|
-
|
|
2859
|
+
"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)"
|
|
2484
2860
|
),
|
|
2485
|
-
decl("--tw-gradient-stops",
|
|
2861
|
+
decl("--tw-gradient-stops", "var(--tw-gradient-via-stops)")
|
|
2486
2862
|
],
|
|
2487
2863
|
position: (value) => [gradientStopProperties(), decl("--tw-gradient-via-position", value)]
|
|
2488
2864
|
});
|
|
@@ -2542,25 +2918,34 @@ function createUtilities(theme) {
|
|
|
2542
2918
|
staticUtility(`bg-blend-${value}`, [["background-blend-mode", value]]);
|
|
2543
2919
|
staticUtility(`mix-blend-${value}`, [["mix-blend-mode", value]]);
|
|
2544
2920
|
}
|
|
2545
|
-
staticUtility(
|
|
2546
|
-
staticUtility(
|
|
2921
|
+
staticUtility("mix-blend-plus-darker", [["mix-blend-mode", "plus-darker"]]);
|
|
2922
|
+
staticUtility("mix-blend-plus-lighter", [["mix-blend-mode", "plus-lighter"]]);
|
|
2547
2923
|
utilities.functional("fill", (candidate) => {
|
|
2548
|
-
if (candidate.negative || !candidate.value)
|
|
2924
|
+
if (candidate.negative || !candidate.value)
|
|
2549
2925
|
return;
|
|
2550
|
-
}
|
|
2551
2926
|
if (candidate.value.kind === "arbitrary") {
|
|
2552
|
-
|
|
2927
|
+
let value2 = asColor(candidate.value.value, candidate.modifier, theme);
|
|
2928
|
+
if (value2 === null)
|
|
2929
|
+
return;
|
|
2930
|
+
return [decl("fill", value2)];
|
|
2553
2931
|
}
|
|
2554
2932
|
let value = resolveThemeColor(candidate, theme, ["--fill", "--color"]);
|
|
2555
2933
|
if (value) {
|
|
2556
2934
|
return [decl("fill", value)];
|
|
2557
2935
|
}
|
|
2558
2936
|
});
|
|
2937
|
+
suggest("fill", () => [
|
|
2938
|
+
{
|
|
2939
|
+
values: ["current", "transparent"],
|
|
2940
|
+
valueThemeKeys: ["--fill", "--color"],
|
|
2941
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
2942
|
+
modifierThemeKeys: ["--opacity"]
|
|
2943
|
+
}
|
|
2944
|
+
]);
|
|
2559
2945
|
staticUtility("stroke-none", [["stroke", "none"]]);
|
|
2560
2946
|
utilities.functional("stroke", (candidate) => {
|
|
2561
|
-
if (candidate.negative || !candidate.value)
|
|
2947
|
+
if (candidate.negative || !candidate.value)
|
|
2562
2948
|
return;
|
|
2563
|
-
}
|
|
2564
2949
|
if (candidate.value.kind === "arbitrary") {
|
|
2565
2950
|
let value = candidate.value.value;
|
|
2566
2951
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "number", "length", "percentage"]);
|
|
@@ -2572,6 +2957,8 @@ function createUtilities(theme) {
|
|
|
2572
2957
|
}
|
|
2573
2958
|
default: {
|
|
2574
2959
|
value = asColor(candidate.value.value, candidate.modifier, theme);
|
|
2960
|
+
if (value === null)
|
|
2961
|
+
return;
|
|
2575
2962
|
return [decl("stroke", value)];
|
|
2576
2963
|
}
|
|
2577
2964
|
}
|
|
@@ -2586,11 +2973,23 @@ function createUtilities(theme) {
|
|
|
2586
2973
|
let value = theme.resolve(candidate.value.value, ["--stroke-width"]);
|
|
2587
2974
|
if (value) {
|
|
2588
2975
|
return [decl("stroke-width", value)];
|
|
2589
|
-
} else if (!isNaN(Number(candidate.value.value))) {
|
|
2976
|
+
} else if (!Number.isNaN(Number(candidate.value.value))) {
|
|
2590
2977
|
return [decl("stroke-width", candidate.value.value)];
|
|
2591
2978
|
}
|
|
2592
2979
|
}
|
|
2593
2980
|
});
|
|
2981
|
+
suggest("stroke", () => [
|
|
2982
|
+
{
|
|
2983
|
+
values: ["current", "transparent"],
|
|
2984
|
+
valueThemeKeys: ["--stroke", "--color"],
|
|
2985
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
2986
|
+
modifierThemeKeys: ["--opacity"]
|
|
2987
|
+
},
|
|
2988
|
+
{
|
|
2989
|
+
values: ["0", "1", "2", "3"],
|
|
2990
|
+
valueThemeKeys: ["--stroke-width"]
|
|
2991
|
+
}
|
|
2992
|
+
]);
|
|
2594
2993
|
staticUtility("object-contain", [["object-fit", "contain"]]);
|
|
2595
2994
|
staticUtility("object-cover", [["object-fit", "cover"]]);
|
|
2596
2995
|
staticUtility("object-fill", [["object-fit", "fill"]]);
|
|
@@ -2669,9 +3068,8 @@ function createUtilities(theme) {
|
|
|
2669
3068
|
handle: (value) => [decl("vertical-align", value)]
|
|
2670
3069
|
});
|
|
2671
3070
|
utilities.functional("font", (candidate) => {
|
|
2672
|
-
if (candidate.negative || !candidate.value)
|
|
3071
|
+
if (candidate.negative || !candidate.value)
|
|
2673
3072
|
return;
|
|
2674
|
-
}
|
|
2675
3073
|
if (candidate.value.kind === "arbitrary") {
|
|
2676
3074
|
let value = candidate.value.value;
|
|
2677
3075
|
let type = candidate.value.dataType ?? inferDataType(value, ["number", "generic-name", "family-name"]);
|
|
@@ -2739,6 +3137,26 @@ function createUtilities(theme) {
|
|
|
2739
3137
|
}
|
|
2740
3138
|
}
|
|
2741
3139
|
});
|
|
3140
|
+
suggest("font", () => [
|
|
3141
|
+
{
|
|
3142
|
+
values: [],
|
|
3143
|
+
valueThemeKeys: ["--font-family"]
|
|
3144
|
+
},
|
|
3145
|
+
{
|
|
3146
|
+
values: [
|
|
3147
|
+
"thin",
|
|
3148
|
+
"extralight",
|
|
3149
|
+
"light",
|
|
3150
|
+
"normal",
|
|
3151
|
+
"medium",
|
|
3152
|
+
"semibold",
|
|
3153
|
+
"bold",
|
|
3154
|
+
"extrabold",
|
|
3155
|
+
"black"
|
|
3156
|
+
],
|
|
3157
|
+
valueThemeKeys: ["--font-weight"]
|
|
3158
|
+
}
|
|
3159
|
+
]);
|
|
2742
3160
|
staticUtility("uppercase", [["text-transform", "uppercase"]]);
|
|
2743
3161
|
staticUtility("lowercase", [["text-transform", "lowercase"]]);
|
|
2744
3162
|
staticUtility("capitalize", [["text-transform", "capitalize"]]);
|
|
@@ -2763,9 +3181,8 @@ function createUtilities(theme) {
|
|
|
2763
3181
|
staticUtility("decoration-auto", [["text-decoration-thickness", "auto"]]);
|
|
2764
3182
|
staticUtility("decoration-from-font", [["text-decoration-thickness", "from-font"]]);
|
|
2765
3183
|
utilities.functional("decoration", (candidate) => {
|
|
2766
|
-
if (candidate.negative || !candidate.value)
|
|
3184
|
+
if (candidate.negative || !candidate.value)
|
|
2767
3185
|
return;
|
|
2768
|
-
}
|
|
2769
3186
|
if (candidate.value.kind === "arbitrary") {
|
|
2770
3187
|
let value = candidate.value.value;
|
|
2771
3188
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage"]);
|
|
@@ -2776,6 +3193,8 @@ function createUtilities(theme) {
|
|
|
2776
3193
|
}
|
|
2777
3194
|
default: {
|
|
2778
3195
|
value = asColor(value, candidate.modifier, theme);
|
|
3196
|
+
if (value === null)
|
|
3197
|
+
return;
|
|
2779
3198
|
return [decl("text-decoration-color", value)];
|
|
2780
3199
|
}
|
|
2781
3200
|
}
|
|
@@ -2785,7 +3204,7 @@ function createUtilities(theme) {
|
|
|
2785
3204
|
if (value) {
|
|
2786
3205
|
return [decl("text-decoration-thickness", value)];
|
|
2787
3206
|
}
|
|
2788
|
-
if (!isNaN(Number(candidate.value.value))) {
|
|
3207
|
+
if (!Number.isNaN(Number(candidate.value.value))) {
|
|
2789
3208
|
return [decl("text-decoration-thickness", `${candidate.value.value}px`)];
|
|
2790
3209
|
}
|
|
2791
3210
|
}
|
|
@@ -2796,6 +3215,18 @@ function createUtilities(theme) {
|
|
|
2796
3215
|
}
|
|
2797
3216
|
}
|
|
2798
3217
|
});
|
|
3218
|
+
suggest("decoration", () => [
|
|
3219
|
+
{
|
|
3220
|
+
values: ["current", "transparent"],
|
|
3221
|
+
valueThemeKeys: ["--text-decoration-color", "--color"],
|
|
3222
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
3223
|
+
modifierThemeKeys: ["--opacity"]
|
|
3224
|
+
},
|
|
3225
|
+
{
|
|
3226
|
+
values: ["0", "1", "2"],
|
|
3227
|
+
valueThemeKeys: ["--text-decoration-thickness"]
|
|
3228
|
+
}
|
|
3229
|
+
]);
|
|
2799
3230
|
staticUtility("animate-none", [["animation", "none"]]);
|
|
2800
3231
|
functionalUtility("animate", {
|
|
2801
3232
|
themeKeys: ["--animate"],
|
|
@@ -2851,14 +3282,13 @@ function createUtilities(theme) {
|
|
|
2851
3282
|
]);
|
|
2852
3283
|
};
|
|
2853
3284
|
utilities.functional("filter", (candidate) => {
|
|
2854
|
-
if (candidate.negative)
|
|
3285
|
+
if (candidate.negative)
|
|
2855
3286
|
return;
|
|
2856
|
-
}
|
|
2857
3287
|
if (candidate.value === null) {
|
|
2858
3288
|
return [filterProperties(), decl("filter", cssFilterValue)];
|
|
2859
3289
|
}
|
|
2860
3290
|
if (candidate.value.kind === "arbitrary") {
|
|
2861
|
-
return;
|
|
3291
|
+
return [decl("filter", candidate.value.value)];
|
|
2862
3292
|
}
|
|
2863
3293
|
switch (candidate.value.value) {
|
|
2864
3294
|
case "none":
|
|
@@ -2866,9 +3296,8 @@ function createUtilities(theme) {
|
|
|
2866
3296
|
}
|
|
2867
3297
|
});
|
|
2868
3298
|
utilities.functional("backdrop-filter", (candidate) => {
|
|
2869
|
-
if (candidate.negative)
|
|
3299
|
+
if (candidate.negative)
|
|
2870
3300
|
return;
|
|
2871
|
-
}
|
|
2872
3301
|
if (candidate.value === null) {
|
|
2873
3302
|
return [
|
|
2874
3303
|
backdropFilterProperties(),
|
|
@@ -2877,7 +3306,10 @@ function createUtilities(theme) {
|
|
|
2877
3306
|
];
|
|
2878
3307
|
}
|
|
2879
3308
|
if (candidate.value.kind === "arbitrary") {
|
|
2880
|
-
return
|
|
3309
|
+
return [
|
|
3310
|
+
decl("-webkit-backdrop-filter", candidate.value.value),
|
|
3311
|
+
decl("backdrop-filter", candidate.value.value)
|
|
3312
|
+
];
|
|
2881
3313
|
}
|
|
2882
3314
|
switch (candidate.value.value) {
|
|
2883
3315
|
case "none":
|
|
@@ -2920,6 +3352,18 @@ function createUtilities(theme) {
|
|
|
2920
3352
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
2921
3353
|
]
|
|
2922
3354
|
});
|
|
3355
|
+
suggest("brightness", () => [
|
|
3356
|
+
{
|
|
3357
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
3358
|
+
valueThemeKeys: ["--brightness"]
|
|
3359
|
+
}
|
|
3360
|
+
]);
|
|
3361
|
+
suggest("backdrop-brightness", () => [
|
|
3362
|
+
{
|
|
3363
|
+
values: ["0", "50", "75", "90", "95", "100", "105", "110", "125", "150", "200"],
|
|
3364
|
+
valueThemeKeys: ["--backdrop-brightness", "--brightness"]
|
|
3365
|
+
}
|
|
3366
|
+
]);
|
|
2923
3367
|
functionalUtility("contrast", {
|
|
2924
3368
|
themeKeys: ["--contrast"],
|
|
2925
3369
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -2939,6 +3383,18 @@ function createUtilities(theme) {
|
|
|
2939
3383
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
2940
3384
|
]
|
|
2941
3385
|
});
|
|
3386
|
+
suggest("contrast", () => [
|
|
3387
|
+
{
|
|
3388
|
+
values: ["0", "50", "75", "100", "125", "150", "200"],
|
|
3389
|
+
valueThemeKeys: ["--contrast"]
|
|
3390
|
+
}
|
|
3391
|
+
]);
|
|
3392
|
+
suggest("backdrop-contrast", () => [
|
|
3393
|
+
{
|
|
3394
|
+
values: ["0", "50", "75", "100", "125", "150", "200"],
|
|
3395
|
+
valueThemeKeys: ["--backdrop-contrast", "--contrast"]
|
|
3396
|
+
}
|
|
3397
|
+
]);
|
|
2942
3398
|
functionalUtility("grayscale", {
|
|
2943
3399
|
themeKeys: ["--grayscale"],
|
|
2944
3400
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -2960,6 +3416,20 @@ function createUtilities(theme) {
|
|
|
2960
3416
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
2961
3417
|
]
|
|
2962
3418
|
});
|
|
3419
|
+
suggest("grayscale", () => [
|
|
3420
|
+
{
|
|
3421
|
+
values: ["0", "25", "50", "75", "100"],
|
|
3422
|
+
valueThemeKeys: ["--grayscale"],
|
|
3423
|
+
hasDefaultValue: true
|
|
3424
|
+
}
|
|
3425
|
+
]);
|
|
3426
|
+
suggest("backdrop-grayscale", () => [
|
|
3427
|
+
{
|
|
3428
|
+
values: ["0", "25", "50", "75", "100"],
|
|
3429
|
+
valueThemeKeys: ["--backdrop-grayscale", "--grayscale"],
|
|
3430
|
+
hasDefaultValue: true
|
|
3431
|
+
}
|
|
3432
|
+
]);
|
|
2963
3433
|
functionalUtility("hue-rotate", {
|
|
2964
3434
|
themeKeys: ["--hue-rotate"],
|
|
2965
3435
|
handleBareValue: ({ value }) => `${value}deg`,
|
|
@@ -2979,6 +3449,18 @@ function createUtilities(theme) {
|
|
|
2979
3449
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
2980
3450
|
]
|
|
2981
3451
|
});
|
|
3452
|
+
suggest("hue-rotate", () => [
|
|
3453
|
+
{
|
|
3454
|
+
values: ["0", "15", "30", "60", "90", "180"],
|
|
3455
|
+
valueThemeKeys: ["--hue-rotate"]
|
|
3456
|
+
}
|
|
3457
|
+
]);
|
|
3458
|
+
suggest("backdrop-hue-rotate", () => [
|
|
3459
|
+
{
|
|
3460
|
+
values: ["0", "15", "30", "60", "90", "180"],
|
|
3461
|
+
valueThemeKeys: ["--backdrop-hue-rotate", "--hue-rotate"]
|
|
3462
|
+
}
|
|
3463
|
+
]);
|
|
2982
3464
|
functionalUtility("invert", {
|
|
2983
3465
|
themeKeys: ["--invert"],
|
|
2984
3466
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -3000,6 +3482,20 @@ function createUtilities(theme) {
|
|
|
3000
3482
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3001
3483
|
]
|
|
3002
3484
|
});
|
|
3485
|
+
suggest("invert", () => [
|
|
3486
|
+
{
|
|
3487
|
+
values: ["0", "25", "50", "75", "100"],
|
|
3488
|
+
valueThemeKeys: ["--invert"],
|
|
3489
|
+
hasDefaultValue: true
|
|
3490
|
+
}
|
|
3491
|
+
]);
|
|
3492
|
+
suggest("backdrop-invert", () => [
|
|
3493
|
+
{
|
|
3494
|
+
values: ["0", "25", "50", "75", "100"],
|
|
3495
|
+
valueThemeKeys: ["--backdrop-invert", "--invert"],
|
|
3496
|
+
hasDefaultValue: true
|
|
3497
|
+
}
|
|
3498
|
+
]);
|
|
3003
3499
|
functionalUtility("saturate", {
|
|
3004
3500
|
themeKeys: ["--saturate"],
|
|
3005
3501
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -3019,6 +3515,18 @@ function createUtilities(theme) {
|
|
|
3019
3515
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3020
3516
|
]
|
|
3021
3517
|
});
|
|
3518
|
+
suggest("saturate", () => [
|
|
3519
|
+
{
|
|
3520
|
+
values: ["0", "50", "100", "150", "200"],
|
|
3521
|
+
valueThemeKeys: ["--saturate"]
|
|
3522
|
+
}
|
|
3523
|
+
]);
|
|
3524
|
+
suggest("backdrop-saturate", () => [
|
|
3525
|
+
{
|
|
3526
|
+
values: ["0", "50", "100", "150", "200"],
|
|
3527
|
+
valueThemeKeys: ["--backdrop-saturate", "--saturate"]
|
|
3528
|
+
}
|
|
3529
|
+
]);
|
|
3022
3530
|
functionalUtility("sepia", {
|
|
3023
3531
|
themeKeys: ["--sepia"],
|
|
3024
3532
|
handleBareValue: ({ value }) => `${value}%`,
|
|
@@ -3040,6 +3548,20 @@ function createUtilities(theme) {
|
|
|
3040
3548
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3041
3549
|
]
|
|
3042
3550
|
});
|
|
3551
|
+
suggest("sepia", () => [
|
|
3552
|
+
{
|
|
3553
|
+
values: ["0", "50", "100"],
|
|
3554
|
+
valueThemeKeys: ["--sepia"],
|
|
3555
|
+
hasDefaultValue: true
|
|
3556
|
+
}
|
|
3557
|
+
]);
|
|
3558
|
+
suggest("backdrop-sepia", () => [
|
|
3559
|
+
{
|
|
3560
|
+
values: ["0", "50", "100"],
|
|
3561
|
+
valueThemeKeys: ["--backdrop-sepia", "--sepia"],
|
|
3562
|
+
hasDefaultValue: true
|
|
3563
|
+
}
|
|
3564
|
+
]);
|
|
3043
3565
|
functionalUtility("drop-shadow", {
|
|
3044
3566
|
themeKeys: ["--drop-shadow"],
|
|
3045
3567
|
handle: (value) => [
|
|
@@ -3054,7 +3576,6 @@ function createUtilities(theme) {
|
|
|
3054
3576
|
functionalUtility("backdrop-opacity", {
|
|
3055
3577
|
themeKeys: ["--backdrop-opacity", "--opacity"],
|
|
3056
3578
|
handleBareValue: ({ value }) => `${value}%`,
|
|
3057
|
-
defaultValue: "100%",
|
|
3058
3579
|
handle: (value) => [
|
|
3059
3580
|
backdropFilterProperties(),
|
|
3060
3581
|
decl("--tw-backdrop-opacity", `opacity(${value})`),
|
|
@@ -3062,6 +3583,12 @@ function createUtilities(theme) {
|
|
|
3062
3583
|
decl("backdrop-filter", cssBackdropFilterValue)
|
|
3063
3584
|
]
|
|
3064
3585
|
});
|
|
3586
|
+
suggest("backdrop-opacity", () => [
|
|
3587
|
+
{
|
|
3588
|
+
values: Array.from({ length: 21 }, (_, i) => `${i * 5}`),
|
|
3589
|
+
valueThemeKeys: ["--backdrop-opacity", "--opacity"]
|
|
3590
|
+
}
|
|
3591
|
+
]);
|
|
3065
3592
|
}
|
|
3066
3593
|
{
|
|
3067
3594
|
let defaultTimingFunction = "var(--default-transition-timing-function)";
|
|
@@ -3121,14 +3648,26 @@ function createUtilities(theme) {
|
|
|
3121
3648
|
value = theme.resolve(candidate.value.fraction ?? candidate.value.value, [
|
|
3122
3649
|
"--transition-duration"
|
|
3123
3650
|
]);
|
|
3124
|
-
if (
|
|
3651
|
+
if (value === null && !Number.isNaN(Number(candidate.value.value))) {
|
|
3125
3652
|
value = `${candidate.value.value}ms`;
|
|
3126
3653
|
}
|
|
3127
|
-
if (!value)
|
|
3128
|
-
return;
|
|
3129
3654
|
}
|
|
3655
|
+
if (value === null)
|
|
3656
|
+
return;
|
|
3130
3657
|
return [decl("transition-duration", value)];
|
|
3131
3658
|
});
|
|
3659
|
+
suggest("delay", () => [
|
|
3660
|
+
{
|
|
3661
|
+
values: ["75", "100", "150", "200", "300", "500", "700", "1000"],
|
|
3662
|
+
valueThemeKeys: ["--transition-delay"]
|
|
3663
|
+
}
|
|
3664
|
+
]);
|
|
3665
|
+
suggest("duration", () => [
|
|
3666
|
+
{
|
|
3667
|
+
values: ["75", "100", "150", "200", "300", "500", "700", "1000"],
|
|
3668
|
+
valueThemeKeys: ["--transition-duration"]
|
|
3669
|
+
}
|
|
3670
|
+
]);
|
|
3132
3671
|
}
|
|
3133
3672
|
functionalUtility("ease", {
|
|
3134
3673
|
themeKeys: ["--transition-timing-function"],
|
|
@@ -3266,61 +3805,121 @@ function createUtilities(theme) {
|
|
|
3266
3805
|
["font-variant-numeric", cssFontVariantNumericValue]
|
|
3267
3806
|
]);
|
|
3268
3807
|
}
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3808
|
+
{
|
|
3809
|
+
let outlineProperties = () => {
|
|
3810
|
+
return atRoot([property("--tw-outline-style", "solid", "<custom-ident>")]);
|
|
3811
|
+
};
|
|
3812
|
+
staticUtility("outline-none", [
|
|
3813
|
+
["outline", "2px solid transparent"],
|
|
3814
|
+
["outline-offset", "2px"]
|
|
3815
|
+
]);
|
|
3816
|
+
staticUtility("outline-solid", [
|
|
3817
|
+
["--tw-outline-style", "solid"],
|
|
3818
|
+
["outline-style", "solid"]
|
|
3819
|
+
]);
|
|
3820
|
+
staticUtility("outline-dashed", [
|
|
3821
|
+
["--tw-outline-style", "dashed"],
|
|
3822
|
+
["outline-style", "dashed"]
|
|
3823
|
+
]);
|
|
3824
|
+
staticUtility("outline-dotted", [
|
|
3825
|
+
["--tw-outline-style", "dotted"],
|
|
3826
|
+
["outline-style", "dotted"]
|
|
3827
|
+
]);
|
|
3828
|
+
staticUtility("outline-double", [
|
|
3829
|
+
["--tw-outline-style", "double"],
|
|
3830
|
+
["outline-style", "double"]
|
|
3831
|
+
]);
|
|
3832
|
+
utilities.functional("outline", (candidate) => {
|
|
3833
|
+
if (candidate.negative)
|
|
3834
|
+
return;
|
|
3835
|
+
if (candidate.value === null) {
|
|
3836
|
+
return [
|
|
3837
|
+
outlineProperties(),
|
|
3838
|
+
decl("outline-style", "var(--tw-outline-style)"),
|
|
3839
|
+
decl("outline-width", "1px")
|
|
3840
|
+
];
|
|
3841
|
+
}
|
|
3842
|
+
if (candidate.value.kind === "arbitrary") {
|
|
3843
|
+
let value = candidate.value.value;
|
|
3844
|
+
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "number", "percentage"]);
|
|
3845
|
+
switch (type) {
|
|
3846
|
+
case "length":
|
|
3847
|
+
case "number":
|
|
3848
|
+
case "percentage": {
|
|
3849
|
+
return [
|
|
3850
|
+
outlineProperties(),
|
|
3851
|
+
decl("outline-style", "var(--tw-outline-style)"),
|
|
3852
|
+
decl("outline-width", value)
|
|
3853
|
+
];
|
|
3854
|
+
}
|
|
3855
|
+
default: {
|
|
3856
|
+
value = asColor(value, candidate.modifier, theme);
|
|
3857
|
+
if (value === null)
|
|
3858
|
+
return;
|
|
3859
|
+
return [decl("outline-color", value)];
|
|
3860
|
+
}
|
|
3291
3861
|
}
|
|
3292
|
-
|
|
3293
|
-
|
|
3862
|
+
}
|
|
3863
|
+
{
|
|
3864
|
+
let value = resolveThemeColor(candidate, theme, ["--outline-color", "--color"]);
|
|
3865
|
+
if (value) {
|
|
3294
3866
|
return [decl("outline-color", value)];
|
|
3295
3867
|
}
|
|
3296
3868
|
}
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3869
|
+
{
|
|
3870
|
+
let value = theme.resolve(candidate.value.value, ["--outline-width"]);
|
|
3871
|
+
if (value) {
|
|
3872
|
+
return [
|
|
3873
|
+
outlineProperties(),
|
|
3874
|
+
decl("outline-style", "var(--tw-outline-style)"),
|
|
3875
|
+
decl("outline-width", value)
|
|
3876
|
+
];
|
|
3877
|
+
} else if (!Number.isNaN(Number(candidate.value.value))) {
|
|
3878
|
+
return [
|
|
3879
|
+
outlineProperties(),
|
|
3880
|
+
decl("outline-style", "var(--tw-outline-style)"),
|
|
3881
|
+
decl("outline-width", `${candidate.value.value}px`)
|
|
3882
|
+
];
|
|
3883
|
+
}
|
|
3302
3884
|
}
|
|
3303
|
-
}
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3885
|
+
});
|
|
3886
|
+
suggest("outline", () => [
|
|
3887
|
+
{
|
|
3888
|
+
values: ["current", "transparent"],
|
|
3889
|
+
valueThemeKeys: ["--outline-color", "--color"],
|
|
3890
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
3891
|
+
modifierThemeKeys: ["--opacity"],
|
|
3892
|
+
hasDefaultValue: true
|
|
3893
|
+
},
|
|
3894
|
+
{
|
|
3895
|
+
values: ["0", "1", "2", "4", "8"],
|
|
3896
|
+
valueThemeKeys: ["--outline-width"]
|
|
3310
3897
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3898
|
+
]);
|
|
3899
|
+
functionalUtility("outline-offset", {
|
|
3900
|
+
supportsNegative: true,
|
|
3901
|
+
themeKeys: ["--outline-offset"],
|
|
3902
|
+
handleBareValue: ({ value }) => `${value}px`,
|
|
3903
|
+
handle: (value) => [decl("outline-offset", value)]
|
|
3904
|
+
});
|
|
3905
|
+
suggest("outline-offset", () => [
|
|
3906
|
+
{
|
|
3907
|
+
values: ["0", "1", "2", "4", "8"],
|
|
3908
|
+
valueThemeKeys: ["--outline-offset"]
|
|
3909
|
+
}
|
|
3910
|
+
]);
|
|
3911
|
+
}
|
|
3319
3912
|
functionalUtility("opacity", {
|
|
3320
3913
|
themeKeys: ["--opacity"],
|
|
3321
3914
|
handleBareValue: ({ value }) => `${value}%`,
|
|
3322
3915
|
handle: (value) => [decl("opacity", value)]
|
|
3323
3916
|
});
|
|
3917
|
+
suggest("opacity", () => [
|
|
3918
|
+
{
|
|
3919
|
+
values: Array.from({ length: 21 }, (_, i) => `${i * 5}`),
|
|
3920
|
+
valueThemeKeys: ["--opacity"]
|
|
3921
|
+
}
|
|
3922
|
+
]);
|
|
3324
3923
|
staticUtility("underline-offset-auto", [["text-underline-offset", "auto"]]);
|
|
3325
3924
|
functionalUtility("underline-offset", {
|
|
3326
3925
|
supportsNegative: true,
|
|
@@ -3328,10 +3927,16 @@ function createUtilities(theme) {
|
|
|
3328
3927
|
handleBareValue: ({ value }) => `${value}px`,
|
|
3329
3928
|
handle: (value) => [decl("text-underline-offset", value)]
|
|
3330
3929
|
});
|
|
3930
|
+
suggest("underline-offset", () => [
|
|
3931
|
+
{
|
|
3932
|
+
supportsNegative: true,
|
|
3933
|
+
values: ["0", "1", "2", "4", "8"],
|
|
3934
|
+
valueThemeKeys: ["--text-underline-offset"]
|
|
3935
|
+
}
|
|
3936
|
+
]);
|
|
3331
3937
|
utilities.functional("text", (candidate) => {
|
|
3332
|
-
if (candidate.negative || !candidate.value)
|
|
3938
|
+
if (candidate.negative || !candidate.value)
|
|
3333
3939
|
return;
|
|
3334
|
-
}
|
|
3335
3940
|
if (candidate.value.kind === "arbitrary") {
|
|
3336
3941
|
let value = candidate.value.value;
|
|
3337
3942
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length", "percentage", "absolute-size", "relative-size"]);
|
|
@@ -3351,6 +3956,8 @@ function createUtilities(theme) {
|
|
|
3351
3956
|
}
|
|
3352
3957
|
default: {
|
|
3353
3958
|
value = asColor(value, candidate.modifier, theme);
|
|
3959
|
+
if (value === null)
|
|
3960
|
+
return;
|
|
3354
3961
|
return [decl("color", value)];
|
|
3355
3962
|
}
|
|
3356
3963
|
}
|
|
@@ -3387,18 +3994,32 @@ function createUtilities(theme) {
|
|
|
3387
3994
|
}
|
|
3388
3995
|
}
|
|
3389
3996
|
});
|
|
3997
|
+
suggest("text", () => [
|
|
3998
|
+
{
|
|
3999
|
+
values: ["current", "transparent"],
|
|
4000
|
+
valueThemeKeys: ["--text-color", "--color"],
|
|
4001
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4002
|
+
modifierThemeKeys: ["--opacity"]
|
|
4003
|
+
},
|
|
4004
|
+
{
|
|
4005
|
+
values: [],
|
|
4006
|
+
valueThemeKeys: ["--font-size"],
|
|
4007
|
+
modifiers: [],
|
|
4008
|
+
modifierThemeKeys: ["--line-height"]
|
|
4009
|
+
}
|
|
4010
|
+
]);
|
|
3390
4011
|
{
|
|
3391
4012
|
let ringShadowValue2 = function(value) {
|
|
3392
|
-
return `var(--tw-ring-inset,) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color,
|
|
4013
|
+
return `var(--tw-ring-inset,) 0 0 0 calc(${value} + var(--tw-ring-offset-width)) var(--tw-ring-color, ${defaultRingColor})`;
|
|
3393
4014
|
}, insetRingShadowValue2 = function(value) {
|
|
3394
4015
|
return `inset 0 0 0 ${value} var(--tw-inset-ring-color, currentColor)`;
|
|
3395
4016
|
};
|
|
3396
4017
|
let cssBoxShadowValue = [
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
4018
|
+
"var(--tw-inset-shadow)",
|
|
4019
|
+
"var(--tw-inset-ring-shadow)",
|
|
4020
|
+
"var(--tw-ring-offset-shadow)",
|
|
4021
|
+
"var(--tw-ring-shadow)",
|
|
4022
|
+
"var(--tw-shadow)"
|
|
3402
4023
|
].join(", ");
|
|
3403
4024
|
let nullShadow = "0 0 #0000";
|
|
3404
4025
|
let boxShadowProperties = () => {
|
|
@@ -3419,12 +4040,11 @@ function createUtilities(theme) {
|
|
|
3419
4040
|
]);
|
|
3420
4041
|
};
|
|
3421
4042
|
utilities.functional("shadow", (candidate) => {
|
|
3422
|
-
if (candidate.negative)
|
|
4043
|
+
if (candidate.negative)
|
|
3423
4044
|
return;
|
|
3424
|
-
}
|
|
3425
4045
|
if (!candidate.value) {
|
|
3426
4046
|
let value = theme.get(["--shadow"]);
|
|
3427
|
-
if (
|
|
4047
|
+
if (value === null)
|
|
3428
4048
|
return;
|
|
3429
4049
|
return [
|
|
3430
4050
|
boxShadowProperties(),
|
|
@@ -3439,6 +4059,8 @@ function createUtilities(theme) {
|
|
|
3439
4059
|
switch (type) {
|
|
3440
4060
|
case "color": {
|
|
3441
4061
|
value = asColor(value, candidate.modifier, theme);
|
|
4062
|
+
if (value === null)
|
|
4063
|
+
return;
|
|
3442
4064
|
return [
|
|
3443
4065
|
boxShadowProperties(),
|
|
3444
4066
|
decl("--tw-shadow-color", value),
|
|
@@ -3486,13 +4108,25 @@ function createUtilities(theme) {
|
|
|
3486
4108
|
}
|
|
3487
4109
|
}
|
|
3488
4110
|
});
|
|
4111
|
+
suggest("shadow", () => [
|
|
4112
|
+
{
|
|
4113
|
+
values: ["current", "transparent"],
|
|
4114
|
+
valueThemeKeys: ["--box-shadow-color", "--color"],
|
|
4115
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4116
|
+
modifierThemeKeys: ["--opacity"]
|
|
4117
|
+
},
|
|
4118
|
+
{
|
|
4119
|
+
values: [],
|
|
4120
|
+
valueThemeKeys: ["--shadow"],
|
|
4121
|
+
hasDefaultValue: true
|
|
4122
|
+
}
|
|
4123
|
+
]);
|
|
3489
4124
|
utilities.functional("inset-shadow", (candidate) => {
|
|
3490
|
-
if (candidate.negative)
|
|
4125
|
+
if (candidate.negative)
|
|
3491
4126
|
return;
|
|
3492
|
-
}
|
|
3493
4127
|
if (!candidate.value) {
|
|
3494
4128
|
let value = theme.get(["--inset-shadow"]);
|
|
3495
|
-
if (
|
|
4129
|
+
if (value === null)
|
|
3496
4130
|
return;
|
|
3497
4131
|
return [
|
|
3498
4132
|
boxShadowProperties(),
|
|
@@ -3510,6 +4144,8 @@ function createUtilities(theme) {
|
|
|
3510
4144
|
switch (type) {
|
|
3511
4145
|
case "color": {
|
|
3512
4146
|
value = asColor(value, candidate.modifier, theme);
|
|
4147
|
+
if (value === null)
|
|
4148
|
+
return;
|
|
3513
4149
|
return [
|
|
3514
4150
|
boxShadowProperties(),
|
|
3515
4151
|
decl("--tw-inset-shadow-color", value),
|
|
@@ -3563,14 +4199,29 @@ function createUtilities(theme) {
|
|
|
3563
4199
|
}
|
|
3564
4200
|
}
|
|
3565
4201
|
});
|
|
4202
|
+
suggest("inset-shadow", () => [
|
|
4203
|
+
{
|
|
4204
|
+
values: ["current", "transparent"],
|
|
4205
|
+
valueThemeKeys: ["--box-shadow-color", "--color"],
|
|
4206
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4207
|
+
modifierThemeKeys: ["--opacity"]
|
|
4208
|
+
},
|
|
4209
|
+
{
|
|
4210
|
+
values: [],
|
|
4211
|
+
valueThemeKeys: ["--shadow"],
|
|
4212
|
+
hasDefaultValue: true
|
|
4213
|
+
}
|
|
4214
|
+
]);
|
|
3566
4215
|
staticUtility("ring-inset", [boxShadowProperties, ["--tw-ring-inset", "inset"]]);
|
|
4216
|
+
let defaultRingColor = theme.get(["--default-ring-color"]) ?? "currentColor";
|
|
3567
4217
|
utilities.functional("ring", (candidate) => {
|
|
3568
4218
|
if (candidate.negative)
|
|
3569
4219
|
return;
|
|
3570
4220
|
if (!candidate.value) {
|
|
4221
|
+
let value = theme.get(["--default-ring-width"]) ?? "1px";
|
|
3571
4222
|
return [
|
|
3572
4223
|
boxShadowProperties(),
|
|
3573
|
-
decl("--tw-ring-shadow", ringShadowValue2(
|
|
4224
|
+
decl("--tw-ring-shadow", ringShadowValue2(value)),
|
|
3574
4225
|
decl("box-shadow", cssBoxShadowValue)
|
|
3575
4226
|
];
|
|
3576
4227
|
}
|
|
@@ -3587,6 +4238,8 @@ function createUtilities(theme) {
|
|
|
3587
4238
|
}
|
|
3588
4239
|
default: {
|
|
3589
4240
|
value = asColor(value, candidate.modifier, theme);
|
|
4241
|
+
if (value === null)
|
|
4242
|
+
return;
|
|
3590
4243
|
return [decl("--tw-ring-color", value)];
|
|
3591
4244
|
}
|
|
3592
4245
|
}
|
|
@@ -3599,7 +4252,7 @@ function createUtilities(theme) {
|
|
|
3599
4252
|
}
|
|
3600
4253
|
{
|
|
3601
4254
|
let value = theme.resolve(candidate.value.value, ["--ring-width"]);
|
|
3602
|
-
if (
|
|
4255
|
+
if (value === null && !Number.isNaN(Number(candidate.value.value))) {
|
|
3603
4256
|
value = `${candidate.value.value}px`;
|
|
3604
4257
|
}
|
|
3605
4258
|
if (value) {
|
|
@@ -3611,6 +4264,19 @@ function createUtilities(theme) {
|
|
|
3611
4264
|
}
|
|
3612
4265
|
}
|
|
3613
4266
|
});
|
|
4267
|
+
suggest("ring", () => [
|
|
4268
|
+
{
|
|
4269
|
+
values: ["current", "transparent"],
|
|
4270
|
+
valueThemeKeys: ["--ring-color", "--color"],
|
|
4271
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4272
|
+
modifierThemeKeys: ["--opacity"]
|
|
4273
|
+
},
|
|
4274
|
+
{
|
|
4275
|
+
values: ["0", "1", "2", "4", "8"],
|
|
4276
|
+
valueThemeKeys: ["--ring-width"],
|
|
4277
|
+
hasDefaultValue: true
|
|
4278
|
+
}
|
|
4279
|
+
]);
|
|
3614
4280
|
utilities.functional("inset-ring", (candidate) => {
|
|
3615
4281
|
if (candidate.negative)
|
|
3616
4282
|
return;
|
|
@@ -3634,6 +4300,8 @@ function createUtilities(theme) {
|
|
|
3634
4300
|
}
|
|
3635
4301
|
default: {
|
|
3636
4302
|
value = asColor(value, candidate.modifier, theme);
|
|
4303
|
+
if (value === null)
|
|
4304
|
+
return;
|
|
3637
4305
|
return [decl("--tw-inset-ring-color", value)];
|
|
3638
4306
|
}
|
|
3639
4307
|
}
|
|
@@ -3646,7 +4314,7 @@ function createUtilities(theme) {
|
|
|
3646
4314
|
}
|
|
3647
4315
|
{
|
|
3648
4316
|
let value = theme.resolve(candidate.value.value, ["--ring-width"]);
|
|
3649
|
-
if (
|
|
4317
|
+
if (value === null && !Number.isNaN(Number(candidate.value.value))) {
|
|
3650
4318
|
value = `${candidate.value.value}px`;
|
|
3651
4319
|
}
|
|
3652
4320
|
if (value) {
|
|
@@ -3658,11 +4326,23 @@ function createUtilities(theme) {
|
|
|
3658
4326
|
}
|
|
3659
4327
|
}
|
|
3660
4328
|
});
|
|
4329
|
+
suggest("inset-ring", () => [
|
|
4330
|
+
{
|
|
4331
|
+
values: ["current", "transparent"],
|
|
4332
|
+
valueThemeKeys: ["--ring-color", "--color"],
|
|
4333
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4334
|
+
modifierThemeKeys: ["--opacity"]
|
|
4335
|
+
},
|
|
4336
|
+
{
|
|
4337
|
+
values: ["0", "1", "2", "4", "8"],
|
|
4338
|
+
valueThemeKeys: ["--ring-width"],
|
|
4339
|
+
hasDefaultValue: true
|
|
4340
|
+
}
|
|
4341
|
+
]);
|
|
3661
4342
|
let ringOffsetShadowValue = "var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)";
|
|
3662
4343
|
utilities.functional("ring-offset", (candidate) => {
|
|
3663
|
-
if (candidate.negative || !candidate.value)
|
|
4344
|
+
if (candidate.negative || !candidate.value)
|
|
3664
4345
|
return;
|
|
3665
|
-
}
|
|
3666
4346
|
if (candidate.value.kind === "arbitrary") {
|
|
3667
4347
|
let value = candidate.value.value;
|
|
3668
4348
|
let type = candidate.value.dataType ?? inferDataType(value, ["color", "length"]);
|
|
@@ -3675,6 +4355,8 @@ function createUtilities(theme) {
|
|
|
3675
4355
|
}
|
|
3676
4356
|
default: {
|
|
3677
4357
|
value = asColor(value, candidate.modifier, theme);
|
|
4358
|
+
if (value === null)
|
|
4359
|
+
return;
|
|
3678
4360
|
return [decl("--tw-ring-offset-color", value)];
|
|
3679
4361
|
}
|
|
3680
4362
|
}
|
|
@@ -3686,7 +4368,7 @@ function createUtilities(theme) {
|
|
|
3686
4368
|
decl("--tw-ring-offset-width", value),
|
|
3687
4369
|
decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
|
|
3688
4370
|
];
|
|
3689
|
-
} else if (!isNaN(Number(candidate.value.value))) {
|
|
4371
|
+
} else if (!Number.isNaN(Number(candidate.value.value))) {
|
|
3690
4372
|
return [
|
|
3691
4373
|
decl("--tw-ring-offset-width", `${candidate.value.value}px`),
|
|
3692
4374
|
decl("--tw-ring-offset-shadow", ringOffsetShadowValue)
|
|
@@ -3701,29 +4383,51 @@ function createUtilities(theme) {
|
|
|
3701
4383
|
}
|
|
3702
4384
|
});
|
|
3703
4385
|
}
|
|
4386
|
+
suggest("ring-offset", () => [
|
|
4387
|
+
{
|
|
4388
|
+
values: ["current", "transparent"],
|
|
4389
|
+
valueThemeKeys: ["--ring-offset-color", "--color"],
|
|
4390
|
+
modifiers: Array.from({ length: 21 }, (_, index) => `${index * 5}`),
|
|
4391
|
+
modifierThemeKeys: ["--opacity"]
|
|
4392
|
+
},
|
|
4393
|
+
{
|
|
4394
|
+
values: ["0", "1", "2", "4", "8"],
|
|
4395
|
+
valueThemeKeys: ["--ring-offset-width"]
|
|
4396
|
+
}
|
|
4397
|
+
]);
|
|
4398
|
+
utilities.functional("@container", (candidate) => {
|
|
4399
|
+
if (candidate.negative)
|
|
4400
|
+
return;
|
|
4401
|
+
let value = null;
|
|
4402
|
+
if (candidate.value === null) {
|
|
4403
|
+
value = "inline-size";
|
|
4404
|
+
} else if (candidate.value.kind === "arbitrary") {
|
|
4405
|
+
value = candidate.value.value;
|
|
4406
|
+
} else if (candidate.value.kind === "named" && candidate.value.value === "normal") {
|
|
4407
|
+
value = "normal";
|
|
4408
|
+
}
|
|
4409
|
+
if (value === null)
|
|
4410
|
+
return;
|
|
4411
|
+
if (candidate.modifier) {
|
|
4412
|
+
return [decl("container-type", value), decl("container-name", candidate.modifier.value)];
|
|
4413
|
+
}
|
|
4414
|
+
return [decl("container-type", value)];
|
|
4415
|
+
});
|
|
4416
|
+
suggest("@container", () => [
|
|
4417
|
+
{
|
|
4418
|
+
values: ["normal"],
|
|
4419
|
+
valueThemeKeys: [],
|
|
4420
|
+
hasDefaultValue: false
|
|
4421
|
+
}
|
|
4422
|
+
]);
|
|
3704
4423
|
return utilities;
|
|
3705
4424
|
}
|
|
3706
4425
|
|
|
3707
|
-
// src/utils/default-map.ts
|
|
3708
|
-
var DefaultMap = class extends Map {
|
|
3709
|
-
constructor(factory) {
|
|
3710
|
-
super();
|
|
3711
|
-
this.factory = factory;
|
|
3712
|
-
}
|
|
3713
|
-
get(key) {
|
|
3714
|
-
let value = super.get(key);
|
|
3715
|
-
if (value === void 0) {
|
|
3716
|
-
value = this.factory(key, this);
|
|
3717
|
-
this.set(key, value);
|
|
3718
|
-
}
|
|
3719
|
-
return value;
|
|
3720
|
-
}
|
|
3721
|
-
};
|
|
3722
|
-
|
|
3723
4426
|
// src/variants.ts
|
|
3724
4427
|
var Variants = class {
|
|
3725
4428
|
compareFns = /* @__PURE__ */ new Map();
|
|
3726
4429
|
variants = /* @__PURE__ */ new Map();
|
|
4430
|
+
completions = /* @__PURE__ */ new Map();
|
|
3727
4431
|
/**
|
|
3728
4432
|
* Registering a group of variants should result in the same sort number for
|
|
3729
4433
|
* all the variants. This is to ensure that the variants are applied in the
|
|
@@ -3755,7 +4459,7 @@ var Variants = class {
|
|
|
3755
4459
|
return this.variants.has(name);
|
|
3756
4460
|
}
|
|
3757
4461
|
get(name) {
|
|
3758
|
-
return this.variants.get(name)
|
|
4462
|
+
return this.variants.get(name);
|
|
3759
4463
|
}
|
|
3760
4464
|
kind(name) {
|
|
3761
4465
|
return this.variants.get(name)?.kind;
|
|
@@ -3763,6 +4467,12 @@ var Variants = class {
|
|
|
3763
4467
|
compounds(name) {
|
|
3764
4468
|
return this.variants.get(name)?.compounds;
|
|
3765
4469
|
}
|
|
4470
|
+
suggest(name, suggestions) {
|
|
4471
|
+
this.completions.set(name, suggestions);
|
|
4472
|
+
}
|
|
4473
|
+
getCompletions(name) {
|
|
4474
|
+
return this.completions.get(name)?.() ?? [];
|
|
4475
|
+
}
|
|
3766
4476
|
compare(a, z) {
|
|
3767
4477
|
if (a === z)
|
|
3768
4478
|
return 0;
|
|
@@ -3793,6 +4503,9 @@ var Variants = class {
|
|
|
3793
4503
|
keys() {
|
|
3794
4504
|
return this.variants.keys();
|
|
3795
4505
|
}
|
|
4506
|
+
entries() {
|
|
4507
|
+
return this.variants.entries();
|
|
4508
|
+
}
|
|
3796
4509
|
set(name, { kind, applyFn, compounds }) {
|
|
3797
4510
|
this.lastOrder = this.nextOrder();
|
|
3798
4511
|
this.variants.set(name, {
|
|
@@ -3828,11 +4541,21 @@ function createVariants(theme) {
|
|
|
3828
4541
|
ruleNode.selector = ruleNode.selector.replace("&", groupSelector);
|
|
3829
4542
|
ruleNode.selector = `&:is(${ruleNode.selector} *)`;
|
|
3830
4543
|
});
|
|
4544
|
+
variants.suggest("group", () => {
|
|
4545
|
+
return Array.from(variants.keys()).filter((name) => {
|
|
4546
|
+
return variants.get(name)?.compounds ?? false;
|
|
4547
|
+
});
|
|
4548
|
+
});
|
|
3831
4549
|
variants.compound("peer", (ruleNode, variant) => {
|
|
3832
4550
|
let peerSelector = variant.modifier ? `:where(.peer\\/${variant.modifier.value})` : ":where(.peer)";
|
|
3833
4551
|
ruleNode.selector = ruleNode.selector.replace("&", peerSelector);
|
|
3834
4552
|
ruleNode.selector = `&:is(${ruleNode.selector} ~ *)`;
|
|
3835
4553
|
});
|
|
4554
|
+
variants.suggest("peer", () => {
|
|
4555
|
+
return Array.from(variants.keys()).filter((name) => {
|
|
4556
|
+
return variants.get(name)?.compounds ?? false;
|
|
4557
|
+
});
|
|
4558
|
+
});
|
|
3836
4559
|
staticVariant("first-letter", ["&::first-letter"], { compounds: false });
|
|
3837
4560
|
staticVariant("first-line", ["&::first-line"], { compounds: false });
|
|
3838
4561
|
staticVariant("marker", ["& *::marker", "&::marker"], { compounds: false });
|
|
@@ -3929,15 +4652,31 @@ function createVariants(theme) {
|
|
|
3929
4652
|
variants.compound("has", (ruleNode) => {
|
|
3930
4653
|
ruleNode.selector = `&:has(${ruleNode.selector.replace("&", "*")})`;
|
|
3931
4654
|
});
|
|
4655
|
+
variants.suggest("has", () => {
|
|
4656
|
+
return Array.from(variants.keys()).filter((name) => {
|
|
4657
|
+
return variants.get(name)?.compounds ?? false;
|
|
4658
|
+
});
|
|
4659
|
+
});
|
|
3932
4660
|
variants.functional("aria", (ruleNode, variant) => {
|
|
3933
4661
|
if (variant.value === null)
|
|
3934
4662
|
return null;
|
|
3935
|
-
if (variant.value.kind
|
|
4663
|
+
if (variant.value.kind === "arbitrary") {
|
|
3936
4664
|
ruleNode.nodes = [rule(`&[aria-${variant.value.value}]`, ruleNode.nodes)];
|
|
3937
4665
|
} else {
|
|
3938
4666
|
ruleNode.nodes = [rule(`&[aria-${variant.value.value}="true"]`, ruleNode.nodes)];
|
|
3939
4667
|
}
|
|
3940
4668
|
});
|
|
4669
|
+
variants.suggest("aria", () => [
|
|
4670
|
+
"busy",
|
|
4671
|
+
"checked",
|
|
4672
|
+
"disabled",
|
|
4673
|
+
"expanded",
|
|
4674
|
+
"hidden",
|
|
4675
|
+
"pressed",
|
|
4676
|
+
"readonly",
|
|
4677
|
+
"required",
|
|
4678
|
+
"selected"
|
|
4679
|
+
]);
|
|
3941
4680
|
variants.functional("data", (ruleNode, variant) => {
|
|
3942
4681
|
if (variant.value === null)
|
|
3943
4682
|
return null;
|
|
@@ -3973,13 +4712,13 @@ function createVariants(theme) {
|
|
|
3973
4712
|
staticVariant("contrast-more", ["@media (prefers-contrast: more)"], { compounds: false });
|
|
3974
4713
|
staticVariant("contrast-less", ["@media (prefers-contrast: less)"], { compounds: false });
|
|
3975
4714
|
{
|
|
3976
|
-
let compareBreakpoints2 = function(a, z, direction) {
|
|
4715
|
+
let compareBreakpoints2 = function(a, z, direction, lookup) {
|
|
3977
4716
|
if (a === z)
|
|
3978
4717
|
return 0;
|
|
3979
|
-
let aValue =
|
|
4718
|
+
let aValue = lookup.get(a);
|
|
3980
4719
|
if (aValue === null)
|
|
3981
4720
|
return direction === "asc" ? -1 : 1;
|
|
3982
|
-
let zValue =
|
|
4721
|
+
let zValue = lookup.get(z);
|
|
3983
4722
|
if (zValue === null)
|
|
3984
4723
|
return direction === "asc" ? 1 : -1;
|
|
3985
4724
|
if (aValue === zValue)
|
|
@@ -4005,78 +4744,177 @@ function createVariants(theme) {
|
|
|
4005
4744
|
aBucket.localeCompare(zBucket) || // If bucket names are the same, compare by value
|
|
4006
4745
|
(direction === "asc" ? parseInt(aValue) - parseInt(zValue) : parseInt(zValue) - parseInt(aValue))
|
|
4007
4746
|
);
|
|
4008
|
-
if (isNaN(order)) {
|
|
4747
|
+
if (Number.isNaN(order)) {
|
|
4009
4748
|
return aValue.localeCompare(zValue);
|
|
4010
4749
|
}
|
|
4011
4750
|
return order;
|
|
4012
4751
|
};
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
case "functional": {
|
|
4020
|
-
let value = null;
|
|
4021
|
-
if (variant.value.kind === "arbitrary") {
|
|
4022
|
-
value = variant.value.value;
|
|
4023
|
-
} else if (variant.value.kind === "named") {
|
|
4024
|
-
value = theme.resolve(variant.value.value, ["--breakpoint"]);
|
|
4752
|
+
{
|
|
4753
|
+
let breakpoints = theme.namespace("--breakpoint");
|
|
4754
|
+
let resolvedBreakpoints = new DefaultMap((variant) => {
|
|
4755
|
+
switch (variant.kind) {
|
|
4756
|
+
case "static": {
|
|
4757
|
+
return breakpoints.get(variant.root) ?? null;
|
|
4025
4758
|
}
|
|
4026
|
-
|
|
4027
|
-
|
|
4759
|
+
case "functional": {
|
|
4760
|
+
if (variant.value === null)
|
|
4761
|
+
return null;
|
|
4762
|
+
let value = null;
|
|
4763
|
+
if (variant.value.kind === "arbitrary") {
|
|
4764
|
+
value = variant.value.value;
|
|
4765
|
+
} else if (variant.value.kind === "named") {
|
|
4766
|
+
value = theme.resolve(variant.value.value, ["--breakpoint"]);
|
|
4767
|
+
}
|
|
4768
|
+
if (!value)
|
|
4769
|
+
return null;
|
|
4770
|
+
if (value.includes("var("))
|
|
4771
|
+
return null;
|
|
4772
|
+
return value;
|
|
4028
4773
|
}
|
|
4029
|
-
|
|
4774
|
+
case "arbitrary":
|
|
4775
|
+
case "compound":
|
|
4030
4776
|
return null;
|
|
4031
|
-
}
|
|
4032
|
-
return value;
|
|
4033
4777
|
}
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4778
|
+
});
|
|
4779
|
+
variants.group(
|
|
4780
|
+
() => {
|
|
4781
|
+
variants.functional(
|
|
4782
|
+
"max",
|
|
4783
|
+
(ruleNode, variant) => {
|
|
4784
|
+
let value = resolvedBreakpoints.get(variant);
|
|
4785
|
+
if (value === null)
|
|
4786
|
+
return null;
|
|
4787
|
+
ruleNode.nodes = [rule(`@media (width < ${value})`, ruleNode.nodes)];
|
|
4788
|
+
},
|
|
4789
|
+
{ compounds: false }
|
|
4790
|
+
);
|
|
4791
|
+
},
|
|
4792
|
+
(a, z) => compareBreakpoints2(a, z, "desc", resolvedBreakpoints)
|
|
4793
|
+
);
|
|
4794
|
+
variants.suggest(
|
|
4795
|
+
"max",
|
|
4796
|
+
() => Array.from(breakpoints.keys()).filter((key) => key !== null)
|
|
4797
|
+
);
|
|
4798
|
+
variants.group(
|
|
4799
|
+
() => {
|
|
4800
|
+
for (let [key, value] of theme.namespace("--breakpoint")) {
|
|
4801
|
+
if (key === null)
|
|
4802
|
+
continue;
|
|
4803
|
+
variants.static(
|
|
4804
|
+
key,
|
|
4805
|
+
(ruleNode) => {
|
|
4806
|
+
ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
|
|
4807
|
+
},
|
|
4808
|
+
{ compounds: false }
|
|
4809
|
+
);
|
|
4810
|
+
}
|
|
4811
|
+
variants.functional(
|
|
4812
|
+
"min",
|
|
4813
|
+
(ruleNode, variant) => {
|
|
4814
|
+
let value = resolvedBreakpoints.get(variant);
|
|
4815
|
+
if (value === null)
|
|
4816
|
+
return null;
|
|
4062
4817
|
ruleNode.nodes = [rule(`@media (width >= ${value})`, ruleNode.nodes)];
|
|
4063
4818
|
},
|
|
4064
4819
|
{ compounds: false }
|
|
4065
4820
|
);
|
|
4066
|
-
}
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4821
|
+
},
|
|
4822
|
+
(a, z) => compareBreakpoints2(a, z, "asc", resolvedBreakpoints)
|
|
4823
|
+
);
|
|
4824
|
+
variants.suggest(
|
|
4825
|
+
"min",
|
|
4826
|
+
() => Array.from(breakpoints.keys()).filter((key) => key !== null)
|
|
4827
|
+
);
|
|
4828
|
+
}
|
|
4829
|
+
{
|
|
4830
|
+
let widths = theme.namespace("--width");
|
|
4831
|
+
let resolvedWidths = new DefaultMap((variant) => {
|
|
4832
|
+
switch (variant.kind) {
|
|
4833
|
+
case "functional": {
|
|
4834
|
+
if (variant.value === null)
|
|
4072
4835
|
return null;
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4836
|
+
let value = null;
|
|
4837
|
+
if (variant.value.kind === "arbitrary") {
|
|
4838
|
+
value = variant.value.value;
|
|
4839
|
+
} else if (variant.value.kind === "named") {
|
|
4840
|
+
value = theme.resolve(variant.value.value, ["--width"]);
|
|
4841
|
+
}
|
|
4842
|
+
if (!value)
|
|
4843
|
+
return null;
|
|
4844
|
+
if (value.includes("var("))
|
|
4845
|
+
return null;
|
|
4846
|
+
return value;
|
|
4847
|
+
}
|
|
4848
|
+
case "static":
|
|
4849
|
+
case "arbitrary":
|
|
4850
|
+
case "compound":
|
|
4851
|
+
return null;
|
|
4852
|
+
}
|
|
4853
|
+
});
|
|
4854
|
+
variants.group(
|
|
4855
|
+
() => {
|
|
4856
|
+
variants.functional(
|
|
4857
|
+
"@max",
|
|
4858
|
+
(ruleNode, variant) => {
|
|
4859
|
+
let value = resolvedWidths.get(variant);
|
|
4860
|
+
if (value === null)
|
|
4861
|
+
return null;
|
|
4862
|
+
ruleNode.nodes = [
|
|
4863
|
+
rule(
|
|
4864
|
+
variant.modifier ? `@container ${variant.modifier.value} (width < ${value})` : `@container (width < ${value})`,
|
|
4865
|
+
ruleNode.nodes
|
|
4866
|
+
)
|
|
4867
|
+
];
|
|
4868
|
+
},
|
|
4869
|
+
{ compounds: false }
|
|
4870
|
+
);
|
|
4871
|
+
},
|
|
4872
|
+
(a, z) => compareBreakpoints2(a, z, "desc", resolvedWidths)
|
|
4873
|
+
);
|
|
4874
|
+
variants.suggest(
|
|
4875
|
+
"@max",
|
|
4876
|
+
() => Array.from(widths.keys()).filter((key) => key !== null)
|
|
4877
|
+
);
|
|
4878
|
+
variants.group(
|
|
4879
|
+
() => {
|
|
4880
|
+
variants.functional(
|
|
4881
|
+
"@",
|
|
4882
|
+
(ruleNode, variant) => {
|
|
4883
|
+
let value = resolvedWidths.get(variant);
|
|
4884
|
+
if (value === null)
|
|
4885
|
+
return null;
|
|
4886
|
+
ruleNode.nodes = [
|
|
4887
|
+
rule(
|
|
4888
|
+
variant.modifier ? `@container ${variant.modifier.value} (width >= ${value})` : `@container (width >= ${value})`,
|
|
4889
|
+
ruleNode.nodes
|
|
4890
|
+
)
|
|
4891
|
+
];
|
|
4892
|
+
},
|
|
4893
|
+
{ compounds: false }
|
|
4894
|
+
);
|
|
4895
|
+
variants.functional(
|
|
4896
|
+
"@min",
|
|
4897
|
+
(ruleNode, variant) => {
|
|
4898
|
+
let value = resolvedWidths.get(variant);
|
|
4899
|
+
if (value === null)
|
|
4900
|
+
return null;
|
|
4901
|
+
ruleNode.nodes = [
|
|
4902
|
+
rule(
|
|
4903
|
+
variant.modifier ? `@container ${variant.modifier.value} (width >= ${value})` : `@container (width >= ${value})`,
|
|
4904
|
+
ruleNode.nodes
|
|
4905
|
+
)
|
|
4906
|
+
];
|
|
4907
|
+
},
|
|
4908
|
+
{ compounds: false }
|
|
4909
|
+
);
|
|
4910
|
+
},
|
|
4911
|
+
(a, z) => compareBreakpoints2(a, z, "asc", resolvedWidths)
|
|
4912
|
+
);
|
|
4913
|
+
variants.suggest(
|
|
4914
|
+
"@min",
|
|
4915
|
+
() => Array.from(widths.keys()).filter((key) => key !== null)
|
|
4916
|
+
);
|
|
4917
|
+
}
|
|
4080
4918
|
}
|
|
4081
4919
|
staticVariant("portrait", ["@media (orientation: portrait)"], { compounds: false });
|
|
4082
4920
|
staticVariant("landscape", ["@media (orientation: landscape)"], { compounds: false });
|
|
@@ -4094,14 +4932,33 @@ function buildDesignSystem(theme) {
|
|
|
4094
4932
|
theme,
|
|
4095
4933
|
utilities: createUtilities(theme),
|
|
4096
4934
|
variants: createVariants(theme),
|
|
4935
|
+
candidatesToCss(classes) {
|
|
4936
|
+
let result = [];
|
|
4937
|
+
for (let className of classes) {
|
|
4938
|
+
let { astNodes } = compileCandidates([className], this, { throwOnInvalidCandidate: false });
|
|
4939
|
+
if (astNodes.length === 0) {
|
|
4940
|
+
result.push(null);
|
|
4941
|
+
} else {
|
|
4942
|
+
result.push(toCss(astNodes));
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
return result;
|
|
4946
|
+
},
|
|
4097
4947
|
getClassOrder(classes) {
|
|
4098
4948
|
return getClassOrder(this, classes);
|
|
4949
|
+
},
|
|
4950
|
+
getClassList() {
|
|
4951
|
+
return getClassList(this);
|
|
4952
|
+
},
|
|
4953
|
+
getVariants() {
|
|
4954
|
+
return getVariants(this);
|
|
4099
4955
|
}
|
|
4100
4956
|
};
|
|
4101
4957
|
}
|
|
4102
4958
|
|
|
4103
4959
|
// src/property-order.ts
|
|
4104
4960
|
var property_order_default = [
|
|
4961
|
+
"container-type",
|
|
4105
4962
|
"pointer-events",
|
|
4106
4963
|
"visibility",
|
|
4107
4964
|
"position",
|
|
@@ -4437,39 +5294,6 @@ function escape(value) {
|
|
|
4437
5294
|
}
|
|
4438
5295
|
|
|
4439
5296
|
// src/compile.ts
|
|
4440
|
-
function applyImportant(ast) {
|
|
4441
|
-
for (let node of ast) {
|
|
4442
|
-
if (node.kind === "rule" && node.selector === "@at-root") {
|
|
4443
|
-
continue;
|
|
4444
|
-
}
|
|
4445
|
-
if (node.kind === "declaration") {
|
|
4446
|
-
node.important = true;
|
|
4447
|
-
} else if (node.kind === "rule") {
|
|
4448
|
-
applyImportant(node.nodes);
|
|
4449
|
-
}
|
|
4450
|
-
}
|
|
4451
|
-
}
|
|
4452
|
-
function applyVariant(node, variant, variants) {
|
|
4453
|
-
if (variant.kind === "arbitrary") {
|
|
4454
|
-
node.nodes = [rule(variant.selector, node.nodes)];
|
|
4455
|
-
return;
|
|
4456
|
-
}
|
|
4457
|
-
let applyVariantFn = variants.get(variant.root);
|
|
4458
|
-
if (variant.kind === "compound") {
|
|
4459
|
-
let result2 = applyVariant(node, variant.variant, variants);
|
|
4460
|
-
if (result2 === null)
|
|
4461
|
-
return null;
|
|
4462
|
-
for (let child of node.nodes) {
|
|
4463
|
-
let result3 = applyVariantFn(child, variant);
|
|
4464
|
-
if (result3 === null)
|
|
4465
|
-
return null;
|
|
4466
|
-
}
|
|
4467
|
-
return;
|
|
4468
|
-
}
|
|
4469
|
-
let result = applyVariantFn(node, variant);
|
|
4470
|
-
if (result === null)
|
|
4471
|
-
return null;
|
|
4472
|
-
}
|
|
4473
5297
|
function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidate = false } = {}) {
|
|
4474
5298
|
rawCandidates.sort();
|
|
4475
5299
|
let nodeSorting = /* @__PURE__ */ new Map();
|
|
@@ -4478,18 +5302,16 @@ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidat
|
|
|
4478
5302
|
return parseVariant(variant, designSystem.variants, map);
|
|
4479
5303
|
});
|
|
4480
5304
|
let candidates = /* @__PURE__ */ new Map();
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
if (
|
|
4485
|
-
|
|
4486
|
-
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
4487
|
-
} else {
|
|
4488
|
-
continue next;
|
|
4489
|
-
}
|
|
5305
|
+
for (let rawCandidate of rawCandidates) {
|
|
5306
|
+
let candidate = parseCandidate(rawCandidate, designSystem.utilities, parsedVariants);
|
|
5307
|
+
if (candidate === null) {
|
|
5308
|
+
if (throwOnInvalidCandidate) {
|
|
5309
|
+
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
4490
5310
|
}
|
|
4491
|
-
|
|
5311
|
+
continue;
|
|
4492
5312
|
}
|
|
5313
|
+
candidates.set(candidate, rawCandidate);
|
|
5314
|
+
}
|
|
4493
5315
|
let variants = Array.from(parsedVariants.values()).sort((a, z) => {
|
|
4494
5316
|
return designSystem.variants.compare(a, z);
|
|
4495
5317
|
});
|
|
@@ -4497,16 +5319,23 @@ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidat
|
|
|
4497
5319
|
for (let [candidate, rawCandidate] of candidates) {
|
|
4498
5320
|
let nodes = [];
|
|
4499
5321
|
if (candidate.kind === "arbitrary") {
|
|
4500
|
-
|
|
5322
|
+
let compileFn = designSystem.utilities.getArbitrary();
|
|
5323
|
+
let compiledNodes = compileFn(candidate);
|
|
5324
|
+
if (compiledNodes === void 0) {
|
|
5325
|
+
if (throwOnInvalidCandidate) {
|
|
5326
|
+
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
5327
|
+
}
|
|
5328
|
+
continue next;
|
|
5329
|
+
}
|
|
5330
|
+
nodes = compiledNodes;
|
|
4501
5331
|
} else if (candidate.kind === "static" || candidate.kind === "functional") {
|
|
4502
5332
|
let { compileFn } = designSystem.utilities.get(candidate.root);
|
|
4503
5333
|
let compiledNodes = compileFn(candidate);
|
|
4504
5334
|
if (compiledNodes === void 0) {
|
|
4505
5335
|
if (throwOnInvalidCandidate) {
|
|
4506
5336
|
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
4507
|
-
} else {
|
|
4508
|
-
continue next;
|
|
4509
5337
|
}
|
|
5338
|
+
continue next;
|
|
4510
5339
|
}
|
|
4511
5340
|
nodes = compiledNodes;
|
|
4512
5341
|
}
|
|
@@ -4525,9 +5354,8 @@ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidat
|
|
|
4525
5354
|
if (result === null) {
|
|
4526
5355
|
if (throwOnInvalidCandidate) {
|
|
4527
5356
|
throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`);
|
|
4528
|
-
} else {
|
|
4529
|
-
continue next;
|
|
4530
5357
|
}
|
|
5358
|
+
continue next;
|
|
4531
5359
|
}
|
|
4532
5360
|
variantOrder |= 1n << BigInt(variants.indexOf(variant));
|
|
4533
5361
|
}
|
|
@@ -4559,31 +5387,65 @@ function compileCandidates(rawCandidates, designSystem, { throwOnInvalidCandidat
|
|
|
4559
5387
|
nodeSorting
|
|
4560
5388
|
};
|
|
4561
5389
|
}
|
|
5390
|
+
function applyVariant(node, variant, variants) {
|
|
5391
|
+
if (variant.kind === "arbitrary") {
|
|
5392
|
+
node.nodes = [rule(variant.selector, node.nodes)];
|
|
5393
|
+
return;
|
|
5394
|
+
}
|
|
5395
|
+
let { applyFn } = variants.get(variant.root);
|
|
5396
|
+
if (variant.kind === "compound") {
|
|
5397
|
+
let result2 = applyVariant(node, variant.variant, variants);
|
|
5398
|
+
if (result2 === null)
|
|
5399
|
+
return null;
|
|
5400
|
+
for (let child of node.nodes) {
|
|
5401
|
+
if (child.kind !== "rule")
|
|
5402
|
+
return null;
|
|
5403
|
+
let result3 = applyFn(child, variant);
|
|
5404
|
+
if (result3 === null)
|
|
5405
|
+
return null;
|
|
5406
|
+
}
|
|
5407
|
+
return;
|
|
5408
|
+
}
|
|
5409
|
+
let result = applyFn(node, variant);
|
|
5410
|
+
if (result === null)
|
|
5411
|
+
return null;
|
|
5412
|
+
}
|
|
5413
|
+
function applyImportant(ast) {
|
|
5414
|
+
for (let node of ast) {
|
|
5415
|
+
if (node.kind === "rule" && node.selector === "@at-root") {
|
|
5416
|
+
continue;
|
|
5417
|
+
}
|
|
5418
|
+
if (node.kind === "declaration") {
|
|
5419
|
+
node.important = true;
|
|
5420
|
+
} else if (node.kind === "rule") {
|
|
5421
|
+
applyImportant(node.nodes);
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
4562
5425
|
function getPropertySort(nodes) {
|
|
4563
5426
|
let propertySort = /* @__PURE__ */ new Set();
|
|
4564
5427
|
let q = nodes.slice();
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
if (node.
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
break next;
|
|
4574
|
-
}
|
|
4575
|
-
}
|
|
4576
|
-
let idx = property_order_default.indexOf(node.property);
|
|
4577
|
-
if (idx !== -1)
|
|
4578
|
-
propertySort.add(idx);
|
|
4579
|
-
} else if (node.kind === "rule") {
|
|
4580
|
-
if (node.selector === "@at-root")
|
|
4581
|
-
continue;
|
|
4582
|
-
for (let child of node.nodes) {
|
|
4583
|
-
q.push(child);
|
|
5428
|
+
while (q.length > 0) {
|
|
5429
|
+
let node = q.shift();
|
|
5430
|
+
if (node.kind === "declaration") {
|
|
5431
|
+
if (node.property === "--tw-sort") {
|
|
5432
|
+
let idx2 = property_order_default.indexOf(node.value);
|
|
5433
|
+
if (idx2 !== -1) {
|
|
5434
|
+
propertySort.add(idx2);
|
|
5435
|
+
break;
|
|
4584
5436
|
}
|
|
4585
5437
|
}
|
|
5438
|
+
let idx = property_order_default.indexOf(node.property);
|
|
5439
|
+
if (idx !== -1)
|
|
5440
|
+
propertySort.add(idx);
|
|
5441
|
+
} else if (node.kind === "rule") {
|
|
5442
|
+
if (node.selector === "@at-root")
|
|
5443
|
+
continue;
|
|
5444
|
+
for (let child of node.nodes) {
|
|
5445
|
+
q.push(child);
|
|
5446
|
+
}
|
|
4586
5447
|
}
|
|
5448
|
+
}
|
|
4587
5449
|
return Array.from(propertySort).sort((a, z) => a - z);
|
|
4588
5450
|
}
|
|
4589
5451
|
|
|
@@ -4706,10 +5568,9 @@ function parse(input) {
|
|
|
4706
5568
|
node = null;
|
|
4707
5569
|
} else if (char === "}") {
|
|
4708
5570
|
if (closingBracketStack === "") {
|
|
4709
|
-
throw new Error(
|
|
4710
|
-
} else {
|
|
4711
|
-
closingBracketStack = closingBracketStack.slice(0, -1);
|
|
5571
|
+
throw new Error("Missing opening {");
|
|
4712
5572
|
}
|
|
5573
|
+
closingBracketStack = closingBracketStack.slice(0, -1);
|
|
4713
5574
|
if (current.length > 0) {
|
|
4714
5575
|
if (current[0] === "@") {
|
|
4715
5576
|
node = rule(current.trim(), []);
|
|
@@ -4787,6 +5648,21 @@ var Theme = class {
|
|
|
4787
5648
|
this.values.set(key, value);
|
|
4788
5649
|
}
|
|
4789
5650
|
}
|
|
5651
|
+
keysInNamespaces(themeKeys) {
|
|
5652
|
+
let keys = [];
|
|
5653
|
+
for (let prefix of themeKeys) {
|
|
5654
|
+
let namespace = `${prefix}-`;
|
|
5655
|
+
for (let key of this.values.keys()) {
|
|
5656
|
+
if (key.startsWith(namespace)) {
|
|
5657
|
+
if (key.indexOf("--", 2) !== -1) {
|
|
5658
|
+
continue;
|
|
5659
|
+
}
|
|
5660
|
+
keys.push(key.slice(namespace.length));
|
|
5661
|
+
}
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
return keys;
|
|
5665
|
+
}
|
|
4790
5666
|
get(themeKeys) {
|
|
4791
5667
|
for (let key of themeKeys) {
|
|
4792
5668
|
let value = this.values.get(key);
|
|
@@ -4849,53 +5725,6 @@ var Theme = class {
|
|
|
4849
5725
|
};
|
|
4850
5726
|
|
|
4851
5727
|
// src/index.ts
|
|
4852
|
-
function toCss(ast) {
|
|
4853
|
-
let atRoots = [];
|
|
4854
|
-
return ast.map(function stringify(node) {
|
|
4855
|
-
let css = "";
|
|
4856
|
-
if (node.kind === "rule") {
|
|
4857
|
-
if (node.selector === "@at-root") {
|
|
4858
|
-
for (let child of node.nodes) {
|
|
4859
|
-
atRoots.push(stringify(child));
|
|
4860
|
-
}
|
|
4861
|
-
return css;
|
|
4862
|
-
}
|
|
4863
|
-
if (node.selector[0] === "@" && node.nodes.length === 0) {
|
|
4864
|
-
return `${node.selector};`;
|
|
4865
|
-
}
|
|
4866
|
-
css += `${node.selector}{`;
|
|
4867
|
-
for (let child of node.nodes) {
|
|
4868
|
-
css += stringify(child);
|
|
4869
|
-
}
|
|
4870
|
-
css += "}";
|
|
4871
|
-
} else if (node.kind === "comment") {
|
|
4872
|
-
css += `/*${node.value}*/
|
|
4873
|
-
`;
|
|
4874
|
-
} else if (node.property !== "--tw-sort" && node.value !== void 0 && node.value !== null) {
|
|
4875
|
-
css += `${node.property}:${node.value}${node.important ? "!important" : ""};`;
|
|
4876
|
-
}
|
|
4877
|
-
return css;
|
|
4878
|
-
}).concat(atRoots).join("\n");
|
|
4879
|
-
}
|
|
4880
|
-
function optimizeCss(input, { file = "input.css", minify = false } = {}) {
|
|
4881
|
-
return transform({
|
|
4882
|
-
filename: file,
|
|
4883
|
-
code: Buffer.from(input),
|
|
4884
|
-
minify,
|
|
4885
|
-
sourceMap: false,
|
|
4886
|
-
drafts: {
|
|
4887
|
-
customMedia: true
|
|
4888
|
-
},
|
|
4889
|
-
nonStandard: {
|
|
4890
|
-
deepSelectorCombinator: true
|
|
4891
|
-
},
|
|
4892
|
-
include: Features.Nesting,
|
|
4893
|
-
exclude: Features.LogicalProperties,
|
|
4894
|
-
targets: {
|
|
4895
|
-
safari: 16 << 16 | 4 << 8
|
|
4896
|
-
}
|
|
4897
|
-
}).code.toString();
|
|
4898
|
-
}
|
|
4899
5728
|
function compile(css, rawCandidates) {
|
|
4900
5729
|
let ast = parse(css);
|
|
4901
5730
|
{
|
|
@@ -4995,7 +5824,27 @@ function compile(css, rawCandidates) {
|
|
|
4995
5824
|
}
|
|
4996
5825
|
return toCss(ast);
|
|
4997
5826
|
}
|
|
4998
|
-
function
|
|
5827
|
+
function optimizeCss(input, { file = "input.css", minify = false } = {}) {
|
|
5828
|
+
return transform({
|
|
5829
|
+
filename: file,
|
|
5830
|
+
code: Buffer.from(input),
|
|
5831
|
+
minify,
|
|
5832
|
+
sourceMap: false,
|
|
5833
|
+
drafts: {
|
|
5834
|
+
customMedia: true
|
|
5835
|
+
},
|
|
5836
|
+
nonStandard: {
|
|
5837
|
+
deepSelectorCombinator: true
|
|
5838
|
+
},
|
|
5839
|
+
include: Features.Nesting,
|
|
5840
|
+
exclude: Features.LogicalProperties,
|
|
5841
|
+
targets: {
|
|
5842
|
+
safari: 16 << 16 | 4 << 8
|
|
5843
|
+
},
|
|
5844
|
+
errorRecovery: true
|
|
5845
|
+
}).code.toString();
|
|
5846
|
+
}
|
|
5847
|
+
function __unstable__loadDesignSystem(css) {
|
|
4999
5848
|
let theme = new Theme();
|
|
5000
5849
|
let ast = parse(css);
|
|
5001
5850
|
walk(ast, (node) => {
|
|
@@ -5014,4 +5863,4 @@ function loadDesignSystem(css) {
|
|
|
5014
5863
|
return buildDesignSystem(theme);
|
|
5015
5864
|
}
|
|
5016
5865
|
|
|
5017
|
-
export { __require,
|
|
5866
|
+
export { __require, __unstable__loadDesignSystem, compile, optimizeCss, version };
|