tailwindcss 4.0.0-alpha.23 → 4.0.0-alpha.25

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/lib.d.ts CHANGED
@@ -1,428 +1,3 @@
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;
1
+ declare function postcssPluginWarning(): void;
17
2
 
18
- declare class Theme {
19
- #private;
20
- private values;
21
- constructor(values?: Map<string, {
22
- value: string;
23
- isReference: boolean;
24
- isInline: boolean;
25
- isDefault: boolean;
26
- }>);
27
- add(key: string, value: string, { isReference, isInline, isDefault }?: {
28
- isReference?: boolean | undefined;
29
- isInline?: boolean | undefined;
30
- isDefault?: boolean | undefined;
31
- }): void;
32
- keysInNamespaces(themeKeys: ThemeKey[]): string[];
33
- get(themeKeys: (ThemeKey | `${ThemeKey}-${string}`)[]): string | null;
34
- hasDefault(key: string): boolean;
35
- entries(): IterableIterator<[string, {
36
- value: string;
37
- isReference: boolean;
38
- isInline: boolean;
39
- isDefault: boolean;
40
- }]>;
41
- resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
42
- resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
43
- resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
44
- namespace(namespace: string): Map<string | null, string>;
45
- }
46
- 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}`;
47
-
48
- type VariantFn<T extends Variant['kind']> = (rule: Rule, variant: Extract<Variant, {
49
- kind: T;
50
- }>) => null | void;
51
- type CompareFn = (a: Variant, z: Variant) => number;
52
- declare class Variants {
53
- private compareFns;
54
- private variants;
55
- private completions;
56
- /**
57
- * Registering a group of variants should result in the same sort number for
58
- * all the variants. This is to ensure that the variants are applied in the
59
- * correct order.
60
- */
61
- private groupOrder;
62
- /**
63
- * Keep track of the last sort order instead of using the size of the map to
64
- * avoid unnecessarily skipping order numbers.
65
- */
66
- private lastOrder;
67
- static(name: string, applyFn: VariantFn<'static'>, { compounds }?: {
68
- compounds?: boolean;
69
- }): void;
70
- fromAst(name: string, ast: AstNode[]): void;
71
- functional(name: string, applyFn: VariantFn<'functional'>, { compounds }?: {
72
- compounds?: boolean;
73
- }): void;
74
- compound(name: string, applyFn: VariantFn<'compound'>, { compounds }?: {
75
- compounds?: boolean;
76
- }): void;
77
- group(fn: () => void, compareFn?: CompareFn): void;
78
- has(name: string): boolean;
79
- get(name: string): {
80
- kind: Variant["kind"];
81
- order: number;
82
- applyFn: VariantFn<any>;
83
- compounds: boolean;
84
- } | undefined;
85
- kind(name: string): "static" | "arbitrary" | "functional" | "compound";
86
- compounds(name: string): boolean;
87
- suggest(name: string, suggestions: () => string[]): void;
88
- getCompletions(name: string): string[];
89
- compare(a: Variant | null, z: Variant | null): number;
90
- keys(): IterableIterator<string>;
91
- entries(): IterableIterator<[string, {
92
- kind: Variant["kind"];
93
- order: number;
94
- applyFn: VariantFn<any>;
95
- compounds: boolean;
96
- }]>;
97
- private set;
98
- private nextOrder;
99
- }
100
-
101
- declare function compileAstNodes(candidate: Candidate, designSystem: DesignSystem): {
102
- node: AstNode;
103
- propertySort: number[];
104
- }[];
105
-
106
- interface ClassMetadata {
107
- modifiers: string[];
108
- }
109
- type ClassEntry = [string, ClassMetadata];
110
- interface SelectorOptions {
111
- modifier?: string;
112
- value?: string;
113
- }
114
- interface VariantEntry {
115
- name: string;
116
- isArbitrary: boolean;
117
- values: string[];
118
- hasDash: boolean;
119
- selectors: (options: SelectorOptions) => string[];
120
- }
121
-
122
- type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
123
- kind: T;
124
- }>) => AstNode[] | undefined | null;
125
- interface SuggestionGroup {
126
- supportsNegative?: boolean;
127
- values: (string | null)[];
128
- modifiers: string[];
129
- }
130
- type UtilityOptions = {
131
- types: string[];
132
- };
133
- type Utility = {
134
- kind: 'static' | 'functional';
135
- compileFn: CompileFn<any>;
136
- options?: UtilityOptions;
137
- };
138
- declare class Utilities {
139
- private utilities;
140
- private completions;
141
- static(name: string, compileFn: CompileFn<'static'>): void;
142
- functional(name: string, compileFn: CompileFn<'functional'>, options?: UtilityOptions): void;
143
- has(name: string, kind: 'static' | 'functional'): boolean;
144
- get(name: string): Utility[];
145
- getCompletions(name: string): SuggestionGroup[];
146
- suggest(name: string, groups: () => SuggestionGroup[]): void;
147
- keys(kind: 'static' | 'functional'): string[];
148
- }
149
-
150
- type DesignSystem = {
151
- theme: Theme;
152
- utilities: Utilities;
153
- variants: Variants;
154
- candidatesToCss(classes: string[]): (string | null)[];
155
- getClassOrder(classes: string[]): [string, bigint | null][];
156
- getClassList(): ClassEntry[];
157
- getVariants(): VariantEntry[];
158
- parseCandidate(candidate: string): Candidate[];
159
- parseVariant(variant: string): ReturnType<typeof parseVariant>;
160
- compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
161
- getUsedVariants(): ReturnType<typeof parseVariant>[];
162
- };
163
-
164
- type ArbitraryUtilityValue = {
165
- kind: 'arbitrary';
166
- /**
167
- * bg-[color:--my-color]
168
- * ^^^^^
169
- */
170
- dataType: string | null;
171
- /**
172
- * bg-[#0088cc]
173
- * ^^^^^^^
174
- * bg-[--my_variable]
175
- * var(^^^^^^^^^^^^^)
176
- */
177
- value: string;
178
- /**
179
- * bg-[--my_variable]
180
- * ^^^^^^^^^^^^^
181
- */
182
- dashedIdent: string | null;
183
- };
184
- type NamedUtilityValue = {
185
- kind: 'named';
186
- /**
187
- * bg-red-500
188
- * ^^^^^^^
189
- *
190
- * w-1/2
191
- * ^
192
- */
193
- value: string;
194
- /**
195
- * w-1/2
196
- * ^^^
197
- */
198
- fraction: string | null;
199
- };
200
- type ArbitraryModifier = {
201
- kind: 'arbitrary';
202
- /**
203
- * bg-red-500/[50%]
204
- * ^^^
205
- */
206
- value: string;
207
- /**
208
- * bg-red-500/[--my_variable]
209
- * ^^^^^^^^^^^^^
210
- */
211
- dashedIdent: string | null;
212
- };
213
- type NamedModifier = {
214
- kind: 'named';
215
- /**
216
- * bg-red-500/50
217
- * ^^
218
- */
219
- value: string;
220
- };
221
- type ArbitraryVariantValue = {
222
- kind: 'arbitrary';
223
- value: string;
224
- };
225
- type NamedVariantValue = {
226
- kind: 'named';
227
- value: string;
228
- };
229
- type Variant =
230
- /**
231
- * Arbitrary variants are variants that take a selector and generate a variant
232
- * on the fly.
233
- *
234
- * E.g.: `[&_p]`
235
- */
236
- {
237
- kind: 'arbitrary';
238
- selector: string;
239
- compounds: boolean;
240
- relative: boolean;
241
- }
242
- /**
243
- * Static variants are variants that don't take any arguments.
244
- *
245
- * E.g.: `hover`
246
- */
247
- | {
248
- kind: 'static';
249
- root: string;
250
- compounds: boolean;
251
- }
252
- /**
253
- * Functional variants are variants that can take an argument. The argument is
254
- * either a named variant value or an arbitrary variant value.
255
- *
256
- * E.g.:
257
- *
258
- * - `aria-disabled`
259
- * - `aria-[disabled]`
260
- * - `@container-size` -> @container, with named value `size`
261
- * - `@container-[inline-size]` -> @container, with arbitrary variant value `inline-size`
262
- * - `@container` -> @container, with no value
263
- */
264
- | {
265
- kind: 'functional';
266
- root: string;
267
- value: ArbitraryVariantValue | NamedVariantValue | null;
268
- modifier: ArbitraryModifier | NamedModifier | null;
269
- compounds: boolean;
270
- }
271
- /**
272
- * Compound variants are variants that take another variant as an argument.
273
- *
274
- * E.g.:
275
- *
276
- * - `has-[&_p]`
277
- * - `group-*`
278
- * - `peer-*`
279
- */
280
- | {
281
- kind: 'compound';
282
- root: string;
283
- modifier: ArbitraryModifier | NamedModifier | null;
284
- variant: Variant;
285
- compounds: boolean;
286
- };
287
- type Candidate =
288
- /**
289
- * Arbitrary candidates are candidates that register utilities on the fly with
290
- * a property and a value.
291
- *
292
- * E.g.:
293
- *
294
- * - `[color:red]`
295
- * - `[color:red]/50`
296
- * - `[color:red]/50!`
297
- */
298
- {
299
- kind: 'arbitrary';
300
- property: string;
301
- value: string;
302
- modifier: ArbitraryModifier | NamedModifier | null;
303
- variants: Variant[];
304
- important: boolean;
305
- raw: string;
306
- }
307
- /**
308
- * Static candidates are candidates that don't take any arguments.
309
- *
310
- * E.g.:
311
- *
312
- * - `underline`
313
- * - `flex`
314
- */
315
- | {
316
- kind: 'static';
317
- root: string;
318
- variants: Variant[];
319
- negative: boolean;
320
- important: boolean;
321
- raw: string;
322
- }
323
- /**
324
- * Functional candidates are candidates that can take an argument.
325
- *
326
- * E.g.:
327
- *
328
- * - `bg-red-500`
329
- * - `bg-[#0088cc]`
330
- * - `w-1/2`
331
- */
332
- | {
333
- kind: 'functional';
334
- root: string;
335
- value: ArbitraryUtilityValue | NamedUtilityValue | null;
336
- modifier: ArbitraryModifier | NamedModifier | null;
337
- variants: Variant[];
338
- negative: boolean;
339
- important: boolean;
340
- raw: string;
341
- };
342
- declare function parseVariant(variant: string, designSystem: DesignSystem): Variant | null;
343
-
344
- interface PluginUtils {
345
- theme(keypath: string, defaultValue?: any): any;
346
- }
347
-
348
- type PluginFn = (api: PluginAPI) => void;
349
- type PluginWithConfig = {
350
- handler: PluginFn;
351
- config?: UserConfig;
352
- };
353
- type PluginWithOptions<T> = {
354
- (options?: T): PluginWithConfig;
355
- __isOptionsFunction: true;
356
- };
357
- type Plugin = PluginFn | PluginWithConfig | PluginWithOptions<any>;
358
- type PluginAPI = {
359
- addBase(base: CssInJs): void;
360
- addVariant(name: string, variant: string | string[] | CssInJs): void;
361
- addUtilities(utilities: Record<string, CssInJs | CssInJs[]> | Record<string, CssInJs | CssInJs[]>[], options?: {}): void;
362
- matchUtilities(utilities: Record<string, (value: string, extra: {
363
- modifier: string | null;
364
- }) => CssInJs | CssInJs[]>, options?: Partial<{
365
- type: string | string[];
366
- supportsNegativeValues: boolean;
367
- values: Record<string, string> & {
368
- __BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
369
- };
370
- modifiers: 'any' | Record<string, string>;
371
- }>): void;
372
- addComponents(utilities: Record<string, CssInJs> | Record<string, CssInJs>[], options?: {}): void;
373
- matchComponents(utilities: Record<string, (value: string, extra: {
374
- modifier: string | null;
375
- }) => CssInJs>, options?: Partial<{
376
- type: string | string[];
377
- supportsNegativeValues: boolean;
378
- values: Record<string, string> & {
379
- __BARE_VALUE__?: (value: NamedUtilityValue) => string | undefined;
380
- };
381
- modifiers: 'any' | Record<string, string>;
382
- }>): void;
383
- theme(path: string, defaultValue?: any): any;
384
- config(path: string, defaultValue?: any): any;
385
- prefix(className: string): string;
386
- };
387
- type CssInJs = {
388
- [key: string]: string | string[] | CssInJs | CssInJs[];
389
- };
390
-
391
- type ResolvableTo<T> = T | ((utils: PluginUtils) => T);
392
- type ThemeValue = ResolvableTo<Record<string, unknown>> | null | undefined;
393
- type ThemeConfig = Record<string, ThemeValue> & {
394
- extend?: Record<string, ThemeValue>;
395
- };
396
- type ContentFile = string | {
397
- raw: string;
398
- extension?: string;
399
- };
400
- type DarkModeStrategy = false | 'media' | 'class' | ['class', string] | 'selector' | ['selector', string] | ['variant', string | string[]];
401
- interface UserConfig {
402
- presets?: UserConfig[];
403
- theme?: ThemeConfig;
404
- plugins?: Plugin[];
405
- }
406
- interface UserConfig {
407
- content?: ContentFile[] | {
408
- files: ContentFile[];
409
- };
410
- }
411
- interface UserConfig {
412
- darkMode?: DarkModeStrategy;
413
- }
414
-
415
- type CompileOptions = {
416
- loadPlugin?: (path: string) => Promise<Plugin>;
417
- loadConfig?: (path: string) => Promise<UserConfig>;
418
- };
419
- declare function compile(css: string, opts?: CompileOptions): Promise<{
420
- globs: {
421
- origin?: string;
422
- pattern: string;
423
- }[];
424
- build(candidates: string[]): string;
425
- }>;
426
- declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
427
-
428
- export { __unstable__loadDesignSystem, compile };
3
+ export { postcssPluginWarning as default };