@flyfish-dev/cad-viewer 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +215 -641
- package/NOTICE +3 -5
- package/README.md +33 -20
- package/README.zh-CN.md +28 -19
- package/dist/cad-viewer.es.js +909 -875
- package/dist/cad-viewer.es.js.map +1 -1
- package/dist/cad-viewer.umd.cjs +4 -4
- package/dist/cad-viewer.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/core/types.d.ts +28 -1
- package/dist/types/core/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/loaders/dwf/DwfLoader.d.ts +16 -7
- package/dist/types/loaders/dwf/DwfLoader.d.ts.map +1 -1
- package/dist/types/loaders/index.d.ts +1 -1
- package/dist/types/loaders/index.d.ts.map +1 -1
- package/dist/types/viewer/CadViewer.d.ts +11 -2
- package/dist/types/viewer/CadViewer.d.ts.map +1 -1
- package/dist/wasm/dwfv-render.wasm +0 -0
- package/package.json +10 -6
package/NOTICE
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
@flyfish-dev/cad-viewer
|
|
2
2
|
|
|
3
|
-
This project
|
|
4
|
-
|
|
5
|
-
This project includes optional/default integrations with third-party open-source projects:
|
|
3
|
+
This project integrates third-party open-source projects for CAD parsing and rendering:
|
|
6
4
|
|
|
7
5
|
- @mlightcad/libredwg-web: DWG parsing in the browser through LibreDWG WebAssembly. License: GPL-3.0-only.
|
|
8
6
|
- dxf-parser: DXF parser for JavaScript. License: MIT.
|
|
9
|
-
-
|
|
7
|
+
- dwf-viewer: native frontend DWF/DWFx renderer for DWF 6+ ZIP containers, DWFx/OPC/XPS, WHIP/W2D 2D sheets and W3D/HSF eModel content. License: AGPL-3.0-only.
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
The combined package is distributed under AGPL-3.0-only. Keep attribution and license notices when redistributing, modifying, embedding, or using this package as part of another application.
|
package/README.md
CHANGED
|
@@ -8,11 +8,22 @@ A professional, lightweight, extensible **frontend CAD viewer** for modern brows
|
|
|
8
8
|
**Live demo:** [cad-viewer-iys.pages.dev](https://cad-viewer-iys.pages.dev)
|
|
9
9
|
**Source:** [github.com/flyfish-dev/cad-viewer](https://github.com/flyfish-dev/cad-viewer)
|
|
10
10
|
|
|
11
|
-
The project provides a clean loader architecture for **DWG**, **DXF** and **
|
|
11
|
+
The project provides a clean loader architecture for **DWG**, **DXF**, **DWF**, **DWFx** and **XPS**. DWG/DXF are normalized into a common `CadDocument` and rendered through retained WebGL with a lightweight Canvas overlay; DWF/DWFx/XPS are delegated to the native `dwf-viewer` renderer for W2D, W3D/HSF eModel and XPS page content. Files are read locally in the browser; the viewer does not upload drawings to a backend.
|
|
12
12
|
|
|
13
|
-
> DWG support uses `@mlightcad/libredwg-web` / LibreDWG WebAssembly. DXF support uses JavaScript parsing plus a built-in fallback parser. DWFx
|
|
13
|
+
> DWG support uses `@mlightcad/libredwg-web` / LibreDWG WebAssembly in a worker. DXF support uses JavaScript parsing plus a built-in fallback parser. DWF, DWFx and XPS support is powered by `dwf-viewer`, including DWF 6+ ZIP containers, WHIP/W2D 2D sheets, W3D/HSF 3D eModel geometry, DWFx/OPC/XPS pages and an optional raster WASM fallback.
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
## What changed in 0.6.0
|
|
17
|
+
|
|
18
|
+
- Replaced the previous DWFx/XPS subset parser with the published `dwf-viewer` native renderer.
|
|
19
|
+
- DWF/DWFx/XPS files now mount a dedicated native viewer path instead of being forced into the DWG/DXF `CadDocument` renderer.
|
|
20
|
+
- Added support for DWF 6+ ZIP packages, WHIP/W2D 2D sheets, W3D/HSF 3D eModel pages, DWFx/OPC/XPS pages and dwf-viewer's WebGL/WASM render backends.
|
|
21
|
+
- Added `CadNativeRenderableLoader`, allowing loaders to mount an optimized DOM/WebGL viewer when a format needs more than the normalized 2D scene model.
|
|
22
|
+
- Added `dwfWasmUrl`, `dwfPreferWebgl`, `dwfPreferWasm`, `dwfMaxCanvasPixels`, `dwfMaxGpuCacheBytes` and related production options.
|
|
23
|
+
- Runtime asset scripts now copy and validate both `libredwg-web.wasm` and `dwfv-render.wasm`.
|
|
24
|
+
- Removed the old classic-DWF warning path and the `fflate` dependency from this package.
|
|
25
|
+
- Updated package licensing to AGPL-3.0-only to match the integrated DWF renderer.
|
|
26
|
+
|
|
16
27
|
## What changed in 0.5.3
|
|
17
28
|
|
|
18
29
|
- Fixed DWG color fidelity for layer-indexed drawings. Indexed LibreDWG layers now resolve from ACI instead of the converter placeholder `0xffffff`, preventing monochrome-white output.
|
|
@@ -49,10 +60,10 @@ The project provides a clean loader architecture for **DWG**, **DXF** and **DWFx
|
|
|
49
60
|
## Features
|
|
50
61
|
|
|
51
62
|
- **Pure frontend viewer component**: `new CadViewer({ container })` or `new CadViewer({ canvas })`.
|
|
52
|
-
- **Loader registry**: DWG, DXF and DWF loaders are independent and replaceable.
|
|
63
|
+
- **Loader registry**: DWG, DXF and DWF loaders are independent and replaceable; native-renderable loaders can mount their own optimized viewer.
|
|
53
64
|
- **DWG preview**: browser-local parsing through LibreDWG WebAssembly, executed in a Web Worker by default.
|
|
54
65
|
- **DXF preview**: JavaScript parser path with fallback support for common ASCII DXF `ENTITIES`.
|
|
55
|
-
- **DWF/DWFx preview**:
|
|
66
|
+
- **DWF/DWFx/XPS preview**: powered by `dwf-viewer` for DWF ZIP packages, W2D 2D sheets, W3D/HSF eModel geometry, DWFx/OPC/XPS pages and raster fallback.
|
|
56
67
|
- **CAD color handling**: ACI, BYLAYER, BYBLOCK inheritance, DWG layer colors, true color, fill color, opacity and adaptive contrast.
|
|
57
68
|
- **High-performance WebGL viewport controls**: retained GPU buffers, spatial culling, zoom, pan, fit-to-view, cursor world coordinates and zoom percentage.
|
|
58
69
|
- **Professional demo UI**: drag-and-drop, compact toolbar, status strip, parse/render timing, entity summary and warnings.
|
|
@@ -71,16 +82,16 @@ npm install
|
|
|
71
82
|
npm run dev
|
|
72
83
|
```
|
|
73
84
|
|
|
74
|
-
The DWG
|
|
85
|
+
The DWG and DWF render paths need runtime WASM assets in a public directory. This repository copies and validates them for the demo:
|
|
75
86
|
|
|
76
87
|
```bash
|
|
77
88
|
npm run copy:wasm
|
|
78
89
|
npm run check:wasm
|
|
79
90
|
```
|
|
80
91
|
|
|
81
|
-
The demo resolves `wasmPath` to an absolute URL before sending it to the worker. In your own app, prefer an absolute path or URL, for example `/wasm` or `new URL('wasm/', document.baseURI).href`. Avoid passing a worker-relative path such as `./wasm` unless it is resolved on the UI thread first.
|
|
92
|
+
The demo resolves `wasmPath` to an absolute URL before sending it to the DWG worker and uses the same directory for `dwfv-render.wasm`. In your own app, prefer an absolute path or URL, for example `/wasm` or `new URL('wasm/', document.baseURI).href`. Avoid passing a worker-relative path such as `./wasm` unless it is resolved on the UI thread first.
|
|
82
93
|
|
|
83
|
-
When publishing the npm package, `build:lib`
|
|
94
|
+
When publishing the npm package, `build:lib` copies these files into `dist/wasm` and exposes them as package subpaths. Applications still need to serve the `.wasm` files from a public URL and pass that directory as `wasmPath`, or pass `dwfWasmUrl` explicitly.
|
|
84
95
|
|
|
85
96
|
|
|
86
97
|
## Demo startup notes
|
|
@@ -110,6 +121,7 @@ const viewer = new CadViewer({
|
|
|
110
121
|
container: document.querySelector('#viewer')!,
|
|
111
122
|
renderer: 'auto', // WebGL first, Canvas2D fallback
|
|
112
123
|
wasmPath: new URL('wasm/', document.baseURI).href,
|
|
124
|
+
dwfWasmUrl: new URL('wasm/dwfv-render.wasm', document.baseURI).href,
|
|
113
125
|
canvasOptions: {
|
|
114
126
|
background: '#05070d',
|
|
115
127
|
foreground: '#f8fafc',
|
|
@@ -177,6 +189,7 @@ const controller = new AbortController();
|
|
|
177
189
|
const viewer = new CadViewer({
|
|
178
190
|
container,
|
|
179
191
|
wasmPath: new URL('wasm/', document.baseURI).href,
|
|
192
|
+
dwfWasmUrl: new URL('wasm/dwfv-render.wasm', document.baseURI).href,
|
|
180
193
|
useWorker: true,
|
|
181
194
|
workerTimeoutMs: 120_000,
|
|
182
195
|
onLoadProgress(progress) {
|
|
@@ -197,6 +210,7 @@ Advanced deployments can override the worker constructor when the bundler or CDN
|
|
|
197
210
|
new CadViewer({
|
|
198
211
|
container,
|
|
199
212
|
wasmPath: new URL('wasm/', document.baseURI).href,
|
|
213
|
+
dwfWasmUrl: new URL('wasm/dwfv-render.wasm', document.baseURI).href,
|
|
200
214
|
workerUrl: new URL('/assets/dwg-worker.js', window.location.origin)
|
|
201
215
|
});
|
|
202
216
|
```
|
|
@@ -210,7 +224,8 @@ const viewer = new CadViewer({
|
|
|
210
224
|
container, // HTMLElement; creates a canvas inside
|
|
211
225
|
canvas, // optional existing HTMLCanvasElement
|
|
212
226
|
renderer: 'auto', // 'auto' | 'webgl' | 'canvas2d'
|
|
213
|
-
wasmPath: '/wasm', //
|
|
227
|
+
wasmPath: '/wasm', // directory containing libredwg-web.wasm and dwfv-render.wasm
|
|
228
|
+
dwfWasmUrl: '/wasm/dwfv-render.wasm',
|
|
214
229
|
autoFit: true,
|
|
215
230
|
canvasOptions: {
|
|
216
231
|
background: '#05070d',
|
|
@@ -229,6 +244,9 @@ const viewer = new CadViewer({
|
|
|
229
244
|
},
|
|
230
245
|
useWorker: true, // default for DWG
|
|
231
246
|
workerTimeoutMs: 0, // 0 = disabled
|
|
247
|
+
dwfPreferWebgl: true,
|
|
248
|
+
dwfPreferWasm: true,
|
|
249
|
+
dwfMaxCanvasPixels: 16_777_216,
|
|
232
250
|
onLoadProgress(progress) {},
|
|
233
251
|
onLoad(result) {},
|
|
234
252
|
onError(error) {},
|
|
@@ -256,11 +274,8 @@ CadLoaderRegistry
|
|
|
256
274
|
↓
|
|
257
275
|
DwgLoader | DxfLoader | DwfLoader | custom loader
|
|
258
276
|
↓
|
|
259
|
-
CadDocument
|
|
260
|
-
|
|
261
|
-
CadWebGLRenderer | CadCanvasRenderer fallback
|
|
262
|
-
↓
|
|
263
|
-
WebGL preview + Canvas overlay
|
|
277
|
+
DWG/DXF: CadDocument → CadWebGLRenderer | CadCanvasRenderer fallback
|
|
278
|
+
DWF/DWFx/XPS: DwfLoader.mount() → dwf-viewer native WebGL/WASM renderer
|
|
264
279
|
```
|
|
265
280
|
|
|
266
281
|
Each loader returns a normalized `CadDocument`:
|
|
@@ -312,8 +327,8 @@ viewer.registerLoader({
|
|
|
312
327
|
|---|---|---|
|
|
313
328
|
| DWG | `DwgLoader` | Uses LibreDWG WebAssembly. Rendering coverage depends on the entities exposed by LibreDWG conversion. |
|
|
314
329
|
| DXF | `DxfLoader` | Uses `dxf-parser` plus fallback parsing. Supports core entities, blocks/inserts, colors/layers, polylines, text, hatch boundaries and splines as preview polylines. |
|
|
315
|
-
|
|
|
316
|
-
|
|
|
330
|
+
| DWF | `DwfLoader` + `dwf-viewer` | DWF 6+ ZIP packages, WHIP/W2D 2D sheets, W3D/HSF 3D eModel pages, model tree metadata and WebGL/WASM rendering. |
|
|
331
|
+
| DWFx / XPS | `DwfLoader` + `dwf-viewer` | DWFx/OPC/XPS pages with vector paths, text, images and package resources through the native DWF renderer. |
|
|
317
332
|
|
|
318
333
|
## Color handling
|
|
319
334
|
|
|
@@ -357,7 +372,7 @@ npm run pack:dry
|
|
|
357
372
|
|
|
358
373
|
```bash
|
|
359
374
|
npm login
|
|
360
|
-
npm publish --access public
|
|
375
|
+
npm publish --access public --auth-type=web
|
|
361
376
|
```
|
|
362
377
|
|
|
363
378
|
The package also exposes:
|
|
@@ -400,12 +415,10 @@ src/
|
|
|
400
415
|
viewer/ CadViewer component and Canvas renderer
|
|
401
416
|
demo/ professional Vite demo UI
|
|
402
417
|
docs/ English and Chinese architecture / format notes
|
|
403
|
-
scripts/ clean and
|
|
418
|
+
scripts/ clean and runtime WASM copy/validation helpers
|
|
404
419
|
public/wasm/ demo WASM asset output directory
|
|
405
420
|
```
|
|
406
421
|
|
|
407
422
|
## License
|
|
408
423
|
|
|
409
|
-
AGPL-3.0-only.
|
|
410
|
-
|
|
411
|
-
The default DWG loader depends on `@mlightcad/libredwg-web`, which is GPL-3.0-only. For closed-source commercial use, replace the DWG loader with a properly licensed parser/converter and review all dependency licenses.
|
|
424
|
+
AGPL-3.0-only. The default DWG loader integrates `@mlightcad/libredwg-web` / LibreDWG, and the DWF renderer integrates `dwf-viewer`. Keep attribution and license notices when redistributing, modifying, embedding or using this package as part of another application. For closed-source commercial products, review all dependency licenses and replace loaders where your licensing model requires it.
|
package/README.zh-CN.md
CHANGED
|
@@ -8,11 +8,22 @@
|
|
|
8
8
|
**在线 Demo:** [cad-viewer-iys.pages.dev](https://cad-viewer-iys.pages.dev)
|
|
9
9
|
**源码仓库:** [github.com/flyfish-dev/cad-viewer](https://github.com/flyfish-dev/cad-viewer)
|
|
10
10
|
|
|
11
|
-
本仓库提供面向浏览器的 loader 架构,支持 **DWG**、**DXF
|
|
11
|
+
本仓库提供面向浏览器的 loader 架构,支持 **DWG**、**DXF**、**DWF**、**DWFx** 和 **XPS**。DWG/DXF 会归一化为统一 `CadDocument` 并通过 WebGL retained-mode 渲染,文字/图片使用轻量 Canvas overlay;DWF/DWFx/XPS 交给原生 `dwf-viewer` 渲染通道处理 W2D、W3D/HSF eModel 和 XPS 页面内容。文件在浏览器本地读取,组件不会把图纸上传到服务端。
|
|
12
12
|
|
|
13
|
-
> DWG 使用 `@mlightcad/libredwg-web` / LibreDWG WebAssembly
|
|
13
|
+
> DWG 使用 `@mlightcad/libredwg-web` / LibreDWG WebAssembly,并默认运行在 Worker 中。DXF 使用 JavaScript 解析器并带内置 fallback。DWF、DWFx、XPS 由 `dwf-viewer` 驱动,覆盖 DWF 6+ ZIP 包、WHIP/W2D 2D 图纸、W3D/HSF 3D eModel、DWFx/OPC/XPS 页面和可选 raster WASM fallback。
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
## 0.6.0 变更
|
|
17
|
+
|
|
18
|
+
- 使用已发布的 `dwf-viewer` 原生渲染器替换旧 DWFx/XPS 子集解析器。
|
|
19
|
+
- DWF/DWFx/XPS 不再强行转成普通 DWG/DXF 的 2D `CadDocument` 渲染链路,而是通过专用 native viewer 挂载。
|
|
20
|
+
- 新增 DWF 6+ ZIP 包、WHIP/W2D 2D 图纸、W3D/HSF 3D eModel、DWFx/OPC/XPS 页面,以及 dwf-viewer WebGL/WASM 渲染后端集成。
|
|
21
|
+
- 新增 `CadNativeRenderableLoader`,允许某些格式挂载自己的 DOM/WebGL 渲染器。
|
|
22
|
+
- 新增 `dwfWasmUrl`、`dwfPreferWebgl`、`dwfPreferWasm`、`dwfMaxCanvasPixels`、`dwfMaxGpuCacheBytes` 等生产配置。
|
|
23
|
+
- 运行时资源脚本现在会同时复制和校验 `libredwg-web.wasm` 与 `dwfv-render.wasm`。
|
|
24
|
+
- 删除旧 classic-DWF warning 逻辑,并移除本包对 `fflate` 的依赖。
|
|
25
|
+
- 包许可证更新为 AGPL-3.0-only,以匹配集成后的 DWF 渲染器。
|
|
26
|
+
|
|
16
27
|
## 0.5.3 变更
|
|
17
28
|
|
|
18
29
|
- 修复 DWG 图层索引色显示。LibreDWG 输出的索引色图层会优先按 ACI 解析,不再被 converter 的 `0xffffff` 占位值渲染成单色白图。
|
|
@@ -49,10 +60,10 @@
|
|
|
49
60
|
## 功能特性
|
|
50
61
|
|
|
51
62
|
- **纯前端组件**:`new CadViewer({ container })` 或 `new CadViewer({ canvas })`。
|
|
52
|
-
- **正确的 loader 架构**:DWG / DXF / DWF 独立 loader
|
|
63
|
+
- **正确的 loader 架构**:DWG / DXF / DWF 独立 loader,可替换、可扩展;native-renderable loader 可以挂载自己的优化渲染器。
|
|
53
64
|
- **DWG 预览**:通过 LibreDWG WebAssembly 在浏览器本地解析,默认在 Web Worker 中执行。
|
|
54
65
|
- **DXF 预览**:JavaScript 解析,支持常见 ASCII DXF `ENTITIES`,并带 fallback parser。
|
|
55
|
-
- **DWF/DWFx
|
|
66
|
+
- **DWF/DWFx/XPS 预览**:由 `dwf-viewer` 支持 DWF ZIP 包、W2D 2D 图纸、W3D/HSF eModel、DWFx/OPC/XPS 页面和 raster fallback。
|
|
56
67
|
- **CAD 颜色处理**:支持 ACI、BYLAYER、BYBLOCK 继承、DWG 图层颜色、true color、填充色、透明度和自适应对比度。
|
|
57
68
|
- **WebGL 高性能交互**:GPU retained buffers、空间分桶、视口裁剪、缩放、平移、适配窗口、世界坐标、缩放百分比。
|
|
58
69
|
- **专业 Demo**:拖拽打开、紧凑工具栏、状态条、解析/渲染耗时、实体类型统计、warnings 展示。
|
|
@@ -71,16 +82,16 @@ npm install
|
|
|
71
82
|
npm run dev
|
|
72
83
|
```
|
|
73
84
|
|
|
74
|
-
DWG
|
|
85
|
+
DWG 和 DWF 渲染链路需要将运行时 WASM 文件放到公开目录。Demo 使用以下命令复制并校验到 `public/wasm`:
|
|
75
86
|
|
|
76
87
|
```bash
|
|
77
88
|
npm run copy:wasm
|
|
78
89
|
npm run check:wasm
|
|
79
90
|
```
|
|
80
91
|
|
|
81
|
-
Demo 会先把 `wasmPath` 解析为绝对 URL,再发送给 worker
|
|
92
|
+
Demo 会先把 `wasmPath` 解析为绝对 URL,再发送给 DWG worker,并复用同一目录查找 `dwfv-render.wasm`。你自己的应用也建议使用绝对路径或绝对 URL,例如 `/wasm` 或 `new URL('wasm/', document.baseURI).href`。不要直接把未解析的 `./wasm` 传入 worker,否则它可能会相对于 worker chunk 请求资源。
|
|
82
93
|
|
|
83
|
-
发布 npm 包时,`build:lib`
|
|
94
|
+
发布 npm 包时,`build:lib` 会把这些文件复制到 `dist/wasm` 并作为 package subpath 暴露出来。应用侧仍需要把 `.wasm` 放到可公开访问的 URL,并把该目录传给 `wasmPath`,或者显式传入 `dwfWasmUrl`。
|
|
84
95
|
|
|
85
96
|
|
|
86
97
|
## Demo 启动说明
|
|
@@ -110,6 +121,7 @@ const viewer = new CadViewer({
|
|
|
110
121
|
container: document.querySelector('#viewer')!,
|
|
111
122
|
renderer: 'auto', // WebGL first, Canvas2D fallback
|
|
112
123
|
wasmPath: new URL('wasm/', document.baseURI).href,
|
|
124
|
+
dwfWasmUrl: new URL('wasm/dwfv-render.wasm', document.baseURI).href,
|
|
113
125
|
canvasOptions: {
|
|
114
126
|
background: '#05070d',
|
|
115
127
|
foreground: '#f8fafc',
|
|
@@ -177,6 +189,7 @@ const controller = new AbortController();
|
|
|
177
189
|
const viewer = new CadViewer({
|
|
178
190
|
container,
|
|
179
191
|
wasmPath: new URL('wasm/', document.baseURI).href,
|
|
192
|
+
dwfWasmUrl: new URL('wasm/dwfv-render.wasm', document.baseURI).href,
|
|
180
193
|
useWorker: true,
|
|
181
194
|
workerTimeoutMs: 120_000,
|
|
182
195
|
onLoadProgress(progress) {
|
|
@@ -197,6 +210,7 @@ controller.abort();
|
|
|
197
210
|
new CadViewer({
|
|
198
211
|
container,
|
|
199
212
|
wasmPath: new URL('wasm/', document.baseURI).href,
|
|
213
|
+
dwfWasmUrl: new URL('wasm/dwfv-render.wasm', document.baseURI).href,
|
|
200
214
|
workerUrl: new URL('/assets/dwg-worker.js', window.location.origin)
|
|
201
215
|
});
|
|
202
216
|
```
|
|
@@ -256,11 +270,8 @@ CadLoaderRegistry
|
|
|
256
270
|
↓
|
|
257
271
|
DwgLoader | DxfLoader | DwfLoader | 自定义 loader
|
|
258
272
|
↓
|
|
259
|
-
CadDocument
|
|
260
|
-
|
|
261
|
-
CadWebGLRenderer | CadCanvasRenderer fallback
|
|
262
|
-
↓
|
|
263
|
-
WebGL preview + Canvas overlay
|
|
273
|
+
DWG/DXF:CadDocument → CadWebGLRenderer | CadCanvasRenderer fallback
|
|
274
|
+
DWF/DWFx/XPS:DwfLoader.mount() → dwf-viewer native WebGL/WASM renderer
|
|
264
275
|
```
|
|
265
276
|
|
|
266
277
|
所有 loader 都输出统一的 `CadDocument`:
|
|
@@ -312,8 +323,8 @@ viewer.registerLoader({
|
|
|
312
323
|
|---|---|---|
|
|
313
324
|
| DWG | `DwgLoader` | 使用 LibreDWG WebAssembly。渲染完整度取决于 LibreDWG converter 暴露出的实体。 |
|
|
314
325
|
| DXF | `DxfLoader` | 使用 `dxf-parser` + 内置 fallback。支持基础实体、block/insert、颜色/图层、多段线、文字、hatch boundary、spline 预览。 |
|
|
315
|
-
|
|
|
316
|
-
|
|
|
326
|
+
| DWF | `DwfLoader` + `dwf-viewer` | DWF 6+ ZIP 包、WHIP/W2D 2D 图纸、W3D/HSF 3D eModel、模型树元数据以及 WebGL/WASM 渲染。 |
|
|
327
|
+
| DWFx / XPS | `DwfLoader` + `dwf-viewer` | DWFx/OPC/XPS 页面,包含 vector path、文本、图片和包内资源,通过原生 DWF 渲染器展示。 |
|
|
317
328
|
|
|
318
329
|
## 颜色处理
|
|
319
330
|
|
|
@@ -357,7 +368,7 @@ npm run pack:dry
|
|
|
357
368
|
|
|
358
369
|
```bash
|
|
359
370
|
npm login
|
|
360
|
-
npm publish --access public
|
|
371
|
+
npm publish --access public --auth-type=web
|
|
361
372
|
```
|
|
362
373
|
|
|
363
374
|
仓库内也提供:
|
|
@@ -400,12 +411,10 @@ src/
|
|
|
400
411
|
viewer/ CadViewer 组件和 Canvas renderer
|
|
401
412
|
demo/ 专业 Vite demo UI
|
|
402
413
|
docs/ 中英文架构/格式文档
|
|
403
|
-
scripts/ clean
|
|
414
|
+
scripts/ clean、运行时 WASM 复制与校验脚本
|
|
404
415
|
public/wasm/ demo 的 WASM 输出目录
|
|
405
416
|
```
|
|
406
417
|
|
|
407
418
|
## 许可证
|
|
408
419
|
|
|
409
|
-
AGPL-3.0-only
|
|
410
|
-
|
|
411
|
-
默认 DWG loader 依赖 `@mlightcad/libredwg-web`,该包为 GPL-3.0-only。若用于闭源商业产品,请替换为合规授权的 DWG parser/converter,并重新审查依赖许可证。
|
|
420
|
+
AGPL-3.0-only。默认 DWG loader 集成 `@mlightcad/libredwg-web` / LibreDWG,DWF 渲染器集成 `dwf-viewer`。二开、分发、嵌入或作为应用组成部分使用时,请保留出处和许可证说明。闭源商用产品需要审阅所有依赖许可证,并在授权模型需要时替换对应 loader。
|