@mlightcad/cad-simple-viewer 1.0.14 → 1.0.15

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.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Registers file format converters for CAD file processing.
3
+ *
4
+ * This function initializes and registers both DXF and DWG converters with the
5
+ * global database converter manager. Each converter is configured to use web workers
6
+ * for improved performance during file parsing operations.
7
+ *
8
+ * The function handles registration errors gracefully by logging them to the console
9
+ * without throwing exceptions, ensuring that the application can continue to function
10
+ * even if one or more converters fail to register.
11
+ *
12
+ * @async
13
+ * @function registerConverters
14
+ * @returns {Promise<void>} A promise that resolves when all converters have been
15
+ * registered (or failed to register)
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Register all available converters
20
+ * await registerConverters();
21
+ * ```
22
+ */
23
+ export declare function registerConverters(): Promise<void>;
24
+ //# sourceMappingURL=AcApGlobalFunc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApGlobalFunc.d.ts","sourceRoot":"","sources":["../../src/app/AcApGlobalFunc.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,kBAAkB,kBAsBvC"}
@@ -0,0 +1,91 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { AcDbDatabaseConverterManager, AcDbDxfConverter, AcDbFileType } from '@mlightcad/data-model';
38
+ import { AcDbLibreDwgConverter } from '@mlightcad/libredwg-converter';
39
+ /**
40
+ * Registers file format converters for CAD file processing.
41
+ *
42
+ * This function initializes and registers both DXF and DWG converters with the
43
+ * global database converter manager. Each converter is configured to use web workers
44
+ * for improved performance during file parsing operations.
45
+ *
46
+ * The function handles registration errors gracefully by logging them to the console
47
+ * without throwing exceptions, ensuring that the application can continue to function
48
+ * even if one or more converters fail to register.
49
+ *
50
+ * @async
51
+ * @function registerConverters
52
+ * @returns {Promise<void>} A promise that resolves when all converters have been
53
+ * registered (or failed to register)
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * // Register all available converters
58
+ * await registerConverters();
59
+ * ```
60
+ */
61
+ export function registerConverters() {
62
+ return __awaiter(this, void 0, void 0, function () {
63
+ var converter, converter;
64
+ return __generator(this, function (_a) {
65
+ // Register DXF converter
66
+ try {
67
+ converter = new AcDbDxfConverter({
68
+ useWorker: true,
69
+ parserWorkerUrl: './assets/dxf-parser-worker.js'
70
+ });
71
+ AcDbDatabaseConverterManager.instance.register(AcDbFileType.DXF, converter);
72
+ }
73
+ catch (error) {
74
+ console.error('Failed to register dxf converter: ', error);
75
+ }
76
+ // Register DWG converter
77
+ try {
78
+ converter = new AcDbLibreDwgConverter({
79
+ useWorker: true,
80
+ parserWorkerUrl: './assets/libredwg-parser-worker.js'
81
+ });
82
+ AcDbDatabaseConverterManager.instance.register(AcDbFileType.DWG, converter);
83
+ }
84
+ catch (error) {
85
+ console.error('Failed to register dwg converter: ', error);
86
+ }
87
+ return [2 /*return*/];
88
+ });
89
+ });
90
+ }
91
+ //# sourceMappingURL=AcApGlobalFunc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApGlobalFunc.js","sourceRoot":"","sources":["../../src/app/AcApGlobalFunc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAgB,kBAAkB;;;;YACtC,yBAAyB;YACzB,IAAI,CAAC;gBACG,SAAS,GAAG,IAAI,gBAAgB,CAAC;oBACrC,SAAS,EAAE,IAAI;oBACf,eAAe,EAAE,+BAA+B;iBACjD,CAAC,CAAA;gBACF,4BAA4B,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YAC7E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAA;YAC5D,CAAC;YAED,yBAAyB;YACzB,IAAI,CAAC;gBACG,SAAS,GAAG,IAAI,qBAAqB,CAAC;oBAC1C,SAAS,EAAE,IAAI;oBACf,eAAe,EAAE,oCAAoC;iBACtD,CAAC,CAAA;gBACF,4BAA4B,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YAC7E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAA;YAC5D,CAAC;;;;CACF"}
@@ -1,5 +1,6 @@
1
1
  export * from './AcApContext';
2
2
  export * from './AcApDocument';
3
3
  export * from './AcApDocManager';
4
+ export * from './AcApGlobalFunc';
4
5
  export * from './AcApSettingManager';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA"}
package/lib/app/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './AcApContext';
2
2
  export * from './AcApDocument';
3
3
  export * from './AcApDocManager';
4
+ export * from './AcApGlobalFunc';
4
5
  export * from './AcApSettingManager';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/cad-simple-viewer",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -37,15 +37,16 @@
37
37
  "@types/lodash-es": "^4.17.12",
38
38
  "@types/rbush": "^3.0.4",
39
39
  "@types/three": "^0.172.0",
40
- "@mlightcad/svg-renderer": "0.0.12",
41
- "@mlightcad/three-renderer": "1.0.12"
40
+ "@mlightcad/three-renderer": "1.0.13",
41
+ "@mlightcad/svg-renderer": "0.0.13"
42
42
  },
43
43
  "dependencies": {
44
+ "@mlightcad/libredwg-converter": "3.0.6",
44
45
  "mitt": "^3.0.1",
45
46
  "rbush": "^4.0.1"
46
47
  },
47
48
  "peerDependencies": {
48
- "@mlightcad/data-model": "1.2.3",
49
+ "@mlightcad/data-model": "1.2.5",
49
50
  "three": "^0.172.0",
50
51
  "lodash-es": "4.17.21"
51
52
  },