Skip to content

Commit c1aad0b

Browse files
committed
Add Svg definition to svg-sprite
1 parent f2be56f commit c1aad0b

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

svg-sprite/svg-sprite.d.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ declare module "svg-sprite" {
1212
import File = require('vinyl');
1313

1414
namespace sprite {
15+
import Function = Stream.Function;
1516
interface SVGSpriterConstructor extends NodeJS.EventEmitter {
1617
new(config: Config): SVGSpriter;
1718
}
@@ -153,7 +154,61 @@ declare module "svg-sprite" {
153154
}
154155

155156
interface Svg {
157+
/**
158+
* Output an XML declaration at the very beginning of each compiled sprite.
159+
* If you provide a non-empty string here, it will be used one-to-one as declaration (e.g. <?xml version="1.0" encoding="utf-8"?>).
160+
* If you set this to TRUE, *svg-sprite* will look at the registered shapes for an XML declaration and use the first one it can find.
161+
* @default true
162+
*/
163+
xmlDeclaration: boolean|string;
164+
/**
165+
* Include a <DOCTYPE> declaration in each compiled sprite. If you provide a non-empty string here,
166+
* it will be used one-to-one as declaration (e.g. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">).
167+
* If you set this to TRUE, *svg-sprite* will look at the registered shapes for a DOCTYPE declaration and use the first one it can find.
168+
* @default true
169+
*/
170+
doctypeDeclaration: boolean|string;
171+
/**
172+
* In order to avoid ID clashes, the default behavior is to namespace all IDs in the source SVGs before compiling them into a sprite.
173+
* Each ID is prepended with a unique string. In some situations, it might be desirable to disable ID namespacing, e.g. when you want to script the resulting sprite.
174+
* Just set svg.namespaceIDs to FALSE then and be aware that you might also want to disable SVGO's ID minification (shape.transform.svgo.plugins: [{cleanupIDs: false}]).
175+
* @default true
176+
*/
177+
namespaceIDs?: boolean;
178+
/**
179+
* In order to avoid CSS class name ambiguities, the default behavior is to namespace CSS class names in the source SVGs before compiling them into a sprite.
180+
* Each class name is prepended with a unique string. Disable this option to keep the class names untouched.
181+
* @default true
182+
*/
183+
namespaceClassnames?: boolean;
184+
/**
185+
* If truthy, width and height attributes will be set on the sprite's <svg> element (where applicable).
186+
* @default true
187+
*/
188+
dimensionAttributes?: boolean;
189+
/**
190+
* Shorthand for applying custom attributes to the outermost <svg> element.
191+
* Please be aware that certain attributes (e.g. viewBox) will be calculated dynamically and override custom rootAttributes in any case.
192+
*/
193+
rootAttributes?: any;
194+
/**
195+
* Floating point precision for CSS positioning values (defaults to -1 meaning highest possible precision).
196+
*/
197+
precision?: number;
198+
/**
199+
* Callback (or list of callbacks) that will be applied to the resulting SVG sprites as global [post-processing transformation](#svg-sprite-customization).
200+
* transform: Function∣Array
201+
*/
202+
transform?: SvgTransformer|SvgTransformer[];
203+
}
156204

205+
interface SvgTransformer {
206+
/**
207+
* Custom sprite SVG transformation
208+
* @param svg Sprite SVG
209+
* @return Processed SVG
210+
*/
211+
(svg: string): string;
157212
}
158213

159214
interface Mode {

0 commit comments

Comments
 (0)