@unocss/core 66.10.3 → 66.10.5

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,13 +1,13 @@
1
1
  import MagicString from "magic-string";
2
2
  import { LoadConfigResult } from "unconfig";
3
3
  //#region src/utils/basic.d.ts
4
- declare function toArray<T>(value?: T | T[]): T[];
5
- declare function uniq<T>(value: T[]): T[];
6
- declare function uniqueBy<T>(array: readonly T[], equalFn: (a: T, b: T) => boolean): T[];
7
- declare function isString(s: any): s is string;
4
+ export declare function toArray<T>(value?: T | T[]): T[];
5
+ export declare function uniq<T>(value: T[]): T[];
6
+ export declare function uniqueBy<T>(array: readonly T[], equalFn: (a: T, b: T) => boolean): T[];
7
+ export declare function isString(s: any): s is string;
8
8
  //#endregion
9
9
  //#region src/utils/countable-set.d.ts
10
- declare class CountableSet<K> extends Set<K> {
10
+ export declare class CountableSet<K> extends Set<K> {
11
11
  _map: Map<K, number>;
12
12
  constructor(values?: Iterable<K>);
13
13
  add(key: K): this;
@@ -16,25 +16,25 @@ declare class CountableSet<K> extends Set<K> {
16
16
  getCount(key: K): number;
17
17
  setCount(key: K, count: number): this;
18
18
  }
19
- declare function isCountableSet<T = string>(value: any): value is CountableSet<T>;
19
+ export declare function isCountableSet<T = string>(value: any): value is CountableSet<T>;
20
20
  //#endregion
21
21
  //#region src/utils/escape.d.ts
22
- declare function escapeRegExp(string: string): string;
22
+ export declare function escapeRegExp(string: string): string;
23
23
  /**
24
24
  * CSS Selector Escape
25
25
  */
26
- declare function escapeSelector(str: string): string;
27
- declare const e: typeof escapeSelector;
26
+ export declare function escapeSelector(str: string): string;
27
+ export declare const e: typeof escapeSelector;
28
28
  //#endregion
29
29
  //#region src/utils/events.d.ts
30
30
  type EventsMap = Record<string, any>;
31
31
  interface DefaultEvents extends EventsMap {
32
32
  [event: string]: (...args: any) => void;
33
33
  }
34
- interface Unsubscribe {
34
+ export interface Unsubscribe {
35
35
  (): void;
36
36
  }
37
- declare class Emitter<Events extends EventsMap = DefaultEvents> {
37
+ export declare class Emitter<Events extends EventsMap = DefaultEvents> {
38
38
  /**
39
39
  * Event names in keys and arrays with listeners in values.
40
40
  *
@@ -93,24 +93,24 @@ declare class Emitter<Events extends EventsMap = DefaultEvents> {
93
93
  * }
94
94
  * ```
95
95
  */
96
- declare function createNanoEvents<Events extends EventsMap = DefaultEvents>(): Emitter<Events>;
96
+ export declare function createNanoEvents<Events extends EventsMap = DefaultEvents>(): Emitter<Events>;
97
97
  //#endregion
98
98
  //#region src/utils/helpers.d.ts
99
- declare const attributifyRE: RegExp;
100
- declare const cssIdRE: RegExp;
101
- declare const validateFilterRE: RegExp;
102
- declare function isAttributifySelector(selector: string): RegExpMatchArray | null;
103
- declare function isValidSelector(selector?: string): selector is string;
104
- declare function normalizeVariant(variant: Variant<any>): VariantObject<any>;
105
- declare function isRawUtil(util: ParsedUtil | RawUtil | StringifiedUtil): util is RawUtil;
106
- declare function notNull<T>(value: T | null | undefined): value is T;
107
- declare function noop(): void;
99
+ export declare const attributifyRE: RegExp;
100
+ export declare const cssIdRE: RegExp;
101
+ export declare const validateFilterRE: RegExp;
102
+ export declare function isAttributifySelector(selector: string): RegExpMatchArray | null;
103
+ export declare function isValidSelector(selector?: string): selector is string;
104
+ export declare function normalizeVariant(variant: Variant<any>): VariantObject<any>;
105
+ export declare function isRawUtil(util: ParsedUtil | RawUtil | StringifiedUtil): util is RawUtil;
106
+ export declare function notNull<T>(value: T | null | undefined): value is T;
107
+ export declare function noop(): void;
108
108
  //#endregion
109
109
  //#region src/utils/layer.d.ts
110
- declare function withLayer<T extends object>(layer: string, rules: Rule<T>[]): Rule<T>[];
110
+ export declare function withLayer<T extends object>(layer: string, rules: Rule<T>[]): Rule<T>[];
111
111
  //#endregion
112
112
  //#region src/utils/map.d.ts
113
- declare class TwoKeyMap<K1, K2, V> {
113
+ export declare class TwoKeyMap<K1, K2, V> {
114
114
  _map: Map<K1, Map<K2, V>>;
115
115
  get(key1: K1, key2: K2): V | undefined;
116
116
  getFallback(key1: K1, key2: K2, fallback: V): V;
@@ -120,48 +120,48 @@ declare class TwoKeyMap<K1, K2, V> {
120
120
  deleteTop(key1: K1): boolean;
121
121
  map<T>(fn: (v: V, k1: K1, k2: K2) => T): T[];
122
122
  }
123
- declare class BetterMap<K, V> extends Map<K, V> {
123
+ export declare class BetterMap<K, V> extends Map<K, V> {
124
124
  getFallback(key: K, fallback: V): V;
125
125
  map<R>(mapFn: (value: V, key: K) => R): R[];
126
126
  flatMap<R extends readonly unknown[]>(mapFn: (value: V, key: K) => R): R[number][];
127
127
  }
128
128
  //#endregion
129
129
  //#region src/utils/object.d.ts
130
- declare function normalizeCSSEntries(obj: string | CSSEntriesInput | CSSObjectInput): string | CSSEntries;
131
- declare function normalizeCSSValues(obj: CSSValueInput | string | (CSSValueInput | string)[]): (string | CSSEntries)[];
132
- declare function clearIdenticalEntries(entry: CSSEntries): CSSEntries;
133
- declare const VirtualKey = "__virtual_key__";
134
- declare function entriesToCss(arr?: CSSEntries): string;
135
- declare function isObject(item: any): item is Record<string, any>;
130
+ export declare function normalizeCSSEntries(obj: string | CSSEntriesInput | CSSObjectInput): string | CSSEntries;
131
+ export declare function normalizeCSSValues(obj: CSSValueInput | string | (CSSValueInput | string)[]): (string | CSSEntries)[];
132
+ export declare function clearIdenticalEntries(entry: CSSEntries): CSSEntries;
133
+ export declare const VirtualKey = "__virtual_key__";
134
+ export declare function entriesToCss(arr?: CSSEntries): string;
135
+ export declare function isObject(item: any): item is Record<string, any>;
136
136
  /**
137
137
  * Deep merge two objects
138
138
  */
139
- declare function mergeDeep<T>(original: T, patch: DeepPartial<T>, mergeArray?: boolean): T;
140
- declare function clone<T>(val: T): T;
141
- declare function isStaticRule(rule: Rule<any>): rule is StaticRule;
142
- declare function isStaticShortcut(sc: Shortcut<any>): sc is StaticShortcut;
139
+ export declare function mergeDeep<T>(original: T, patch: DeepPartial<T>, mergeArray?: boolean): T;
140
+ export declare function clone<T>(val: T): T;
141
+ export declare function isStaticRule(rule: Rule<any>): rule is StaticRule;
142
+ export declare function isStaticShortcut(sc: Shortcut<any>): sc is StaticShortcut;
143
143
  //#endregion
144
144
  //#region src/utils/variant-group.d.ts
145
- declare function makeRegexClassGroup(separators?: string[]): RegExp;
145
+ export declare function makeRegexClassGroup(separators?: string[]): RegExp;
146
146
  interface VariantGroup {
147
147
  length: number;
148
148
  items: HighlightAnnotation[];
149
149
  }
150
- declare function parseVariantGroup(str: string | MagicString, separators?: string[], depth?: number): {
150
+ export declare function parseVariantGroup(str: string | MagicString, separators?: string[], depth?: number): {
151
151
  prefixes: string[];
152
152
  hasChanged: boolean;
153
153
  groupsByOffset: Map<number, VariantGroup>;
154
154
  readonly expanded: string;
155
155
  };
156
- declare function collapseVariantGroup(str: string, prefixes: string[]): string;
157
- declare function expandVariantGroup(str: string, separators?: string[], depth?: number): string;
158
- declare function expandVariantGroup(str: MagicString, separators?: string[], depth?: number): MagicString;
156
+ export declare function collapseVariantGroup(str: string, prefixes: string[]): string;
157
+ export declare function expandVariantGroup(str: string, separators?: string[], depth?: number): string;
158
+ export declare function expandVariantGroup(str: MagicString, separators?: string[], depth?: number): MagicString;
159
159
  //#endregion
160
160
  //#region src/utils/warn.d.ts
161
- declare function warnOnce(msg: string): void;
161
+ export declare function warnOnce(msg: string): void;
162
162
  //#endregion
163
163
  //#region src/generator.d.ts
164
- declare const symbols: ControlSymbols;
164
+ export declare const symbols: ControlSymbols;
165
165
  declare class UnoGeneratorInternal<Theme extends object = object> {
166
166
  userConfig: UserConfig<Theme>;
167
167
  defaults: UserConfigDefaults<Theme>;
@@ -199,41 +199,41 @@ declare class UnoGeneratorInternal<Theme extends object = object> {
199
199
  isBlocked(raw: string): boolean;
200
200
  getBlocked(raw: string): [BlocklistValue, BlocklistMeta | undefined] | undefined;
201
201
  }
202
- declare class UnoGenerator<Theme extends object = object> extends UnoGeneratorInternal<Theme> {
202
+ export declare class UnoGenerator<Theme extends object = object> extends UnoGeneratorInternal<Theme> {
203
203
  /**
204
204
  * @deprecated `new UnoGenerator` is deprecated, please use `createGenerator()` instead
205
205
  */
206
206
  constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
207
207
  }
208
- declare function createGenerator<Theme extends object = object>(config?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<UnoGenerator<Theme>>;
209
- declare const regexScopePlaceholder: RegExp;
210
- declare function hasScopePlaceholder(css: string): boolean;
211
- declare function toEscapedSelector(raw: string): string;
208
+ export declare function createGenerator<Theme extends object = object>(config?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<UnoGenerator<Theme>>;
209
+ export declare const regexScopePlaceholder: RegExp;
210
+ export declare function hasScopePlaceholder(css: string): boolean;
211
+ export declare function toEscapedSelector(raw: string): string;
212
212
  //#endregion
213
213
  //#region src/types.d.ts
214
- type Awaitable<T> = T | Promise<T>;
215
- type Arrayable<T> = T | T[];
216
- type ToArray<T> = T extends (infer U)[] ? U[] : T[];
217
- type ArgumentType<T> = T extends ((...args: infer A) => any) ? A : never;
218
- type Shift<T> = T extends [_: any, ...args: infer A] ? A : never;
219
- type RestArgs<T> = Shift<ArgumentType<T>>;
220
- type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]>; };
221
- type FlatObjectTuple<T> = { [K in keyof T]: T[K]; };
222
- type PartialByKeys<T, K extends keyof T = keyof T> = FlatObjectTuple<Partial<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
223
- type RequiredByKey<T, K extends keyof T = keyof T> = FlatObjectTuple<Required<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
224
- type CSSObject = Record<string, string | number | undefined>;
214
+ export type Awaitable<T> = T | Promise<T>;
215
+ export type Arrayable<T> = T | T[];
216
+ export type ToArray<T> = T extends (infer U)[] ? U[] : T[];
217
+ export type ArgumentType<T> = T extends ((...args: infer A) => any) ? A : never;
218
+ export type Shift<T> = T extends [_: any, ...args: infer A] ? A : never;
219
+ export type RestArgs<T> = Shift<ArgumentType<T>>;
220
+ export type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]>; };
221
+ export type FlatObjectTuple<T> = { [K in keyof T]: T[K]; };
222
+ export type PartialByKeys<T, K extends keyof T = keyof T> = FlatObjectTuple<Partial<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
223
+ export type RequiredByKey<T, K extends keyof T = keyof T> = FlatObjectTuple<Required<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
224
+ export type CSSObject = Record<string, string | number | undefined>;
225
225
  /**
226
226
  * [property, value, operators?]
227
227
  *
228
228
  * - operators: Used to perform specific operations on value or property.
229
229
  */
230
- type CSSEntry = [string, string | number | undefined, Arrayable<string>?];
231
- type CSSEntries = CSSEntry[];
232
- type CSSObjectInput = CSSObject | Partial<ControlSymbolsValue>;
233
- type CSSEntriesInput = (CSSEntry | ControlSymbolsEntry)[];
234
- type CSSValueInput = CSSObjectInput | CSSEntriesInput | CSSValue;
235
- type PresetOptions = Record<string, any>;
236
- interface RuleContext<Theme extends object = object> {
230
+ export type CSSEntry = [string, string | number | undefined, Arrayable<string>?];
231
+ export type CSSEntries = CSSEntry[];
232
+ export type CSSObjectInput = CSSObject | Partial<ControlSymbolsValue>;
233
+ export type CSSEntriesInput = (CSSEntry | ControlSymbolsEntry)[];
234
+ export type CSSValueInput = CSSObjectInput | CSSEntriesInput | CSSValue;
235
+ export type PresetOptions = Record<string, any>;
236
+ export interface RuleContext<Theme extends object = object> {
237
237
  /**
238
238
  * Unprocessed selector from user input.
239
239
  * Useful for generating CSS rule.
@@ -290,7 +290,7 @@ declare const SymbolSelector: unique symbol;
290
290
  declare const SymbolLayer: unique symbol;
291
291
  declare const SymbolSort: unique symbol;
292
292
  declare const SymbolBody: unique symbol;
293
- interface ControlSymbols {
293
+ export interface ControlSymbols {
294
294
  /**
295
295
  * Prevent merging in shortcuts
296
296
  */
@@ -328,7 +328,7 @@ interface ControlSymbols {
328
328
  */
329
329
  body: typeof SymbolBody;
330
330
  }
331
- interface ControlSymbolsValue {
331
+ export interface ControlSymbolsValue {
332
332
  [SymbolShortcutsNoMerge]: true;
333
333
  [SymbolNoMerge]: true;
334
334
  [SymbolNoScope]: true;
@@ -339,9 +339,9 @@ interface ControlSymbolsValue {
339
339
  [SymbolSort]: number;
340
340
  [SymbolBody]: string;
341
341
  }
342
- type ObjectToEntry<T> = { [K in keyof T]: [K, T[K]]; }[keyof T];
343
- type ControlSymbolsEntry = ObjectToEntry<ControlSymbolsValue>;
344
- interface VariantContext<Theme extends object = object> {
342
+ export type ObjectToEntry<T> = { [K in keyof T]: [K, T[K]]; }[keyof T];
343
+ export type ControlSymbolsEntry = ObjectToEntry<ControlSymbolsValue>;
344
+ export interface VariantContext<Theme extends object = object> {
345
345
  /**
346
346
  * Unprocessed selector from user input.
347
347
  */
@@ -355,14 +355,14 @@ interface VariantContext<Theme extends object = object> {
355
355
  */
356
356
  theme: Theme;
357
357
  }
358
- interface ExtractorContext {
358
+ export interface ExtractorContext {
359
359
  readonly original: string;
360
360
  code: string;
361
361
  id?: string;
362
362
  extracted: Set<string> | CountableSet<string>;
363
363
  envMode?: 'dev' | 'build';
364
364
  }
365
- interface BaseContext<Theme extends object = object> {
365
+ export interface BaseContext<Theme extends object = object> {
366
366
  /**
367
367
  * UnoCSS generator instance
368
368
  */
@@ -372,9 +372,9 @@ interface BaseContext<Theme extends object = object> {
372
372
  */
373
373
  theme: Theme;
374
374
  }
375
- interface PreflightContext<Theme extends object = object> extends BaseContext<Theme> {}
376
- interface SafeListContext<Theme extends object = object> extends BaseContext<Theme> {}
377
- interface Extractor {
375
+ export interface PreflightContext<Theme extends object = object> extends BaseContext<Theme> {}
376
+ export interface SafeListContext<Theme extends object = object> extends BaseContext<Theme> {}
377
+ export interface Extractor {
378
378
  name: string;
379
379
  order?: number;
380
380
  /**
@@ -384,7 +384,7 @@ interface Extractor {
384
384
  */
385
385
  extract?: (ctx: ExtractorContext) => Awaitable<Set<string> | CountableSet<string> | string[] | undefined | void>;
386
386
  }
387
- interface RuleMeta {
387
+ export interface RuleMeta {
388
388
  /**
389
389
  * The layer name of this rule.
390
390
  * @default 'default'
@@ -435,37 +435,37 @@ interface RuleMeta {
435
435
  */
436
436
  custom?: Record<string, any>;
437
437
  }
438
- type CSSValue = CSSObject | CSSEntries;
439
- type CSSValues = CSSValue | CSSValue[];
440
- type DynamicMatcher<Theme extends object = object> = (match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => Awaitable<CSSValueInput | string | (CSSValueInput | string)[] | undefined> | Generator<CSSValueInput | string | undefined> | AsyncGenerator<CSSValueInput | string | undefined>;
441
- type DynamicRule<Theme extends object = object> = [RegExp, DynamicMatcher<Theme>, RuleMeta?];
442
- type StaticRule = [string, CSSObject | CSSEntries | (CSSValueInput | string)[], RuleMeta?];
443
- type Rule<Theme extends object = object> = DynamicRule<Theme> | StaticRule;
444
- type DynamicShortcutMatcher<Theme extends object = object> = ((match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => (string | ShortcutValue[] | undefined));
445
- type StaticShortcut = [string, string | ShortcutValue[], RuleMeta?];
446
- type StaticShortcutMap = Record<string, string | ShortcutValue[]>;
447
- type DynamicShortcut<Theme extends object = object> = [RegExp, DynamicShortcutMatcher<Theme>, RuleMeta?];
448
- type UserShortcuts<Theme extends object = object> = StaticShortcutMap | (StaticShortcut | DynamicShortcut<Theme> | StaticShortcutMap)[];
449
- type Shortcut<Theme extends object = object> = StaticShortcut | DynamicShortcut<Theme>;
450
- interface ShortcutInlineValue {
438
+ export type CSSValue = CSSObject | CSSEntries;
439
+ export type CSSValues = CSSValue | CSSValue[];
440
+ export type DynamicMatcher<Theme extends object = object> = (match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => Awaitable<CSSValueInput | string | (CSSValueInput | string)[] | undefined> | Generator<CSSValueInput | string | undefined> | AsyncGenerator<CSSValueInput | string | undefined>;
441
+ export type DynamicRule<Theme extends object = object> = [RegExp, DynamicMatcher<Theme>, RuleMeta?];
442
+ export type StaticRule = [string, CSSObject | CSSEntries | (CSSValueInput | string)[], RuleMeta?];
443
+ export type Rule<Theme extends object = object> = DynamicRule<Theme> | StaticRule;
444
+ export type DynamicShortcutMatcher<Theme extends object = object> = ((match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => (string | ShortcutValue[] | undefined));
445
+ export type StaticShortcut = [string, string | ShortcutValue[], RuleMeta?];
446
+ export type StaticShortcutMap = Record<string, string | ShortcutValue[]>;
447
+ export type DynamicShortcut<Theme extends object = object> = [RegExp, DynamicShortcutMatcher<Theme>, RuleMeta?];
448
+ export type UserShortcuts<Theme extends object = object> = StaticShortcutMap | (StaticShortcut | DynamicShortcut<Theme> | StaticShortcutMap)[];
449
+ export type Shortcut<Theme extends object = object> = StaticShortcut | DynamicShortcut<Theme>;
450
+ export interface ShortcutInlineValue {
451
451
  handles: VariantHandler[];
452
452
  value: ShortcutValue;
453
453
  }
454
- type ShortcutValue = string | CSSValue;
455
- type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
456
- interface Preflight<Theme extends object = object> {
454
+ export type ShortcutValue = string | CSSValue;
455
+ export type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
456
+ export interface Preflight<Theme extends object = object> {
457
457
  getCSS: (context: PreflightContext<Theme>) => Promise<string | undefined> | string | undefined;
458
458
  layer?: string;
459
459
  }
460
- interface BlocklistMeta {
460
+ export interface BlocklistMeta {
461
461
  /**
462
462
  * Custom message to show why this selector is blocked.
463
463
  */
464
464
  message?: string | ((selector: string) => string);
465
465
  }
466
- type BlocklistValue = string | RegExp | ((selector: string) => boolean | null | undefined);
467
- type BlocklistRule = BlocklistValue | [BlocklistValue, BlocklistMeta];
468
- interface VariantHandlerContext {
466
+ export type BlocklistValue = string | RegExp | ((selector: string) => boolean | null | undefined);
467
+ export type BlocklistRule = BlocklistValue | [BlocklistValue, BlocklistMeta];
468
+ export interface VariantHandlerContext {
469
469
  /**
470
470
  * Rewrite the output selector. Often be used to append parents.
471
471
  */
@@ -504,7 +504,7 @@ interface VariantHandlerContext {
504
504
  */
505
505
  noMerge?: boolean;
506
506
  }
507
- interface VariantHandler {
507
+ export interface VariantHandler {
508
508
  /**
509
509
  * Callback to process the handler.
510
510
  */
@@ -538,8 +538,8 @@ interface VariantHandler {
538
538
  */
539
539
  layer?: string | undefined;
540
540
  }
541
- type VariantFunction<Theme extends object = object> = (matcher: string, context: Readonly<VariantContext<Theme>>) => Awaitable<string | VariantHandler | VariantHandler[] | undefined>;
542
- interface VariantObject<Theme extends object = object> {
541
+ export type VariantFunction<Theme extends object = object> = (matcher: string, context: Readonly<VariantContext<Theme>>) => Awaitable<string | VariantHandler | VariantHandler[] | undefined>;
542
+ export interface VariantObject<Theme extends object = object> {
543
543
  /**
544
544
  * The name of the variant.
545
545
  */
@@ -563,11 +563,11 @@ interface VariantObject<Theme extends object = object> {
563
563
  */
564
564
  autocomplete?: Arrayable<AutoCompleteFunction | AutoCompleteTemplate>;
565
565
  }
566
- type Variant<Theme extends object = object> = VariantFunction<Theme> | VariantObject<Theme>;
567
- type Preprocessor = (matcher: string) => string | undefined;
568
- type Postprocessor = (util: UtilObject) => void | UtilObject | (UtilObject | null | undefined)[];
569
- type ThemeExtender<Theme extends object = object> = (theme: Theme, config: Readonly<ResolvedConfig<Theme>>) => Theme | void;
570
- interface ConfigBase<Theme extends object = object> {
566
+ export type Variant<Theme extends object = object> = VariantFunction<Theme> | VariantObject<Theme>;
567
+ export type Preprocessor = (matcher: string) => string | undefined;
568
+ export type Postprocessor = (util: UtilObject) => void | UtilObject | (UtilObject | null | undefined)[];
569
+ export type ThemeExtender<Theme extends object = object> = (theme: Theme, config: Readonly<ResolvedConfig<Theme>>) => Theme | void;
570
+ export interface ConfigBase<Theme extends object = object> {
571
571
  /**
572
572
  * Rules to generate CSS utilities.
573
573
  *
@@ -707,7 +707,7 @@ interface ConfigBase<Theme extends object = object> {
707
707
  */
708
708
  processors?: CSSProcessor<Theme>[];
709
709
  }
710
- interface OutputCssLayersOptions {
710
+ export interface OutputCssLayersOptions {
711
711
  /**
712
712
  * Specify the css layer that the internal layer should be output to.
713
713
  *
@@ -721,13 +721,13 @@ interface OutputCssLayersOptions {
721
721
  */
722
722
  allLayers?: boolean;
723
723
  }
724
- type AutoCompleteTemplate = string;
725
- type AutoCompleteFunction = (input: string) => Awaitable<string[]>;
726
- interface AutoCompleteExtractorContext {
724
+ export type AutoCompleteTemplate = string;
725
+ export type AutoCompleteFunction = (input: string) => Awaitable<string[]>;
726
+ export interface AutoCompleteExtractorContext {
727
727
  content: string;
728
728
  cursor: number;
729
729
  }
730
- interface Replacement {
730
+ export interface Replacement {
731
731
  /**
732
732
  * The range of the original text
733
733
  */
@@ -738,7 +738,7 @@ interface Replacement {
738
738
  */
739
739
  replacement: string;
740
740
  }
741
- interface SuggestResult {
741
+ export interface SuggestResult {
742
742
  /**
743
743
  * The generated suggestions
744
744
  *
@@ -751,7 +751,7 @@ interface SuggestResult {
751
751
  */
752
752
  resolveReplacement: (suggestion: string) => Replacement;
753
753
  }
754
- interface AutoCompleteExtractorResult {
754
+ export interface AutoCompleteExtractorResult {
755
755
  /**
756
756
  * The extracted string
757
757
  */
@@ -765,12 +765,12 @@ interface AutoCompleteExtractorResult {
765
765
  */
766
766
  transformSuggestions?: (suggestions: string[]) => string[];
767
767
  }
768
- interface AutoCompleteExtractor {
768
+ export interface AutoCompleteExtractor {
769
769
  name: string;
770
770
  extract: (context: AutoCompleteExtractorContext) => Awaitable<AutoCompleteExtractorResult | null>;
771
771
  order?: number;
772
772
  }
773
- interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
773
+ export interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
774
774
  name: string;
775
775
  /**
776
776
  * Enforce the preset to be applied before or after other presets
@@ -801,11 +801,11 @@ interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
801
801
  */
802
802
  docs?: string;
803
803
  }
804
- type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
805
- type PresetFactoryAwaitable<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Awaitable<Preset<Theme>>;
806
- type PresetOrFactory<Theme extends object = object> = Preset<Theme> | PresetFactory<Theme, any>;
807
- type PresetOrFactoryAwaitable<Theme extends object = object> = PresetOrFactory<Theme> | Promise<Preset<Theme>> | PresetFactoryAwaitable<Theme>;
808
- interface GeneratorOptions {
804
+ export type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
805
+ export type PresetFactoryAwaitable<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Awaitable<Preset<Theme>>;
806
+ export type PresetOrFactory<Theme extends object = object> = Preset<Theme> | PresetFactory<Theme, any>;
807
+ export type PresetOrFactoryAwaitable<Theme extends object = object> = PresetOrFactory<Theme> | Promise<Preset<Theme>> | PresetFactoryAwaitable<Theme>;
808
+ export interface GeneratorOptions {
809
809
  /**
810
810
  * Merge utilities with the exact same body to save the file size
811
811
  *
@@ -819,7 +819,7 @@ interface GeneratorOptions {
819
819
  */
820
820
  warn?: boolean;
821
821
  }
822
- interface UserOnlyOptions<Theme extends object = object> {
822
+ export interface UserOnlyOptions<Theme extends object = object> {
823
823
  /**
824
824
  * The theme object, will be merged with the theme provides by presets
825
825
  */
@@ -852,12 +852,12 @@ interface UserOnlyOptions<Theme extends object = object> {
852
852
  /**
853
853
  * For unocss-cli config
854
854
  */
855
- interface CliOptions {
855
+ export interface CliOptions {
856
856
  cli?: {
857
857
  entry?: Arrayable<CliEntryItem>;
858
858
  };
859
859
  }
860
- interface UnocssPluginContext<Config extends UserConfig = UserConfig> {
860
+ export interface UnocssPluginContext<Config extends UserConfig = UserConfig> {
861
861
  /**
862
862
  * Singleton promise for config loading
863
863
  */
@@ -905,7 +905,7 @@ interface UnocssPluginContext<Config extends UserConfig = UserConfig> {
905
905
  RESOLVED_ID_RE: RegExp;
906
906
  }>;
907
907
  }
908
- interface SourceMap {
908
+ export interface SourceMap {
909
909
  file?: string;
910
910
  mappings?: string;
911
911
  names?: string[];
@@ -913,13 +913,13 @@ interface SourceMap {
913
913
  sourcesContent?: string[];
914
914
  version?: number;
915
915
  }
916
- interface HighlightAnnotation {
916
+ export interface HighlightAnnotation {
917
917
  offset: number;
918
918
  length: number;
919
919
  className: string;
920
920
  }
921
- type SourceCodeTransformerEnforce = 'pre' | 'post' | 'default';
922
- interface SourceCodeTransformer {
921
+ export type SourceCodeTransformerEnforce = 'pre' | 'post' | 'default';
922
+ export interface SourceCodeTransformer {
923
923
  name: string;
924
924
  /**
925
925
  * Documentation URL for the transformer
@@ -946,7 +946,7 @@ interface SourceCodeTransformer {
946
946
  highlightAnnotations?: HighlightAnnotation[];
947
947
  } | void>;
948
948
  }
949
- interface CSSProcessorContext<Theme extends object = object> {
949
+ export interface CSSProcessorContext<Theme extends object = object> {
950
950
  /**
951
951
  * The current CSS layer being processed.
952
952
  */
@@ -962,12 +962,12 @@ interface CSSProcessorContext<Theme extends object = object> {
962
962
  */
963
963
  envMode: 'dev' | 'build';
964
964
  }
965
- interface CSSProcessor<Theme extends object = object> {
965
+ export interface CSSProcessor<Theme extends object = object> {
966
966
  name: string;
967
967
  order?: number;
968
968
  process: (css: string, context: CSSProcessorContext<Theme>) => Awaitable<string>;
969
969
  }
970
- interface ContentOptions {
970
+ export interface ContentOptions {
971
971
  /**
972
972
  * Glob patterns to extract from the file system, in addition to other content sources.
973
973
  *
@@ -1019,7 +1019,7 @@ interface ContentOptions {
1019
1019
  /**
1020
1020
  * For other modules to aggregate the options
1021
1021
  */
1022
- interface PluginOptions {
1022
+ export interface PluginOptions {
1023
1023
  /**
1024
1024
  * Load from configs files
1025
1025
  *
@@ -1046,9 +1046,9 @@ interface PluginOptions {
1046
1046
  */
1047
1047
  content?: ContentOptions;
1048
1048
  }
1049
- interface UserConfig<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme>, GeneratorOptions, PluginOptions, CliOptions {}
1050
- interface UserConfigDefaults<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme> {}
1051
- 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'> {
1049
+ export interface UserConfig<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme>, GeneratorOptions, PluginOptions, CliOptions {}
1050
+ export interface UserConfigDefaults<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme> {}
1051
+ export 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'> {
1052
1052
  presets: Preset<Theme>[];
1053
1053
  shortcuts: Shortcut<Theme>[];
1054
1054
  variants: VariantObject<Theme>[];
@@ -1073,7 +1073,7 @@ interface ResolvedConfig<Theme extends object = object> extends Omit<RequiredByK
1073
1073
  };
1074
1074
  separators: string[];
1075
1075
  }
1076
- interface GenerateResult<T = Set<string>> {
1076
+ export interface GenerateResult<T = Set<string>> {
1077
1077
  css: string;
1078
1078
  layers: string[];
1079
1079
  getLayer: (name?: string) => string | undefined;
@@ -1081,12 +1081,12 @@ interface GenerateResult<T = Set<string>> {
1081
1081
  setLayer: (layer: string, callback: (content: string) => Promise<string>) => Promise<string>;
1082
1082
  matched: T;
1083
1083
  }
1084
- type VariantMatchedResult<Theme extends object = object> = [raw: string, current: string, variantHandlers: VariantHandler[], variants: Set<Variant<Theme>>];
1085
- type ParsedUtil = readonly [index: number, raw: string, entries: CSSEntries, meta: RuleMeta | undefined, variantHandlers: VariantHandler[]];
1086
- type RawUtil = readonly [index: number, rawCSS: string, meta: RuleMeta | undefined];
1087
- 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];
1088
- type PreparedRule = readonly [selector: [string, number][], body: string, noMerge: boolean];
1089
- interface CliEntryItem {
1084
+ export type VariantMatchedResult<Theme extends object = object> = [raw: string, current: string, variantHandlers: VariantHandler[], variants: Set<Variant<Theme>>];
1085
+ export type ParsedUtil = readonly [index: number, raw: string, entries: CSSEntries, meta: RuleMeta | undefined, variantHandlers: VariantHandler[]];
1086
+ export type RawUtil = readonly [index: number, rawCSS: string, meta: RuleMeta | undefined];
1087
+ export 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];
1088
+ export type PreparedRule = readonly [selector: [string, number][], body: string, noMerge: boolean];
1089
+ export interface CliEntryItem {
1090
1090
  patterns: string[];
1091
1091
  outFile: string;
1092
1092
  /**
@@ -1110,7 +1110,7 @@ interface CliEntryItem {
1110
1110
  */
1111
1111
  splitCss?: boolean | 'multi' | 'single';
1112
1112
  }
1113
- interface UtilObject {
1113
+ export interface UtilObject {
1114
1114
  selector: string;
1115
1115
  entries: CSSEntries;
1116
1116
  parent: string | undefined;
@@ -1121,7 +1121,7 @@ interface UtilObject {
1121
1121
  /**
1122
1122
  * Returned from `uno.generate()` when `extendedInfo` option is enabled.
1123
1123
  */
1124
- interface ExtendedTokenInfo<Theme extends object = object> {
1124
+ export interface ExtendedTokenInfo<Theme extends object = object> {
1125
1125
  /**
1126
1126
  * Stringified util data
1127
1127
  */
@@ -1131,7 +1131,7 @@ interface ExtendedTokenInfo<Theme extends object = object> {
1131
1131
  */
1132
1132
  count: number;
1133
1133
  }
1134
- interface GenerateOptions<T extends boolean> {
1134
+ export interface GenerateOptions<T extends boolean> {
1135
1135
  /**
1136
1136
  * Filepath of the file being processed.
1137
1137
  */
@@ -1162,30 +1162,30 @@ interface GenerateOptions<T extends boolean> {
1162
1162
  }
1163
1163
  //#endregion
1164
1164
  //#region src/config.d.ts
1165
- declare function resolveShortcuts<Theme extends object = object>(shortcuts: UserShortcuts<Theme>): Shortcut<Theme>[];
1165
+ export declare function resolveShortcuts<Theme extends object = object>(shortcuts: UserShortcuts<Theme>): Shortcut<Theme>[];
1166
1166
  /**
1167
1167
  * Resolve a single preset, nested presets are ignored
1168
1168
  */
1169
- declare function resolvePreset<Theme extends object = object>(presetInput: PresetOrFactoryAwaitable<Theme>): Promise<Preset<Theme>>;
1169
+ export declare function resolvePreset<Theme extends object = object>(presetInput: PresetOrFactoryAwaitable<Theme>): Promise<Preset<Theme>>;
1170
1170
  /**
1171
1171
  * Resolve presets with nested presets
1172
1172
  */
1173
- declare function resolvePresets<Theme extends object = object>(preset: PresetOrFactoryAwaitable<Theme>): Promise<Preset<Theme>[]>;
1174
- declare function resolveConfig<Theme extends object = object>(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<ResolvedConfig<Theme>>;
1173
+ export declare function resolvePresets<Theme extends object = object>(preset: PresetOrFactoryAwaitable<Theme>): Promise<Preset<Theme>[]>;
1174
+ export declare function resolveConfig<Theme extends object = object>(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<ResolvedConfig<Theme>>;
1175
1175
  /**
1176
1176
  * Merge multiple configs into one, later ones have higher priority
1177
1177
  */
1178
- declare function mergeConfigs<Theme extends object = object>(configs: UserConfig<Theme>[]): UserConfig<Theme>;
1179
- declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactory<Theme, Options>): PresetFactory<Theme, Options>;
1180
- declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactoryAwaitable<Theme, Options>): PresetFactoryAwaitable<Theme, Options>;
1181
- declare function definePreset<Theme extends object = object>(preset: Preset<Theme>): Preset<Theme>;
1178
+ export declare function mergeConfigs<Theme extends object = object>(configs: UserConfig<Theme>[]): UserConfig<Theme>;
1179
+ export declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactory<Theme, Options>): PresetFactory<Theme, Options>;
1180
+ export declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactoryAwaitable<Theme, Options>): PresetFactoryAwaitable<Theme, Options>;
1181
+ export declare function definePreset<Theme extends object = object>(preset: Preset<Theme>): Preset<Theme>;
1182
1182
  //#endregion
1183
1183
  //#region src/constants.d.ts
1184
- declare const LAYER_DEFAULT = "default";
1185
- declare const LAYER_PREFLIGHTS = "preflights";
1186
- declare const LAYER_SHORTCUTS = "shortcuts";
1187
- declare const LAYER_IMPORTS = "imports";
1188
- declare const DEFAULT_LAYERS: {
1184
+ export declare const LAYER_DEFAULT = "default";
1185
+ export declare const LAYER_PREFLIGHTS = "preflights";
1186
+ export declare const LAYER_SHORTCUTS = "shortcuts";
1187
+ export declare const LAYER_IMPORTS = "imports";
1188
+ export declare const DEFAULT_LAYERS: {
1189
1189
  imports: number;
1190
1190
  preflights: number;
1191
1191
  shortcuts: number;
@@ -1193,8 +1193,8 @@ declare const DEFAULT_LAYERS: {
1193
1193
  };
1194
1194
  //#endregion
1195
1195
  //#region src/extractors/split.d.ts
1196
- declare const defaultSplitRE: RegExp;
1197
- declare const splitWithVariantGroupRE: RegExp;
1198
- declare const extractorSplit: Extractor;
1196
+ export declare const defaultSplitRE: RegExp;
1197
+ export declare const splitWithVariantGroupRE: RegExp;
1198
+ export declare const extractorSplit: Extractor;
1199
1199
  //#endregion
1200
- export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BaseContext, BetterMap, BlocklistMeta, BlocklistRule, BlocklistValue, CSSEntries, CSSEntriesInput, CSSEntry, CSSObject, CSSObjectInput, CSSProcessor, CSSProcessorContext, 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 };
1200
+ export { extractorSplit as extractorDefault };
package/dist/index.mjs CHANGED
@@ -650,7 +650,7 @@ function definePreset(preset) {
650
650
  }
651
651
  //#endregion
652
652
  //#region package.json
653
- var version = "66.10.3";
653
+ var version = "66.10.5";
654
654
  //#endregion
655
655
  //#region src/generator.ts
656
656
  const symbols = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
3
  "type": "module",
4
- "version": "66.10.3",
4
+ "version": "66.10.5",
5
5
  "description": "The instant on-demand Atomic CSS engine.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "devDependencies": {
36
- "magic-string": "^1.2.2",
36
+ "magic-string": "^1.4.1",
37
37
  "unconfig": "^7.5.0"
38
38
  },
39
39
  "scripts": {