feat(canvas): import DWG/DXF CAD drawings as canvas assets

Accept DWG and DXF files (up to 24 MB) through the canvas asset picker and
drag-and-drop. Conversion runs locally in a browser worker via acad-ts,
uploads a sanitized derived SVG, and leaves the source file untouched. DXF
covers ASCII and binary drawings; DWG covers AutoCAD R14 through 2018.

Rename the image-only upload input/handler to a generic canvas asset flow,
add vector-image node detection, tag imported SVGs as vector-image nodes,
localize CAD import status/error messages, and switch the Next build to the
webpack compiler so the worker bundles correctly. Add a node --test suite
covering CAD conversion and vector image helpers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-15 12:09:05 +08:00
parent 09b961fcc4
commit 078b0bee32
16 changed files with 1020 additions and 27 deletions
+4 -2
View File
@@ -4,13 +4,15 @@
"private": true,
"type": "module",
"scripts": {
"dev": "next dev -H 0.0.0.0 -p 5173",
"dev": "next dev --webpack -H 0.0.0.0 -p 5173",
"dev:vite": "vite --host 0.0.0.0",
"build": "tsc -b && next build && vite build",
"build": "tsc -b && next build --webpack && vite build",
"test": "node --experimental-strip-types --test tests/*.test.mjs",
"start": "next start -H 0.0.0.0 -p 3000",
"preview": "vite preview --host 0.0.0.0"
},
"dependencies": {
"@node-projects/acad-ts": "2.3.0",
"@radix-ui/react-context-menu": "^2.3.2",
"@radix-ui/react-dropdown-menu": "^2.1.19",
"@radix-ui/react-popover": "^1.1.18",