import type { Root } from 'postcss'; import type { UrlString } from '../../types'; import type { CssLink } from './types'; /** * Find all links in a parsed stylesheet. * * @param parsedCss - An AST as produced by `postcss.parse()` * @param baseUrl - the absolute URL for interpreting any relative URLs in the stylesheet. * @returns The found links. Each {@link Link} provides a live, editable view on one URL inside * the stylesheet. */ export declare function findLinksInCss(parsedCss: Root, baseUrl: UrlString): CssLink[]; /** * Create a live & editable view on the links in a stylesheet. * * Conceptually, the stylesheet is a mutable string. Because strings are not mutable, this function * takes a getter and a setter method that it uses to read and write the string. * * @example * const linksInStyleAttribute = findLinksInCssSynced({ * get: () => element.getAttribute('style'), * set: newValue => { element.setAttribute('style', newValue) }, * baseUrl: element.baseURI as UrlString, * }) * * @param options.get - Getter to obtain the current content of the stylesheet. This may be called * many times, so keep it light; e.g. just reading a variable or style attribute. * @param options.set - Setter that is called, whenever a link is modified, with the new value of * the whole stylesheet. * @param options.baseUrl - The absolute URL for interpreting any relative URLs in the stylesheet. */ export declare function findLinksInCssSynced({ get: getCssString, set: setCssString, baseUrl, }: { get: () => string; set: (value: string) => void; baseUrl: UrlString; }): CssLink[];