1/*2Package svg is a minimalist and extensible SVG generation library for Gno.34It is the B+ tree successor to [gno.land/p/moul/svg/v0] (whose canvas styles are5backed by an AVL tree): a bump to v2 because the backing data structure used for6the canvas style map — and thus the on-chain storage layout — changed from7[gno.land/p/nt/avl/v0] to [gno.land/p/nt/bptree/v0]. The exported API is8otherwise identical to v1.910A B+ tree packs many entries per persisted node, so a stored style entry costs11less storage than the AVL backing (and inserts spend materially less gas).12Prefer v2 when the canvas is part of persisted realm state.1314Two behavioral caveats inherited from the in-place-mutating B+ tree backing:1516 - do NOT call AddStyle from inside a Canvas.String/Render iteration — the AVL17 backing tolerated mutation during iteration, the B+ tree one does not;18 - do NOT copy a non-zero Canvas by value once styles have been added — the19 copies would share live B+ tree nodes (v1's AVL copies were independent).2021It provides a structured way to create and compose SVG elements such as rectangles, circles, text, paths, and more. The package is designed to be modular and developer-friendly, enabling optional attributes and method chaining for ease of use.2223Each SVG element embeds a BaseAttrs struct, which supports common SVG attributes like `id`, `class`, `style`, `fill`, `stroke`, and `transform`.2425Canvas objects represent the root SVG container and support global dimensions, viewBox configuration, embedded styles, and element composition.2627Example:2829 import "gno.land/p/moul/svg/v0"3031 func Foo() string {32 canvas := svg.NewCanvas(200, 200).WithViewBox(0, 0, 200, 200)33 canvas.AddStyle(".my-rect", "stroke:black;stroke-width:2")34 canvas.Append(35 svg.NewRectangle(60, 40, 100, 50, "red").WithClass("my-rect"),36 svg.NewCircle(50, 80, 40, "blue"),37 &svg.Path{D: `M 10,3038 A 20,20 0,0,1 50,3039 A 20,20 0,0,1 90,3040 Q 90,60 50,9041 Q 10,60 10,30 z`, Fill: "magenta"},42 svg.NewText(20, 50, "Hello SVG", "black"),43 )44 mysvg := canvas.Base64()45 }46*/47package svg // import "gno.land/p/moul/svg/v0"48Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.