tailwindcss 4.0.0-alpha.17 → 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
@@ -191,6 +191,9 @@ type Comment = {
191
191
  value: string;
192
192
  };
193
193
  type AstNode = Rule | Declaration | Comment;
194
+ type CssInJs = {
195
+ [key: string]: string | CssInJs;
196
+ };
194
197
 
195
198
  declare class Theme {
196
199
  #private;
@@ -198,13 +201,18 @@ declare class Theme {
198
201
  constructor(values?: Map<string, {
199
202
  value: string;
200
203
  isReference: boolean;
204
+ isInline: boolean;
201
205
  }>);
202
- 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;
203
210
  keysInNamespaces(themeKeys: ThemeKey[]): string[];
204
211
  get(themeKeys: (ThemeKey | `${ThemeKey}-${string}`)[]): string | null;
205
212
  entries(): IterableIterator<[string, {
206
213
  value: string;
207
214
  isReference: boolean;
215
+ isInline: boolean;
208
216
  }]>;
209
217
  resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
210
218
  resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
@@ -235,6 +243,7 @@ declare class Variants {
235
243
  static(name: string, applyFn: VariantFn<'static'>, { compounds }?: {
236
244
  compounds?: boolean;
237
245
  }): void;
246
+ fromAst(name: string, ast: AstNode[]): void;
238
247
  functional(name: string, applyFn: VariantFn<'functional'>, { compounds }?: {
239
248
  compounds?: boolean;
240
249
  }): void;
@@ -249,7 +258,7 @@ declare class Variants {
249
258
  applyFn: VariantFn<any>;
250
259
  compounds: boolean;
251
260
  } | undefined;
252
- kind(name: string): "arbitrary" | "static" | "functional" | "compound";
261
+ kind(name: string): "static" | "arbitrary" | "functional" | "compound";
253
262
  compounds(name: string): boolean;
254
263
  suggest(name: string, suggestions: () => string[]): void;
255
264
  getCompletions(name: string): string[];
@@ -288,7 +297,7 @@ interface VariantEntry {
288
297
 
289
298
  type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
290
299
  kind: T;
291
- }>) => AstNode[] | undefined;
300
+ }>) => AstNode[] | undefined | null;
292
301
  interface SuggestionGroup {
293
302
  supportsNegative?: boolean;
294
303
  values: (string | null)[];
@@ -299,22 +308,14 @@ declare class Utilities {
299
308
  private completions;
300
309
  static(name: string, compileFn: CompileFn<'static'>): void;
301
310
  functional(name: string, compileFn: CompileFn<'functional'>): void;
302
- arbitrary(compileFn: CompileFn<'arbitrary'>): void;
303
- has(name: string): boolean;
304
- get(name: string | symbol): {
305
- kind: Candidate["kind"];
311
+ has(name: string, kind: 'static' | 'functional'): boolean;
312
+ get(name: string): {
313
+ kind: "static" | "functional";
306
314
  compileFn: CompileFn<any>;
307
- } | undefined;
308
- kind(name: string): "arbitrary" | "static" | "functional";
315
+ }[];
309
316
  getCompletions(name: string): SuggestionGroup[];
310
317
  suggest(name: string, groups: () => SuggestionGroup[]): void;
311
- keys(): IterableIterator<string | symbol>;
312
- entries(): IterableIterator<[string | symbol, {
313
- kind: Candidate["kind"];
314
- compileFn: CompileFn<any>;
315
- }]>;
316
- getArbitrary(): CompileFn<any>;
317
- private set;
318
+ keys(kind: 'static' | 'functional'): string[];
318
319
  }
319
320
 
320
321
  type DesignSystem = {
@@ -331,9 +332,27 @@ type DesignSystem = {
331
332
  getUsedVariants(): ReturnType<typeof parseVariant>[];
332
333
  };
333
334
 
334
- declare function compile(css: string): {
335
- build(candidates: string[]): string;
335
+ type PluginAPI = {
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;
336
346
  };
337
- declare function __unstable__loadDesignSystem(css: string): DesignSystem;
347
+
348
+ type Plugin = (api: PluginAPI) => void;
349
+ type CompileOptions = {
350
+ loadPlugin?: (path: string) => Promise<Plugin>;
351
+ };
352
+ declare function compile(css: string, opts?: CompileOptions): Promise<{
353
+ globs: string[];
354
+ build(candidates: string[]): string;
355
+ }>;
356
+ declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
338
357
 
339
358
  export { __unstable__loadDesignSystem, compile };
package/dist/lib.d.ts CHANGED
@@ -191,6 +191,9 @@ type Comment = {
191
191
  value: string;
192
192
  };
193
193
  type AstNode = Rule | Declaration | Comment;
194
+ type CssInJs = {
195
+ [key: string]: string | CssInJs;
196
+ };
194
197
 
195
198
  declare class Theme {
196
199
  #private;
@@ -198,13 +201,18 @@ declare class Theme {
198
201
  constructor(values?: Map<string, {
199
202
  value: string;
200
203
  isReference: boolean;
204
+ isInline: boolean;
201
205
  }>);
202
- 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;
203
210
  keysInNamespaces(themeKeys: ThemeKey[]): string[];
204
211
  get(themeKeys: (ThemeKey | `${ThemeKey}-${string}`)[]): string | null;
205
212
  entries(): IterableIterator<[string, {
206
213
  value: string;
207
214
  isReference: boolean;
215
+ isInline: boolean;
208
216
  }]>;
209
217
  resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
210
218
  resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
@@ -235,6 +243,7 @@ declare class Variants {
235
243
  static(name: string, applyFn: VariantFn<'static'>, { compounds }?: {
236
244
  compounds?: boolean;
237
245
  }): void;
246
+ fromAst(name: string, ast: AstNode[]): void;
238
247
  functional(name: string, applyFn: VariantFn<'functional'>, { compounds }?: {
239
248
  compounds?: boolean;
240
249
  }): void;
@@ -249,7 +258,7 @@ declare class Variants {
249
258
  applyFn: VariantFn<any>;
250
259
  compounds: boolean;
251
260
  } | undefined;
252
- kind(name: string): "arbitrary" | "static" | "functional" | "compound";
261
+ kind(name: string): "static" | "arbitrary" | "functional" | "compound";
253
262
  compounds(name: string): boolean;
254
263
  suggest(name: string, suggestions: () => string[]): void;
255
264
  getCompletions(name: string): string[];
@@ -288,7 +297,7 @@ interface VariantEntry {
288
297
 
289
298
  type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
290
299
  kind: T;
291
- }>) => AstNode[] | undefined;
300
+ }>) => AstNode[] | undefined | null;
292
301
  interface SuggestionGroup {
293
302
  supportsNegative?: boolean;
294
303
  values: (string | null)[];
@@ -299,22 +308,14 @@ declare class Utilities {
299
308
  private completions;
300
309
  static(name: string, compileFn: CompileFn<'static'>): void;
301
310
  functional(name: string, compileFn: CompileFn<'functional'>): void;
302
- arbitrary(compileFn: CompileFn<'arbitrary'>): void;
303
- has(name: string): boolean;
304
- get(name: string | symbol): {
305
- kind: Candidate["kind"];
311
+ has(name: string, kind: 'static' | 'functional'): boolean;
312
+ get(name: string): {
313
+ kind: "static" | "functional";
306
314
  compileFn: CompileFn<any>;
307
- } | undefined;
308
- kind(name: string): "arbitrary" | "static" | "functional";
315
+ }[];
309
316
  getCompletions(name: string): SuggestionGroup[];
310
317
  suggest(name: string, groups: () => SuggestionGroup[]): void;
311
- keys(): IterableIterator<string | symbol>;
312
- entries(): IterableIterator<[string | symbol, {
313
- kind: Candidate["kind"];
314
- compileFn: CompileFn<any>;
315
- }]>;
316
- getArbitrary(): CompileFn<any>;
317
- private set;
318
+ keys(kind: 'static' | 'functional'): string[];
318
319
  }
319
320
 
320
321
  type DesignSystem = {
@@ -331,9 +332,27 @@ type DesignSystem = {
331
332
  getUsedVariants(): ReturnType<typeof parseVariant>[];
332
333
  };
333
334
 
334
- declare function compile(css: string): {
335
- build(candidates: string[]): string;
335
+ type PluginAPI = {
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;
336
346
  };
337
- declare function __unstable__loadDesignSystem(css: string): DesignSystem;
347
+
348
+ type Plugin = (api: PluginAPI) => void;
349
+ type CompileOptions = {
350
+ loadPlugin?: (path: string) => Promise<Plugin>;
351
+ };
352
+ declare function compile(css: string, opts?: CompileOptions): Promise<{
353
+ globs: string[];
354
+ build(candidates: string[]): string;
355
+ }>;
356
+ declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
338
357
 
339
358
  export { __unstable__loadDesignSystem, compile };