tailwindcss 4.0.0-alpha.18 → 4.0.0-alpha.19

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.mts CHANGED
@@ -1,23 +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;
10
- important: boolean;
11
- };
12
- type Comment = {
13
- kind: 'comment';
14
- value: string;
15
- };
16
- type AstNode = Rule | Declaration | Comment;
17
- type CssInJs = {
18
- [key: string]: string | CssInJs;
19
- };
20
-
21
1
  type ArbitraryUtilityValue = {
22
2
  kind: 'arbitrary';
23
3
  /**
@@ -195,19 +175,44 @@ type Candidate =
195
175
  declare function parseCandidate(input: string, designSystem: DesignSystem): Candidate | null;
196
176
  declare function parseVariant(variant: string, designSystem: DesignSystem): Variant | null;
197
177
 
178
+ type Rule = {
179
+ kind: 'rule';
180
+ selector: string;
181
+ nodes: AstNode[];
182
+ };
183
+ type Declaration = {
184
+ kind: 'declaration';
185
+ property: string;
186
+ value: string;
187
+ important: boolean;
188
+ };
189
+ type Comment = {
190
+ kind: 'comment';
191
+ value: string;
192
+ };
193
+ type AstNode = Rule | Declaration | Comment;
194
+ type CssInJs = {
195
+ [key: string]: string | CssInJs;
196
+ };
197
+
198
198
  declare class Theme {
199
199
  #private;
200
200
  private values;
201
201
  constructor(values?: Map<string, {
202
202
  value: string;
203
203
  isReference: boolean;
204
+ isInline: boolean;
204
205
  }>);
205
- add(key: string, value: string, isReference?: boolean): void;
206
+ add(key: string, value: string, { isReference, isInline }?: {
207
+ isReference?: boolean | undefined;
208
+ isInline?: boolean | undefined;
209
+ }): void;
206
210
  keysInNamespaces(themeKeys: ThemeKey[]): string[];
207
211
  get(themeKeys: (ThemeKey | `${ThemeKey}-${string}`)[]): string | null;
208
212
  entries(): IterableIterator<[string, {
209
213
  value: string;
210
214
  isReference: boolean;
215
+ isInline: boolean;
211
216
  }]>;
212
217
  resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
213
218
  resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
@@ -248,7 +253,7 @@ declare class Variants {
248
253
  group(fn: () => void, compareFn?: CompareFn): void;
249
254
  has(name: string): boolean;
250
255
  get(name: string): {
251
- kind: "static" | "arbitrary" | "functional" | "compound";
256
+ kind: Variant["kind"];
252
257
  order: number;
253
258
  applyFn: VariantFn<any>;
254
259
  compounds: boolean;
@@ -260,7 +265,7 @@ declare class Variants {
260
265
  compare(a: Variant | null, z: Variant | null): number;
261
266
  keys(): IterableIterator<string>;
262
267
  entries(): IterableIterator<[string, {
263
- kind: "static" | "arbitrary" | "functional" | "compound";
268
+ kind: Variant["kind"];
264
269
  order: number;
265
270
  applyFn: VariantFn<any>;
266
271
  compounds: boolean;
@@ -292,19 +297,17 @@ interface VariantEntry {
292
297
 
293
298
  type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
294
299
  kind: T;
295
- }>) => AstNode[] | undefined;
300
+ }>) => AstNode[] | undefined | null;
296
301
  interface SuggestionGroup {
297
302
  supportsNegative?: boolean;
298
303
  values: (string | null)[];
299
304
  modifiers: string[];
300
305
  }
301
306
  declare class Utilities {
302
- private arbitraryFn;
303
307
  private utilities;
304
308
  private completions;
305
309
  static(name: string, compileFn: CompileFn<'static'>): void;
306
310
  functional(name: string, compileFn: CompileFn<'functional'>): void;
307
- arbitrary(compileFn: CompileFn<'arbitrary'>): void;
308
311
  has(name: string, kind: 'static' | 'functional'): boolean;
309
312
  get(name: string): {
310
313
  kind: "static" | "functional";
@@ -313,7 +316,6 @@ declare class Utilities {
313
316
  getCompletions(name: string): SuggestionGroup[];
314
317
  suggest(name: string, groups: () => SuggestionGroup[]): void;
315
318
  keys(kind: 'static' | 'functional'): string[];
316
- getArbitrary(): CompileFn<"arbitrary">;
317
319
  }
318
320
 
319
321
  type DesignSystem = {
@@ -332,14 +334,25 @@ type DesignSystem = {
332
334
 
333
335
  type PluginAPI = {
334
336
  addVariant(name: string, variant: string | string[] | CssInJs): void;
337
+ addUtilities(utilities: Record<string, CssInJs>, options?: {}): void;
338
+ matchUtilities(utilities: Record<string, (value: string, extra: {
339
+ modifier: string | null;
340
+ }) => CssInJs>, options?: Partial<{
341
+ type: string | string[];
342
+ supportsNegativeValues: boolean;
343
+ values: Record<string, string>;
344
+ modifiers: 'any' | Record<string, string>;
345
+ }>): void;
335
346
  };
347
+
336
348
  type Plugin = (api: PluginAPI) => void;
337
349
  type CompileOptions = {
338
- loadPlugin?: (path: string) => Plugin;
350
+ loadPlugin?: (path: string) => Promise<Plugin>;
339
351
  };
340
- declare function compile(css: string, { loadPlugin }?: CompileOptions): {
352
+ declare function compile(css: string, opts?: CompileOptions): Promise<{
353
+ globs: string[];
341
354
  build(candidates: string[]): string;
342
- };
343
- declare function __unstable__loadDesignSystem(css: string): DesignSystem;
355
+ }>;
356
+ declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
344
357
 
345
358
  export { __unstable__loadDesignSystem, compile };
package/dist/lib.d.ts CHANGED
@@ -1,23 +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;
10
- important: boolean;
11
- };
12
- type Comment = {
13
- kind: 'comment';
14
- value: string;
15
- };
16
- type AstNode = Rule | Declaration | Comment;
17
- type CssInJs = {
18
- [key: string]: string | CssInJs;
19
- };
20
-
21
1
  type ArbitraryUtilityValue = {
22
2
  kind: 'arbitrary';
23
3
  /**
@@ -195,19 +175,44 @@ type Candidate =
195
175
  declare function parseCandidate(input: string, designSystem: DesignSystem): Candidate | null;
196
176
  declare function parseVariant(variant: string, designSystem: DesignSystem): Variant | null;
197
177
 
178
+ type Rule = {
179
+ kind: 'rule';
180
+ selector: string;
181
+ nodes: AstNode[];
182
+ };
183
+ type Declaration = {
184
+ kind: 'declaration';
185
+ property: string;
186
+ value: string;
187
+ important: boolean;
188
+ };
189
+ type Comment = {
190
+ kind: 'comment';
191
+ value: string;
192
+ };
193
+ type AstNode = Rule | Declaration | Comment;
194
+ type CssInJs = {
195
+ [key: string]: string | CssInJs;
196
+ };
197
+
198
198
  declare class Theme {
199
199
  #private;
200
200
  private values;
201
201
  constructor(values?: Map<string, {
202
202
  value: string;
203
203
  isReference: boolean;
204
+ isInline: boolean;
204
205
  }>);
205
- add(key: string, value: string, isReference?: boolean): void;
206
+ add(key: string, value: string, { isReference, isInline }?: {
207
+ isReference?: boolean | undefined;
208
+ isInline?: boolean | undefined;
209
+ }): void;
206
210
  keysInNamespaces(themeKeys: ThemeKey[]): string[];
207
211
  get(themeKeys: (ThemeKey | `${ThemeKey}-${string}`)[]): string | null;
208
212
  entries(): IterableIterator<[string, {
209
213
  value: string;
210
214
  isReference: boolean;
215
+ isInline: boolean;
211
216
  }]>;
212
217
  resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
213
218
  resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
@@ -248,7 +253,7 @@ declare class Variants {
248
253
  group(fn: () => void, compareFn?: CompareFn): void;
249
254
  has(name: string): boolean;
250
255
  get(name: string): {
251
- kind: "static" | "arbitrary" | "functional" | "compound";
256
+ kind: Variant["kind"];
252
257
  order: number;
253
258
  applyFn: VariantFn<any>;
254
259
  compounds: boolean;
@@ -260,7 +265,7 @@ declare class Variants {
260
265
  compare(a: Variant | null, z: Variant | null): number;
261
266
  keys(): IterableIterator<string>;
262
267
  entries(): IterableIterator<[string, {
263
- kind: "static" | "arbitrary" | "functional" | "compound";
268
+ kind: Variant["kind"];
264
269
  order: number;
265
270
  applyFn: VariantFn<any>;
266
271
  compounds: boolean;
@@ -292,19 +297,17 @@ interface VariantEntry {
292
297
 
293
298
  type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
294
299
  kind: T;
295
- }>) => AstNode[] | undefined;
300
+ }>) => AstNode[] | undefined | null;
296
301
  interface SuggestionGroup {
297
302
  supportsNegative?: boolean;
298
303
  values: (string | null)[];
299
304
  modifiers: string[];
300
305
  }
301
306
  declare class Utilities {
302
- private arbitraryFn;
303
307
  private utilities;
304
308
  private completions;
305
309
  static(name: string, compileFn: CompileFn<'static'>): void;
306
310
  functional(name: string, compileFn: CompileFn<'functional'>): void;
307
- arbitrary(compileFn: CompileFn<'arbitrary'>): void;
308
311
  has(name: string, kind: 'static' | 'functional'): boolean;
309
312
  get(name: string): {
310
313
  kind: "static" | "functional";
@@ -313,7 +316,6 @@ declare class Utilities {
313
316
  getCompletions(name: string): SuggestionGroup[];
314
317
  suggest(name: string, groups: () => SuggestionGroup[]): void;
315
318
  keys(kind: 'static' | 'functional'): string[];
316
- getArbitrary(): CompileFn<"arbitrary">;
317
319
  }
318
320
 
319
321
  type DesignSystem = {
@@ -332,14 +334,25 @@ type DesignSystem = {
332
334
 
333
335
  type PluginAPI = {
334
336
  addVariant(name: string, variant: string | string[] | CssInJs): void;
337
+ addUtilities(utilities: Record<string, CssInJs>, options?: {}): void;
338
+ matchUtilities(utilities: Record<string, (value: string, extra: {
339
+ modifier: string | null;
340
+ }) => CssInJs>, options?: Partial<{
341
+ type: string | string[];
342
+ supportsNegativeValues: boolean;
343
+ values: Record<string, string>;
344
+ modifiers: 'any' | Record<string, string>;
345
+ }>): void;
335
346
  };
347
+
336
348
  type Plugin = (api: PluginAPI) => void;
337
349
  type CompileOptions = {
338
- loadPlugin?: (path: string) => Plugin;
350
+ loadPlugin?: (path: string) => Promise<Plugin>;
339
351
  };
340
- declare function compile(css: string, { loadPlugin }?: CompileOptions): {
352
+ declare function compile(css: string, opts?: CompileOptions): Promise<{
353
+ globs: string[];
341
354
  build(candidates: string[]): string;
342
- };
343
- declare function __unstable__loadDesignSystem(css: string): DesignSystem;
355
+ }>;
356
+ declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
344
357
 
345
358
  export { __unstable__loadDesignSystem, compile };