tailwindcss 4.0.0-alpha.2 → 4.0.0-alpha.20
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/colors.d.mts +295 -0
- package/dist/colors.d.ts +2 -0
- package/dist/colors.js +1 -0
- package/dist/colors.mjs +1 -0
- package/dist/default-theme.d.mts +770 -0
- package/dist/default-theme.d.ts +2 -0
- package/dist/default-theme.js +1 -0
- package/dist/default-theme.mjs +1 -0
- package/dist/lib.d.mts +166 -86
- package/dist/lib.d.ts +166 -86
- package/dist/lib.js +14 -11
- package/dist/lib.mjs +14 -11
- package/dist/plugin.d.mts +67 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +1 -0
- package/dist/plugin.mjs +1 -0
- package/dist/types-InlknEYy.d.mts +14 -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,51 +1,3 @@
|
|
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
|
-
|
17
|
-
declare class Theme {
|
18
|
-
private values;
|
19
|
-
constructor(values?: Map<string, string>);
|
20
|
-
add(key: string, value: string): void;
|
21
|
-
keysInNamespaces(themeKeys: ThemeKey[]): string[];
|
22
|
-
get(themeKeys: ThemeKey[]): string | null;
|
23
|
-
entries(): IterableIterator<[string, string]>;
|
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>;
|
29
|
-
}
|
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';
|
31
|
-
|
32
|
-
type Rule = {
|
33
|
-
kind: 'rule';
|
34
|
-
selector: string;
|
35
|
-
nodes: AstNode[];
|
36
|
-
};
|
37
|
-
type Declaration = {
|
38
|
-
kind: 'declaration';
|
39
|
-
property: string;
|
40
|
-
value: string;
|
41
|
-
important: boolean;
|
42
|
-
};
|
43
|
-
type Comment = {
|
44
|
-
kind: 'comment';
|
45
|
-
value: string;
|
46
|
-
};
|
47
|
-
type AstNode = Rule | Declaration | Comment;
|
48
|
-
|
49
1
|
type ArbitraryUtilityValue = {
|
50
2
|
kind: 'arbitrary';
|
51
3
|
/**
|
@@ -122,6 +74,7 @@ type Variant =
|
|
122
74
|
kind: 'arbitrary';
|
123
75
|
selector: string;
|
124
76
|
compounds: boolean;
|
77
|
+
relative: boolean;
|
125
78
|
}
|
126
79
|
/**
|
127
80
|
* Static variants are variants that don't take any arguments.
|
@@ -186,6 +139,7 @@ type Candidate =
|
|
186
139
|
modifier: ArbitraryModifier | NamedModifier | null;
|
187
140
|
variants: Variant[];
|
188
141
|
important: boolean;
|
142
|
+
raw: string;
|
189
143
|
}
|
190
144
|
/**
|
191
145
|
* Static candidates are candidates that don't take any arguments.
|
@@ -201,6 +155,7 @@ type Candidate =
|
|
201
155
|
variants: Variant[];
|
202
156
|
negative: boolean;
|
203
157
|
important: boolean;
|
158
|
+
raw: string;
|
204
159
|
}
|
205
160
|
/**
|
206
161
|
* Functional candidates are candidates that can take an argument.
|
@@ -219,38 +174,52 @@ type Candidate =
|
|
219
174
|
variants: Variant[];
|
220
175
|
negative: boolean;
|
221
176
|
important: boolean;
|
177
|
+
raw: string;
|
222
178
|
};
|
179
|
+
declare function parseVariant(variant: string, designSystem: DesignSystem): Variant | null;
|
223
180
|
|
224
|
-
type
|
225
|
-
kind:
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
181
|
+
type Rule = {
|
182
|
+
kind: 'rule';
|
183
|
+
selector: string;
|
184
|
+
nodes: AstNode[];
|
185
|
+
};
|
186
|
+
type Declaration = {
|
187
|
+
kind: 'declaration';
|
188
|
+
property: string;
|
189
|
+
value: string | undefined;
|
190
|
+
important: boolean;
|
191
|
+
};
|
192
|
+
type Comment = {
|
193
|
+
kind: 'comment';
|
194
|
+
value: string;
|
195
|
+
};
|
196
|
+
type AstNode = Rule | Declaration | Comment;
|
197
|
+
|
198
|
+
declare class Theme {
|
199
|
+
#private;
|
200
|
+
private values;
|
201
|
+
constructor(values?: Map<string, {
|
202
|
+
value: string;
|
203
|
+
isReference: boolean;
|
204
|
+
isInline: boolean;
|
205
|
+
}>);
|
206
|
+
add(key: string, value: string, { isReference, isInline }?: {
|
207
|
+
isReference?: boolean | undefined;
|
208
|
+
isInline?: boolean | undefined;
|
209
|
+
}): void;
|
210
|
+
keysInNamespaces(themeKeys: ThemeKey[]): string[];
|
211
|
+
get(themeKeys: (ThemeKey | `${ThemeKey}-${string}`)[]): string | null;
|
212
|
+
entries(): IterableIterator<[string, {
|
213
|
+
value: string;
|
214
|
+
isReference: boolean;
|
215
|
+
isInline: boolean;
|
250
216
|
}]>;
|
251
|
-
|
252
|
-
|
217
|
+
resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
|
218
|
+
resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
|
219
|
+
resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
|
220
|
+
namespace(namespace: string): Map<string | null, string>;
|
253
221
|
}
|
222
|
+
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}`;
|
254
223
|
|
255
224
|
type VariantFn<T extends Variant['kind']> = (rule: Rule, variant: Extract<Variant, {
|
256
225
|
kind: T;
|
@@ -274,6 +243,7 @@ declare class Variants {
|
|
274
243
|
static(name: string, applyFn: VariantFn<'static'>, { compounds }?: {
|
275
244
|
compounds?: boolean;
|
276
245
|
}): void;
|
246
|
+
fromAst(name: string, ast: AstNode[]): void;
|
277
247
|
functional(name: string, applyFn: VariantFn<'functional'>, { compounds }?: {
|
278
248
|
compounds?: boolean;
|
279
249
|
}): void;
|
@@ -283,19 +253,19 @@ declare class Variants {
|
|
283
253
|
group(fn: () => void, compareFn?: CompareFn): void;
|
284
254
|
has(name: string): boolean;
|
285
255
|
get(name: string): {
|
286
|
-
kind: "
|
256
|
+
kind: Variant["kind"];
|
287
257
|
order: number;
|
288
258
|
applyFn: VariantFn<any>;
|
289
259
|
compounds: boolean;
|
290
260
|
} | undefined;
|
291
|
-
kind(name: string): "
|
261
|
+
kind(name: string): "static" | "arbitrary" | "functional" | "compound";
|
292
262
|
compounds(name: string): boolean;
|
293
263
|
suggest(name: string, suggestions: () => string[]): void;
|
294
264
|
getCompletions(name: string): string[];
|
295
265
|
compare(a: Variant | null, z: Variant | null): number;
|
296
266
|
keys(): IterableIterator<string>;
|
297
267
|
entries(): IterableIterator<[string, {
|
298
|
-
kind: "
|
268
|
+
kind: Variant["kind"];
|
299
269
|
order: number;
|
300
270
|
applyFn: VariantFn<any>;
|
301
271
|
compounds: boolean;
|
@@ -304,6 +274,55 @@ declare class Variants {
|
|
304
274
|
private nextOrder;
|
305
275
|
}
|
306
276
|
|
277
|
+
declare function compileAstNodes(candidate: Candidate, designSystem: DesignSystem): {
|
278
|
+
node: AstNode;
|
279
|
+
propertySort: number[];
|
280
|
+
}[];
|
281
|
+
|
282
|
+
interface ClassMetadata {
|
283
|
+
modifiers: string[];
|
284
|
+
}
|
285
|
+
type ClassEntry = [string, ClassMetadata];
|
286
|
+
interface SelectorOptions {
|
287
|
+
modifier?: string;
|
288
|
+
value?: string;
|
289
|
+
}
|
290
|
+
interface VariantEntry {
|
291
|
+
name: string;
|
292
|
+
isArbitrary: boolean;
|
293
|
+
values: string[];
|
294
|
+
hasDash: boolean;
|
295
|
+
selectors: (options: SelectorOptions) => string[];
|
296
|
+
}
|
297
|
+
|
298
|
+
type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
|
299
|
+
kind: T;
|
300
|
+
}>) => AstNode[] | undefined | null;
|
301
|
+
interface SuggestionGroup {
|
302
|
+
supportsNegative?: boolean;
|
303
|
+
values: (string | null)[];
|
304
|
+
modifiers: string[];
|
305
|
+
}
|
306
|
+
type UtilityOptions = {
|
307
|
+
types: string[];
|
308
|
+
};
|
309
|
+
type Utility = {
|
310
|
+
kind: 'static' | 'functional';
|
311
|
+
compileFn: CompileFn<any>;
|
312
|
+
options?: UtilityOptions;
|
313
|
+
};
|
314
|
+
declare class Utilities {
|
315
|
+
private utilities;
|
316
|
+
private completions;
|
317
|
+
static(name: string, compileFn: CompileFn<'static'>): void;
|
318
|
+
functional(name: string, compileFn: CompileFn<'functional'>, options?: UtilityOptions): void;
|
319
|
+
has(name: string, kind: 'static' | 'functional'): boolean;
|
320
|
+
get(name: string): Utility[];
|
321
|
+
getCompletions(name: string): SuggestionGroup[];
|
322
|
+
suggest(name: string, groups: () => SuggestionGroup[]): void;
|
323
|
+
keys(kind: 'static' | 'functional'): string[];
|
324
|
+
}
|
325
|
+
|
307
326
|
type DesignSystem = {
|
308
327
|
theme: Theme;
|
309
328
|
utilities: Utilities;
|
@@ -312,13 +331,74 @@ type DesignSystem = {
|
|
312
331
|
getClassOrder(classes: string[]): [string, bigint | null][];
|
313
332
|
getClassList(): ClassEntry[];
|
314
333
|
getVariants(): VariantEntry[];
|
334
|
+
parseCandidate(candidate: string): Candidate[];
|
335
|
+
parseVariant(variant: string): ReturnType<typeof parseVariant>;
|
336
|
+
compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
|
337
|
+
getUsedVariants(): ReturnType<typeof parseVariant>[];
|
315
338
|
};
|
316
339
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
340
|
+
interface PluginUtils {
|
341
|
+
theme(keypath: string, defaultValue?: any): any;
|
342
|
+
}
|
343
|
+
|
344
|
+
type ResolvableTo<T> = T | ((utils: PluginUtils) => T);
|
345
|
+
interface UserConfig {
|
346
|
+
theme?: ThemeConfig;
|
347
|
+
}
|
348
|
+
type ThemeValue = ResolvableTo<Record<string, unknown>> | null | undefined;
|
349
|
+
type ThemeConfig = Record<string, ThemeValue> & {
|
350
|
+
extend?: Record<string, ThemeValue>;
|
351
|
+
};
|
352
|
+
|
353
|
+
type PluginFn = (api: PluginAPI) => void;
|
354
|
+
type PluginWithConfig = {
|
355
|
+
handler: PluginFn;
|
356
|
+
config?: UserConfig;
|
357
|
+
};
|
358
|
+
type PluginWithOptions<T> = {
|
359
|
+
(options?: T): PluginWithConfig;
|
360
|
+
__isOptionsFunction: true;
|
361
|
+
};
|
362
|
+
type Plugin = PluginFn | PluginWithConfig | PluginWithOptions<any>;
|
363
|
+
type PluginAPI = {
|
364
|
+
addBase(base: CssInJs): void;
|
365
|
+
addVariant(name: string, variant: string | string[] | CssInJs): void;
|
366
|
+
addUtilities(utilities: Record<string, CssInJs | CssInJs[]> | Record<string, CssInJs | CssInJs[]>[], options?: {}): void;
|
367
|
+
matchUtilities(utilities: Record<string, (value: string, extra: {
|
368
|
+
modifier: string | null;
|
369
|
+
}) => CssInJs | CssInJs[]>, options?: Partial<{
|
370
|
+
type: string | string[];
|
371
|
+
supportsNegativeValues: boolean;
|
372
|
+
values: Record<string, string> & {
|
373
|
+
__BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
|
374
|
+
};
|
375
|
+
modifiers: 'any' | Record<string, string>;
|
376
|
+
}>): void;
|
377
|
+
addComponents(utilities: Record<string, CssInJs> | Record<string, CssInJs>[], options?: {}): void;
|
378
|
+
matchComponents(utilities: Record<string, (value: string, extra: {
|
379
|
+
modifier: string | null;
|
380
|
+
}) => CssInJs>, options?: Partial<{
|
381
|
+
type: string | string[];
|
382
|
+
supportsNegativeValues: boolean;
|
383
|
+
values: Record<string, string> & {
|
384
|
+
__BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
|
385
|
+
};
|
386
|
+
modifiers: 'any' | Record<string, string>;
|
387
|
+
}>): void;
|
388
|
+
theme(path: string, defaultValue?: any): any;
|
389
|
+
prefix(className: string): string;
|
390
|
+
};
|
391
|
+
type CssInJs = {
|
392
|
+
[key: string]: string | CssInJs | CssInJs[];
|
393
|
+
};
|
394
|
+
|
395
|
+
type CompileOptions = {
|
396
|
+
loadPlugin?: (path: string) => Promise<Plugin>;
|
397
|
+
};
|
398
|
+
declare function compile(css: string, opts?: CompileOptions): Promise<{
|
399
|
+
globs: string[];
|
400
|
+
build(candidates: string[]): string;
|
401
|
+
}>;
|
402
|
+
declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
|
323
403
|
|
324
|
-
export { __unstable__loadDesignSystem, compile
|
404
|
+
export { __unstable__loadDesignSystem, compile };
|