Trim vendored svgo-client payload
Remove unused svgo-client files while keeping bin/svgo-client/svgo.cmd runtime behavior intact. Drop node_modules/.bin wrappers, TypeScript declaration files (*.d.ts), and obsolete svgo-cli.js wrapper script. Co-Authored-By: Abacus.AI CLI <agent@abacus.ai>
This commit is contained in:
-7
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Plugins that are bundled with SVGO. This includes plugin presets, and plugins
|
||||
* that are not enabled by default.
|
||||
*
|
||||
* @type {ReadonlyArray<{[Name in keyof import('./types.js').PluginsParams]: import('./types.js').BuiltinPluginOrPreset<Name, import('./types.js').PluginsParams[Name]>;}[keyof import('./types.js').PluginsParams]>}
|
||||
*/
|
||||
export const builtinPlugins: ReadonlyArray<{ [Name in keyof import("./types.js").PluginsParams]: import("./types.js").BuiltinPluginOrPreset<Name, import("./types.js").PluginsParams[Name]>; }[keyof import("./types.js").PluginsParams]>;
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
export class SvgoParserError extends Error {
|
||||
/**
|
||||
* @param {string} message
|
||||
* @param {number} line
|
||||
* @param {number} column
|
||||
* @param {string} source
|
||||
* @param {string=} file
|
||||
*/
|
||||
constructor(message: string, line: number, column: number, source: string, file?: string | undefined);
|
||||
reason: string;
|
||||
line: number;
|
||||
column: number;
|
||||
source: string;
|
||||
}
|
||||
export function parseSvg(data: string, from?: string | undefined): import("./types.js").XastRoot;
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
export function parsePathData(string: string): import("./types.js").PathDataItem[];
|
||||
export function stringifyPathData({ pathData, precision, disableSpaceAfterFlags, }: StringifyPathDataOptions): string;
|
||||
export type ReadNumberState = "none" | "sign" | "whole" | "decimal_point" | "decimal" | "e" | "exponent_sign" | "exponent";
|
||||
export type StringifyPathDataOptions = {
|
||||
pathData: ReadonlyArray<import("./types.js").PathDataItem>;
|
||||
precision?: number | undefined;
|
||||
disableSpaceAfterFlags?: boolean | undefined;
|
||||
};
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
export function stringifySvg(data: import("./types.js").XastRoot, userOptions?: import("./types.js").StringifyOptions | undefined): string;
|
||||
export type Options = Required<import("./types.js").StringifyOptions>;
|
||||
export type State = {
|
||||
indent: string;
|
||||
textContext: import("./types.js").XastElement | null;
|
||||
indentLevel: number;
|
||||
};
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
export function compareSpecificity(a: import("./types.js").Specificity, b: import("./types.js").Specificity): number;
|
||||
export function collectStylesheet(root: import("./types.js").XastRoot): import("./types.js").Stylesheet;
|
||||
export function computeStyle(stylesheet: import("./types.js").Stylesheet, node: import("./types.js").XastElement): import("./types.js").ComputedStyles;
|
||||
export function includesAttrSelector(selector: csstree.ListItem<csstree.CssNode> | string, name: string, value?: string | null, traversed?: boolean): boolean;
|
||||
import * as csstree from 'css-tree';
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export * from "./svgo.js";
|
||||
/**
|
||||
* If you write a tool on top of svgo you might need a way to load svgo config.
|
||||
* You can also specify relative or absolute path and customize current working
|
||||
* directory.
|
||||
*
|
||||
* @type {<T extends string | null>(configFile?: T, cwd?: string) => Promise<T extends string ? import('./svgo.js').Config : import('./svgo.js').Config | null>}
|
||||
*/
|
||||
export const loadConfig: <T extends string | null>(configFile?: T, cwd?: string) => Promise<T extends string ? import("./svgo.js").Config : import("./svgo.js").Config | null>;
|
||||
export function optimize(input: string, config?: import("./svgo.js").Config | undefined): import("./svgo.js").Output;
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
export * from "./types.js";
|
||||
export function optimize(input: string, config?: import("./types.js").Config | undefined): import("./types.js").Output;
|
||||
import { VERSION } from './version.js';
|
||||
import { builtinPlugins } from './builtin.js';
|
||||
import { mapNodesToParents } from './util/map-nodes-to-parents.js';
|
||||
import { querySelector } from './xast.js';
|
||||
import { querySelectorAll } from './xast.js';
|
||||
import * as _collections from '../plugins/_collections.js';
|
||||
export { VERSION, builtinPlugins, mapNodesToParents, querySelector, querySelectorAll, _collections };
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* @param {import('../types.js').XastParent} relativeNode
|
||||
* @param {Map<import('../types.js').XastNode, import('../types.js').XastParent>=} parents
|
||||
* @returns {Required<import('css-select').Options<import('../types.js').XastNode & { children?: any }, import('../types.js').XastElement>>['adapter']}
|
||||
*/
|
||||
export function createAdapter(relativeNode: import("../types.js").XastParent, parents?: Map<import("../types.js").XastNode, import("../types.js").XastParent> | undefined): Required<import("css-select").Options<import("../types.js").XastNode & {
|
||||
children?: any;
|
||||
}, import("../types.js").XastElement>>["adapter"];
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
export function invokePlugins(ast: import("../types.js").XastNode, info: any, plugins: ReadonlyArray<any>, overrides: any, globalOverrides: any): void;
|
||||
export function createPreset<T extends `preset-${string}`>({ name, plugins }: {
|
||||
name: T;
|
||||
plugins: ReadonlyArray<import("../types.js").BuiltinPlugin<string, any>>;
|
||||
}): import("../types.js").BuiltinPluginOrPreset<T, any>;
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
export function encodeSVGDatauri(str: string, type?: import("../types.js").DataUri | undefined): string;
|
||||
export function decodeSVGDatauri(str: string): string;
|
||||
export function cleanupOutData(data: ReadonlyArray<number>, params: CleanupOutDataParams, command?: import("../types.js").PathDataCommand | undefined): string;
|
||||
export function removeLeadingZero(value: number): string;
|
||||
export function hasScripts(node: import("../types.js").XastElement): boolean;
|
||||
export function includesUrlReference(body: string): boolean;
|
||||
export function findReferences(attribute: string, value: string): string[];
|
||||
export function toFixed(num: number, precision: number): number;
|
||||
export type CleanupOutDataParams = {
|
||||
noSpaceAfterFlags?: boolean | undefined;
|
||||
leadingZero?: boolean | undefined;
|
||||
negativeExtraSpace?: boolean | undefined;
|
||||
};
|
||||
-278
@@ -1,278 +0,0 @@
|
||||
import { AddAttributesToSVGElementParams } from '../plugins/addAttributesToSVGElement.js';
|
||||
import { AddClassesToSVGElementParams } from '../plugins/addClassesToSVGElement.js';
|
||||
import { CleanupAttrsParams } from '../plugins/cleanupAttrs.js';
|
||||
import { CleanupIdsParams } from '../plugins/cleanupIds.js';
|
||||
import { CleanupListOfValuesParams } from '../plugins/cleanupListOfValues.js';
|
||||
import { CleanupNumericValuesParams } from '../plugins/cleanupNumericValues.js';
|
||||
import { ConvertColorsParams } from '../plugins/convertColors.js';
|
||||
import { ConvertPathDataParams } from '../plugins/convertPathData.js';
|
||||
import { ConvertShapeToPathParams } from '../plugins/convertShapeToPath.js';
|
||||
import { ConvertStyleToAttrsParams } from '../plugins/convertStyleToAttrs.js';
|
||||
import { ConvertTransformParams } from '../plugins/convertTransform.js';
|
||||
import { InlineStylesParams } from '../plugins/inlineStyles.js';
|
||||
import { MergePathsParams } from '../plugins/mergePaths.js';
|
||||
import { MinifyStylesParams } from '../plugins/minifyStyles.js';
|
||||
import { PrefixIdsParams } from '../plugins/prefixIds.js';
|
||||
import { RemoveAttrsParams } from '../plugins/removeAttrs.js';
|
||||
import { RemoveCommentsParams } from '../plugins/removeComments.js';
|
||||
import { RemoveDeprecatedAttrsParams } from '../plugins/removeDeprecatedAttrs.js';
|
||||
import { RemoveDescParams } from '../plugins/removeDesc.js';
|
||||
import { RemoveEditorsNSDataParams } from '../plugins/removeEditorsNSData.js';
|
||||
import { RemoveElementsByAttrParams } from '../plugins/removeElementsByAttr.js';
|
||||
import { RemoveEmptyTextParams } from '../plugins/removeEmptyText.js';
|
||||
import { RemoveHiddenElemsParams } from '../plugins/removeHiddenElems.js';
|
||||
import { RemoveUnknownsAndDefaultsParams } from '../plugins/removeUnknownsAndDefaults.js';
|
||||
import { RemoveUselessStrokeAndFillParams } from '../plugins/removeUselessStrokeAndFill.js';
|
||||
import { RemoveXlinkParams } from '../plugins/removeXlink.js';
|
||||
import { SortAttrsParams } from '../plugins/sortAttrs.js';
|
||||
export type DefaultPlugins = {
|
||||
cleanupAttrs: CleanupAttrsParams;
|
||||
cleanupEnableBackground: null;
|
||||
cleanupIds: CleanupIdsParams;
|
||||
cleanupNumericValues: CleanupNumericValuesParams;
|
||||
collapseGroups: null;
|
||||
convertColors: ConvertColorsParams;
|
||||
convertEllipseToCircle: null;
|
||||
convertPathData: ConvertPathDataParams;
|
||||
convertShapeToPath: ConvertShapeToPathParams;
|
||||
convertTransform: ConvertTransformParams;
|
||||
mergeStyles: null;
|
||||
inlineStyles: InlineStylesParams;
|
||||
mergePaths: MergePathsParams;
|
||||
minifyStyles: MinifyStylesParams;
|
||||
moveElemsAttrsToGroup: null;
|
||||
moveGroupAttrsToElems: null;
|
||||
removeComments: RemoveCommentsParams;
|
||||
removeDeprecatedAttrs: RemoveDeprecatedAttrsParams;
|
||||
removeDesc: RemoveDescParams;
|
||||
removeDoctype: null;
|
||||
removeEditorsNSData: RemoveEditorsNSDataParams;
|
||||
removeEmptyAttrs: null;
|
||||
removeEmptyContainers: null;
|
||||
removeEmptyText: RemoveEmptyTextParams;
|
||||
removeHiddenElems: RemoveHiddenElemsParams;
|
||||
removeMetadata: null;
|
||||
removeNonInheritableGroupAttrs: null;
|
||||
removeUnknownsAndDefaults: RemoveUnknownsAndDefaultsParams;
|
||||
removeUnusedNS: null;
|
||||
removeUselessDefs: null;
|
||||
removeUselessStrokeAndFill: RemoveUselessStrokeAndFillParams;
|
||||
removeXMLProcInst: null;
|
||||
sortAttrs: SortAttrsParams;
|
||||
sortDefsChildren: null;
|
||||
};
|
||||
export type PresetDefaultOverrides = {
|
||||
[Name in keyof DefaultPlugins]?: DefaultPlugins[Name] | false;
|
||||
};
|
||||
export type BuiltinsWithOptionalParams = DefaultPlugins & {
|
||||
'preset-default': {
|
||||
floatPrecision?: number;
|
||||
/**
|
||||
* All default plugins can be customized or disabled here
|
||||
* for example
|
||||
* {
|
||||
* sortAttrs: { xmlnsOrder: "alphabetical" },
|
||||
* cleanupAttrs: false,
|
||||
* }
|
||||
*/
|
||||
overrides?: PresetDefaultOverrides;
|
||||
};
|
||||
cleanupListOfValues: CleanupListOfValuesParams;
|
||||
convertOneStopGradients: null;
|
||||
convertStyleToAttrs: ConvertStyleToAttrsParams;
|
||||
prefixIds: PrefixIdsParams;
|
||||
removeDimensions: null;
|
||||
removeOffCanvasPaths: null;
|
||||
removeRasterImages: null;
|
||||
removeScripts: null;
|
||||
removeStyleElement: null;
|
||||
removeTitle: null;
|
||||
removeViewBox: null;
|
||||
removeXlink: RemoveXlinkParams;
|
||||
removeXMLNS: null;
|
||||
reusePaths: null;
|
||||
};
|
||||
export type BuiltinsWithRequiredParams = {
|
||||
addAttributesToSVGElement: AddAttributesToSVGElementParams;
|
||||
addClassesToSVGElement: AddClassesToSVGElementParams;
|
||||
removeAttributesBySelector: any;
|
||||
removeAttrs: RemoveAttrsParams;
|
||||
removeElementsByAttr: RemoveElementsByAttrParams;
|
||||
};
|
||||
export type PluginsParams = BuiltinsWithOptionalParams & BuiltinsWithRequiredParams;
|
||||
export type CustomPlugin<T = any> = {
|
||||
name: string;
|
||||
fn: Plugin<T>;
|
||||
params?: T;
|
||||
};
|
||||
export type PluginConfig = keyof BuiltinsWithOptionalParams | {
|
||||
[Name in keyof BuiltinsWithOptionalParams]: {
|
||||
name: Name;
|
||||
params?: BuiltinsWithOptionalParams[Name];
|
||||
};
|
||||
}[keyof BuiltinsWithOptionalParams] | {
|
||||
[Name in keyof BuiltinsWithRequiredParams]: {
|
||||
name: Name;
|
||||
params: BuiltinsWithRequiredParams[Name];
|
||||
};
|
||||
}[keyof BuiltinsWithRequiredParams] | CustomPlugin;
|
||||
export type BuiltinPlugin<Name extends string, Params> = {
|
||||
/** Name of the plugin, also known as the plugin ID. */
|
||||
name: Name;
|
||||
description?: string;
|
||||
fn: Plugin<Params>;
|
||||
};
|
||||
type PresetProperties<IsPreset extends boolean> = {
|
||||
name: IsPreset extends true ? `preset-${string}` : string;
|
||||
/** If the plugin is itself a preset that invokes other plugins. */
|
||||
isPreset: IsPreset extends true ? true : undefined;
|
||||
/**
|
||||
* If {@link #isPreset} is true, an array of the plugins in the preset
|
||||
* in the order that they are invoked.
|
||||
*/
|
||||
plugins: IsPreset extends true ? ReadonlyArray<BuiltinPlugin<string, Object>> : undefined;
|
||||
};
|
||||
export type BuiltinPluginOrPreset<Name extends string, Params> = BuiltinPlugin<Name, Params> & (PresetProperties<true> | Partial<PresetProperties<false>>);
|
||||
export type XastDoctype = {
|
||||
type: 'doctype';
|
||||
name: string;
|
||||
data: {
|
||||
doctype: string;
|
||||
};
|
||||
};
|
||||
export type XastInstruction = {
|
||||
type: 'instruction';
|
||||
name: string;
|
||||
value: string;
|
||||
};
|
||||
export type XastComment = {
|
||||
type: 'comment';
|
||||
value: string;
|
||||
};
|
||||
export type XastCdata = {
|
||||
type: 'cdata';
|
||||
value: string;
|
||||
};
|
||||
export type XastText = {
|
||||
type: 'text';
|
||||
value: string;
|
||||
};
|
||||
export type XastElement = {
|
||||
type: 'element';
|
||||
name: string;
|
||||
attributes: Record<string, string>;
|
||||
children: XastChild[];
|
||||
};
|
||||
export type XastChild = XastDoctype | XastInstruction | XastComment | XastCdata | XastText | XastElement;
|
||||
export type XastRoot = {
|
||||
type: 'root';
|
||||
children: XastChild[];
|
||||
};
|
||||
export type XastParent = XastRoot | XastElement;
|
||||
export type XastNode = XastRoot | XastChild;
|
||||
export type StringifyOptions = {
|
||||
doctypeStart?: string;
|
||||
doctypeEnd?: string;
|
||||
procInstStart?: string;
|
||||
procInstEnd?: string;
|
||||
tagOpenStart?: string;
|
||||
tagOpenEnd?: string;
|
||||
tagCloseStart?: string;
|
||||
tagCloseEnd?: string;
|
||||
tagShortStart?: string;
|
||||
tagShortEnd?: string;
|
||||
attrStart?: string;
|
||||
attrEnd?: string;
|
||||
commentStart?: string;
|
||||
commentEnd?: string;
|
||||
cdataStart?: string;
|
||||
cdataEnd?: string;
|
||||
textStart?: string;
|
||||
textEnd?: string;
|
||||
indent?: number | string;
|
||||
regEntities?: RegExp;
|
||||
regValEntities?: RegExp;
|
||||
encodeEntity?: (char: string) => string;
|
||||
pretty?: boolean;
|
||||
useShortTags?: boolean;
|
||||
eol?: 'lf' | 'crlf';
|
||||
finalNewline?: boolean;
|
||||
};
|
||||
export type VisitorNode<Node> = {
|
||||
enter?: (node: Node, parentNode: XastParent) => void | symbol;
|
||||
exit?: (node: Node, parentNode: XastParent) => void;
|
||||
};
|
||||
export type VisitorRoot = {
|
||||
enter?: (node: XastRoot, parentNode: null) => void;
|
||||
exit?: (node: XastRoot, parentNode: null) => void;
|
||||
};
|
||||
export type Visitor = {
|
||||
doctype?: VisitorNode<XastDoctype>;
|
||||
instruction?: VisitorNode<XastInstruction>;
|
||||
comment?: VisitorNode<XastComment>;
|
||||
cdata?: VisitorNode<XastCdata>;
|
||||
text?: VisitorNode<XastText>;
|
||||
element?: VisitorNode<XastElement>;
|
||||
root?: VisitorRoot;
|
||||
};
|
||||
export type PluginInfo = {
|
||||
path?: string;
|
||||
multipassCount: number;
|
||||
};
|
||||
export type Plugin<P = null> = (root: XastRoot, params: P, info: PluginInfo) => Visitor | null | void;
|
||||
export type Specificity = [number, number, number];
|
||||
export type StylesheetDeclaration = {
|
||||
name: string;
|
||||
value: string;
|
||||
important: boolean;
|
||||
};
|
||||
export type StylesheetRule = {
|
||||
dynamic: boolean;
|
||||
selector: string;
|
||||
specificity: Specificity;
|
||||
declarations: StylesheetDeclaration[];
|
||||
};
|
||||
export type Stylesheet = {
|
||||
rules: StylesheetRule[];
|
||||
parents: Map<XastElement, XastParent>;
|
||||
};
|
||||
export type StaticStyle = {
|
||||
type: 'static';
|
||||
inherited: boolean;
|
||||
value: string;
|
||||
};
|
||||
export type DynamicStyle = {
|
||||
type: 'dynamic';
|
||||
inherited: boolean;
|
||||
};
|
||||
export type ComputedStyles = Record<string, StaticStyle | DynamicStyle>;
|
||||
export type PathDataCommand = 'M' | 'm' | 'Z' | 'z' | 'L' | 'l' | 'H' | 'h' | 'V' | 'v' | 'C' | 'c' | 'S' | 's' | 'Q' | 'q' | 'T' | 't' | 'A' | 'a';
|
||||
export type PathDataItem = {
|
||||
command: PathDataCommand;
|
||||
args: number[];
|
||||
};
|
||||
export type DataUri = 'base64' | 'enc' | 'unenc';
|
||||
export type Config = {
|
||||
/** Can be used by plugins, for example prefixIds. */
|
||||
path?: string;
|
||||
/** Pass over SVGs multiple times to ensure all optimizations are applied. */
|
||||
multipass?: boolean;
|
||||
/**
|
||||
* Precision of floating point numbers. Will be passed to each plugin that
|
||||
* supports this param.
|
||||
*/
|
||||
floatPrecision?: number;
|
||||
/**
|
||||
* Plugins configuration. By default SVGO uses `preset-default`, but may
|
||||
* contain builtin or custom plugins.
|
||||
*/
|
||||
plugins?: PluginConfig[];
|
||||
/** Options for rendering optimized SVG from AST. */
|
||||
js2svg?: StringifyOptions;
|
||||
/** Output as Data URI string. */
|
||||
datauri?: DataUri;
|
||||
};
|
||||
export type Output = {
|
||||
data: string;
|
||||
};
|
||||
export {};
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Maps all nodes to their parent node recursively.
|
||||
*
|
||||
* @param {import('../types.js').XastParent} node
|
||||
* @returns {Map<import('../types.js').XastNode, import('../types.js').XastParent>}
|
||||
*/
|
||||
export function mapNodesToParents(node: import("../types.js").XastParent): Map<import("../types.js").XastNode, import("../types.js").XastParent>;
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
export const visitSkip: unique symbol;
|
||||
export function visit(node: import("../types.js").XastNode, visitor: import("../types.js").Visitor, parentNode?: any | undefined): void;
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* Version of SVGO.
|
||||
*
|
||||
* @type {string}
|
||||
* @since 4.0.0
|
||||
*/
|
||||
export const VERSION: string;
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
export function querySelectorAll(node: import("./types.js").XastParent, selector: string, parents?: Map<import("./types.js").XastNode, import("./types.js").XastParent> | undefined): import("./types.js").XastChild[];
|
||||
export function querySelector(node: import("./types.js").XastParent, selector: string, parents?: Map<import("./types.js").XastNode, import("./types.js").XastParent> | undefined): import("./types.js").XastChild | null;
|
||||
export function matches(node: import("./types.js").XastElement, selector: string, parents?: Map<import("./types.js").XastNode, import("./types.js").XastParent> | undefined): boolean;
|
||||
export function detachNodeFromParent(node: import("./types.js").XastChild, parentNode: import("./types.js").XastParent): void;
|
||||
-99
@@ -1,99 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Based on https://www.w3.org/TR/SVG11/intro.html#Definitions.
|
||||
*/
|
||||
/**
|
||||
* @type {Readonly<Record<string, Set<string>>>}
|
||||
*/
|
||||
export const elemsGroups: Readonly<Record<string, Set<string>>>;
|
||||
/**
|
||||
* Elements where adding or removing whitespace may affect rendering, metadata,
|
||||
* or semantic meaning.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre
|
||||
* @type {Readonly<Set<string>>}
|
||||
*/
|
||||
export const textElems: Readonly<Set<string>>;
|
||||
/**
|
||||
* @type {Readonly<Set<string>>}
|
||||
*/
|
||||
export const pathElems: Readonly<Set<string>>;
|
||||
/**
|
||||
* @type {Readonly<Record<string, Set<string>>>}
|
||||
* @see https://www.w3.org/TR/SVG11/intro.html#Definitions
|
||||
*/
|
||||
export const attrsGroups: Readonly<Record<string, Set<string>>>;
|
||||
/**
|
||||
* @type {Readonly<Record<string, Record<string, string>>>}
|
||||
*/
|
||||
export const attrsGroupsDefaults: Readonly<Record<string, Record<string, string>>>;
|
||||
/**
|
||||
* @type {Readonly<Record<string, { safe?: Set<string>; unsafe?: Set<string> }>>}
|
||||
* @see https://www.w3.org/TR/SVG11/intro.html#Definitions
|
||||
*/
|
||||
export const attrsGroupsDeprecated: Readonly<Record<string, {
|
||||
safe?: Set<string>;
|
||||
unsafe?: Set<string>;
|
||||
}>>;
|
||||
/**
|
||||
* @type {Readonly<Record<string, {
|
||||
* attrsGroups: Set<string>,
|
||||
* attrs?: Set<string>,
|
||||
* defaults?: Record<string, string>,
|
||||
* deprecated?: {
|
||||
* safe?: Set<string>,
|
||||
* unsafe?: Set<string>,
|
||||
* },
|
||||
* contentGroups?: Set<string>,
|
||||
* content?: Set<string>,
|
||||
* }>>}
|
||||
* @see https://www.w3.org/TR/SVG11/eltindex.html
|
||||
*/
|
||||
export const elems: Readonly<Record<string, {
|
||||
attrsGroups: Set<string>;
|
||||
attrs?: Set<string>;
|
||||
defaults?: Record<string, string>;
|
||||
deprecated?: {
|
||||
safe?: Set<string>;
|
||||
unsafe?: Set<string>;
|
||||
};
|
||||
contentGroups?: Set<string>;
|
||||
content?: Set<string>;
|
||||
}>>;
|
||||
/**
|
||||
* @type {Readonly<Set<string>>}
|
||||
* @see https://wiki.inkscape.org/wiki/index.php/Inkscape-specific_XML_attributes
|
||||
*/
|
||||
export const editorNamespaces: Readonly<Set<string>>;
|
||||
/**
|
||||
* @type {Readonly<Set<string>>}
|
||||
* @see https://www.w3.org/TR/SVG11/linking.html#processingIRI
|
||||
*/
|
||||
export const referencesProps: Readonly<Set<string>>;
|
||||
/**
|
||||
* @type {Readonly<Set<string>>}
|
||||
* @see https://www.w3.org/TR/SVG11/propidx.html
|
||||
*/
|
||||
export const inheritableAttrs: Readonly<Set<string>>;
|
||||
/**
|
||||
* @type {Readonly<Set<string>>}
|
||||
*/
|
||||
export const presentationNonInheritableGroupAttrs: Readonly<Set<string>>;
|
||||
/**
|
||||
* @type {Readonly<Record<string, string>>}
|
||||
* @see https://www.w3.org/TR/SVG11/single-page.html#types-ColorKeywords
|
||||
*/
|
||||
export const colorsNames: Readonly<Record<string, string>>;
|
||||
/**
|
||||
* @type {Readonly<Record<string, string>>}
|
||||
*/
|
||||
export const colorsShortNames: Readonly<Record<string, string>>;
|
||||
/**
|
||||
* @type {Readonly<Set<string>>}
|
||||
* @see https://www.w3.org/TR/SVG11/single-page.html#types-DataTypeColor
|
||||
*/
|
||||
export const colorsProps: Readonly<Set<string>>;
|
||||
/**
|
||||
* @type {Readonly<Record<string, Set<string>>>}
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
|
||||
*/
|
||||
export const pseudoClasses: Readonly<Record<string, Set<string>>>;
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
export function path2js(path: import("../lib/types.js").XastElement): import("../lib/types.js").PathDataItem[];
|
||||
export function js2path(path: import("../lib/types.js").XastElement, data: ReadonlyArray<import("../lib/types.js").PathDataItem>, params: Js2PathParams): void;
|
||||
export function intersects(path1: ReadonlyArray<import("../lib/types.js").PathDataItem>, path2: ReadonlyArray<import("../lib/types.js").PathDataItem>): boolean;
|
||||
export type Js2PathParams = {
|
||||
floatPrecision?: number | undefined;
|
||||
noSpaceAfterFlags?: boolean | undefined;
|
||||
};
|
||||
export type Point = {
|
||||
list: number[][];
|
||||
minX: number;
|
||||
minY: number;
|
||||
maxX: number;
|
||||
maxY: number;
|
||||
};
|
||||
export type Points = {
|
||||
list: Point[];
|
||||
minX: number;
|
||||
minY: number;
|
||||
maxX: number;
|
||||
maxY: number;
|
||||
};
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
export function transform2js(transformString: string): TransformItem[];
|
||||
export function transformsMultiply(transforms: ReadonlyArray<TransformItem>): TransformItem;
|
||||
export function matrixToTransform(origMatrix: TransformItem, params: TransformParams): TransformItem[];
|
||||
export function transformArc(cursor: [number, number], arc: number[], transform: ReadonlyArray<number>): number[];
|
||||
export function roundTransform(transform: TransformItem, params: TransformParams): TransformItem;
|
||||
export function js2transform(transformJS: ReadonlyArray<TransformItem>, params: TransformParams): string;
|
||||
export type TransformItem = {
|
||||
name: string;
|
||||
data: number[];
|
||||
};
|
||||
export type TransformParams = {
|
||||
convertToShorts: boolean;
|
||||
degPrecision?: number | undefined;
|
||||
floatPrecision: number;
|
||||
transformPrecision: number;
|
||||
matrixToTransform: boolean;
|
||||
shortTranslate: boolean;
|
||||
shortScale: boolean;
|
||||
shortRotate: boolean;
|
||||
removeUseless: boolean;
|
||||
collapseIntoOne: boolean;
|
||||
leadingZero: boolean;
|
||||
negativeExtraSpace: boolean;
|
||||
};
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* @typedef AddAttributesToSVGElementParams
|
||||
* @property {string | Record<string, null | string>=} attribute
|
||||
* @property {Array<string | Record<string, null | string>>=} attributes
|
||||
*/
|
||||
export const name: "addAttributesToSVGElement";
|
||||
export const description: "adds attributes to an outer <svg> element";
|
||||
/**
|
||||
* Add attributes to an outer <svg> element.
|
||||
*
|
||||
* @author April Arcus
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<AddAttributesToSVGElementParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<AddAttributesToSVGElementParams>;
|
||||
export type AddAttributesToSVGElementParams = {
|
||||
attribute?: (string | Record<string, null | string>) | undefined;
|
||||
attributes?: Array<string | Record<string, null | string>> | undefined;
|
||||
};
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* @typedef AddClassesToSVGElementParams
|
||||
* @property {string | ((node: import('../lib/types.js').XastElement, info: import('../lib/types.js').PluginInfo) => string)=} className
|
||||
* @property {Array<string | ((node: import('../lib/types.js').XastElement, info: import('../lib/types.js').PluginInfo) => string)>=} classNames
|
||||
*/
|
||||
export const name: "addClassesToSVGElement";
|
||||
export const description: "adds classnames to an outer <svg> element";
|
||||
/**
|
||||
* Add classnames to an outer <svg> element. Example config:
|
||||
*
|
||||
* plugins: [
|
||||
* {
|
||||
* name: "addClassesToSVGElement",
|
||||
* params: {
|
||||
* className: "mySvg"
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
*
|
||||
* plugins: [
|
||||
* {
|
||||
* name: "addClassesToSVGElement",
|
||||
* params: {
|
||||
* classNames: ["mySvg", "size-big"]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
*
|
||||
* @author April Arcus
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<AddClassesToSVGElementParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<AddClassesToSVGElementParams>;
|
||||
export type AddClassesToSVGElementParams = {
|
||||
className?: (string | ((node: import("../lib/types.js").XastElement, info: import("../lib/types.js").PluginInfo) => string)) | undefined;
|
||||
classNames?: Array<string | ((node: import("../lib/types.js").XastElement, info: import("../lib/types.js").PluginInfo) => string)> | undefined;
|
||||
};
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* Apply transformation(s) to the Path data.
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<{
|
||||
* transformPrecision: number,
|
||||
* applyTransformsStroked: boolean,
|
||||
* }>}
|
||||
*/
|
||||
export const applyTransforms: import("../lib/types.js").Plugin<{
|
||||
transformPrecision: number;
|
||||
applyTransformsStroked: boolean;
|
||||
}>;
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* @typedef CleanupAttrsParams
|
||||
* @property {boolean=} newlines
|
||||
* @property {boolean=} trim
|
||||
* @property {boolean=} spaces
|
||||
*/
|
||||
export const name: "cleanupAttrs";
|
||||
export const description: "cleanups attributes from newlines, trailing and repeating spaces";
|
||||
/**
|
||||
* Cleanup attributes values from newlines, trailing and repeating spaces.
|
||||
*
|
||||
* @author Kir Belevich
|
||||
* @type {import('../lib/types.js').Plugin<CleanupAttrsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<CleanupAttrsParams>;
|
||||
export type CleanupAttrsParams = {
|
||||
newlines?: boolean | undefined;
|
||||
trim?: boolean | undefined;
|
||||
spaces?: boolean | undefined;
|
||||
};
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
export const name: "cleanupEnableBackground";
|
||||
export const description: "remove or cleanup enable-background attribute when possible";
|
||||
/**
|
||||
* Remove or cleanup enable-background attr which coincides with a width/height
|
||||
* box.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/filters.html#EnableBackgroundProperty
|
||||
* @example
|
||||
* <svg width="100" height="50" enable-background="new 0 0 100 50">
|
||||
* ⬇
|
||||
* <svg width="100" height="50">
|
||||
* @author Kir Belevich
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* @typedef CleanupIdsParams
|
||||
* @property {boolean=} remove
|
||||
* @property {boolean=} minify
|
||||
* @property {string[]=} preserve
|
||||
* @property {string[]=} preservePrefixes
|
||||
* @property {boolean=} force
|
||||
*/
|
||||
export const name: "cleanupIds";
|
||||
export const description: "removes unused IDs and minifies used";
|
||||
/**
|
||||
* Remove unused and minify used IDs (only if there are no `<style>` or
|
||||
* `<script>` nodes).
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<CleanupIdsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<CleanupIdsParams>;
|
||||
export type CleanupIdsParams = {
|
||||
remove?: boolean | undefined;
|
||||
minify?: boolean | undefined;
|
||||
preserve?: string[] | undefined;
|
||||
preservePrefixes?: string[] | undefined;
|
||||
force?: boolean | undefined;
|
||||
};
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* @typedef CleanupListOfValuesParams
|
||||
* @property {number=} floatPrecision
|
||||
* @property {boolean=} leadingZero
|
||||
* @property {boolean=} defaultPx
|
||||
* @property {boolean=} convertToPx
|
||||
*/
|
||||
export const name: "cleanupListOfValues";
|
||||
export const description: "rounds list of values to the fixed precision";
|
||||
/**
|
||||
* Round list of values to the fixed precision.
|
||||
*
|
||||
* @example
|
||||
* <svg viewBox="0 0 200.28423 200.28423" enable-background="new 0 0 200.28423 200.28423">
|
||||
* ⬇
|
||||
* <svg viewBox="0 0 200.284 200.284" enable-background="new 0 0 200.284 200.284">
|
||||
*
|
||||
* <polygon points="208.250977 77.1308594 223.069336 ... "/>
|
||||
* ⬇
|
||||
* <polygon points="208.251 77.131 223.069 ... "/>
|
||||
*
|
||||
* @author kiyopikko
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<CleanupListOfValuesParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<CleanupListOfValuesParams>;
|
||||
export type CleanupListOfValuesParams = {
|
||||
floatPrecision?: number | undefined;
|
||||
leadingZero?: boolean | undefined;
|
||||
defaultPx?: boolean | undefined;
|
||||
convertToPx?: boolean | undefined;
|
||||
};
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* @typedef CleanupNumericValuesParams
|
||||
* @property {number=} floatPrecision
|
||||
* @property {boolean=} leadingZero
|
||||
* @property {boolean=} defaultPx
|
||||
* @property {boolean=} convertToPx
|
||||
*/
|
||||
export const name: "cleanupNumericValues";
|
||||
export const description: "rounds numeric values to the fixed precision, removes default \"px\" units";
|
||||
/**
|
||||
* Round numeric values to the fixed precision, remove default 'px' units.
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<CleanupNumericValuesParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<CleanupNumericValuesParams>;
|
||||
export type CleanupNumericValuesParams = {
|
||||
floatPrecision?: number | undefined;
|
||||
leadingZero?: boolean | undefined;
|
||||
defaultPx?: boolean | undefined;
|
||||
convertToPx?: boolean | undefined;
|
||||
};
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
export const name: "collapseGroups";
|
||||
export const description: "collapses useless groups";
|
||||
/**
|
||||
* Collapse useless groups.
|
||||
*
|
||||
* @example
|
||||
* <g>
|
||||
* <g attr1="val1">
|
||||
* <path d="..."/>
|
||||
* </g>
|
||||
* </g>
|
||||
* ⬇
|
||||
* <g>
|
||||
* <g>
|
||||
* <path attr1="val1" d="..."/>
|
||||
* </g>
|
||||
* </g>
|
||||
* ⬇
|
||||
* <path attr1="val1" d="..."/>
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* @typedef ConvertColorsParams
|
||||
* @property {boolean | string | RegExp=} currentColor
|
||||
* @property {boolean=} names2hex
|
||||
* @property {boolean=} rgb2hex
|
||||
* @property {false | 'lower' | 'upper'=} convertCase
|
||||
* @property {boolean=} shorthex
|
||||
* @property {boolean=} shortname
|
||||
*/
|
||||
export const name: "convertColors";
|
||||
export const description: "converts colors: rgb() to #rrggbb and #rrggbb to #rgb";
|
||||
/**
|
||||
* Convert different colors formats in element attributes to hex.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/types.html#DataTypeColor
|
||||
* @see https://www.w3.org/TR/SVG11/single-page.html#types-ColorKeywords
|
||||
*
|
||||
* @example
|
||||
* Convert color name keyword to long hex:
|
||||
* fuchsia ➡ #ff00ff
|
||||
*
|
||||
* Convert rgb() to long hex:
|
||||
* rgb(255, 0, 255) ➡ #ff00ff
|
||||
* rgb(50%, 100, 100%) ➡ #7f64ff
|
||||
*
|
||||
* Convert long hex to short hex:
|
||||
* #aabbcc ➡ #abc
|
||||
*
|
||||
* Convert hex to short name
|
||||
* #000080 ➡ navy
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<ConvertColorsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<ConvertColorsParams>;
|
||||
export type ConvertColorsParams = {
|
||||
currentColor?: (boolean | string | RegExp) | undefined;
|
||||
names2hex?: boolean | undefined;
|
||||
rgb2hex?: boolean | undefined;
|
||||
convertCase?: (false | "lower" | "upper") | undefined;
|
||||
shorthex?: boolean | undefined;
|
||||
shortname?: boolean | undefined;
|
||||
};
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
export const name: "convertEllipseToCircle";
|
||||
export const description: "converts non-eccentric <ellipse>s to <circle>s";
|
||||
/**
|
||||
* Converts non-eccentric <ellipse>s to <circle>s.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/shapes.html
|
||||
*
|
||||
* @author Taylor Hunt
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
export const name: "convertOneStopGradients";
|
||||
export const description: "converts one-stop (single color) gradients to a plain color";
|
||||
/**
|
||||
* Converts one-stop (single color) gradients to a plain color.
|
||||
*
|
||||
* @author Seth Falco <seth@falco.fun>
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
/**
|
||||
* @typedef {[number, number]} Point
|
||||
*
|
||||
* @typedef Circle
|
||||
* @property {Point} center
|
||||
* @property {number} radius
|
||||
*
|
||||
* @typedef MakeArcs
|
||||
* @property {number} threshold
|
||||
* @property {number} tolerance
|
||||
*
|
||||
* @typedef ConvertPathDataParams
|
||||
* @property {boolean=} applyTransforms
|
||||
* @property {boolean=} applyTransformsStroked
|
||||
* @property {MakeArcs=} makeArcs
|
||||
* @property {boolean=} straightCurves
|
||||
* @property {boolean=} convertToQ
|
||||
* @property {boolean=} lineShorthands
|
||||
* @property {boolean=} convertToZ
|
||||
* @property {boolean=} curveSmoothShorthands
|
||||
* @property {number | false=} floatPrecision
|
||||
* @property {number=} transformPrecision
|
||||
* @property {boolean=} smartArcRounding
|
||||
* @property {boolean=} removeUseless
|
||||
* @property {boolean=} collapseRepeated
|
||||
* @property {boolean=} utilizeAbsolute
|
||||
* @property {boolean=} leadingZero
|
||||
* @property {boolean=} negativeExtraSpace
|
||||
* @property {boolean=} noSpaceAfterFlags
|
||||
* @property {boolean=} forceAbsolutePath
|
||||
*
|
||||
* @typedef {Required<ConvertPathDataParams>} InternalParams
|
||||
*/
|
||||
export const name: "convertPathData";
|
||||
export const description: "optimizes path data: writes in shorter form, applies transformations";
|
||||
/**
|
||||
* Convert absolute Path to relative,
|
||||
* collapse repeated instructions,
|
||||
* detect and convert Lineto shorthands,
|
||||
* remove useless instructions like "l0,0",
|
||||
* trim useless delimiters and leading zeros,
|
||||
* decrease accuracy of floating-point numbers.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/paths.html#PathData
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<ConvertPathDataParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<ConvertPathDataParams>;
|
||||
export type Point = [number, number];
|
||||
export type Circle = {
|
||||
center: Point;
|
||||
radius: number;
|
||||
};
|
||||
export type MakeArcs = {
|
||||
threshold: number;
|
||||
tolerance: number;
|
||||
};
|
||||
export type ConvertPathDataParams = {
|
||||
applyTransforms?: boolean | undefined;
|
||||
applyTransformsStroked?: boolean | undefined;
|
||||
makeArcs?: MakeArcs | undefined;
|
||||
straightCurves?: boolean | undefined;
|
||||
convertToQ?: boolean | undefined;
|
||||
lineShorthands?: boolean | undefined;
|
||||
convertToZ?: boolean | undefined;
|
||||
curveSmoothShorthands?: boolean | undefined;
|
||||
floatPrecision?: (number | false) | undefined;
|
||||
transformPrecision?: number | undefined;
|
||||
smartArcRounding?: boolean | undefined;
|
||||
removeUseless?: boolean | undefined;
|
||||
collapseRepeated?: boolean | undefined;
|
||||
utilizeAbsolute?: boolean | undefined;
|
||||
leadingZero?: boolean | undefined;
|
||||
negativeExtraSpace?: boolean | undefined;
|
||||
noSpaceAfterFlags?: boolean | undefined;
|
||||
forceAbsolutePath?: boolean | undefined;
|
||||
};
|
||||
export type InternalParams = Required<ConvertPathDataParams>;
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* @typedef ConvertShapeToPathParams
|
||||
* @property {boolean=} convertArcs
|
||||
* @property {number=} floatPrecision
|
||||
*/
|
||||
export const name: "convertShapeToPath";
|
||||
export const description: "converts basic shapes to more compact path form";
|
||||
/**
|
||||
* Converts basic shape to more compact path. It also allows further
|
||||
* optimizations like combining paths with similar attributes.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/shapes.html
|
||||
*
|
||||
* @author Lev Solntsev
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<ConvertShapeToPathParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<ConvertShapeToPathParams>;
|
||||
export type ConvertShapeToPathParams = {
|
||||
convertArcs?: boolean | undefined;
|
||||
floatPrecision?: number | undefined;
|
||||
};
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* @typedef ConvertStyleToAttrsParams
|
||||
* @property {boolean=} keepImportant
|
||||
*/
|
||||
export const name: "convertStyleToAttrs";
|
||||
export const description: "converts style to attributes";
|
||||
/**
|
||||
* Convert style in attributes. Cleanups comments and illegal declarations (without colon) as a side effect.
|
||||
*
|
||||
* @example
|
||||
* <g style="fill:#000; color: #fff;">
|
||||
* ⬇
|
||||
* <g fill="#000" color="#fff">
|
||||
*
|
||||
* @example
|
||||
* <g style="fill:#000; color: #fff; -webkit-blah: blah">
|
||||
* ⬇
|
||||
* <g fill="#000" color="#fff" style="-webkit-blah: blah">
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<ConvertStyleToAttrsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<ConvertStyleToAttrsParams>;
|
||||
export type ConvertStyleToAttrsParams = {
|
||||
keepImportant?: boolean | undefined;
|
||||
};
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
/**
|
||||
* @typedef ConvertTransformParams
|
||||
* @property {boolean=} convertToShorts
|
||||
* @property {number=} degPrecision
|
||||
* @property {number=} floatPrecision
|
||||
* @property {number=} transformPrecision
|
||||
* @property {boolean=} matrixToTransform
|
||||
* @property {boolean=} shortTranslate
|
||||
* @property {boolean=} shortScale
|
||||
* @property {boolean=} shortRotate
|
||||
* @property {boolean=} removeUseless
|
||||
* @property {boolean=} collapseIntoOne
|
||||
* @property {boolean=} leadingZero
|
||||
* @property {boolean=} negativeExtraSpace
|
||||
*
|
||||
* @typedef TransformParams
|
||||
* @property {boolean} convertToShorts
|
||||
* @property {number=} degPrecision
|
||||
* @property {number} floatPrecision
|
||||
* @property {number} transformPrecision
|
||||
* @property {boolean} matrixToTransform
|
||||
* @property {boolean} shortTranslate
|
||||
* @property {boolean} shortScale
|
||||
* @property {boolean} shortRotate
|
||||
* @property {boolean} removeUseless
|
||||
* @property {boolean} collapseIntoOne
|
||||
* @property {boolean} leadingZero
|
||||
* @property {boolean} negativeExtraSpace
|
||||
*
|
||||
* @typedef TransformItem
|
||||
* @property {string} name
|
||||
* @property {number[]} data
|
||||
*/
|
||||
export const name: "convertTransform";
|
||||
export const description: "collapses multiple transformations and optimizes it";
|
||||
/**
|
||||
* Convert matrices to the short aliases,
|
||||
* convert long translate, scale or rotate transform notations to the shorts ones,
|
||||
* convert transforms to the matrices and multiply them all into one,
|
||||
* remove useless transforms.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/coords.html#TransformMatrixDefined
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<ConvertTransformParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<ConvertTransformParams>;
|
||||
export type ConvertTransformParams = {
|
||||
convertToShorts?: boolean | undefined;
|
||||
degPrecision?: number | undefined;
|
||||
floatPrecision?: number | undefined;
|
||||
transformPrecision?: number | undefined;
|
||||
matrixToTransform?: boolean | undefined;
|
||||
shortTranslate?: boolean | undefined;
|
||||
shortScale?: boolean | undefined;
|
||||
shortRotate?: boolean | undefined;
|
||||
removeUseless?: boolean | undefined;
|
||||
collapseIntoOne?: boolean | undefined;
|
||||
leadingZero?: boolean | undefined;
|
||||
negativeExtraSpace?: boolean | undefined;
|
||||
};
|
||||
export type TransformParams = {
|
||||
convertToShorts: boolean;
|
||||
degPrecision?: number | undefined;
|
||||
floatPrecision: number;
|
||||
transformPrecision: number;
|
||||
matrixToTransform: boolean;
|
||||
shortTranslate: boolean;
|
||||
shortScale: boolean;
|
||||
shortRotate: boolean;
|
||||
removeUseless: boolean;
|
||||
collapseIntoOne: boolean;
|
||||
leadingZero: boolean;
|
||||
negativeExtraSpace: boolean;
|
||||
};
|
||||
export type TransformItem = {
|
||||
name: string;
|
||||
data: number[];
|
||||
};
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* @typedef InlineStylesParams
|
||||
* @property {boolean=} onlyMatchedOnce Inlines selectors that match once only.
|
||||
* @property {boolean=} removeMatchedSelectors
|
||||
* Clean up matched selectors. Unused selects are left as-is.
|
||||
* @property {string[]=} useMqs
|
||||
* Media queries to use. An empty string indicates all selectors outside of
|
||||
* media queries.
|
||||
* @property {string[]=} usePseudos
|
||||
* Pseudo-classes and elements to use. An empty string indicates all
|
||||
* non-pseudo-classes and elements.
|
||||
*/
|
||||
export const name: "inlineStyles";
|
||||
export const description: "inline styles (additional options)";
|
||||
/**
|
||||
* Merges styles from style nodes into inline styles.
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<InlineStylesParams>}
|
||||
* @author strarsis <strarsis@gmail.com>
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<InlineStylesParams>;
|
||||
export type InlineStylesParams = {
|
||||
/**
|
||||
* Inlines selectors that match once only.
|
||||
*/
|
||||
onlyMatchedOnce?: boolean | undefined;
|
||||
/**
|
||||
* Clean up matched selectors. Unused selects are left as-is.
|
||||
*/
|
||||
removeMatchedSelectors?: boolean | undefined;
|
||||
/**
|
||||
* Media queries to use. An empty string indicates all selectors outside of
|
||||
* media queries.
|
||||
*/
|
||||
useMqs?: string[] | undefined;
|
||||
/**
|
||||
* Pseudo-classes and elements to use. An empty string indicates all
|
||||
* non-pseudo-classes and elements.
|
||||
*/
|
||||
usePseudos?: string[] | undefined;
|
||||
};
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @typedef MergePathsParams
|
||||
* @property {boolean=} force
|
||||
* @property {number=} floatPrecision
|
||||
* @property {boolean=} noSpaceAfterFlags
|
||||
*/
|
||||
export const name: "mergePaths";
|
||||
export const description: "merges multiple paths in one if possible";
|
||||
/**
|
||||
* Merge multiple Paths into one.
|
||||
*
|
||||
* @author Kir Belevich, Lev Solntsev
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<MergePathsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<MergePathsParams>;
|
||||
export type MergePathsParams = {
|
||||
force?: boolean | undefined;
|
||||
floatPrecision?: number | undefined;
|
||||
noSpaceAfterFlags?: boolean | undefined;
|
||||
};
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export const name: "mergeStyles";
|
||||
export const description: "merge multiple style elements into one";
|
||||
/**
|
||||
* Merge multiple style elements into one.
|
||||
*
|
||||
* @author strarsis <strarsis@gmail.com>
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* @typedef Usage
|
||||
* @property {boolean=} force
|
||||
* @property {boolean=} ids
|
||||
* @property {boolean=} classes
|
||||
* @property {boolean=} tags
|
||||
*
|
||||
* @typedef MinifyStylesParams
|
||||
* @property {boolean=} restructure Disable or enable a structure optimizations.
|
||||
* @property {boolean=} forceMediaMerge
|
||||
* Enables merging of `@media` rules with the same media query split by other
|
||||
* rules. Unsafe in general, but should work fine in most cases. Use it on
|
||||
* your own risk.
|
||||
* @property {'exclamation' | 'first-exclamation' | boolean=} comments
|
||||
* Specify what comments to leave:
|
||||
* - `'exclamation'` or `true` — leave all exclamation comments
|
||||
* - `'first-exclamation'` — remove every comment except first one
|
||||
* - `false` — remove all comments
|
||||
* @property {boolean | Usage=} usage Advanced optimizations.
|
||||
*/
|
||||
export const name: "minifyStyles";
|
||||
export const description: "minifies styles and removes unused styles";
|
||||
/**
|
||||
* Minifies styles (<style> element + style attribute) using CSSO.
|
||||
*
|
||||
* @author strarsis <strarsis@gmail.com>
|
||||
* @type {import('../lib/types.js').Plugin<MinifyStylesParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<MinifyStylesParams>;
|
||||
export type Usage = {
|
||||
force?: boolean | undefined;
|
||||
ids?: boolean | undefined;
|
||||
classes?: boolean | undefined;
|
||||
tags?: boolean | undefined;
|
||||
};
|
||||
export type MinifyStylesParams = {
|
||||
/**
|
||||
* Disable or enable a structure optimizations.
|
||||
*/
|
||||
restructure?: boolean | undefined;
|
||||
/**
|
||||
* Enables merging of `@media` rules with the same media query split by other
|
||||
* rules. Unsafe in general, but should work fine in most cases. Use it on
|
||||
* your own risk.
|
||||
*/
|
||||
forceMediaMerge?: boolean | undefined;
|
||||
/**
|
||||
* Specify what comments to leave:
|
||||
* - `'exclamation'` or `true` — leave all exclamation comments
|
||||
* - `'first-exclamation'` — remove every comment except first one
|
||||
* - `false` — remove all comments
|
||||
*/
|
||||
comments?: ("exclamation" | "first-exclamation" | boolean) | undefined;
|
||||
/**
|
||||
* Advanced optimizations.
|
||||
*/
|
||||
usage?: (boolean | Usage) | undefined;
|
||||
};
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
export const name: "moveElemsAttrsToGroup";
|
||||
export const description: "Move common attributes of group children to the group";
|
||||
/**
|
||||
* Move common attributes of group children to the group
|
||||
*
|
||||
* @example
|
||||
* <g attr1="val1">
|
||||
* <g attr2="val2">
|
||||
* text
|
||||
* </g>
|
||||
* <circle attr2="val2" attr3="val3"/>
|
||||
* </g>
|
||||
* ⬇
|
||||
* <g attr1="val1" attr2="val2">
|
||||
* <g>
|
||||
* text
|
||||
* </g>
|
||||
* <circle attr3="val3"/>
|
||||
* </g>
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
export const name: "moveGroupAttrsToElems";
|
||||
export const description: "moves some group attributes to the content elements";
|
||||
/**
|
||||
* Move group attrs to the content elements.
|
||||
*
|
||||
* @example
|
||||
* <g transform="scale(2)">
|
||||
* <path transform="rotate(45)" d="M0,0 L10,20"/>
|
||||
* <path transform="translate(10, 20)" d="M0,10 L20,30"/>
|
||||
* </g>
|
||||
* ⬇
|
||||
* <g>
|
||||
* <path transform="scale(2) rotate(45)" d="M0,0 L10,20"/>
|
||||
* <path transform="scale(2) translate(10, 20)" d="M0,10 L20,30"/>
|
||||
* </g>
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* @typedef PrefixIdsParams
|
||||
* @property {boolean | string | ((node: import('../lib/types.js').XastElement, info: import('../lib/types.js').PluginInfo) => string)=} prefix
|
||||
* @property {string=} delim
|
||||
* @property {boolean=} prefixIds
|
||||
* @property {boolean=} prefixClassNames
|
||||
*/
|
||||
export const name: "prefixIds";
|
||||
export const description: "prefix IDs";
|
||||
/**
|
||||
* Prefixes identifiers
|
||||
*
|
||||
* @author strarsis <strarsis@gmail.com>
|
||||
* @type {import('../lib/types.js').Plugin<PrefixIdsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<PrefixIdsParams>;
|
||||
export type PrefixIdsParams = {
|
||||
prefix?: (boolean | string | ((node: import("../lib/types.js").XastElement, info: import("../lib/types.js").PluginInfo) => string)) | undefined;
|
||||
delim?: string | undefined;
|
||||
prefixIds?: boolean | undefined;
|
||||
prefixClassNames?: boolean | undefined;
|
||||
};
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
export default presetDefault;
|
||||
declare const presetDefault: import("../lib/types.js").BuiltinPluginOrPreset<"preset-default", any>;
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
export const name: "removeAttributesBySelector";
|
||||
export const description: "removes attributes of elements that match a css selector";
|
||||
/**
|
||||
* Removes attributes of elements that match a css selector.
|
||||
*
|
||||
* @example
|
||||
* <caption>A selector removing a single attribute</caption>
|
||||
* plugins: [
|
||||
* {
|
||||
* name: "removeAttributesBySelector",
|
||||
* params: {
|
||||
* selector: "[fill='#00ff00']"
|
||||
* attributes: "fill"
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
*
|
||||
* <rect x="0" y="0" width="100" height="100" fill="#00ff00" stroke="#00ff00"/>
|
||||
* ↓
|
||||
* <rect x="0" y="0" width="100" height="100" stroke="#00ff00"/>
|
||||
*
|
||||
* <caption>A selector removing multiple attributes</caption>
|
||||
* plugins: [
|
||||
* {
|
||||
* name: "removeAttributesBySelector",
|
||||
* params: {
|
||||
* selector: "[fill='#00ff00']",
|
||||
* attributes: [
|
||||
* "fill",
|
||||
* "stroke"
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
*
|
||||
* <rect x="0" y="0" width="100" height="100" fill="#00ff00" stroke="#00ff00"/>
|
||||
* ↓
|
||||
* <rect x="0" y="0" width="100" height="100"/>
|
||||
*
|
||||
* <caption>Multiple selectors removing attributes</caption>
|
||||
* plugins: [
|
||||
* {
|
||||
* name: "removeAttributesBySelector",
|
||||
* params: {
|
||||
* selectors: [
|
||||
* {
|
||||
* selector: "[fill='#00ff00']",
|
||||
* attributes: "fill"
|
||||
* },
|
||||
* {
|
||||
* selector: "#remove",
|
||||
* attributes: [
|
||||
* "stroke",
|
||||
* "id"
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
*
|
||||
* <rect x="0" y="0" width="100" height="100" fill="#00ff00" stroke="#00ff00"/>
|
||||
* ↓
|
||||
* <rect x="0" y="0" width="100" height="100"/>
|
||||
*
|
||||
* @link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|MDN CSS Selectors
|
||||
*
|
||||
* @author Bradley Mease
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<any>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<any>;
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveAttrsParams
|
||||
* @property {string=} elemSeparator
|
||||
* @property {boolean=} preserveCurrentColor
|
||||
* @property {string | string[]} attrs
|
||||
*/
|
||||
export const name: "removeAttrs";
|
||||
export const description: "removes specified attributes";
|
||||
/**
|
||||
* Remove attributes
|
||||
*
|
||||
* @example elemSeparator
|
||||
* format: string
|
||||
*
|
||||
* @example preserveCurrentColor
|
||||
* format: boolean
|
||||
*
|
||||
* @example attrs:
|
||||
*
|
||||
* format: [ element* : attribute* : value* ]
|
||||
*
|
||||
* element : regexp (wrapped into ^...$), single * or omitted > all elements (must be present when value is used)
|
||||
* attribute : regexp (wrapped into ^...$)
|
||||
* value : regexp (wrapped into ^...$), single * or omitted > all values
|
||||
*
|
||||
* examples:
|
||||
*
|
||||
* > basic: remove fill attribute
|
||||
* ---
|
||||
* removeAttrs:
|
||||
* attrs: 'fill'
|
||||
*
|
||||
* > remove fill attribute on path element
|
||||
* ---
|
||||
* attrs: 'path:fill'
|
||||
*
|
||||
* > remove fill attribute on path element where value is none
|
||||
* ---
|
||||
* attrs: 'path:fill:none'
|
||||
*
|
||||
*
|
||||
* > remove all fill and stroke attribute
|
||||
* ---
|
||||
* attrs:
|
||||
* - 'fill'
|
||||
* - 'stroke'
|
||||
*
|
||||
* [is same as]
|
||||
*
|
||||
* attrs: '(fill|stroke)'
|
||||
*
|
||||
* [is same as]
|
||||
*
|
||||
* attrs: '*:(fill|stroke)'
|
||||
*
|
||||
* [is same as]
|
||||
*
|
||||
* attrs: '.*:(fill|stroke)'
|
||||
*
|
||||
* [is same as]
|
||||
*
|
||||
* attrs: '.*:(fill|stroke):.*'
|
||||
*
|
||||
*
|
||||
* > remove all stroke related attributes
|
||||
* ----
|
||||
* attrs: 'stroke.*'
|
||||
*
|
||||
*
|
||||
* @author Benny Schudel
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveAttrsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveAttrsParams>;
|
||||
export type RemoveAttrsParams = {
|
||||
elemSeparator?: string | undefined;
|
||||
preserveCurrentColor?: boolean | undefined;
|
||||
attrs: string | string[];
|
||||
};
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveCommentsParams
|
||||
* @property {ReadonlyArray<RegExp | string> | false=} preservePatterns
|
||||
*/
|
||||
export const name: "removeComments";
|
||||
export const description: "removes comments";
|
||||
/**
|
||||
* Remove comments.
|
||||
*
|
||||
* @example
|
||||
* <!-- Generator: Adobe Illustrator 15.0.0, SVG Export
|
||||
* Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveCommentsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveCommentsParams>;
|
||||
export type RemoveCommentsParams = {
|
||||
preservePatterns?: (ReadonlyArray<RegExp | string> | false) | undefined;
|
||||
};
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export function fn(root: import("../lib/types.js").XastRoot, params: RemoveDeprecatedAttrsParams, info: import("../lib/types.js").PluginInfo): import("../lib/types.js").Visitor | null | void;
|
||||
/**
|
||||
* @typedef RemoveDeprecatedAttrsParams
|
||||
* @property {boolean=} removeUnsafe
|
||||
*/
|
||||
export const name: "removeDeprecatedAttrs";
|
||||
export const description: "removes deprecated attributes";
|
||||
export type RemoveDeprecatedAttrsParams = {
|
||||
removeUnsafe?: boolean | undefined;
|
||||
};
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveDescParams
|
||||
* @property {boolean=} removeAny
|
||||
*/
|
||||
export const name: "removeDesc";
|
||||
export const description: "removes <desc>";
|
||||
/**
|
||||
* Removes <desc>.
|
||||
* Removes only standard editors content or empty elements because it can be
|
||||
* used for accessibility. Enable parameter 'removeAny' to remove any
|
||||
* description.
|
||||
*
|
||||
* @author Daniel Wabyick
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/desc
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveDescParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveDescParams>;
|
||||
export type RemoveDescParams = {
|
||||
removeAny?: boolean | undefined;
|
||||
};
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
export const name: "removeDimensions";
|
||||
export const description: "removes width and height in presence of viewBox (opposite to removeViewBox)";
|
||||
/**
|
||||
* Remove width/height attributes and add the viewBox attribute if it's missing
|
||||
*
|
||||
* @example
|
||||
* <svg width="100" height="50" />
|
||||
* ↓
|
||||
* <svg viewBox="0 0 100 50" />
|
||||
*
|
||||
* @author Benny Schudel
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
export const name: "removeDoctype";
|
||||
export const description: "removes doctype declaration";
|
||||
/**
|
||||
* Remove DOCTYPE declaration.
|
||||
*
|
||||
* "Unfortunately the SVG DTDs are a source of so many
|
||||
* issues that the SVG WG has decided not to write one
|
||||
* for the upcoming SVG 1.2 standard. In fact SVG WG
|
||||
* members are even telling people not to use a DOCTYPE
|
||||
* declaration in SVG 1.0 and 1.1 documents"
|
||||
* https://jwatt.org/svg/authoring/#doctype-declaration
|
||||
*
|
||||
* @example
|
||||
* <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
* q"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
*
|
||||
* @example
|
||||
* <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
* "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
|
||||
* <!-- an internal subset can be embedded here -->
|
||||
* ]>
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveEditorsNSDataParams
|
||||
* @property {string[]=} additionalNamespaces
|
||||
*/
|
||||
export const name: "removeEditorsNSData";
|
||||
export const description: "removes editors namespaces, elements and attributes";
|
||||
/**
|
||||
* Remove editors namespaces, elements and attributes.
|
||||
*
|
||||
* @example
|
||||
* <svg xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd">
|
||||
* <sodipodi:namedview/>
|
||||
* <path sodipodi:nodetypes="cccc"/>
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveEditorsNSDataParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveEditorsNSDataParams>;
|
||||
export type RemoveEditorsNSDataParams = {
|
||||
additionalNamespaces?: string[] | undefined;
|
||||
};
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveElementsByAttrParams
|
||||
* @property {string | string[]=} id
|
||||
* @property {string | string[]=} class
|
||||
*/
|
||||
export const name: "removeElementsByAttr";
|
||||
export const description: "removes arbitrary elements by ID or className";
|
||||
/**
|
||||
* Remove arbitrary SVG elements by ID or className.
|
||||
*
|
||||
* @example id
|
||||
* > single: remove element with ID of `elementID`
|
||||
* ---
|
||||
* removeElementsByAttr:
|
||||
* id: 'elementID'
|
||||
*
|
||||
* > list: remove multiple elements by ID
|
||||
* ---
|
||||
* removeElementsByAttr:
|
||||
* id:
|
||||
* - 'elementID'
|
||||
* - 'anotherID'
|
||||
*
|
||||
* @example class
|
||||
* > single: remove all elements with class of `elementClass`
|
||||
* ---
|
||||
* removeElementsByAttr:
|
||||
* class: 'elementClass'
|
||||
*
|
||||
* > list: remove all elements with class of `elementClass` or `anotherClass`
|
||||
* ---
|
||||
* removeElementsByAttr:
|
||||
* class:
|
||||
* - 'elementClass'
|
||||
* - 'anotherClass'
|
||||
*
|
||||
* @author Eli Dupuis (@elidupuis)
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveElementsByAttrParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveElementsByAttrParams>;
|
||||
export type RemoveElementsByAttrParams = {
|
||||
id?: (string | string[]) | undefined;
|
||||
class?: (string | string[]) | undefined;
|
||||
};
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export const name: "removeEmptyAttrs";
|
||||
export const description: "removes empty attributes";
|
||||
/**
|
||||
* Remove attributes with empty values.
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
export const name: "removeEmptyContainers";
|
||||
export const description: "removes empty container elements";
|
||||
/**
|
||||
* Remove empty containers.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/intro.html#TermContainerElement
|
||||
*
|
||||
* @example
|
||||
* <defs/>
|
||||
*
|
||||
* @example
|
||||
* <g><marker><a/></marker></g>
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveEmptyTextParams
|
||||
* @property {boolean=} text
|
||||
* @property {boolean=} tspan
|
||||
* @property {boolean=} tref
|
||||
*/
|
||||
export const name: "removeEmptyText";
|
||||
export const description: "removes empty <text> elements";
|
||||
/**
|
||||
* Remove empty Text elements.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/text.html
|
||||
*
|
||||
* @example
|
||||
* Remove empty text element:
|
||||
* <text/>
|
||||
*
|
||||
* Remove empty tspan element:
|
||||
* <tspan/>
|
||||
*
|
||||
* Remove tref with empty xlink:href attribute:
|
||||
* <tref xlink:href=""/>
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveEmptyTextParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveEmptyTextParams>;
|
||||
export type RemoveEmptyTextParams = {
|
||||
text?: boolean | undefined;
|
||||
tspan?: boolean | undefined;
|
||||
tref?: boolean | undefined;
|
||||
};
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
export const name: "removeHiddenElems";
|
||||
export const description: "removes hidden elements (zero sized, with absent attributes)";
|
||||
/**
|
||||
* Remove hidden elements with disabled rendering:
|
||||
* - display="none"
|
||||
* - opacity="0"
|
||||
* - circle with zero radius
|
||||
* - ellipse with zero x-axis or y-axis radius
|
||||
* - rectangle with zero width or height
|
||||
* - pattern with zero width or height
|
||||
* - image with zero width or height
|
||||
* - path with empty data
|
||||
* - polyline with empty points
|
||||
* - polygon with empty points
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveHiddenElemsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveHiddenElemsParams>;
|
||||
export type RemoveHiddenElemsParams = {
|
||||
isHidden?: boolean | undefined;
|
||||
displayNone?: boolean | undefined;
|
||||
opacity0?: boolean | undefined;
|
||||
circleR0?: boolean | undefined;
|
||||
ellipseRX0?: boolean | undefined;
|
||||
ellipseRY0?: boolean | undefined;
|
||||
rectWidth0?: boolean | undefined;
|
||||
rectHeight0?: boolean | undefined;
|
||||
patternWidth0?: boolean | undefined;
|
||||
patternHeight0?: boolean | undefined;
|
||||
imageWidth0?: boolean | undefined;
|
||||
imageHeight0?: boolean | undefined;
|
||||
pathEmptyD?: boolean | undefined;
|
||||
polylineEmptyPoints?: boolean | undefined;
|
||||
polygonEmptyPoints?: boolean | undefined;
|
||||
};
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
export const name: "removeMetadata";
|
||||
export const description: "removes <metadata>";
|
||||
/**
|
||||
* Remove <metadata>.
|
||||
*
|
||||
* https://www.w3.org/TR/SVG11/metadata.html
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
Generated
Vendored
-10
@@ -1,10 +0,0 @@
|
||||
export const name: "removeNonInheritableGroupAttrs";
|
||||
export const description: "removes non-inheritable group's presentational attributes";
|
||||
/**
|
||||
* Remove non-inheritable group's "presentation" attributes.
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export const name: "removeOffCanvasPaths";
|
||||
export const description: "removes elements that are drawn outside of the viewBox";
|
||||
/**
|
||||
* Remove elements that are drawn outside of the viewBox.
|
||||
*
|
||||
* @author JoshyPHP
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
export const name: "removeRasterImages";
|
||||
export const description: "removes raster images";
|
||||
/**
|
||||
* Remove raster images references in <image>.
|
||||
*
|
||||
* @see https://bugs.webkit.org/show_bug.cgi?id=63548
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
export const name: "removeScripts";
|
||||
export const description: "removes scripts";
|
||||
/**
|
||||
* Remove scripts.
|
||||
*
|
||||
* https://www.w3.org/TR/SVG11/script.html
|
||||
*
|
||||
* @author Patrick Klingemann
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
export const name: "removeStyleElement";
|
||||
export const description: "removes <style> element";
|
||||
/**
|
||||
* Remove <style>.
|
||||
*
|
||||
* https://www.w3.org/TR/SVG11/styling.html#StyleElement
|
||||
*
|
||||
* @author Betsy Dupuis
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
export const name: "removeTitle";
|
||||
export const description: "removes <title>";
|
||||
/**
|
||||
* Remove <title>.
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
|
||||
*
|
||||
* @author Igor Kalashnikov
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveUnknownsAndDefaultsParams
|
||||
* @property {boolean=} unknownContent
|
||||
* @property {boolean=} unknownAttrs
|
||||
* @property {boolean=} defaultAttrs
|
||||
* @property {boolean=} defaultMarkupDeclarations
|
||||
* If to remove XML declarations that are assigned their default value. XML
|
||||
* declarations are the properties in the `<?xml … ?>` block at the top of the
|
||||
* document.
|
||||
* @property {boolean=} uselessOverrides
|
||||
* @property {boolean=} keepDataAttrs
|
||||
* @property {boolean=} keepAriaAttrs
|
||||
* @property {boolean=} keepRoleAttr
|
||||
*/
|
||||
export const name: "removeUnknownsAndDefaults";
|
||||
export const description: "removes unknown elements content and attributes, removes attrs with default values";
|
||||
/**
|
||||
* Remove unknown elements content and attributes,
|
||||
* remove attributes with default values.
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveUnknownsAndDefaultsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveUnknownsAndDefaultsParams>;
|
||||
export type RemoveUnknownsAndDefaultsParams = {
|
||||
unknownContent?: boolean | undefined;
|
||||
unknownAttrs?: boolean | undefined;
|
||||
defaultAttrs?: boolean | undefined;
|
||||
/**
|
||||
* If to remove XML declarations that are assigned their default value. XML
|
||||
* declarations are the properties in the `<?xml … ?>` block at the top of the
|
||||
* document.
|
||||
*/
|
||||
defaultMarkupDeclarations?: boolean | undefined;
|
||||
uselessOverrides?: boolean | undefined;
|
||||
keepDataAttrs?: boolean | undefined;
|
||||
keepAriaAttrs?: boolean | undefined;
|
||||
keepRoleAttr?: boolean | undefined;
|
||||
};
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
export const name: "removeUnusedNS";
|
||||
export const description: "removes unused namespaces declaration";
|
||||
/**
|
||||
* Remove unused namespaces declaration from svg element
|
||||
* which are not used in elements or attributes
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export const name: "removeUselessDefs";
|
||||
export const description: "removes elements in <defs> without id";
|
||||
/**
|
||||
* Removes content of defs and properties that aren't rendered directly without ids.
|
||||
*
|
||||
* @author Lev Solntsev
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveUselessStrokeAndFillParams
|
||||
* @property {boolean=} stroke
|
||||
* @property {boolean=} fill
|
||||
* @property {boolean=} removeNone
|
||||
*/
|
||||
export const name: "removeUselessStrokeAndFill";
|
||||
export const description: "removes useless stroke and fill attributes";
|
||||
/**
|
||||
* Remove useless stroke and fill attrs.
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveUselessStrokeAndFillParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveUselessStrokeAndFillParams>;
|
||||
export type RemoveUselessStrokeAndFillParams = {
|
||||
stroke?: boolean | undefined;
|
||||
fill?: boolean | undefined;
|
||||
removeNone?: boolean | undefined;
|
||||
};
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
export const name: "removeViewBox";
|
||||
export const description: "removes viewBox attribute when possible";
|
||||
/**
|
||||
* Remove viewBox attr which coincides with a width/height box.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/coords.html#ViewBoxAttribute
|
||||
*
|
||||
* @example
|
||||
* <svg width="100" height="50" viewBox="0 0 100 50">
|
||||
* ⬇
|
||||
* <svg width="100" height="50">
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
export const name: "removeXMLNS";
|
||||
export const description: "removes xmlns attribute (for inline svg)";
|
||||
/**
|
||||
* Remove the xmlns attribute when present.
|
||||
*
|
||||
* @example
|
||||
* <svg viewBox="0 0 100 50" xmlns="http://www.w3.org/2000/svg">
|
||||
* ↓
|
||||
* <svg viewBox="0 0 100 50">
|
||||
*
|
||||
* @author Ricardo Tomasi
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
export const name: "removeXMLProcInst";
|
||||
export const description: "removes XML processing instructions";
|
||||
/**
|
||||
* Remove XML Processing Instruction.
|
||||
*
|
||||
* @example
|
||||
* <?xml version="1.0" encoding="utf-8"?>
|
||||
*
|
||||
* @author Kir Belevich
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* @typedef RemoveXlinkParams
|
||||
* @property {boolean=} includeLegacy
|
||||
* By default this plugin ignores legacy elements that were deprecated or
|
||||
* removed in SVG 2. Set to true to force performing operations on those too.
|
||||
*/
|
||||
export const name: "removeXlink";
|
||||
export const description: "remove xlink namespace and replaces attributes with the SVG 2 equivalent where applicable";
|
||||
/**
|
||||
* Removes XLink namespace prefixes and converts references to XLink attributes
|
||||
* to the native SVG equivalent.
|
||||
*
|
||||
* XLink namespace is deprecated in SVG 2.
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<RemoveXlinkParams>}
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<RemoveXlinkParams>;
|
||||
export type RemoveXlinkParams = {
|
||||
/**
|
||||
* By default this plugin ignores legacy elements that were deprecated or
|
||||
* removed in SVG 2. Set to true to force performing operations on those too.
|
||||
*/
|
||||
includeLegacy?: boolean | undefined;
|
||||
};
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
export const name: "reusePaths";
|
||||
export const description: string;
|
||||
/**
|
||||
* Finds <path> elements with the same d, fill, and stroke, and converts them to
|
||||
* <use> elements referencing a single <path> def.
|
||||
*
|
||||
* @author Jacob Howcroft
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* @typedef SortAttrsParams
|
||||
* @property {ReadonlyArray<string>=} order
|
||||
* @property {'front' | 'alphabetical'=} xmlnsOrder
|
||||
*/
|
||||
export const name: "sortAttrs";
|
||||
export const description: "Sort element attributes for better compression";
|
||||
/**
|
||||
* Sort element attributes for better compression
|
||||
*
|
||||
* @author Nikolay Frantsev
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin<SortAttrsParams>}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin<SortAttrsParams>;
|
||||
export type SortAttrsParams = {
|
||||
order?: ReadonlyArray<string> | undefined;
|
||||
xmlnsOrder?: ("front" | "alphabetical") | undefined;
|
||||
};
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
export const name: "sortDefsChildren";
|
||||
export const description: "Sorts children of <defs> to improve compression";
|
||||
/**
|
||||
* Sorts children of defs in order to improve compression. Sorted first by
|
||||
* frequency then by element name length then by element name (to ensure
|
||||
* grouping).
|
||||
*
|
||||
* @author David Leston
|
||||
*
|
||||
* @type {import('../lib/types.js').Plugin}
|
||||
*/
|
||||
export const fn: import("../lib/types.js").Plugin;
|
||||
Reference in New Issue
Block a user