@mlightcad/cad-simple-viewer 1.2.2 → 1.2.3

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 (202) hide show
  1. package/dist/__vite-browser-external-l0sNRNKZ-l0sNRNKZ.js +1 -0
  2. package/dist/index.js +40205 -0
  3. package/dist/index.umd.cjs +333 -0
  4. package/dist/libredwg-parser-worker.js +15458 -0
  5. package/dist/mtext-renderer-worker.js +29930 -0
  6. package/lib/app/AcApContext.d.ts +57 -0
  7. package/lib/app/AcApContext.d.ts.map +1 -0
  8. package/lib/app/AcApContext.js +106 -0
  9. package/lib/app/AcApContext.js.map +1 -0
  10. package/lib/app/AcApDocManager.d.ts +291 -0
  11. package/lib/app/AcApDocManager.d.ts.map +1 -0
  12. package/lib/app/AcApDocManager.js +498 -0
  13. package/lib/app/AcApDocManager.js.map +1 -0
  14. package/lib/app/AcApDocument.d.ts +101 -0
  15. package/lib/app/AcApDocument.d.ts.map +1 -0
  16. package/lib/app/AcApDocument.js +237 -0
  17. package/lib/app/AcApDocument.js.map +1 -0
  18. package/lib/app/AcApFontLoader.d.ts +54 -0
  19. package/lib/app/AcApFontLoader.d.ts.map +1 -0
  20. package/lib/app/AcApFontLoader.js +151 -0
  21. package/lib/app/AcApFontLoader.js.map +1 -0
  22. package/lib/app/AcApGlobalFunc.d.ts +26 -0
  23. package/lib/app/AcApGlobalFunc.d.ts.map +1 -0
  24. package/lib/app/AcApGlobalFunc.js +66 -0
  25. package/lib/app/AcApGlobalFunc.js.map +1 -0
  26. package/lib/app/AcApSettingManager.d.ts +232 -0
  27. package/lib/app/AcApSettingManager.d.ts.map +1 -0
  28. package/lib/app/AcApSettingManager.js +283 -0
  29. package/lib/app/AcApSettingManager.js.map +1 -0
  30. package/lib/app/index.d.ts +6 -0
  31. package/lib/app/index.d.ts.map +1 -0
  32. package/lib/app/index.js +6 -0
  33. package/lib/app/index.js.map +1 -0
  34. package/lib/command/AcApConvertToSvgCmd.d.ts +32 -0
  35. package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
  36. package/lib/command/AcApConvertToSvgCmd.js +56 -0
  37. package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
  38. package/lib/command/AcApOpenCmd.d.ts +37 -0
  39. package/lib/command/AcApOpenCmd.d.ts.map +1 -0
  40. package/lib/command/AcApOpenCmd.js +60 -0
  41. package/lib/command/AcApOpenCmd.js.map +1 -0
  42. package/lib/command/AcApPanCmd.d.ts +31 -0
  43. package/lib/command/AcApPanCmd.d.ts.map +1 -0
  44. package/lib/command/AcApPanCmd.js +55 -0
  45. package/lib/command/AcApPanCmd.js.map +1 -0
  46. package/lib/command/AcApQNewCmd.d.ts +32 -0
  47. package/lib/command/AcApQNewCmd.d.ts.map +1 -0
  48. package/lib/command/AcApQNewCmd.js +56 -0
  49. package/lib/command/AcApQNewCmd.js.map +1 -0
  50. package/lib/command/AcApRegenCmd.d.ts +21 -0
  51. package/lib/command/AcApRegenCmd.d.ts.map +1 -0
  52. package/lib/command/AcApRegenCmd.js +45 -0
  53. package/lib/command/AcApRegenCmd.js.map +1 -0
  54. package/lib/command/AcApSelectCmd.d.ts +32 -0
  55. package/lib/command/AcApSelectCmd.d.ts.map +1 -0
  56. package/lib/command/AcApSelectCmd.js +56 -0
  57. package/lib/command/AcApSelectCmd.js.map +1 -0
  58. package/lib/command/AcApSvgConvertor.d.ts +53 -0
  59. package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
  60. package/lib/command/AcApSvgConvertor.js +103 -0
  61. package/lib/command/AcApSvgConvertor.js.map +1 -0
  62. package/lib/command/AcApZoomCmd.d.ts +35 -0
  63. package/lib/command/AcApZoomCmd.d.ts.map +1 -0
  64. package/lib/command/AcApZoomCmd.js +57 -0
  65. package/lib/command/AcApZoomCmd.js.map +1 -0
  66. package/lib/command/AcApZoomToBoxCmd.d.ts +68 -0
  67. package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
  68. package/lib/command/AcApZoomToBoxCmd.js +158 -0
  69. package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
  70. package/lib/command/index.d.ts +11 -0
  71. package/lib/command/index.d.ts.map +1 -0
  72. package/lib/command/index.js +11 -0
  73. package/lib/command/index.js.map +1 -0
  74. package/lib/editor/command/AcEdCommand.d.ts +151 -0
  75. package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
  76. package/lib/editor/command/AcEdCommand.js +164 -0
  77. package/lib/editor/command/AcEdCommand.js.map +1 -0
  78. package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
  79. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
  80. package/lib/editor/command/AcEdCommandIterator.js +65 -0
  81. package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
  82. package/lib/editor/command/AcEdCommandStack.d.ts +120 -0
  83. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
  84. package/lib/editor/command/AcEdCommandStack.js +235 -0
  85. package/lib/editor/command/AcEdCommandStack.js.map +1 -0
  86. package/lib/editor/command/index.d.ts +3 -0
  87. package/lib/editor/command/index.d.ts.map +1 -0
  88. package/lib/editor/command/index.js +3 -0
  89. package/lib/editor/command/index.js.map +1 -0
  90. package/lib/editor/global/AcEdConditionWaiter.d.ts +51 -0
  91. package/lib/editor/global/AcEdConditionWaiter.d.ts.map +1 -0
  92. package/lib/editor/global/AcEdConditionWaiter.js +87 -0
  93. package/lib/editor/global/AcEdConditionWaiter.js.map +1 -0
  94. package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
  95. package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
  96. package/lib/editor/global/AcEdGlobalFunc.js +14 -0
  97. package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
  98. package/lib/editor/global/AcEdMessage.d.ts +5 -0
  99. package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
  100. package/lib/editor/global/AcEdMessage.js +6 -0
  101. package/lib/editor/global/AcEdMessage.js.map +1 -0
  102. package/lib/editor/global/eventBus.d.ts +103 -0
  103. package/lib/editor/global/eventBus.d.ts.map +1 -0
  104. package/lib/editor/global/eventBus.js +41 -0
  105. package/lib/editor/global/eventBus.js.map +1 -0
  106. package/lib/editor/global/index.d.ts +4 -0
  107. package/lib/editor/global/index.d.ts.map +1 -0
  108. package/lib/editor/global/index.js +4 -0
  109. package/lib/editor/global/index.js.map +1 -0
  110. package/lib/editor/index.d.ts +5 -0
  111. package/lib/editor/index.d.ts.map +1 -0
  112. package/lib/editor/index.js +5 -0
  113. package/lib/editor/index.js.map +1 -0
  114. package/lib/editor/input/AcEdBaseInput.d.ts +89 -0
  115. package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
  116. package/lib/editor/input/AcEdBaseInput.js +166 -0
  117. package/lib/editor/input/AcEdBaseInput.js.map +1 -0
  118. package/lib/editor/input/AcEdBoxSelector.d.ts +108 -0
  119. package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
  120. package/lib/editor/input/AcEdBoxSelector.js +220 -0
  121. package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
  122. package/lib/editor/input/AcEdCursorManager.d.ts +130 -0
  123. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
  124. package/lib/editor/input/AcEdCursorManager.js +155 -0
  125. package/lib/editor/input/AcEdCursorManager.js.map +1 -0
  126. package/lib/editor/input/AcEdInputPoint.d.ts +51 -0
  127. package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
  128. package/lib/editor/input/AcEdInputPoint.js +78 -0
  129. package/lib/editor/input/AcEdInputPoint.js.map +1 -0
  130. package/lib/editor/input/AcEdJig.d.ts +180 -0
  131. package/lib/editor/input/AcEdJig.d.ts.map +1 -0
  132. package/lib/editor/input/AcEdJig.js +256 -0
  133. package/lib/editor/input/AcEdJig.js.map +1 -0
  134. package/lib/editor/input/AcEdJigLoop.d.ts +63 -0
  135. package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
  136. package/lib/editor/input/AcEdJigLoop.js +91 -0
  137. package/lib/editor/input/AcEdJigLoop.js.map +1 -0
  138. package/lib/editor/input/AcEdSelectionSet.d.ts +146 -0
  139. package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
  140. package/lib/editor/input/AcEdSelectionSet.js +179 -0
  141. package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
  142. package/lib/editor/input/AcEditor.d.ts +111 -0
  143. package/lib/editor/input/AcEditor.d.ts.map +1 -0
  144. package/lib/editor/input/AcEditor.js +183 -0
  145. package/lib/editor/input/AcEditor.js.map +1 -0
  146. package/lib/editor/input/index.d.ts +5 -0
  147. package/lib/editor/input/index.d.ts.map +1 -0
  148. package/lib/editor/input/index.js +5 -0
  149. package/lib/editor/input/index.js.map +1 -0
  150. package/lib/editor/view/AcEdBaseView.d.ts +457 -0
  151. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
  152. package/lib/editor/view/AcEdBaseView.js +349 -0
  153. package/lib/editor/view/AcEdBaseView.js.map +1 -0
  154. package/lib/editor/view/AcEdLayerInfo.d.ts +21 -0
  155. package/lib/editor/view/AcEdLayerInfo.d.ts.map +1 -0
  156. package/lib/editor/view/AcEdLayerInfo.js +2 -0
  157. package/lib/editor/view/AcEdLayerInfo.js.map +1 -0
  158. package/lib/editor/view/index.d.ts +3 -0
  159. package/lib/editor/view/index.d.ts.map +1 -0
  160. package/lib/editor/view/index.js +3 -0
  161. package/lib/editor/view/index.js.map +1 -0
  162. package/lib/index.d.ts +5 -0
  163. package/lib/index.d.ts.map +1 -0
  164. package/lib/index.js +5 -0
  165. package/lib/index.js.map +1 -0
  166. package/lib/util/AcTrGeometryUtil.d.ts +92 -0
  167. package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
  168. package/lib/util/AcTrGeometryUtil.js +109 -0
  169. package/lib/util/AcTrGeometryUtil.js.map +1 -0
  170. package/lib/util/index.d.ts +2 -0
  171. package/lib/util/index.d.ts.map +1 -0
  172. package/lib/util/index.js +2 -0
  173. package/lib/util/index.js.map +1 -0
  174. package/lib/view/AcTrLayer.d.ts +132 -0
  175. package/lib/view/AcTrLayer.d.ts.map +1 -0
  176. package/lib/view/AcTrLayer.js +199 -0
  177. package/lib/view/AcTrLayer.js.map +1 -0
  178. package/lib/view/AcTrLayout.d.ts +218 -0
  179. package/lib/view/AcTrLayout.d.ts.map +1 -0
  180. package/lib/view/AcTrLayout.js +437 -0
  181. package/lib/view/AcTrLayout.js.map +1 -0
  182. package/lib/view/AcTrLayoutView.d.ts +115 -0
  183. package/lib/view/AcTrLayoutView.d.ts.map +1 -0
  184. package/lib/view/AcTrLayoutView.js +200 -0
  185. package/lib/view/AcTrLayoutView.js.map +1 -0
  186. package/lib/view/AcTrLayoutViewManager.d.ts +89 -0
  187. package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
  188. package/lib/view/AcTrLayoutViewManager.js +118 -0
  189. package/lib/view/AcTrLayoutViewManager.js.map +1 -0
  190. package/lib/view/AcTrScene.d.ts +162 -0
  191. package/lib/view/AcTrScene.d.ts.map +1 -0
  192. package/lib/view/AcTrScene.js +370 -0
  193. package/lib/view/AcTrScene.js.map +1 -0
  194. package/lib/view/AcTrView2d.d.ts +262 -0
  195. package/lib/view/AcTrView2d.d.ts.map +1 -0
  196. package/lib/view/AcTrView2d.js +772 -0
  197. package/lib/view/AcTrView2d.js.map +1 -0
  198. package/lib/view/index.d.ts +2 -0
  199. package/lib/view/index.d.ts.map +1 -0
  200. package/lib/view/index.js +2 -0
  201. package/lib/view/index.js.map +1 -0
  202. package/package.json +3 -3
