feat(proxy): add offset param to inset or outset traced shapes

Trace results can now be inset (negative) or outset (positive) by a
pixel amount. Offset the outline and holes in opposite directions with
clipper-lib's miter joins, then recombine with a boolean difference so
holes grow on inset and shrink on outset. Collapsed shapes return an
empty outline; a split outline keeps the largest ring. Document the
parameter and the new dependency.
This commit is contained in:
2026-08-08 15:37:27 +08:00
parent c7f4bd03fd
commit 9094ad58e0
12 changed files with 284 additions and 17 deletions
+4 -3
View File
@@ -86,6 +86,7 @@ apps/web ──► apps/proxy ──► packages/tts ──► packages/shared
| `@hono/cors` | CORS middleware | `apps/proxy` |
| `bson` | BSON deserialization of TTS save files | `packages/tts` |
| `@visioncortex/vtracer` | Raster-to-SVG vectorization (wasm) | `apps/proxy` |
| `clipper-lib` | Polygon offsetting (inset/outset) for traced shapes | `apps/proxy` |
| `sharp` | Image decoding to RGBA | `apps/proxy` |
| `svgpath` | SVG path parsing for traced shapes | `apps/proxy` |
| `cheerio` | Workshop browse page scraping | `apps/proxy` |
@@ -101,9 +102,9 @@ apps/web ──► apps/proxy ──► packages/tts ──► packages/shared
must stay isomorphic.
- **`bson` is Node-only** — used by the fetcher and the trace route, not the
analysis layer.
- **`@visioncortex/vtracer`, `sharp`, `svgpath` are backend-only** — the trace
route lives in `apps/proxy`; they never appear in `packages/extract`, which
must stay isomorphic.
- **`@visioncortex/vtracer`, `sharp`, `svgpath`, `clipper-lib` are
backend-only** — the trace route lives in `apps/proxy`; they never appear in
`packages/extract`, which must stay isomorphic.
- **`packages/extract` has zero external runtime deps** — it relies only on
platform `fetch` / `Blob`, keeping it portable to a future frontend.