import { UrlFilter } from '../urls/index.js'; /** * Selector and metadata to identify a specific region of an HTML page. */ export type PageRegion = Record & { /** * The unique name for this region. If one isn't specified, the selector will be used as the name. */ name?: string; /** * One or more {@link UrlFilter|UrlFilters} that limit the pages the selector should * apply to. If a urlFilter is set on the Region defintion, and no Url is supplied when * the page is being processed, the region will be ignored. */ urlFilter?: UrlFilter | UrlFilter[]; /** * The CSS selector that identifies the region. */ selector: string; }; export type RegionSelector = string | PageRegion; export type RegionMap = Record; /** * One or more page region definitions. Several input formats are supported: * * @example Simple selector * `const regions: RegionInput = 'footer';` * * @example Array of simple selectors * `const regions: RegionInput = ['head.hero', 'article', 'footer'];` * * @example Array of Region definitions * ``` * const regions: RegionInput = [ * { name: 'header', selector: 'head.hero' }, * { urlFilter: { hostname: '*example.com' }, name: 'header', selector: 'body > div:nth-child(2)' }, * ] * ``` * * @example Named Regions object * ``` * const regions: RegionInput = { * header: 'selector', * footer: [ * 'footer', * 'div#footer', * { urlFilter: { hostname: '*example.com' }, selector: 'footer > div:nth-child(2)' } * ], * } * ``` */ export type RegionInput = RegionSelector | RegionSelector[] | RegionMap; /** * Default options for the */ export interface RegionOptions extends Record { removeFoundElements?: boolean; fallbackRegion?: string | false; urlContext?: string | URL; } /** * Chop an HTML fragment into smaller chunks based on named selectors, optionally * preserving the remaining portions of the document. * * Selectors are processed in the order they appear in the dictionary, and by default * the DOM elements they match are removed from the HTML so overlapping selectors won't * produce duplicate markup. The downside is that it can produce discontiguous markup, * but that's not a problem for things like link and component identification. */ export declare function getHtmlRegions(input: string, regions: string | string[] | Record, options?: RegionOptions): Record; //# sourceMappingURL=get-html-regions.d.ts.map