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