Skip to content

Split SVGDocument into separate svg package#15

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/split-svgdocument-package
Draft

Split SVGDocument into separate svg package#15
Copilot wants to merge 3 commits into
mainfrom
copilot/split-svgdocument-package

Conversation

Copilot AI commented Nov 22, 2025

Copy link
Copy Markdown
Contributor

Extracts SvgDocument and all SVG rendering methods into a dedicated svg package following the established pattern used for geometry and color packages. Image::render_image_to_svg remains in the main vg package.

Changes

  • New svg package: Created svg/types.mbt (SvgDocument struct), svg/svg.mbt (all rendering methods and helpers), and svg/moon.pkg.json (imports geometry and color)
  • vg package updates: Added SvgDocument type re-export to types.mbt, reduced svg.mbt to only Image::render_image_to_svg, added svg package import
  • Namespace migration: All SVG document creation and rendering now uses @svg namespace instead of @vg
  • Documentation: Added REFACTORING_SVG_PACKAGE.md following existing refactoring docs pattern

Migration

// Before
let doc = @vg.new_svg(200.0, 200.0)
  .render_circle(Point::new(50.0, 50.0), 25.0, @color.red())

// After
let doc = @svg.new_svg(200.0, 200.0)
  .render_circle(Point::new(50.0, 50.0), 25.0, @color.red())

// Image method unchanged in vg package
let svg_string = img.render_image_to_svg(100.0, 100.0, 20)

Type references continue to work via re-export: SvgDocument or @vg.SvgDocument.

Original prompt

split SVGDocument into a separate package, note Image::render_to_svg should be kept in vg package


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 22, 2025 12:45
Co-authored-by: bobzhang <747051+bobzhang@users.noreply.github.com>
Co-authored-by: bobzhang <747051+bobzhang@users.noreply.github.com>
Copilot AI changed the title [WIP] Split SVGDocument into a separate package Split SVGDocument into separate svg package Nov 22, 2025
Copilot AI requested a review from bobzhang November 22, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants