how it works
The rendered receipt is serialised into an SVG <foreignObject> and painted onto a canvas. That is the whole mechanism, and it is why there is no dependency: no html2canvas, no headless browser, no screenshot endpoint. The shadow DOM is flattened, the slotted light DOM is inlined, and the component's own stylesheet is rewritten against the classes that survive the flattening.
the one caveat, stated plainly
A foreignObject is sandboxed: it cannot fetch anything over the network. Text and styles are inlined for you automatically, but an <img> inside the receipt must be a data: URI or it will not survive. When that happens the export rejects with an explicit error naming the cause, rather than quietly handing you a receipt with a hole in it. Fonts are subject to the same rule — a webfont that has not loaded falls back inside the export.
None of that is specific to Tearline — it falls out of how browser-side rasterisation works at all. Export a DOM element as a PNG walks through the technique on its own, including the tainted-canvas rule that throws instead of returning a blank image, and how the zero-dependency packages on npm compare.
making the image match the screen
Set a seed. The tear and the bars come out of it, so the exported PNG is the same paper the visitor was looking at when they pressed the button. Without one, the export re-renders a different tear and the share image quietly stops being a picture of what happened.