import { Optional } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser'; import { Observable } from 'rxjs/Observable'; export declare class GhIconRegistry { private _httpClient; private _sanitizer; private _document; /** * URLs and cached SVG elements for individual icons. * Keys are of the format "[namespace]:[icon]". */ private _svgIconConfigs; /** In-progress icon fetches. Used to coalesce multiple requests to the same URL. */ private _inProgressUrlFetches; /** Cache for icons loaded by direct URLs. */ private _cachedIconsByUrl; constructor(_httpClient: HttpClient, _sanitizer: DomSanitizer, _document?: any); /** * Registers an icon by URL in the default namespace. * @param iconName Name under which the icon should be registered. * @param url */ addSvgIcon(iconName: string, url: SafeResourceUrl): this; /** * Registers an icon by URL in the specified namespace. * @param namespace Namespace in which the icon should be registered. * @param iconName Name under which the icon should be registered. * @param url */ addSvgIconInNamespace(namespace: string, iconName: string, url: SafeResourceUrl): this; /** * Returns an Observable that produces the icon (as an `` DOM element) with the given name * and namespace. The icon must have been previously registered with addIcon or addIconSet; * if not, the Observable will throw an error. * @param name Name of the icon to be retrieved. * @param namespace Namespace in which to look for the icon. */ getNamedSvgIcon(name: string, namespace?: string): Observable; /** * Returns an Observable that produces the icon (as an `` DOM element) from the given URL. * The response from the URL may be cached so this will not always cause an HTTP request, but * the produced element will always be a new copy of the originally fetched icon. (That is, * it will not contain any modifications made to elements previously returned). * @param safeUrl URL from which to fetch the SVG icon. */ getSvgIconFromUrl(safeUrl: SafeResourceUrl): Observable; /** * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element * from it. */ private _loadSvgIconFromConfig(config); /** * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not. */ private _getSvgIconFromConfig(config); /** Creates a DOM element from the given SVG string, and adds default attributes. */ private _createSvgElementForSingleIcon(responseText); /** Sets the default attributes for an SVG element to be used as an icon. */ private _setSvgAttributes(svg); /** Creates a DOM element from the given SVG string. */ private _svgElementFromString(str); /** * Returns an Observable which produces the string contents of the given URL. Results may be * cached, so future calls with the same URL may not cause another HTTP request. */ private _fetchUrl(safeUrl); } export declare function ICON_REGISTRY_PROVIDER_FACTORY(parent: GhIconRegistry, httpClient: HttpClient, sanitizer: DomSanitizer, document?: any): GhIconRegistry; export declare const ICON_REGISTRY_PROVIDER: { provide: typeof GhIconRegistry; deps: (Optional[] | typeof DomSanitizer)[]; useFactory: (parent: GhIconRegistry, httpClient: HttpClient, sanitizer: DomSanitizer, document?: any) => GhIconRegistry; };