tailwindcss 0.0.0-oxide.2 → 0.0.0-oxide.4
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-BU3RKWVW.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 +43 -92
- package/theme.css +0 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { __require, optimizeCss, compile, version } from './chunk-BU3RKWVW.mjs';
|
|
2
3
|
import parse from 'mri';
|
|
3
4
|
import watcher from '@parcel/watcher';
|
|
4
5
|
import { scanDir, clearCache, scanFiles, IO, Parsing } from '@tailwindcss/oxide';
|
|
@@ -72,7 +73,7 @@ function convertNumber(value) {
|
|
|
72
73
|
}
|
|
73
74
|
{
|
|
74
75
|
let valueAsNumber = Number(value);
|
|
75
|
-
if (!isNaN(valueAsNumber)) {
|
|
76
|
+
if (!Number.isNaN(valueAsNumber)) {
|
|
76
77
|
return valueAsNumber;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
@@ -110,7 +111,7 @@ var UI = {
|
|
|
110
111
|
indent: 2
|
|
111
112
|
};
|
|
112
113
|
function header() {
|
|
113
|
-
return `${pc.italic(pc.bold(pc.blue("\u2248")))} tailwindcss ${pc.blue(
|
|
114
|
+
return `${pc.italic(pc.bold(pc.blue("\u2248")))} tailwindcss ${pc.blue(`v${version}`)}`;
|
|
114
115
|
}
|
|
115
116
|
function highlight(file) {
|
|
116
117
|
return `${pc.dim(pc.blue("`"))}${pc.blue(file)}${pc.dim(pc.blue("`"))}`;
|
|
@@ -421,18 +422,11 @@ if (command) {
|
|
|
421
422
|
});
|
|
422
423
|
process.exit(1);
|
|
423
424
|
}
|
|
424
|
-
if (process.stdout.isTTY && !process.argv.slice(2).includes("-o")) {
|
|
425
|
+
if (process.stdout.isTTY && !process.argv.slice(2).includes("-o") || shared["--help"]) {
|
|
425
426
|
help({
|
|
426
427
|
usage: ["tailwindcss [--input input.css] [--output output.css] [--watch] [options\u2026]"],
|
|
427
428
|
options: { ...options(), ...sharedOptions }
|
|
428
429
|
});
|
|
429
430
|
process.exit(0);
|
|
430
431
|
}
|
|
431
|
-
if (shared["--help"]) {
|
|
432
|
-
help({
|
|
433
|
-
usage: [`tailwindcss ${command} [options]`],
|
|
434
|
-
options: { ...options(), ...sharedOptions }
|
|
435
|
-
});
|
|
436
|
-
process.exit(0);
|
|
437
|
-
}
|
|
438
432
|
handle(args(options()));
|
package/dist/lib.d.mts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
+
interface ClassMetadata {
|
|
2
|
+
modifiers: string[];
|
|
3
|
+
}
|
|
4
|
+
type ClassEntry = [string, ClassMetadata];
|
|
5
|
+
interface SelectorOptions {
|
|
6
|
+
modifier?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
}
|
|
9
|
+
interface VariantEntry {
|
|
10
|
+
name: string;
|
|
11
|
+
isArbitrary: boolean;
|
|
12
|
+
values: string[];
|
|
13
|
+
hasDash: boolean;
|
|
14
|
+
selectors: (options: SelectorOptions) => string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
declare class Theme {
|
|
2
18
|
private values;
|
|
3
19
|
constructor(values?: Map<string, string>);
|
|
4
20
|
add(key: string, value: string): void;
|
|
21
|
+
keysInNamespaces(themeKeys: ThemeKey[]): string[];
|
|
5
22
|
get(themeKeys: ThemeKey[]): string | null;
|
|
6
23
|
entries(): IterableIterator<[string, string]>;
|
|
7
24
|
clearNamespace(namespace: string): void;
|
|
@@ -10,7 +27,7 @@ declare class Theme {
|
|
|
10
27
|
resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
|
|
11
28
|
namespace(namespace: string): Map<string | null, string>;
|
|
12
29
|
}
|
|
13
|
-
type ThemeKey = '--accent-color' | '--animate' | '--aspect-ratio' | '--backdrop-blur' | '--backdrop-brightness' | '--backdrop-contrast' | '--backdrop-grayscale' | '--backdrop-hue-rotate' | '--backdrop-invert' | '--backdrop-opacity' | '--backdrop-saturate' | '--backdrop-sepia' | '--background-color' | '--background-image' | '--blur' | '--border-color' | '--border-spacing' | '--border-width' | '--box-shadow-color' | '--breakpoint' | '--brightness' | '--caret-color' | '--color' | '--columns' | '--contrast' | '--cursor' | '--default-border-width' | '--divide-width' | '--divide-color' | '--drop-shadow' | '--fill' | '--flex-basis' | '--font-family' | '--font-size' | '--font-weight' | '--gap' | '--gradient-color-stop-positions' | '--grayscale' | '--grid-auto-columns' | '--grid-auto-rows' | '--grid-column' | '--grid-column-end' | '--grid-column-start' | '--grid-row' | '--grid-row-end' | '--grid-row-start' | '--grid-template-columns' | '--grid-template-rows' | '--height' | '--hue-rotate' | '--inset' | '--inset-shadow' | '--invert' | '--letter-spacing' | '--line-height' | '--line-clamp' | '--list-style-image' | '--list-style-type' | '--margin' | '--max-height' | '--max-width' | '--min-height' | '--min-width' | '--object-position' | '--opacity' | '--order' | '--outline-color' | '--outline-width' | '--outline-offset' | '--padding' | '--placeholder-color' | '--radius' | '--ring-color' | '--ring-offset-color' | '--ring-offset-width' | '--ring-width' | '--rotate' | '--saturate' | '--scale' | '--scroll-margin' | '--scroll-padding' | '--sepia' | '--shadow' | '--size' | '--skew' | '--space' | '--spacing' | '--stroke' | '--stroke-width' | '--text-color' | '--text-decoration-color' | '--text-decoration-thickness' | '--text-indent' | '--text-underline-offset' | '--transform-origin' | '--transition-delay' | '--transition-duration' | '--transition-property' | '--transition-timing-function' | '--translate' | '--width' | '--z-index';
|
|
30
|
+
type ThemeKey = '--accent-color' | '--animate' | '--aspect-ratio' | '--backdrop-blur' | '--backdrop-brightness' | '--backdrop-contrast' | '--backdrop-grayscale' | '--backdrop-hue-rotate' | '--backdrop-invert' | '--backdrop-opacity' | '--backdrop-saturate' | '--backdrop-sepia' | '--background-color' | '--background-image' | '--blur' | '--border-color' | '--border-spacing' | '--border-width' | '--box-shadow-color' | '--breakpoint' | '--brightness' | '--caret-color' | '--color' | '--columns' | '--contrast' | '--cursor' | '--default-border-width' | '--default-ring-color' | '--default-ring-width' | '--divide-width' | '--divide-color' | '--drop-shadow' | '--fill' | '--flex-basis' | '--font-family' | '--font-size' | '--font-weight' | '--gap' | '--gradient-color-stop-positions' | '--grayscale' | '--grid-auto-columns' | '--grid-auto-rows' | '--grid-column' | '--grid-column-end' | '--grid-column-start' | '--grid-row' | '--grid-row-end' | '--grid-row-start' | '--grid-template-columns' | '--grid-template-rows' | '--height' | '--hue-rotate' | '--inset' | '--inset-shadow' | '--invert' | '--letter-spacing' | '--line-height' | '--line-clamp' | '--list-style-image' | '--list-style-type' | '--margin' | '--max-height' | '--max-width' | '--min-height' | '--min-width' | '--object-position' | '--opacity' | '--order' | '--outline-color' | '--outline-width' | '--outline-offset' | '--padding' | '--placeholder-color' | '--radius' | '--ring-color' | '--ring-offset-color' | '--ring-offset-width' | '--ring-width' | '--rotate' | '--saturate' | '--scale' | '--scroll-margin' | '--scroll-padding' | '--sepia' | '--shadow' | '--size' | '--skew' | '--space' | '--spacing' | '--stroke' | '--stroke-width' | '--text-color' | '--text-decoration-color' | '--text-decoration-thickness' | '--text-indent' | '--text-underline-offset' | '--transform-origin' | '--transition-delay' | '--transition-duration' | '--transition-property' | '--transition-timing-function' | '--translate' | '--width' | '--z-index';
|
|
14
31
|
|
|
15
32
|
type Rule = {
|
|
16
33
|
kind: 'rule';
|
|
@@ -54,6 +71,7 @@ type NamedUtilityValue = {
|
|
|
54
71
|
/**
|
|
55
72
|
* bg-red-500
|
|
56
73
|
* ^^^^^^^
|
|
74
|
+
*
|
|
57
75
|
* w-1/2
|
|
58
76
|
* ^
|
|
59
77
|
*/
|
|
@@ -98,9 +116,7 @@ type Variant =
|
|
|
98
116
|
* Arbitrary variants are variants that take a selector and generate a variant
|
|
99
117
|
* on the fly.
|
|
100
118
|
*
|
|
101
|
-
* E.g.:
|
|
102
|
-
*
|
|
103
|
-
* - `[&_p]`
|
|
119
|
+
* E.g.: `[&_p]`
|
|
104
120
|
*/
|
|
105
121
|
{
|
|
106
122
|
kind: 'arbitrary';
|
|
@@ -110,9 +126,7 @@ type Variant =
|
|
|
110
126
|
/**
|
|
111
127
|
* Static variants are variants that don't take any arguments.
|
|
112
128
|
*
|
|
113
|
-
* E.g.:
|
|
114
|
-
*
|
|
115
|
-
* - `hover`
|
|
129
|
+
* E.g.: `hover`
|
|
116
130
|
*/
|
|
117
131
|
| {
|
|
118
132
|
kind: 'static';
|
|
@@ -120,18 +134,22 @@ type Variant =
|
|
|
120
134
|
compounds: boolean;
|
|
121
135
|
}
|
|
122
136
|
/**
|
|
123
|
-
* Functional variants are variants that take an argument. The argument is
|
|
137
|
+
* Functional variants are variants that can take an argument. The argument is
|
|
124
138
|
* either a named variant value or an arbitrary variant value.
|
|
125
139
|
*
|
|
126
140
|
* E.g.:
|
|
127
141
|
*
|
|
128
142
|
* - `aria-disabled`
|
|
129
143
|
* - `aria-[disabled]`
|
|
144
|
+
* - `@container-size` -> @container, with named value `size`
|
|
145
|
+
* - `@container-[inline-size]` -> @container, with arbitrary variant value `inline-size`
|
|
146
|
+
* - `@container` -> @container, with no value
|
|
130
147
|
*/
|
|
131
148
|
| {
|
|
132
149
|
kind: 'functional';
|
|
133
150
|
root: string;
|
|
134
|
-
value: ArbitraryVariantValue | NamedVariantValue;
|
|
151
|
+
value: ArbitraryVariantValue | NamedVariantValue | null;
|
|
152
|
+
modifier: ArbitraryModifier | NamedModifier | null;
|
|
135
153
|
compounds: boolean;
|
|
136
154
|
}
|
|
137
155
|
/**
|
|
@@ -150,19 +168,50 @@ type Variant =
|
|
|
150
168
|
variant: Variant;
|
|
151
169
|
compounds: boolean;
|
|
152
170
|
};
|
|
153
|
-
type Candidate =
|
|
171
|
+
type Candidate =
|
|
172
|
+
/**
|
|
173
|
+
* Arbitrary candidates are candidates that register utilities on the fly with
|
|
174
|
+
* a property and a value.
|
|
175
|
+
*
|
|
176
|
+
* E.g.:
|
|
177
|
+
*
|
|
178
|
+
* - `[color:red]`
|
|
179
|
+
* - `[color:red]/50`
|
|
180
|
+
* - `[color:red]/50!`
|
|
181
|
+
*/
|
|
182
|
+
{
|
|
154
183
|
kind: 'arbitrary';
|
|
155
184
|
property: string;
|
|
156
185
|
value: string;
|
|
186
|
+
modifier: ArbitraryModifier | NamedModifier | null;
|
|
157
187
|
variants: Variant[];
|
|
158
188
|
important: boolean;
|
|
159
|
-
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Static candidates are candidates that don't take any arguments.
|
|
192
|
+
*
|
|
193
|
+
* E.g.:
|
|
194
|
+
*
|
|
195
|
+
* - `underline`
|
|
196
|
+
* - `flex`
|
|
197
|
+
*/
|
|
198
|
+
| {
|
|
160
199
|
kind: 'static';
|
|
161
200
|
root: string;
|
|
162
201
|
variants: Variant[];
|
|
163
202
|
negative: boolean;
|
|
164
203
|
important: boolean;
|
|
165
|
-
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Functional candidates are candidates that can take an argument.
|
|
207
|
+
*
|
|
208
|
+
* E.g.:
|
|
209
|
+
*
|
|
210
|
+
* - `bg-red-500`
|
|
211
|
+
* - `bg-[#0088cc]`
|
|
212
|
+
* - `w-1/2`
|
|
213
|
+
*/
|
|
214
|
+
| {
|
|
166
215
|
kind: 'functional';
|
|
167
216
|
root: string;
|
|
168
217
|
value: ArbitraryUtilityValue | NamedUtilityValue | null;
|
|
@@ -175,17 +224,31 @@ type Candidate = {
|
|
|
175
224
|
type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
|
|
176
225
|
kind: T;
|
|
177
226
|
}>) => AstNode[] | undefined;
|
|
227
|
+
interface SuggestionGroup {
|
|
228
|
+
supportsNegative?: boolean;
|
|
229
|
+
values: (string | null)[];
|
|
230
|
+
modifiers: string[];
|
|
231
|
+
}
|
|
178
232
|
declare class Utilities {
|
|
179
233
|
private utilities;
|
|
234
|
+
private completions;
|
|
180
235
|
static(name: string, compileFn: CompileFn<'static'>): void;
|
|
181
236
|
functional(name: string, compileFn: CompileFn<'functional'>): void;
|
|
237
|
+
arbitrary(compileFn: CompileFn<'arbitrary'>): void;
|
|
182
238
|
has(name: string): boolean;
|
|
183
|
-
get(name: string): {
|
|
239
|
+
get(name: string | symbol): {
|
|
184
240
|
kind: "arbitrary" | "static" | "functional";
|
|
185
241
|
compileFn: CompileFn<any>;
|
|
186
242
|
} | undefined;
|
|
187
243
|
kind(name: string): "arbitrary" | "static" | "functional";
|
|
188
|
-
|
|
244
|
+
getCompletions(name: string): SuggestionGroup[];
|
|
245
|
+
suggest(name: string, groups: () => SuggestionGroup[]): void;
|
|
246
|
+
keys(): IterableIterator<string | symbol>;
|
|
247
|
+
entries(): IterableIterator<[string | symbol, {
|
|
248
|
+
kind: "arbitrary" | "static" | "functional";
|
|
249
|
+
compileFn: CompileFn<any>;
|
|
250
|
+
}]>;
|
|
251
|
+
getArbitrary(): CompileFn<any>;
|
|
189
252
|
private set;
|
|
190
253
|
}
|
|
191
254
|
|
|
@@ -196,6 +259,7 @@ type CompareFn = (a: Variant, z: Variant) => number;
|
|
|
196
259
|
declare class Variants {
|
|
197
260
|
private compareFns;
|
|
198
261
|
private variants;
|
|
262
|
+
private completions;
|
|
199
263
|
/**
|
|
200
264
|
* Registering a group of variants should result in the same sort number for
|
|
201
265
|
* all the variants. This is to ensure that the variants are applied in the
|
|
@@ -218,11 +282,24 @@ declare class Variants {
|
|
|
218
282
|
}): void;
|
|
219
283
|
group(fn: () => void, compareFn?: CompareFn): void;
|
|
220
284
|
has(name: string): boolean;
|
|
221
|
-
get(name: string):
|
|
285
|
+
get(name: string): {
|
|
286
|
+
kind: "arbitrary" | "static" | "functional" | "compound";
|
|
287
|
+
order: number;
|
|
288
|
+
applyFn: VariantFn<any>;
|
|
289
|
+
compounds: boolean;
|
|
290
|
+
} | undefined;
|
|
222
291
|
kind(name: string): "arbitrary" | "static" | "functional" | "compound";
|
|
223
292
|
compounds(name: string): boolean;
|
|
293
|
+
suggest(name: string, suggestions: () => string[]): void;
|
|
294
|
+
getCompletions(name: string): string[];
|
|
224
295
|
compare(a: Variant | null, z: Variant | null): number;
|
|
225
296
|
keys(): IterableIterator<string>;
|
|
297
|
+
entries(): IterableIterator<[string, {
|
|
298
|
+
kind: "arbitrary" | "static" | "functional" | "compound";
|
|
299
|
+
order: number;
|
|
300
|
+
applyFn: VariantFn<any>;
|
|
301
|
+
compounds: boolean;
|
|
302
|
+
}]>;
|
|
226
303
|
private set;
|
|
227
304
|
private nextOrder;
|
|
228
305
|
}
|
|
@@ -231,14 +308,17 @@ type DesignSystem = {
|
|
|
231
308
|
theme: Theme;
|
|
232
309
|
utilities: Utilities;
|
|
233
310
|
variants: Variants;
|
|
311
|
+
candidatesToCss(classes: string[]): (string | null)[];
|
|
234
312
|
getClassOrder(classes: string[]): [string, bigint | null][];
|
|
313
|
+
getClassList(): ClassEntry[];
|
|
314
|
+
getVariants(): VariantEntry[];
|
|
235
315
|
};
|
|
236
316
|
|
|
317
|
+
declare function compile(css: string, rawCandidates: string[]): string;
|
|
237
318
|
declare function optimizeCss(input: string, { file, minify }?: {
|
|
238
319
|
file?: string;
|
|
239
320
|
minify?: boolean;
|
|
240
321
|
}): string;
|
|
241
|
-
declare function
|
|
242
|
-
declare function loadDesignSystem(css: string): DesignSystem;
|
|
322
|
+
declare function __unstable__loadDesignSystem(css: string): DesignSystem;
|
|
243
323
|
|
|
244
|
-
export {
|
|
324
|
+
export { __unstable__loadDesignSystem, compile, optimizeCss };
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
+
interface ClassMetadata {
|
|
2
|
+
modifiers: string[];
|
|
3
|
+
}
|
|
4
|
+
type ClassEntry = [string, ClassMetadata];
|
|
5
|
+
interface SelectorOptions {
|
|
6
|
+
modifier?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
}
|
|
9
|
+
interface VariantEntry {
|
|
10
|
+
name: string;
|
|
11
|
+
isArbitrary: boolean;
|
|
12
|
+
values: string[];
|
|
13
|
+
hasDash: boolean;
|
|
14
|
+
selectors: (options: SelectorOptions) => string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
declare class Theme {
|
|
2
18
|
private values;
|
|
3
19
|
constructor(values?: Map<string, string>);
|
|
4
20
|
add(key: string, value: string): void;
|
|
21
|
+
keysInNamespaces(themeKeys: ThemeKey[]): string[];
|
|
5
22
|
get(themeKeys: ThemeKey[]): string | null;
|
|
6
23
|
entries(): IterableIterator<[string, string]>;
|
|
7
24
|
clearNamespace(namespace: string): void;
|
|
@@ -10,7 +27,7 @@ declare class Theme {
|
|
|
10
27
|
resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
|
|
11
28
|
namespace(namespace: string): Map<string | null, string>;
|
|
12
29
|
}
|
|
13
|
-
type ThemeKey = '--accent-color' | '--animate' | '--aspect-ratio' | '--backdrop-blur' | '--backdrop-brightness' | '--backdrop-contrast' | '--backdrop-grayscale' | '--backdrop-hue-rotate' | '--backdrop-invert' | '--backdrop-opacity' | '--backdrop-saturate' | '--backdrop-sepia' | '--background-color' | '--background-image' | '--blur' | '--border-color' | '--border-spacing' | '--border-width' | '--box-shadow-color' | '--breakpoint' | '--brightness' | '--caret-color' | '--color' | '--columns' | '--contrast' | '--cursor' | '--default-border-width' | '--divide-width' | '--divide-color' | '--drop-shadow' | '--fill' | '--flex-basis' | '--font-family' | '--font-size' | '--font-weight' | '--gap' | '--gradient-color-stop-positions' | '--grayscale' | '--grid-auto-columns' | '--grid-auto-rows' | '--grid-column' | '--grid-column-end' | '--grid-column-start' | '--grid-row' | '--grid-row-end' | '--grid-row-start' | '--grid-template-columns' | '--grid-template-rows' | '--height' | '--hue-rotate' | '--inset' | '--inset-shadow' | '--invert' | '--letter-spacing' | '--line-height' | '--line-clamp' | '--list-style-image' | '--list-style-type' | '--margin' | '--max-height' | '--max-width' | '--min-height' | '--min-width' | '--object-position' | '--opacity' | '--order' | '--outline-color' | '--outline-width' | '--outline-offset' | '--padding' | '--placeholder-color' | '--radius' | '--ring-color' | '--ring-offset-color' | '--ring-offset-width' | '--ring-width' | '--rotate' | '--saturate' | '--scale' | '--scroll-margin' | '--scroll-padding' | '--sepia' | '--shadow' | '--size' | '--skew' | '--space' | '--spacing' | '--stroke' | '--stroke-width' | '--text-color' | '--text-decoration-color' | '--text-decoration-thickness' | '--text-indent' | '--text-underline-offset' | '--transform-origin' | '--transition-delay' | '--transition-duration' | '--transition-property' | '--transition-timing-function' | '--translate' | '--width' | '--z-index';
|
|
30
|
+
type ThemeKey = '--accent-color' | '--animate' | '--aspect-ratio' | '--backdrop-blur' | '--backdrop-brightness' | '--backdrop-contrast' | '--backdrop-grayscale' | '--backdrop-hue-rotate' | '--backdrop-invert' | '--backdrop-opacity' | '--backdrop-saturate' | '--backdrop-sepia' | '--background-color' | '--background-image' | '--blur' | '--border-color' | '--border-spacing' | '--border-width' | '--box-shadow-color' | '--breakpoint' | '--brightness' | '--caret-color' | '--color' | '--columns' | '--contrast' | '--cursor' | '--default-border-width' | '--default-ring-color' | '--default-ring-width' | '--divide-width' | '--divide-color' | '--drop-shadow' | '--fill' | '--flex-basis' | '--font-family' | '--font-size' | '--font-weight' | '--gap' | '--gradient-color-stop-positions' | '--grayscale' | '--grid-auto-columns' | '--grid-auto-rows' | '--grid-column' | '--grid-column-end' | '--grid-column-start' | '--grid-row' | '--grid-row-end' | '--grid-row-start' | '--grid-template-columns' | '--grid-template-rows' | '--height' | '--hue-rotate' | '--inset' | '--inset-shadow' | '--invert' | '--letter-spacing' | '--line-height' | '--line-clamp' | '--list-style-image' | '--list-style-type' | '--margin' | '--max-height' | '--max-width' | '--min-height' | '--min-width' | '--object-position' | '--opacity' | '--order' | '--outline-color' | '--outline-width' | '--outline-offset' | '--padding' | '--placeholder-color' | '--radius' | '--ring-color' | '--ring-offset-color' | '--ring-offset-width' | '--ring-width' | '--rotate' | '--saturate' | '--scale' | '--scroll-margin' | '--scroll-padding' | '--sepia' | '--shadow' | '--size' | '--skew' | '--space' | '--spacing' | '--stroke' | '--stroke-width' | '--text-color' | '--text-decoration-color' | '--text-decoration-thickness' | '--text-indent' | '--text-underline-offset' | '--transform-origin' | '--transition-delay' | '--transition-duration' | '--transition-property' | '--transition-timing-function' | '--translate' | '--width' | '--z-index';
|
|
14
31
|
|
|
15
32
|
type Rule = {
|
|
16
33
|
kind: 'rule';
|
|
@@ -54,6 +71,7 @@ type NamedUtilityValue = {
|
|
|
54
71
|
/**
|
|
55
72
|
* bg-red-500
|
|
56
73
|
* ^^^^^^^
|
|
74
|
+
*
|
|
57
75
|
* w-1/2
|
|
58
76
|
* ^
|
|
59
77
|
*/
|
|
@@ -98,9 +116,7 @@ type Variant =
|
|
|
98
116
|
* Arbitrary variants are variants that take a selector and generate a variant
|
|
99
117
|
* on the fly.
|
|
100
118
|
*
|
|
101
|
-
* E.g.:
|
|
102
|
-
*
|
|
103
|
-
* - `[&_p]`
|
|
119
|
+
* E.g.: `[&_p]`
|
|
104
120
|
*/
|
|
105
121
|
{
|
|
106
122
|
kind: 'arbitrary';
|
|
@@ -110,9 +126,7 @@ type Variant =
|
|
|
110
126
|
/**
|
|
111
127
|
* Static variants are variants that don't take any arguments.
|
|
112
128
|
*
|
|
113
|
-
* E.g.:
|
|
114
|
-
*
|
|
115
|
-
* - `hover`
|
|
129
|
+
* E.g.: `hover`
|
|
116
130
|
*/
|
|
117
131
|
| {
|
|
118
132
|
kind: 'static';
|
|
@@ -120,18 +134,22 @@ type Variant =
|
|
|
120
134
|
compounds: boolean;
|
|
121
135
|
}
|
|
122
136
|
/**
|
|
123
|
-
* Functional variants are variants that take an argument. The argument is
|
|
137
|
+
* Functional variants are variants that can take an argument. The argument is
|
|
124
138
|
* either a named variant value or an arbitrary variant value.
|
|
125
139
|
*
|
|
126
140
|
* E.g.:
|
|
127
141
|
*
|
|
128
142
|
* - `aria-disabled`
|
|
129
143
|
* - `aria-[disabled]`
|
|
144
|
+
* - `@container-size` -> @container, with named value `size`
|
|
145
|
+
* - `@container-[inline-size]` -> @container, with arbitrary variant value `inline-size`
|
|
146
|
+
* - `@container` -> @container, with no value
|
|
130
147
|
*/
|
|
131
148
|
| {
|
|
132
149
|
kind: 'functional';
|
|
133
150
|
root: string;
|
|
134
|
-
value: ArbitraryVariantValue | NamedVariantValue;
|
|
151
|
+
value: ArbitraryVariantValue | NamedVariantValue | null;
|
|
152
|
+
modifier: ArbitraryModifier | NamedModifier | null;
|
|
135
153
|
compounds: boolean;
|
|
136
154
|
}
|
|
137
155
|
/**
|
|
@@ -150,19 +168,50 @@ type Variant =
|
|
|
150
168
|
variant: Variant;
|
|
151
169
|
compounds: boolean;
|
|
152
170
|
};
|
|
153
|
-
type Candidate =
|
|
171
|
+
type Candidate =
|
|
172
|
+
/**
|
|
173
|
+
* Arbitrary candidates are candidates that register utilities on the fly with
|
|
174
|
+
* a property and a value.
|
|
175
|
+
*
|
|
176
|
+
* E.g.:
|
|
177
|
+
*
|
|
178
|
+
* - `[color:red]`
|
|
179
|
+
* - `[color:red]/50`
|
|
180
|
+
* - `[color:red]/50!`
|
|
181
|
+
*/
|
|
182
|
+
{
|
|
154
183
|
kind: 'arbitrary';
|
|
155
184
|
property: string;
|
|
156
185
|
value: string;
|
|
186
|
+
modifier: ArbitraryModifier | NamedModifier | null;
|
|
157
187
|
variants: Variant[];
|
|
158
188
|
important: boolean;
|
|
159
|
-
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Static candidates are candidates that don't take any arguments.
|
|
192
|
+
*
|
|
193
|
+
* E.g.:
|
|
194
|
+
*
|
|
195
|
+
* - `underline`
|
|
196
|
+
* - `flex`
|
|
197
|
+
*/
|
|
198
|
+
| {
|
|
160
199
|
kind: 'static';
|
|
161
200
|
root: string;
|
|
162
201
|
variants: Variant[];
|
|
163
202
|
negative: boolean;
|
|
164
203
|
important: boolean;
|
|
165
|
-
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Functional candidates are candidates that can take an argument.
|
|
207
|
+
*
|
|
208
|
+
* E.g.:
|
|
209
|
+
*
|
|
210
|
+
* - `bg-red-500`
|
|
211
|
+
* - `bg-[#0088cc]`
|
|
212
|
+
* - `w-1/2`
|
|
213
|
+
*/
|
|
214
|
+
| {
|
|
166
215
|
kind: 'functional';
|
|
167
216
|
root: string;
|
|
168
217
|
value: ArbitraryUtilityValue | NamedUtilityValue | null;
|
|
@@ -175,17 +224,31 @@ type Candidate = {
|
|
|
175
224
|
type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
|
|
176
225
|
kind: T;
|
|
177
226
|
}>) => AstNode[] | undefined;
|
|
227
|
+
interface SuggestionGroup {
|
|
228
|
+
supportsNegative?: boolean;
|
|
229
|
+
values: (string | null)[];
|
|
230
|
+
modifiers: string[];
|
|
231
|
+
}
|
|
178
232
|
declare class Utilities {
|
|
179
233
|
private utilities;
|
|
234
|
+
private completions;
|
|
180
235
|
static(name: string, compileFn: CompileFn<'static'>): void;
|
|
181
236
|
functional(name: string, compileFn: CompileFn<'functional'>): void;
|
|
237
|
+
arbitrary(compileFn: CompileFn<'arbitrary'>): void;
|
|
182
238
|
has(name: string): boolean;
|
|
183
|
-
get(name: string): {
|
|
239
|
+
get(name: string | symbol): {
|
|
184
240
|
kind: "arbitrary" | "static" | "functional";
|
|
185
241
|
compileFn: CompileFn<any>;
|
|
186
242
|
} | undefined;
|
|
187
243
|
kind(name: string): "arbitrary" | "static" | "functional";
|
|
188
|
-
|
|
244
|
+
getCompletions(name: string): SuggestionGroup[];
|
|
245
|
+
suggest(name: string, groups: () => SuggestionGroup[]): void;
|
|
246
|
+
keys(): IterableIterator<string | symbol>;
|
|
247
|
+
entries(): IterableIterator<[string | symbol, {
|
|
248
|
+
kind: "arbitrary" | "static" | "functional";
|
|
249
|
+
compileFn: CompileFn<any>;
|
|
250
|
+
}]>;
|
|
251
|
+
getArbitrary(): CompileFn<any>;
|
|
189
252
|
private set;
|
|
190
253
|
}
|
|
191
254
|
|
|
@@ -196,6 +259,7 @@ type CompareFn = (a: Variant, z: Variant) => number;
|
|
|
196
259
|
declare class Variants {
|
|
197
260
|
private compareFns;
|
|
198
261
|
private variants;
|
|
262
|
+
private completions;
|
|
199
263
|
/**
|
|
200
264
|
* Registering a group of variants should result in the same sort number for
|
|
201
265
|
* all the variants. This is to ensure that the variants are applied in the
|
|
@@ -218,11 +282,24 @@ declare class Variants {
|
|
|
218
282
|
}): void;
|
|
219
283
|
group(fn: () => void, compareFn?: CompareFn): void;
|
|
220
284
|
has(name: string): boolean;
|
|
221
|
-
get(name: string):
|
|
285
|
+
get(name: string): {
|
|
286
|
+
kind: "arbitrary" | "static" | "functional" | "compound";
|
|
287
|
+
order: number;
|
|
288
|
+
applyFn: VariantFn<any>;
|
|
289
|
+
compounds: boolean;
|
|
290
|
+
} | undefined;
|
|
222
291
|
kind(name: string): "arbitrary" | "static" | "functional" | "compound";
|
|
223
292
|
compounds(name: string): boolean;
|
|
293
|
+
suggest(name: string, suggestions: () => string[]): void;
|
|
294
|
+
getCompletions(name: string): string[];
|
|
224
295
|
compare(a: Variant | null, z: Variant | null): number;
|
|
225
296
|
keys(): IterableIterator<string>;
|
|
297
|
+
entries(): IterableIterator<[string, {
|
|
298
|
+
kind: "arbitrary" | "static" | "functional" | "compound";
|
|
299
|
+
order: number;
|
|
300
|
+
applyFn: VariantFn<any>;
|
|
301
|
+
compounds: boolean;
|
|
302
|
+
}]>;
|
|
226
303
|
private set;
|
|
227
304
|
private nextOrder;
|
|
228
305
|
}
|
|
@@ -231,14 +308,17 @@ type DesignSystem = {
|
|
|
231
308
|
theme: Theme;
|
|
232
309
|
utilities: Utilities;
|
|
233
310
|
variants: Variants;
|
|
311
|
+
candidatesToCss(classes: string[]): (string | null)[];
|
|
234
312
|
getClassOrder(classes: string[]): [string, bigint | null][];
|
|
313
|
+
getClassList(): ClassEntry[];
|
|
314
|
+
getVariants(): VariantEntry[];
|
|
235
315
|
};
|
|
236
316
|
|
|
317
|
+
declare function compile(css: string, rawCandidates: string[]): string;
|
|
237
318
|
declare function optimizeCss(input: string, { file, minify }?: {
|
|
238
319
|
file?: string;
|
|
239
320
|
minify?: boolean;
|
|
240
321
|
}): string;
|
|
241
|
-
declare function
|
|
242
|
-
declare function loadDesignSystem(css: string): DesignSystem;
|
|
322
|
+
declare function __unstable__loadDesignSystem(css: string): DesignSystem;
|
|
243
323
|
|
|
244
|
-
export {
|
|
324
|
+
export { __unstable__loadDesignSystem, compile, optimizeCss };
|