@mlightcad/cad-simple-viewer 1.4.7 → 1.4.8

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 (177) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +88 -88
  3. package/dist/index.js +6014 -5042
  4. package/dist/index.umd.cjs +22 -22
  5. package/lib/app/AcApAnnotation.d.ts +46 -0
  6. package/lib/app/AcApAnnotation.d.ts.map +1 -0
  7. package/lib/app/AcApAnnotation.js +134 -0
  8. package/lib/app/AcApAnnotation.js.map +1 -0
  9. package/lib/app/AcApDocManager.d.ts +118 -6
  10. package/lib/app/AcApDocManager.d.ts.map +1 -1
  11. package/lib/app/AcApDocManager.js +162 -6
  12. package/lib/app/AcApDocManager.js.map +1 -1
  13. package/lib/app/AcApDocument.d.ts +16 -14
  14. package/lib/app/AcApDocument.d.ts.map +1 -1
  15. package/lib/app/AcApDocument.js +48 -31
  16. package/lib/app/AcApDocument.js.map +1 -1
  17. package/lib/app/AcDbOpenDatabaseOptions.d.ts +28 -0
  18. package/lib/app/AcDbOpenDatabaseOptions.d.ts.map +1 -0
  19. package/lib/app/AcDbOpenDatabaseOptions.js +2 -0
  20. package/lib/app/AcDbOpenDatabaseOptions.js.map +1 -0
  21. package/lib/app/index.d.ts +2 -0
  22. package/lib/app/index.d.ts.map +1 -1
  23. package/lib/app/index.js +2 -0
  24. package/lib/app/index.js.map +1 -1
  25. package/lib/command/AcApBaseRevCmd.d.ts +36 -0
  26. package/lib/command/AcApBaseRevCmd.d.ts.map +1 -0
  27. package/lib/command/AcApBaseRevCmd.js +68 -0
  28. package/lib/command/AcApBaseRevCmd.js.map +1 -0
  29. package/lib/command/AcApCircleCmd.d.ts +1 -0
  30. package/lib/command/AcApCircleCmd.d.ts.map +1 -1
  31. package/lib/command/AcApCircleCmd.js +4 -2
  32. package/lib/command/AcApCircleCmd.js.map +1 -1
  33. package/lib/command/AcApConvertToSvgCmd.d.ts +1 -1
  34. package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -1
  35. package/lib/command/AcApConvertToSvgCmd.js +44 -2
  36. package/lib/command/AcApConvertToSvgCmd.js.map +1 -1
  37. package/lib/command/AcApDimLinearCmd.d.ts +1 -0
  38. package/lib/command/AcApDimLinearCmd.d.ts.map +1 -1
  39. package/lib/command/AcApDimLinearCmd.js +4 -2
  40. package/lib/command/AcApDimLinearCmd.js.map +1 -1
  41. package/lib/command/AcApEraseCmd.d.ts +1 -0
  42. package/lib/command/AcApEraseCmd.d.ts.map +1 -1
  43. package/lib/command/AcApEraseCmd.js +14 -4
  44. package/lib/command/AcApEraseCmd.js.map +1 -1
  45. package/lib/command/AcApLineCmd.d.ts +1 -0
  46. package/lib/command/AcApLineCmd.d.ts.map +1 -1
  47. package/lib/command/AcApLineCmd.js +4 -2
  48. package/lib/command/AcApLineCmd.js.map +1 -1
  49. package/lib/command/AcApLogCmd.d.ts +1 -1
  50. package/lib/command/AcApLogCmd.d.ts.map +1 -1
  51. package/lib/command/AcApLogCmd.js +44 -3
  52. package/lib/command/AcApLogCmd.js.map +1 -1
  53. package/lib/command/AcApOpenCmd.d.ts +1 -1
  54. package/lib/command/AcApOpenCmd.d.ts.map +1 -1
  55. package/lib/command/AcApOpenCmd.js +42 -1
  56. package/lib/command/AcApOpenCmd.js.map +1 -1
  57. package/lib/command/AcApPanCmd.d.ts +1 -1
  58. package/lib/command/AcApPanCmd.d.ts.map +1 -1
  59. package/lib/command/AcApPanCmd.js +43 -2
  60. package/lib/command/AcApPanCmd.js.map +1 -1
  61. package/lib/command/AcApQNewCmd.d.ts +1 -1
  62. package/lib/command/AcApQNewCmd.d.ts.map +1 -1
  63. package/lib/command/AcApQNewCmd.js +44 -2
  64. package/lib/command/AcApQNewCmd.js.map +1 -1
  65. package/lib/command/AcApRectCmd.d.ts +23 -0
  66. package/lib/command/AcApRectCmd.d.ts.map +1 -0
  67. package/lib/command/AcApRectCmd.js +134 -0
  68. package/lib/command/AcApRectCmd.js.map +1 -0
  69. package/lib/command/AcApRegenCmd.d.ts +1 -1
  70. package/lib/command/AcApRegenCmd.d.ts.map +1 -1
  71. package/lib/command/AcApRegenCmd.js +42 -1
  72. package/lib/command/AcApRegenCmd.js.map +1 -1
  73. package/lib/command/AcApRevCircleCmd.d.ts +10 -0
  74. package/lib/command/AcApRevCircleCmd.d.ts.map +1 -0
  75. package/lib/command/AcApRevCircleCmd.js +83 -0
  76. package/lib/command/AcApRevCircleCmd.js.map +1 -0
  77. package/lib/command/AcApRevCloudCmd.d.ts +26 -0
  78. package/lib/command/AcApRevCloudCmd.d.ts.map +1 -0
  79. package/lib/command/AcApRevCloudCmd.js +234 -0
  80. package/lib/command/AcApRevCloudCmd.js.map +1 -0
  81. package/lib/command/AcApRevRectCmd.d.ts +10 -0
  82. package/lib/command/AcApRevRectCmd.d.ts.map +1 -0
  83. package/lib/command/AcApRevRectCmd.js +83 -0
  84. package/lib/command/AcApRevRectCmd.js.map +1 -0
  85. package/lib/command/AcApRevVisibilityCmd.d.ts +15 -0
  86. package/lib/command/AcApRevVisibilityCmd.d.ts.map +1 -0
  87. package/lib/command/AcApRevVisibilityCmd.js +90 -0
  88. package/lib/command/AcApRevVisibilityCmd.js.map +1 -0
  89. package/lib/command/AcApSelectCmd.d.ts +1 -1
  90. package/lib/command/AcApSelectCmd.d.ts.map +1 -1
  91. package/lib/command/AcApSelectCmd.js +43 -2
  92. package/lib/command/AcApSelectCmd.js.map +1 -1
  93. package/lib/command/AcApSketchCmd.d.ts +32 -0
  94. package/lib/command/AcApSketchCmd.d.ts.map +1 -0
  95. package/lib/command/AcApSketchCmd.js +171 -0
  96. package/lib/command/AcApSketchCmd.js.map +1 -0
  97. package/lib/command/AcApSwitchBgCmd.d.ts +15 -0
  98. package/lib/command/AcApSwitchBgCmd.d.ts.map +1 -0
  99. package/lib/command/AcApSwitchBgCmd.js +88 -0
  100. package/lib/command/AcApSwitchBgCmd.js.map +1 -0
  101. package/lib/command/AcApSysVarCmd.d.ts +2 -1
  102. package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
  103. package/lib/command/AcApSysVarCmd.js +6 -5
  104. package/lib/command/AcApSysVarCmd.js.map +1 -1
  105. package/lib/command/AcApZoomCmd.d.ts +1 -1
  106. package/lib/command/AcApZoomCmd.d.ts.map +1 -1
  107. package/lib/command/AcApZoomCmd.js +42 -1
  108. package/lib/command/AcApZoomCmd.js.map +1 -1
  109. package/lib/command/index.d.ts +8 -0
  110. package/lib/command/index.d.ts.map +1 -1
  111. package/lib/command/index.js +8 -0
  112. package/lib/command/index.js.map +1 -1
  113. package/lib/editor/command/AcEdCommand.d.ts +81 -22
  114. package/lib/editor/command/AcEdCommand.d.ts.map +1 -1
  115. package/lib/editor/command/AcEdCommand.js +157 -15
  116. package/lib/editor/command/AcEdCommand.js.map +1 -1
  117. package/lib/editor/command/AcEdCommandIterator.d.ts +1 -1
  118. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -1
  119. package/lib/editor/command/AcEdCommandStack.d.ts +31 -6
  120. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
  121. package/lib/editor/command/AcEdCommandStack.js +55 -11
  122. package/lib/editor/command/AcEdCommandStack.js.map +1 -1
  123. package/lib/editor/input/AcEditor.d.ts +14 -0
  124. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  125. package/lib/editor/input/AcEditor.js +5 -1
  126. package/lib/editor/input/AcEditor.js.map +1 -1
  127. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  128. package/lib/editor/input/ui/AcEdCommandLine.js +2 -2
  129. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  130. package/lib/editor/view/AcEdOpenMode.d.ts +26 -0
  131. package/lib/editor/view/AcEdOpenMode.d.ts.map +1 -0
  132. package/lib/editor/view/AcEdOpenMode.js +27 -0
  133. package/lib/editor/view/AcEdOpenMode.js.map +1 -0
  134. package/lib/editor/view/index.d.ts +2 -0
  135. package/lib/editor/view/index.d.ts.map +1 -1
  136. package/lib/editor/view/index.js +2 -0
  137. package/lib/editor/view/index.js.map +1 -1
  138. package/lib/i18n/en/command.d.ts +18 -0
  139. package/lib/i18n/en/command.d.ts.map +1 -1
  140. package/lib/i18n/en/command.js +19 -1
  141. package/lib/i18n/en/command.js.map +1 -1
  142. package/lib/i18n/en/jig.d.ts +8 -0
  143. package/lib/i18n/en/jig.d.ts.map +1 -1
  144. package/lib/i18n/en/jig.js +8 -0
  145. package/lib/i18n/en/jig.js.map +1 -1
  146. package/lib/i18n/zh/command.d.ts +18 -0
  147. package/lib/i18n/zh/command.d.ts.map +1 -1
  148. package/lib/i18n/zh/command.js +18 -0
  149. package/lib/i18n/zh/command.js.map +1 -1
  150. package/lib/i18n/zh/jig.d.ts +8 -0
  151. package/lib/i18n/zh/jig.d.ts.map +1 -1
  152. package/lib/i18n/zh/jig.js +8 -0
  153. package/lib/i18n/zh/jig.js.map +1 -1
  154. package/lib/index.d.ts +1 -0
  155. package/lib/index.d.ts.map +1 -1
  156. package/lib/index.js +1 -0
  157. package/lib/index.js.map +1 -1
  158. package/lib/plugin/AcApPlugin.d.ts +83 -0
  159. package/lib/plugin/AcApPlugin.d.ts.map +1 -0
  160. package/lib/plugin/AcApPlugin.js +2 -0
  161. package/lib/plugin/AcApPlugin.js.map +1 -0
  162. package/lib/plugin/AcApPluginExample.d.ts +23 -0
  163. package/lib/plugin/AcApPluginExample.d.ts.map +1 -0
  164. package/lib/plugin/AcApPluginExample.js +160 -0
  165. package/lib/plugin/AcApPluginExample.js.map +1 -0
  166. package/lib/plugin/AcApPluginManager.d.ts +206 -0
  167. package/lib/plugin/AcApPluginManager.d.ts.map +1 -0
  168. package/lib/plugin/AcApPluginManager.js +499 -0
  169. package/lib/plugin/AcApPluginManager.js.map +1 -0
  170. package/lib/plugin/index.d.ts +4 -0
  171. package/lib/plugin/index.d.ts.map +1 -0
  172. package/lib/plugin/index.js +4 -0
  173. package/lib/plugin/index.js.map +1 -0
  174. package/lib/view/AcTrView2d.d.ts.map +1 -1
  175. package/lib/view/AcTrView2d.js +8 -1
  176. package/lib/view/AcTrView2d.js.map +1 -1
  177. package/package.json +5 -5
