ducsvg 3.9.1 → 4.0.2

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <p align="center">
4
4
  <br/>
5
5
  <a href="https://duc.ducflair.com" target="_blank"><img width="256px" src="https://cdn.jsdelivr.net/gh/ducflair/assets@main/src/duc/duc-extended.png" /></a>
6
- <p align="center">SVG Adapter for the duc 2D CAD File Format</p>
6
+ <p align="center">SVG Adapter for the .duc project-state format</p>
7
7
  <p align="center" style="align: center;">
8
8
  <a href="https://www.npmjs.com/package/ducsvg"><img src="https://shields.io/badge/NPM-cc3534?logo=Npm&logoColor=white&style=round-square" alt="NPM" /></a>
9
9
  <a href="https://www.npmjs.com/package/ducsvg"><img src="https://img.shields.io/npm/v/ducsvg/latest?style=round-square&label=latest%20stable" alt="NPM ducsvg@latest release" /></a>
@@ -12,7 +12,7 @@
12
12
  </p>
13
13
 
14
14
 
15
- `ducsvg` is a lightweight adapter for rendering `duc` CAD documents to SVG. It’s built on top of `ducjs` and focuses on accurate, standards-compliant SVG output you can embed in browsers or export from Node.js.
15
+ `ducsvg` is a lightweight adapter for rendering `duc` documents to SVG. It's built on top of `ducjs` and focuses on accurate, standards-compliant SVG output you can embed in browsers or export from Node.js.
16
16
 
17
17
  > This library leverages the stable renderer from `ducpdf`, first converting the `duc` document to PDF format before transforming it into SVG using `hayro` and `hayro_svg`. This approach ensures high fidelity in the SVG output by utilizing the robust rendering capabilities of the PDF format.
18
18
 
@@ -1,8 +1,13 @@
1
1
  import { type ConversionOptions } from "ducpdf";
2
+ import type { ExportedDataState } from "ducjs";
2
3
  import { type SvgDocument } from "./pdf2svg";
3
4
  export type { SvgDocument };
5
+ export interface DucDocumentSource {
6
+ readDocumentState(): ExportedDataState | Promise<ExportedDataState>;
7
+ }
8
+ export type DucSvgSource = ExportedDataState | DucDocumentSource;
4
9
  /**
5
- * Convert DUC data to SVG pages.
10
+ * Convert a DUC document state/source to SVG pages.
6
11
  * Uses ducpdf to convert DUC to PDF, then pdf2svg to convert PDF to SVG.
7
12
  */
8
- export declare const ducToSvg: (ducData: Uint8Array, options?: ConversionOptions) => Promise<SvgDocument>;
13
+ export declare const ducToSvg: (source: DucSvgSource, options?: ConversionOptions) => Promise<SvgDocument>;
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ducsvg",
3
- "version": "3.9.1",
3
+ "version": "4.0.2",
4
4
  "description": "Adapter for converting duc CAD documents to SVG. Built on top of ducjs.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -29,19 +29,22 @@
29
29
  "copy:wasm-to-dist": "mkdir -p dist && cp pkg/pdf2svg_bg.wasm dist/ && cp pkg/pdf2svg.js dist/pdf2svg-wasm.js && cp pkg/pdf2svg.d.ts dist/pdf2svg-wasm.d.ts && cp pkg/pdf2svg_bg.wasm.d.ts dist/",
30
30
  "clean": "rm -rf dist pkg",
31
31
  "check-types": "tsc --noEmit",
32
+ "gen:docs": "bunx typedoc",
33
+ "dev:docs": "bun run gen:docs && python3 -m http.server 8244 --directory docs",
32
34
  "test": "bun test",
33
35
  "semantic-release": "semantic-release"
34
36
  },
35
37
  "author": "Ducflair",
36
38
  "license": "MIT",
37
39
  "dependencies": {
38
- "ducjs": "^3.5.1",
39
- "ducpdf": "^3.9.1"
40
+ "ducjs": "^4.0.1",
41
+ "ducpdf": "^4.0.2"
40
42
  },
41
43
  "devDependencies": {
42
44
  "@xmldom/xmldom": "^0.8.11",
43
45
  "happy-dom": "^20.0.5",
44
46
  "semantic-release": "^24.1.2",
47
+ "typedoc": "^0.27.9",
45
48
  "typescript": "^5.8.3",
46
49
  "vite": "^6.0.0",
47
50
  "vite-plugin-compression": "^0.5.1",