tailwindcss 0.0.0-insiders.d2daf59 → 0.0.0-insiders.d2fdddf

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
@@ -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;
@@ -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,46 +183,137 @@ 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;
182
192
  candidatesToCss(classes: string[]): (string | null)[];
183
193
  };
184
194
 
195
+ /**
196
+ * The source code for one or more nodes in the AST
197
+ *
198
+ * This generally corresponds to a stylesheet
199
+ */
200
+ interface Source {
201
+ /**
202
+ * The path to the file that contains the referenced source code
203
+ *
204
+ * If this references the *output* source code, this is `null`.
205
+ */
206
+ file: string | null;
207
+ /**
208
+ * The referenced source code
209
+ */
210
+ code: string;
211
+ }
212
+ /**
213
+ * The file and offsets within it that this node covers
214
+ *
215
+ * This can represent either:
216
+ * - A location in the original CSS which caused this node to be created
217
+ * - A location in the output CSS where this node resides
218
+ */
219
+ type SourceLocation = [source: Source, start: number, end: number];
220
+
185
221
  type StyleRule = {
186
222
  kind: 'rule';
187
223
  selector: string;
188
224
  nodes: AstNode[];
225
+ src?: SourceLocation;
226
+ dst?: SourceLocation;
189
227
  };
190
228
  type AtRule = {
191
229
  kind: 'at-rule';
192
230
  name: string;
193
231
  params: string;
194
232
  nodes: AstNode[];
233
+ src?: SourceLocation;
234
+ dst?: SourceLocation;
195
235
  };
196
236
  type Declaration = {
197
237
  kind: 'declaration';
198
238
  property: string;
199
239
  value: string | undefined;
200
240
  important: boolean;
241
+ src?: SourceLocation;
242
+ dst?: SourceLocation;
201
243
  };
202
244
  type Comment = {
203
245
  kind: 'comment';
204
246
  value: string;
247
+ src?: SourceLocation;
248
+ dst?: SourceLocation;
205
249
  };
206
250
  type Context = {
207
251
  kind: 'context';
208
252
  context: Record<string, string | boolean>;
209
253
  nodes: AstNode[];
254
+ src?: undefined;
255
+ dst?: undefined;
210
256
  };
211
257
  type AtRoot = {
212
258
  kind: 'at-root';
213
259
  nodes: AstNode[];
260
+ src?: undefined;
261
+ dst?: undefined;
214
262
  };
215
263
  type Rule = StyleRule | AtRule;
216
264
  type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot;
217
265
 
266
+ /**
267
+ * Line offset tables are the key to generating our source maps. They allow us
268
+ * to store indexes with our AST nodes and later convert them into positions as
269
+ * when given the source that the indexes refer to.
270
+ */
271
+ /**
272
+ * A position in source code
273
+ *
274
+ * https://tc39.es/ecma426/#sec-position-record-type
275
+ */
276
+ interface Position {
277
+ /** The line number, one-based */
278
+ line: number;
279
+ /** The column/character number, one-based */
280
+ column: number;
281
+ }
282
+
283
+ interface OriginalPosition extends Position {
284
+ source: DecodedSource;
285
+ }
286
+ /**
287
+ * A "decoded" sourcemap
288
+ *
289
+ * @see https://tc39.es/ecma426/#decoded-source-map-record
290
+ */
291
+ interface DecodedSourceMap {
292
+ file: string | null;
293
+ sources: DecodedSource[];
294
+ mappings: DecodedMapping[];
295
+ }
296
+ /**
297
+ * A "decoded" source
298
+ *
299
+ * @see https://tc39.es/ecma426/#decoded-source-record
300
+ */
301
+ interface DecodedSource {
302
+ url: string | null;
303
+ content: string | null;
304
+ ignore: boolean;
305
+ }
306
+ /**
307
+ * A "decoded" mapping
308
+ *
309
+ * @see https://tc39.es/ecma426/#decoded-mapping-record
310
+ */
311
+ interface DecodedMapping {
312
+ originalPosition: OriginalPosition | null;
313
+ generatedPosition: Position;
314
+ name: string | null;
315
+ }
316
+
218
317
  type Config = UserConfig;
219
318
  declare const enum Polyfills {
220
319
  None = 0,
@@ -224,14 +323,17 @@ declare const enum Polyfills {
224
323
  }
225
324
  type CompileOptions = {
226
325
  base?: string;
326
+ from?: string;
227
327
  polyfills?: Polyfills;
228
328
  loadModule?: (id: string, base: string, resourceHint: 'plugin' | 'config') => Promise<{
229
- module: Plugin | Config;
329
+ path: string;
230
330
  base: string;
331
+ module: Plugin | Config;
231
332
  }>;
232
333
  loadStylesheet?: (id: string, base: string) => Promise<{
233
- content: string;
334
+ path: string;
234
335
  base: string;
336
+ content: string;
235
337
  }>;
236
338
  };
237
339
  type Root = null | 'none' | {
@@ -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 };