/** * SVG asset analysis for rig standardization checks. * Pure functions — no network, no DOM required. */ export declare const MAX_TOTAL_VERTICES = 400; export declare const VIEWBOX_PADDING_TOLERANCE_RATIO = 0.02; export declare const VIEWBOX_PADDING_TOLERANCE_MIN_PX = 1; export declare const VIEWBOX_OVERFLOW_EPSILON = 0.5; /** Content occupying less than this fraction of viewBox width/height is "shared canvas" padding (breaks SVG edit drag preview). */ export declare const VIEWBOX_MIN_CONTENT_COVERAGE = 0.5; /** Matches cartoon_maker assertSvgDrawRectAlignedWithOverlay default bounds. */ export declare const DIMENSION_LAYOUT_RATIO_MIN = 0.8; export declare const DIMENSION_LAYOUT_RATIO_MAX = 1.25; export type PathHiddenReason = 'display_none' | 'visibility_hidden' | 'opacity_zero'; export type SvgLengthUnit = 'px' | 'mm' | 'cm' | 'in' | 'pt' | 'pc' | '%' | 'unknown' | 'missing'; export interface SvgPathInfo { index: number; d: string; fill: string | null; stroke: string | null; fillOpacity: number; strokeOpacity: number; strokeWidth: number; visible: boolean; hiddenReason?: PathHiddenReason; /** Parsed translate() from the path's transform attribute, if present. */ translateX?: number; translateY?: number; /** Full accumulated affine transform from ancestor elements and path transform. */ ancestorTransform?: AffineMatrix; } export interface HiddenPathDetail { index: number; fill: string | null; reason: PathHiddenReason; bounds: Bounds | null; } export interface EmbeddedImageDetail { index: number; hidden: boolean; hiddenReason?: PathHiddenReason; hrefKind: 'embedded_raster' | 'external' | 'missing'; width: string | null; height: string | null; } export interface SvgRootUnits { widthRaw: string | null; heightRaw: string | null; widthUnit: SvgLengthUnit; heightUnit: SvgLengthUnit; pixelUnitsOnly: boolean; } export interface SvgViewBox { minX: number; minY: number; width: number; height: number; } export interface Bounds { minX: number; minY: number; maxX: number; maxY: number; } export interface AffineMatrix { a: number; b: number; c: number; d: number; e: number; f: number; } export interface ViewBoxSideMetric { value: number; tolerance: number; excess: number; } export interface ViewBoxFitResult { pass: boolean; failureKind?: 'missing_viewbox' | 'no_visible_geometry' | 'content_outside_viewbox'; viewBox?: SvgViewBox; visibleBounds?: Bounds; overflow?: { left: number; right: number; top: number; bottom: number; }; visiblePathStart?: { x: number; y: number; }; contentCoverage?: { widthRatio: number; heightRatio: number; }; reason?: string; } export interface ViewBoxCheckResult { pass: boolean; failureKind?: 'missing_viewbox' | 'no_geometry' | 'excess_padding' | 'off_center'; viewBox?: SvgViewBox; contentBounds?: Bounds; padding?: { left: ViewBoxSideMetric; right: ViewBoxSideMetric; top: ViewBoxSideMetric; bottom: ViewBoxSideMetric; }; centerOffset?: { dx: number; dy: number; toleranceX: number; toleranceY: number; excessDx: number; excessDy: number; }; reason?: string; } export interface SvgAssetAnalysis { vertexCount: number; visiblePathCount: number; hiddenPathCount: number; forbiddenElementCount: number; embeddedImageCount: number; colorOutlineOnSameShape: boolean; pathsOnly: boolean; pixelUnitsOnly: boolean; preserveAspectRatioNone: boolean; viewBoxMatchesVisibleContent: boolean; centeredTightViewBox: boolean; viewBoxFit: ViewBoxFitResult | null; viewBoxMetrics: ViewBoxCheckResult | null; rootUnits: SvgRootUnits | null; hiddenPaths: HiddenPathDetail[]; embeddedImages: EmbeddedImageDetail[]; failures: string[]; warnings: string[]; } export interface DimensionLayoutParityResult { pass: boolean; layoutWidth?: number; layoutHeight?: number; viewBoxWidth?: number; viewBoxHeight?: number; rootWidth?: number | null; rootHeight?: number | null; widthRatio?: number; heightRatio?: number; rootWidthMismatch?: boolean; rootHeightMismatch?: boolean; reason?: string; } export declare function parseLengthUnit(value: string | null): SvgLengthUnit; export declare function parseSvgRootUnits(svgSource: string): SvgRootUnits; export declare function checkPreserveAspectRatioNone(svgSource: string): boolean; /** Parse translation from an SVG transform attribute. * Handles both `translate(tx[, ty])` and `matrix(a, b, c, d, tx, ty)` formats. * For matrix transforms, extracts the translation components (e and f). */ export declare function parsePathTranslateTransform(transform: string | null): { tx: number; ty: number; } | null; /** * Parse a transform attribute into an affine matrix. * Handles translate(tx[,ty]) and matrix(a,b,c,d,e,f). */ export declare function parseTransformToMatrix(transform: string | null): AffineMatrix | null; export declare function parseViewBox(svgSource: string): SvgViewBox | null; export declare function extractSvgPaths(svgSource: string): SvgPathInfo[]; export declare function extractEmbeddedImages(svgSource: string): EmbeddedImageDetail[]; export declare function countForbiddenNonVectorElements(svgSource: string): number; export declare function getVisiblePaths(paths: SvgPathInfo[]): SvgPathInfo[]; /** Count authoring vertices in an SVG path `d` attribute. */ export declare function countPathVertices(d: string): number; export declare function getPathStartPoint(d: string): { x: number; y: number; } | null; /** Conservative axis-aligned bounds for a single path (includes curve control points). */ export declare function getPathBounds(d: string): Bounds | null; export declare function getPathBoundsWithTransform(path: SvgPathInfo): Bounds | null; export declare function getContentBounds(paths: SvgPathInfo[]): Bounds | null; /** Visible ink bounds: path geometry plus half stroke-width on stroked paths. */ export declare function getVisibleContentBounds(paths: SvgPathInfo[]): Bounds | null; /** True when axis-aligned bounds lie fully inside the viewBox (within overflow epsilon). */ export declare function contentFitsWithinViewBox(viewBox: SvgViewBox, bounds: Bounds): boolean; export declare function getViewBoxContentCoverage(viewBox: SvgViewBox, bounds: Bounds): { widthRatio: number; heightRatio: number; }; export declare function detectSplitFillStrokePaths(paths: SvgPathInfo[]): boolean; export declare function checkViewBoxFitsVisibleContent(svgSource: string, visiblePaths: SvgPathInfo[]): ViewBoxFitResult; export declare function checkCenteredTightViewBox(svgSource: string, paths: SvgPathInfo[]): ViewBoxCheckResult; /** * Compare rig dimensionValues to SVG viewBox/root — catches drawRect vs overlay drift in SVG edit. */ export declare function checkDimensionLayoutParity(layoutWidth: number, layoutHeight: number, svgSource: string): DimensionLayoutParityResult; export declare function formatDimensionLayoutParityFailure(result: DimensionLayoutParityResult): string; export declare function dimensionLayoutParitySeverity(result: DimensionLayoutParityResult): number; export declare function formatViewBoxFitFailure(metrics: ViewBoxFitResult): string; export declare function formatViewBoxFailure(metrics: ViewBoxCheckResult): string; export declare function viewBoxFitFailureSeverity(metrics: ViewBoxFitResult): number; export declare function viewBoxFailureSeverity(metrics: ViewBoxCheckResult): number; export declare function classifyAssetRef(ref: string): 'svg' | 'raster' | 'url' | 'missing'; export declare function analyzeSvgAsset(svgSource: string): SvgAssetAnalysis; //# sourceMappingURL=svgAssetAnalysis.d.ts.map