tailwindcss 4.1.4 → 4.1.14

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[];
@@ -164,6 +168,10 @@ declare class Utilities {
164
168
  keys(kind: 'static' | 'functional'): string[];
165
169
  }
166
170
 
171
+ declare const enum CompileAstFlags {
172
+ None = 0,
173
+ RespectImportant = 1
174
+ }
167
175
  type DesignSystem = {
168
176
  theme: Theme;
169
177
  utilities: Utilities;
@@ -175,7 +183,9 @@ type DesignSystem = {
175
183
  getVariants(): VariantEntry[];
176
184
  parseCandidate(candidate: string): Readonly<Candidate>[];
177
185
  parseVariant(variant: string): Readonly<Variant> | null;
178
- compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
186
+ compileAstNodes(candidate: Candidate, flags?: CompileAstFlags): ReturnType<typeof compileAstNodes>;
187
+ printCandidate(candidate: Candidate): string;
188
+ printVariant(variant: Variant): string;
179
189
  getVariantOrder(): Map<Variant, number>;
180
190
  resolveThemeValue(path: string, forceInline?: boolean): string | undefined;
181
191
  trackUsedVariables(raw: string): void;
@@ -186,35 +196,98 @@ type StyleRule = {
186
196
  kind: 'rule';
187
197
  selector: string;
188
198
  nodes: AstNode[];
199
+ src?: SourceLocation;
200
+ dst?: SourceLocation;
189
201
  };
190
202
  type AtRule = {
191
203
  kind: 'at-rule';
192
204
  name: string;
193
205
  params: string;
194
206
  nodes: AstNode[];
207
+ src?: SourceLocation;
208
+ dst?: SourceLocation;
195
209
  };
196
210
  type Declaration = {
197
211
  kind: 'declaration';
198
212
  property: string;
199
213
  value: string | undefined;
200
214
  important: boolean;
215
+ src?: SourceLocation;
216
+ dst?: SourceLocation;
201
217
  };
202
218
  type Comment = {
203
219
  kind: 'comment';
204
220
  value: string;
221
+ src?: SourceLocation;
222
+ dst?: SourceLocation;
205
223
  };
206
224
  type Context = {
207
225
  kind: 'context';
208
226
  context: Record<string, string | boolean>;
209
227
  nodes: AstNode[];
228
+ src?: undefined;
229
+ dst?: undefined;
210
230
  };
211
231
  type AtRoot = {
212
232
  kind: 'at-root';
213
233
  nodes: AstNode[];
234
+ src?: undefined;
235
+ dst?: undefined;
214
236
  };
215
237
  type Rule = StyleRule | AtRule;
216
238
  type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot;
217
239
 
240
+ /**
241
+ * Line offset tables are the key to generating our source maps. They allow us
242
+ * to store indexes with our AST nodes and later convert them into positions as
243
+ * when given the source that the indexes refer to.
244
+ */
245
+ /**
246
+ * A position in source code
247
+ *
248
+ * https://tc39.es/ecma426/#sec-position-record-type
249
+ */
250
+ interface Position {
251
+ /** The line number, one-based */
252
+ line: number;
253
+ /** The column/character number, one-based */
254
+ column: number;
255
+ }
256
+
257
+ interface OriginalPosition extends Position {
258
+ source: DecodedSource;
259
+ }
260
+ /**
261
+ * A "decoded" sourcemap
262
+ *
263
+ * @see https://tc39.es/ecma426/#decoded-source-map-record
264
+ */
265
+ interface DecodedSourceMap {
266
+ file: string | null;
267
+ sources: DecodedSource[];
268
+ mappings: DecodedMapping[];
269
+ }
270
+ /**
271
+ * A "decoded" source
272
+ *
273
+ * @see https://tc39.es/ecma426/#decoded-source-record
274
+ */
275
+ interface DecodedSource {
276
+ url: string | null;
277
+ content: string | null;
278
+ ignore: boolean;
279
+ }
280
+ /**
281
+ * A "decoded" mapping
282
+ *
283
+ * @see https://tc39.es/ecma426/#decoded-mapping-record
284
+ */
285
+ interface DecodedMapping {
286
+ originalPosition: OriginalPosition | null;
287
+ generatedPosition: Position;
288
+ name: string | null;
289
+ }
290
+
218
291
  type Config = UserConfig;
219
292
  declare const enum Polyfills {
220
293
  None = 0,
@@ -224,14 +297,17 @@ declare const enum Polyfills {
224
297
  }
225
298
  type CompileOptions = {
226
299
  base?: string;
300
+ from?: string;
227
301
  polyfills?: Polyfills;
228
302
  loadModule?: (id: string, base: string, resourceHint: 'plugin' | 'config') => Promise<{
229
- module: Plugin | Config;
303
+ path: string;
230
304
  base: string;
305
+ module: Plugin | Config;
231
306
  }>;
232
307
  loadStylesheet?: (id: string, base: string) => Promise<{
233
- content: string;
308
+ path: string;
234
309
  base: string;
310
+ content: string;
235
311
  }>;
236
312
  };
237
313
  type Root = null | 'none' | {
@@ -245,7 +321,8 @@ declare const enum Features {
245
321
  JsPluginCompat = 4,
246
322
  ThemeFunction = 8,
247
323
  Utilities = 16,
248
- Variants = 32
324
+ Variants = 32,
325
+ AtTheme = 64
249
326
  }
250
327
  declare function compileAst(input: AstNode[], opts?: CompileOptions): Promise<{
251
328
  sources: {
@@ -257,6 +334,7 @@ declare function compileAst(input: AstNode[], opts?: CompileOptions): Promise<{
257
334
  features: Features;
258
335
  build(candidates: string[]): AstNode[];
259
336
  }>;
337
+
260
338
  declare function compile(css: string, opts?: CompileOptions): Promise<{
261
339
  sources: {
262
340
  base: string;
@@ -266,8 +344,9 @@ declare function compile(css: string, opts?: CompileOptions): Promise<{
266
344
  root: Root;
267
345
  features: Features;
268
346
  build(candidates: string[]): string;
347
+ buildSourceMap(): DecodedSourceMap;
269
348
  }>;
270
349
  declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
271
350
  declare function postcssPluginWarning(): void;
272
351
 
273
- export { type Config, Features, Polyfills, __unstable__loadDesignSystem, compile, compileAst, postcssPluginWarning as default };
352
+ export { type Config, type DecodedSourceMap, Features, Polyfills, __unstable__loadDesignSystem, compile, compileAst, postcssPluginWarning as default };