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
+8
View File
@@ -432,7 +432,15 @@
"canvasCursor": "Canvas status",
"imageNode": "Image node",
"uploadImageNode": "Upload image node",
"uploadCanvasAsset": "Upload image or CAD file",
"imageUploadSuccess": "Image uploaded",
"cadImportConverting": "Converting CAD drawing",
"cadImportSuccess": "Imported {count} CAD drawing(s)",
"cadImportTooLarge": "CAD files must be 24 MB or smaller.",
"cadImportTimeout": "CAD conversion timed out. Simplify the drawing and try again.",
"cadImportEmpty": "The CAD drawing has no visible model-space content.",
"cadImportUnsupported": "This browser cannot convert the selected CAD file.",
"cadImportFailed": "CAD conversion failed. Check that the file is complete and uses a supported version.",
"uploadingImage": "Uploading",
"extractingText": "Extract text",
"textNode": "Text node",