@@ -0,0 +1,499 @@
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
+ /**
49
+ * Plugin manager for dynamically loading and unloading plugins.
50
+ *
51
+ * This class manages the lifecycle of plugins, including:
52
+ * - Loading plugins and calling their `onLoad` hooks
53
+ * - Unloading plugins and calling their `onUnload` hooks
54
+ * - Providing access to the application context and command manager
55
+ *
56
+ * Plugins are responsible for cleaning up their own registered commands
57
+ * in the `onUnload` hook using `commandManager.removeCmd()`.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const pluginManager = AcApDocManager.instance.pluginManager;
62
+ *
63
+ * // Load a plugin
64
+ * const myPlugin = new MyPlugin();
65
+ * await pluginManager.loadPlugin(myPlugin);
66
+ *
67
+ * // Unload a plugin
68
+ * await pluginManager.unloadPlugin('MyPlugin');
69
+ *
70
+ * // Check if a plugin is loaded
71
+ * if (pluginManager.isPluginLoaded('MyPlugin')) {
72
+ * console.log('Plugin is loaded');
73
+ * }
74
+ *
75
+ * // Get all loaded plugins
76
+ * const loadedPlugins = pluginManager.getLoadedPlugins();
77
+ * ```
78
+ */
79
+ var AcApPluginManager = /** @class */ (function () {
80
+ /**
81
+ * Creates a new plugin manager.
82
+ *
83
+ * @param context - The application context
84
+ * @param commandManager - The command manager for plugin command registration
85
+ */
86
+ function AcApPluginManager(context, commandManager) {
87
+ this._plugins = new Map();
88
+ this._context = context;
89
+ this._commandManager = commandManager;
90
+ }
91
+ /**
92
+ * Loads a plugin and calls its `onLoad` hook.
93
+ *
94
+ * If the plugin is already loaded, this method will throw an error.
95
+ * The plugin's `onLoad` method will be called with the context and command manager.
96
+ *
97
+ * @param plugin - The plugin instance to load
98
+ * @throws {Error} If a plugin with the same name is already loaded
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * const plugin = new MyPlugin();
103
+ * await pluginManager.loadPlugin(plugin);
104
+ * ```
105
+ */
106
+ AcApPluginManager.prototype.loadPlugin = function (plugin) {
107
+ return __awaiter(this, void 0, void 0, function () {
108
+ var pluginName, error_1;
109
+ return __generator(this, function (_a) {
110
+ switch (_a.label) {
111
+ case 0:
112
+ pluginName = plugin.name;
113
+ if (!pluginName) {
114
+ throw new Error('[AcApPluginManager] Plugin name is required');
115
+ }
116
+ if (this._plugins.has(pluginName)) {
117
+ throw new Error("[AcApPluginManager] Plugin '".concat(pluginName, "' is already loaded"));
118
+ }
119
+ _a.label = 1;
120
+ case 1:
121
+ _a.trys.push([1, 3, , 4]);
122
+ return [4 /*yield*/, plugin.onLoad(this._context, this._commandManager)];
123
+ case 2:
124
+ _a.sent();
125
+ return [3 /*break*/, 4];
126
+ case 3:
127
+ error_1 = _a.sent();
128
+ throw new Error("[AcApPluginManager] Failed to load plugin '".concat(pluginName, "': ").concat(error_1));
129
+ case 4:
130
+ // Store plugin
131
+ this._plugins.set(pluginName, plugin);
132
+ return [2 /*return*/];
133
+ }
134
+ });
135
+ });
136
+ };
137
+ /**
138
+ * Unloads a plugin and calls its `onUnload` hook.
139
+ *
140
+ * This method will:
141
+ * 1. Call the plugin's `onUnload` hook (plugins should clean up their commands here)
142
+ * 2. Remove the plugin from the loaded plugins map
143
+ *
144
+ * @param pluginName - The name of the plugin to unload
145
+ * @returns `true` if the plugin was successfully unloaded, `false` if it wasn't loaded
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * const success = await pluginManager.unloadPlugin('MyPlugin');
150
+ * if (success) {
151
+ * console.log('Plugin unloaded successfully');
152
+ * }
153
+ * ```
154
+ */
155
+ AcApPluginManager.prototype.unloadPlugin = function (pluginName) {
156
+ return __awaiter(this, void 0, void 0, function () {
157
+ var plugin, error_2;
158
+ return __generator(this, function (_a) {
159
+ switch (_a.label) {
160
+ case 0:
161
+ plugin = this._plugins.get(pluginName);
162
+ if (!plugin) {
163
+ return [2 /*return*/, false];
164
+ }
165
+ _a.label = 1;
166
+ case 1:
167
+ _a.trys.push([1, 3, , 4]);
168
+ // Call onUnload hook (plugin should clean up its commands here)
169
+ return [4 /*yield*/, plugin.onUnload(this._context, this._commandManager)];
170
+ case 2:
171
+ // Call onUnload hook (plugin should clean up its commands here)
172
+ _a.sent();
173
+ return [3 /*break*/, 4];
174
+ case 3:
175
+ error_2 = _a.sent();
176
+ console.error("[AcApPluginManager] Error unloading plugin '".concat(pluginName, "':"), error_2);
177
+ return [3 /*break*/, 4];
178
+ case 4:
179
+ // Remove plugin from map
180
+ this._plugins.delete(pluginName);
181
+ return [2 /*return*/, true];
182
+ }
183
+ });
184
+ });
185
+ };
186
+ /**
187
+ * Checks if a plugin is currently loaded.
188
+ *
189
+ * @param pluginName - The name of the plugin to check
190
+ * @returns `true` if the plugin is loaded, `false` otherwise
191
+ */
192
+ AcApPluginManager.prototype.isPluginLoaded = function (pluginName) {
193
+ return this._plugins.has(pluginName);
194
+ };
195
+ /**
196
+ * Gets information about a loaded plugin.
197
+ *
198
+ * @param pluginName - The name of the plugin
199
+ * @returns The plugin instance if loaded, `undefined` otherwise
200
+ */
201
+ AcApPluginManager.prototype.getPlugin = function (pluginName) {
202
+ return this._plugins.get(pluginName);
203
+ };
204
+ /**
205
+ * Gets all currently loaded plugins.
206
+ *
207
+ * @returns Array of loaded plugin names
208
+ */
209
+ AcApPluginManager.prototype.getLoadedPlugins = function () {
210
+ return Array.from(this._plugins.keys());
211
+ };
212
+ /**
213
+ * Unloads all currently loaded plugins.
214
+ *
215
+ * This method calls `unloadPlugin` for each loaded plugin.
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * await pluginManager.unloadAllPlugins();
220
+ * ```
221
+ */
222
+ AcApPluginManager.prototype.unloadAllPlugins = function () {
223
+ return __awaiter(this, void 0, void 0, function () {
224
+ var pluginNames, pluginNames_1, pluginNames_1_1, pluginName, e_1_1;
225
+ var e_1, _a;
226
+ return __generator(this, function (_b) {
227
+ switch (_b.label) {
228
+ case 0:
229
+ pluginNames = Array.from(this._plugins.keys());
230
+ _b.label = 1;
231
+ case 1:
232
+ _b.trys.push([1, 6, 7, 8]);
233
+ pluginNames_1 = __values(pluginNames), pluginNames_1_1 = pluginNames_1.next();
234
+ _b.label = 2;
235
+ case 2:
236
+ if (!!pluginNames_1_1.done) return [3 /*break*/, 5];
237
+ pluginName = pluginNames_1_1.value;
238
+ return [4 /*yield*/, this.unloadPlugin(pluginName)];
239
+ case 3:
240
+ _b.sent();
241
+ _b.label = 4;
242
+ case 4:
243
+ pluginNames_1_1 = pluginNames_1.next();
244
+ return [3 /*break*/, 2];
245
+ case 5: return [3 /*break*/, 8];
246
+ case 6:
247
+ e_1_1 = _b.sent();
248
+ e_1 = { error: e_1_1 };
249
+ return [3 /*break*/, 8];
250
+ case 7:
251
+ try {
252
+ if (pluginNames_1_1 && !pluginNames_1_1.done && (_a = pluginNames_1.return)) _a.call(pluginNames_1);
253
+ }
254
+ finally { if (e_1) throw e_1.error; }
255
+ return [7 /*endfinally*/];
256
+ case 8: return [2 /*return*/];
257
+ }
258
+ });
259
+ });
260
+ };
261
+ /**
262
+ * Loads multiple plugins from a configuration array.
263
+ *
264
+ * This method accepts an array of plugin instances or plugin factory functions.
265
+ * Factory functions are useful when you want to create plugin instances lazily.
266
+ *
267
+ * @param plugins - Array of plugin instances or factory functions that return plugin instances
268
+ * @param options - Optional configuration for loading behavior
269
+ * @param options.continueOnError - If true, continue loading other plugins even if one fails (default: false)
270
+ * @returns Promise that resolves to an object containing successful and failed plugin loads
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * // Load plugins from instances
275
+ * await pluginManager.loadPluginsFromConfig([
276
+ * new MyPlugin1(),
277
+ * new MyPlugin2()
278
+ * ]);
279
+ *
280
+ * // Load plugins from factory functions
281
+ * await pluginManager.loadPluginsFromConfig([
282
+ * () => new MyPlugin1(),
283
+ * () => new MyPlugin2()
284
+ * ]);
285
+ *
286
+ * // Continue loading even if some fail
287
+ * const result = await pluginManager.loadPluginsFromConfig(
288
+ * [new Plugin1(), new Plugin2()],
289
+ * { continueOnError: true }
290
+ * );
291
+ * console.log('Loaded:', result.loaded);
292
+ * console.log('Failed:', result.failed);
293
+ * ```
294
+ */
295
+ AcApPluginManager.prototype.loadPluginsFromConfig = function (plugins, options) {
296
+ return __awaiter(this, void 0, void 0, function () {
297
+ var continueOnError, loaded, failed, plugins_1, plugins_1_1, pluginOrFactory, plugin, error_3, pluginName, err, e_2_1;
298
+ var e_2, _a;
299
+ var _b;
300
+ return __generator(this, function (_c) {
301
+ switch (_c.label) {
302
+ case 0:
303
+ continueOnError = (_b = options === null || options === void 0 ? void 0 : options.continueOnError) !== null && _b !== void 0 ? _b : false;
304
+ loaded = [];
305
+ failed = [];
306
+ _c.label = 1;
307
+ case 1:
308
+ _c.trys.push([1, 8, 9, 10]);
309
+ plugins_1 = __values(plugins), plugins_1_1 = plugins_1.next();
310
+ _c.label = 2;
311
+ case 2:
312
+ if (!!plugins_1_1.done) return [3 /*break*/, 7];
313
+ pluginOrFactory = plugins_1_1.value;
314
+ _c.label = 3;
315
+ case 3:
316
+ _c.trys.push([3, 5, , 6]);
317
+ plugin = typeof pluginOrFactory === 'function'
318
+ ? pluginOrFactory()
319
+ : pluginOrFactory;
320
+ return [4 /*yield*/, this.loadPlugin(plugin)];
321
+ case 4:
322
+ _c.sent();
323
+ loaded.push(plugin.name);
324
+ return [3 /*break*/, 6];
325
+ case 5:
326
+ error_3 = _c.sent();
327
+ pluginName = typeof pluginOrFactory === 'function'
328
+ ? 'Unknown'
329
+ : pluginOrFactory.name || 'Unknown';
330
+ err = error_3 instanceof Error ? error_3 : new Error(String(error_3));
331
+ failed.push({ name: pluginName, error: err });
332
+ if (!continueOnError) {
333
+ throw err;
334
+ }
335
+ return [3 /*break*/, 6];
336
+ case 6:
337
+ plugins_1_1 = plugins_1.next();
338
+ return [3 /*break*/, 2];
339
+ case 7: return [3 /*break*/, 10];
340
+ case 8:
341
+ e_2_1 = _c.sent();
342
+ e_2 = { error: e_2_1 };
343
+ return [3 /*break*/, 10];
344
+ case 9:
345
+ try {
346
+ if (plugins_1_1 && !plugins_1_1.done && (_a = plugins_1.return)) _a.call(plugins_1);
347
+ }
348
+ finally { if (e_2) throw e_2.error; }
349
+ return [7 /*endfinally*/];
350
+ case 10: return [2 /*return*/, { loaded: loaded, failed: failed }];
351
+ }
352
+ });
353
+ });
354
+ };
355
+ /**
356
+ * Loads plugins from a folder using dynamic imports.
357
+ *
358
+ * This method scans a folder for plugin files and dynamically imports them.
359
+ * It expects each plugin file to export a default export that is either:
360
+ * - A plugin instance
361
+ * - A plugin class (constructor function)
362
+ * - A factory function that returns a plugin instance
363
+ *
364
+ * @param folderPath - Path to the folder containing plugin files (relative to the base URL)
365
+ * @param options - Optional configuration for loading behavior
366
+ * @param options.pattern - Glob pattern to match plugin files (default: '*.js' or '*.ts')
367
+ * @param options.continueOnError - If true, continue loading other plugins even if one fails (default: false)
368
+ * @param options.pluginList - Optional array of specific plugin file names to load (if not provided, attempts to auto-discover)
369
+ * @returns Promise that resolves to an object containing successful and failed plugin loads
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * // Load all plugins from a folder (requires plugin list or manifest)
374
+ * await pluginManager.loadPluginsFromFolder('./plugins', {
375
+ * pluginList: ['MyPlugin1.js', 'MyPlugin2.js']
376
+ * });
377
+ *
378
+ * // Or with continue on error
379
+ * const result = await pluginManager.loadPluginsFromFolder('./plugins', {
380
+ * pluginList: ['Plugin1.js', 'Plugin2.js'],
381
+ * continueOnError: true
382
+ * });
383
+ * ```
384
+ *
385
+ * @remarks
386
+ * In browser environments, you typically need to provide a list of plugin files
387
+ * to load, as there's no direct way to list directory contents. You can:
388
+ * 1. Provide a `pluginList` array with specific file names
389
+ * 2. Create a manifest file that lists all plugins
390
+ * 3. Use a build-time tool to generate the plugin list
391
+ */
392
+ AcApPluginManager.prototype.loadPluginsFromFolder = function (folderPath, options) {
393
+ return __awaiter(this, void 0, void 0, function () {
394
+ var continueOnError, pluginList, loaded, failed, normalizedPath, basePath, pluginList_1, pluginList_1_1, pluginFile, importPath, module_1, pluginExport, className, fileName, exportName, plugin, error_4, err, e_3_1;
395
+ var e_3, _a;
396
+ var _b;
397
+ return __generator(this, function (_c) {
398
+ switch (_c.label) {
399
+ case 0:
400
+ continueOnError = (_b = options === null || options === void 0 ? void 0 : options.continueOnError) !== null && _b !== void 0 ? _b : false;
401
+ pluginList = (options === null || options === void 0 ? void 0 : options.pluginList) || [];
402
+ loaded = [];
403
+ failed = [];
404
+ if (pluginList.length === 0) {
405
+ console.warn('[AcApPluginManager] No plugin list provided. Cannot load plugins from folder without a list of files.');
406
+ return [2 /*return*/, { loaded: loaded, failed: failed }];
407
+ }
408
+ normalizedPath = folderPath.replace(/\/$/, '');
409
+ basePath = normalizedPath.startsWith('./')
410
+ ? normalizedPath
411
+ : "./".concat(normalizedPath);
412
+ _c.label = 1;
413
+ case 1:
414
+ _c.trys.push([1, 9, 10, 11]);
415
+ pluginList_1 = __values(pluginList), pluginList_1_1 = pluginList_1.next();
416
+ _c.label = 2;
417
+ case 2:
418
+ if (!!pluginList_1_1.done) return [3 /*break*/, 8];
419
+ pluginFile = pluginList_1_1.value;
420
+ _c.label = 3;
421
+ case 3:
422
+ _c.trys.push([3, 6, , 7]);
423
+ importPath = "".concat(basePath, "/").concat(pluginFile.replace(/^\//, ''));
424
+ return [4 /*yield*/, import(/* @vite-ignore */ importPath)
425
+ // Get the plugin from the module
426
+ // Support: default export, named export 'Plugin', or named export matching filename
427
+ ];
428
+ case 4:
429
+ module_1 = _c.sent();
430
+ pluginExport = module_1.default;
431
+ className = void 0;
432
+ if (!pluginExport) {
433
+ fileName = pluginFile.replace(/\.(js|ts)$/, '');
434
+ className = fileName
435
+ .split(/[-_]/)
436
+ .map(function (part) { return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase(); })
437
+ .join('');
438
+ pluginExport = module_1[className] || module_1.Plugin || module_1[fileName];
439
+ }
440
+ if (!pluginExport) {
441
+ exportName = className || 'Plugin';
442
+ throw new Error("No plugin export found in ".concat(pluginFile, ". Expected default export, or named export 'Plugin' or '").concat(exportName, "'."));
443
+ }
444
+ plugin = void 0;
445
+ if (typeof pluginExport === 'function') {
446
+ // Check if it's a class (has prototype) or factory function
447
+ if (pluginExport.prototype && pluginExport.prototype.onLoad) {
448
+ // It's a class, instantiate it
449
+ plugin = new pluginExport();
450
+ }
451
+ else {
452
+ // It's a factory function, call it
453
+ plugin = pluginExport();
454
+ }
455
+ }
456
+ else {
457
+ // It's already an instance
458
+ plugin = pluginExport;
459
+ }
460
+ // Verify it's a valid plugin
461
+ if (!plugin || typeof plugin.onLoad !== 'function') {
462
+ throw new Error("Invalid plugin in ".concat(pluginFile, ". Plugin must implement AcApPlugin interface."));
463
+ }
464
+ return [4 /*yield*/, this.loadPlugin(plugin)];
465
+ case 5:
466
+ _c.sent();
467
+ loaded.push(plugin.name);
468
+ return [3 /*break*/, 7];
469
+ case 6:
470
+ error_4 = _c.sent();
471
+ err = error_4 instanceof Error ? error_4 : new Error(String(error_4));
472
+ failed.push({ name: pluginFile, error: err });
473
+ if (!continueOnError) {
474
+ throw err;
475
+ }
476
+ return [3 /*break*/, 7];
477
+ case 7:
478
+ pluginList_1_1 = pluginList_1.next();
479
+ return [3 /*break*/, 2];
480
+ case 8: return [3 /*break*/, 11];
481
+ case 9:
482
+ e_3_1 = _c.sent();
483
+ e_3 = { error: e_3_1 };
484
+ return [3 /*break*/, 11];
485
+ case 10:
486
+ try {
487
+ if (pluginList_1_1 && !pluginList_1_1.done && (_a = pluginList_1.return)) _a.call(pluginList_1);
488
+ }
489
+ finally { if (e_3) throw e_3.error; }
490
+ return [7 /*endfinally*/];
491
+ case 11: return [2 /*return*/, { loaded: loaded, failed: failed }];
492
+ }
493
+ });
494
+ });
495
+ };
496
+ return AcApPluginManager;
497
+ }());
498
+ export { AcApPluginManager };
499
+ //# sourceMappingURL=AcApPluginManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcApPluginManager.js","sourceRoot":"","sources":["../../src/plugin/AcApPluginManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;IAQE;;;;;OAKG;IACH,2BAAY,OAAoB,EAAE,cAAgC;QAChE,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAA;QACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;IACvC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACG,sCAAU,GAAhB,UAAiB,MAAkB;;;;;;wBAC3B,UAAU,GAAG,MAAM,CAAC,IAAI,CAAA;wBAE9B,IAAI,CAAC,UAAU,EAAE,CAAC;4BAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;wBAChE,CAAC;wBAED,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;4BAClC,MAAM,IAAI,KAAK,CACb,sCAA+B,UAAU,wBAAqB,CAC/D,CAAA;wBACH,CAAC;;;;wBAIC,qBAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,EAAA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AAA;;wBAA7B,SAA6B,CAAA;wBAC7B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;;;;wBAElB,GAAG,GAAG,OAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,OAAK,CAAC,CAAC,CAAA;wBAErE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;wBAE7C,IAAI,CAAC,eAAe,EAAE,CAAC;4BACrB,MAAM,GAAG,CAAA;wBACX,CAAC;;;;;;;;;;;;;;;;6BAIL,sBAAO,EAAE,MAAM,QAAA,EAAE,MAAM,QAAA,EAAE,EAAA;;;;KAC1B;IACH,wBAAC;AAAD,CAAC,AArWD,IAqWC"}
@@ -0,0 +1,4 @@
1
+ export * from './AcApPlugin';
2
+ export * from './AcApPluginManager';
3
+ export * from './AcApPluginExample';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './AcApPlugin';
2
+ export * from './AcApPluginManager';
3
+ export * from './AcApPluginExample';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"AcTrView2d.d.ts","sourceRoot":"","sources":["../../src/view/AcTrView2d.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,oBAAoB,EACpB,yBAAyB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EAAE,YAAY,EAAE;IAI/B,iBAAiB;IAOjB;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,YAAY;IAIxB;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,YAAY;IAI1B,SAAS,CAAC,WAAW;IAIrB,OAAO,CAAC,WAAW;IAcnB,SAAS,CAAC,cAAc;IAOxB,OAAO,CAAC,OAAO,CAQd;IAED,OAAO,CAAC,kBAAkB;IAM1B;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAmBhC;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAuClC;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,UAAU;IAMlB,MAAM,CAAC,iBAAiB,SAAO;IAC/B;;;;OAIG;YACW,YAAY;IAuG1B,OAAO,CAAC,WAAW;IA0DnB,OAAO,CAAC,8BAA8B;CASvC"}
@@ -71,7 +71,7 @@ var __values = (this && this.__values) || function(o) {
71
71
  };
72
72
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
73
73
  };
74
- import { acdbHostApplicationServices, AcDbRasterImage, AcDbRay, AcDbViewport, AcDbXline, AcGePoint2d } from '@mlightcad/data-model';
74
+ import { acdbHostApplicationServices, AcDbRasterImage, AcDbRay, AcDbSysVarManager, AcDbViewport, AcDbXline, AcGePoint2d } from '@mlightcad/data-model';
75
75
  import { AcTrEntity, AcTrGroup, AcTrRenderer, AcTrViewportView } from '@mlightcad/three-renderer';
76
76
  import * as THREE from 'three';
77
77
  import Stats from 'three/examples/jsm/libs/stats.module';
@@ -170,6 +170,12 @@ var AcTrView2d = /** @class */ (function (_super) {
170
170
  // Initialize background color via renderer clear color
171
171
  _this._renderer.setClearColor(mergedOptions.background || 0x000000);
172
172
  _this._stats = _this.createStats(AcApSettingManager.instance.isShowStats);
173
+ AcDbSysVarManager.instance().events.sysVarChanged.addEventListener(function (args) {
174
+ if (args.name === 'WHITEBKCOLOR') {
175
+ var useWhiteBackgroundColor = args.newVal;
176
+ _this.backgroundColor = useWhiteBackgroundColor ? 0xffffff : 0;
177
+ }
178
+ });
173
179
  AcApSettingManager.instance.events.modified.addEventListener(function (args) {
174
180
  if (args.key == 'isShowStats') {
175
181
  _this.toggleStatsVisibility(_this._stats, args.value);
@@ -189,6 +195,7 @@ var AcTrView2d = /** @class */ (function (_super) {
189
195
  _this.selectionSet.clear();
190
196
  break;
191
197
  case 'Delete':
198
+ case 'Backspace':
192
199
  AcApDocManager.instance.sendStringToExecute('erase');
193
200
  break;
194
201
  }