import type { DiagramDef } from '../types.js'; import { type IconContext } from './icons.js'; import type { GgError } from './errors.js'; /** Decode a `data:…` URL — returns either an SVG fragment (for SVG * payloads) or an `` fragment (for raster payloads). */ export declare function decodeDataUrl(url: string): string; /** * Load a single icon-map value. The value may be: * - URL (https://… or http://…) — fetched. SVG responses are inlined * as `…`; PNG / JPEG / GIF / WebP / AVIF responses are wrapped * in an `` element that covers the icon's square * (short-edge fit, long-edge cropped). * - dataURL (data:…) — decoded (same SVG vs raster split) * - file path (relative to cwd, or absolute) — read (same split by * extension) * - raw SVG markup ('; export declare function loadIconDirectory(dir: string): Record; /** * Resolve every entry of an icons map to its inlined SVG fragment. * * A per-entry failure drops that entry from the output and records a * structured error; the map keeps loading the rest. Callers decide * whether to surface the errors (the CLI prints them; tests just check * the resolved map). */ export declare function loadIconMap(map: Record, cwd: string): Promise<{ map: Record; errors: GgError[]; /** Per-entry load failures, keyed by the map's id. Used by the icon * resolver to produce `load-failed` diagnostics for the nodes that * referenced these ids. */ failed: Map; }>; export interface PathResolveCtx { /** Directory for cwd-relative DSL paths (e.g. 'path/to.svg') — normally the .gg file's dir. */ docDir: string; /** Directory for resolving alias target paths (e.g. from `--alias brand=./icons`) — normally process.cwd. */ aliasDir: string; /** Alias name → target directory (possibly relative to aliasDir) */ aliases: Record; } export declare function resolvePathRef(ref: string, ctx: PathResolveCtx): string; /** * Pre-read every external-path icon referenced in the def. * * A per-ref failure drops that ref from the output and records a * structured error; the def keeps resolving the rest (nodes with an * unresolved ref surface as `iconError` downstream). */ export declare function loadPathRefs(def: DiagramDef, ctx: PathResolveCtx): { paths: Record; errors: GgError[]; /** Per-ref load failures, keyed by the original DSL string (e.g. * '@alias/x.svg' or './foo.svg'). */ failed: Map; }; export declare function buildIconContext(opts: { iconsDir?: string; jsonIconsMap?: Record; aliases?: Record; def?: DiagramDef; /** Directory for cwd-relative DSL paths AND for the JSON `icons:` map (= .gg file's dir). */ docDir: string; /** Directory for alias target paths (= process.cwd usually). Defaults to docDir. */ aliasDir?: string; }): Promise; //# sourceMappingURL=icon-loader.d.ts.map