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