import { type UserConfig } from 'unocss'; import type { Plugin } from 'vite'; /** Options for {@link unoSheet}. */ export interface UnoSheetOptions { /** The UnoCSS config: presets, theme, content pipeline. */ config: UserConfig; /** * The `.css` file to write, imported with `?css-sheet`. Relative paths * resolve against the Vite root. Gitignore it: it is regenerated on start. */ outFile: string; /** Directory, relative to the Vite root, scanned for utility classes. Defaults to `src`. */ dir?: string; /** Files that count as source. Defaults to `.ts`, `.js` and `.html`. */ include?: RegExp; /** * Emit the presets' preflights along with the utilities. Defaults to * `false`. * * Wind4 needs this: its utilities read the `--spacing`, `--colors-*` * variables from the `theme` preflight, and its `@property --un-*` rules * come from the `properties` one. Turn it on and keep the global reset out * of every shadow root at the preset, * `presetWind4({preflights: {reset: false}})`. */ preflights?: boolean; } /** * Writes the utility classes your source uses into a real `.css` file, so * every component can adopt them as one shared sheet. * * UnoCSS's own Vite plugin serves its CSS from `virtual:uno.css`, a module * with no file behind it. `?css-sheet` reads a file's URL, and a build of * `virtual:uno.css?inline` fails inside UnoCSS, so the two cannot meet. This * plugin generates the CSS itself and writes it to `outFile`. The file is * then an ordinary stylesheet: `?css-sheet` gives every importer the same * `CSSStyleSheet`, `vite build` emits it as a content-hashed asset, and when * a new class lands in a component the file changes and the lit plugin swaps * the rules inside the sheet that is already adopted. * * Utilities are collected twice. `buildStart` scans `dir`, so the first * dev load and `vite build` start with every class. In dev, `transform` then * feeds each edited module through the same extractors and rewrites the file * when a new class shows up. A build never regenerates after `buildStart`. * * Preflights are off by default: the sheet carries utilities only, because a * reset preflight would be repeated inside every shadow root. Wind4 keeps its * theme variables in preflights too, so set `preflights: true` there and drop * the reset with `presetWind4({preflights: {reset: false}})`. * * Put it before `litPlugin()`. It runs as an `enforce: 'pre'` plugin, so the * extractors read the source the way you wrote it. */ export declare function unoSheet(options: UnoSheetOptions): Plugin; //# sourceMappingURL=uno-sheet.d.ts.map