@unocss/core 66.5.10-beta.1 → 66.5.11

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/index.d.mts CHANGED
@@ -1,77 +1,79 @@
1
- import MagicString from 'magic-string';
2
- import { LoadConfigResult } from 'unconfig';
1
+ import MagicString from "magic-string";
2
+ import { LoadConfigResult } from "unconfig";
3
3
 
4
+ //#region src/utils/basic.d.ts
4
5
  declare function toArray<T>(value?: T | T[]): T[];
5
6
  declare function uniq<T>(value: T[]): T[];
6
7
  declare function uniqueBy<T>(array: readonly T[], equalFn: (a: T, b: T) => boolean): T[];
7
8
  declare function isString(s: any): s is string;
8
-
9
- declare class CountableSet<K> extends Set<K> {
10
- _map: Map<K, number>;
11
- constructor(values?: Iterable<K>);
12
- add(key: K): this;
13
- delete(key: K): boolean;
14
- clear(): void;
15
- getCount(key: K): number;
16
- setCount(key: K, count: number): this;
9
+ //#endregion
10
+ //#region src/utils/countable-set.d.ts
11
+ declare class CountableSet<K$1> extends Set<K$1> {
12
+ _map: Map<K$1, number>;
13
+ constructor(values?: Iterable<K$1>);
14
+ add(key: K$1): this;
15
+ delete(key: K$1): boolean;
16
+ clear(): void;
17
+ getCount(key: K$1): number;
18
+ setCount(key: K$1, count: number): this;
17
19
  }
18
20
  declare function isCountableSet<T = string>(value: any): value is CountableSet<T>;
19
-
21
+ //#endregion
22
+ //#region src/utils/escape.d.ts
20
23
  declare function escapeRegExp(string: string): string;
21
24
  /**
22
25
  * CSS Selector Escape
23
26
  */
24
27
  declare function escapeSelector(str: string): string;
25
28
  declare const e: typeof escapeSelector;
26
-
29
+ //#endregion
30
+ //#region src/utils/events.d.ts
27
31
  type EventsMap = Record<string, any>;
28
32
  interface DefaultEvents extends EventsMap {
29
- [event: string]: (...args: any) => void;
33
+ [event: string]: (...args: any) => void;
30
34
  }
31
35
  interface Unsubscribe {
32
- (): void;
36
+ (): void;
33
37
  }
34
38
  declare class Emitter<Events extends EventsMap = DefaultEvents> {
35
- /**
36
- * Event names in keys and arrays with listeners in values.
37
- *
38
- * ```js
39
- * emitter1.events = emitter2.events
40
- * emitter2.events = { }
41
- * ```
42
- */
43
- events: Partial<{
44
- [E in keyof Events]: Events[E][];
45
- }>;
46
- /**
47
- * Add a listener for a given event.
48
- *
49
- * ```js
50
- * const unbind = ee.on('tick', (tickType, tickDuration) => {
51
- * count += 1
52
- * })
53
- *
54
- * disable () {
55
- * unbind()
56
- * }
57
- * ```
58
- *
59
- * @param event The event name.
60
- * @param cb The listener function.
61
- * @returns Unbind listener from event.
62
- */
63
- on<K extends keyof Events>(this: this, event: K, cb: Events[K]): Unsubscribe;
64
- /**
65
- * Calls each of the listeners registered for a given event.
66
- *
67
- * ```js
68
- * ee.emit('tick', tickType, tickDuration)
69
- * ```
70
- *
71
- * @param event The event name.
72
- * @param args The arguments for listeners.
73
- */
74
- emit<K extends keyof Events>(this: this, event: K, ...args: Parameters<Events[K]>): void;
39
+ /**
40
+ * Event names in keys and arrays with listeners in values.
41
+ *
42
+ * ```js
43
+ * emitter1.events = emitter2.events
44
+ * emitter2.events = { }
45
+ * ```
46
+ */
47
+ events: Partial<{ [E in keyof Events]: Events[E][] }>;
48
+ /**
49
+ * Add a listener for a given event.
50
+ *
51
+ * ```js
52
+ * const unbind = ee.on('tick', (tickType, tickDuration) => {
53
+ * count += 1
54
+ * })
55
+ *
56
+ * disable () {
57
+ * unbind()
58
+ * }
59
+ * ```
60
+ *
61
+ * @param event The event name.
62
+ * @param cb The listener function.
63
+ * @returns Unbind listener from event.
64
+ */
65
+ on<K$1 extends keyof Events>(this: this, event: K$1, cb: Events[K$1]): Unsubscribe;
66
+ /**
67
+ * Calls each of the listeners registered for a given event.
68
+ *
69
+ * ```js
70
+ * ee.emit('tick', tickType, tickDuration)
71
+ * ```
72
+ *
73
+ * @param event The event name.
74
+ * @param args The arguments for listeners.
75
+ */
76
+ emit<K$1 extends keyof Events>(this: this, event: K$1, ...args: Parameters<Events[K$1]>): void;
75
77
  }
76
78
  /**
77
79
  * Create event emitter.
@@ -93,7 +95,8 @@ declare class Emitter<Events extends EventsMap = DefaultEvents> {
93
95
  * ```
94
96
  */
95
97
  declare function createNanoEvents<Events extends EventsMap = DefaultEvents>(): Emitter<Events>;
96
-
98
+ //#endregion
99
+ //#region src/utils/helpers.d.ts
97
100
  declare const attributifyRE: RegExp;
98
101
  declare const cssIdRE: RegExp;
99
102
  declare const validateFilterRE: RegExp;
@@ -103,25 +106,28 @@ declare function normalizeVariant(variant: Variant<any>): VariantObject<any>;
103
106
  declare function isRawUtil(util: ParsedUtil | RawUtil | StringifiedUtil): util is RawUtil;
104
107
  declare function notNull<T>(value: T | null | undefined): value is T;
105
108
  declare function noop(): void;
106
-
109
+ //#endregion
110
+ //#region src/utils/layer.d.ts
107
111
  declare function withLayer<T extends object>(layer: string, rules: Rule<T>[]): Rule<T>[];
108
-
112
+ //#endregion
113
+ //#region src/utils/map.d.ts
109
114
  declare class TwoKeyMap<K1, K2, V> {
110
- _map: Map<K1, Map<K2, V>>;
111
- get(key1: K1, key2: K2): V | undefined;
112
- getFallback(key1: K1, key2: K2, fallback: V): V;
113
- set(key1: K1, key2: K2, value: V): this;
114
- has(key1: K1, key2: K2): boolean | undefined;
115
- delete(key1: K1, key2: K2): boolean;
116
- deleteTop(key1: K1): boolean;
117
- map<T>(fn: (v: V, k1: K1, k2: K2) => T): T[];
115
+ _map: Map<K1, Map<K2, V>>;
116
+ get(key1: K1, key2: K2): V | undefined;
117
+ getFallback(key1: K1, key2: K2, fallback: V): V;
118
+ set(key1: K1, key2: K2, value: V): this;
119
+ has(key1: K1, key2: K2): boolean | undefined;
120
+ delete(key1: K1, key2: K2): boolean;
121
+ deleteTop(key1: K1): boolean;
122
+ map<T>(fn: (v: V, k1: K1, k2: K2) => T): T[];
118
123
  }
119
- declare class BetterMap<K, V> extends Map<K, V> {
120
- getFallback(key: K, fallback: V): V;
121
- map<R>(mapFn: (value: V, key: K) => R): R[];
122
- flatMap<R extends readonly unknown[]>(mapFn: (value: V, key: K) => R): R[number][];
124
+ declare class BetterMap<K$1, V> extends Map<K$1, V> {
125
+ getFallback(key: K$1, fallback: V): V;
126
+ map<R>(mapFn: (value: V, key: K$1) => R): R[];
127
+ flatMap<R extends readonly unknown[]>(mapFn: (value: V, key: K$1) => R): R[number][];
123
128
  }
124
-
129
+ //#endregion
130
+ //#region src/utils/object.d.ts
125
131
  declare function normalizeCSSEntries(obj: string | CSSEntriesInput | CSSObjectInput): string | CSSEntries;
126
132
  declare function normalizeCSSValues(obj: CSSValueInput | string | (CSSValueInput | string)[]): (string | CSSEntries)[];
127
133
  declare function clearIdenticalEntries(entry: CSSEntries): CSSEntries;
@@ -135,82 +141,82 @@ declare function mergeDeep<T>(original: T, patch: DeepPartial<T>, mergeArray?: b
135
141
  declare function clone<T>(val: T): T;
136
142
  declare function isStaticRule(rule: Rule<any>): rule is StaticRule;
137
143
  declare function isStaticShortcut(sc: Shortcut<any>): sc is StaticShortcut;
138
-
144
+ //#endregion
145
+ //#region src/utils/variant-group.d.ts
139
146
  declare function makeRegexClassGroup(separators?: string[]): RegExp;
140
147
  interface VariantGroup {
141
- length: number;
142
- items: HighlightAnnotation[];
148
+ length: number;
149
+ items: HighlightAnnotation[];
143
150
  }
144
151
  declare function parseVariantGroup(str: string | MagicString, separators?: string[], depth?: number): {
145
- prefixes: string[];
146
- hasChanged: boolean;
147
- groupsByOffset: Map<number, VariantGroup>;
148
- readonly expanded: string;
152
+ prefixes: string[];
153
+ hasChanged: boolean;
154
+ groupsByOffset: Map<number, VariantGroup>;
155
+ readonly expanded: string;
149
156
  };
150
157
  declare function collapseVariantGroup(str: string, prefixes: string[]): string;
151
158
  declare function expandVariantGroup(str: string, separators?: string[], depth?: number): string;
152
159
  declare function expandVariantGroup(str: MagicString, separators?: string[], depth?: number): MagicString;
153
-
160
+ //#endregion
161
+ //#region src/utils/warn.d.ts
154
162
  declare function warnOnce(msg: string): void;
155
-
163
+ //#endregion
164
+ //#region src/generator.d.ts
156
165
  declare const symbols: ControlSymbols;
157
166
  declare class UnoGeneratorInternal<Theme extends object = object> {
158
- userConfig: UserConfig<Theme>;
159
- defaults: UserConfigDefaults<Theme>;
160
- readonly version: string;
161
- readonly events: Emitter<{
162
- config: (config: ResolvedConfig<Theme>) => void;
163
- }>;
164
- config: ResolvedConfig<Theme>;
165
- cache: Map<string, StringifiedUtil<Theme>[] | null>;
166
- blocked: Set<string>;
167
- parentOrders: Map<string, number>;
168
- activatedRules: Set<Rule<Theme>>;
169
- protected constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
170
- static create<Theme extends object = object>(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<UnoGeneratorInternal<Theme>>;
171
- setConfig(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<void>;
172
- applyExtractors(code: string, id?: string, extracted?: Set<string>): Promise<Set<string>>;
173
- applyExtractors(code: string, id?: string, extracted?: CountableSet<string>): Promise<CountableSet<string>>;
174
- makeContext(raw: string, applied: VariantMatchedResult<Theme>): RuleContext<Theme>;
175
- parseToken(raw: string, alias?: string): Promise<StringifiedUtil<Theme>[] | undefined | null>;
176
- generate(input: string | Set<string> | CountableSet<string> | string[], options?: GenerateOptions<false>): Promise<GenerateResult<Set<string>>>;
177
- generate(input: string | Set<string> | CountableSet<string> | string[], options?: GenerateOptions<true>): Promise<GenerateResult<Map<string, ExtendedTokenInfo<Theme>>>>;
178
- matchVariants(raw: string, current?: string): Promise<readonly VariantMatchedResult<Theme>[]>;
179
- private applyVariants;
180
- constructCustomCSS(context: Readonly<RuleContext<Theme>>, body: CSSObject | CSSEntries, overrideSelector?: string): string;
181
- parseUtil(input: string | VariantMatchedResult<Theme>, context: RuleContext<Theme>, internal?: boolean, shortcutPrefix?: string | string[] | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>;
182
- private resolveCSSResult;
183
- stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext<Theme>): StringifiedUtil<Theme> | undefined;
184
- expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<[(string | ShortcutInlineValue)[], RuleMeta | undefined] | undefined>;
185
- stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded: (string | ShortcutInlineValue)[], meta?: RuleMeta): Promise<StringifiedUtil<Theme>[] | undefined>;
186
- isBlocked(raw: string): boolean;
187
- getBlocked(raw: string): [BlocklistValue, BlocklistMeta | undefined] | undefined;
167
+ userConfig: UserConfig<Theme>;
168
+ defaults: UserConfigDefaults<Theme>;
169
+ readonly version: string;
170
+ readonly events: Emitter<{
171
+ config: (config: ResolvedConfig<Theme>) => void;
172
+ }>;
173
+ config: ResolvedConfig<Theme>;
174
+ cache: Map<string, StringifiedUtil<Theme>[] | null>;
175
+ blocked: Set<string>;
176
+ parentOrders: Map<string, number>;
177
+ activatedRules: Set<Rule<Theme>>;
178
+ protected constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
179
+ static create<Theme extends object = object>(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<UnoGeneratorInternal<Theme>>;
180
+ setConfig(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<void>;
181
+ applyExtractors(code: string, id?: string, extracted?: Set<string>): Promise<Set<string>>;
182
+ applyExtractors(code: string, id?: string, extracted?: CountableSet<string>): Promise<CountableSet<string>>;
183
+ makeContext(raw: string, applied: VariantMatchedResult<Theme>): RuleContext<Theme>;
184
+ parseToken(raw: string, alias?: string): Promise<StringifiedUtil<Theme>[] | undefined | null>;
185
+ generate(input: string | Set<string> | CountableSet<string> | string[], options?: GenerateOptions<false>): Promise<GenerateResult<Set<string>>>;
186
+ generate(input: string | Set<string> | CountableSet<string> | string[], options?: GenerateOptions<true>): Promise<GenerateResult<Map<string, ExtendedTokenInfo<Theme>>>>;
187
+ matchVariants(raw: string, current?: string): Promise<readonly VariantMatchedResult<Theme>[]>;
188
+ private applyVariants;
189
+ constructCustomCSS(context: Readonly<RuleContext<Theme>>, body: CSSObject | CSSEntries, overrideSelector?: string): string;
190
+ parseUtil(input: string | VariantMatchedResult<Theme>, context: RuleContext<Theme>, internal?: boolean, shortcutPrefix?: string | string[] | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>;
191
+ private resolveCSSResult;
192
+ stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext<Theme>): StringifiedUtil<Theme>[] | undefined;
193
+ expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<[(string | ShortcutInlineValue)[], RuleMeta | undefined] | undefined>;
194
+ stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded: (string | ShortcutInlineValue)[], meta?: RuleMeta): Promise<StringifiedUtil<Theme>[] | undefined>;
195
+ isBlocked(raw: string): boolean;
196
+ getBlocked(raw: string): [BlocklistValue, BlocklistMeta | undefined] | undefined;
188
197
  }
189
198
  declare class UnoGenerator<Theme extends object = object> extends UnoGeneratorInternal<Theme> {
190
- /**
191
- * @deprecated `new UnoGenerator` is deprecated, please use `createGenerator()` instead
192
- */
193
- constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
199
+ /**
200
+ * @deprecated `new UnoGenerator` is deprecated, please use `createGenerator()` instead
201
+ */
202
+ constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
194
203
  }
195
204
  declare function createGenerator<Theme extends object = object>(config?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<UnoGenerator<Theme>>;
196
205
  declare const regexScopePlaceholder: RegExp;
197
206
  declare function hasScopePlaceholder(css: string): boolean;
198
207
  declare function toEscapedSelector(raw: string): string;
199
-
208
+ //#endregion
209
+ //#region src/types.d.ts
200
210
  type Awaitable<T> = T | Promise<T>;
201
211
  type Arrayable<T> = T | T[];
202
212
  type ToArray<T> = T extends (infer U)[] ? U[] : T[];
203
213
  type ArgumentType<T> = T extends ((...args: infer A) => any) ? A : never;
204
214
  type Shift<T> = T extends [_: any, ...args: infer A] ? A : never;
205
215
  type RestArgs<T> = Shift<ArgumentType<T>>;
206
- type DeepPartial<T> = {
207
- [P in keyof T]?: DeepPartial<T[P]>;
208
- };
209
- type FlatObjectTuple<T> = {
210
- [K in keyof T]: T[K];
211
- };
212
- type PartialByKeys<T, K extends keyof T = keyof T> = FlatObjectTuple<Partial<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
213
- type RequiredByKey<T, K extends keyof T = keyof T> = FlatObjectTuple<Required<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
216
+ type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
217
+ type FlatObjectTuple<T> = { [K in keyof T]: T[K] };
218
+ type PartialByKeys<T, K$1 extends keyof T = keyof T> = FlatObjectTuple<Partial<Pick<T, Extract<keyof T, K$1>>> & Omit<T, K$1>>;
219
+ type RequiredByKey<T, K$1 extends keyof T = keyof T> = FlatObjectTuple<Required<Pick<T, Extract<keyof T, K$1>>> & Omit<T, K$1>>;
214
220
  type CSSObject = Record<string, string | number | undefined>;
215
221
  /**
216
222
  * [property, value, operators?]
@@ -224,52 +230,52 @@ type CSSEntriesInput = (CSSEntry | ControlSymbolsEntry)[];
224
230
  type CSSValueInput = CSSObjectInput | CSSEntriesInput | CSSValue;
225
231
  type PresetOptions = Record<string, any>;
226
232
  interface RuleContext<Theme extends object = object> {
227
- /**
228
- * Unprocessed selector from user input.
229
- * Useful for generating CSS rule.
230
- */
231
- rawSelector: string;
232
- /**
233
- * Current selector for rule matching
234
- */
235
- currentSelector: string;
236
- /**
237
- * UnoCSS generator instance
238
- */
239
- generator: UnoGenerator<Theme>;
240
- /**
241
- * Symbols for special handling
242
- */
243
- symbols: ControlSymbols;
244
- /**
245
- * The theme object
246
- */
247
- theme: Theme;
248
- /**
249
- * Matched variants handlers for this rule.
250
- */
251
- variantHandlers: VariantHandler[];
252
- /**
253
- * The result of variant matching.
254
- */
255
- variantMatch: VariantMatchedResult<Theme>;
256
- /**
257
- * Construct a custom CSS rule.
258
- * Variants and selector escaping will be handled automatically.
259
- */
260
- constructCSS: (body: CSSEntries | CSSObject, overrideSelector?: string) => string;
261
- /**
262
- * Available only when `details` option is enabled.
263
- */
264
- rules?: Rule<Theme>[];
265
- /**
266
- * Available only when `details` option is enabled.
267
- */
268
- shortcuts?: Shortcut<Theme>[];
269
- /**
270
- * Available only when `details` option is enabled.
271
- */
272
- variants?: Variant<Theme>[];
233
+ /**
234
+ * Unprocessed selector from user input.
235
+ * Useful for generating CSS rule.
236
+ */
237
+ rawSelector: string;
238
+ /**
239
+ * Current selector for rule matching
240
+ */
241
+ currentSelector: string;
242
+ /**
243
+ * UnoCSS generator instance
244
+ */
245
+ generator: UnoGenerator<Theme>;
246
+ /**
247
+ * Symbols for special handling
248
+ */
249
+ symbols: ControlSymbols;
250
+ /**
251
+ * The theme object
252
+ */
253
+ theme: Theme;
254
+ /**
255
+ * Matched variants handlers for this rule.
256
+ */
257
+ variantHandlers: VariantHandler[];
258
+ /**
259
+ * The result of variant matching.
260
+ */
261
+ variantMatch: VariantMatchedResult<Theme>;
262
+ /**
263
+ * Construct a custom CSS rule.
264
+ * Variants and selector escaping will be handled automatically.
265
+ */
266
+ constructCSS: (body: CSSEntries | CSSObject, overrideSelector?: string) => string;
267
+ /**
268
+ * Available only when `details` option is enabled.
269
+ */
270
+ rules?: Rule<Theme>[];
271
+ /**
272
+ * Available only when `details` option is enabled.
273
+ */
274
+ shortcuts?: Shortcut<Theme>[];
275
+ /**
276
+ * Available only when `details` option is enabled.
277
+ */
278
+ variants?: Variant<Theme>[];
273
279
  }
274
280
  declare const SymbolShortcutsNoMerge: unique symbol;
275
281
  declare const SymbolNoMerge: unique symbol;
@@ -280,143 +286,139 @@ declare const SymbolLayer: unique symbol;
280
286
  declare const SymbolSort: unique symbol;
281
287
  declare const SymbolBody: unique symbol;
282
288
  interface ControlSymbols {
283
- /**
284
- * Prevent merging in shortcuts
285
- */
286
- shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
287
- /**
288
- * Prevent merging in rules
289
- */
290
- noMerge: typeof SymbolNoMerge;
291
- /**
292
- * Additional variants applied to this rule
293
- */
294
- variants: typeof SymbolVariants;
295
- /**
296
- * Parent selector (`@media`, `@supports`, etc.)
297
- */
298
- parent: typeof SymbolParent;
299
- /**
300
- * Selector modifier
301
- */
302
- selector: typeof SymbolSelector;
303
- /**
304
- * Layer modifier
305
- */
306
- layer: typeof SymbolLayer;
307
- /**
308
- * Sort modifier
309
- */
310
- sort: typeof SymbolSort;
311
- /**
312
- * Custom css body modifier
313
- */
314
- body: typeof SymbolBody;
289
+ /**
290
+ * Prevent merging in shortcuts
291
+ */
292
+ shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
293
+ /**
294
+ * Prevent merging in rules
295
+ */
296
+ noMerge: typeof SymbolNoMerge;
297
+ /**
298
+ * Additional variants applied to this rule
299
+ */
300
+ variants: typeof SymbolVariants;
301
+ /**
302
+ * Parent selector (`@media`, `@supports`, etc.)
303
+ */
304
+ parent: typeof SymbolParent;
305
+ /**
306
+ * Selector modifier
307
+ */
308
+ selector: typeof SymbolSelector;
309
+ /**
310
+ * Layer modifier
311
+ */
312
+ layer: typeof SymbolLayer;
313
+ /**
314
+ * Sort modifier
315
+ */
316
+ sort: typeof SymbolSort;
317
+ /**
318
+ * Custom css body modifier
319
+ */
320
+ body: typeof SymbolBody;
315
321
  }
316
322
  interface ControlSymbolsValue {
317
- [SymbolShortcutsNoMerge]: true;
318
- [SymbolNoMerge]: true;
319
- [SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
320
- [SymbolParent]: string;
321
- [SymbolSelector]: (selector: string) => string;
322
- [SymbolLayer]: string;
323
- [SymbolSort]: number;
324
- [SymbolBody]: string;
323
+ [SymbolShortcutsNoMerge]: true;
324
+ [SymbolNoMerge]: true;
325
+ [SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
326
+ [SymbolParent]: string;
327
+ [SymbolSelector]: (selector: string) => string;
328
+ [SymbolLayer]: string;
329
+ [SymbolSort]: number;
330
+ [SymbolBody]: string;
325
331
  }
326
- type ObjectToEntry<T> = {
327
- [K in keyof T]: [K, T[K]];
328
- }[keyof T];
332
+ type ObjectToEntry<T> = { [K in keyof T]: [K, T[K]] }[keyof T];
329
333
  type ControlSymbolsEntry = ObjectToEntry<ControlSymbolsValue>;
330
334
  interface VariantContext<Theme extends object = object> {
331
- /**
332
- * Unprocessed selector from user input.
333
- */
334
- rawSelector: string;
335
- /**
336
- * UnoCSS generator instance
337
- */
338
- generator: UnoGenerator<Theme>;
339
- /**
340
- * The theme object
341
- */
342
- theme: Theme;
335
+ /**
336
+ * Unprocessed selector from user input.
337
+ */
338
+ rawSelector: string;
339
+ /**
340
+ * UnoCSS generator instance
341
+ */
342
+ generator: UnoGenerator<Theme>;
343
+ /**
344
+ * The theme object
345
+ */
346
+ theme: Theme;
343
347
  }
344
348
  interface ExtractorContext {
345
- readonly original: string;
346
- code: string;
347
- id?: string;
348
- extracted: Set<string> | CountableSet<string>;
349
- envMode?: 'dev' | 'build';
349
+ readonly original: string;
350
+ code: string;
351
+ id?: string;
352
+ extracted: Set<string> | CountableSet<string>;
353
+ envMode?: 'dev' | 'build';
350
354
  }
351
355
  interface BaseContext<Theme extends object = object> {
352
- /**
353
- * UnoCSS generator instance
354
- */
355
- generator: UnoGenerator<Theme>;
356
- /**
357
- * The theme object
358
- */
359
- theme: Theme;
360
- }
361
- interface PreflightContext<Theme extends object = object> extends BaseContext<Theme> {
362
- }
363
- interface SafeListContext<Theme extends object = object> extends BaseContext<Theme> {
356
+ /**
357
+ * UnoCSS generator instance
358
+ */
359
+ generator: UnoGenerator<Theme>;
360
+ /**
361
+ * The theme object
362
+ */
363
+ theme: Theme;
364
364
  }
365
+ interface PreflightContext<Theme extends object = object> extends BaseContext<Theme> {}
366
+ interface SafeListContext<Theme extends object = object> extends BaseContext<Theme> {}
365
367
  interface Extractor {
366
- name: string;
367
- order?: number;
368
- /**
369
- * Extract the code and return a list of selectors.
370
- *
371
- * Return `undefined` to skip this extractor.
372
- */
373
- extract?: (ctx: ExtractorContext) => Awaitable<Set<string> | CountableSet<string> | string[] | undefined | void>;
368
+ name: string;
369
+ order?: number;
370
+ /**
371
+ * Extract the code and return a list of selectors.
372
+ *
373
+ * Return `undefined` to skip this extractor.
374
+ */
375
+ extract?: (ctx: ExtractorContext) => Awaitable<Set<string> | CountableSet<string> | string[] | undefined | void>;
374
376
  }
375
377
  interface RuleMeta {
376
- /**
377
- * The layer name of this rule.
378
- * @default 'default'
379
- */
380
- layer?: string;
381
- /**
382
- * Option to not merge this selector even if the body are the same.
383
- * @default false
384
- */
385
- noMerge?: boolean;
386
- /**
387
- * Fine tune sort
388
- */
389
- sort?: number;
390
- /**
391
- * Templates to provide autocomplete suggestions
392
- */
393
- autocomplete?: Arrayable<AutoCompleteTemplate>;
394
- /**
395
- * Matching prefix before this util
396
- */
397
- prefix?: string | string[];
398
- /**
399
- * Internal rules will only be matched for shortcuts but not the user code.
400
- * @default false
401
- */
402
- internal?: boolean;
403
- /**
404
- * Store the hash of the rule boy
405
- *
406
- * @internal
407
- * @private
408
- */
409
- __hash?: string;
410
- /**
411
- * Internal index of the rulelist
412
- * @internal
413
- * @private
414
- */
415
- __index?: number;
416
- /**
417
- * Custom metadata
418
- */
419
- custom?: Record<string, any>;
378
+ /**
379
+ * The layer name of this rule.
380
+ * @default 'default'
381
+ */
382
+ layer?: string;
383
+ /**
384
+ * Option to not merge this selector even if the body are the same.
385
+ * @default false
386
+ */
387
+ noMerge?: boolean;
388
+ /**
389
+ * Fine tune sort
390
+ */
391
+ sort?: number;
392
+ /**
393
+ * Templates to provide autocomplete suggestions
394
+ */
395
+ autocomplete?: Arrayable<AutoCompleteTemplate>;
396
+ /**
397
+ * Matching prefix before this util
398
+ */
399
+ prefix?: string | string[];
400
+ /**
401
+ * Internal rules will only be matched for shortcuts but not the user code.
402
+ * @default false
403
+ */
404
+ internal?: boolean;
405
+ /**
406
+ * Store the hash of the rule boy
407
+ *
408
+ * @internal
409
+ * @private
410
+ */
411
+ __hash?: string;
412
+ /**
413
+ * Internal index of the rulelist
414
+ * @internal
415
+ * @private
416
+ */
417
+ __index?: number;
418
+ /**
419
+ * Custom metadata
420
+ */
421
+ custom?: Record<string, any>;
420
422
  }
421
423
  type CSSValue = CSSObject | CSSEntries;
422
424
  type CSSValues = CSSValue | CSSValue[];
@@ -431,675 +433,647 @@ type DynamicShortcut<Theme extends object = object> = [RegExp, DynamicShortcutMa
431
433
  type UserShortcuts<Theme extends object = object> = StaticShortcutMap | (StaticShortcut | DynamicShortcut<Theme> | StaticShortcutMap)[];
432
434
  type Shortcut<Theme extends object = object> = StaticShortcut | DynamicShortcut<Theme>;
433
435
  interface ShortcutInlineValue {
434
- handles: VariantHandler[];
435
- value: ShortcutValue;
436
+ handles: VariantHandler[];
437
+ value: ShortcutValue;
436
438
  }
437
439
  type ShortcutValue = string | CSSValue;
438
440
  type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
439
441
  interface Preflight<Theme extends object = object> {
440
- getCSS: (context: PreflightContext<Theme>) => Promise<string | undefined> | string | undefined;
441
- layer?: string;
442
+ getCSS: (context: PreflightContext<Theme>) => Promise<string | undefined> | string | undefined;
443
+ layer?: string;
442
444
  }
443
445
  interface BlocklistMeta {
444
- /**
445
- * Custom message to show why this selector is blocked.
446
- */
447
- message?: string | ((selector: string) => string);
446
+ /**
447
+ * Custom message to show why this selector is blocked.
448
+ */
449
+ message?: string | ((selector: string) => string);
448
450
  }
449
451
  type BlocklistValue = string | RegExp | ((selector: string) => boolean | null | undefined);
450
452
  type BlocklistRule = BlocklistValue | [BlocklistValue, BlocklistMeta];
451
453
  interface VariantHandlerContext {
452
- /**
453
- * Rewrite the output selector. Often be used to append parents.
454
- */
455
- prefix: string;
456
- /**
457
- * Rewrite the output selector. Often be used to append pseudo classes.
458
- */
459
- selector: string;
460
- /**
461
- * Rewrite the output selector. Often be used to append pseudo elements.
462
- */
463
- pseudo: string;
464
- /**
465
- * Rewrite the output css body. The input come in [key,value][] pairs.
466
- */
467
- entries: CSSEntries;
468
- /**
469
- * Provide a parent selector(e.g. media query) to the output css.
470
- */
471
- parent?: string;
472
- /**
473
- * Provide order to the `parent` parent selector within layer.
474
- */
475
- parentOrder?: number;
476
- /**
477
- * Override layer to the output css.
478
- */
479
- layer?: string;
480
- /**
481
- * Order in which the variant is sorted within single rule.
482
- */
483
- sort?: number;
484
- /**
485
- * Option to not merge the resulting entries even if the body are the same.
486
- * @default false
487
- */
488
- noMerge?: boolean;
454
+ /**
455
+ * Rewrite the output selector. Often be used to append parents.
456
+ */
457
+ prefix: string;
458
+ /**
459
+ * Rewrite the output selector. Often be used to append pseudo classes.
460
+ */
461
+ selector: string;
462
+ /**
463
+ * Rewrite the output selector. Often be used to append pseudo elements.
464
+ */
465
+ pseudo: string;
466
+ /**
467
+ * Rewrite the output css body. The input come in [key,value][] pairs.
468
+ */
469
+ entries: CSSEntries;
470
+ /**
471
+ * Provide a parent selector(e.g. media query) to the output css.
472
+ */
473
+ parent?: string;
474
+ /**
475
+ * Provide order to the `parent` parent selector within layer.
476
+ */
477
+ parentOrder?: number;
478
+ /**
479
+ * Override layer to the output css.
480
+ */
481
+ layer?: string;
482
+ /**
483
+ * Order in which the variant is sorted within single rule.
484
+ */
485
+ sort?: number;
486
+ /**
487
+ * Option to not merge the resulting entries even if the body are the same.
488
+ * @default false
489
+ */
490
+ noMerge?: boolean;
489
491
  }
490
492
  interface VariantHandler {
491
- /**
492
- * Callback to process the handler.
493
- */
494
- handle?: (input: VariantHandlerContext, next: (input: VariantHandlerContext) => VariantHandlerContext) => VariantHandlerContext;
495
- /**
496
- * The result rewritten selector for the next round of matching
497
- */
498
- matcher?: string;
499
- /**
500
- * Order in which the variant is applied to selector.
501
- */
502
- order?: number;
503
- /**
504
- * Rewrite the output selector. Often be used to append pseudo classes or parents.
505
- */
506
- selector?: (input: string, body: CSSEntries) => string | undefined;
507
- /**
508
- * Rewrite the output css body. The input come in [key,value][] pairs.
509
- */
510
- body?: (body: CSSEntries) => CSSEntries | undefined;
511
- /**
512
- * Provide a parent selector(e.g. media query) to the output css.
513
- */
514
- parent?: string | [string, number] | undefined;
515
- /**
516
- * Order in which the variant is sorted within single rule.
517
- */
518
- sort?: number;
519
- /**
520
- * Override layer to the output css.
521
- */
522
- layer?: string | undefined;
493
+ /**
494
+ * Callback to process the handler.
495
+ */
496
+ handle?: (input: VariantHandlerContext, next: (input: VariantHandlerContext) => VariantHandlerContext) => VariantHandlerContext;
497
+ /**
498
+ * The result rewritten selector for the next round of matching
499
+ */
500
+ matcher?: string;
501
+ /**
502
+ * Order in which the variant is applied to selector.
503
+ */
504
+ order?: number;
505
+ /**
506
+ * Rewrite the output selector. Often be used to append pseudo classes or parents.
507
+ */
508
+ selector?: (input: string, body: CSSEntries) => string | undefined;
509
+ /**
510
+ * Rewrite the output css body. The input come in [key,value][] pairs.
511
+ */
512
+ body?: (body: CSSEntries) => CSSEntries | undefined;
513
+ /**
514
+ * Provide a parent selector(e.g. media query) to the output css.
515
+ */
516
+ parent?: string | [string, number] | undefined;
517
+ /**
518
+ * Order in which the variant is sorted within single rule.
519
+ */
520
+ sort?: number;
521
+ /**
522
+ * Override layer to the output css.
523
+ */
524
+ layer?: string | undefined;
523
525
  }
524
526
  type VariantFunction<Theme extends object = object> = (matcher: string, context: Readonly<VariantContext<Theme>>) => Awaitable<string | VariantHandler | VariantHandler[] | undefined>;
525
527
  interface VariantObject<Theme extends object = object> {
526
- /**
527
- * The name of the variant.
528
- */
529
- name?: string;
530
- /**
531
- * The entry function to match and rewrite the selector for further processing.
532
- */
533
- match: VariantFunction<Theme>;
534
- /**
535
- * Sort for when the match is applied.
536
- */
537
- order?: number;
538
- /**
539
- * Allows this variant to be used more than once in matching a single rule
540
- *
541
- * @default false
542
- */
543
- multiPass?: boolean;
544
- /**
545
- * Custom function for auto complete
546
- */
547
- autocomplete?: Arrayable<AutoCompleteFunction | AutoCompleteTemplate>;
528
+ /**
529
+ * The name of the variant.
530
+ */
531
+ name?: string;
532
+ /**
533
+ * The entry function to match and rewrite the selector for further processing.
534
+ */
535
+ match: VariantFunction<Theme>;
536
+ /**
537
+ * Sort for when the match is applied.
538
+ */
539
+ order?: number;
540
+ /**
541
+ * Allows this variant to be used more than once in matching a single rule
542
+ *
543
+ * @default false
544
+ */
545
+ multiPass?: boolean;
546
+ /**
547
+ * Custom function for auto complete
548
+ */
549
+ autocomplete?: Arrayable<AutoCompleteFunction | AutoCompleteTemplate>;
548
550
  }
549
551
  type Variant<Theme extends object = object> = VariantFunction<Theme> | VariantObject<Theme>;
550
552
  type Preprocessor = (matcher: string) => string | undefined;
551
- type Postprocessor = (util: UtilObject) => void;
553
+ type Postprocessor = (util: UtilObject) => void | UtilObject | (UtilObject | null | undefined)[];
552
554
  type ThemeExtender<Theme extends object = object> = (theme: Theme, config: Readonly<ResolvedConfig<Theme>>) => Theme | void;
553
555
  interface ConfigBase<Theme extends object = object> {
554
- /**
555
- * Rules to generate CSS utilities.
556
- *
557
- * Later entries have higher priority.
558
- */
559
- rules?: Rule<Theme>[];
560
- /**
561
- * Variant separator
562
- *
563
- * @default [':', '-']
564
- */
565
- separators?: Arrayable<string>;
566
- /**
567
- * Variants that preprocess the selectors,
568
- * having the ability to rewrite the CSS object.
569
- */
570
- variants?: Variant<Theme>[];
571
- /**
572
- * Similar to Windi CSS's shortcuts,
573
- * allows you have create new utilities by combining existing ones.
574
- *
575
- * Later entries have higher priority.
576
- */
577
- shortcuts?: UserShortcuts<Theme>;
578
- /**
579
- * Rules to exclude the selectors for your design system (to narrow down the possibilities).
580
- * Combining `warnExcluded` options it can also help you identify wrong usages.
581
- */
582
- blocklist?: BlocklistRule[];
583
- /**
584
- * Utilities that always been included
585
- */
586
- safelist?: (string | ((context: SafeListContext<Theme>) => Arrayable<string>))[];
587
- /**
588
- * Extractors to handle the source file and outputs possible classes/selectors
589
- * Can be language-aware.
590
- */
591
- extractors?: Extractor[];
592
- /**
593
- * Default extractor that are always applied.
594
- * By default it split the source code by whitespace and quotes.
595
- *
596
- * It maybe be replaced by preset or user config,
597
- * only one default extractor can be presented,
598
- * later one will override the previous one.
599
- *
600
- * Pass `null` or `false` to disable the default extractor.
601
- *
602
- * @see https://github.com/unocss/unocss/blob/main/packages-engine/core/src/extractors/split.ts
603
- * @default import('@unocss/core').defaultExtractor
604
- */
605
- extractorDefault?: Extractor | null | false;
606
- /**
607
- * Raw CSS injections.
608
- */
609
- preflights?: Preflight<Theme>[];
610
- /**
611
- * Theme object for shared configuration between rules
612
- */
613
- theme?: Theme;
614
- /**
615
- * Layer orders. Default to 0.
616
- */
617
- layers?: Record<string, number>;
618
- /**
619
- * Output the internal layers as CSS Cascade Layers.
620
- */
621
- outputToCssLayers?: boolean | OutputCssLayersOptions;
622
- /**
623
- * Custom function to sort layers.
624
- */
625
- sortLayers?: (layers: string[]) => string[];
626
- /**
627
- * Preprocess the incoming utilities, return falsy value to exclude
628
- */
629
- preprocess?: Arrayable<Preprocessor>;
630
- /**
631
- * Postprocess the generate utils object
632
- */
633
- postprocess?: Arrayable<Postprocessor>;
634
- /**
635
- * Custom functions mutate the theme object.
636
- *
637
- * It's also possible to return a new theme object to completely replace the original one.
638
- */
639
- extendTheme?: Arrayable<ThemeExtender<Theme>>;
640
- /**
641
- * Presets
642
- */
643
- presets?: (PresetOrFactoryAwaitable<Theme> | PresetOrFactoryAwaitable<Theme>[])[];
644
- /**
645
- * Additional options for auto complete
646
- */
647
- autocomplete?: {
648
- /**
649
- * Custom functions / templates to provide autocomplete suggestions
650
- */
651
- templates?: Arrayable<AutoCompleteFunction | AutoCompleteTemplate>;
652
- /**
653
- * Custom extractors to pickup possible classes and
654
- * transform class-name style suggestions to the correct format
655
- */
656
- extractors?: Arrayable<AutoCompleteExtractor>;
657
- /**
658
- * Custom shorthands to provide autocomplete suggestions.
659
- * if values is an array, it will be joined with `|` and wrapped with `()`
660
- */
661
- shorthands?: Record<string, string | string[]>;
662
- };
663
- /**
664
- * Hook to modify the resolved config.
665
- *
666
- * First presets runs first and the user config
667
- */
668
- configResolved?: (config: ResolvedConfig<Theme>) => void;
669
- /**
670
- * Expose internal details for debugging / inspecting
671
- *
672
- * Added `rules`, `shortcuts`, `variants` to the context and expose the context object in `StringifiedUtil`
673
- *
674
- * You don't usually need to set this.
675
- *
676
- * @default `true` when `envMode` is `dev`, otherwise `false`
677
- */
678
- details?: boolean;
679
- /**
680
- * Options for sources to be extracted as utilities usages.
681
- *
682
- */
683
- content?: ContentOptions;
684
- /**
685
- * Custom transformers to the source code.
686
- */
687
- transformers?: SourceCodeTransformer[];
556
+ /**
557
+ * Rules to generate CSS utilities.
558
+ *
559
+ * Later entries have higher priority.
560
+ */
561
+ rules?: Rule<Theme>[];
562
+ /**
563
+ * Variant separator
564
+ *
565
+ * @default [':', '-']
566
+ */
567
+ separators?: Arrayable<string>;
568
+ /**
569
+ * Variants that preprocess the selectors,
570
+ * having the ability to rewrite the CSS object.
571
+ */
572
+ variants?: Variant<Theme>[];
573
+ /**
574
+ * Similar to Windi CSS's shortcuts,
575
+ * allows you have create new utilities by combining existing ones.
576
+ *
577
+ * Later entries have higher priority.
578
+ */
579
+ shortcuts?: UserShortcuts<Theme>;
580
+ /**
581
+ * Rules to exclude the selectors for your design system (to narrow down the possibilities).
582
+ * Combining `warnExcluded` options it can also help you identify wrong usages.
583
+ */
584
+ blocklist?: BlocklistRule[];
585
+ /**
586
+ * Utilities that always been included
587
+ */
588
+ safelist?: (string | ((context: SafeListContext<Theme>) => Arrayable<string>))[];
589
+ /**
590
+ * Extractors to handle the source file and outputs possible classes/selectors
591
+ * Can be language-aware.
592
+ */
593
+ extractors?: Extractor[];
594
+ /**
595
+ * Default extractor that are always applied.
596
+ * By default it split the source code by whitespace and quotes.
597
+ *
598
+ * It maybe be replaced by preset or user config,
599
+ * only one default extractor can be presented,
600
+ * later one will override the previous one.
601
+ *
602
+ * Pass `null` or `false` to disable the default extractor.
603
+ *
604
+ * @see https://github.com/unocss/unocss/blob/main/packages-engine/core/src/extractors/split.ts
605
+ * @default import('@unocss/core').defaultExtractor
606
+ */
607
+ extractorDefault?: Extractor | null | false;
608
+ /**
609
+ * Raw CSS injections.
610
+ */
611
+ preflights?: Preflight<Theme>[];
612
+ /**
613
+ * Theme object for shared configuration between rules
614
+ */
615
+ theme?: Theme;
616
+ /**
617
+ * Layer orders. Default to 0.
618
+ */
619
+ layers?: Record<string, number>;
620
+ /**
621
+ * Output the internal layers as CSS Cascade Layers.
622
+ */
623
+ outputToCssLayers?: boolean | OutputCssLayersOptions;
624
+ /**
625
+ * Custom function to sort layers.
626
+ */
627
+ sortLayers?: (layers: string[]) => string[];
628
+ /**
629
+ * Preprocess the incoming utilities, return falsy value to exclude
630
+ */
631
+ preprocess?: Arrayable<Preprocessor>;
632
+ /**
633
+ * Postprocess the generate utils object
634
+ */
635
+ postprocess?: Arrayable<Postprocessor>;
636
+ /**
637
+ * Custom functions mutate the theme object.
638
+ *
639
+ * It's also possible to return a new theme object to completely replace the original one.
640
+ */
641
+ extendTheme?: Arrayable<ThemeExtender<Theme>>;
642
+ /**
643
+ * Presets
644
+ */
645
+ presets?: (PresetOrFactoryAwaitable<Theme> | PresetOrFactoryAwaitable<Theme>[])[];
646
+ /**
647
+ * Additional options for auto complete
648
+ */
649
+ autocomplete?: {
650
+ /**
651
+ * Custom functions / templates to provide autocomplete suggestions
652
+ */
653
+ templates?: Arrayable<AutoCompleteFunction | AutoCompleteTemplate>;
654
+ /**
655
+ * Custom extractors to pickup possible classes and
656
+ * transform class-name style suggestions to the correct format
657
+ */
658
+ extractors?: Arrayable<AutoCompleteExtractor>;
659
+ /**
660
+ * Custom shorthands to provide autocomplete suggestions.
661
+ * if values is an array, it will be joined with `|` and wrapped with `()`
662
+ */
663
+ shorthands?: Record<string, string | string[]>;
664
+ };
665
+ /**
666
+ * Hook to modify the resolved config.
667
+ *
668
+ * First presets runs first and the user config
669
+ */
670
+ configResolved?: (config: ResolvedConfig<Theme>) => void;
671
+ /**
672
+ * Expose internal details for debugging / inspecting
673
+ *
674
+ * Added `rules`, `shortcuts`, `variants` to the context and expose the context object in `StringifiedUtil`
675
+ *
676
+ * You don't usually need to set this.
677
+ *
678
+ * @default `true` when `envMode` is `dev`, otherwise `false`
679
+ */
680
+ details?: boolean;
681
+ /**
682
+ * Options for sources to be extracted as utilities usages.
683
+ *
684
+ */
685
+ content?: ContentOptions;
686
+ /**
687
+ * Custom transformers to the source code.
688
+ */
689
+ transformers?: SourceCodeTransformer[];
688
690
  }
689
691
  interface OutputCssLayersOptions {
690
- /**
691
- * Specify the css layer that the internal layer should be output to.
692
- *
693
- * Return `null` to specify that the layer should not be output to any css layer.
694
- */
695
- cssLayerName?: (internalLayer: string) => string | undefined | null;
692
+ /**
693
+ * Specify the css layer that the internal layer should be output to.
694
+ *
695
+ * Return `null` to specify that the layer should not be output to any css layer.
696
+ */
697
+ cssLayerName?: (internalLayer: string) => string | undefined | null;
696
698
  }
697
699
  type AutoCompleteTemplate = string;
698
700
  type AutoCompleteFunction = (input: string) => Awaitable<string[]>;
699
701
  interface AutoCompleteExtractorContext {
700
- content: string;
701
- cursor: number;
702
+ content: string;
703
+ cursor: number;
702
704
  }
703
705
  interface Replacement {
704
- /**
705
- * The range of the original text
706
- */
707
- start: number;
708
- end: number;
709
- /**
710
- * The text used to replace
711
- */
712
- replacement: string;
706
+ /**
707
+ * The range of the original text
708
+ */
709
+ start: number;
710
+ end: number;
711
+ /**
712
+ * The text used to replace
713
+ */
714
+ replacement: string;
713
715
  }
714
716
  interface SuggestResult {
715
- /**
716
- * The generated suggestions
717
- *
718
- * `[original, formatted]`
719
- */
720
- suggestions: [string, string][];
721
- /**
722
- * The function to convert the selected suggestion back.
723
- * Needs to pass in the original one.
724
- */
725
- resolveReplacement: (suggestion: string) => Replacement;
717
+ /**
718
+ * The generated suggestions
719
+ *
720
+ * `[original, formatted]`
721
+ */
722
+ suggestions: [string, string][];
723
+ /**
724
+ * The function to convert the selected suggestion back.
725
+ * Needs to pass in the original one.
726
+ */
727
+ resolveReplacement: (suggestion: string) => Replacement;
726
728
  }
727
729
  interface AutoCompleteExtractorResult {
728
- /**
729
- * The extracted string
730
- */
731
- extracted: string;
732
- /**
733
- * The function to convert the selected suggestion back
734
- */
735
- resolveReplacement: (suggestion: string) => Replacement;
736
- /**
737
- * The function to format suggestions
738
- */
739
- transformSuggestions?: (suggestions: string[]) => string[];
730
+ /**
731
+ * The extracted string
732
+ */
733
+ extracted: string;
734
+ /**
735
+ * The function to convert the selected suggestion back
736
+ */
737
+ resolveReplacement: (suggestion: string) => Replacement;
738
+ /**
739
+ * The function to format suggestions
740
+ */
741
+ transformSuggestions?: (suggestions: string[]) => string[];
740
742
  }
741
743
  interface AutoCompleteExtractor {
742
- name: string;
743
- extract: (context: AutoCompleteExtractorContext) => Awaitable<AutoCompleteExtractorResult | null>;
744
- order?: number;
744
+ name: string;
745
+ extract: (context: AutoCompleteExtractorContext) => Awaitable<AutoCompleteExtractorResult | null>;
746
+ order?: number;
745
747
  }
746
748
  interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
747
- name: string;
748
- /**
749
- * Enforce the preset to be applied before or after other presets
750
- */
751
- enforce?: 'pre' | 'post';
752
- /**
753
- * Preset options for other tools like IDE to consume
754
- */
755
- options?: PresetOptions;
756
- /**
757
- * Apply prefix to all utilities and shortcuts
758
- */
759
- prefix?: string | string[];
760
- /**
761
- * Apply layer to all utilities and shortcuts
762
- */
763
- layer?: string;
764
- /**
765
- * Custom API endpoint for cross-preset communication
766
- */
767
- api?: any;
768
- /**
769
- * Custom metadata for the preset
770
- */
771
- meta?: Record<string, any>;
749
+ name: string;
750
+ /**
751
+ * Enforce the preset to be applied before or after other presets
752
+ */
753
+ enforce?: 'pre' | 'post';
754
+ /**
755
+ * Preset options for other tools like IDE to consume
756
+ */
757
+ options?: PresetOptions;
758
+ /**
759
+ * Apply prefix to all utilities and shortcuts
760
+ */
761
+ prefix?: string | string[];
762
+ /**
763
+ * Apply layer to all utilities and shortcuts
764
+ */
765
+ layer?: string;
766
+ /**
767
+ * Custom API endpoint for cross-preset communication
768
+ */
769
+ api?: any;
770
+ /**
771
+ * Custom metadata for the preset
772
+ */
773
+ meta?: Record<string, any>;
772
774
  }
773
- type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
774
- type PresetFactoryAwaitable<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Awaitable<Preset<Theme>>;
775
+ type PresetFactory<Theme extends object = object, PresetOptions$1 extends object | undefined = undefined> = (options?: PresetOptions$1) => Preset<Theme>;
776
+ type PresetFactoryAwaitable<Theme extends object = object, PresetOptions$1 extends object | undefined = undefined> = (options?: PresetOptions$1) => Awaitable<Preset<Theme>>;
775
777
  type PresetOrFactory<Theme extends object = object> = Preset<Theme> | PresetFactory<Theme, any>;
776
778
  type PresetOrFactoryAwaitable<Theme extends object = object> = PresetOrFactory<Theme> | Promise<Preset<Theme>> | PresetFactoryAwaitable<Theme>;
777
779
  interface GeneratorOptions {
778
- /**
779
- * Merge utilities with the exact same body to save the file size
780
- *
781
- * @default true
782
- */
783
- mergeSelectors?: boolean;
784
- /**
785
- * Emit warning when matched selectors are presented in blocklist
786
- *
787
- * @default true
788
- */
789
- warn?: boolean;
780
+ /**
781
+ * Merge utilities with the exact same body to save the file size
782
+ *
783
+ * @default true
784
+ */
785
+ mergeSelectors?: boolean;
786
+ /**
787
+ * Emit warning when matched selectors are presented in blocklist
788
+ *
789
+ * @default true
790
+ */
791
+ warn?: boolean;
790
792
  }
791
793
  interface UserOnlyOptions<Theme extends object = object> {
792
- /**
793
- * The theme object, will be merged with the theme provides by presets
794
- */
795
- theme?: Theme;
796
- /**
797
- * Layout name of shortcuts
798
- *
799
- * @default 'shortcuts'
800
- */
801
- shortcutsLayer?: string;
802
- /**
803
- * Environment mode
804
- *
805
- * @default 'build'
806
- */
807
- envMode?: 'dev' | 'build';
808
- /**
809
- * legacy.renderModernChunks need to be consistent with @vitejs/plugin-legacy
810
- */
811
- legacy?: {
812
- renderModernChunks: boolean;
813
- };
814
- /**
815
- * Custom prefix for virtual modules
816
- *
817
- * @default '__uno'
818
- */
819
- virtualModulePrefix?: string;
794
+ /**
795
+ * The theme object, will be merged with the theme provides by presets
796
+ */
797
+ theme?: Theme;
798
+ /**
799
+ * Layout name of shortcuts
800
+ *
801
+ * @default 'shortcuts'
802
+ */
803
+ shortcutsLayer?: string;
804
+ /**
805
+ * Environment mode
806
+ *
807
+ * @default 'build'
808
+ */
809
+ envMode?: 'dev' | 'build';
810
+ /**
811
+ * legacy.renderModernChunks need to be consistent with @vitejs/plugin-legacy
812
+ */
813
+ legacy?: {
814
+ renderModernChunks: boolean;
815
+ };
816
+ /**
817
+ * Custom prefix for virtual modules
818
+ *
819
+ * @default '__uno'
820
+ */
821
+ virtualModulePrefix?: string;
820
822
  }
821
823
  /**
822
824
  * For unocss-cli config
823
825
  */
824
826
  interface CliOptions {
825
- cli?: {
826
- entry?: Arrayable<CliEntryItem>;
827
- };
827
+ cli?: {
828
+ entry?: Arrayable<CliEntryItem>;
829
+ };
828
830
  }
829
831
  interface UnocssPluginContext<Config extends UserConfig = UserConfig> {
830
- /**
831
- * Singleton promise for config loading
832
- */
833
- ready: Promise<LoadConfigResult<Config>>;
834
- /**
835
- * The UnoCSS generator instance. Should be used after `ready` resolved.
836
- */
837
- uno: UnoGenerator;
838
- /**
839
- * All tokens scanned
840
- */
841
- tokens: Set<string>;
842
- /**
843
- * Map for all module's raw content
844
- */
845
- modules: BetterMap<string, string>;
846
- /**
847
- * Module IDs that been affected by UnoCSS
848
- */
849
- affectedModules: Set<string>;
850
- /**
851
- * Pending promises
852
- */
853
- tasks: Promise<any>[];
854
- /**
855
- * Await all pending tasks
856
- */
857
- flushTasks: () => Promise<any>;
858
- filter: (code: string, id: string) => boolean;
859
- extract: (code: string, id?: string) => Promise<void>;
860
- reloadConfig: () => Promise<LoadConfigResult<Config>>;
861
- getConfig: () => Promise<Config>;
862
- onReload: (fn: () => void) => void;
863
- invalidate: () => void;
864
- onInvalidate: (fn: () => void) => void;
865
- root: string;
866
- updateRoot: (root: string) => Promise<LoadConfigResult<Config>>;
867
- getConfigFileList: () => string[];
868
- /**
869
- * Get regexes to match virtual module ids
870
- */
871
- getVMPRegexes: () => Promise<{
872
- prefix: string;
873
- RESOLVED_ID_WITH_QUERY_RE: RegExp;
874
- RESOLVED_ID_RE: RegExp;
875
- }>;
832
+ /**
833
+ * Singleton promise for config loading
834
+ */
835
+ ready: Promise<LoadConfigResult<Config>>;
836
+ /**
837
+ * The UnoCSS generator instance. Should be used after `ready` resolved.
838
+ */
839
+ uno: UnoGenerator;
840
+ /**
841
+ * All tokens scanned
842
+ */
843
+ tokens: Set<string>;
844
+ /**
845
+ * Map for all module's raw content
846
+ */
847
+ modules: BetterMap<string, string>;
848
+ /**
849
+ * Module IDs that been affected by UnoCSS
850
+ */
851
+ affectedModules: Set<string>;
852
+ /**
853
+ * Pending promises
854
+ */
855
+ tasks: Promise<any>[];
856
+ /**
857
+ * Await all pending tasks
858
+ */
859
+ flushTasks: () => Promise<any>;
860
+ filter: (code: string, id: string) => boolean;
861
+ extract: (code: string, id?: string) => Promise<void>;
862
+ reloadConfig: () => Promise<LoadConfigResult<Config>>;
863
+ getConfig: () => Promise<Config>;
864
+ onReload: (fn: () => void) => void;
865
+ invalidate: () => void;
866
+ onInvalidate: (fn: () => void) => void;
867
+ root: string;
868
+ updateRoot: (root: string) => Promise<LoadConfigResult<Config>>;
869
+ getConfigFileList: () => string[];
870
+ /**
871
+ * Get regexes to match virtual module ids
872
+ */
873
+ getVMPRegexes: () => Promise<{
874
+ prefix: string;
875
+ RESOLVED_ID_WITH_QUERY_RE: RegExp;
876
+ RESOLVED_ID_RE: RegExp;
877
+ }>;
876
878
  }
877
879
  interface SourceMap {
878
- file?: string;
879
- mappings?: string;
880
- names?: string[];
881
- sources?: string[];
882
- sourcesContent?: string[];
883
- version?: number;
880
+ file?: string;
881
+ mappings?: string;
882
+ names?: string[];
883
+ sources?: string[];
884
+ sourcesContent?: string[];
885
+ version?: number;
884
886
  }
885
887
  interface HighlightAnnotation {
886
- offset: number;
887
- length: number;
888
- className: string;
888
+ offset: number;
889
+ length: number;
890
+ className: string;
889
891
  }
890
892
  type SourceCodeTransformerEnforce = 'pre' | 'post' | 'default';
891
893
  interface SourceCodeTransformer {
892
- name: string;
893
- /**
894
- * The order of transformer
895
- */
896
- enforce?: SourceCodeTransformerEnforce;
897
- /**
898
- * Custom id filter, if not provided, the extraction filter will be applied
899
- */
900
- idFilter?: (id: string) => boolean;
901
- /**
902
- * The transform function
903
- */
904
- transform: (code: MagicString, id: string, ctx: UnocssPluginContext) => Awaitable<{
905
- highlightAnnotations?: HighlightAnnotation[];
906
- } | void>;
894
+ name: string;
895
+ /**
896
+ * The order of transformer
897
+ */
898
+ enforce?: SourceCodeTransformerEnforce;
899
+ /**
900
+ * Custom id filter, if not provided, the extraction filter will be applied
901
+ */
902
+ idFilter?: (id: string) => boolean;
903
+ /**
904
+ * The transform function
905
+ */
906
+ transform: (code: MagicString, id: string, ctx: UnocssPluginContext) => Awaitable<{
907
+ highlightAnnotations?: HighlightAnnotation[];
908
+ } | void>;
907
909
  }
908
910
  interface ContentOptions {
909
- /**
910
- * Glob patterns to extract from the file system, in addition to other content sources.
911
+ /**
912
+ * Glob patterns to extract from the file system, in addition to other content sources.
913
+ *
914
+ * In dev mode, the files will be watched and trigger HMR.
915
+ *
916
+ * @default []
917
+ */
918
+ filesystem?: string[];
919
+ /**
920
+ * Inline text to be extracted
921
+ */
922
+ inline?: (string | {
923
+ code: string;
924
+ id?: string;
925
+ } | (() => Awaitable<string | {
926
+ code: string;
927
+ id?: string;
928
+ }>))[];
929
+ /**
930
+ * Filters to determine whether to extract certain modules from the build tools' transformation pipeline.
931
+ *
932
+ * Currently only works for Vite and Webpack integration.
933
+ *
934
+ * Set `false` to disable.
935
+ */
936
+ pipeline?: false | {
937
+ /**
938
+ * Patterns that filter the files being extracted.
939
+ * Supports regular expressions and `picomatch` glob patterns.
911
940
  *
912
- * In dev mode, the files will be watched and trigger HMR.
941
+ * By default, `.ts` and `.js` files are NOT extracted.
913
942
  *
914
- * @default []
943
+ * @see https://www.npmjs.com/package/picomatch
944
+ * @default [/\.(vue|svelte|[jt]sx|vine.ts|mdx?|astro|elm|php|phtml|marko|html)($|\?)/]
915
945
  */
916
- filesystem?: string[];
946
+ include?: FilterPattern;
917
947
  /**
918
- * Inline text to be extracted
919
- */
920
- inline?: (string | {
921
- code: string;
922
- id?: string;
923
- } | (() => Awaitable<string | {
924
- code: string;
925
- id?: string;
926
- }>))[];
927
- /**
928
- * Filters to determine whether to extract certain modules from the build tools' transformation pipeline.
948
+ * Patterns that filter the files NOT being extracted.
949
+ * Supports regular expressions and `picomatch` glob patterns.
929
950
  *
930
- * Currently only works for Vite and Webpack integration.
951
+ * By default, `node_modules` and `dist` are also extracted.
931
952
  *
932
- * Set `false` to disable.
953
+ * @see https://www.npmjs.com/package/picomatch
954
+ * @default [/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/]
933
955
  */
934
- pipeline?: false | {
935
- /**
936
- * Patterns that filter the files being extracted.
937
- * Supports regular expressions and `picomatch` glob patterns.
938
- *
939
- * By default, `.ts` and `.js` files are NOT extracted.
940
- *
941
- * @see https://www.npmjs.com/package/picomatch
942
- * @default [/\.(vue|svelte|[jt]sx|vine.ts|mdx?|astro|elm|php|phtml|marko|html)($|\?)/]
943
- */
944
- include?: FilterPattern;
945
- /**
946
- * Patterns that filter the files NOT being extracted.
947
- * Supports regular expressions and `picomatch` glob patterns.
948
- *
949
- * By default, `node_modules` and `dist` are also extracted.
950
- *
951
- * @see https://www.npmjs.com/package/picomatch
952
- * @default [/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/]
953
- */
954
- exclude?: FilterPattern;
955
- };
956
+ exclude?: FilterPattern;
957
+ };
956
958
  }
957
959
  /**
958
960
  * For other modules to aggregate the options
959
961
  */
960
962
  interface PluginOptions {
961
- /**
962
- * Load from configs files
963
- *
964
- * set `false` to disable
965
- */
966
- configFile?: string | false;
967
- /**
968
- * List of files that will also trigger config reloads
969
- */
970
- configDeps?: string[];
971
- /**
972
- * Custom transformers to the source code
973
- */
974
- transformers?: SourceCodeTransformer[];
975
- /**
976
- * Options for sources to be extracted as utilities usages
977
- *
978
- * Supported sources:
979
- * - `filesystem` - extract from file system
980
- * - `inline` - extract from plain inline text
981
- * - `pipeline` - extract from build tools' transformation pipeline, such as Vite and Webpack
982
- *
983
- * The usage extracted from each source will be **merged** together.
984
- */
985
- content?: ContentOptions;
986
- }
987
- interface UserConfig<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme>, GeneratorOptions, PluginOptions, CliOptions {
988
- }
989
- interface UserConfigDefaults<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme> {
963
+ /**
964
+ * Load from configs files
965
+ *
966
+ * set `false` to disable
967
+ */
968
+ configFile?: string | false;
969
+ /**
970
+ * List of files that will also trigger config reloads
971
+ */
972
+ configDeps?: string[];
973
+ /**
974
+ * Custom transformers to the source code
975
+ */
976
+ transformers?: SourceCodeTransformer[];
977
+ /**
978
+ * Options for sources to be extracted as utilities usages
979
+ *
980
+ * Supported sources:
981
+ * - `filesystem` - extract from file system
982
+ * - `inline` - extract from plain inline text
983
+ * - `pipeline` - extract from build tools' transformation pipeline, such as Vite and Webpack
984
+ *
985
+ * The usage extracted from each source will be **merged** together.
986
+ */
987
+ content?: ContentOptions;
990
988
  }
989
+ interface UserConfig<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme>, GeneratorOptions, PluginOptions, CliOptions {}
990
+ interface UserConfigDefaults<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme> {}
991
991
  interface ResolvedConfig<Theme extends object = object> extends Omit<RequiredByKey<UserConfig<Theme>, 'mergeSelectors' | 'theme' | 'rules' | 'variants' | 'layers' | 'extractors' | 'blocklist' | 'safelist' | 'preflights' | 'sortLayers'>, 'rules' | 'shortcuts' | 'autocomplete' | 'presets'> {
992
- presets: Preset<Theme>[];
993
- shortcuts: Shortcut<Theme>[];
994
- variants: VariantObject<Theme>[];
995
- preprocess: Preprocessor[];
996
- postprocess: Postprocessor[];
997
- rulesSize: number;
998
- rules: readonly Rule<Theme>[];
999
- rulesDynamic: readonly DynamicRule<Theme>[];
1000
- rulesStaticMap: Record<string, StaticRule | undefined>;
1001
- autocomplete: {
1002
- templates: (AutoCompleteFunction | AutoCompleteTemplate)[];
1003
- extractors: AutoCompleteExtractor[];
1004
- shorthands: Record<string, string>;
1005
- };
1006
- separators: string[];
992
+ presets: Preset<Theme>[];
993
+ shortcuts: Shortcut<Theme>[];
994
+ variants: VariantObject<Theme>[];
995
+ preprocess: Preprocessor[];
996
+ postprocess: Postprocessor[];
997
+ rulesSize: number;
998
+ rules: readonly Rule<Theme>[];
999
+ rulesDynamic: readonly DynamicRule<Theme>[];
1000
+ rulesStaticMap: Record<string, StaticRule | undefined>;
1001
+ autocomplete: {
1002
+ templates: (AutoCompleteFunction | AutoCompleteTemplate)[];
1003
+ extractors: AutoCompleteExtractor[];
1004
+ shorthands: Record<string, string>;
1005
+ };
1006
+ separators: string[];
1007
1007
  }
1008
1008
  interface GenerateResult<T = Set<string>> {
1009
- css: string;
1010
- layers: string[];
1011
- getLayer: (name?: string) => string | undefined;
1012
- getLayers: (includes?: string[], excludes?: string[]) => string;
1013
- setLayer: (layer: string, callback: (content: string) => Promise<string>) => Promise<string>;
1014
- matched: T;
1009
+ css: string;
1010
+ layers: string[];
1011
+ getLayer: (name?: string) => string | undefined;
1012
+ getLayers: (includes?: string[], excludes?: string[]) => string;
1013
+ setLayer: (layer: string, callback: (content: string) => Promise<string>) => Promise<string>;
1014
+ matched: T;
1015
1015
  }
1016
- type VariantMatchedResult<Theme extends object = object> = [
1017
- raw: string,
1018
- current: string,
1019
- variantHandlers: VariantHandler[],
1020
- variants: Set<Variant<Theme>>
1021
- ];
1022
- type ParsedUtil = readonly [
1023
- index: number,
1024
- raw: string,
1025
- entries: CSSEntries,
1026
- meta: RuleMeta | undefined,
1027
- variantHandlers: VariantHandler[]
1028
- ];
1029
- type RawUtil = readonly [
1030
- index: number,
1031
- rawCSS: string,
1032
- meta: RuleMeta | undefined
1033
- ];
1034
- type StringifiedUtil<Theme extends object = object> = readonly [
1035
- index: number,
1036
- selector: string | undefined,
1037
- body: string,
1038
- parent: string | undefined,
1039
- meta: RuleMeta | undefined,
1040
- context: RuleContext<Theme> | undefined,
1041
- noMerge: boolean | undefined
1042
- ];
1043
- type PreparedRule = readonly [
1044
- selector: [string, number][],
1045
- body: string,
1046
- noMerge: boolean
1047
- ];
1016
+ type VariantMatchedResult<Theme extends object = object> = [raw: string, current: string, variantHandlers: VariantHandler[], variants: Set<Variant<Theme>>];
1017
+ type ParsedUtil = readonly [index: number, raw: string, entries: CSSEntries, meta: RuleMeta | undefined, variantHandlers: VariantHandler[]];
1018
+ type RawUtil = readonly [index: number, rawCSS: string, meta: RuleMeta | undefined];
1019
+ type StringifiedUtil<Theme extends object = object> = readonly [index: number, selector: string | undefined, body: string, parent: string | undefined, meta: RuleMeta | undefined, context: RuleContext<Theme> | undefined, noMerge: boolean | undefined];
1020
+ type PreparedRule = readonly [selector: [string, number][], body: string, noMerge: boolean];
1048
1021
  interface CliEntryItem {
1049
- patterns: string[];
1050
- outFile: string;
1022
+ patterns: string[];
1023
+ outFile: string;
1051
1024
  }
1052
1025
  interface UtilObject {
1053
- selector: string;
1054
- entries: CSSEntries;
1055
- parent: string | undefined;
1056
- layer: string | undefined;
1057
- sort: number | undefined;
1058
- noMerge: boolean | undefined;
1026
+ selector: string;
1027
+ entries: CSSEntries;
1028
+ parent: string | undefined;
1029
+ layer: string | undefined;
1030
+ sort: number | undefined;
1031
+ noMerge: boolean | undefined;
1059
1032
  }
1060
1033
  /**
1061
1034
  * Returned from `uno.generate()` when `extendedInfo` option is enabled.
1062
1035
  */
1063
1036
  interface ExtendedTokenInfo<Theme extends object = object> {
1064
- /**
1065
- * Stringified util data
1066
- */
1067
- data: StringifiedUtil<Theme>[];
1068
- /**
1069
- * Return -1 if the data structure is not countable
1070
- */
1071
- count: number;
1037
+ /**
1038
+ * Stringified util data
1039
+ */
1040
+ data: StringifiedUtil<Theme>[];
1041
+ /**
1042
+ * Return -1 if the data structure is not countable
1043
+ */
1044
+ count: number;
1072
1045
  }
1073
1046
  interface GenerateOptions<T extends boolean> {
1074
- /**
1075
- * Filepath of the file being processed.
1076
- */
1077
- id?: string;
1078
- /**
1079
- * Generate preflights (if defined)
1080
- *
1081
- * @default true
1082
- */
1083
- preflights?: boolean;
1084
- /**
1085
- * Includes safelist
1086
- */
1087
- safelist?: boolean;
1088
- /**
1089
- * Generate minified CSS
1090
- * @default false
1091
- */
1092
- minify?: boolean;
1093
- /**
1094
- * @experimental
1095
- */
1096
- scope?: string;
1097
- /**
1098
- * If return extended "matched" with payload and count
1099
- */
1100
- extendedInfo?: T;
1047
+ /**
1048
+ * Filepath of the file being processed.
1049
+ */
1050
+ id?: string;
1051
+ /**
1052
+ * Generate preflights (if defined)
1053
+ *
1054
+ * @default true
1055
+ */
1056
+ preflights?: boolean;
1057
+ /**
1058
+ * Includes safelist
1059
+ */
1060
+ safelist?: boolean;
1061
+ /**
1062
+ * Generate minified CSS
1063
+ * @default false
1064
+ */
1065
+ minify?: boolean;
1066
+ /**
1067
+ * @experimental
1068
+ */
1069
+ scope?: string;
1070
+ /**
1071
+ * If return extended "matched" with payload and count
1072
+ */
1073
+ extendedInfo?: T;
1101
1074
  }
1102
-
1075
+ //#endregion
1076
+ //#region src/config.d.ts
1103
1077
  declare function resolveShortcuts<Theme extends object = object>(shortcuts: UserShortcuts<Theme>): Shortcut<Theme>[];
1104
1078
  /**
1105
1079
  * Resolve a single preset, nested presets are ignored
@@ -1117,21 +1091,22 @@ declare function mergeConfigs<Theme extends object = object>(configs: UserConfig
1117
1091
  declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactory<Theme, Options>): PresetFactory<Theme, Options>;
1118
1092
  declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactoryAwaitable<Theme, Options>): PresetFactoryAwaitable<Theme, Options>;
1119
1093
  declare function definePreset<Theme extends object = object>(preset: Preset<Theme>): Preset<Theme>;
1120
-
1094
+ //#endregion
1095
+ //#region src/constants.d.ts
1121
1096
  declare const LAYER_DEFAULT = "default";
1122
1097
  declare const LAYER_PREFLIGHTS = "preflights";
1123
1098
  declare const LAYER_SHORTCUTS = "shortcuts";
1124
1099
  declare const LAYER_IMPORTS = "imports";
1125
1100
  declare const DEFAULT_LAYERS: {
1126
- imports: number;
1127
- preflights: number;
1128
- shortcuts: number;
1129
- default: number;
1101
+ imports: number;
1102
+ preflights: number;
1103
+ shortcuts: number;
1104
+ default: number;
1130
1105
  };
1131
-
1106
+ //#endregion
1107
+ //#region src/extractors/split.d.ts
1132
1108
  declare const defaultSplitRE: RegExp;
1133
1109
  declare const splitWithVariantGroupRE: RegExp;
1134
1110
  declare const extractorSplit: Extractor;
1135
-
1136
- export { BetterMap, CountableSet, DEFAULT_LAYERS, Emitter, LAYER_DEFAULT, LAYER_IMPORTS, LAYER_PREFLIGHTS, LAYER_SHORTCUTS, TwoKeyMap, UnoGenerator, VirtualKey, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
1137
- export type { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BaseContext, BlocklistMeta, BlocklistRule, BlocklistValue, CSSEntries, CSSEntriesInput, CSSEntry, CSSObject, CSSObjectInput, CSSValue, CSSValueInput, CSSValues, CliEntryItem, CliOptions, ConfigBase, ContentOptions, ControlSymbols, ControlSymbolsEntry, ControlSymbolsValue, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, ObjectToEntry, OutputCssLayersOptions, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedRule, Preprocessor, Preset, PresetFactory, PresetFactoryAwaitable, PresetOptions, PresetOrFactory, PresetOrFactoryAwaitable, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, SafeListContext, Shift, Shortcut, ShortcutInlineValue, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, ToArray, UnocssPluginContext, Unsubscribe, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject };
1111
+ //#endregion
1112
+ export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BaseContext, BetterMap, BlocklistMeta, BlocklistRule, BlocklistValue, CSSEntries, CSSEntriesInput, CSSEntry, CSSObject, CSSObjectInput, CSSValue, CSSValueInput, CSSValues, CliEntryItem, CliOptions, ConfigBase, ContentOptions, ControlSymbols, ControlSymbolsEntry, ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Emitter, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, LAYER_DEFAULT, LAYER_IMPORTS, LAYER_PREFLIGHTS, LAYER_SHORTCUTS, ObjectToEntry, OutputCssLayersOptions, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedRule, Preprocessor, Preset, PresetFactory, PresetFactoryAwaitable, PresetOptions, PresetOrFactory, PresetOrFactoryAwaitable, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, SafeListContext, Shift, Shortcut, ShortcutInlineValue, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, ToArray, TwoKeyMap, UnoGenerator, UnocssPluginContext, Unsubscribe, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, VirtualKey, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };