SVG API reference
Version 1.0.0 · Package API 1 · SVG usage guide
Plugins
svg.python(python): SVG documents and inspection CLI.
Import these symbols from manifest.svg.
normalize_svg_styles(source, destination)
Write a new SVG with simple .class rules inlined, preserving the original.
Supports class selectors and comma-separated class selectors with supported SVG paint properties. Stylesheet order and inline precedence are retained. Complex selectors, !important, external stylesheets and unsupported declarations fail without writing a file. Existing destinations are never overwritten.
SvgElement(document: SvgDocument, key: str)
A document selection that preserves its ancestor styles and transforms.
inspect(*, offset=0, limit=50)
Return a paginated summary for this source element.
instantiate(parent: Entity, position: Vector2, *, origin: Literal['canvas', 'bounds']='canvas', unsupported: Literal['error', 'skip']='error') -> SvgInstance
Instantiate this element as an ordinary Video2D group.
SvgInstance(parent: Entity, position: Vector2, *, document: SvgDocument)
An ordinary animatable Group containing fresh imported entities.
Use by_id, by_key, or by_label to obtain entities and animate their props using normal animation classes. diagnostics lists any explicitly skipped content.
by_key(key)
Select an expanded element by its instance key.
by_id(identifier)
Select a unique source ID within this instance.
by_label(label)
Return all instance elements matching an editor label.
SvgDocument(path: str | PathLike[str])
Parse a UTF-8 SVG asset once for inspection and repeated instantiation.
No external resources are fetched. Unsupported content remains inspectable; conversion is strict unless unsupported="skip" is explicitly requested.
by_key(key)
Select a source or expanded element by stable document key.
by_id(identifier)
Select a unique source element ID.
by_label(label)
Return all source elements matching an editor label.
inspect(*, key=None, view='elements', offset=0, limit=50)
Return paginated element, layer, or compatibility summaries.
layers(*, offset=0, limit=50)
Return top-level layer summaries.
compatibility(*, offset=0, limit=50)
Return diagnostics describing supported and unsupported SVG content.
instantiate(parent: Entity, position: Vector2, *, key: str | None=None, origin: Literal['canvas', 'bounds']='canvas', unsupported: Literal['error', 'skip']='error') -> SvgInstance
Create an independent entity tree from the document or selected subtree.