tailwindcss 4.0.0-alpha.2 → 4.0.0-alpha.21
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-2PMIOWFK.mjs +1 -0
- package/dist/colors.d.mts +295 -0
- package/dist/colors.d.ts +295 -0
- package/dist/colors.js +1 -0
- package/dist/colors.mjs +1 -0
- package/dist/default-theme.d.mts +1146 -0
- package/dist/default-theme.d.ts +1146 -0
- package/dist/default-theme.js +1 -0
- package/dist/default-theme.mjs +1 -0
- package/dist/lib.d.mts +219 -122
- package/dist/lib.d.ts +219 -122
- package/dist/lib.js +24 -11
- package/dist/lib.mjs +24 -11
- package/dist/plugin.d.mts +76 -0
- package/dist/plugin.d.ts +76 -0
- package/dist/plugin.js +1 -0
- package/dist/plugin.mjs +1 -0
- package/dist/resolve-config-C9L_YGHi.d.mts +22 -0
- package/dist/resolve-config-C9L_YGHi.d.ts +22 -0
- package/index.css +825 -3
- package/package.json +30 -8
- package/preflight.css +22 -51
- package/theme.css +16 -10
package/dist/lib.d.ts
CHANGED
@@ -1,3 +1,104 @@
|
|
1
|
+
type Rule = {
|
2
|
+
kind: 'rule';
|
3
|
+
selector: string;
|
4
|
+
nodes: AstNode[];
|
5
|
+
};
|
6
|
+
type Declaration = {
|
7
|
+
kind: 'declaration';
|
8
|
+
property: string;
|
9
|
+
value: string | undefined;
|
10
|
+
important: boolean;
|
11
|
+
};
|
12
|
+
type Comment = {
|
13
|
+
kind: 'comment';
|
14
|
+
value: string;
|
15
|
+
};
|
16
|
+
type AstNode = Rule | Declaration | Comment;
|
17
|
+
|
18
|
+
declare class Theme {
|
19
|
+
#private;
|
20
|
+
private values;
|
21
|
+
constructor(values?: Map<string, {
|
22
|
+
value: string;
|
23
|
+
isReference: boolean;
|
24
|
+
isInline: boolean;
|
25
|
+
}>);
|
26
|
+
add(key: string, value: string, { isReference, isInline }?: {
|
27
|
+
isReference?: boolean | undefined;
|
28
|
+
isInline?: boolean | undefined;
|
29
|
+
}): void;
|
30
|
+
keysInNamespaces(themeKeys: ThemeKey[]): string[];
|
31
|
+
get(themeKeys: (ThemeKey | `${ThemeKey}-${string}`)[]): string | null;
|
32
|
+
entries(): IterableIterator<[string, {
|
33
|
+
value: string;
|
34
|
+
isReference: boolean;
|
35
|
+
isInline: boolean;
|
36
|
+
}]>;
|
37
|
+
resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
|
38
|
+
resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
|
39
|
+
resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
|
40
|
+
namespace(namespace: string): Map<string | null, string>;
|
41
|
+
}
|
42
|
+
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' | '--default-transition-timing-function' | '--default-transition-duration' | '--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' | '--perspective' | '--perspective-origin' | '--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' | `--default-${string}`;
|
43
|
+
|
44
|
+
type VariantFn<T extends Variant['kind']> = (rule: Rule, variant: Extract<Variant, {
|
45
|
+
kind: T;
|
46
|
+
}>) => null | void;
|
47
|
+
type CompareFn = (a: Variant, z: Variant) => number;
|
48
|
+
declare class Variants {
|
49
|
+
private compareFns;
|
50
|
+
private variants;
|
51
|
+
private completions;
|
52
|
+
/**
|
53
|
+
* Registering a group of variants should result in the same sort number for
|
54
|
+
* all the variants. This is to ensure that the variants are applied in the
|
55
|
+
* correct order.
|
56
|
+
*/
|
57
|
+
private groupOrder;
|
58
|
+
/**
|
59
|
+
* Keep track of the last sort order instead of using the size of the map to
|
60
|
+
* avoid unnecessarily skipping order numbers.
|
61
|
+
*/
|
62
|
+
private lastOrder;
|
63
|
+
static(name: string, applyFn: VariantFn<'static'>, { compounds }?: {
|
64
|
+
compounds?: boolean;
|
65
|
+
}): void;
|
66
|
+
fromAst(name: string, ast: AstNode[]): void;
|
67
|
+
functional(name: string, applyFn: VariantFn<'functional'>, { compounds }?: {
|
68
|
+
compounds?: boolean;
|
69
|
+
}): void;
|
70
|
+
compound(name: string, applyFn: VariantFn<'compound'>, { compounds }?: {
|
71
|
+
compounds?: boolean;
|
72
|
+
}): void;
|
73
|
+
group(fn: () => void, compareFn?: CompareFn): void;
|
74
|
+
has(name: string): boolean;
|
75
|
+
get(name: string): {
|
76
|
+
kind: Variant["kind"];
|
77
|
+
order: number;
|
78
|
+
applyFn: VariantFn<any>;
|
79
|
+
compounds: boolean;
|
80
|
+
} | undefined;
|
81
|
+
kind(name: string): "static" | "arbitrary" | "functional" | "compound";
|
82
|
+
compounds(name: string): boolean;
|
83
|
+
suggest(name: string, suggestions: () => string[]): void;
|
84
|
+
getCompletions(name: string): string[];
|
85
|
+
compare(a: Variant | null, z: Variant | null): number;
|
86
|
+
keys(): IterableIterator<string>;
|
87
|
+
entries(): IterableIterator<[string, {
|
88
|
+
kind: Variant["kind"];
|
89
|
+
order: number;
|
90
|
+
applyFn: VariantFn<any>;
|
91
|
+
compounds: boolean;
|
92
|
+
}]>;
|
93
|
+
private set;
|
94
|
+
private nextOrder;
|
95
|
+
}
|
96
|
+
|
97
|
+
declare function compileAstNodes(candidate: Candidate, designSystem: DesignSystem): {
|
98
|
+
node: AstNode;
|
99
|
+
propertySort: number[];
|
100
|
+
}[];
|
101
|
+
|
1
102
|
interface ClassMetadata {
|
2
103
|
modifiers: string[];
|
3
104
|
}
|
@@ -14,37 +115,47 @@ interface VariantEntry {
|
|
14
115
|
selectors: (options: SelectorOptions) => string[];
|
15
116
|
}
|
16
117
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
clearNamespace(namespace: string): void;
|
25
|
-
resolveKey(candidateValue: string, themeKeys: ThemeKey[]): string | null;
|
26
|
-
resolve(candidateValue: string, themeKeys: ThemeKey[]): string | null;
|
27
|
-
resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
|
28
|
-
namespace(namespace: string): Map<string | null, string>;
|
118
|
+
type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
|
119
|
+
kind: T;
|
120
|
+
}>) => AstNode[] | undefined | null;
|
121
|
+
interface SuggestionGroup {
|
122
|
+
supportsNegative?: boolean;
|
123
|
+
values: (string | null)[];
|
124
|
+
modifiers: string[];
|
29
125
|
}
|
30
|
-
type
|
31
|
-
|
32
|
-
type Rule = {
|
33
|
-
kind: 'rule';
|
34
|
-
selector: string;
|
35
|
-
nodes: AstNode[];
|
126
|
+
type UtilityOptions = {
|
127
|
+
types: string[];
|
36
128
|
};
|
37
|
-
type
|
38
|
-
kind: '
|
39
|
-
|
40
|
-
|
41
|
-
important: boolean;
|
129
|
+
type Utility = {
|
130
|
+
kind: 'static' | 'functional';
|
131
|
+
compileFn: CompileFn<any>;
|
132
|
+
options?: UtilityOptions;
|
42
133
|
};
|
43
|
-
|
44
|
-
|
45
|
-
|
134
|
+
declare class Utilities {
|
135
|
+
private utilities;
|
136
|
+
private completions;
|
137
|
+
static(name: string, compileFn: CompileFn<'static'>): void;
|
138
|
+
functional(name: string, compileFn: CompileFn<'functional'>, options?: UtilityOptions): void;
|
139
|
+
has(name: string, kind: 'static' | 'functional'): boolean;
|
140
|
+
get(name: string): Utility[];
|
141
|
+
getCompletions(name: string): SuggestionGroup[];
|
142
|
+
suggest(name: string, groups: () => SuggestionGroup[]): void;
|
143
|
+
keys(kind: 'static' | 'functional'): string[];
|
144
|
+
}
|
145
|
+
|
146
|
+
type DesignSystem = {
|
147
|
+
theme: Theme;
|
148
|
+
utilities: Utilities;
|
149
|
+
variants: Variants;
|
150
|
+
candidatesToCss(classes: string[]): (string | null)[];
|
151
|
+
getClassOrder(classes: string[]): [string, bigint | null][];
|
152
|
+
getClassList(): ClassEntry[];
|
153
|
+
getVariants(): VariantEntry[];
|
154
|
+
parseCandidate(candidate: string): Candidate[];
|
155
|
+
parseVariant(variant: string): ReturnType<typeof parseVariant>;
|
156
|
+
compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
|
157
|
+
getUsedVariants(): ReturnType<typeof parseVariant>[];
|
46
158
|
};
|
47
|
-
type AstNode = Rule | Declaration | Comment;
|
48
159
|
|
49
160
|
type ArbitraryUtilityValue = {
|
50
161
|
kind: 'arbitrary';
|
@@ -122,6 +233,7 @@ type Variant =
|
|
122
233
|
kind: 'arbitrary';
|
123
234
|
selector: string;
|
124
235
|
compounds: boolean;
|
236
|
+
relative: boolean;
|
125
237
|
}
|
126
238
|
/**
|
127
239
|
* Static variants are variants that don't take any arguments.
|
@@ -186,6 +298,7 @@ type Candidate =
|
|
186
298
|
modifier: ArbitraryModifier | NamedModifier | null;
|
187
299
|
variants: Variant[];
|
188
300
|
important: boolean;
|
301
|
+
raw: string;
|
189
302
|
}
|
190
303
|
/**
|
191
304
|
* Static candidates are candidates that don't take any arguments.
|
@@ -201,6 +314,7 @@ type Candidate =
|
|
201
314
|
variants: Variant[];
|
202
315
|
negative: boolean;
|
203
316
|
important: boolean;
|
317
|
+
raw: string;
|
204
318
|
}
|
205
319
|
/**
|
206
320
|
* Functional candidates are candidates that can take an argument.
|
@@ -219,106 +333,89 @@ type Candidate =
|
|
219
333
|
variants: Variant[];
|
220
334
|
negative: boolean;
|
221
335
|
important: boolean;
|
336
|
+
raw: string;
|
222
337
|
};
|
338
|
+
declare function parseVariant(variant: string, designSystem: DesignSystem): Variant | null;
|
223
339
|
|
224
|
-
|
225
|
-
|
226
|
-
}>) => AstNode[] | undefined;
|
227
|
-
interface SuggestionGroup {
|
228
|
-
supportsNegative?: boolean;
|
229
|
-
values: (string | null)[];
|
230
|
-
modifiers: string[];
|
231
|
-
}
|
232
|
-
declare class Utilities {
|
233
|
-
private utilities;
|
234
|
-
private completions;
|
235
|
-
static(name: string, compileFn: CompileFn<'static'>): void;
|
236
|
-
functional(name: string, compileFn: CompileFn<'functional'>): void;
|
237
|
-
arbitrary(compileFn: CompileFn<'arbitrary'>): void;
|
238
|
-
has(name: string): boolean;
|
239
|
-
get(name: string | symbol): {
|
240
|
-
kind: "arbitrary" | "static" | "functional";
|
241
|
-
compileFn: CompileFn<any>;
|
242
|
-
} | undefined;
|
243
|
-
kind(name: string): "arbitrary" | "static" | "functional";
|
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>;
|
252
|
-
private set;
|
340
|
+
interface PluginUtils {
|
341
|
+
theme(keypath: string, defaultValue?: any): any;
|
253
342
|
}
|
254
343
|
|
255
|
-
type
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
}): void;
|
280
|
-
|
281
|
-
|
282
|
-
})
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
entries(): IterableIterator<[string, {
|
298
|
-
kind: "arbitrary" | "static" | "functional" | "compound";
|
299
|
-
order: number;
|
300
|
-
applyFn: VariantFn<any>;
|
301
|
-
compounds: boolean;
|
302
|
-
}]>;
|
303
|
-
private set;
|
304
|
-
private nextOrder;
|
305
|
-
}
|
344
|
+
type PluginFn = (api: PluginAPI) => void;
|
345
|
+
type PluginWithConfig = {
|
346
|
+
handler: PluginFn;
|
347
|
+
config?: UserConfig;
|
348
|
+
};
|
349
|
+
type PluginWithOptions<T> = {
|
350
|
+
(options?: T): PluginWithConfig;
|
351
|
+
__isOptionsFunction: true;
|
352
|
+
};
|
353
|
+
type Plugin = PluginFn | PluginWithConfig | PluginWithOptions<any>;
|
354
|
+
type PluginAPI = {
|
355
|
+
addBase(base: CssInJs): void;
|
356
|
+
addVariant(name: string, variant: string | string[] | CssInJs): void;
|
357
|
+
addUtilities(utilities: Record<string, CssInJs | CssInJs[]> | Record<string, CssInJs | CssInJs[]>[], options?: {}): void;
|
358
|
+
matchUtilities(utilities: Record<string, (value: string, extra: {
|
359
|
+
modifier: string | null;
|
360
|
+
}) => CssInJs | CssInJs[]>, options?: Partial<{
|
361
|
+
type: string | string[];
|
362
|
+
supportsNegativeValues: boolean;
|
363
|
+
values: Record<string, string> & {
|
364
|
+
__BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
|
365
|
+
};
|
366
|
+
modifiers: 'any' | Record<string, string>;
|
367
|
+
}>): void;
|
368
|
+
addComponents(utilities: Record<string, CssInJs> | Record<string, CssInJs>[], options?: {}): void;
|
369
|
+
matchComponents(utilities: Record<string, (value: string, extra: {
|
370
|
+
modifier: string | null;
|
371
|
+
}) => CssInJs>, options?: Partial<{
|
372
|
+
type: string | string[];
|
373
|
+
supportsNegativeValues: boolean;
|
374
|
+
values: Record<string, string> & {
|
375
|
+
__BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
|
376
|
+
};
|
377
|
+
modifiers: 'any' | Record<string, string>;
|
378
|
+
}>): void;
|
379
|
+
theme(path: string, defaultValue?: any): any;
|
380
|
+
config(path: string, defaultValue?: any): any;
|
381
|
+
prefix(className: string): string;
|
382
|
+
};
|
383
|
+
type CssInJs = {
|
384
|
+
[key: string]: string | string[] | CssInJs | CssInJs[];
|
385
|
+
};
|
306
386
|
|
307
|
-
type
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
387
|
+
type ResolvableTo<T> = T | ((utils: PluginUtils) => T);
|
388
|
+
type ThemeValue = ResolvableTo<Record<string, unknown>> | null | undefined;
|
389
|
+
type ThemeConfig = Record<string, ThemeValue> & {
|
390
|
+
extend?: Record<string, ThemeValue>;
|
391
|
+
};
|
392
|
+
type ContentFile = string | {
|
393
|
+
raw: string;
|
394
|
+
extension?: string;
|
315
395
|
};
|
396
|
+
type DarkModeStrategy = false | 'media' | 'class' | ['class', string] | 'selector' | ['selector', string] | ['variant', string | string[]];
|
397
|
+
interface UserConfig {
|
398
|
+
presets?: UserConfig[];
|
399
|
+
theme?: ThemeConfig;
|
400
|
+
plugins?: Plugin[];
|
401
|
+
}
|
402
|
+
interface UserConfig {
|
403
|
+
content?: ContentFile[] | {
|
404
|
+
files: ContentFile[];
|
405
|
+
};
|
406
|
+
}
|
407
|
+
interface UserConfig {
|
408
|
+
darkMode?: DarkModeStrategy;
|
409
|
+
}
|
316
410
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
411
|
+
type CompileOptions = {
|
412
|
+
loadPlugin?: (path: string) => Promise<Plugin>;
|
413
|
+
loadConfig?: (path: string) => Promise<UserConfig>;
|
414
|
+
};
|
415
|
+
declare function compile(css: string, opts?: CompileOptions): Promise<{
|
416
|
+
globs: string[];
|
417
|
+
build(candidates: string[]): string;
|
418
|
+
}>;
|
419
|
+
declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
|
323
420
|
|
324
|
-
export { __unstable__loadDesignSystem, compile
|
421
|
+
export { __unstable__loadDesignSystem, compile };
|