Retentive SVG basic-shape profile zero
Status: executable integrated profile (nuif-svg-0). The library, public CLI,
blocking xtask gate and CI artifact path exercise the same profile boundary.
Model projection
- one positive, fixed-size surface maps to the root SVG element and its
viewBox; - freeform containers map to
gelements; - fixed-size, positioned rectangles map to
rectgeometry; - fixed-size, positioned ellipses retain NUIF bounding-box attributes and map
derived centre/radius geometry to
ellipseattributes; - fixed-size, positioned text maps to one literal SVG text node with the pinned font name, content hash, font size and line height;
- absent fill maps to
none; present fill is opaque sRGB with 8-bit-exact channels and maps to lowercase six-digit hexadecimal notation; - entity name, role and accessible name map to
data-nuif-name,roleandaria-label; data-nuif-document,data-nuif-id,data-nuif-kindanddata-nuif-profileretain canonical identities and the profile marker.
The profile excludes tokens, relations, extensions, responsive rules, layout families other than default freeform, property values, semantic states, paths, images, components, instances and unknown kinds. Paths, transforms, CSS, strokes, gradients, patterns, clipping, masks, filters, animation, scripts, external resources, text spans and per-character positioning require separate profiles.
Retentive laws
For a document inside the profile:
import_source(export_document(document).source).document == document.- Each mapped scalar has a UTF-8 byte span. Derived ellipse geometry uses multiple ordered correspondence records against the authored geometry.
- Synchronization compares every retained scalar with a canonical export of the imported document before applying any edit.
- Changed spans are replaced from the highest byte offset to the lowest.
- The synchronized source is re-imported and must equal the requested edited document exactly.
- Repeated synchronization from the same retained source and edited document produces identical source, edit records and reports.
- Containment, order, kind, optional mapped-property inventory and unsupported semantic changes return typed errors without partial output.
Unmarked elements, attributes, comments and processing instructions are outside the semantic projection and remain byte-identical during synchronization. They can affect SVG rendering. Exact NUIF round trips therefore do not imply visual equivalence after arbitrary unmarked SVG is inserted.
Resource and parser contract
Input is UTF-8 and limited to 1 MiB. roxmltree 0.21.1 parses at most 16,384
nodes with DTD parsing disabled and no external entity resolver. Mapped elements
must use the SVG namespace and be direct children of mapped surface/container
elements. Duplicate identities, inconsistent kind/tag pairs, non-canonical
numbers, non-canonical colors and inconsistent derived ellipse geometry fail
import.
The crate tests and cargo xtask gate-svg cover exact export/import,
deterministic seven-span synchronization, escaped text, unmarked-source
locality, stale spans, structural rejection, property-attributed unsupported
paint, inconsistent derived geometry, DTD rejection, the XML-node limit and
the source byte limit. The gate also performs export, edited synchronization
and exact canonical re-import through the public CLI.
The command surface is:
nuif export <input.nuif> svg-0 <output.svg> [report.json];nuif import svg-0 <input.svg> <output.nuif> [report.json];nuif sync svg-0 <retained.svg> <edited.nuif> <output.svg> [report.json].
nuif-svg-0 is accepted as an explicit alias. The gate writes
target/svg-sync-report.json, target/svg-sync-output.svg,
target/svg-sync-edited.nuif, target/svg-sync-cli-report.json and
target/svg-sync-cli-output.svg.