@mlightcad/cad-simple-viewer 1.0.0 → 1.0.1
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.
- package/README.md +296 -2
- package/dist/index.js +1347 -122
- package/dist/index.umd.cjs +2 -2
- package/lib/app/AcApContext.d.ts +45 -3
- package/lib/app/AcApContext.d.ts.map +1 -1
- package/lib/app/AcApContext.js +43 -3
- package/lib/app/AcApContext.js.map +1 -1
- package/lib/app/AcApDocCreator.d.ts +68 -2
- package/lib/app/AcApDocCreator.d.ts.map +1 -1
- package/lib/app/AcApDocCreator.js +67 -2
- package/lib/app/AcApDocCreator.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +227 -12
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +228 -17
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApDocument.d.ts +77 -3
- package/lib/app/AcApDocument.d.ts.map +1 -1
- package/lib/app/AcApDocument.js +75 -3
- package/lib/app/AcApDocument.js.map +1 -1
- package/lib/app/AcApFontLoader.d.ts +32 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -1
- package/lib/app/AcApFontLoader.js +30 -0
- package/lib/app/AcApFontLoader.js.map +1 -1
- package/lib/app/AcApSettingManager.d.ts +191 -3
- package/lib/app/AcApSettingManager.d.ts.map +1 -1
- package/lib/app/AcApSettingManager.js +161 -0
- package/lib/app/AcApSettingManager.js.map +1 -1
- package/lib/command/AcApConvertToSvgCmd.d.ts +26 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -1
- package/lib/command/AcApConvertToSvgCmd.js +26 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -1
- package/lib/command/AcApOpenCmd.d.ts +31 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -1
- package/lib/command/AcApOpenCmd.js +31 -0
- package/lib/command/AcApOpenCmd.js.map +1 -1
- package/lib/command/AcApPanCmd.d.ts +25 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -1
- package/lib/command/AcApPanCmd.js +25 -0
- package/lib/command/AcApPanCmd.js.map +1 -1
- package/lib/command/AcApQNewCmd.d.ts +26 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -1
- package/lib/command/AcApQNewCmd.js +26 -0
- package/lib/command/AcApQNewCmd.js.map +1 -1
- package/lib/command/AcApSelectCmd.d.ts +26 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -1
- package/lib/command/AcApSelectCmd.js +26 -0
- package/lib/command/AcApSelectCmd.js.map +1 -1
- package/lib/command/AcApSvgConvertor.d.ts +48 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -1
- package/lib/command/AcApSvgConvertor.js +48 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -1
- package/lib/command/AcApZoomCmd.d.ts +29 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomCmd.js +29 -0
- package/lib/command/AcApZoomCmd.js.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.d.ts +57 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.js +57 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
- package/lib/editor/command/AcEdCommand.d.ts +118 -9
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommand.js +113 -9
- package/lib/editor/command/AcEdCommand.js.map +1 -1
- package/lib/editor/command/AcEdCommandStack.d.ts +59 -5
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommandStack.js +48 -5
- package/lib/editor/command/AcEdCommandStack.js.map +1 -1
- package/lib/editor/global/eventBus.d.ts +69 -1
- package/lib/editor/global/eventBus.d.ts.map +1 -1
- package/lib/editor/global/eventBus.js +37 -0
- package/lib/editor/global/eventBus.js.map +1 -1
- package/lib/editor/input/AcEdBaseInput.d.ts +65 -1
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -1
- package/lib/editor/input/AcEdBaseInput.js +62 -1
- package/lib/editor/input/AcEdBaseInput.js.map +1 -1
- package/lib/editor/input/AcEdBoxSelector.d.ts +81 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -1
- package/lib/editor/input/AcEdBoxSelector.js +80 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +95 -8
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +95 -11
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEdInputPoint.d.ts +38 -1
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -1
- package/lib/editor/input/AcEdInputPoint.js +38 -1
- package/lib/editor/input/AcEdInputPoint.js.map +1 -1
- package/lib/editor/input/AcEdJig.d.ts +166 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -1
- package/lib/editor/input/AcEdJig.js +164 -0
- package/lib/editor/input/AcEdJig.js.map +1 -1
- package/lib/editor/input/AcEdJigLoop.d.ts +49 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -1
- package/lib/editor/input/AcEdJigLoop.js +48 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -1
- package/lib/editor/input/AcEdSelectionSet.d.ts +122 -2
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -1
- package/lib/editor/input/AcEdSelectionSet.js +117 -1
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -1
- package/lib/editor/input/AcEditor.d.ts +90 -6
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +86 -6
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +163 -16
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +94 -5
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/util/AcTrGeometryUtil.d.ts +65 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -1
- package/lib/util/AcTrGeometryUtil.js +65 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -1
- package/lib/view/AcTrLayer.d.ts +40 -5
- package/lib/view/AcTrLayer.d.ts.map +1 -1
- package/lib/view/AcTrLayer.js +34 -5
- package/lib/view/AcTrLayer.js.map +1 -1
- package/lib/view/AcTrLayout.d.ts +122 -23
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +103 -23
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrLayoutView.d.ts +74 -16
- package/lib/view/AcTrLayoutView.d.ts.map +1 -1
- package/lib/view/AcTrLayoutView.js +65 -16
- package/lib/view/AcTrLayoutView.js.map +1 -1
- package/lib/view/AcTrLayoutViewManager.d.ts +58 -12
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -1
- package/lib/view/AcTrLayoutViewManager.js +56 -12
- package/lib/view/AcTrLayoutViewManager.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +48 -4
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +44 -4
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +71 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +65 -0
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +8 -4
|
@@ -1,11 +1,60 @@
|
|
|
1
1
|
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Abstract base class for all CAD commands.
|
|
4
|
+
*
|
|
5
|
+
* This class provides the foundation for implementing CAD commands with:
|
|
6
|
+
* - Command name management (global and localized names)
|
|
7
|
+
* - Lifecycle event handling (command start/end)
|
|
8
|
+
* - Execution framework with context access
|
|
9
|
+
* - Event notification system
|
|
10
|
+
*
|
|
11
|
+
* Commands are the primary way users interact with the CAD system. Each command
|
|
12
|
+
* represents a specific operation like drawing lines, selecting objects, zooming, etc.
|
|
13
|
+
*
|
|
14
|
+
* ## Command Lifecycle
|
|
15
|
+
* 1. Command is triggered via `trigger()` method
|
|
16
|
+
* 2. `commandWillStart` event is fired
|
|
17
|
+
* 3. `execute()` method is called with current context
|
|
18
|
+
* 4. `commandEnded` event is fired
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* class MyDrawCommand extends AcEdCommand {
|
|
23
|
+
* constructor() {
|
|
24
|
+
* super();
|
|
25
|
+
* this.globalName = 'DRAW';
|
|
26
|
+
* this.localName = 'Draw Line';
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* execute(context: AcApContext) {
|
|
30
|
+
* // Implement command logic here
|
|
31
|
+
* const view = context.view;
|
|
32
|
+
* const document = context.doc;
|
|
33
|
+
* // ... drawing logic
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* // Usage
|
|
38
|
+
* const command = new MyDrawCommand();
|
|
39
|
+
* command.events.commandWillStart.addEventListener(args => {
|
|
40
|
+
* console.log('Command starting:', args.command.globalName);
|
|
41
|
+
* });
|
|
42
|
+
* command.trigger(context);
|
|
43
|
+
* ```
|
|
4
44
|
*/
|
|
5
45
|
var AcEdCommand = /** @class */ (function () {
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new command instance.
|
|
48
|
+
*
|
|
49
|
+
* Initializes the command with empty names. Subclasses should set
|
|
50
|
+
* appropriate global and local names in their constructors.
|
|
51
|
+
*/
|
|
6
52
|
function AcEdCommand() {
|
|
53
|
+
/** Events fired during command execution lifecycle */
|
|
7
54
|
this.events = {
|
|
55
|
+
/** Fired just before the command starts executing */
|
|
8
56
|
commandWillStart: new AcCmEventManager(),
|
|
57
|
+
/** Fired after the command finishes executing */
|
|
9
58
|
commandEnded: new AcCmEventManager()
|
|
10
59
|
};
|
|
11
60
|
this._globalName = '';
|
|
@@ -13,11 +62,21 @@ var AcEdCommand = /** @class */ (function () {
|
|
|
13
62
|
}
|
|
14
63
|
Object.defineProperty(AcEdCommand.prototype, "globalName", {
|
|
15
64
|
/**
|
|
16
|
-
*
|
|
65
|
+
* Gets the global (untranslated) name of the command.
|
|
66
|
+
*
|
|
67
|
+
* The global name is typically used for programmatic access and
|
|
68
|
+
* should remain consistent across different language localizations.
|
|
69
|
+
*
|
|
70
|
+
* @returns The global command name
|
|
17
71
|
*/
|
|
18
72
|
get: function () {
|
|
19
73
|
return this._globalName;
|
|
20
74
|
},
|
|
75
|
+
/**
|
|
76
|
+
* Sets the global (untranslated) name of the command.
|
|
77
|
+
*
|
|
78
|
+
* @param value - The global command name (e.g., 'LINE', 'CIRCLE', 'ZOOM')
|
|
79
|
+
*/
|
|
21
80
|
set: function (value) {
|
|
22
81
|
this._globalName = value;
|
|
23
82
|
},
|
|
@@ -26,11 +85,21 @@ var AcEdCommand = /** @class */ (function () {
|
|
|
26
85
|
});
|
|
27
86
|
Object.defineProperty(AcEdCommand.prototype, "localName", {
|
|
28
87
|
/**
|
|
29
|
-
*
|
|
88
|
+
* Gets the local (translated) name of the command.
|
|
89
|
+
*
|
|
90
|
+
* The local name is displayed to users and should be localized
|
|
91
|
+
* to the current language/region.
|
|
92
|
+
*
|
|
93
|
+
* @returns The localized command name
|
|
30
94
|
*/
|
|
31
95
|
get: function () {
|
|
32
96
|
return this._localName;
|
|
33
97
|
},
|
|
98
|
+
/**
|
|
99
|
+
* Sets the local (translated) name of the command.
|
|
100
|
+
*
|
|
101
|
+
* @param value - The localized command name (e.g., 'Draw Line', 'Zoom In')
|
|
102
|
+
*/
|
|
34
103
|
set: function (value) {
|
|
35
104
|
this._localName = value;
|
|
36
105
|
},
|
|
@@ -38,9 +107,24 @@ var AcEdCommand = /** @class */ (function () {
|
|
|
38
107
|
configurable: true
|
|
39
108
|
});
|
|
40
109
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
110
|
+
* Triggers the command execution with proper event handling.
|
|
111
|
+
*
|
|
112
|
+
* This method should not be overridden by subclasses as it handles
|
|
113
|
+
* the event notification workflow. Subclasses should implement the
|
|
114
|
+
* `execute()` method instead.
|
|
115
|
+
*
|
|
116
|
+
* The execution flow:
|
|
117
|
+
* 1. Fires `commandWillStart` event
|
|
118
|
+
* 2. Calls the `execute()` method
|
|
119
|
+
* 3. Fires `commandEnded` event
|
|
120
|
+
*
|
|
121
|
+
* @param context - The current application context containing view and document
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const command = new MyCommand();
|
|
126
|
+
* command.trigger(docManager.context);
|
|
127
|
+
* ```
|
|
44
128
|
*/
|
|
45
129
|
AcEdCommand.prototype.tirgger = function (context) {
|
|
46
130
|
this.events.commandWillStart.dispatch({ command: this });
|
|
@@ -48,11 +132,31 @@ var AcEdCommand = /** @class */ (function () {
|
|
|
48
132
|
this.events.commandEnded.dispatch({ command: this });
|
|
49
133
|
};
|
|
50
134
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
135
|
+
* Executes the command logic.
|
|
136
|
+
*
|
|
137
|
+
* This abstract method must be implemented by subclasses to define
|
|
138
|
+
* the specific behavior of the command. The method receives the current
|
|
139
|
+
* application context providing access to the view and document.
|
|
140
|
+
*
|
|
141
|
+
* @param _context - The current application context
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* execute(context: AcApContext) {
|
|
146
|
+
* const view = context.view;
|
|
147
|
+
* const doc = context.doc;
|
|
148
|
+
*
|
|
149
|
+
* // Get user input
|
|
150
|
+
* const point = await view.editor.getPoint();
|
|
151
|
+
*
|
|
152
|
+
* // Create entity in document
|
|
153
|
+
* const entity = new SomeEntity(point);
|
|
154
|
+
* doc.database.addEntity(entity);
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
53
157
|
*/
|
|
54
158
|
AcEdCommand.prototype.execute = function (_context) {
|
|
55
|
-
// Do nothing
|
|
159
|
+
// Do nothing - subclasses should override this method
|
|
56
160
|
};
|
|
57
161
|
return AcEdCommand;
|
|
58
162
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdCommand.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"AcEdCommand.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAcxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH;IAME;;;;;OAKG;IACH;QAKA,sDAAsD;QACtC,WAAM,GAAG;YACvB,qDAAqD;YACrD,gBAAgB,EAAE,IAAI,gBAAgB,EAAwB;YAC9D,iDAAiD;YACjD,YAAY,EAAE,IAAI,gBAAgB,EAAwB;SAC3D,CAAA;QAVC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAA;QACrB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;IACtB,CAAC;IAkBD,sBAAI,mCAAU;QARd;;;;;;;WAOG;aACH;YACE,OAAO,IAAI,CAAC,WAAW,CAAA;QACzB,CAAC;QAED;;;;WAIG;aACH,UAAe,KAAa;YAC1B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QAC1B,CAAC;;;OATA;IAmBD,sBAAI,kCAAS;QARb;;;;;;;WAOG;aACH;YACE,OAAO,IAAI,CAAC,UAAU,CAAA;QACxB,CAAC;QAED;;;;WAIG;aACH,UAAc,KAAa;YACzB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;QACzB,CAAC;;;OATA;IAWD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,6BAAO,GAAP,UAAQ,OAAoB;QAC1B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QACxD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACrB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;IACtD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,6BAAO,GAAP,UAAQ,QAAqB;QAC3B,sDAAsD;IACxD,CAAC;IACH,kBAAC;AAAD,CAAC,AAxHD,IAwHC"}
|
|
@@ -1,26 +1,76 @@
|
|
|
1
1
|
import { AcEdCommand } from './AcEdCommand';
|
|
2
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
|
+
*/
|
|
3
7
|
export interface AcEdCommandGroup {
|
|
8
|
+
/** The name of the command group */
|
|
4
9
|
groupName: string;
|
|
10
|
+
/** Map of commands indexed by their global names */
|
|
5
11
|
commandsByGlobalName: Map<string, AcEdCommand>;
|
|
12
|
+
/** Map of commands indexed by their local names */
|
|
6
13
|
commandsByLocalName: Map<string, AcEdCommand>;
|
|
7
14
|
}
|
|
8
15
|
/**
|
|
9
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
|
+
* ```
|
|
10
28
|
*/
|
|
11
29
|
export declare class AcEdCommandStack {
|
|
30
|
+
/** The name of the system command group */
|
|
12
31
|
static SYSTEMT_COMMAND_GROUP_NAME: string;
|
|
32
|
+
/** The name of the default user command group */
|
|
13
33
|
static DEFAUT_COMMAND_GROUP_NAME: string;
|
|
34
|
+
/** Array of all command groups in the stack */
|
|
14
35
|
private _commandsByGroup;
|
|
36
|
+
/** Reference to the system command group */
|
|
15
37
|
private _systemCommandGroup;
|
|
38
|
+
/** Reference to the default user command group */
|
|
16
39
|
private _defaultCommandGroup;
|
|
40
|
+
/** Singleton instance of the command stack */
|
|
17
41
|
private static _instance?;
|
|
42
|
+
/**
|
|
43
|
+
* Private constructor to enforce singleton pattern.
|
|
44
|
+
* Initializes the command stack with system and default command groups.
|
|
45
|
+
*/
|
|
18
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
|
+
*/
|
|
19
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
|
+
*/
|
|
20
69
|
addCommand(cmdGroupName: string, cmdGlobalName: string, cmdLocalName: string, cmd: AcEdCommand): void;
|
|
21
70
|
/**
|
|
22
71
|
* Return an iterator that can be used to traverse all of command objects in this command stack
|
|
23
72
|
* (that is, the iterator iterates through all commands in all groups).
|
|
73
|
+
*
|
|
24
74
|
* @returns Return an iterator that can be used to traverse all of command objects in this command
|
|
25
75
|
* stack.
|
|
26
76
|
*/
|
|
@@ -31,7 +81,8 @@ export declare class AcEdCommandStack {
|
|
|
31
81
|
* matched AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command
|
|
32
82
|
* could not be found. If more than one command of the same name is present in the command stack (that
|
|
33
83
|
* is, in separate command groups), then the first one found is used.
|
|
34
|
-
*
|
|
84
|
+
*
|
|
85
|
+
* @param cmdName - Input the command name to search for
|
|
35
86
|
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
36
87
|
*/
|
|
37
88
|
lookupGlobalCmd(cmdName: string): AcEdCommand | undefined;
|
|
@@ -41,7 +92,8 @@ export declare class AcEdCommandStack {
|
|
|
41
92
|
* AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command could not
|
|
42
93
|
* be found. If more than one command of the same name is present in the command stack (that is, in
|
|
43
94
|
* separate command groups), then the first one found is used.
|
|
44
|
-
*
|
|
95
|
+
*
|
|
96
|
+
* @param cmdName - Input the command name to search for
|
|
45
97
|
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
46
98
|
*/
|
|
47
99
|
lookupLocalCmd(cmdName: string): AcEdCommand | undefined;
|
|
@@ -49,8 +101,9 @@ export declare class AcEdCommandStack {
|
|
|
49
101
|
* Remove the command with the global and untranslated name `cmdGlobalName` from the `cmdGroupName`
|
|
50
102
|
* command group. Return true if successful. Return false if no command with the global and untranslated
|
|
51
103
|
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
52
|
-
*
|
|
53
|
-
* @param
|
|
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
|
|
54
107
|
* @returns Return true if successful. Return false if no command with the global and untranslated
|
|
55
108
|
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
56
109
|
*/
|
|
@@ -58,7 +111,8 @@ export declare class AcEdCommandStack {
|
|
|
58
111
|
/**
|
|
59
112
|
* Remove the command group with the name `GroupName` from the command stack and delete the command group
|
|
60
113
|
* dictionary object and all the AcEdCommand objects stored within it.
|
|
61
|
-
*
|
|
114
|
+
*
|
|
115
|
+
* @param groupName - Input the name of the command group to be removed from the command stack.
|
|
62
116
|
* @returns Return true if successful. Return false if no command group is found with the name `GroupName`.
|
|
63
117
|
*/
|
|
64
118
|
removeGroup(groupName: string): boolean;
|
|
@@ -1 +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,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IAC9C,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;CAC9C;AAED
|
|
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"}
|
|
@@ -12,8 +12,23 @@ var __values = (this && this.__values) || function(o) {
|
|
|
12
12
|
import { AcEdCommandIterator } from './AcEdCommandIterator';
|
|
13
13
|
/**
|
|
14
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
|
+
* ```
|
|
15
26
|
*/
|
|
16
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
|
+
*/
|
|
17
32
|
function AcEdCommandStack() {
|
|
18
33
|
this._commandsByGroup = [];
|
|
19
34
|
this._systemCommandGroup = {
|
|
@@ -30,6 +45,12 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
30
45
|
this._commandsByGroup.push(this._defaultCommandGroup);
|
|
31
46
|
}
|
|
32
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
|
+
*/
|
|
33
54
|
get: function () {
|
|
34
55
|
if (!AcEdCommandStack._instance) {
|
|
35
56
|
AcEdCommandStack._instance = new AcEdCommandStack();
|
|
@@ -39,6 +60,21 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
39
60
|
enumerable: false,
|
|
40
61
|
configurable: true
|
|
41
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
|
+
*/
|
|
42
78
|
AcEdCommandStack.prototype.addCommand = function (cmdGroupName, cmdGlobalName, cmdLocalName, cmd) {
|
|
43
79
|
if (!cmdGlobalName) {
|
|
44
80
|
throw new Error('[AcEdCommandStack] The global name of the command is required!');
|
|
@@ -74,6 +110,7 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
74
110
|
/**
|
|
75
111
|
* Return an iterator that can be used to traverse all of command objects in this command stack
|
|
76
112
|
* (that is, the iterator iterates through all commands in all groups).
|
|
113
|
+
*
|
|
77
114
|
* @returns Return an iterator that can be used to traverse all of command objects in this command
|
|
78
115
|
* stack.
|
|
79
116
|
*/
|
|
@@ -86,7 +123,8 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
86
123
|
* matched AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command
|
|
87
124
|
* could not be found. If more than one command of the same name is present in the command stack (that
|
|
88
125
|
* is, in separate command groups), then the first one found is used.
|
|
89
|
-
*
|
|
126
|
+
*
|
|
127
|
+
* @param cmdName - Input the command name to search for
|
|
90
128
|
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
91
129
|
*/
|
|
92
130
|
AcEdCommandStack.prototype.lookupGlobalCmd = function (cmdName) {
|
|
@@ -115,7 +153,8 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
115
153
|
* AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command could not
|
|
116
154
|
* be found. If more than one command of the same name is present in the command stack (that is, in
|
|
117
155
|
* separate command groups), then the first one found is used.
|
|
118
|
-
*
|
|
156
|
+
*
|
|
157
|
+
* @param cmdName - Input the command name to search for
|
|
119
158
|
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
120
159
|
*/
|
|
121
160
|
AcEdCommandStack.prototype.lookupLocalCmd = function (cmdName) {
|
|
@@ -142,8 +181,9 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
142
181
|
* Remove the command with the global and untranslated name `cmdGlobalName` from the `cmdGroupName`
|
|
143
182
|
* command group. Return true if successful. Return false if no command with the global and untranslated
|
|
144
183
|
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
145
|
-
*
|
|
146
|
-
* @param
|
|
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
|
|
147
187
|
* @returns Return true if successful. Return false if no command with the global and untranslated
|
|
148
188
|
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
149
189
|
*/
|
|
@@ -169,7 +209,8 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
169
209
|
/**
|
|
170
210
|
* Remove the command group with the name `GroupName` from the command stack and delete the command group
|
|
171
211
|
* dictionary object and all the AcEdCommand objects stored within it.
|
|
172
|
-
*
|
|
212
|
+
*
|
|
213
|
+
* @param groupName - Input the name of the command group to be removed from the command stack.
|
|
173
214
|
* @returns Return true if successful. Return false if no command group is found with the name `GroupName`.
|
|
174
215
|
*/
|
|
175
216
|
AcEdCommandStack.prototype.removeGroup = function (groupName) {
|
|
@@ -184,7 +225,9 @@ var AcEdCommandStack = /** @class */ (function () {
|
|
|
184
225
|
}
|
|
185
226
|
return false;
|
|
186
227
|
};
|
|
228
|
+
/** The name of the system command group */
|
|
187
229
|
AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME = 'ACAD';
|
|
230
|
+
/** The name of the default user command group */
|
|
188
231
|
AcEdCommandStack.DEFAUT_COMMAND_GROUP_NAME = 'USER';
|
|
189
232
|
return AcEdCommandStack;
|
|
190
233
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdCommandStack.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandStack.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,O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OAAO,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"}
|
|
@@ -1,34 +1,102 @@
|
|
|
1
1
|
import { AcDbConversionStage, AcDbConversionStageStatus } from '@mlightcad/data-model';
|
|
2
2
|
import { type Emitter } from 'mitt';
|
|
3
3
|
/**
|
|
4
|
-
* Message type
|
|
4
|
+
* Message severity type for user notifications.
|
|
5
|
+
*
|
|
6
|
+
* Used to categorize messages shown to users with appropriate visual styling.
|
|
5
7
|
*/
|
|
6
8
|
export type AcEdMessageType = 'success' | 'warning' | 'info' | 'error';
|
|
9
|
+
/**
|
|
10
|
+
* Type definition for all events that can be emitted through the global event bus.
|
|
11
|
+
*
|
|
12
|
+
* This type maps event names to their corresponding payload types, providing
|
|
13
|
+
* type safety for event emission and listening throughout the application.
|
|
14
|
+
*
|
|
15
|
+
* ## Event Categories
|
|
16
|
+
* - **File Operations**: `open-file`, `open-file-progress`, `failed-to-open-file`
|
|
17
|
+
* - **Font Management**: `font-not-loaded`, `failed-to-get-avaiable-fonts`, `font-not-found`
|
|
18
|
+
* - **User Messages**: `message`
|
|
19
|
+
*/
|
|
7
20
|
export type AcEdEvents = {
|
|
21
|
+
/** Emitted to request opening a file dialog */
|
|
8
22
|
'open-file': {};
|
|
23
|
+
/** Emitted during file opening to report progress */
|
|
9
24
|
'open-file-progress': {
|
|
25
|
+
/** Progress percentage (0-100) */
|
|
10
26
|
percentage: number;
|
|
27
|
+
/** Current conversion stage */
|
|
11
28
|
stage: AcDbConversionStage;
|
|
29
|
+
/** Status of the current stage */
|
|
12
30
|
stageStatus: AcDbConversionStageStatus;
|
|
13
31
|
};
|
|
32
|
+
/** Emitted to display a message to the user */
|
|
14
33
|
message: {
|
|
34
|
+
/** The message text to display */
|
|
15
35
|
message: string;
|
|
36
|
+
/** The severity/type of the message */
|
|
16
37
|
type: AcEdMessageType;
|
|
17
38
|
};
|
|
39
|
+
/** Emitted when a font fails to load */
|
|
18
40
|
'font-not-loaded': {
|
|
41
|
+
/** Name of the font that failed to load */
|
|
19
42
|
fontName: string;
|
|
43
|
+
/** URL where the font was attempted to be loaded from */
|
|
20
44
|
url: string;
|
|
21
45
|
};
|
|
46
|
+
/** Emitted when the available fonts list cannot be retrieved */
|
|
22
47
|
'failed-to-get-avaiable-fonts': {
|
|
48
|
+
/** URL where the fonts list was attempted to be retrieved from */
|
|
23
49
|
url: string;
|
|
24
50
|
};
|
|
51
|
+
/** Emitted when a file fails to open */
|
|
25
52
|
'failed-to-open-file': {
|
|
53
|
+
/** Name/path of the file that failed to open */
|
|
26
54
|
fileName: string;
|
|
27
55
|
};
|
|
56
|
+
/** Emitted when a required font is not found */
|
|
28
57
|
'font-not-found': {
|
|
58
|
+
/** Name of the missing font */
|
|
29
59
|
fontName: string;
|
|
60
|
+
/** Number of entities that require this font */
|
|
30
61
|
count: number;
|
|
31
62
|
};
|
|
32
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Global event bus for application-wide communication.
|
|
66
|
+
*
|
|
67
|
+
* This event bus enables decoupled communication between different parts of the
|
|
68
|
+
* CAD viewer application. Components can emit events to notify about state changes
|
|
69
|
+
* or request actions, while other components can listen for these events to respond
|
|
70
|
+
* appropriately.
|
|
71
|
+
*
|
|
72
|
+
* The event bus is particularly useful for:
|
|
73
|
+
* - File operation status updates
|
|
74
|
+
* - Error and warning notifications
|
|
75
|
+
* - Font loading status
|
|
76
|
+
* - Cross-component communication
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* import { eventBus } from './eventBus';
|
|
81
|
+
*
|
|
82
|
+
* // Listen for file opening events
|
|
83
|
+
* eventBus.on('open-file', () => {
|
|
84
|
+
* console.log('File open requested');
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* // Emit a progress update
|
|
88
|
+
* eventBus.emit('open-file-progress', {
|
|
89
|
+
* percentage: 50,
|
|
90
|
+
* stage: AcDbConversionStage.Parsing,
|
|
91
|
+
* stageStatus: AcDbConversionStageStatus.InProgress
|
|
92
|
+
* });
|
|
93
|
+
*
|
|
94
|
+
* // Display a message to the user
|
|
95
|
+
* eventBus.emit('message', {
|
|
96
|
+
* message: 'File opened successfully',
|
|
97
|
+
* type: 'success'
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
33
101
|
export declare const eventBus: Emitter<AcEdEvents>;
|
|
34
102
|
//# sourceMappingURL=eventBus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAa,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAA;AAEzC
|
|
1
|
+
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAA;AAC9B,OAAa,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAA;AAEzC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,+CAA+C;IAC/C,WAAW,EAAE,EAAE,CAAA;IACf,qDAAqD;IACrD,oBAAoB,EAAE;QACpB,kCAAkC;QAClC,UAAU,EAAE,MAAM,CAAA;QAClB,+BAA+B;QAC/B,KAAK,EAAE,mBAAmB,CAAA;QAC1B,kCAAkC;QAClC,WAAW,EAAE,yBAAyB,CAAA;KACvC,CAAA;IACD,+CAA+C;IAC/C,OAAO,EAAE;QACP,kCAAkC;QAClC,OAAO,EAAE,MAAM,CAAA;QACf,uCAAuC;QACvC,IAAI,EAAE,eAAe,CAAA;KACtB,CAAA;IACD,wCAAwC;IACxC,iBAAiB,EAAE;QACjB,2CAA2C;QAC3C,QAAQ,EAAE,MAAM,CAAA;QAChB,yDAAyD;QACzD,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,gEAAgE;IAChE,8BAA8B,EAAE;QAC9B,kEAAkE;QAClE,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,wCAAwC;IACxC,qBAAqB,EAAE;QACrB,gDAAgD;QAChD,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,gDAAgD;IAChD,gBAAgB,EAAE;QAChB,+BAA+B;QAC/B,QAAQ,EAAE,MAAM,CAAA;QAChB,gDAAgD;QAChD,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAsB,CAAA"}
|
|
@@ -1,3 +1,40 @@
|
|
|
1
1
|
import mitt from 'mitt';
|
|
2
|
+
/**
|
|
3
|
+
* Global event bus for application-wide communication.
|
|
4
|
+
*
|
|
5
|
+
* This event bus enables decoupled communication between different parts of the
|
|
6
|
+
* CAD viewer application. Components can emit events to notify about state changes
|
|
7
|
+
* or request actions, while other components can listen for these events to respond
|
|
8
|
+
* appropriately.
|
|
9
|
+
*
|
|
10
|
+
* The event bus is particularly useful for:
|
|
11
|
+
* - File operation status updates
|
|
12
|
+
* - Error and warning notifications
|
|
13
|
+
* - Font loading status
|
|
14
|
+
* - Cross-component communication
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { eventBus } from './eventBus';
|
|
19
|
+
*
|
|
20
|
+
* // Listen for file opening events
|
|
21
|
+
* eventBus.on('open-file', () => {
|
|
22
|
+
* console.log('File open requested');
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Emit a progress update
|
|
26
|
+
* eventBus.emit('open-file-progress', {
|
|
27
|
+
* percentage: 50,
|
|
28
|
+
* stage: AcDbConversionStage.Parsing,
|
|
29
|
+
* stageStatus: AcDbConversionStageStatus.InProgress
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Display a message to the user
|
|
33
|
+
* eventBus.emit('message', {
|
|
34
|
+
* message: 'File opened successfully',
|
|
35
|
+
* type: 'success'
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
2
39
|
export var eventBus = mitt();
|
|
3
40
|
//# sourceMappingURL=eventBus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAIA,OAAO,IAAsB,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../../src/editor/global/eventBus.ts"],"names":[],"mappings":"AAIA,OAAO,IAAsB,MAAM,MAAM,CAAA;AAiEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,IAAM,QAAQ,GAAwB,IAAI,EAAc,CAAA"}
|