@mlightcad/cad-simple-viewer 1.5.1 → 1.5.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.
Files changed (178) hide show
  1. package/README.md +2 -1
  2. package/dist/index.js +22465 -22159
  3. package/dist/index.umd.cjs +585 -604
  4. package/dist/mtext-renderer-worker.js +1877 -1878
  5. package/lib/app/AcApDocManager.d.ts +13 -3
  6. package/lib/app/AcApDocManager.d.ts.map +1 -1
  7. package/lib/app/AcApDocManager.js +63 -29
  8. package/lib/app/AcApDocManager.js.map +1 -1
  9. package/lib/app/index.d.ts +1 -0
  10. package/lib/app/index.d.ts.map +1 -1
  11. package/lib/app/index.js +1 -0
  12. package/lib/app/index.js.map +1 -1
  13. package/lib/app/openFileProgress.d.ts +10 -0
  14. package/lib/app/openFileProgress.d.ts.map +1 -0
  15. package/lib/app/openFileProgress.js +20 -0
  16. package/lib/app/openFileProgress.js.map +1 -0
  17. package/lib/command/AcApSwitchBgCmd.d.ts +3 -0
  18. package/lib/command/AcApSwitchBgCmd.d.ts.map +1 -1
  19. package/lib/command/AcApSwitchBgCmd.js +14 -7
  20. package/lib/command/AcApSwitchBgCmd.js.map +1 -1
  21. package/lib/command/AcApZoomCmd.d.ts.map +1 -1
  22. package/lib/command/AcApZoomCmd.js.map +1 -1
  23. package/lib/command/convert/index.d.ts +0 -4
  24. package/lib/command/convert/index.d.ts.map +1 -1
  25. package/lib/command/convert/index.js +0 -4
  26. package/lib/command/convert/index.js.map +1 -1
  27. package/lib/command/draw/AcApArcCmd.d.ts.map +1 -1
  28. package/lib/command/draw/AcApArcCmd.js +2 -1
  29. package/lib/command/draw/AcApArcCmd.js.map +1 -1
  30. package/lib/command/draw/AcApCircleCmd.d.ts.map +1 -1
  31. package/lib/command/draw/AcApCircleCmd.js.map +1 -1
  32. package/lib/command/draw/AcApEllipseCmd.d.ts.map +1 -1
  33. package/lib/command/draw/AcApEllipseCmd.js.map +1 -1
  34. package/lib/command/draw/AcApPolylineCmd.d.ts.map +1 -1
  35. package/lib/command/draw/AcApPolylineCmd.js.map +1 -1
  36. package/lib/command/draw/AcApRayCmd.d.ts.map +1 -1
  37. package/lib/command/draw/AcApRayCmd.js.map +1 -1
  38. package/lib/command/draw/AcApRectCmd.d.ts.map +1 -1
  39. package/lib/command/draw/AcApRectCmd.js +2 -1
  40. package/lib/command/draw/AcApRectCmd.js.map +1 -1
  41. package/lib/command/draw/AcApXLineCmd.d.ts.map +1 -1
  42. package/lib/command/draw/AcApXLineCmd.js.map +1 -1
  43. package/lib/command/modify/AcApOffsetCmd.d.ts.map +1 -1
  44. package/lib/command/modify/AcApOffsetCmd.js +2 -1
  45. package/lib/command/modify/AcApOffsetCmd.js.map +1 -1
  46. package/lib/editor/global/AcEdUiColor.d.ts +183 -0
  47. package/lib/editor/global/AcEdUiColor.d.ts.map +1 -0
  48. package/lib/editor/global/AcEdUiColor.js +224 -0
  49. package/lib/editor/global/AcEdUiColor.js.map +1 -0
  50. package/lib/editor/global/AcEdUiTheme.d.ts +0 -1
  51. package/lib/editor/global/AcEdUiTheme.d.ts.map +1 -1
  52. package/lib/editor/global/AcEdUiTheme.js +0 -5
  53. package/lib/editor/global/AcEdUiTheme.js.map +1 -1
  54. package/lib/editor/global/eventBus.d.ts +3 -0
  55. package/lib/editor/global/eventBus.d.ts.map +1 -1
  56. package/lib/editor/global/eventBus.js.map +1 -1
  57. package/lib/editor/global/index.d.ts +1 -0
  58. package/lib/editor/global/index.d.ts.map +1 -1
  59. package/lib/editor/global/index.js +1 -0
  60. package/lib/editor/global/index.js.map +1 -1
  61. package/lib/editor/input/AcEdCursorManager.d.ts +4 -0
  62. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
  63. package/lib/editor/input/AcEdCursorManager.js +11 -8
  64. package/lib/editor/input/AcEdCursorManager.js.map +1 -1
  65. package/lib/editor/input/AcEdOrthoMode.d.ts +11 -0
  66. package/lib/editor/input/AcEdOrthoMode.d.ts.map +1 -0
  67. package/lib/editor/input/AcEdOrthoMode.js +22 -0
  68. package/lib/editor/input/AcEdOrthoMode.js.map +1 -0
  69. package/lib/editor/input/AcEdPolarTracking.d.ts +107 -0
  70. package/lib/editor/input/AcEdPolarTracking.d.ts.map +1 -0
  71. package/lib/editor/input/AcEdPolarTracking.js +398 -0
  72. package/lib/editor/input/AcEdPolarTracking.js.map +1 -0
  73. package/lib/editor/input/AcEditor.d.ts +4 -0
  74. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  75. package/lib/editor/input/AcEditor.js +6 -0
  76. package/lib/editor/input/AcEditor.js.map +1 -1
  77. package/lib/editor/input/index.d.ts +2 -0
  78. package/lib/editor/input/index.d.ts.map +1 -1
  79. package/lib/editor/input/index.js +2 -0
  80. package/lib/editor/input/index.js.map +1 -1
  81. package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -1
  82. package/lib/editor/input/marker/AcEdMarker.js +3 -2
  83. package/lib/editor/input/marker/AcEdMarker.js.map +1 -1
  84. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts +4 -0
  85. package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts.map +1 -1
  86. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js +11 -0
  87. package/lib/editor/input/marker/AcEdOSnapMarkerManager.js.map +1 -1
  88. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  89. package/lib/editor/input/ui/AcEdCommandLine.js +1 -1
  90. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  91. package/lib/editor/input/ui/AcEdFloatingInput.d.ts +4 -0
  92. package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
  93. package/lib/editor/input/ui/AcEdFloatingInput.js +27 -0
  94. package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
  95. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +5 -0
  96. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
  97. package/lib/editor/input/ui/AcEdFloatingMessage.js +1 -1
  98. package/lib/editor/input/ui/AcEdFloatingMessage.js.map +1 -1
  99. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
  100. package/lib/editor/input/ui/AcEdInputManager.js +47 -26
  101. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
  102. package/lib/editor/input/ui/AcEdMTextEditor.d.ts.map +1 -1
  103. package/lib/editor/input/ui/AcEdMTextEditor.js +3 -2
  104. package/lib/editor/input/ui/AcEdMTextEditor.js.map +1 -1
  105. package/lib/editor/input/ui/AcEdRubberBand.d.ts +8 -0
  106. package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -1
  107. package/lib/editor/input/ui/AcEdRubberBand.js +46 -29
  108. package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
  109. package/lib/i18n/en/command.d.ts +7 -1
  110. package/lib/i18n/en/command.d.ts.map +1 -1
  111. package/lib/i18n/en/command.js +7 -1
  112. package/lib/i18n/en/command.js.map +1 -1
  113. package/lib/i18n/zh/command.d.ts +7 -1
  114. package/lib/i18n/zh/command.d.ts.map +1 -1
  115. package/lib/i18n/zh/command.js +7 -1
  116. package/lib/i18n/zh/command.js.map +1 -1
  117. package/lib/plugin/AcApLazyPluginRegistration.d.ts +28 -0
  118. package/lib/plugin/AcApLazyPluginRegistration.d.ts.map +1 -0
  119. package/lib/plugin/AcApLazyPluginRegistration.js +2 -0
  120. package/lib/plugin/AcApLazyPluginRegistration.js.map +1 -0
  121. package/lib/plugin/AcApPluginManager.d.ts +38 -0
  122. package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
  123. package/lib/plugin/AcApPluginManager.js +147 -22
  124. package/lib/plugin/AcApPluginManager.js.map +1 -1
  125. package/lib/plugin/index.d.ts +1 -0
  126. package/lib/plugin/index.d.ts.map +1 -1
  127. package/lib/plugin/index.js +1 -0
  128. package/lib/plugin/index.js.map +1 -1
  129. package/lib/util/AcApExportFileNameUtil.d.ts +22 -0
  130. package/lib/util/AcApExportFileNameUtil.d.ts.map +1 -0
  131. package/lib/util/AcApExportFileNameUtil.js +49 -0
  132. package/lib/util/AcApExportFileNameUtil.js.map +1 -0
  133. package/lib/util/AcApFontUtil.d.ts +10 -0
  134. package/lib/util/AcApFontUtil.d.ts.map +1 -1
  135. package/lib/util/AcApFontUtil.js +12 -0
  136. package/lib/util/AcApFontUtil.js.map +1 -1
  137. package/lib/util/index.d.ts +1 -0
  138. package/lib/util/index.d.ts.map +1 -1
  139. package/lib/util/index.js +1 -0
  140. package/lib/util/index.js.map +1 -1
  141. package/lib/view/AcTrLayoutView.d.ts +1 -1
  142. package/lib/view/AcTrLayoutView.d.ts.map +1 -1
  143. package/lib/view/AcTrLayoutView.js +2 -1
  144. package/lib/view/AcTrLayoutView.js.map +1 -1
  145. package/lib/view/AcTrLayoutViewManager.d.ts +3 -1
  146. package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -1
  147. package/lib/view/AcTrLayoutViewManager.js +4 -2
  148. package/lib/view/AcTrLayoutViewManager.js.map +1 -1
  149. package/lib/view/AcTrView2d.d.ts +18 -1
  150. package/lib/view/AcTrView2d.d.ts.map +1 -1
  151. package/lib/view/AcTrView2d.js +72 -52
  152. package/lib/view/AcTrView2d.js.map +1 -1
  153. package/lib/view/index.d.ts +1 -0
  154. package/lib/view/index.d.ts.map +1 -1
  155. package/lib/view/index.js +1 -0
  156. package/lib/view/index.js.map +1 -1
  157. package/package.json +9 -12
  158. package/dist/viewer-runtime.iife.js +0 -3879
  159. package/lib/command/convert/AcApConvertToSvgCmd.d.ts +0 -32
  160. package/lib/command/convert/AcApConvertToSvgCmd.d.ts.map +0 -1
  161. package/lib/command/convert/AcApConvertToSvgCmd.js +0 -98
  162. package/lib/command/convert/AcApConvertToSvgCmd.js.map +0 -1
  163. package/lib/command/convert/AcApExportHtmlCmd.d.ts +0 -22
  164. package/lib/command/convert/AcApExportHtmlCmd.d.ts.map +0 -1
  165. package/lib/command/convert/AcApExportHtmlCmd.js +0 -93
  166. package/lib/command/convert/AcApExportHtmlCmd.js.map +0 -1
  167. package/lib/command/convert/AcApHtmlConvertor.d.ts +0 -61
  168. package/lib/command/convert/AcApHtmlConvertor.d.ts.map +0 -1
  169. package/lib/command/convert/AcApHtmlConvertor.js +0 -223
  170. package/lib/command/convert/AcApHtmlConvertor.js.map +0 -1
  171. package/lib/command/convert/AcApHtmlSnapshotBuilder.d.ts +0 -65
  172. package/lib/command/convert/AcApHtmlSnapshotBuilder.d.ts.map +0 -1
  173. package/lib/command/convert/AcApHtmlSnapshotBuilder.js +0 -301
  174. package/lib/command/convert/AcApHtmlSnapshotBuilder.js.map +0 -1
  175. package/lib/command/convert/AcApSvgConvertor.d.ts +0 -53
  176. package/lib/command/convert/AcApSvgConvertor.d.ts.map +0 -1
  177. package/lib/command/convert/AcApSvgConvertor.js +0 -103
  178. package/lib/command/convert/AcApSvgConvertor.js.map +0 -1
