@mlightcad/cad-simple-viewer 1.4.12 → 1.4.13

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 (160) hide show
  1. package/dist/index.js +15901 -10590
  2. package/dist/index.umd.cjs +55 -48
  3. package/dist/libredwg-parser-worker.js +4724 -4762
  4. package/lib/app/AcApDocManager.d.ts +60 -4
  5. package/lib/app/AcApDocManager.d.ts.map +1 -1
  6. package/lib/app/AcApDocManager.js +160 -33
  7. package/lib/app/AcApDocManager.js.map +1 -1
  8. package/lib/command/AcApArcCmd.d.ts.map +1 -1
  9. package/lib/command/AcApArcCmd.js +1 -1
  10. package/lib/command/AcApArcCmd.js.map +1 -1
  11. package/lib/command/AcApCircleCmd.d.ts +59 -0
  12. package/lib/command/AcApCircleCmd.d.ts.map +1 -1
  13. package/lib/command/AcApCircleCmd.js +489 -18
  14. package/lib/command/AcApCircleCmd.js.map +1 -1
  15. package/lib/command/AcApConvertToPngCmd.d.ts +35 -0
  16. package/lib/command/AcApConvertToPngCmd.d.ts.map +1 -0
  17. package/lib/command/{AcApZoomToBoxCmd.js → AcApConvertToPngCmd.js} +50 -26
  18. package/lib/command/AcApConvertToPngCmd.js.map +1 -0
  19. package/lib/command/AcApEllipseCmd.d.ts +87 -0
  20. package/lib/command/AcApEllipseCmd.d.ts.map +1 -0
  21. package/lib/command/AcApEllipseCmd.js +583 -0
  22. package/lib/command/AcApEllipseCmd.js.map +1 -0
  23. package/lib/command/AcApHatchCmd.d.ts +210 -0
  24. package/lib/command/AcApHatchCmd.d.ts.map +1 -0
  25. package/lib/command/AcApHatchCmd.js +808 -0
  26. package/lib/command/AcApHatchCmd.js.map +1 -0
  27. package/lib/command/AcApLayerCmd.d.ts +217 -0
  28. package/lib/command/AcApLayerCmd.d.ts.map +1 -0
  29. package/lib/command/AcApLayerCmd.js +768 -0
  30. package/lib/command/AcApLayerCmd.js.map +1 -0
  31. package/lib/command/AcApLineCmd.d.ts +36 -1
  32. package/lib/command/AcApLineCmd.d.ts.map +1 -1
  33. package/lib/command/AcApLineCmd.js +157 -20
  34. package/lib/command/AcApLineCmd.js.map +1 -1
  35. package/lib/command/AcApMeasureAreaCmd.d.ts.map +1 -1
  36. package/lib/command/AcApMeasureAreaCmd.js +3 -0
  37. package/lib/command/AcApMeasureAreaCmd.js.map +1 -1
  38. package/lib/command/AcApMoveCmd.d.ts +16 -0
  39. package/lib/command/AcApMoveCmd.d.ts.map +1 -0
  40. package/lib/command/AcApMoveCmd.js +278 -0
  41. package/lib/command/AcApMoveCmd.js.map +1 -0
  42. package/lib/command/AcApPngConvertor.d.ts +95 -0
  43. package/lib/command/AcApPngConvertor.d.ts.map +1 -0
  44. package/lib/command/AcApPngConvertor.js +205 -0
  45. package/lib/command/AcApPngConvertor.js.map +1 -0
  46. package/lib/command/AcApPolygonCmd.d.ts +69 -0
  47. package/lib/command/AcApPolygonCmd.d.ts.map +1 -0
  48. package/lib/command/AcApPolygonCmd.js +422 -0
  49. package/lib/command/AcApPolygonCmd.js.map +1 -0
  50. package/lib/command/AcApRectCmd.d.ts +149 -4
  51. package/lib/command/AcApRectCmd.d.ts.map +1 -1
  52. package/lib/command/AcApRectCmd.js +716 -34
  53. package/lib/command/AcApRectCmd.js.map +1 -1
  54. package/lib/command/AcApRevCircleCmd.d.ts +8 -0
  55. package/lib/command/AcApRevCircleCmd.d.ts.map +1 -1
  56. package/lib/command/AcApRevCircleCmd.js +30 -6
  57. package/lib/command/AcApRevCircleCmd.js.map +1 -1
  58. package/lib/command/AcApRevRectCmd.d.ts +8 -0
  59. package/lib/command/AcApRevRectCmd.d.ts.map +1 -1
  60. package/lib/command/AcApRevRectCmd.js +78 -6
  61. package/lib/command/AcApRevRectCmd.js.map +1 -1
  62. package/lib/command/AcApSplineCmd.d.ts +66 -1
  63. package/lib/command/AcApSplineCmd.d.ts.map +1 -1
  64. package/lib/command/AcApSplineCmd.js +466 -59
  65. package/lib/command/AcApSplineCmd.js.map +1 -1
  66. package/lib/command/AcApZoomCmd.d.ts +91 -20
  67. package/lib/command/AcApZoomCmd.d.ts.map +1 -1
  68. package/lib/command/AcApZoomCmd.js +288 -23
  69. package/lib/command/AcApZoomCmd.js.map +1 -1
  70. package/lib/command/index.d.ts +7 -1
  71. package/lib/command/index.d.ts.map +1 -1
  72. package/lib/command/index.js +7 -1
  73. package/lib/command/index.js.map +1 -1
  74. package/lib/editor/command/AcEdCommandStack.d.ts +54 -1
  75. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
  76. package/lib/editor/command/AcEdCommandStack.js +207 -25
  77. package/lib/editor/command/AcEdCommandStack.js.map +1 -1
  78. package/lib/editor/input/AcEdSelectionFilter.d.ts +79 -0
  79. package/lib/editor/input/AcEdSelectionFilter.d.ts.map +1 -0
  80. package/lib/editor/input/AcEdSelectionFilter.js +231 -0
  81. package/lib/editor/input/AcEdSelectionFilter.js.map +1 -0
  82. package/lib/editor/input/AcEditor.d.ts +20 -2
  83. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  84. package/lib/editor/input/AcEditor.js +66 -0
  85. package/lib/editor/input/AcEditor.js.map +1 -1
  86. package/lib/editor/input/index.d.ts +1 -0
  87. package/lib/editor/input/index.d.ts.map +1 -1
  88. package/lib/editor/input/index.js +1 -0
  89. package/lib/editor/input/index.js.map +1 -1
  90. package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts +47 -0
  91. package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts.map +1 -1
  92. package/lib/editor/input/prompt/AcEdKeywordCollection.js +19 -0
  93. package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -1
  94. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +7 -0
  95. package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -1
  96. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +17 -0
  97. package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -1
  98. package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts +17 -0
  99. package/lib/editor/input/prompt/AcEdPromptEntityOptions.d.ts.map +1 -1
  100. package/lib/editor/input/prompt/AcEdPromptEntityOptions.js +30 -3
  101. package/lib/editor/input/prompt/AcEdPromptEntityOptions.js.map +1 -1
  102. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +6 -1
  103. package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -1
  104. package/lib/editor/input/prompt/AcEdPromptOptions.js +7 -0
  105. package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -1
  106. package/lib/editor/input/session/AcEdKeywordSession.d.ts +65 -0
  107. package/lib/editor/input/session/AcEdKeywordSession.d.ts.map +1 -1
  108. package/lib/editor/input/session/AcEdKeywordSession.js +71 -0
  109. package/lib/editor/input/session/AcEdKeywordSession.js.map +1 -1
  110. package/lib/editor/input/ui/AcEdCommandLine.d.ts +23 -0
  111. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  112. package/lib/editor/input/ui/AcEdCommandLine.js +42 -6
  113. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  114. package/lib/editor/input/ui/AcEdFloatingInput.d.ts +1 -0
  115. package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
  116. package/lib/editor/input/ui/AcEdFloatingInput.js +8 -2
  117. package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
  118. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +23 -1
  119. package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -1
  120. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +32 -9
  121. package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -1
  122. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +28 -0
  123. package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
  124. package/lib/editor/input/ui/AcEdInputManager.d.ts +356 -16
  125. package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
  126. package/lib/editor/input/ui/AcEdInputManager.js +964 -529
  127. package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
  128. package/lib/editor/input/ui/AcEdRubberBand.d.ts +15 -1
  129. package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -1
  130. package/lib/editor/input/ui/AcEdRubberBand.js +42 -10
  131. package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -1
  132. package/lib/i18n/en/command.d.ts +21 -3
  133. package/lib/i18n/en/command.d.ts.map +1 -1
  134. package/lib/i18n/en/command.js +21 -3
  135. package/lib/i18n/en/command.js.map +1 -1
  136. package/lib/i18n/en/jig.d.ts +443 -0
  137. package/lib/i18n/en/jig.d.ts.map +1 -1
  138. package/lib/i18n/en/jig.js +452 -9
  139. package/lib/i18n/en/jig.js.map +1 -1
  140. package/lib/i18n/zh/command.d.ts +21 -3
  141. package/lib/i18n/zh/command.d.ts.map +1 -1
  142. package/lib/i18n/zh/command.js +21 -3
  143. package/lib/i18n/zh/command.js.map +1 -1
  144. package/lib/i18n/zh/jig.d.ts +443 -0
  145. package/lib/i18n/zh/jig.d.ts.map +1 -1
  146. package/lib/i18n/zh/jig.js +452 -9
  147. package/lib/i18n/zh/jig.js.map +1 -1
  148. package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
  149. package/lib/plugin/AcApPluginManager.js.map +1 -1
  150. package/lib/view/AcTrLayer.d.ts.map +1 -1
  151. package/lib/view/AcTrLayer.js +5 -3
  152. package/lib/view/AcTrLayer.js.map +1 -1
  153. package/lib/view/AcTrView2d.d.ts +0 -1
  154. package/lib/view/AcTrView2d.d.ts.map +1 -1
  155. package/lib/view/AcTrView2d.js +17 -4
  156. package/lib/view/AcTrView2d.js.map +1 -1
  157. package/package.json +11 -9
  158. package/lib/command/AcApZoomToBoxCmd.d.ts +0 -29
  159. package/lib/command/AcApZoomToBoxCmd.d.ts.map +0 -1
  160. package/lib/command/AcApZoomToBoxCmd.js.map +0 -1
