Skip to content

Split CanvasDocument into separate package#16

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/split-canvas-document-package
Draft

Split CanvasDocument into separate package#16
Copilot wants to merge 4 commits into
mainfrom
copilot/split-canvas-document-package

Conversation

Copilot AI commented Nov 22, 2025

Copy link
Copy Markdown
Contributor

Extracts Canvas rendering backend into dedicated canvas/ package, following established modularization pattern from geometry and color packages.

Changes

  • New canvas/ package: CanvasDocument type, rendering methods, and 11 tests
  • Type re-export: pub type CanvasDocument = @canvas.CanvasDocument in main package for backward compatibility
  • Simplified wrapper: Main canvas.mbt reduced to new_canvas function forwarding to @canvas.new_canvas
  • Package dependencies: Canvas package imports geometry and color packages
  • Documentation: Added REFACTORING_CANVAS_PACKAGE.md

API Compatibility

Fully backward compatible. Existing code requires no changes:

// Works identically before and after refactoring
let doc = @vg.new_canvas(300.0, 200.0)
  .render_circle(@vg.Point::new(100.0, 100.0), 50.0, @color.red())
  .to_html("Demo")

Canvas package can also be imported directly if needed:

// Optional: direct import
let doc = @canvas.new_canvas(300.0, 200.0)

Testing

186 tests pass (175 existing + 11 new canvas package tests).

Original prompt

split CanvasDocument into a separate package


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits November 22, 2025 12:49
Co-authored-by: bobzhang <747051+bobzhang@users.noreply.github.com>
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 CanvasDocument into a separate package Split CanvasDocument into separate package Nov 22, 2025
Copilot AI requested a review from bobzhang November 22, 2025 12:58
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