SVG Sketch Source A new SVG editor, built on bidirectional lens theory from Foster et al. 2007 and Hofmann et al. 2012, synchronizes code and graphical UI in real time, preserving unknown semantics like SVG animations without parsing. Developed by Tom Larkworthy, the tool uses a novel prompting strategy that requests an LLM to apply property checking against mathematical laws, achieving strong implementation consistency across an expansive domain. The drawing syncs to the code and vice versa. Switch between using code and UI. Built on composable lens Foster et al. 2007 and edit-lens Hofmann et al. 2012 theory, but applied in the string domain so unknown semantics like SVG animations are preserved without parsing. Follows the path of Sketch-n-Sketch Chugh et al. 2016 Hempel et al. 2019 but applied to an existing image format: SVG. Generated with a novel prompting strategy of requesting an LLM to use property checking against mathematical laws as a architecture, leading to strong implementation consistency over an expansive domain. | gesture | what it does | lens | |---|---|---| | drag a shape | moves it | transform | | tap a polygon or path, drag a handle | moves one vertex or anchor | points , path d | | tap anything else, drag a corner or the rotate handle | scale or rotate from the box | transform | | drag the pivot dot | moves the point the box scales and rotates around | transform | | double-click an edge / a vertex / empty canvas | add a vertex / remove one / drop in a shape | children | | tap again in the same place | steps down through stacked shapes | — | | shift-tap, or rubber-band | adds to the selection | — | A selection also carries chips : the same commands, one tap away, drawn only when they apply: | chip | chip | || |---|---|---|---| ⧉ | duplicate | ∿ | smooth ↔ corner the anchor | ⇄ | swap fill and stroke | ◑ | give it a gradient minted into defs | ≡ drag | stroke width | ➤ | put an arrowhead on it | ⊚ / ◠ | close / open the path | The panel under the drawing edits fill , stroke , width, opacity and the dash as typed inputs; each change commits through the same write path, so the source keeps the notation you wrote. | key | | |---|---| R E L | drag out a rect, an ellipse, a line | P | place path anchors; click the first again to close, double-click to finish open | S | scribble a freehand path; it is fitted to Béziers on release | V / Esc | back to selecting a finished tool returns by itself | ⌘G / ⇧⌘G | group / ungroup the selection | ⌘D | duplicate | ⌘C ⌘X ⌘V / ⇧⌘V | copy, cut, paste / paste in place | ⌘A | select all | 1 / 2 | reset the view / fit it to the selection | / { } | lower, raise / send to back, front | Delete | removes the selection | ⌘Z / ⇧⌘Z | undo, redo byte for byte , and declines if something else wrote to the cell first | arrows, shift+arrows | nudge by one unit, by ten | alt while dragging | ignore snapping | import {svgLens} from "@tomlarkworthy/svg-lens" viewof picture = svgLens svg