@@ -1,34 +1,105 @@
1
1
  import { AcApContext } from '../app';
2
- import { AcEdCommand } from '../command';
2
+ import { AcEdCommand } from '../editor';
3
3
  /**
4
- * Command to zoom the view to fit all visible entities.
4
+ * AutoCAD-style ZOOM command with keyword-driven branches in a single command.
5
5
  *
6
- * This command adjusts the view's zoom level and position to show all
7
- * visible entities in the current drawing within the viewport. It's
8
- * equivalent to the "Zoom Extents" or "Fit to Window" functionality
9
- * found in most CAD applications.
6
+ * Supported flows:
7
+ * - Press Enter: zoom extents.
8
+ * - Pick first corner: zoom window.
9
+ * - Keywords:
10
+ * - `All` / `Extents`: zoom extents.
11
+ * - `Window`: prompt two corners and zoom to that box.
12
+ * - `Center`: prompt center + height/scale factor.
13
+ * - `Scale`: scale relative to current view (`n`, `nX`, `nXP`).
14
+ * - `Previous`: restore previous zoom box.
10
15
  *
11
- * The command calculates the bounding box of all visible entities and
12
- * adjusts the camera to show them all with appropriate padding.
16
+ * This command intentionally keeps all zoom branches in one implementation so
17
+ * callers can use script-style command input such as:
13
18
  *
14
- * @example
15
- * ```typescript
16
- * const zoomCommand = new AcApZoomCmd();
17
- * zoomCommand.globalName = 'ZOOM';
18
- * zoomCommand.localName = 'Zoom to Fit';
19
- *
20
- * // Execute the command to fit all entities in view
21
- * zoomCommand.trigger(docManager.context);
19
+ * ```text
20
+ * zoom
21
+ * window
22
22
  * ```
23
23
  */
