@mlightcad/libredwg-web 0.7.8 → 0.7.9
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/dist/libredwg-web.js +13 -11
- package/dist/libredwg-web.umd.cjs +13 -11
- package/lib/converter/converter.js +6 -9
- package/lib/database/database.d.ts +1 -0
- package/lib/libredwg.d.ts +1 -1
- package/lib/libredwg.js +6 -3
- package/package.json +3 -2
- package/wasm/libredwg-web.d.ts +548 -548
- package/lib/converter/mleaderColorCodec.d.ts +0 -9
- package/lib/converter/mleaderColorCodec.js +0 -52
- package/lib/converter/stringConverter.d.ts +0 -3
- package/lib/converter/stringConverter.js +0 -7
- package/lib/database/entities/unknown.d.ts +0 -7
- package/lib/database/entities/unknown.js +0 -2
- package/lib/database/objects/unknown.d.ts +0 -7
- package/lib/database/objects/unknown.js +0 -2
- package/lib/debug.d.ts +0 -13
- package/lib/debug.js +0 -48
- package/lib/libredwg-core.d.ts +0 -740
- package/lib/libredwg-core.js +0 -1121
- package/lib/libredwg-web.d.ts +0 -3
- package/lib/libredwg-web.js +0 -2318
- package/lib/memory64/index.d.ts +0 -4
- package/lib/memory64/index.js +0 -4
- package/lib/memory64/libredwg.d.ts +0 -13
- package/lib/memory64/libredwg.js +0 -23
- package/lib/utils/common.d.ts +0 -4
- package/lib/utils/common.js +0 -12
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.js +0 -2
package/dist/libredwg-web.js
CHANGED
|
@@ -3345,6 +3345,7 @@ class LibreDwgConverter {
|
|
|
3345
3345
|
this.entityConverter = new LibreEntityConverter(instance);
|
|
3346
3346
|
}
|
|
3347
3347
|
convert(data) {
|
|
3348
|
+
var _a;
|
|
3348
3349
|
this.entityConverter.clear();
|
|
3349
3350
|
const db = {
|
|
3350
3351
|
tables: {
|
|
@@ -3490,6 +3491,10 @@ class LibreDwgConverter {
|
|
|
3490
3491
|
viewportEntities.forEach((viewport, index) => {
|
|
3491
3492
|
viewport.viewportId = index + 1;
|
|
3492
3493
|
});
|
|
3494
|
+
const thumbnail = libredwg.dwg_bmp(data);
|
|
3495
|
+
if ((_a = thumbnail == null ? void 0 : thumbnail.data) == null ? void 0 : _a.length) {
|
|
3496
|
+
db.thumbnailImage = thumbnail.data;
|
|
3497
|
+
}
|
|
3493
3498
|
return db;
|
|
3494
3499
|
}
|
|
3495
3500
|
getConversionStats() {
|
|
@@ -3568,17 +3573,10 @@ class LibreDwgConverter {
|
|
|
3568
3573
|
const scalability = libredwg.dwg_dynapi_entity_data(item, "block_scaling");
|
|
3569
3574
|
const layout_ptr = libredwg.dwg_dynapi_entity_data(item, "layout");
|
|
3570
3575
|
const layout = libredwg.dwg_ref_get_id(layout_ptr) ?? "";
|
|
3571
|
-
let bmpPreview
|
|
3572
|
-
const uint8ArrayToHexString2 = (bytes) => {
|
|
3573
|
-
const hexChars = new Array(bytes.length);
|
|
3574
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
3575
|
-
hexChars[i] = bytes[i].toString(16).toUpperCase();
|
|
3576
|
-
}
|
|
3577
|
-
return hexChars.join("");
|
|
3578
|
-
};
|
|
3576
|
+
let bmpPreview;
|
|
3579
3577
|
const bmpPreviewBinaryData = libredwg.dwg_entity_block_header_get_preview(item);
|
|
3580
3578
|
if (bmpPreviewBinaryData && bmpPreviewBinaryData.length > 0) {
|
|
3581
|
-
bmpPreview =
|
|
3579
|
+
bmpPreview = uint8ArrayToHexString(bmpPreviewBinaryData);
|
|
3582
3580
|
}
|
|
3583
3581
|
let entities = this.convertEntities(obj, commonAttrs.handle);
|
|
3584
3582
|
if (!entities || entities.length == 0) {
|
|
@@ -6708,8 +6706,12 @@ const _LibreDwg = class _LibreDwg {
|
|
|
6708
6706
|
* @returns Returns preview image of the block pointed by the specified block header.
|
|
6709
6707
|
*/
|
|
6710
6708
|
dwg_entity_block_header_get_preview(ptr) {
|
|
6711
|
-
const
|
|
6712
|
-
|
|
6709
|
+
const wasm = this.wasmInstance;
|
|
6710
|
+
if (typeof wasm.dwg_entity_block_header_get_preview !== "function") {
|
|
6711
|
+
return null;
|
|
6712
|
+
}
|
|
6713
|
+
const result = wasm.dwg_entity_block_header_get_preview(ptr);
|
|
6714
|
+
return (result == null ? void 0 : result.data) ?? null;
|
|
6713
6715
|
}
|
|
6714
6716
|
/**
|
|
6715
6717
|
* Returns preview binary data of one entity (common entity preview field).
|
|
@@ -3347,6 +3347,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3347
3347
|
this.entityConverter = new LibreEntityConverter(instance);
|
|
3348
3348
|
}
|
|
3349
3349
|
convert(data) {
|
|
3350
|
+
var _a;
|
|
3350
3351
|
this.entityConverter.clear();
|
|
3351
3352
|
const db = {
|
|
3352
3353
|
tables: {
|
|
@@ -3492,6 +3493,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3492
3493
|
viewportEntities.forEach((viewport, index) => {
|
|
3493
3494
|
viewport.viewportId = index + 1;
|
|
3494
3495
|
});
|
|
3496
|
+
const thumbnail = libredwg.dwg_bmp(data);
|
|
3497
|
+
if ((_a = thumbnail == null ? void 0 : thumbnail.data) == null ? void 0 : _a.length) {
|
|
3498
|
+
db.thumbnailImage = thumbnail.data;
|
|
3499
|
+
}
|
|
3495
3500
|
return db;
|
|
3496
3501
|
}
|
|
3497
3502
|
getConversionStats() {
|
|
@@ -3570,17 +3575,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
3570
3575
|
const scalability = libredwg.dwg_dynapi_entity_data(item, "block_scaling");
|
|
3571
3576
|
const layout_ptr = libredwg.dwg_dynapi_entity_data(item, "layout");
|
|
3572
3577
|
const layout = libredwg.dwg_ref_get_id(layout_ptr) ?? "";
|
|
3573
|
-
let bmpPreview
|
|
3574
|
-
const uint8ArrayToHexString2 = (bytes) => {
|
|
3575
|
-
const hexChars = new Array(bytes.length);
|
|
3576
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
3577
|
-
hexChars[i] = bytes[i].toString(16).toUpperCase();
|
|
3578
|
-
}
|
|
3579
|
-
return hexChars.join("");
|
|
3580
|
-
};
|
|
3578
|
+
let bmpPreview;
|
|
3581
3579
|
const bmpPreviewBinaryData = libredwg.dwg_entity_block_header_get_preview(item);
|
|
3582
3580
|
if (bmpPreviewBinaryData && bmpPreviewBinaryData.length > 0) {
|
|
3583
|
-
bmpPreview =
|
|
3581
|
+
bmpPreview = uint8ArrayToHexString(bmpPreviewBinaryData);
|
|
3584
3582
|
}
|
|
3585
3583
|
let entities = this.convertEntities(obj, commonAttrs.handle);
|
|
3586
3584
|
if (!entities || entities.length == 0) {
|
|
@@ -6710,8 +6708,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6710
6708
|
* @returns Returns preview image of the block pointed by the specified block header.
|
|
6711
6709
|
*/
|
|
6712
6710
|
dwg_entity_block_header_get_preview(ptr) {
|
|
6713
|
-
const
|
|
6714
|
-
|
|
6711
|
+
const wasm = this.wasmInstance;
|
|
6712
|
+
if (typeof wasm.dwg_entity_block_header_get_preview !== "function") {
|
|
6713
|
+
return null;
|
|
6714
|
+
}
|
|
6715
|
+
const result = wasm.dwg_entity_block_header_get_preview(ptr);
|
|
6716
|
+
return (result == null ? void 0 : result.data) ?? null;
|
|
6715
6717
|
}
|
|
6716
6718
|
/**
|
|
6717
6719
|
* Returns preview binary data of one entity (common entity preview field).
|
|
@@ -2,7 +2,7 @@ import { HEADER_VARIABLES } from '../database';
|
|
|
2
2
|
import { Dwg_Object_Supertype, Dwg_Object_Type } from '../types';
|
|
3
3
|
import { dwgColorToMLeaderRawColor } from './dwgColorToMLeaderRawColor';
|
|
4
4
|
import { LibreEntityConverter } from './entityConverter';
|
|
5
|
-
import { idToString, isModelSpace, isPaperSpace } from './utils';
|
|
5
|
+
import { idToString, isModelSpace, isPaperSpace, uint8ArrayToHexString } from './utils';
|
|
6
6
|
/**
|
|
7
7
|
* Class used to convert Dwg_Data instance to DwgDatabase instance.
|
|
8
8
|
*/
|
|
@@ -166,6 +166,10 @@ export class LibreDwgConverter {
|
|
|
166
166
|
viewportEntities.forEach((viewport, index) => {
|
|
167
167
|
viewport.viewportId = index + 1;
|
|
168
168
|
});
|
|
169
|
+
const thumbnail = libredwg.dwg_bmp(data);
|
|
170
|
+
if (thumbnail?.data?.length) {
|
|
171
|
+
db.thumbnailImage = thumbnail.data;
|
|
172
|
+
}
|
|
169
173
|
return db;
|
|
170
174
|
}
|
|
171
175
|
getConversionStats() {
|
|
@@ -258,14 +262,7 @@ export class LibreDwgConverter {
|
|
|
258
262
|
const scalability = libredwg.dwg_dynapi_entity_data(item, 'block_scaling');
|
|
259
263
|
const layout_ptr = libredwg.dwg_dynapi_entity_data(item, 'layout');
|
|
260
264
|
const layout = (libredwg.dwg_ref_get_id(layout_ptr) ?? '');
|
|
261
|
-
let bmpPreview
|
|
262
|
-
const uint8ArrayToHexString = (bytes) => {
|
|
263
|
-
const hexChars = new Array(bytes.length);
|
|
264
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
265
|
-
hexChars[i] = bytes[i].toString(16).toUpperCase();
|
|
266
|
-
}
|
|
267
|
-
return hexChars.join('');
|
|
268
|
-
};
|
|
265
|
+
let bmpPreview;
|
|
269
266
|
const bmpPreviewBinaryData = libredwg.dwg_entity_block_header_get_preview(item);
|
|
270
267
|
if (bmpPreviewBinaryData && bmpPreviewBinaryData.length > 0) {
|
|
271
268
|
bmpPreview = uint8ArrayToHexString(bmpPreviewBinaryData);
|
package/lib/libredwg.d.ts
CHANGED
|
@@ -717,7 +717,7 @@ export declare class LibreDwg {
|
|
|
717
717
|
* @param ptr Pointer to one Dwg_Entity_BLOCK_HEADER instance.
|
|
718
718
|
* @returns Returns preview image of the block pointed by the specified block header.
|
|
719
719
|
*/
|
|
720
|
-
dwg_entity_block_header_get_preview(ptr: Dwg_Object_BLOCK_HEADER_Ptr): Uint8Array;
|
|
720
|
+
dwg_entity_block_header_get_preview(ptr: Dwg_Object_BLOCK_HEADER_Ptr): Uint8Array | null;
|
|
721
721
|
/**
|
|
722
722
|
* Returns preview binary data of one entity (common entity preview field).
|
|
723
723
|
* For PROXY_ENTITY this contains the proxy graphics data.
|
package/lib/libredwg.js
CHANGED
|
@@ -1055,9 +1055,12 @@ export class LibreDwg {
|
|
|
1055
1055
|
* @returns Returns preview image of the block pointed by the specified block header.
|
|
1056
1056
|
*/
|
|
1057
1057
|
dwg_entity_block_header_get_preview(ptr) {
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1060
|
-
|
|
1058
|
+
const wasm = this.wasmInstance;
|
|
1059
|
+
if (typeof wasm.dwg_entity_block_header_get_preview !== 'function') {
|
|
1060
|
+
return null;
|
|
1061
|
+
}
|
|
1062
|
+
const result = wasm.dwg_entity_block_header_get_preview(ptr);
|
|
1063
|
+
return result?.data ?? null;
|
|
1061
1064
|
}
|
|
1062
1065
|
/**
|
|
1063
1066
|
* Returns preview binary data of one entity (common entity preview field).
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A DWG/DXF JavaScript parser based on libredwg",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "0.7.
|
|
6
|
+
"version": "0.7.9",
|
|
7
7
|
"author": "MLight Lee <mlight.lee@outlook.com>",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"engines": {
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"lint:fix": "eslint --fix --quiet src/",
|
|
87
87
|
"test": "node --test test/node-api.test.mjs",
|
|
88
88
|
"test:node": "pnpm build && pnpm test",
|
|
89
|
-
"publish:npm": "pnpm publish --access public --no-git-checks"
|
|
89
|
+
"publish:npm": "pnpm publish --access public --no-git-checks",
|
|
90
|
+
"release": "node tools/release.mjs"
|
|
90
91
|
}
|
|
91
92
|
}
|