import type { AtRuleInfo } from './types'; /** * Basic sorting function for at-rules. * * We follow these principles: * * - We first sort by the name of the at-rule, e.g. `@media`, `@supports`. * - Then we sort by the rest of the at-rule. * - If it does not contain a parse-able length and comparison of some kind (e.g. `width < XYZ`, `min-width: XYZ`), it will be sorted alphabetically (e.g. `@media screen`). * - Otherwise, we extract the strings that contain a comparison involving width/height, * e.g. `width < XYZ`, `height >= XYZ`, `device-height <= XYZ`, `device-width > XYZ` * (or strings that can be normalised to this format, e.g. `XYZ > width`), and we * sort at-rules in the following way: * * 1. `width > XYZ`, `height > XYZ` * 2. `width >= XYZ`, `height >= XYZ` * 3. `width < XYZ`, `height < XYZ` * 4. `width <= XYZ`, `height <= XYZ` * 5. `width = XYZ`, `height = XYZ` * 6. `device-width` and `device-height` are sorted in the same manner as above. * * Note that: * * - The length XYZ must be a number; complex expressions such as ratios and `calc()` will not be parsed. * - `min-width: XYZ` is equivalent to `width >= XYZ` (same for `min-height`) * - `max-width: XYZ` is equivalent to `width <= XYZ` (same for `max-height`) * - `min-device-width: XYZ`, `max-device-width: XYZ`, `min-device-height`, * and `max-device-height` are converted to `device-width` and `device-height` in a similar manner. * - If the at-rule does not contain a string in this format (e.g. `@media print`), it * will appear before at-rules that do (e.g. `@media print and (max-width: XYZ)`). * * This is a variation of the mobile-first sorting discussed in * https://github.com/OlehDutchenko/sort-css-media-queries/tree/master?tab=readme-ov-file#mobile-first * * @param rule1 Information about the first at-rule. We assume this has already been parsed by `parseAtRule`. * @param rule2 Information about the second at-rule, We assume this has already been parsed by `parseAtRule`. */ export declare const sortAtRules: (rule1: AtRuleInfo, rule2: AtRuleInfo) => number;