tailwindcss 4.1.4 → 4.1.16

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,4 +1,4 @@
1
- import { U as UserConfig, P as Plugin } from './types-B254mqw1.mjs';
1
+ import { S as SourceLocation, U as UserConfig, P as Plugin } from './types-WlZgYgM8.mjs';
2
2
  import { V as Variant, C as Candidate } from './resolve-config-QUZ9b-Gn.mjs';
3
3
  import './colors.mjs';
4
4
 
@@ -18,8 +18,10 @@ declare class Theme {
18
18
  constructor(values?: Map<string, {
19
19
  value: string;
20
20
  options: ThemeOptions;
21
+ src: Declaration["src"];
21
22
  }>, keyframes?: Set<AtRule>);
22
- add(key: string, value: string, options?: ThemeOptions): void;
23
+ get size(): number;
24
+ add(key: string, value: string, options?: ThemeOptions, src?: Declaration['src']): void;
23
25
  keysInNamespaces(themeKeys: Iterable<ThemeKey>): string[];
24
26
  get(themeKeys: ThemeKey[]): string | null;
25
27
  hasDefault(key: string): boolean;
@@ -27,9 +29,11 @@ declare class Theme {
27
29
  entries(): IterableIterator<[string, {
28
30
  value: string;
29
31
  options: ThemeOptions;
32
+ src: Declaration["src"];
30
33
  }]> | [string, {
31
34
  value: string;
32
35
  options: ThemeOptions;
36
+ src: Declaration["src"];
33
37
  }][];
34
38
  prefixKey(key: string): string;
35
39
  clearNamespace(namespace: string, clearOptions: ThemeOptions): void;
@@ -77,7 +81,7 @@ declare class Variants {
77
81
  compounds?: Compounds;
78
82
  order?: number;
79
83
  }): void;
80
- fromAst(name: string, ast: AstNode[]): void;
84
+ fromAst(name: string, ast: AstNode[], designSystem: DesignSystem): void;
81
85
  functional(name: string, applyFn: VariantFn<'functional'>, { compounds, order }?: {
82
86
  compounds?: Compounds;
83
87
  order?: number;
@@ -95,7 +99,7 @@ declare class Variants {
95
99
  compoundsWith: Compounds;
96
100
  compounds: Compounds;
97
101
  } | undefined;
98
- kind(name: string): "static" | "arbitrary" | "functional" | "compound";
102
+ kind(name: string): "arbitrary" | "static" | "functional" | "compound";
99
103
  compoundsWith(parent: string, child: string | Variant): boolean;
100
104
  suggest(name: string, suggestions: () => string[]): void;
101
105
  getCompletions(name: string): string[];
@@ -112,7 +116,7 @@ declare class Variants {
112
116
  private nextOrder;
113
117
  }
114
118
 
115
- declare function compileAstNodes(candidate: Candidate, designSystem: DesignSystem): {
119
+ declare function compileAstNodes(candidate: Candidate, designSystem: DesignSystem, flags: CompileAstFlags): {
116
120
  node: AstNode;
117
121
  propertySort: {
118
122
  order: number[];
@@ -120,6 +124,29 @@ declare function compileAstNodes(candidate: Candidate, designSystem: DesignSyste
120
124
  };
121
125
  }[];
122
126
 
127
+ interface CanonicalizeOptions {
128
+ /**
129
+ * The root font size in pixels. If provided, `rem` values will be normalized
130
+ * to `px` values.
131
+ *
132
+ * E.g.: `mt-[16px]` with `rem: 16` will become `mt-4` (assuming `--spacing: 0.25rem`).
133
+ */
134
+ rem?: number;
135
+ /**
136
+ * Whether to collapse multiple utilities into a single utility if possible.
137
+ *
138
+ * E.g.: `mt-2 mr-2 mb-2 ml-2` → `m-2`
139
+ */
140
+ collapse?: boolean;
141
+ /**
142
+ * Whether to convert between logical and physical properties when collapsing
143
+ * utilities.
144
+ *
145
+ * E.g.: `mr-2 ml-2` → `mx-2`
146
+ */
147
+ logicalToPhysical?: boolean;
148
+ }
149
+
123
150
  interface ClassMetadata {
124
151
  modifiers: string[];
125
152
  }
@@ -164,6 +191,10 @@ declare class Utilities {
164
191
  keys(kind: 'static' | 'functional'): string[];
165
192
  }
166
193
 
194
+ declare const enum CompileAstFlags {
195
+ None = 0,
196
+ RespectImportant = 1
197
+ }
167
198
  type DesignSystem = {
168
199
  theme: Theme;
169
200
  utilities: Utilities;
@@ -175,46 +206,113 @@ type DesignSystem = {
175
206
  getVariants(): VariantEntry[];
176
207
  parseCandidate(candidate: string): Readonly<Candidate>[];
177
208
  parseVariant(variant: string): Readonly<Variant> | null;
178
- compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
209
+ compileAstNodes(candidate: Candidate, flags?: CompileAstFlags): ReturnType<typeof compileAstNodes>;
210
+ printCandidate(candidate: Candidate): string;
211
+ printVariant(variant: Variant): string;
179
212
  getVariantOrder(): Map<Variant, number>;
180
213
  resolveThemeValue(path: string, forceInline?: boolean): string | undefined;
181
214
  trackUsedVariables(raw: string): void;
215
+ canonicalizeCandidates(candidates: string[], options?: CanonicalizeOptions): string[];
182
216
  candidatesToCss(classes: string[]): (string | null)[];
217
+ storage: Record<symbol, unknown>;
183
218
  };
184
219
 
185
220
  type StyleRule = {
186
221
  kind: 'rule';
187
222
  selector: string;
188
223
  nodes: AstNode[];
224
+ src?: SourceLocation;
225
+ dst?: SourceLocation;
189
226
  };
190
227
  type AtRule = {
191
228
  kind: 'at-rule';
192
229
  name: string;
193
230
  params: string;
194
231
  nodes: AstNode[];
232
+ src?: SourceLocation;
233
+ dst?: SourceLocation;
195
234
  };
196
235
  type Declaration = {
197
236
  kind: 'declaration';
198
237
  property: string;
199
238
  value: string | undefined;
200
239
  important: boolean;
240
+ src?: SourceLocation;
241
+ dst?: SourceLocation;
201
242
  };
202
243
  type Comment = {
203
244
  kind: 'comment';
204
245
  value: string;
246
+ src?: SourceLocation;
247
+ dst?: SourceLocation;
205
248
  };
206
249
  type Context = {
207
250
  kind: 'context';
208
251
  context: Record<string, string | boolean>;
209
252
  nodes: AstNode[];
253
+ src?: undefined;
254
+ dst?: undefined;
210
255
  };
211
256
  type AtRoot = {
212
257
  kind: 'at-root';
213
258
  nodes: AstNode[];
259
+ src?: undefined;
260
+ dst?: undefined;
214
261
  };
215
262
  type Rule = StyleRule | AtRule;
216
263
  type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot;
217
264
 
265
+ /**
266
+ * Line offset tables are the key to generating our source maps. They allow us
267
+ * to store indexes with our AST nodes and later convert them into positions as
268
+ * when given the source that the indexes refer to.
269
+ */
270
+ /**
271
+ * A position in source code
272
+ *
273
+ * https://tc39.es/ecma426/#sec-position-record-type
274
+ */
275
+ interface Position {
276
+ /** The line number, one-based */
277
+ line: number;
278
+ /** The column/character number, one-based */
279
+ column: number;
280
+ }
281
+
282
+ interface OriginalPosition extends Position {
283
+ source: DecodedSource;
284
+ }
285
+ /**
286
+ * A "decoded" sourcemap
287
+ *
288
+ * @see https://tc39.es/ecma426/#decoded-source-map-record
289
+ */
290
+ interface DecodedSourceMap {
291
+ file: string | null;
292
+ sources: DecodedSource[];
293
+ mappings: DecodedMapping[];
294
+ }
295
+ /**
296
+ * A "decoded" source
297
+ *
298
+ * @see https://tc39.es/ecma426/#decoded-source-record
299
+ */
300
+ interface DecodedSource {
301
+ url: string | null;
302
+ content: string | null;
303
+ ignore: boolean;
304
+ }
305
+ /**
306
+ * A "decoded" mapping
307
+ *
308
+ * @see https://tc39.es/ecma426/#decoded-mapping-record
309
+ */
310
+ interface DecodedMapping {
311
+ originalPosition: OriginalPosition | null;
312
+ generatedPosition: Position;
313
+ name: string | null;
314
+ }
315
+
218
316
  type Config = UserConfig;
219
317
  declare const enum Polyfills {
220
318
  None = 0,
@@ -224,14 +322,17 @@ declare const enum Polyfills {
224
322
  }
225
323
  type CompileOptions = {
226
324
  base?: string;
325
+ from?: string;
227
326
  polyfills?: Polyfills;
228
327
  loadModule?: (id: string, base: string, resourceHint: 'plugin' | 'config') => Promise<{
229
- module: Plugin | Config;
328
+ path: string;
230
329
  base: string;
330
+ module: Plugin | Config;
231
331
  }>;
232
332
  loadStylesheet?: (id: string, base: string) => Promise<{
233
- content: string;
333
+ path: string;
234
334
  base: string;
335
+ content: string;
235
336
  }>;
236
337
  };
237
338
  type Root = null | 'none' | {
@@ -245,7 +346,8 @@ declare const enum Features {
245
346
  JsPluginCompat = 4,
246
347
  ThemeFunction = 8,
247
348
  Utilities = 16,
248
- Variants = 32
349
+ Variants = 32,
350
+ AtTheme = 64
249
351
  }
250
352
  declare function compileAst(input: AstNode[], opts?: CompileOptions): Promise<{
251
353
  sources: {
@@ -257,6 +359,7 @@ declare function compileAst(input: AstNode[], opts?: CompileOptions): Promise<{
257
359
  features: Features;
258
360
  build(candidates: string[]): AstNode[];
259
361
  }>;
362
+
260
363
  declare function compile(css: string, opts?: CompileOptions): Promise<{
261
364
  sources: {
262
365
  base: string;
@@ -266,8 +369,9 @@ declare function compile(css: string, opts?: CompileOptions): Promise<{
266
369
  root: Root;
267
370
  features: Features;
268
371
  build(candidates: string[]): string;
372
+ buildSourceMap(): DecodedSourceMap;
269
373
  }>;
270
374
  declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
271
375
  declare function postcssPluginWarning(): void;
272
376
 
273
- export { type Config, Features, Polyfills, __unstable__loadDesignSystem, compile, compileAst, postcssPluginWarning as default };
377
+ export { type Config, type DecodedSourceMap, Features, Polyfills, __unstable__loadDesignSystem, compile, compileAst, postcssPluginWarning as default };