It works by walking the DOM, reading computed styles for each node, and assembling the clipboard payload that Figma expects. The last step was the hardest part since Figma’s clipboard structure has almost no public documentation and it’s more like an internal thing. I went through a lot of trial and error but finally got something that works decently, although there are still some issues.
Right now it covers editable text, images, SVG paths and shapes, linear gradients, shadows, borders, form placeholders, multi-frame canvases. Auto-layout is next on the list. Would love to see bug reports and contributions.