source: node_modules/tailwindcss/dist/lib.d.mts@ d42aac3

Last change on this file since d42aac3 was 2058e5c, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Working / before login

  • Property mode set to 100644
File size: 10.9 KB
Line 
1import { S as SourceLocation, U as UserConfig, P as Plugin } from './types-CJYAW1ql.mjs';
2import { V as Variant, C as Candidate } from './resolve-config-QUZ9b-Gn.mjs';
3import './colors.mjs';
4
5declare const enum ThemeOptions {
6 NONE = 0,
7 INLINE = 1,
8 REFERENCE = 2,
9 DEFAULT = 4,
10 STATIC = 8,
11 USED = 16
12}
13declare class Theme {
14 #private;
15 private values;
16 private keyframes;
17 prefix: string | null;
18 constructor(values?: Map<string, {
19 value: string;
20 options: ThemeOptions;
21 src: Declaration["src"];
22 }>, keyframes?: Set<AtRule>);
23 get size(): number;
24 add(key: string, value: string, options?: ThemeOptions, src?: Declaration['src']): void;
25 keysInNamespaces(themeKeys: Iterable<ThemeKey>): string[];
26 get(themeKeys: ThemeKey[]): string | null;
27 hasDefault(key: string): boolean;
28 getOptions(key: string): ThemeOptions;
29 entries(): IterableIterator<[string, {
30 value: string;
31 options: ThemeOptions;
32 src: Declaration["src"];
33 }]> | [string, {
34 value: string;
35 options: ThemeOptions;
36 src: Declaration["src"];
37 }][];
38 prefixKey(key: string): string;
39 clearNamespace(namespace: string, clearOptions: ThemeOptions): void;
40 markUsedVariable(themeKey: string): boolean;
41 resolve(candidateValue: string | null, themeKeys: ThemeKey[], options?: ThemeOptions): string | null;
42 resolveValue(candidateValue: string | null, themeKeys: ThemeKey[]): string | null;
43 resolveWith(candidateValue: string, themeKeys: ThemeKey[], nestedKeys?: `--${string}`[]): [string, Record<string, string>] | null;
44 namespace(namespace: string): Map<string | null, string>;
45 addKeyframes(value: AtRule): void;
46 getKeyframes(): AtRule[];
47}
48type ThemeKey = `--${string}`;
49
50type VariantFn<T extends Variant['kind']> = (rule: Rule, variant: Extract<Variant, {
51 kind: T;
52}>) => null | void;
53type CompareFn = (a: Variant, z: Variant) => number;
54declare const enum Compounds {
55 Never = 0,
56 AtRules = 1,
57 StyleRules = 2
58}
59declare class Variants {
60 compareFns: Map<number, CompareFn>;
61 variants: Map<string, {
62 kind: Variant["kind"];
63 order: number;
64 applyFn: VariantFn<any>;
65 compoundsWith: Compounds;
66 compounds: Compounds;
67 }>;
68 private completions;
69 /**
70 * Registering a group of variants should result in the same sort number for
71 * all the variants. This is to ensure that the variants are applied in the
72 * correct order.
73 */
74 private groupOrder;
75 /**
76 * Keep track of the last sort order instead of using the size of the map to
77 * avoid unnecessarily skipping order numbers.
78 */
79 private lastOrder;
80 static(name: string, applyFn: VariantFn<'static'>, { compounds, order }?: {
81 compounds?: Compounds;
82 order?: number;
83 }): void;
84 fromAst(name: string, ast: AstNode[], designSystem: DesignSystem): void;
85 functional(name: string, applyFn: VariantFn<'functional'>, { compounds, order }?: {
86 compounds?: Compounds;
87 order?: number;
88 }): void;
89 compound(name: string, compoundsWith: Compounds, applyFn: VariantFn<'compound'>, { compounds, order }?: {
90 compounds?: Compounds;
91 order?: number;
92 }): void;
93 group(fn: () => void, compareFn?: CompareFn): void;
94 has(name: string): boolean;
95 get(name: string): {
96 kind: Variant["kind"];
97 order: number;
98 applyFn: VariantFn<any>;
99 compoundsWith: Compounds;
100 compounds: Compounds;
101 } | undefined;
102 kind(name: string): "arbitrary" | "static" | "functional" | "compound";
103 compoundsWith(parent: string, child: string | Variant): boolean;
104 suggest(name: string, suggestions: () => string[]): void;
105 getCompletions(name: string): string[];
106 compare(a: Variant | null, z: Variant | null): number;
107 keys(): IterableIterator<string>;
108 entries(): IterableIterator<[string, {
109 kind: Variant["kind"];
110 order: number;
111 applyFn: VariantFn<any>;
112 compoundsWith: Compounds;
113 compounds: Compounds;
114 }]>;
115 private set;
116 private nextOrder;
117}
118
119declare function compileAstNodes(candidate: Candidate, designSystem: DesignSystem, flags: CompileAstFlags): {
120 node: AstNode;
121 propertySort: {
122 order: number[];
123 count: number;
124 };
125}[];
126
127interface 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
150interface ClassMetadata {
151 modifiers: string[];
152}
153type ClassEntry = [string, ClassMetadata];
154interface SelectorOptions {
155 modifier?: string;
156 value?: string;
157}
158interface VariantEntry {
159 name: string;
160 isArbitrary: boolean;
161 values: string[];
162 hasDash: boolean;
163 selectors: (options: SelectorOptions) => string[];
164}
165
166type CompileFn<T extends Candidate['kind']> = (value: Extract<Candidate, {
167 kind: T;
168}>) => AstNode[] | undefined | null;
169interface SuggestionGroup {
170 supportsNegative?: boolean;
171 values: (string | null)[];
172 modifiers: string[];
173}
174type UtilityOptions = {
175 types: string[];
176};
177type Utility = {
178 kind: 'static' | 'functional';
179 compileFn: CompileFn<any>;
180 options?: UtilityOptions;
181};
182declare class Utilities {
183 private utilities;
184 private completions;
185 static(name: string, compileFn: CompileFn<'static'>): void;
186 functional(name: string, compileFn: CompileFn<'functional'>, options?: UtilityOptions): void;
187 has(name: string, kind: 'static' | 'functional'): boolean;
188 get(name: string): Utility[];
189 getCompletions(name: string): SuggestionGroup[];
190 suggest(name: string, groups: () => SuggestionGroup[]): void;
191 keys(kind: 'static' | 'functional'): string[];
192}
193
194declare const enum CompileAstFlags {
195 None = 0,
196 RespectImportant = 1
197}
198type DesignSystem = {
199 theme: Theme;
200 utilities: Utilities;
201 variants: Variants;
202 invalidCandidates: Set<string>;
203 important: boolean;
204 getClassOrder(classes: string[]): [string, bigint | null][];
205 getClassList(): ClassEntry[];
206 getVariants(): VariantEntry[];
207 parseCandidate(candidate: string): Readonly<Candidate>[];
208 parseVariant(variant: string): Readonly<Variant> | null;
209 compileAstNodes(candidate: Candidate, flags?: CompileAstFlags): ReturnType<typeof compileAstNodes>;
210 printCandidate(candidate: Candidate): string;
211 printVariant(variant: Variant): string;
212 getVariantOrder(): Map<Variant, number>;
213 resolveThemeValue(path: string, forceInline?: boolean): string | undefined;
214 trackUsedVariables(raw: string): void;
215 canonicalizeCandidates(candidates: string[], options?: CanonicalizeOptions): string[];
216 candidatesToCss(classes: string[]): (string | null)[];
217 candidatesToAst(classes: string[]): AstNode[][];
218 storage: Record<symbol, unknown>;
219};
220
221type StyleRule = {
222 kind: 'rule';
223 selector: string;
224 nodes: AstNode[];
225 src?: SourceLocation;
226 dst?: SourceLocation;
227};
228type AtRule = {
229 kind: 'at-rule';
230 name: string;
231 params: string;
232 nodes: AstNode[];
233 src?: SourceLocation;
234 dst?: SourceLocation;
235};
236type Declaration = {
237 kind: 'declaration';
238 property: string;
239 value: string | undefined;
240 important: boolean;
241 src?: SourceLocation;
242 dst?: SourceLocation;
243};
244type Comment = {
245 kind: 'comment';
246 value: string;
247 src?: SourceLocation;
248 dst?: SourceLocation;
249};
250type Context = {
251 kind: 'context';
252 context: Record<string, string | boolean>;
253 nodes: AstNode[];
254 src?: undefined;
255 dst?: undefined;
256};
257type AtRoot = {
258 kind: 'at-root';
259 nodes: AstNode[];
260 src?: undefined;
261 dst?: undefined;
262};
263type Rule = StyleRule | AtRule;
264type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot;
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 */
276interface Position {
277 /** The line number, one-based */
278 line: number;
279 /** The column/character number, one-based */
280 column: number;
281}
282
283interface OriginalPosition extends Position {
284 source: DecodedSource;
285}
286/**
287 * A "decoded" sourcemap
288 *
289 * @see https://tc39.es/ecma426/#decoded-source-map-record
290 */
291interface 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 */
301interface 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 */
311interface DecodedMapping {
312 originalPosition: OriginalPosition | null;
313 generatedPosition: Position;
314 name: string | null;
315}
316
317type Config = UserConfig;
318declare const enum Polyfills {
319 None = 0,
320 AtProperty = 1,
321 ColorMix = 2,
322 All = 3
323}
324type CompileOptions = {
325 base?: string;
326 from?: string;
327 polyfills?: Polyfills;
328 loadModule?: (id: string, base: string, resourceHint: 'plugin' | 'config') => Promise<{
329 path: string;
330 base: string;
331 module: Plugin | Config;
332 }>;
333 loadStylesheet?: (id: string, base: string) => Promise<{
334 path: string;
335 base: string;
336 content: string;
337 }>;
338};
339type Root = null | 'none' | {
340 base: string;
341 pattern: string;
342};
343declare const enum Features {
344 None = 0,
345 AtApply = 1,
346 AtImport = 2,
347 JsPluginCompat = 4,
348 ThemeFunction = 8,
349 Utilities = 16,
350 Variants = 32,
351 AtTheme = 64
352}
353declare function compileAst(input: AstNode[], opts?: CompileOptions): Promise<{
354 sources: {
355 base: string;
356 pattern: string;
357 negated: boolean;
358 }[];
359 root: Root;
360 features: Features;
361 build(candidates: string[]): AstNode[];
362}>;
363
364declare function compile(css: string, opts?: CompileOptions): Promise<{
365 sources: {
366 base: string;
367 pattern: string;
368 negated: boolean;
369 }[];
370 root: Root;
371 features: Features;
372 build(candidates: string[]): string;
373 buildSourceMap(): DecodedSourceMap;
374}>;
375declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
376declare function postcssPluginWarning(): void;
377
378export { type Config, type DecodedSourceMap, Features, Polyfills, __unstable__loadDesignSystem, compile, compileAst, postcssPluginWarning as default };
Note: See TracBrowser for help on using the repository browser.