Repository navigation
M4: SVG symbols as <symbol>/<use>, hidden layers, metadata; Preserve Editing round trip (M4.39, M4.40) - #72
Merged
Merged
Conversation
…ore metadata Symbol instances export as one <symbol> def per symbol and a <use> per instance. An instance the def can't stand for exactly (stained by its fill, or a transform under which the canvas paints differently: scaling with strokes, effects or live objects, turning with effects or brushes, any move with pattern paints or unlinked masks) is written as its own art, now stained like the canvas and with its patterns and unlinked masks left on the page. Symbols nested in themselves stop at a fixed depth. New SVG option hiddenLayers keeps hidden layers as display:none groups; document.save (and Save As / Save a Copy) turns it on unless told otherwise, exports leave hidden layers out. Import shows display:none layer groups to usvg and marks them hidden, so they reopen hidden (groups a <use> refers to stay templates). File Info metadata goes through one Dublin Core list. The symbol stain helper moves to vectorcraft-brush so the renderer and the SVG writer share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ted elsewhere The editing data now sits in CDATA inside <metadata> with a hash of the markup around that element (whitespace between tags and line endings don't count). document.open restores the native document when the hash matches (data written without a hash is trusted as before); when another app changed the SVG, or the data can't be read, it imports the SVG and says why in its warnings. vectorcraft_svg::editing reports the data and whether it is intact; editing_data stays. Live effects, symbols and patterns come back exactly; the import fuzz test now mutates saved SVGs with editing data and hidden layers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of M4 (Files). SVG export writes symbols as
<symbol>/<use>, keeps hidden layers on Save and carries Dublin Core metadata. SVGs saved with Preserve Editing reopen exactly, or as plain SVG once another app has edited them.<symbol overflow="visible">, and each instance as a<use>.vectorcraft_brush::{stain, instance_art}, shared with the renderer.hiddenLayers(listed indocument.formats). Save, Save As and Save a Copy turn it on; exports leave hidden layers out. On import, adisplay:nonegroup with an id comes back as a hidden layer or group.dublin_core()), currently the format and title. File Info will fill in the other fields.<metadata>as CDATA, with a hash of the SVG markup around it. Re-indenting and line-ending changes don't change the hash.document.openrestores the document exactly when the hash matches. Older SVGs without a hash are trusted, as before.warnings(EDITING_STALE,EDITING_DAMAGED).vectorcraft_svg::editing().docs/mcp.mdcovers the option and the round trip.Known limits (these problems predate this PR):
Checks
Rebased onto
4cccbc2(#71).cargo xtask cipasses all 7 steps (fmt, clippy, test, assets, brands, layers, wasm): 2,091 tests, 0 failed.mainstill exists (2,074 → 2,088), and no existing test changed;UI_COMMANDS, menu entries and MCP tools are unchanged.<symbol>/<use>output and the cases written as art;data:URLs;🤖 Generated with Claude Code