24
24
  export declare class AcApZoomCmd extends AcEdCommand {
25
25
  /**
26
- * Executes the zoom to fit command.
26
+ * Stores the last view box before a zoom operation so `Previous` can restore it.
27
+ */
28
+ private static previousViewBox?;
29
+ /**
30
+ * Captures current visible world box from the viewport corners.
31
+ *
32
+ * @param context - Current command context.
33
+ * @returns Current view box in world coordinates.
34
+ */
35
+ private captureCurrentViewBox;
36
+ /**
37
+ * Saves current view box before executing a zoom branch.
38
+ *
39
+ * @param context - Current command context.
40
+ */
41
+ private rememberViewBeforeZoom;
42
+ /**
43
+ * Executes extents-like zoom and records previous view for rollback.
44
+ *
45
+ * @param context - Current command context.
46
+ */
47
+ private zoomToExtents;
48
+ /**
49
+ * Executes window zoom from two corner points.
50
+ *
51
+ * @param context - Current command context.
52
+ * @param first - First corner in WCS.
53
+ * @param second - Opposite corner in WCS.
54
+ */
55
+ private zoomToWindow;
56
+ /**
57
+ * Prompts second corner from a known first corner, then performs window zoom.
58
+ *
59
+ * @param context - Current command context.
60
+ * @param firstCorner - First window corner in WCS.
61
+ */
62
+ private promptAndZoomWindowFromFirstCorner;
63
+ /**
64
+ * Prompts a window box using editor `getBox`, then zooms to that box.
65
+ *
66
+ * @param context - Current command context.
67
+ */
68
+ private promptAndZoomWindowByBox;
69
+ /**
70
+ * Handles `Center` branch:
71
+ * - pick center point
72
+ * - input height or scale factor
73
+ *
74
+ * @param context - Current command context.
75
+ */
76
+ private runCenter;
77
+ /**
78
+ * Parses scale factor text from AutoCAD-like inputs:
79
+ * - `2` / `2x` / `2xp`
27
80
  *
28
- * Calls the view's `zoomToFit()` method to adjust the camera position
29
- * and zoom level to display all visible entities within the viewport.
81
+ * @param raw - Raw user input.
82
+ * @returns Positive scale factor, or `undefined` when invalid.
83
+ */
84
+ private parseScaleFactor;
85
+ /**
86
+ * Applies relative zoom around the specified center (or current view center).
87
+ *
88
+ * @param context - Current command context.
89
+ * @param factor - Relative zoom factor (> 0).
90
+ * @param centerPoint - Optional explicit zoom center in WCS.
91
+ */
92
+ private applyRelativeScale;
93
+ /**
94
+ * Restores previous view box if one exists and swaps buffers to allow toggling.
95
+ *
96
+ * @param context - Current command context.
97
+ */
98
+ private runPrevious;
99
+ /**
100
+ * Runs zoom interaction with keyword-capable branching.
30
101
  *
31
- * @param context - The current application context containing the view to zoom
102
+ * @param context - Current command context.
32
103
  */
33
104
  execute(context: AcApContext): Promise<void>;
34
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AcApZoomCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;OAOG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW;CAGnC"}
1
+ {"version":3,"file":"AcApZoomCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAkB,MAAM,QAAQ,CAAA;AACpD,OAAO,EACL,WAAW,EAKZ,MAAM,WAAW,CAAA;AAGlB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAW;IAE1C;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAU7B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAI9B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAKrB;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;OAKG;YACW,kCAAkC;IAkBhD;;;;OAIG;YACW,wBAAwB;IAWtC;;;;;;OAMG;YACW,SAAS;IA4CvB;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAOnB;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,WAAW;CAmFnC"}
@@ -49,26 +49,29 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
50
  }
