import { FullConfig, Extractor, ExtractorResultDetailed } from 'windicss/types/interfaces'; import { generateCompletions } from 'windicss/utils'; import Processor from 'windicss'; import { WindiCssOptions, LoadConfigurationOptions } from '@windicss/config'; export * from '@windicss/config'; export { WindiCssOptions } from '@windicss/config'; import * as magic_string from 'magic-string'; export { Arrayable, partition, slash, toArray } from '@antfu/utils'; declare const defaultAlias: Record; declare const preflightTags: string[]; declare const htmlTags: readonly ["html", "body", "div", "a", "abbr", "address", "area", "article", "aside", "audio", "base", "basefont", "bdo", "blink", "blockquote", "br", "button", "canvas", "caption", "center", "col", "colgroup", "command", "comment", "datalist", "dd", "del", "details", "dir", "dl", "dt", "embed", "fieldset", "figure", "b", "big", "i", "small", "tt", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "isindex", "iframe", "ilayer", "img", "input", "ins", "keygen", "keygen", "label", "layer", "legend", "li", "link", "map", "mark", "marquee", "menu", "meta", "meter", "multicol", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "cite", "code", "dfn", "em", "kbd", "samp", "strong", "var", "plaintext", "pre", "progress", "q", "ruby", "script", "section", "select", "spacer", "span", "s", "strike", "style", "sub", "sup", "svg", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "video", "wbr", "wbr", "xmp"]; type TagNames = (typeof htmlTags)[number]; declare function defineConfig(config: FullConfig): FullConfig; interface TransformerOptions { include?: RegExp[]; } type TransformerFunction = (code: string, id: string) => string | undefined | null; type Transformer = (options?: T) => TransformerFunction; declare function transformGroups(code: string, sourcemap?: boolean): { code: string; map: magic_string.SourceMap | undefined; } | null; declare function buildAliasTransformer(alias?: Record): (code: string, sourcemap?: boolean) => { code: string; map: magic_string.SourceMap | undefined; } | null; interface UserOptions { /** * Options for windicss/tailwindcss. * Also accepts string as config file path. * * @default auto searching for `windi.config.ts` / `tailwind.config.js` */ config?: WindiCssOptions | string; /** * A list of filename of paths to search of config files */ configFiles?: string[]; /** * Safe class names to be always included. * * @deprecated define this field in the windicss.config.ts instead */ safelist?: string | (string | string[])[]; /** * Class names to be always excluded. * * @deprecated define this field in the windicss.config.ts instead */ blocklist?: string | (string | string[])[]; /** * Enabled windicss preflight (a.k.a TailwindCSS style reset) * * @deprecated define this field in the windicss.config.ts instead * @default true */ preflight?: boolean | { /** * Enable all the preflight regardless the template * * @deprecated define this field in the windicss.config.ts instead */ enableAll?: boolean; /** * Enable all the preflight regardless the template * * @deprecated define this field in the windicss.config.ts instead */ includeAll?: boolean; /** * Safelist to always included * * @deprecated define this field in the windicss.config.ts instead */ safelist?: string | (string | string[])[]; /** * Blocklist to always excluded * * @deprecated define this field in the windicss.config.ts instead */ blocklist?: string | (string | string[])[]; /** * Alias for resolving preflight */ alias?: Record; /** * @default true * @deprecated define this field in the windicss.config.ts instead */ includeBase?: boolean; /** * @default true * @deprecated define this field in the windicss.config.ts instead */ includeGlobal?: boolean; /** * @default true * @deprecated define this field in the windicss.config.ts instead */ includePlugin?: boolean; }; /** * File paths will be resolved against this directory. * * @default process.cwd * @internal */ root?: string; /** * Scan the files and extract the usage * * @default true */ scan?: boolean | { /** * Auto scan on startup * * @default true */ runOnStartup?: boolean; /** * Directories to search for classnames * * @default 'src' * @deprecated use `extract.include` in the windicss.config.ts instead */ dirs?: string | string[]; /** * File extension to search for classnames * * @default 'html', 'vue', 'md', 'mdx', 'pug', 'jsx', 'tsx', 'svelte', 'js', 'ts' * @deprecated use `extract.include` in the windicss.config.ts instead */ fileExtensions?: string | string[]; /** * Exclude globs * * @default [] */ exclude?: string | string[]; /** * Include globs * * @default [] */ include?: string | string[]; /** * Transformers to apply before doing extraction * * @default [] */ transformers?: TransformerFunction[]; }; /** * Transform CSS for `@apply` directive * * @default true */ transformCSS?: boolean | 'pre' | 'post'; /** * Transform groups like `hover:(bg-gray-100 font-medium)` * * @default true */ transformGroups?: boolean; /** * Sort the genrate utilities * * @default true */ sortUtilities?: boolean; /** * Callback before classes css generated */ onBeforeGenerate?: (ctx: { classesPending: Set; tagsPending: Set; }) => void; /** * Callback when classes and/or tags are generated/changed */ onGenerated?: (ctx: { classes: Set; tags: Set; }) => void; /** * Callback when the options are resolved. These are the plugin options and contain the windi config */ onOptionsResolved?: (options: ResolvedOptions) => ResolvedOptions | void | Promise; /** * Callback when the windi config is resolved. Not to be confused with the options which are the top level way to * configure the util package */ onConfigResolved?: (config: WindiCssOptions, configFilePath?: string) => WindiCssOptions | void | Promise; /** * Callback when the utils is initialized */ onInitialized?: (utils: WindiPluginUtils) => void; } type WindiPluginUtilsOptions = Omit & { /** * Reuse existing plugin instance */ utils?: WindiPluginUtils; }; interface ResolvedOptions { config: WindiCssOptions; configFilePath: string | undefined; enableScan: boolean; enablePreflight: boolean; transformCSS: boolean | 'pre' | 'auto' | 'post'; transformGroups: boolean; scanOptions: { fileExtensions: string[]; dirs: string[]; exclude: string[]; include: string[]; runOnStartup: boolean; transformers: TransformerFunction[]; extractors: Extractor[]; extraTransformTargets: { css: (string | ((path: string) => boolean))[]; detect: (string | ((path: string) => boolean))[]; }; }; preflightOptions: { includeBase: boolean; includeGlobal: boolean; includePlugin: boolean; includeAll: boolean; /** * @deprecated use includeAll */ enableAll: boolean; safelist: Set; blocklist: Set; alias: Record; }; root: string; sortUtilities: boolean; safelist: Set; blocklist: Set; onBeforeGenerate: UserOptions['onBeforeGenerate']; onGenerated: UserOptions['onGenerated']; onConfigResolved: UserOptions['onConfigResolved']; onOptionsResolved: UserOptions['onOptionsResolved']; onInitialized: UserOptions['onInitialized']; } declare function DefaultExtractor(code: string, id?: string): ExtractorResultDetailed; declare function getDefaultExtractors(): Extractor[]; declare function applyExtractors(code: string, id?: string, extractors?: Extractor[], defaultExtract?: typeof DefaultExtractor): Promise; type CompletionsResult = ReturnType; type LayerName = 'base' | 'utilities' | 'components'; declare const SupportedLayers: readonly ["base", "utilities", "components"]; interface LayerMeta { cssCache?: string; timestamp?: number; } interface TransformCssOptions { onLayerUpdated?: () => void; globaliseKeyframes?: boolean; } interface WindiPluginUtils { init(): Promise; ensureInit(): Promise; extractFile(code: string, id?: string, applyTransform?: boolean): Promise; applyExtractors: typeof applyExtractors; generateCSS(layer?: LayerName): Promise; getFiles(): Promise; clearCache(clearAll?: boolean): void; transformCSS(css: string, id: string, transformOptions?: TransformCssOptions): string; transformGroups: typeof transformGroups; transformAlias: ReturnType; buildPendingStyles(): void; isDetectTarget(id: string): boolean; isScanTarget(id: string): boolean; isCssTransformTarget(id: string): boolean; isExcluded(id: string): boolean; scan(): Promise; classesGenerated: Set; classesPending: Set; tagsGenerated: Set; tagsPending: Set; tagsAvailable: Set; layersMeta: Record; addClasses(classes: string[]): boolean; addTags(tags: string[]): boolean; getCompletions(): ReturnType; lock(fn: () => Promise): Promise; waitLocks(): Promise; initialized: boolean; options: ResolvedOptions; files: string[]; globs: string[]; processor: Processor; scanned: boolean; configFilePath: string | undefined; hasPending: boolean; } declare function createUtils(userOptions?: UserOptions | ResolvedOptions, utilsOptions?: WindiPluginUtilsOptions): WindiPluginUtils; declare function PugExtractor(code: string, id?: string): ExtractorResultDetailed; declare function SvelteExtractor(code: string, id?: string): ExtractorResultDetailed; type NestedArrayable = T | (T | T[])[]; declare function flattenArray(v: NestedArrayable): T[]; declare function mergeArrays(...args: (NestedArrayable | undefined)[]): T[]; declare function kebabCase(str: string): string; declare function include(set: Set, v: T[] | Set): void; declare function exclude(set: Set, v: T[] | Set): void; declare function escapeRegExp(str: string): string; declare function isResolvedOptions(options: UserOptions | ResolvedOptions): options is ResolvedOptions; declare function resolveOptions(options?: UserOptions | ResolvedOptions, utilsOptions?: WindiPluginUtilsOptions, loadConfigFile?: boolean): Promise; declare function mergeWindicssConfig(a: FullConfig, b: FullConfig): any; export { CompletionsResult, DefaultExtractor, LayerMeta, LayerName, NestedArrayable, PugExtractor, ResolvedOptions, SupportedLayers, SvelteExtractor, TagNames, TransformCssOptions, Transformer, TransformerFunction, TransformerOptions, UserOptions, WindiPluginUtils, WindiPluginUtilsOptions, applyExtractors, buildAliasTransformer, createUtils, defaultAlias, defineConfig, escapeRegExp, exclude, flattenArray, getDefaultExtractors, htmlTags, include, isResolvedOptions, kebabCase, mergeArrays, mergeWindicssConfig, preflightTags, resolveOptions, transformGroups };