@@ -0,0 +1,36 @@
1
+ import { AcEdCommand } from './AcEdCommand';
2
+ import { AcEdCommandGroup } from './AcEdCommandStack';
3
+ /**
4
+ * Represents the type of item returned by command iterator.
5
+ */
6
+ export interface AcEdCommandIteratorItem {
7
+ commandGroup: string;
8
+ command: AcEdCommand;
9
+ }
10
+ /**
11
+ * This class allows you to traverse the chain of command groups that are registered with AutoCAD and
12
+ * obtain information about the groups and the AcEdCommand objects within them.
13
+ */
14
+ export declare class AcEdCommandIterator implements IterableIterator<AcEdCommandIteratorItem> {
15
+ private _index;
16
+ private _commands;
17
+ constructor(commandGroups: AcEdCommandGroup[]);
18
+ [Symbol.iterator](): IterableIterator<AcEdCommandIteratorItem>;
19
+ /**
20
+ * Return command object the iterator currently points to. If the iterator is at the beginning, then the
21
+ * first object is returned. If the iterator has already gone past the last entry, then null is returned.
22
+ */
23
+ get command(): AcEdCommand | null;
24
+ /**
25
+ * Return the name of the command object the iterator currently points to. If the iterator is at the
26
+ * beginning, then the first object is returned. If the iterator has already gone past the last entry,
27
+ * then null is returned.
28
+ */
29
+ get commandGroup(): string | null;
30
+ /**
31
+ * Increment the iterator to the next entry.
32
+ * @returns Return the next entry
33
+ */
34
+ next(): IteratorResult<AcEdCommandIteratorItem, null>;
35
+ }
36
+ //# sourceMappingURL=AcEdCommandIterator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdCommandIterator.d.ts","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandIterator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,WAAW,CAAA;CACrB;AACD;;;GAGG;AACH,qBAAa,mBACX,YAAW,gBAAgB,CAAC,uBAAuB,CAAC;IAEpD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,SAAS,CAA2B;gBAEhC,aAAa,EAAE,gBAAgB,EAAE;IAc7C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,uBAAuB,CAAC;IAI9D;;;OAGG;IACH,IAAI,OAAO,uBAIV;IAED;;;;OAIG;IACH,IAAI,YAAY,kBAIf;IAED;;;OAGG;IACH,IAAI,IAAI,cAAc,CAAC,uBAAuB,EAAE,IAAI,CAAC;CAQtD"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * This class allows you to traverse the chain of command groups that are registered with AutoCAD and
3
+ * obtain information about the groups and the AcEdCommand objects within them.
4
+ */
5
+ var AcEdCommandIterator = /** @class */ (function () {
6
+ function AcEdCommandIterator(commandGroups) {
7
+ var _this = this;
8
+ this._index = 0;
9
+ this._commands = [];
10
+ commandGroups.forEach(function (group) {
11
+ var commandGroup = group.groupName;
12
+ group.commandsByGlobalName.forEach(function (command) {
13
+ _this._commands.push({
14
+ command: command,
15
+ commandGroup: commandGroup
16
+ });
17
+ });
18
+ });
19
+ }
20
+ AcEdCommandIterator.prototype[Symbol.iterator] = function () {
21
+ return this;
22
+ };
23
+ Object.defineProperty(AcEdCommandIterator.prototype, "command", {
24
+ /**
25
+ * Return command object the iterator currently points to. If the iterator is at the beginning, then the
26
+ * first object is returned. If the iterator has already gone past the last entry, then null is returned.
27
+ */
28
+ get: function () {
29
+ return this._index < this._commands.length
30
+ ? this._commands[this._index].command
31
+ : null;
32
+ },
33
+ enumerable: false,
34
+ configurable: true
35
+ });
36
+ Object.defineProperty(AcEdCommandIterator.prototype, "commandGroup", {
37
+ /**
38
+ * Return the name of the command object the iterator currently points to. If the iterator is at the
39
+ * beginning, then the first object is returned. If the iterator has already gone past the last entry,
40
+ * then null is returned.
41
+ */
42
+ get: function () {
43
+ return this._index < this._commands.length
44
+ ? this._commands[this._index].commandGroup
45
+ : null;
46
+ },
47
+ enumerable: false,
48
+ configurable: true
49
+ });
50
+ /**
51
+ * Increment the iterator to the next entry.
52
+ * @returns Return the next entry
53
+ */
54
+ AcEdCommandIterator.prototype.next = function () {
55
+ while (this._index < this._commands.length) {
56
+ var value = this._commands[this._index];
57
+ this._index += 1;
58
+ return { value: value, done: false };
59
+ }
60
+ return { value: null, done: true };
61
+ };
62
+ return AcEdCommandIterator;
63
+ }());
64
+ export { AcEdCommandIterator };
65
+ //# sourceMappingURL=AcEdCommandIterator.js.map
@@ -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AI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACzC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA;YAChB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QACtC,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IACpC,CAAC;IACH,0BAAC;AAAD,CAAC,AAzDD,IAyDC"}
@@ -0,0 +1,120 @@
1
+ import { AcEdCommand } from './AcEdCommand';
2
+ import { AcEdCommandIterator } from './AcEdCommandIterator';
3
+ /**
4
+ * Interface representing a command group in the command stack.
5
+ * Groups commands by name and provides maps for both global and local command lookups.
6
+ */
7
+ export interface AcEdCommandGroup {
8
+ /** The name of the command group */
9
+ groupName: string;
10
+ /** Map of commands indexed by their global names */
11
+ commandsByGlobalName: Map<string, AcEdCommand>;
12
+ /** Map of commands indexed by their local names */
13
+ commandsByLocalName: Map<string, AcEdCommand>;
14
+ }
15
+ /**
16
+ * The class to create, define, and register command objects.
17
+ *
18
+ * This is a singleton class that manages all command registration and lookup functionality.
19
+ * Commands are organized into groups, with system commands (ACAD) and user commands (USER)
20
+ * being the default groups.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const commandStack = AcEdCommandStack.instance;
25
+ * commandStack.addCommand('USER', 'MYCOMMAND', 'MYCOMMAND', myCommandInstance);
26
+ * const command = commandStack.lookupGlobalCmd('MYCOMMAND');
27
+ * ```
28
+ */
29
+ export declare class AcEdCommandStack {
30
+ /** The name of the system command group */
31
+ static SYSTEMT_COMMAND_GROUP_NAME: string;
32
+ /** The name of the default user command group */
33
+ static DEFAUT_COMMAND_GROUP_NAME: string;
34
+ /** Array of all command groups in the stack */
35
+ private _commandsByGroup;
36
+ /** Reference to the system command group */
37
+ private _systemCommandGroup;
38
+ /** Reference to the default user command group */
39
+ private _defaultCommandGroup;
40
+ /** Singleton instance of the command stack */
41
+ private static _instance?;
42
+ /**
43
+ * Private constructor to enforce singleton pattern.
44
+ * Initializes the command stack with system and default command groups.
45
+ */
46
+ private constructor();
47
+ /**
48
+ * Gets the singleton instance of the command stack.
49
+ * Creates a new instance if one doesn't exist.
50
+ *
51
+ * @returns The singleton instance of AcEdCommandStack
52
+ */
53
+ static get instance(): AcEdCommandStack;
54
+ /**
55
+ * Adds a command to the specified command group.
56
+ *
57
+ * @param cmdGroupName - The name of the command group. If empty, uses the default group.
58
+ * @param cmdGlobalName - The global (untranslated) name of the command. Must be unique within the group.
59
+ * @param cmdLocalName - The local (translated) name of the command. Defaults to global name if empty.
60
+ * @param cmd - The command object to add to the stack.
61
+ *
62
+ * @throws {Error} When the global name is empty or when a command with the same name already exists
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * commandStack.addCommand('USER', 'LINE', 'ligne', new LineCommand());
67
+ * ```
68
+ */
69
+ addCommand(cmdGroupName: string, cmdGlobalName: string, cmdLocalName: string, cmd: AcEdCommand): void;
70
+ /**
71
+ * Return an iterator that can be used to traverse all of command objects in this command stack
72
+ * (that is, the iterator iterates through all commands in all groups).
73
+ *
74
+ * @returns Return an iterator that can be used to traverse all of command objects in this command
75
+ * stack.
76
+ */
77
+ iterator(): AcEdCommandIterator;
78
+ /**
79
+ * Search through all of the global and untranslated names in all of the command groups in the command
80
+ * stack starting at the top of the stack trying to find a match with cmdName. If a match is found, the
81
+ * matched AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command
82
+ * could not be found. If more than one command of the same name is present in the command stack (that
83
+ * is, in separate command groups), then the first one found is used.
84
+ *
85
+ * @param cmdName - Input the command name to search for
86
+ * @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
87
+ */
88
+ lookupGlobalCmd(cmdName: string): AcEdCommand | undefined;
89
+ /**
90
+ * Search through all of the local and translated names in all of the command groups in the command stack
91
+ * starting at the top of the stack trying to find a match with cmdName. If a match is found, the matched
92
+ * AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command could not
93
+ * be found. If more than one command of the same name is present in the command stack (that is, in
94
+ * separate command groups), then the first one found is used.
95
+ *
96
+ * @param cmdName - Input the command name to search for
97
+ * @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
98
+ */
99
+ lookupLocalCmd(cmdName: string): AcEdCommand | undefined;
100
+ /**
101
+ * Remove the command with the global and untranslated name `cmdGlobalName` from the `cmdGroupName`
102
+ * command group. Return true if successful. Return false if no command with the global and untranslated
103
+ * name `cmdGlobalName` is found in the `cmdGroupName` command group.
104
+ *
105
+ * @param cmdGroupName - Input the name of the command group containing the command to be removed
106
+ * @param cmdGlobalName - Input the command name which is to be removed from cmdGroupName
107
+ * @returns Return true if successful. Return false if no command with the global and untranslated
108
+ * name `cmdGlobalName` is found in the `cmdGroupName` command group.
109
+ */
110
+ removeCmd(cmdGroupName: string, cmdGlobalName: string): boolean;
111
+ /**
112
+ * Remove the command group with the name `GroupName` from the command stack and delete the command group
113
+ * dictionary object and all the AcEdCommand objects stored within it.
114
+ *
115
+ * @param groupName - Input the name of the command group to be removed from the command stack.
116
+ * @returns Return true if successful. Return false if no command group is found with the name `GroupName`.
117
+ */
118
+ removeGroup(groupName: string): boolean;
119
+ }
120
+ //# sourceMappingURL=AcEdCommandStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdCommandStack.d.ts","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IAC9C,mDAAmD;IACnD,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;CAC9C;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;IAC3B,2CAA2C;IAC3C,MAAM,CAAC,0BAA0B,SAAS;IAC1C,iDAAiD;IACjD,MAAM,CAAC,yBAAyB,SAAS;IAEzC,+CAA+C;IAC/C,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,4CAA4C;IAC5C,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,kDAAkD;IAClD,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,8CAA8C;IAC9C,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAkB;IAE3C;;;OAGG;IACH,OAAO;IAgBP;;;;;OAKG;IACH,MAAM,KAAK,QAAQ,qBAKlB;IAED;;;;;;;;;;;;;;OAcG;IACH,UAAU,CACR,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,WAAW;IA2ClB;;;;;;OAMG;IACH,QAAQ;IAIR;;;;;;;;;OASG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM;IAS/B;;;;;;;;;OASG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM;IAS9B;;;;;;;;;OASG;IACH,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IASrD;;;;;;OAMG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM;CAY9B"}
@@ -0,0 +1,235 @@
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 { AcEdCommandIterator } from './AcEdCommandIterator';
13
+ /**
14
+ * The class to create, define, and register command objects.
15
+ *
16
+ * This is a singleton class that manages all command registration and lookup functionality.
17
+ * Commands are organized into groups, with system commands (ACAD) and user commands (USER)
18
+ * being the default groups.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const commandStack = AcEdCommandStack.instance;
23
+ * commandStack.addCommand('USER', 'MYCOMMAND', 'MYCOMMAND', myCommandInstance);
24
+ * const command = commandStack.lookupGlobalCmd('MYCOMMAND');
25
+ * ```
26
+ */
27
+ var AcEdCommandStack = /** @class */ (function () {
28
+ /**
29
+ * Private constructor to enforce singleton pattern.
30
+ * Initializes the command stack with system and default command groups.
31
+ */
32
+ function AcEdCommandStack() {
33
+ this._commandsByGroup = [];
34
+ this._systemCommandGroup = {
35
+ groupName: AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME,
36
+ commandsByGlobalName: new Map(),
37
+ commandsByLocalName: new Map()
38
+ };
39
+ this._defaultCommandGroup = {
40
+ groupName: AcEdCommandStack.DEFAUT_COMMAND_GROUP_NAME,
41
+ commandsByGlobalName: new Map(),
42
+ commandsByLocalName: new Map()
43
+ };
44
+ this._commandsByGroup.push(this._systemCommandGroup);
45
+ this._commandsByGroup.push(this._defaultCommandGroup);
46
+ }
47
+ Object.defineProperty(AcEdCommandStack, "instance", {
48
+ /**
49
+ * Gets the singleton instance of the command stack.
50
+ * Creates a new instance if one doesn't exist.
51
+ *
52
+ * @returns The singleton instance of AcEdCommandStack
53
+ */
54
+ get: function () {
55
+ if (!AcEdCommandStack._instance) {
56
+ AcEdCommandStack._instance = new AcEdCommandStack();
57
+ }
58
+ return AcEdCommandStack._instance;
59
+ },
60
+ enumerable: false,
61
+ configurable: true
62
+ });
63
+ /**
64
+ * Adds a command to the specified command group.
65
+ *
66
+ * @param cmdGroupName - The name of the command group. If empty, uses the default group.
67
+ * @param cmdGlobalName - The global (untranslated) name of the command. Must be unique within the group.
68
+ * @param cmdLocalName - The local (translated) name of the command. Defaults to global name if empty.
69
+ * @param cmd - The command object to add to the stack.
70
+ *
71
+ * @throws {Error} When the global name is empty or when a command with the same name already exists
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * commandStack.addCommand('USER', 'LINE', 'ligne', new LineCommand());
76
+ * ```
77
+ */
78
+ AcEdCommandStack.prototype.addCommand = function (cmdGroupName, cmdGlobalName, cmdLocalName, cmd) {
79
+ if (!cmdGlobalName) {
80
+ throw new Error('[AcEdCommandStack] The global name of the command is required!');
81
+ }
82
+ if (!cmdLocalName) {
83
+ cmdLocalName = cmdGlobalName;
84
+ }
85
+ var commandGroup = this._defaultCommandGroup;
86
+ if (cmdGroupName) {
87
+ var tmp = this._commandsByGroup.find(function (value) { return value.groupName == cmdGroupName; });
88
+ if (!tmp) {
89
+ commandGroup = {
90
+ groupName: cmdGroupName,
91
+ commandsByGlobalName: new Map(),
92
+ commandsByLocalName: new Map()
93
+ };
94
+ }
95
+ else {
96
+ commandGroup = tmp;
97
+ }
98
+ }
99
+ if (commandGroup.commandsByGlobalName.has(cmdGlobalName)) {
100
+ throw new Error("[AcEdCommandStack] The command with global name '".concat(cmdGlobalName, "' already exists!"));
101
+ }
102
+ if (commandGroup.commandsByLocalName.has(cmdLocalName)) {
103
+ throw new Error("[AcEdCommandStack] The command with local name '".concat(cmdLocalName, "' already exists!"));
104
+ }
105
+ commandGroup.commandsByGlobalName.set(cmdGlobalName, cmd);
106
+ commandGroup.commandsByLocalName.set(cmdLocalName, cmd);
107
+ cmd.globalName = cmdGlobalName;
108
+ cmd.localName = cmdLocalName;
109
+ };
110
+ /**
111
+ * Return an iterator that can be used to traverse all of command objects in this command stack
112
+ * (that is, the iterator iterates through all commands in all groups).
113
+ *
114
+ * @returns Return an iterator that can be used to traverse all of command objects in this command
115
+ * stack.
116
+ */
117
+ AcEdCommandStack.prototype.iterator = function () {
118
+ return new AcEdCommandIterator(this._commandsByGroup);
119
+ };
120
+ /**
121
+ * Search through all of the global and untranslated names in all of the command groups in the command
122
+ * stack starting at the top of the stack trying to find a match with cmdName. If a match is found, the
123
+ * matched AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command
124
+ * could not be found. If more than one command of the same name is present in the command stack (that
125
+ * is, in separate command groups), then the first one found is used.
126
+ *
127
+ * @param cmdName - Input the command name to search for
128
+ * @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
129
+ */
130
+ AcEdCommandStack.prototype.lookupGlobalCmd = function (cmdName) {
131
+ var e_1, _a;
132
+ var result = undefined;
133
+ try {
134
+ for (var _b = __values(this._commandsByGroup), _c = _b.next(); !_c.done; _c = _b.next()) {
135
+ var group = _c.value;
136
+ result = group.commandsByGlobalName.get(cmdName);
137
+ if (result)
138
+ break;
139
+ }
140
+ }
141
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
142
+ finally {
143
+ try {
144
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
145
+ }
146
+ finally { if (e_1) throw e_1.error; }
147
+ }
148
+ return result;
149
+ };
150
+ /**
151
+ * Search through all of the local and translated names in all of the command groups in the command stack
152
+ * starting at the top of the stack trying to find a match with cmdName. If a match is found, the matched
153
+ * AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command could not
154
+ * be found. If more than one command of the same name is present in the command stack (that is, in
155
+ * separate command groups), then the first one found is used.
156
+ *
157
+ * @param cmdName - Input the command name to search for
158
+ * @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
159
+ */
160
+ AcEdCommandStack.prototype.lookupLocalCmd = function (cmdName) {
161
+ var e_2, _a;
162
+ var result = undefined;
163
+ try {
164
+ for (var _b = __values(this._commandsByGroup), _c = _b.next(); !_c.done; _c = _b.next()) {
165
+ var group = _c.value;
166
+ result = group.commandsByLocalName.get(cmdName);
167
+ if (result)
168
+ break;
169
+ }
170
+ }
171
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
172
+ finally {
173
+ try {
174
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
175
+ }
176
+ finally { if (e_2) throw e_2.error; }
177
+ }
178
+ return result;
179
+ };
180
+ /**
181
+ * Remove the command with the global and untranslated name `cmdGlobalName` from the `cmdGroupName`
182
+ * command group. Return true if successful. Return false if no command with the global and untranslated
183
+ * name `cmdGlobalName` is found in the `cmdGroupName` command group.
184
+ *
185
+ * @param cmdGroupName - Input the name of the command group containing the command to be removed
186
+ * @param cmdGlobalName - Input the command name which is to be removed from cmdGroupName
187
+ * @returns Return true if successful. Return false if no command with the global and untranslated
188
+ * name `cmdGlobalName` is found in the `cmdGroupName` command group.
189
+ */
190
+ AcEdCommandStack.prototype.removeCmd = function (cmdGroupName, cmdGlobalName) {
191
+ var e_3, _a;
192
+ try {
193
+ for (var _b = __values(this._commandsByGroup), _c = _b.next(); !_c.done; _c = _b.next()) {
194
+ var group = _c.value;
195
+ if (group.groupName == cmdGroupName) {
196
+ return group.commandsByGlobalName.delete(cmdGlobalName);
197
+ }
198
+ }
199
+ }
200
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
201
+ finally {
202
+ try {
203
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
204
+ }
205
+ finally { if (e_3) throw e_3.error; }
206
+ }
207
+ return false;
208
+ };
209
+ /**
210
+ * Remove the command group with the name `GroupName` from the command stack and delete the command group
211
+ * dictionary object and all the AcEdCommand objects stored within it.
212
+ *
213
+ * @param groupName - Input the name of the command group to be removed from the command stack.
214
+ * @returns Return true if successful. Return false if no command group is found with the name `GroupName`.
215
+ */
216
+ AcEdCommandStack.prototype.removeGroup = function (groupName) {
217
+ var tmp = -1;
218
+ this._commandsByGroup.some(function (group, index) {
219
+ tmp = index;
220
+ return group.groupName == groupName;
221
+ });
222
+ if (tmp >= 0) {
223
+ this._commandsByGroup.splice(tmp, 1);
224
+ return true;
225
+ }
226
+ return false;
227
+ };
228
+ /** The name of the system command group */
229
+ AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME = 'ACAD';
230
+ /** The name of the default user command group */
231
+ AcEdCommandStack.DEFAUT_COMMAND_GROUP_NAME = 'USER';
232
+ return AcEdCommandStack;
233
+ }());
234
+ export { AcEdCommandStack };
235
+ //# sourceMappingURL=AcEdCommandStack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdCommandStack.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandStack.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAe3D;;;;;;;;;;;;;GAaG;AACH;IAeE;;;OAGG;IACH;QACE,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;QAC1B,IAAI,CAAC,mBAAmB,GAAG;YACzB,SAAS,EAAE,gBAAgB,CAAC,0BAA0B;YACtD,oBAAoB,EAAE,IAAI,GAAG,EAAE;YAC/B,mBAAmB,EAAE,IAAI,GAAG,EAAE;SAC/B,CAAA;QACD,IAAI,CAAC,oBAAoB,GAAG;YAC1B,SAAS,EAAE,gBAAgB,CAAC,yBAAyB;YACrD,oBAAoB,EAAE,IAAI,GAAG,EAAE;YAC/B,mBAAmB,EAAE,IAAI,GAAG,EAAE;SAC/B,CAAA;QACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;QACpD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IACvD,CAAC;IAQD,sBAAW,4BAAQ;QANnB;;;;;WAKG;aACH;YACE,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC;gBAChC,gBAAgB,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAA;YACrD,CAAC;YACD,OAAO,gBAAgB,CAAC,SAAS,CAAA;QACnC,CAAC;;;OAAA;IAED;;;;;;;;;;;;;;OAcG;IACH,qCAAU,GAAV,UACE,YAAoB,EACpB,aAAqB,EACrB,YAAoB,EACpB,GAAgB;QAEhB,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,IAAI,CAAC,YA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AAO,KAAK,CAAC,SAAS,IAAI,SAAS,CAAA;QACrC,CAAC,CAAC,CAAA;QACF,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;YACpC,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAnMD,2CAA2C;IACpC,2CAA0B,GAAG,MAAM,CAAA;IAC1C,iDAAiD;IAC1C,0CAAyB,GAAG,MAAM,CAAA;IAiM3C,uBAAC;CAAA,AArMD,IAqMC;SArMY,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ export * from './AcEdCommand';
2
+ export * from './AcEdCommandStack';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './AcEdCommand';
2
+ export * from './AcEdCommandStack';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * A utility class that waits until a specified condition is met
3
+ * or a timeout occurs, and then executes a single action.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const waiter = new AcEdConditionWaiter(
8
+ * () => isDataReady(), // condition
9
+ * () => console.log('Ready or timed out'), // action
10
+ * 1000, // check every 1s
11
+ * 10000 // timeout after 10s
12
+ * );
13
+ *
14
+ * waiter.start();
15
+ * ```
16
+ */
17
+ export declare class AcEdConditionWaiter {
18
+ private readonly condition;
19
+ private readonly action;
20
+ private readonly checkInterval;
21
+ private readonly timeout;
22
+ private timerId;
23
+ private timeoutId;
24
+ /**
25
+ * Creates a new AcEdConditionWaiter.
26
+ *
27
+ * @param condition - The condition function to check periodically.
28
+ * @param action - The action to execute once when the condition is met or timeout occurs.
29
+ * @param checkInterval - How often (ms) to check the condition. Default: 1000 ms.
30
+ * @param timeout - Maximum time (ms) to wait before executing the action. Default: 0 (no timeout).
31
+ */
32
+ constructor(condition: () => boolean, action: () => void, checkInterval?: number, timeout?: number);
33
+ /**
34
+ * Starts checking the condition at the defined interval.
35
+ * Executes the action once when the condition becomes true or when timeout is reached.
36
+ */
37
+ start(): void;
38
+ /**
39
+ * Stops all checking without triggering the action.
40
+ */
41
+ stop(): void;
42
+ /**
43
+ * Internal helper to execute the action and stop all timers.
44
+ */
45
+ private executeAndStop;
46
+ /**
47
+ * Checks whether the waiter is currently active.
48
+ */
49
+ isRunning(): boolean;
50
+ }
51
+ //# sourceMappingURL=AcEdConditionWaiter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdConditionWaiter.d.ts","sourceRoot":"","sources":["../../../src/editor/global/AcEdConditionWaiter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,mBAAmB;IAa5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAf1B,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,SAAS,CAAsB;IAEvC;;;;;;;OAOG;gBAEgB,SAAS,EAAE,MAAM,OAAO,EACxB,MAAM,EAAE,MAAM,IAAI,EAClB,aAAa,GAAE,MAAa,EAC5B,OAAO,GAAE,MAAU;IAGtC;;;OAGG;IACI,KAAK,IAAI,IAAI;IAmBpB;;OAEG;IACI,IAAI,IAAI,IAAI;IAWnB;;OAEG;IACH,OAAO,CAAC,cAAc;IAKtB;;OAEG;IACI,SAAS,IAAI,OAAO;CAG5B"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * A utility class that waits until a specified condition is met
3
+ * or a timeout occurs, and then executes a single action.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const waiter = new AcEdConditionWaiter(
8
+ * () => isDataReady(), // condition
9
+ * () => console.log('Ready or timed out'), // action
10
+ * 1000, // check every 1s
11
+ * 10000 // timeout after 10s
12
+ * );
13
+ *
14
+ * waiter.start();
15
+ * ```
16
+ */
17
+ var AcEdConditionWaiter = /** @class */ (function () {
18
+ /**
19
+ * Creates a new AcEdConditionWaiter.
20
+ *
21
+ * @param condition - The condition function to check periodically.
22
+ * @param action - The action to execute once when the condition is met or timeout occurs.
23
+ * @param checkInterval - How often (ms) to check the condition. Default: 1000 ms.
24
+ * @param timeout - Maximum time (ms) to wait before executing the action. Default: 0 (no timeout).
25
+ */
26
+ function AcEdConditionWaiter(condition, action, checkInterval, timeout) {
27
+ if (checkInterval === void 0) { checkInterval = 1000; }
28
+ if (timeout === void 0) { timeout = 0; }
29
+ this.condition = condition;
30
+ this.action = action;
31
+ this.checkInterval = checkInterval;
32
+ this.timeout = timeout;
33
+ this.timerId = null;
34
+ this.timeoutId = null;
35
+ }
36
+ /**
37
+ * Starts checking the condition at the defined interval.
38
+ * Executes the action once when the condition becomes true or when timeout is reached.
39
+ */
40
+ AcEdConditionWaiter.prototype.start = function () {
41
+ var _this = this;
42
+ if (this.timerId !== null)
43
+ return; // already running
44
+ // Periodically check condition
45
+ this.timerId = window.setInterval(function () {
46
+ if (_this.condition()) {
47
+ _this.executeAndStop();
48
+ }
49
+ }, this.checkInterval);
50
+ // Setup timeout if provided
51
+ if (this.timeout > 0) {
52
+ this.timeoutId = window.setTimeout(function () {
53
+ console.warn('AcEdConditionWaiter: Timeout reached.');
54
+ _this.executeAndStop();
55
+ }, this.timeout);
56
+ }
57
+ };
58
+ /**
59
+ * Stops all checking without triggering the action.
60
+ */
61
+ AcEdConditionWaiter.prototype.stop = function () {
62
+ if (this.timerId !== null) {
63
+ clearInterval(this.timerId);
64
+ this.timerId = null;
65
+ }
66
+ if (this.timeoutId !== null) {
67
+ clearTimeout(this.timeoutId);
68
+ this.timeoutId = null;
69
+ }
70
+ };
71
+ /**
72
+ * Internal helper to execute the action and stop all timers.
73
+ */
74
+ AcEdConditionWaiter.prototype.executeAndStop = function () {
75
+ this.stop();
76
+ this.action();
77
+ };
78
+ /**
79
+ * Checks whether the waiter is currently active.
80
+ */
81
+ AcEdConditionWaiter.prototype.isRunning = function () {
82
+ return this.timerId !== null;
83
+ };
84
+ return AcEdConditionWaiter;
85
+ }());
86
+ export { AcEdConditionWaiter };
87
+ //# sourceMappingURL=AcEdConditionWaiter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdConditionWaiter.js","sourceRoot":"","sources":["../../../src/editor/global/AcEdConditionWaiter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH;IAIE;;;;;;;OAOG;IACH,6BACmB,SAAwB,EACxB,MAAkB,EAClB,aAA4B,EAC5B,OAAmB;QADnB,8BAAA,EAAA,oBAA4B;QAC5B,wBAAA,EAAA,WAAmB;QAHnB,cAAS,GAAT,SAAS,CAAe;QACxB,WAAM,GAAN,MAAM,CAAY;QAClB,kBAAa,GAAb,aAAa,CAAe;QAC5B,YAAO,GAAP,OAAO,CAAY;QAf9B,YAAO,GAAkB,IAAI,CAAA;QAC7B,cAAS,GAAkB,IAAI,CAAA;IAepC,CAAC;IAEJ;;;OAGG;IACI,mCAAK,GAAZ;QAAA,iBAiBC;QAhBC,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI;YAAE,OAAM,CAAC,kBAAkB;QAEpD,+BAA+B;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC;YAChC,IAAI,KAAI,CAAC,SAAS,EAAE,EAAE,CAAC;gBACrB,KAAI,CAAC,cAAc,EAAE,CAAA;YACvB,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;QAEtB,4BAA4B;QAC5B,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC;gBACjC,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAA;gBACrD,KAAI,CAAC,cAAc,EAAE,CAAA;YACvB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QAClB,CAAC;IACH,CAAC;IAED;;OAEG;IACI,kCAAI,GAAX;QACE,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC1B,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACrB,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;YAC5B,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QACvB,CAAC;IACH,CAAC;IAED;;OAEG;IACK,4CAAc,GAAtB;QACE,IAAI,CAAC,IAAI,EAAE,CAAA;QACX,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAED;;OAEG;IACI,uCAAS,GAAhB;QACE,OAAO,IAAI,CAAC,OAAO,KAAK,IAAI,CAAA;IAC9B,CAAC;IACH,0BAAC;AAAD,CAAC,AAtED,IAsEC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Display an error or warning message. In order to decouple UI from this module,
3
+ * this function justs trigger one 'message' event through event bus instead of
4
+ * showing one message directly. It is UI module's resposiblity to listen this event
5
+ * and show message.
6
+ */
7
+ export declare function acedAlert(message: string): void;
8
+ //# sourceMappingURL=AcEdGlobalFunc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcEdGlobalFunc.d.ts","sourceRoot":"","sources":["../../../src/editor/global/AcEdGlobalFunc.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,QAKxC"}