UNPKG

@iconsets/svg-morpheus-ts

Version:

ESM TypeScript library enabling SVG icons to morph from one to the other. It implements Material Design's Delightful Details transitions. Refactored with modern TypeScript + Vite + pnpm stack. Supports both Chinese and English documentation.

50 lines (49 loc) 2.49 kB
import { CurveData, NormalizedStyle, StyleAttributes, Transform } from './types'; export declare function styleNormCalc(styleNormFrom: NormalizedStyle, styleNormTo: NormalizedStyle, progress: number): NormalizedStyle; export declare function styleNormToString(styleNorm: NormalizedStyle): StyleAttributes; export declare function styleToNorm(styleFrom: StyleAttributes, styleTo: StyleAttributes, doc: SVGSVGElement | null): [NormalizedStyle, NormalizedStyle]; export declare function transCalc(transFrom: Transform, transTo: Transform, progress: number): Transform; export declare function trans2string(trans: Transform): string; export declare function curveCalc(curveFrom: CurveData, curveTo: CurveData, progress: number): CurveData; export declare function clone<T>(obj: T): T; /** * 动态合并多个 SVG 为类似 iconset.svg 的格式,并返回 Blob URL * @param svgMap 对象,key 为 g 标签的 id,value 为 svg 路径或 svg 代码 * @param svgAttributes 可选,生成的 SVG 根元素的属性集合 * @returns Promise<string> 生成的 Blob URL */ export declare function bundleSvgs(svgMap: Record<string, string>, svgAttributes?: Record<string, string | number>): Promise<string>; /** * 动态合并多个 SVG 为类似 iconset.svg 的格式,并返回 SVG 字符串(用于需要直接操作 SVG 内容的场景) * @param svgMap 对象,key 为 g 标签的 id,value 为 svg 路径或 svg 代码 * @param svgAttributes 可选,生成的 SVG 根元素的属性集合 * @returns Promise<string> 合并后的 SVG 字符串 */ export declare function bundleSvgsString(svgMap: Record<string, string>, svgAttributes?: Record<string, string | number>): Promise<string>; /** * 提取 SVG 的 ViewBox 信息 * @param svgContent SVG 字符串 * @returns ViewBox 信息 */ export declare function extractViewBoxInfo(svgContent: string): { values: [number, number, number, number]; original: string; } | null; /** * 提取 SVG 的 defs 信息 * @param svgContent SVG 字符串 * @returns defs 信息 */ export declare function extractDefsInfo(svgContent: string): { gradients: Record<string, string>; patterns: Record<string, string>; others: Record<string, string>; raw: string | undefined; }; /** * 提取 SVG 根元素的属性 * @param svgContent SVG 字符串 * @returns 属性对象 */ export declare function extractSvgRootAttributes(svgContent: string): Record<string, string>; //# sourceMappingURL=helpers.d.ts.map