51
51
  };
52
- import { AcEdCommand } from '../command';
52
+ import { AcGeBox2d, AcGePoint3d } from '@mlightcad/data-model';
53
+ import { AcApDocManager } from '../app';
54
+ import { AcEdCommand, AcEdPromptBoxOptions, AcEdPromptPointOptions, AcEdPromptStatus, AcEdPromptStringOptions } from '../editor';
55
+ import { AcApI18n } from '../i18n';
53
56
  /**
54
- * Command to zoom the view to fit all visible entities.
57
+ * AutoCAD-style ZOOM command with keyword-driven branches in a single command.
55
58
  *
56
- * This command adjusts the view's zoom level and position to show all
57
- * visible entities in the current drawing within the viewport. It's
58
- * equivalent to the "Zoom Extents" or "Fit to Window" functionality
59
- * found in most CAD applications.
59
+ * Supported flows:
60
+ * - Press Enter: zoom extents.
61
+ * - Pick first corner: zoom window.
62
+ * - Keywords:
63
+ * - `All` / `Extents`: zoom extents.
64
+ * - `Window`: prompt two corners and zoom to that box.
65
+ * - `Center`: prompt center + height/scale factor.
66
+ * - `Scale`: scale relative to current view (`n`, `nX`, `nXP`).
67
+ * - `Previous`: restore previous zoom box.
60
68
  *
61
- * The command calculates the bounding box of all visible entities and
62
- * adjusts the camera to show them all with appropriate padding.
69
+ * This command intentionally keeps all zoom branches in one implementation so
70
+ * callers can use script-style command input such as:
63
71
  *
64
- * @example
65
- * ```typescript
66
- * const zoomCommand = new AcApZoomCmd();
67
- * zoomCommand.globalName = 'ZOOM';
68
- * zoomCommand.localName = 'Zoom to Fit';
69
- *
70
- * // Execute the command to fit all entities in view
71
- * zoomCommand.trigger(docManager.context);
72
+ * ```text
73
+ * zoom
74
+ * window
72
75
  * ```
73
76
  */
