@@ -6,6 +6,21 @@ interface FontConfig {
66}
77/** Font mapping: family name → URL string, single config, or array of configs for multiple weights/styles */
88type FontMapping = Record < string , string | FontConfig | FontConfig [ ] > ;
9+ /** SVG compatibility configuration flags */
10+ interface SvgCompatConfig {
11+ useClipPathForOverflow : boolean ;
12+ stripFilters : boolean ;
13+ stripBoxShadows : boolean ;
14+ stripMaskImage : boolean ;
15+ stripTextShadows : boolean ;
16+ avoidStyleAttributes : boolean ;
17+ stripXmlSpace : boolean ;
18+ stripGroupOpacity : boolean ;
19+ inlineClipPathTransforms : boolean ;
20+ flattenNestedSvg : boolean ;
21+ }
22+ /** SVG compatibility preset */
23+ type SvgCompat = 'full' | 'inkscape' | SvgCompatConfig ;
924/** Options for domToSvg() */
1025interface DomToSvgOptions {
1126 /** Map of font-family → URL or FontConfig for text-to-path conversion */
@@ -26,6 +41,8 @@ interface DomToSvgOptions {
2641 * with nested CSS transforms (e.g. SvelteFlow, React Flow) where
2742 * the default behaviour would double-apply transforms. */
2843 flattenTransforms ?: boolean ;
44+ /** SVG compatibility preset or custom config (default: 'full') */
45+ compat ?: SvgCompat ;
2946}
3047/** Internal render context passed through the tree */
3148interface RenderContext {
@@ -37,6 +54,8 @@ interface RenderContext {
3754 idGenerator : IdGenerator ;
3855 /** Options from the caller */
3956 options : DomToSvgOptions ;
57+ /** Resolved SVG compatibility config */
58+ compat : SvgCompatConfig ;
4059 /** Font cache (available when textToPath is enabled) */
4160 fontCache ?: FontCache ;
4261 /** Current inherited opacity */
@@ -72,4 +91,4 @@ interface DomToSvgResult {
7291 */
7392declare function domToSvg ( element : Element , options ?: DomToSvgOptions ) : Promise < DomToSvgResult > ;
7493
75- export { type DomToSvgOptions , type DomToSvgResult , type FontConfig , type FontMapping , domToSvg } ;
94+ export { type DomToSvgOptions , type DomToSvgResult , type FontConfig , type FontMapping , type SvgCompat , type SvgCompatConfig , domToSvg } ;
0 commit comments