@mlightcad/libredwg-web 0.7.5 → 0.7.6

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.
@@ -2934,37 +2934,36 @@ class LibreEntityConverter {
2934
2934
  };
2935
2935
  }
2936
2936
  convertTableCells(cells) {
2937
- const converted = [];
2938
- cells.forEach((cell) => {
2937
+ return cells.map((cell) => {
2938
+ var _a, _b;
2939
2939
  return {
2940
2940
  text: cell.text_value,
2941
2941
  attachmentPoint: cell.cell_alignment,
2942
- textStyle: cell.text_style,
2943
- // TODO: Set the text style name instead of handle
2942
+ textStyle: cell.text_style ? String(cell.text_style) : void 0,
2944
2943
  rotation: cell.rotation,
2945
2944
  cellType: cell.type,
2946
2945
  flagValue: cell.flags,
2947
2946
  mergedValue: cell.is_merged_value,
2948
2947
  autoFit: cell.is_autofit_flag,
2949
- // borderWidth?: number
2950
- // borderHeight?: number
2951
- topBorderVisibility: cell.top_visibility,
2952
- bottomBorderVisibility: cell.bottom_visibility,
2953
- leftBorderVisibility: cell.left_visibility,
2954
- rightBorderVisibility: cell.right_visibility,
2948
+ topBorderVisibility: !!cell.top_visibility,
2949
+ bottomBorderVisibility: !!cell.bottom_visibility,
2950
+ leftBorderVisibility: !!cell.left_visibility,
2951
+ rightBorderVisibility: !!cell.right_visibility,
2955
2952
  overrideFlag: cell.cell_flag_override,
2956
2953
  virtualEdgeFlag: cell.virtual_edge_flag,
2957
- // fieldObjetId?: string
2958
- blockTableRecordI: cell.block_handle.absolute_ref,
2954
+ blockTableRecordId: cell.block_handle ? String(cell.block_handle.absolute_ref ?? "") : void 0,
2959
2955
  blockScale: cell.block_scale,
2960
- blockAttrNum: cell.attr_defs.length,
2961
- attrDefineId: cell.attr_defs.map((value) => value.attdef.absolute_ref),
2962
- // attrText?: string
2963
- // textHeight: number
2956
+ blockAttrNum: ((_a = cell.attr_defs) == null ? void 0 : _a.length) ?? 0,
2957
+ attrDefineId: (_b = cell.attr_defs) == null ? void 0 : _b.map(
2958
+ (value) => {
2959
+ var _a2;
2960
+ return String(((_a2 = value.attdef) == null ? void 0 : _a2.absolute_ref) ?? "");
2961
+ }
2962
+ ),
2963
+ textHeight: cell.text_height ?? 0,
2964
2964
  extendedCellFlags: cell.additional_data_flag
2965
2965
  };
2966
2966
  });
2967
- return converted;
2968
2967
  }
2969
2968
  convertTextBase(entity) {
2970
2969
  const libredwg = this.libredwg;
@@ -5389,6 +5388,7 @@ class SvgConverter {
5389
5388
  result = this.ray(entity);
5390
5389
  break;
5391
5390
  case "TABLE":
5391
+ case "ACAD_TABLE":
5392
5392
  result = this.table(entity);
5393
5393
  break;
5394
5394
  case "TEXT":
@@ -2936,37 +2936,36 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2936
2936
  };
2937
2937
  }
2938
2938
  convertTableCells(cells) {
2939
- const converted = [];
2940
- cells.forEach((cell) => {
2939
+ return cells.map((cell) => {
2940
+ var _a, _b;
2941
2941
  return {
2942
2942
  text: cell.text_value,
2943
2943
  attachmentPoint: cell.cell_alignment,
2944
- textStyle: cell.text_style,
2945
- // TODO: Set the text style name instead of handle
2944
+ textStyle: cell.text_style ? String(cell.text_style) : void 0,
2946
2945
  rotation: cell.rotation,
2947
2946
  cellType: cell.type,
2948
2947
  flagValue: cell.flags,
2949
2948
  mergedValue: cell.is_merged_value,
2950
2949
  autoFit: cell.is_autofit_flag,
2951
- // borderWidth?: number
2952
- // borderHeight?: number
2953
- topBorderVisibility: cell.top_visibility,
2954
- bottomBorderVisibility: cell.bottom_visibility,
2955
- leftBorderVisibility: cell.left_visibility,
2956
- rightBorderVisibility: cell.right_visibility,
2950
+ topBorderVisibility: !!cell.top_visibility,
2951
+ bottomBorderVisibility: !!cell.bottom_visibility,
2952
+ leftBorderVisibility: !!cell.left_visibility,
2953
+ rightBorderVisibility: !!cell.right_visibility,
2957
2954
  overrideFlag: cell.cell_flag_override,
2958
2955
  virtualEdgeFlag: cell.virtual_edge_flag,
2959
- // fieldObjetId?: string
2960
- blockTableRecordI: cell.block_handle.absolute_ref,
2956
+ blockTableRecordId: cell.block_handle ? String(cell.block_handle.absolute_ref ?? "") : void 0,
2961
2957
  blockScale: cell.block_scale,
2962
- blockAttrNum: cell.attr_defs.length,
2963
- attrDefineId: cell.attr_defs.map((value) => value.attdef.absolute_ref),
2964
- // attrText?: string
2965
- // textHeight: number
2958
+ blockAttrNum: ((_a = cell.attr_defs) == null ? void 0 : _a.length) ?? 0,
2959
+ attrDefineId: (_b = cell.attr_defs) == null ? void 0 : _b.map(
2960
+ (value) => {
2961
+ var _a2;
2962
+ return String(((_a2 = value.attdef) == null ? void 0 : _a2.absolute_ref) ?? "");
2963
+ }
2964
+ ),
2965
+ textHeight: cell.text_height ?? 0,
2966
2966
  extendedCellFlags: cell.additional_data_flag
2967
2967
  };
2968
2968
  });
2969
- return converted;
2970
2969
  }
2971
2970
  convertTextBase(entity) {
2972
2971
  const libredwg = this.libredwg;
@@ -5391,6 +5390,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5391
5390
  result = this.ray(entity);
5392
5391
  break;
5393
5392
  case "TABLE":
5393
+ case "ACAD_TABLE":
5394
5394
  result = this.table(entity);
5395
5395
  break;
5396
5396
  case "TEXT":
@@ -1561,36 +1561,32 @@ export class LibreEntityConverter {
1561
1561
  };
1562
1562
  }
1563
1563
  convertTableCells(cells) {
1564
- const converted = [];
1565
- cells.forEach(cell => {
1566
- return {
1567
- text: cell.text_value,
1568
- attachmentPoint: cell.cell_alignment,
1569
- textStyle: cell.text_style, // TODO: Set the text style name instead of handle
1570
- rotation: cell.rotation,
1571
- cellType: cell.type,
1572
- flagValue: cell.flags,
1573
- mergedValue: cell.is_merged_value,
1574
- autoFit: cell.is_autofit_flag,
1575
- // borderWidth?: number
1576
- // borderHeight?: number
1577
- topBorderVisibility: cell.top_visibility,
1578
- bottomBorderVisibility: cell.bottom_visibility,
1579
- leftBorderVisibility: cell.left_visibility,
1580
- rightBorderVisibility: cell.right_visibility,
1581
- overrideFlag: cell.cell_flag_override,
1582
- virtualEdgeFlag: cell.virtual_edge_flag,
1583
- // fieldObjetId?: string
1584
- blockTableRecordI: cell.block_handle.absolute_ref,
1585
- blockScale: cell.block_scale,
1586
- blockAttrNum: cell.attr_defs.length,
1587
- attrDefineId: cell.attr_defs.map(value => value.attdef.absolute_ref),
1588
- // attrText?: string
1589
- // textHeight: number
1590
- extendedCellFlags: cell.additional_data_flag
1591
- };
1592
- });
1593
- return converted;
1564
+ return cells.map(cell => ({
1565
+ text: cell.text_value,
1566
+ attachmentPoint: cell.cell_alignment,
1567
+ textStyle: cell.text_style
1568
+ ? String(cell.text_style)
1569
+ : undefined,
1570
+ rotation: cell.rotation,
1571
+ cellType: cell.type,
1572
+ flagValue: cell.flags,
1573
+ mergedValue: cell.is_merged_value,
1574
+ autoFit: cell.is_autofit_flag,
1575
+ topBorderVisibility: !!cell.top_visibility,
1576
+ bottomBorderVisibility: !!cell.bottom_visibility,
1577
+ leftBorderVisibility: !!cell.left_visibility,
1578
+ rightBorderVisibility: !!cell.right_visibility,
1579
+ overrideFlag: cell.cell_flag_override,
1580
+ virtualEdgeFlag: cell.virtual_edge_flag,
1581
+ blockTableRecordId: cell.block_handle
1582
+ ? String(cell.block_handle.absolute_ref ?? '')
1583
+ : undefined,
1584
+ blockScale: cell.block_scale,
1585
+ blockAttrNum: cell.attr_defs?.length ?? 0,
1586
+ attrDefineId: cell.attr_defs?.map(value => String(value.attdef?.absolute_ref ?? '')),
1587
+ textHeight: cell.text_height ?? 0,
1588
+ extendedCellFlags: cell.additional_data_flag
1589
+ }));
1594
1590
  }
1595
1591
  convertTextBase(entity) {
1596
1592
  const libredwg = this.libredwg;
@@ -446,6 +446,7 @@ export class SvgConverter {
446
446
  result = this.ray(entity);
447
447
  break;
448
448
  case 'TABLE':
449
+ case 'ACAD_TABLE':
449
450
  result = this.table(entity);
450
451
  break;
451
452
  case 'TEXT':
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.5",
6
+ "version": "0.7.6",
7
7
  "author": "MLight Lee <mlight.lee@outlook.com>",
8
8
  "type": "module",
9
9
  "engines": {
@@ -74,7 +74,7 @@
74
74
  "demo": "live-server examples --entry-file=index.html",
75
75
  "doc": "typedoc",
76
76
  "build": "tsc && vite build && cp -rf wasm examples/ && cp -rf dist examples/",
77
- "build:prepare": "mkdir -p ../../build-wasm && cd ../../build-wasm && emconfigure ../configure CFLAGS=\"-O2 -sUSE_ZLIB=1 -DNDEBUG\" CC=emcc --enable-release --disable-docs --disable-write --disable-python --disable-bindings --disable-shared --disable-json --enable-partial --enable-experimental",
77
+ "build:prepare": "mkdir -p ../../build-wasm && cd ../../build-wasm && emconfigure ../configure CFLAGS=\"-O2 -sUSE_ZLIB=1 -DNDEBUG\" CC=emcc --enable-release --enable-debug --disable-docs --disable-write --disable-python --disable-bindings --disable-shared --disable-json",
78
78
  "build:obj": "cd ../../build-wasm && emmake make",
79
79
  "build:wasm": "cd ../../build-wasm && emcc ../bindings/javascript/embind/*.cpp src/*.o -O2 -lembind -std=c++17 -Isrc -I../src -I../include -o libredwg-web.js -s ALLOW_MEMORY_GROWTH=1 -s INITIAL_MEMORY=1GB -s MAXIMUM_MEMORY=4GB -s MALLOC=mimalloc -s EXPORT_ES6=1 -s MODULARIZE=1 -s EXPORT_NAME=\"createModule\" -sEXPORTED_RUNTIME_METHODS=FS,ENV,ccall,cwrap,UTF8ToString,stringToNewUTF8,setValue --emit-tsd libredwg-web.d.ts",
80
80
  "clean": "rm -rf ../../build-wasm ./docs ./dist ./lib",
Binary file