74
77
  var AcApZoomCmd = /** @class */ (function (_super) {
@@ -77,18 +80,280 @@ var AcApZoomCmd = /** @class */ (function (_super) {
77
80
  return _super !== null && _super.apply(this, arguments) || this;
78
81
  }
79
82
  /**
80
- * Executes the zoom to fit command.
83
+ * Captures current visible world box from the viewport corners.
81
84
  *
82
- * Calls the view's `zoomToFit()` method to adjust the camera position
83
- * and zoom level to display all visible entities within the viewport.
85
+ * @param context - Current command context.
86
+ * @returns Current view box in world coordinates.
87
+ */
88
+ AcApZoomCmd.prototype.captureCurrentViewBox = function (context) {
89
+ var topLeft = context.view.screenToWorld({ x: 0, y: 0 });
90
+ var bottomRight = context.view.screenToWorld({
91
+ x: context.view.width,
92
+ y: context.view.height
93
+ });
94
+ return new AcGeBox2d().expandByPoint(topLeft).expandByPoint(bottomRight);
95
+ };
96
+ /**
97
+ * Saves current view box before executing a zoom branch.
84
98
  *
85
- * @param context - The current application context containing the view to zoom
99
+ * @param context - Current command context.
86
100
  */
87
- AcApZoomCmd.prototype.execute = function (context) {
101
+ AcApZoomCmd.prototype.rememberViewBeforeZoom = function (context) {
102
+ AcApZoomCmd.previousViewBox = this.captureCurrentViewBox(context);
103
+ };
104
+ /**
105
+ * Executes extents-like zoom and records previous view for rollback.
106
+ *
107
+ * @param context - Current command context.
108
+ */
109
+ AcApZoomCmd.prototype.zoomToExtents = function (context) {
110
+ this.rememberViewBeforeZoom(context);
111
+ context.view.zoomToFitDrawing();
112
+ };
113
+ /**
114
+ * Executes window zoom from two corner points.
115
+ *
116
+ * @param context - Current command context.
117
+ * @param first - First corner in WCS.
118
+ * @param second - Opposite corner in WCS.
119
+ */
120
+ AcApZoomCmd.prototype.zoomToWindow = function (context, first, second) {
121
+ var box = new AcGeBox2d().expandByPoint(first).expandByPoint(second);
122
+ this.rememberViewBeforeZoom(context);
123
+ context.view.zoomTo(box, 1);
124
+ };
125
+ /**
126
+ * Prompts second corner from a known first corner, then performs window zoom.
127
+ *
128
+ * @param context - Current command context.
129
+ * @param firstCorner - First window corner in WCS.
130
+ */
131
+ AcApZoomCmd.prototype.promptAndZoomWindowFromFirstCorner = function (context, firstCorner) {
132
+ return __awaiter(this, void 0, void 0, function () {
133
+ var secondPrompt, secondResult;
134
+ return __generator(this, function (_a) {
135
+ switch (_a.label) {
136
+ case 0:
137
+ secondPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.zoom.secondCorner'));
138
+ secondPrompt.useBasePoint = true;
139
+ secondPrompt.basePoint = new AcGePoint3d(firstCorner);
140
+ secondPrompt.useDashedLine = true;
141
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(secondPrompt)];
142
+ case 1:
143
+ secondResult = _a.sent();
144
+ if (secondResult.status !== AcEdPromptStatus.OK || !secondResult.value)
145
+ return [2 /*return*/];
146
+ this.zoomToWindow(context, firstCorner, secondResult.value);
147
+ return [2 /*return*/];
148
+ }
149
+ });
150
+ });
151
+ };
152
+ /**
153
+ * Prompts a window box using editor `getBox`, then zooms to that box.
154
+ *
155
+ * @param context - Current command context.
156
+ */
157
+ AcApZoomCmd.prototype.promptAndZoomWindowByBox = function (context) {
158
+ return __awaiter(this, void 0, void 0, function () {
159
+ var boxOptions, boxResult;
160
+ return __generator(this, function (_a) {
161
+ switch (_a.label) {
162
+ case 0:
163
+ boxOptions = new AcEdPromptBoxOptions(AcApI18n.t('jig.zoom.firstCorner'), AcApI18n.t('jig.zoom.secondCorner'));
164
+ return [4 /*yield*/, AcApDocManager.instance.editor.getBox(boxOptions)];
165
+ case 1:
166
+ boxResult = _a.sent();
167
+ if (boxResult.status !== AcEdPromptStatus.OK || !boxResult.value)
168
+ return [2 /*return*/];
169
+ this.rememberViewBeforeZoom(context);
170
+ context.view.zoomTo(boxResult.value, 1);
171
+ return [2 /*return*/];
172
+ }
173
+ });
174
+ });
175
+ };
176
+ /**
177
+ * Handles `Center` branch:
178
+ * - pick center point
179
+ * - input height or scale factor
180
+ *
181
+ * @param context - Current command context.
182
+ */
183
+ AcApZoomCmd.prototype.runCenter = function (context) {
88
184
  return __awaiter(this, void 0, void 0, function () {
185
+ var centerPrompt, centerResult, heightPrompt, heightResult, parsedScale, viewHeight, aspect, halfHeight, halfWidth, box;
89
186
  return __generator(this, function (_a) {
90
- context.view.zoomToFitDrawing();
91
- return [2 /*return*/];
187
+ switch (_a.label) {
188
+ case 0:
189
+ centerPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.zoom.centerPoint'));
190
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(centerPrompt)];
191
+ case 1:
192
+ centerResult = _a.sent();
193
+ if (centerResult.status !== AcEdPromptStatus.OK || !centerResult.value)
194
+ return [2 /*return*/];
195
+ heightPrompt = new AcEdPromptStringOptions(AcApI18n.t('jig.zoom.heightOrScale'));
196
+ return [4 /*yield*/, AcApDocManager.instance.editor.getString(heightPrompt)];
197
+ case 2:
198
+ heightResult = _a.sent();
199
+ if (heightResult.status !== AcEdPromptStatus.OK ||
200
+ !heightResult.stringResult)
201
+ return [2 /*return*/];
202
+ parsedScale = this.parseScaleFactor(heightResult.stringResult);
203
+ if (parsedScale != null) {
204
+ this.applyRelativeScale(context, parsedScale, centerResult.value);
205
+ return [2 /*return*/];
206
+ }
207
+ viewHeight = Number(heightResult.stringResult);
208
+ if (!Number.isFinite(viewHeight) || viewHeight <= 0)
209
+ return [2 /*return*/];
210
+ aspect = context.view.width / Math.max(context.view.height, 1);
211
+ halfHeight = viewHeight / 2;
212
+ halfWidth = (viewHeight * aspect) / 2;
213
+ box = new AcGeBox2d()
214
+ .expandByPoint({
215
+ x: centerResult.value.x - halfWidth,
216
+ y: centerResult.value.y - halfHeight
217
+ })
218
+ .expandByPoint({
219
+ x: centerResult.value.x + halfWidth,
220
+ y: centerResult.value.y + halfHeight
221
+ });
222
+ this.rememberViewBeforeZoom(context);
223
+ context.view.zoomTo(box, 1);
224
+ return [2 /*return*/];
225
+ }
226
+ });
227
+ });
228
+ };
229
+ /**
230
+ * Parses scale factor text from AutoCAD-like inputs:
231
+ * - `2` / `2x` / `2xp`
232
+ *
233
+ * @param raw - Raw user input.
234
+ * @returns Positive scale factor, or `undefined` when invalid.
235
+ */
236
+ AcApZoomCmd.prototype.parseScaleFactor = function (raw) {
237
+ var text = raw.trim().toLowerCase();
238
+ if (!text)
239
+ return undefined;
240
+ if (text.endsWith('xp')) {
241
+ var value_1 = Number(text.slice(0, -2));
242
+ return Number.isFinite(value_1) && value_1 > 0 ? value_1 : undefined;
243
+ }
244
+ if (text.endsWith('x')) {
245
+ var value_2 = Number(text.slice(0, -1));
246
+ return Number.isFinite(value_2) && value_2 > 0 ? value_2 : undefined;
247
+ }
248
+ var value = Number(text);
249
+ return Number.isFinite(value) && value > 0 ? value : undefined;
250
+ };
251
+ /**
252
+ * Applies relative zoom around the specified center (or current view center).
253
+ *
254
+ * @param context - Current command context.
255
+ * @param factor - Relative zoom factor (> 0).
256
+ * @param centerPoint - Optional explicit zoom center in WCS.
257
+ */
258
+ AcApZoomCmd.prototype.applyRelativeScale = function (context, factor, centerPoint) {
259
+ var current = this.captureCurrentViewBox(context);
260
+ var width = Math.max(current.max.x - current.min.x, 1e-9);
261
+ var height = Math.max(current.max.y - current.min.y, 1e-9);
262
+ var halfWidth = width / (2 * factor);
263
+ var halfHeight = height / (2 * factor);
264
+ var center = centerPoint !== null && centerPoint !== void 0 ? centerPoint : {
265
+ x: (current.min.x + current.max.x) / 2,
266
+ y: (current.min.y + current.max.y) / 2
267
+ };
268
+ var target = new AcGeBox2d()
269
+ .expandByPoint({ x: center.x - halfWidth, y: center.y - halfHeight })
270
+ .expandByPoint({ x: center.x + halfWidth, y: center.y + halfHeight });
271
+ this.rememberViewBeforeZoom(context);
272
+ context.view.zoomTo(target, 1);
273
+ };
274
+ /**
275
+ * Restores previous view box if one exists and swaps buffers to allow toggling.
276
+ *
277
+ * @param context - Current command context.
278
+ */
279
+ AcApZoomCmd.prototype.runPrevious = function (context) {
280
+ if (!AcApZoomCmd.previousViewBox)
281
+ return;
282
+ var current = this.captureCurrentViewBox(context);
283
+ context.view.zoomTo(AcApZoomCmd.previousViewBox, 1);
284
+ AcApZoomCmd.previousViewBox = current;
285
+ };
286
+ /**
287
+ * Runs zoom interaction with keyword-capable branching.
288
+ *
289
+ * @param context - Current command context.
290
+ */
291
+ AcApZoomCmd.prototype.execute = function (context) {
292
+ return __awaiter(this, void 0, void 0, function () {
293
+ var firstPrompt, firstResult, keyword, scalePrompt, scaleResult, factor;
294
+ var _a;
295
+ return __generator(this, function (_b) {
296
+ switch (_b.label) {
297
+ case 0:
298
+ firstPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.zoom.mainPrompt'));
299
+ firstPrompt.allowNone = true;
300
+ firstPrompt.keywords.add(AcApI18n.t('jig.zoom.keywords.all.display'), AcApI18n.t('jig.zoom.keywords.all.global'), AcApI18n.t('jig.zoom.keywords.all.local'));
301
+ firstPrompt.keywords.add(AcApI18n.t('jig.zoom.keywords.center.display'), AcApI18n.t('jig.zoom.keywords.center.global'), AcApI18n.t('jig.zoom.keywords.center.local'));
302
+ firstPrompt.keywords.add(AcApI18n.t('jig.zoom.keywords.extents.display'), AcApI18n.t('jig.zoom.keywords.extents.global'), AcApI18n.t('jig.zoom.keywords.extents.local'));
303
+ firstPrompt.keywords.add(AcApI18n.t('jig.zoom.keywords.previous.display'), AcApI18n.t('jig.zoom.keywords.previous.global'), AcApI18n.t('jig.zoom.keywords.previous.local'));
304
+ firstPrompt.keywords.add(AcApI18n.t('jig.zoom.keywords.scale.display'), AcApI18n.t('jig.zoom.keywords.scale.global'), AcApI18n.t('jig.zoom.keywords.scale.local'));
305
+ firstPrompt.keywords.add(AcApI18n.t('jig.zoom.keywords.window.display'), AcApI18n.t('jig.zoom.keywords.window.global'), AcApI18n.t('jig.zoom.keywords.window.local'));
306
+ return [4 /*yield*/, AcApDocManager.instance.editor.getPoint(firstPrompt)];
307
+ case 1:
308
+ firstResult = _b.sent();
309
+ if (firstResult.status === AcEdPromptStatus.None) {
310
+ this.zoomToExtents(context);
311
+ return [2 /*return*/];
312
+ }
313
+ if (!(firstResult.status === AcEdPromptStatus.OK && firstResult.value)) return [3 /*break*/, 3];
314
+ return [4 /*yield*/, this.promptAndZoomWindowFromFirstCorner(context, firstResult.value)];
315
+ case 2:
316
+ _b.sent();
317
+ return [2 /*return*/];
318
+ case 3:
319
+ if (firstResult.status !== AcEdPromptStatus.Keyword)
320
+ return [2 /*return*/];
321
+ keyword = (_a = firstResult.stringResult) !== null && _a !== void 0 ? _a : '';
322
+ if (keyword === 'All' || keyword === 'Extents') {
323
+ this.zoomToExtents(context);
324
+ return [2 /*return*/];
325
+ }
326
+ if (!(keyword === 'Window')) return [3 /*break*/, 5];
327
+ return [4 /*yield*/, this.promptAndZoomWindowByBox(context)];
328
+ case 4:
329
+ _b.sent();
330
+ return [2 /*return*/];
331
+ case 5:
332
+ if (!(keyword === 'Center')) return [3 /*break*/, 7];
333
+ return [4 /*yield*/, this.runCenter(context)];
334
+ case 6:
335
+ _b.sent();
336
+ return [2 /*return*/];
337
+ case 7:
338
+ if (!(keyword === 'Scale')) return [3 /*break*/, 9];
339
+ scalePrompt = new AcEdPromptStringOptions(AcApI18n.t('jig.zoom.scaleFactor'));
340
+ return [4 /*yield*/, AcApDocManager.instance.editor.getString(scalePrompt)];
341
+ case 8:
342
+ scaleResult = _b.sent();
343
+ if (scaleResult.status !== AcEdPromptStatus.OK ||
344
+ !scaleResult.stringResult)
345
+ return [2 /*return*/];
346
+ factor = this.parseScaleFactor(scaleResult.stringResult);
347
+ if (factor == null)
348
+ return [2 /*return*/];
349
+ this.applyRelativeScale(context, factor);
350
+ return [2 /*return*/];
351
+ case 9:
352
+ if (keyword === 'Previous') {
353
+ this.runPrevious(context);
354
+ }
355
+ return [2 /*return*/];
356
+ }
92
357
  });
93
358
  });
94
359
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AcApZoomCmd.js","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAAiC,+BAAW;IAA5C;;IAYA,CAAC;IAXC;;;;;;;OAOG;IACG,6BAAO,GAAb,UAAc,OAAoB;;;gBAChC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAA;;;;KAChC;IACH,kBAAC;AAAD,CAAC,AAZD,CAAiC,WAAW,GAY3C"}
1
+ {"version":3,"file":"AcApZoomCmd.js","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names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AC,CAAA;wBAC9D,IAAI,MAAM,IAAI,IAAI;4BAAE,sBAAM;wBAC1B,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;wBACxC,sBAAM;;wBAER,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;4BAC3B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;wBAC3B,CAAC;;;;;KACF;IACH,kBAAC;AAAD,CAAC,AAhTD,CAAiC,WAAW,GAgT3C"}
@@ -4,18 +4,24 @@ export * from './AcApArcCmd';
4
4
  export * from './AcApBaseRevCmd';
5
5
  export * from './AcApCircleCmd';
6
6
  export * from './AcApConvertToDxfCmd';
7
+ export * from './AcApConvertToPngCmd';
8
+ export * from './AcApPngConvertor';
7
9
  export * from './AcApConvertToSvgCmd';
8
10
  export * from './AcApDimLinearCmd';
9
11
  export * from './AcApDxfConvertor';
12
+ export * from './AcApEllipseCmd';
10
13
  export * from './AcApClearMeasurementsCmd';
11
14
  export * from './AcApMeasureAngleCmd';
12
15
  export * from './AcApMeasureAreaCmd';
13
16
  export * from './AcApMeasureArcCmd';
14
17
  export * from './AcApMeasureDistanceCmd';
15
18
  export * from './AcApEraseCmd';
19
+ export * from './AcApHatchCmd';
16
20
  export * from './AcApLineCmd';
17
21
  export * from './AcApLogCmd';
18
22
  export * from './AcApMTextCmd';
23
+ export * from './AcApMoveCmd';
24
+ export * from './AcApLayerCmd';
19
25
  export * from './AcApOpenCmd';
20
26
  export * from './AcApQNewCmd';
21
27
  export * from './AcApRectCmd';
@@ -29,8 +35,8 @@ export * from './AcApSketchCmd';
29
35
  export * from './AcApSysVarCmd';
30
36
  export * from './AcApSwitchBgCmd';
31
37
  export * from './AcApZoomCmd';
32
- export * from './AcApZoomToBoxCmd';
33
38
  export * from './AcApPanCmd';
39
+ export * from './AcApPolygonCmd';
34
40
  export * from './AcApPolylineCmd';
35
41
  export * from './AcApSplineCmd';
36
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA"}
@@ -4,18 +4,24 @@ export * from './AcApArcCmd';
4
4
  export * from './AcApBaseRevCmd';
5
5
  export * from './AcApCircleCmd';
6
6
  export * from './AcApConvertToDxfCmd';
7
+ export * from './AcApConvertToPngCmd';
8
+ export * from './AcApPngConvertor';
7
9
  export * from './AcApConvertToSvgCmd';
8
10
  export * from './AcApDimLinearCmd';
9
11
  export * from './AcApDxfConvertor';
12
+ export * from './AcApEllipseCmd';
10
13
  export * from './AcApClearMeasurementsCmd';
11
14
  export * from './AcApMeasureAngleCmd';
12
15
  export * from './AcApMeasureAreaCmd';
13
16
  export * from './AcApMeasureArcCmd';
14
17
  export * from './AcApMeasureDistanceCmd';
15
18
  export * from './AcApEraseCmd';
19
+ export * from './AcApHatchCmd';
16
20
  export * from './AcApLineCmd';
17
21
  export * from './AcApLogCmd';
18
22
  export * from './AcApMTextCmd';
23
+ export * from './AcApMoveCmd';
24
+ export * from './AcApLayerCmd';
19
25
  export * from './AcApOpenCmd';
20
26
  export * from './AcApQNewCmd';
21
27
  export * from './AcApRectCmd';
@@ -29,8 +35,8 @@ export * from './AcApSketchCmd';
29
35
  export * from './AcApSysVarCmd';
30
36
  export * from './AcApSwitchBgCmd';
31
37
  export * from './AcApZoomCmd';
32
- export * from './AcApZoomToBoxCmd';
33
38
  export * from './AcApPanCmd';
39
+ export * from './AcApPolygonCmd';
34
40
  export * from './AcApPolylineCmd';
35
41
  export * from './AcApSplineCmd';
36
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,e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,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA"}
@@ -12,6 +12,21 @@ export interface AcEdCommandGroup {
12
12
  commandsByGlobalName: Map<string, AcEdCommand>;
13
13
  /** Map of commands indexed by their local names */
14
14
  commandsByLocalName: Map<string, AcEdCommand>;
15
+ /**
16
+ * Map of commands indexed by alias names.
17
+ *
18
+ * Key is normalized alias (uppercase), value is the registered command object.
19
+ * Used for direct lookup by alias and conflict checks during registration.
20
+ */
21
+ commandsByAlias: Map<string, AcEdCommand>;
22
+ /**
23
+ * Reverse index of aliases by command instance.
24
+ *
25
+ * This map allows:
26
+ * - Efficient cleanup of all aliases when a command is removed
27
+ * - Efficient alias listing in command UI (auto-complete display)
28
+ */
29
+ aliasesByCommand: Map<AcEdCommand, Set<string>>;
15
30
  }
16
31
  /**
17
32
  * The class to create, define, and register command objects.
@@ -50,6 +65,8 @@ export declare class AcEdCommandStack {
50
65
  * @param cmdGlobalName - The global (untranslated) name of the command. Must be unique within the group.
51
66
  * @param cmdLocalName - The local (translated) name of the command. Defaults to global name if empty.
52
67
  * @param cmd - The command object to add to the stack.
68
+ * @param cmdAlias - Optional command alias or alias list. Aliases are case-insensitive and
69
+ * normalized to uppercase during registration.
53
70
  *
54
71
  * @throws {Error} When the global name is empty or when a command with the same name already exists
55
72
  *
@@ -58,7 +75,7 @@ export declare class AcEdCommandStack {
58
75
  * commandStack.addCommand('USER', 'LINE', 'ligne', new LineCommand());
59
76
  * ```
60
77
  */
61
- addCommand(cmdGroupName: string, cmdGlobalName: string, cmdLocalName: string, cmd: AcEdCommand): void;
78
+ addCommand(cmdGroupName: string, cmdGlobalName: string, cmdLocalName: string, cmd: AcEdCommand, cmdAlias?: string | string[]): void;
62
79
  /**
63
80
  * Return an iterator that can be used to traverse all of command objects in this command stack
64
81
  * (that is, the iterator iterates through all commands in all groups).
@@ -141,6 +158,42 @@ export declare class AcEdCommandStack {
141
158
  * Removes all of registered commands
142
159
  */
143
160
  removeAll(): void;
161
+ /**
162
+ * Gets all aliases of the specified command in a command group.
163
+ *
164
+ * @param command - Target command object
165
+ * @param commandGroupName - Optional command group name. If omitted, the first matching group is used.
166
+ * @returns Alias list in registration order
167
+ */
168
+ getCommandAliases(command: AcEdCommand, commandGroupName?: string): string[];
169
+ /**
170
+ * Checks whether any alias of the given command starts with the input prefix.
171
+ *
172
+ * This helper is used by prefix search so alias names can participate in
173
+ * command auto-complete matching together with global/local command names.
174
+ *
175
+ * @param commandGroupName - Name of the command group containing the command
176
+ * @param command - Command instance whose aliases are inspected
177
+ * @param prefix - Uppercase prefix to match
178
+ * @returns True if any alias starts with the prefix
179
+ */
180
+ private commandAliasStartsWith;
181
+ /**
182
+ * Normalizes raw alias input into a validated alias list for registration.
183
+ *
184
+ * Processing rules:
185
+ * - Accepts one alias string or a list of alias strings.
186
+ * - Trims whitespace and converts aliases to uppercase.
187
+ * - Removes empty aliases.
188
+ * - Removes aliases that are identical to command global/local names.
189
+ * - Removes duplicates while preserving insertion order.
190
+ *
191
+ * @param aliases - Raw alias input from caller
192
+ * @param cmdGlobalName - Command global name in uppercase
193
+ * @param cmdLocalName - Command local name in uppercase
194
+ * @returns Normalized alias list
195
+ */
196
+ private normalizeAliases;
144
197
  /**
145
198
  * Checks if a document mode is compatible with a command's required mode.
146
199
  *