@@ -1,301 +0,0 @@
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
- var __values = (this && this.__values) || function(o) {
38
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
39
- if (m) return m.call(o);
40
- if (o && typeof o.length === "number") return {
41
- next: function () {
42
- if (o && i >= o.length) o = void 0;
43
- return { value: o && o[i++], done: !o };
44
- }
45
- };
46
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
47
- };
48
- var __read = (this && this.__read) || function (o, n) {
49
- var m = typeof Symbol === "function" && o[Symbol.iterator];
50
- if (!m) return o;
51
- var i = m.call(o), r, ar = [], e;
52
- try {
53
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
54
- }
55
- catch (error) { e = { error: error }; }
56
- finally {
57
- try {
58
- if (r && !r.done && (m = i["return"])) m.call(i);
59
- }
60
- finally { if (e) throw e.error; }
61
- }
62
- return ar;
63
- };
64
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
65
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
66
- if (ar || !(i in from)) {
67
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
68
- ar[i] = from[i];
69
- }
70
- }
71
- return to.concat(ar || Array.prototype.slice.call(from));
72
- };
73
- import { ACEX_SNAPSHOT_VERSION, buildOsnapCatalog, buildViewerMetadata, collectBatchesFromObject3D } from '@mlightcad/cad-html-exporter';
74
- import { AcApI18n } from '../../i18n';
75
- import { yieldToMain } from '../../util';
76
- /**
77
- * Serializes the live Three.js scene into a versioned {@link AcExSnapshotV1}.
78
- *
79
- * The snapshot contains layer visibility, per-layout line/mesh batches, and
80
- * viewer metadata (extents, units, background). It is display-only: no DXF/DWG
81
- * entities or edit capability are preserved.
82
- */
83
- var AcApHtmlSnapshotBuilder = /** @class */ (function () {
84
- function AcApHtmlSnapshotBuilder() {
85
- }
86
- /**
87
- * Builds a snapshot synchronously in one pass.
88
- *
89
- * Prefer {@link buildAsync} for interactive export so the UI can stay responsive.
90
- *
91
- * @param scene - Current renderer scene (layouts, layers, active layout).
92
- * @param database - Open drawing database used for layout names and metadata.
93
- * @param options - Optional title, background, and locale overrides.
94
- * @returns A complete v1 snapshot ready for `packHtml`.
95
- */
96
- AcApHtmlSnapshotBuilder.prototype.build = function (scene, database, options) {
97
- if (options === void 0) { options = {}; }
98
- return this.buildSync(scene, database, options);
99
- };
100
- /**
101
- * Builds a snapshot incrementally, yielding to the main thread between layouts.
102
- *
103
- * Geometry is collected per layout layer so a busy indicator can repaint
104
- * during large drawings.
105
- *
106
- * @param scene - Current renderer scene (layouts, layers, active layout).
107
- * @param database - Open drawing database used for layout names and metadata.
108
- * @param options - Optional title, background, and locale overrides.
109
- * @returns A complete v1 snapshot ready for `packHtml`.
110
- */
111
- AcApHtmlSnapshotBuilder.prototype.buildAsync = function (scene_1, database_1) {
112
- return __awaiter(this, arguments, void 0, function (scene, database, options) {
113
- var meta, layers, layouts, _a, _b, _c, btrId, layout, lineBatches, meshBatches, _d, _e, _f, layer, collected, e_1_1, e_2_1;
114
- var e_2, _g, e_1, _h;
115
- if (options === void 0) { options = {}; }
116
- return __generator(this, function (_j) {
117
- switch (_j.label) {
118
- case 0: return [4 /*yield*/, yieldToMain()];
119
- case 1:
120
- _j.sent();
121
- meta = buildViewerMetadata(database, {
122
- title: options.title,
123
- background: options.background
124
- });
125
- layers = [];
126
- scene.layers.forEach(function (layer) {
127
- var _a;
128
- layers.push({
129
- name: layer.name,
130
- color: (_a = layer.color.RGB) !== null && _a !== void 0 ? _a : 0xffffff,
131
- visible: !layer.isOff && !layer.isFrozen
132
- });
133
- });
134
- layouts = [];
135
- _j.label = 2;
136
- case 2:
137
- _j.trys.push([2, 15, 16, 17]);
138
- _a = __values(scene.layouts), _b = _a.next();
139
- _j.label = 3;
140
- case 3:
141
- if (!!_b.done) return [3 /*break*/, 14];
142
- _c = __read(_b.value, 2), btrId = _c[0], layout = _c[1];
143
- lineBatches = [];
144
- meshBatches = [];
145
- _j.label = 4;
146
- case 4:
147
- _j.trys.push([4, 9, 10, 11]);
148
- _d = (e_1 = void 0, __values(layout.layers)), _e = _d.next();
149
- _j.label = 5;
150
- case 5:
151
- if (!!_e.done) return [3 /*break*/, 8];
152
- _f = __read(_e.value, 2), layer = _f[1];
153
- collected = collectBatchesFromObject3D(layer.internalObject);
154
- lineBatches.push.apply(lineBatches, __spreadArray([], __read(collected.lineBatches), false));
155
- meshBatches.push.apply(meshBatches, __spreadArray([], __read(collected.meshBatches), false));
156
- return [4 /*yield*/, yieldToMain()];
157
- case 6:
158
- _j.sent();
159
- _j.label = 7;
160
- case 7:
161
- _e = _d.next();
162
- return [3 /*break*/, 5];
163
- case 8: return [3 /*break*/, 11];
164
- case 9:
165
- e_1_1 = _j.sent();
166
- e_1 = { error: e_1_1 };
167
- return [3 /*break*/, 11];
168
- case 10:
169
- try {
170
- if (_e && !_e.done && (_h = _d.return)) _h.call(_d);
171
- }
172
- finally { if (e_1) throw e_1.error; }
173
- return [7 /*endfinally*/];
174
- case 11:
175
- layouts.push({
176
- btrId: btrId,
177
- name: resolveLayoutName(database, btrId),
178
- isModelSpace: btrId === scene.modelSpaceBtrId,
179
- lineBatches: lineBatches,
180
- meshBatches: meshBatches,
181
- osnap: buildOsnapCatalog(database, btrId)
182
- });
183
- return [4 /*yield*/, yieldToMain()];
184
- case 12:
185
- _j.sent();
186
- _j.label = 13;
187
- case 13:
188
- _b = _a.next();
189
- return [3 /*break*/, 3];
190
- case 14: return [3 /*break*/, 17];
191
- case 15:
192
- e_2_1 = _j.sent();
193
- e_2 = { error: e_2_1 };
194
- return [3 /*break*/, 17];
195
- case 16:
196
- try {
197
- if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
198
- }
199
- finally { if (e_2) throw e_2.error; }
200
- return [7 /*endfinally*/];
201
- case 17: return [2 /*return*/, {
202
- version: ACEX_SNAPSHOT_VERSION,
203
- meta: buildSnapshotMeta(meta, options),
204
- layers: layers,
205
- layouts: layouts,
206
- activeLayoutBtrId: scene.activeLayoutBtrId || scene.modelSpaceBtrId
207
- }];
208
- }
209
- });
210
- });
211
- };
212
- /**
213
- * Synchronous implementation shared by {@link build} and {@link buildAsync}.
214
- *
215
- * @param scene - Current renderer scene.
216
- * @param database - Open drawing database.
217
- * @param options - Snapshot overrides.
218
- * @returns A complete v1 snapshot.
219
- */
220
- AcApHtmlSnapshotBuilder.prototype.buildSync = function (scene, database, options) {
221
- var meta = buildViewerMetadata(database, {
222
- title: options.title,
223
- background: options.background
224
- });
225
- var layers = [];
226
- scene.layers.forEach(function (layer) {
227
- var _a;
228
- layers.push({
229
- name: layer.name,
230
- color: (_a = layer.color.RGB) !== null && _a !== void 0 ? _a : 0xffffff,
231
- visible: !layer.isOff && !layer.isFrozen
232
- });
233
- });
234
- var layouts = [];
235
- scene.layouts.forEach(function (layout, btrId) {
236
- var _a = collectBatchesFromObject3D(layout.internalObject), lineBatches = _a.lineBatches, meshBatches = _a.meshBatches;
237
- layouts.push({
238
- btrId: btrId,
239
- name: resolveLayoutName(database, btrId),
240
- isModelSpace: btrId === scene.modelSpaceBtrId,
241
- lineBatches: lineBatches,
242
- meshBatches: meshBatches,
243
- osnap: buildOsnapCatalog(database, btrId)
244
- });
245
- });
246
- return {
247
- version: ACEX_SNAPSHOT_VERSION,
248
- meta: buildSnapshotMeta(meta, options),
249
- layers: layers,
250
- layouts: layouts,
251
- activeLayoutBtrId: scene.activeLayoutBtrId || scene.modelSpaceBtrId
252
- };
253
- };
254
- return AcApHtmlSnapshotBuilder;
255
- }());
256
- export { AcApHtmlSnapshotBuilder };
257
- /**
258
- * Merges database-derived viewer metadata with export-time options.
259
- *
260
- * @param meta - Extents, units, and background from {@link buildViewerMetadata}.
261
- * @param options - User overrides (title is taken from `meta`; locale from options).
262
- * @returns The `meta` block stored on {@link AcExSnapshotV1}.
263
- */
264
- function buildSnapshotMeta(meta, options) {
265
- var _a;
266
- return {
267
- title: meta.title,
268
- createdAt: new Date().toISOString(),
269
- extents: meta.extents,
270
- units: meta.units,
271
- background: meta.background,
272
- locale: (_a = options.locale) !== null && _a !== void 0 ? _a : AcApI18n.currentLocale
273
- };
274
- }
275
- /**
276
- * Resolves a block table record object id to its layout/block name.
277
- *
278
- * @param database - Drawing whose block table is searched.
279
- * @param btrId - Object id of the layout's owning block table record.
280
- * @returns The record name, or `btrId` if no matching block is found.
281
- */
282
- function resolveLayoutName(database, btrId) {
283
- var e_3, _a;
284
- try {
285
- for (var _b = __values(database.tables.blockTable.newIterator()), _c = _b.next(); !_c.done; _c = _b.next()) {
286
- var block = _c.value;
287
- if (block.objectId === btrId) {
288
- return block.name;
289
- }
290
- }
291
- }
292
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
293
- finally {
294
- try {
295
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
296
- }
297
- finally { if (e_3) throw e_3.error; }
298
- }
299
- return btrId;
300
- }
301
- //# sourceMappingURL=AcApHtmlSnapshotBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcApHtmlSnapshotBuilder.js","sourceRoot":"","sources":["../../../src/command/convert/AcApHtmlSnapshotBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,qBAAqB,EAMrB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,8BAA8B,CAAA;AAGrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAwBxC;;;;;;GAMG;AACH;IAAA;IAmIA,CAAC;IAlIC;;;;;;;;;OASG;IACH,uCAAK,GAAL,UACE,KAAgB,EAChB,QAAsB,EACtB,OAA4C;QAA5C,wBAAA,EAAA,YAA4C;QAE5C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED;;;;;;;;;;OAUG;IACG,4CAAU,GAAhB;4DACE,KAAgB,EAChB,QAAsB,EACtB,OAA4C;;;YAA5C,wBAAA,EAAA,YAA4C;;;4BAE5C,qBAAM,WAAW,EAAE,EAAA;;wBAAnB,SAAmB,CAAA;wBAEb,IAAI,GAAG,mBAAmB,CAAC,QAAQ,EAAE;4BACzC,KAAK,EAAE,OAAO,CAAC,KAAK;4BACpB,UAAU,EAAE,OAAO,CAAC,UAAU;yBAC/B,CAAC,CAAA;wBAEI,MAAM,GAAwB,EAAE,CAAA;wBACtC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,UAAA,KAAK;;4BACxB,MAAM,CAAC,IAAI,CAAC;gCACV,IAAI,EAAE,KAAK,CAAC,IAAI;gCAChB,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,CAAC,GAAG,mCAA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,OAAO,SAAA;YACP,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,eAAe;SACpE,CAAA;IACH,CAAC;IACH,8BAAC;AAAD,CAAC,AAnID,IAmIC;;AAED;;;;;;GAMG;AACH,SAAS,iBAAiB,CACxB,IAA4C,EAC5C,OAAuC;;IAEvC,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,QAAQ,CAAC,aAAa;KACjD,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,QAAsB,EAAE,KAAa;;;QAC9D,KAAoB,IAAA,KAAA,SAAA,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA,gBAAA,4BAAE,CAAC;YAA1D,IAAM,KAAK,WAAA;YACd,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;gBAC7B,OAAO,KAAK,CAAC,IAAI,CAAA;YACnB,CAAC;QACH,CAAC;;;;;;;;;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -1,53 +0,0 @@
1
- /**
2
- * Utility class for converting CAD drawings to SVG format.
3
- *
4
- * This class provides functionality to export the current CAD drawing
5
- * to SVG format and download it as a file. It iterates through all
6
- * entities in the model space and renders them using the SVG renderer.
7
- *
8
- * The conversion process:
9
- * 1. Gets all entities from the current document's model space
10
- * 2. Uses the SVG renderer to convert each entity to SVG markup
11
- * 3. Exports the complete SVG content
12
- * 4. Creates a downloadable file for the user
13
- *
14
- * @example
15
- * ```typescript
16
- * const converter = new AcApSvgConvertor();
17
- *
18
- * // Convert and download current drawing as SVG
19
- * converter.convert();
20
- * ```
21
- */
22
- export declare class AcApSvgConvertor {
23
- /**
24
- * Converts the current CAD drawing to SVG format and initiates download.
25
- *
26
- * This method:
27
- * - Retrieves all entities from the current document's model space
28
- * - Renders each entity using the SVG renderer
29
- * - Exports the complete SVG markup
30
- * - Automatically downloads the SVG file as 'example.svg'
31
- *
32
- * @example
33
- * ```typescript
34
- * const converter = new AcApSvgConvertor();
35
- * converter.convert(); // Downloads the drawing as SVG
36
- * ```
37
- */
38
- convert(): void;
39
- /**
40
- * Creates a downloadable SVG file and triggers the download.
41
- *
42
- * This method:
43
- * - Creates a Blob from the SVG content with proper MIME type
44
- * - Generates a temporary download URL
45
- * - Creates and triggers a download link
46
- * - Cleans up the temporary elements
47
- *
48
- * @param svgContent - The SVG markup content to download
49
- * @private
50
- */
51
- private createFileAndDownloadIt;
52
- }
53
- //# sourceMappingURL=AcApSvgConvertor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcApSvgConvertor.d.ts","sourceRoot":"","sources":["../../../src/command/convert/AcApSvgConvertor.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;OAcG;IACH,OAAO;IAUP;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,uBAAuB;CAoBhC"}
@@ -1,103 +0,0 @@
1
- var __values = (this && this.__values) || function(o) {
2
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
- if (m) return m.call(o);
4
- if (o && typeof o.length === "number") return {
5
- next: function () {
6
- if (o && i >= o.length) o = void 0;
7
- return { value: o && o[i++], done: !o };
8
- }
9
- };
10
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
- };
12
- import { AcSvgRenderer } from '@mlightcad/svg-renderer';
13
- import { AcApDocManager } from '../../app';
14
- /**
15
- * Utility class for converting CAD drawings to SVG format.
16
- *
17
- * This class provides functionality to export the current CAD drawing
18
- * to SVG format and download it as a file. It iterates through all
19
- * entities in the model space and renders them using the SVG renderer.
20
- *
21
- * The conversion process:
22
- * 1. Gets all entities from the current document's model space
23
- * 2. Uses the SVG renderer to convert each entity to SVG markup
24
- * 3. Exports the complete SVG content
25
- * 4. Creates a downloadable file for the user
26
- *
27
- * @example
28
- * ```typescript
29
- * const converter = new AcApSvgConvertor();
30
- *
31
- * // Convert and download current drawing as SVG
32
- * converter.convert();
33
- * ```
34
- */
35
- var AcApSvgConvertor = /** @class */ (function () {
36
- function AcApSvgConvertor() {
37
- }
38
- /**
39
- * Converts the current CAD drawing to SVG format and initiates download.
40
- *
41
- * This method:
42
- * - Retrieves all entities from the current document's model space
43
- * - Renders each entity using the SVG renderer
44
- * - Exports the complete SVG markup
45
- * - Automatically downloads the SVG file as 'example.svg'
46
- *
47
- * @example
48
- * ```typescript
49
- * const converter = new AcApSvgConvertor();
50
- * converter.convert(); // Downloads the drawing as SVG
51
- * ```
52
- */
53
- AcApSvgConvertor.prototype.convert = function () {
54
- var e_1, _a;
55
- var entities = AcApDocManager.instance.curDocument.database.tables.blockTable.modelSpace.newIterator();
56
- var renderer = new AcSvgRenderer();
57
- try {
58
- for (var entities_1 = __values(entities), entities_1_1 = entities_1.next(); !entities_1_1.done; entities_1_1 = entities_1.next()) {
59
- var entity = entities_1_1.value;
60
- entity.worldDraw(renderer);
61
- }
62
- }
63
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
64
- finally {
65
- try {
66
- if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
67
- }
68
- finally { if (e_1) throw e_1.error; }
69
- }
70
- this.createFileAndDownloadIt(renderer.export());
71
- };
72
- /**
73
- * Creates a downloadable SVG file and triggers the download.
74
- *
75
- * This method:
76
- * - Creates a Blob from the SVG content with proper MIME type
77
- * - Generates a temporary download URL
78
- * - Creates and triggers a download link
79
- * - Cleans up the temporary elements
80
- *
81
- * @param svgContent - The SVG markup content to download
82
- * @private
83
- */
84
- AcApSvgConvertor.prototype.createFileAndDownloadIt = function (svgContent) {
85
- // Convert the SVG content into a Blob
86
- var svgBlob = new Blob([svgContent], {
87
- type: 'image/svg+xml;charset=utf-8'
88
- });
89
- // Create a URL for the Blob
90
- var url = URL.createObjectURL(svgBlob);
91
- // Create a download link and trigger the download
92
- var downloadLink = document.createElement('a');
93
- downloadLink.href = url;
94
- downloadLink.download = 'example.svg';
95
- // Append the link to the body (it needs to be in the DOM to work in some browsers)
96
- document.body.appendChild(downloadLink);
97
- // Trigger the download
98
- downloadLink.click();
99
- };
100
- return AcApSvgConvertor;
101
- }());
102
- export { AcApSvgConvertor };
103
- //# sourceMappingURL=AcApSvgConvertor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AcApSvgConvertor.js","sourceRoot":"","sources":["../../../src/command/convert/AcApSvgConvertor.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAAA;IA0DA,CAAC;IAzDC;;;;;;;;;;;;;;OAcG;IACH,kCAAO,GAAP;;QACE,IAAM,QAAQ,GACZ,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA;QACzF,IAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAA;;YACpC,KAAqB,IAAA,aAAA,SAAA,QAAQ,CAAA,kCAAA,wDAAE,CAAC;gBAA3B,IAAM,MAAM,qBAAA;gBACf,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;YAC5B,CAAC;;;;;;;;;QACD,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IACjD,CAAC;IAED;;;;;;;;;;;OAWG;IACK,kDAAuB,GAA/B,UAAgC,UAAkB;QAChD,sCA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