tailwindcss 4.0.0-alpha.16 → 4.0.0-alpha.18

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,3 +1,23 @@
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
+
1
21
  type ArbitraryUtilityValue = {
2
22
  kind: 'arbitrary';
3
23
  /**
@@ -175,23 +195,6 @@ type Candidate =
175
195
  declare function parseCandidate(input: string, designSystem: DesignSystem): Candidate | null;
176
196
  declare function parseVariant(variant: string, designSystem: DesignSystem): Variant | null;
177
197
 
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
-
195
198
  declare class Theme {
196
199
  #private;
197
200
  private values;
@@ -206,8 +209,8 @@ declare class Theme {
206
209
  value: string;
207
210
  isReference: boolean;
208
211
  }]>;
209
- resolve(candidateValue: string, themeKeys: ThemeKey[]): string | null;
210
- resolveValue(candidateValue: string, themeKeys: ThemeKey[]): string | null;
212
+ resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
213
+ resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
211
214
  resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
212
215
  namespace(namespace: string): Map<string | null, string>;
213
216
  }
@@ -235,6 +238,7 @@ declare class Variants {
235
238
  static(name: string, applyFn: VariantFn<'static'>, { compounds }?: {
236
239
  compounds?: boolean;
237
240
  }): void;
241
+ fromAst(name: string, ast: AstNode[]): void;
238
242
  functional(name: string, applyFn: VariantFn<'functional'>, { compounds }?: {
239
243
  compounds?: boolean;
240
244
  }): void;
@@ -244,19 +248,19 @@ declare class Variants {
244
248
  group(fn: () => void, compareFn?: CompareFn): void;
245
249
  has(name: string): boolean;
246
250
  get(name: string): {
247
- kind: "arbitrary" | "static" | "functional" | "compound";
251
+ kind: "static" | "arbitrary" | "functional" | "compound";
248
252
  order: number;
249
253
  applyFn: VariantFn<any>;
250
254
  compounds: boolean;
251
255
  } | undefined;
252
- kind(name: string): "arbitrary" | "static" | "functional" | "compound";
256
+ kind(name: string): "static" | "arbitrary" | "functional" | "compound";
253
257
  compounds(name: string): boolean;
254
258
  suggest(name: string, suggestions: () => string[]): void;
255
259
  getCompletions(name: string): string[];
256
260
  compare(a: Variant | null, z: Variant | null): number;
257
261
  keys(): IterableIterator<string>;
258
262
  entries(): IterableIterator<[string, {
259
- kind: "arbitrary" | "static" | "functional" | "compound";
263
+ kind: "static" | "arbitrary" | "functional" | "compound";
260
264
  order: number;
261
265
  applyFn: VariantFn<any>;
262
266
  compounds: boolean;
@@ -295,26 +299,21 @@ interface SuggestionGroup {
295
299
  modifiers: string[];
296
300
  }
297
301
  declare class Utilities {
302
+ private arbitraryFn;
298
303
  private utilities;
299
304
  private completions;
300
305
  static(name: string, compileFn: CompileFn<'static'>): void;
301
306
  functional(name: string, compileFn: CompileFn<'functional'>): void;
302
307
  arbitrary(compileFn: CompileFn<'arbitrary'>): void;
303
- has(name: string): boolean;
304
- get(name: string | symbol): {
305
- kind: "arbitrary" | "static" | "functional";
308
+ has(name: string, kind: 'static' | 'functional'): boolean;
309
+ get(name: string): {
310
+ kind: "static" | "functional";
306
311
  compileFn: CompileFn<any>;
307
- } | undefined;
308
- kind(name: string): "arbitrary" | "static" | "functional";
312
+ }[];
309
313
  getCompletions(name: string): SuggestionGroup[];
310
314
  suggest(name: string, groups: () => SuggestionGroup[]): void;
311
- keys(): IterableIterator<string | symbol>;
312
- entries(): IterableIterator<[string | symbol, {
313
- kind: "arbitrary" | "static" | "functional";
314
- compileFn: CompileFn<any>;
315
- }]>;
316
- getArbitrary(): CompileFn<any>;
317
- private set;
315
+ keys(kind: 'static' | 'functional'): string[];
316
+ getArbitrary(): CompileFn<"arbitrary">;
318
317
  }
319
318
 
320
319
  type DesignSystem = {
@@ -331,7 +330,14 @@ type DesignSystem = {
331
330
  getUsedVariants(): ReturnType<typeof parseVariant>[];
332
331
  };
333
332
 
334
- declare function compile(css: string): {
333
+ type PluginAPI = {
334
+ addVariant(name: string, variant: string | string[] | CssInJs): void;
335
+ };
336
+ type Plugin = (api: PluginAPI) => void;
337
+ type CompileOptions = {
338
+ loadPlugin?: (path: string) => Plugin;
339
+ };
340
+ declare function compile(css: string, { loadPlugin }?: CompileOptions): {
335
341
  build(candidates: string[]): string;
336
342
  };
337
343
  declare function __unstable__loadDesignSystem(css: string): DesignSystem;
package/dist/lib.d.ts CHANGED
@@ -1,3 +1,23 @@
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
+
1
21
  type ArbitraryUtilityValue = {
2
22
  kind: 'arbitrary';
3
23
  /**
@@ -175,23 +195,6 @@ type Candidate =
175
195
  declare function parseCandidate(input: string, designSystem: DesignSystem): Candidate | null;
176
196
  declare function parseVariant(variant: string, designSystem: DesignSystem): Variant | null;
177
197
 
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
-
195
198
  declare class Theme {
196
199
  #private;
197
200
  private values;
@@ -206,8 +209,8 @@ declare class Theme {
206
209
  value: string;
207
210
  isReference: boolean;
208
211
  }]>;
209
- resolve(candidateValue: string, themeKeys: ThemeKey[]): string | null;
210
- resolveValue(candidateValue: string, themeKeys: ThemeKey[]): string | null;
212
+ resolve(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
213
+ resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
211
214
  resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
212
215
  namespace(namespace: string): Map<string | null, string>;
213
216
  }
@@ -235,6 +238,7 @@ declare class Variants {
235
238
  static(name: string, applyFn: VariantFn<'static'>, { compounds }?: {
236
239
  compounds?: boolean;
237
240
  }): void;
241
+ fromAst(name: string, ast: AstNode[]): void;
238
242
  functional(name: string, applyFn: VariantFn<'functional'>, { compounds }?: {
239
243
  compounds?: boolean;
240
244
  }): void;
@@ -244,19 +248,19 @@ declare class Variants {
244
248
  group(fn: () => void, compareFn?: CompareFn): void;
245
249
  has(name: string): boolean;
246
250
  get(name: string): {
247
- kind: "arbitrary" | "static" | "functional" | "compound";
251
+ kind: "static" | "arbitrary" | "functional" | "compound";
248
252
  order: number;
249
253
  applyFn: VariantFn<any>;
250
254
  compounds: boolean;
251
255
  } | undefined;
252
- kind(name: string): "arbitrary" | "static" | "functional" | "compound";
256
+ kind(name: string): "static" | "arbitrary" | "functional" | "compound";
253
257
  compounds(name: string): boolean;
254
258
  suggest(name: string, suggestions: () => string[]): void;
255
259
  getCompletions(name: string): string[];
256
260
  compare(a: Variant | null, z: Variant | null): number;
257
261
  keys(): IterableIterator<string>;
258
262
  entries(): IterableIterator<[string, {
259
- kind: "arbitrary" | "static" | "functional" | "compound";
263
+ kind: "static" | "arbitrary" | "functional" | "compound";
260
264
  order: number;
261
265
  applyFn: VariantFn<any>;
262
266
  compounds: boolean;
@@ -295,26 +299,21 @@ interface SuggestionGroup {
295
299
  modifiers: string[];
296
300
  }
297
301
  declare class Utilities {
302
+ private arbitraryFn;
298
303
  private utilities;
299
304
  private completions;
300
305
  static(name: string, compileFn: CompileFn<'static'>): void;
301
306
  functional(name: string, compileFn: CompileFn<'functional'>): void;
302
307
  arbitrary(compileFn: CompileFn<'arbitrary'>): void;
303
- has(name: string): boolean;
304
- get(name: string | symbol): {
305
- kind: "arbitrary" | "static" | "functional";
308
+ has(name: string, kind: 'static' | 'functional'): boolean;
309
+ get(name: string): {
310
+ kind: "static" | "functional";
306
311
  compileFn: CompileFn<any>;
307
- } | undefined;
308
- kind(name: string): "arbitrary" | "static" | "functional";
312
+ }[];
309
313
  getCompletions(name: string): SuggestionGroup[];
310
314
  suggest(name: string, groups: () => SuggestionGroup[]): void;
311
- keys(): IterableIterator<string | symbol>;
312
- entries(): IterableIterator<[string | symbol, {
313
- kind: "arbitrary" | "static" | "functional";
314
- compileFn: CompileFn<any>;
315
- }]>;
316
- getArbitrary(): CompileFn<any>;
317
- private set;
315
+ keys(kind: 'static' | 'functional'): string[];
316
+ getArbitrary(): CompileFn<"arbitrary">;
318
317
  }
319
318
 
320
319
  type DesignSystem = {
@@ -331,7 +330,14 @@ type DesignSystem = {
331
330
  getUsedVariants(): ReturnType<typeof parseVariant>[];
332
331
  };
333
332
 
334
- declare function compile(css: string): {
333
+ type PluginAPI = {
334
+ addVariant(name: string, variant: string | string[] | CssInJs): void;
335
+ };
336
+ type Plugin = (api: PluginAPI) => void;
337
+ type CompileOptions = {
338
+ loadPlugin?: (path: string) => Plugin;
339
+ };
340
+ declare function compile(css: string, { loadPlugin }?: CompileOptions): {
335
341
  build(candidates: string[]): string;
336
342
  };
337
343
  declare function __unstable__loadDesignSystem(css: string): DesignSystem;