@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApDocManager.js","sourceRoot":"","sources":["../../src/app/AcApDocManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAE5B,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW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ACtB,CAAC;IAED;;;;;;;;;OASG;IACO,4CAAmB,GAA7B,UAA8B,SAAkB;QAC9C,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC;gBACrC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG;aACtB,CAAC,CAAA;YACF,IAAI,CAAC,aAAa,EAAE,CAAA;YACpB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAA;QAC1B,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACK,mCAAU,GAAlB,UAAmB,OAAiC;QAClD,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,OAAO,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,CAAA;QAC5C,CAAC;aAAM,IAAI,OAAO,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;YACtC,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAA;QACvC,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;;;;;OAOG;IACK,sCAAa,GAArB;QACE,IAAM,WAAW,GAAG,IAAI,CAAC,OAAqB,CAAA;QAC9C,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAA;QACxE,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAA;IACxE,CAAC;IACH,qBAAC;AAAD,CAAC,AApaD,IAoaC"}
|
|
@@ -1,27 +1,101 @@
|
|
|
1
1
|
import { AcDbDatabase, AcDbOpenDatabaseOptions } from '@mlightcad/data-model';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a CAD document that manages a drawing database and associated metadata.
|
|
4
|
+
*
|
|
5
|
+
* This class handles:
|
|
6
|
+
* - Opening CAD files from URIs or file content (DWG/DXF formats)
|
|
7
|
+
* - Managing document properties (title, read-only state)
|
|
8
|
+
* - Providing access to the underlying database
|
|
9
|
+
* - Handling file loading errors through event emission
|
|
10
|
+
*/
|
|
2
11
|
export declare class AcApDocument {
|
|
12
|
+
/** The URI of the opened document, if opened from a URI */
|
|
3
13
|
private _uri?;
|
|
14
|
+
/** The underlying CAD database containing all drawing data */
|
|
4
15
|
private _database;
|
|
16
|
+
/** The file name of the document */
|
|
5
17
|
private _fileName;
|
|
18
|
+
/** The display title of the document */
|
|
6
19
|
private _docTitle;
|
|
20
|
+
/** Whether the document is opened in read-only mode */
|
|
7
21
|
private _isReadOnly;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new document instance with an empty database.
|
|
24
|
+
*
|
|
25
|
+
* The document is initialized with an "Untitled" title and read-only mode enabled.
|
|
26
|
+
*/
|
|
8
27
|
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Opens a CAD document from a URI.
|
|
30
|
+
*
|
|
31
|
+
* @param uri - The URI of the CAD file to open
|
|
32
|
+
* @param options - Options for opening the database, including read-only mode
|
|
33
|
+
* @returns Promise resolving to true if successful, false if failed
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const success = await document.openUri('https://example.com/drawing.dwg', {
|
|
38
|
+
* readOnly: true
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
9
42
|
openUri(uri: string, options: AcDbOpenDatabaseOptions): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Opens a CAD document from file content.
|
|
45
|
+
*
|
|
46
|
+
* @param fileName - The name of the file (used to determine file type from extension)
|
|
47
|
+
* @param content - The file content as string or ArrayBuffer
|
|
48
|
+
* @param options - Options for opening the database, including read-only mode
|
|
49
|
+
* @returns Promise resolving to true if successful, false if failed
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const fileContent = await fetch('drawing.dwg').then(r => r.arrayBuffer());
|
|
54
|
+
* const success = await document.openDocument('drawing.dwg', fileContent, {
|
|
55
|
+
* readOnly: false
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
10
59
|
openDocument(fileName: string, content: string | ArrayBuffer, options: AcDbOpenDatabaseOptions): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the URI of the document if opened from a URI.
|
|
62
|
+
*
|
|
63
|
+
* @returns The document URI, or undefined if not opened from URI
|
|
64
|
+
*/
|
|
11
65
|
get uri(): string | undefined;
|
|
12
66
|
/**
|
|
13
|
-
*
|
|
67
|
+
* Gets the database object containing all drawing data.
|
|
68
|
+
*
|
|
69
|
+
* @returns The underlying CAD database instance
|
|
14
70
|
*/
|
|
15
71
|
get database(): AcDbDatabase;
|
|
16
72
|
/**
|
|
17
|
-
*
|
|
73
|
+
* Gets the display title of the document.
|
|
74
|
+
*
|
|
75
|
+
* @returns The document title displayed in the window/tab
|
|
18
76
|
*/
|
|
19
77
|
get docTitle(): string;
|
|
78
|
+
/**
|
|
79
|
+
* Sets the display title of the document.
|
|
80
|
+
*
|
|
81
|
+
* Also updates the browser tab title if running in a browser environment.
|
|
82
|
+
*
|
|
83
|
+
* @param value - The new document title
|
|
84
|
+
*/
|
|
20
85
|
set docTitle(value: string);
|
|
21
86
|
/**
|
|
22
|
-
*
|
|
87
|
+
* Gets whether the document is opened in read-only mode.
|
|
88
|
+
*
|
|
89
|
+
* @returns True if the document is read-only, false if editable
|
|
23
90
|
*/
|
|
24
91
|
get isReadOnly(): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Extracts the file name from a URI.
|
|
94
|
+
*
|
|
95
|
+
* @param uri - The URI to extract the file name from
|
|
96
|
+
* @returns The extracted file name, or empty string if extraction fails
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
25
99
|
private getFileNameFromUri;
|
|
26
100
|
}
|
|
27
101
|
//# sourceMappingURL=AcApDocument.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApDocument.d.ts","sourceRoot":"","sources":["../../src/app/AcApDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,uBAAuB,EACxB,MAAM,uBAAuB,CAAA;AAI9B,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAC,CAAQ;IACrB,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,WAAW,CAAgB;;
|
|
1
|
+
{"version":3,"file":"AcApDocument.d.ts","sourceRoot":"","sources":["../../src/app/AcApDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,uBAAuB,EACxB,MAAM,uBAAuB,CAAA;AAI9B;;;;;;;;GAQG;AACH,qBAAa,YAAY;IACvB,2DAA2D;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAQ;IACrB,8DAA8D;IAC9D,OAAO,CAAC,SAAS,CAAc;IAC/B,oCAAoC;IACpC,OAAO,CAAC,SAAS,CAAa;IAC9B,wCAAwC;IACxC,OAAO,CAAC,SAAS,CAAa;IAC9B,uDAAuD;IACvD,OAAO,CAAC,WAAW,CAAgB;IAEnC;;;;OAIG;;IAMH;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB;IAe3D;;;;;;;;;;;;;;;OAeG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,WAAW,EAC7B,OAAO,EAAE,uBAAuB;IAoBlC;;;;OAIG;IACH,IAAI,GAAG,uBAEN;IAED;;;;OAIG;IACH,IAAI,QAAQ,iBAEX;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAWQ,MAAM,CATzB;IAED;;;;;;OAMG;IACH,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMzB;IAED;;;;OAIG;IACH,IAAI,UAAU,YAEb;IAED;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;CAa3B"}
|
package/lib/app/AcApDocument.js
CHANGED
|
@@ -36,14 +36,45 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import { AcDbDatabase, AcDbFileType } from '@mlightcad/data-model';
|
|
38
38
|
import { eventBus } from '../editor';
|
|
39
|
+
/**
|
|
40
|
+
* Represents a CAD document that manages a drawing database and associated metadata.
|
|
41
|
+
*
|
|
42
|
+
* This class handles:
|
|
43
|
+
* - Opening CAD files from URIs or file content (DWG/DXF formats)
|
|
44
|
+
* - Managing document properties (title, read-only state)
|
|
45
|
+
* - Providing access to the underlying database
|
|
46
|
+
* - Handling file loading errors through event emission
|
|
47
|
+
*/
|
|
39
48
|
var AcApDocument = /** @class */ (function () {
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new document instance with an empty database.
|
|
51
|
+
*
|
|
52
|
+
* The document is initialized with an "Untitled" title and read-only mode enabled.
|
|
53
|
+
*/
|
|
40
54
|
function AcApDocument() {
|
|
55
|
+
/** The file name of the document */
|
|
41
56
|
this._fileName = '';
|
|
57
|
+
/** The display title of the document */
|
|
42
58
|
this._docTitle = '';
|
|
59
|
+
/** Whether the document is opened in read-only mode */
|
|
43
60
|
this._isReadOnly = true;
|
|
44
61
|
this._database = new AcDbDatabase();
|
|
45
62
|
this.docTitle = 'Untitled';
|
|
46
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Opens a CAD document from a URI.
|
|
66
|
+
*
|
|
67
|
+
* @param uri - The URI of the CAD file to open
|
|
68
|
+
* @param options - Options for opening the database, including read-only mode
|
|
69
|
+
* @returns Promise resolving to true if successful, false if failed
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const success = await document.openUri('https://example.com/drawing.dwg', {
|
|
74
|
+
* readOnly: true
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
47
78
|
AcApDocument.prototype.openUri = function (uri, options) {
|
|
48
79
|
return __awaiter(this, void 0, void 0, function () {
|
|
49
80
|
var isSuccess, _1;
|
|
@@ -72,6 +103,22 @@ var AcApDocument = /** @class */ (function () {
|
|
|
72
103
|
});
|
|
73
104
|
});
|
|
74
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* Opens a CAD document from file content.
|
|
108
|
+
*
|
|
109
|
+
* @param fileName - The name of the file (used to determine file type from extension)
|
|
110
|
+
* @param content - The file content as string or ArrayBuffer
|
|
111
|
+
* @param options - Options for opening the database, including read-only mode
|
|
112
|
+
* @returns Promise resolving to true if successful, false if failed
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const fileContent = await fetch('drawing.dwg').then(r => r.arrayBuffer());
|
|
117
|
+
* const success = await document.openDocument('drawing.dwg', fileContent, {
|
|
118
|
+
* readOnly: false
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
75
122
|
AcApDocument.prototype.openDocument = function (fileName, content, options) {
|
|
76
123
|
return __awaiter(this, void 0, void 0, function () {
|
|
77
124
|
var isSuccess, fileExtension, e_1;
|
|
@@ -102,6 +149,11 @@ var AcApDocument = /** @class */ (function () {
|
|
|
102
149
|
});
|
|
103
150
|
};
|
|
104
151
|
Object.defineProperty(AcApDocument.prototype, "uri", {
|
|
152
|
+
/**
|
|
153
|
+
* Gets the URI of the document if opened from a URI.
|
|
154
|
+
*
|
|
155
|
+
* @returns The document URI, or undefined if not opened from URI
|
|
156
|
+
*/
|
|
105
157
|
get: function () {
|
|
106
158
|
return this._uri;
|
|
107
159
|
},
|
|
@@ -110,7 +162,9 @@ var AcApDocument = /** @class */ (function () {
|
|
|
110
162
|
});
|
|
111
163
|
Object.defineProperty(AcApDocument.prototype, "database", {
|
|
112
164
|
/**
|
|
113
|
-
*
|
|
165
|
+
* Gets the database object containing all drawing data.
|
|
166
|
+
*
|
|
167
|
+
* @returns The underlying CAD database instance
|
|
114
168
|
*/
|
|
115
169
|
get: function () {
|
|
116
170
|
return this._database;
|
|
@@ -120,11 +174,20 @@ var AcApDocument = /** @class */ (function () {
|
|
|
120
174
|
});
|
|
121
175
|
Object.defineProperty(AcApDocument.prototype, "docTitle", {
|
|
122
176
|
/**
|
|
123
|
-
*
|
|
177
|
+
* Gets the display title of the document.
|
|
178
|
+
*
|
|
179
|
+
* @returns The document title displayed in the window/tab
|
|
124
180
|
*/
|
|
125
181
|
get: function () {
|
|
126
182
|
return this._docTitle;
|
|
127
183
|
},
|
|
184
|
+
/**
|
|
185
|
+
* Sets the display title of the document.
|
|
186
|
+
*
|
|
187
|
+
* Also updates the browser tab title if running in a browser environment.
|
|
188
|
+
*
|
|
189
|
+
* @param value - The new document title
|
|
190
|
+
*/
|
|
128
191
|
set: function (value) {
|
|
129
192
|
this._docTitle = value;
|
|
130
193
|
// Update browser title when document title changes
|
|
@@ -137,7 +200,9 @@ var AcApDocument = /** @class */ (function () {
|
|
|
137
200
|
});
|
|
138
201
|
Object.defineProperty(AcApDocument.prototype, "isReadOnly", {
|
|
139
202
|
/**
|
|
140
|
-
*
|
|
203
|
+
* Gets whether the document is opened in read-only mode.
|
|
204
|
+
*
|
|
205
|
+
* @returns True if the document is read-only, false if editable
|
|
141
206
|
*/
|
|
142
207
|
get: function () {
|
|
143
208
|
return this._isReadOnly;
|
|
@@ -145,6 +210,13 @@ var AcApDocument = /** @class */ (function () {
|
|
|
145
210
|
enumerable: false,
|
|
146
211
|
configurable: true
|
|
147
212
|
});
|
|
213
|
+
/**
|
|
214
|
+
* Extracts the file name from a URI.
|
|
215
|
+
*
|
|
216
|
+
* @param uri - The URI to extract the file name from
|
|
217
|
+
* @returns The extracted file name, or empty string if extraction fails
|
|
218
|
+
* @private
|
|
219
|
+
*/
|
|
148
220
|
AcApDocument.prototype.getFileNameFromUri = function (uri) {
|
|
149
221
|
try {
|
|
150
222
|
// Create a new URL object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApDocument.js","sourceRoot":"","sources":["../../src/app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AAG,KAAK,CAAA;YACtB,mDAAmD;YACnD,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;gBACpC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAA;YACxB,CAAC;QACH,CAAC;;;OAfA;IAsBD,sBAAI,oCAAU;QALd;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,WAAW,CAAA;QACzB,CAAC;;;OAAA;IAED;;;;;;OAMG;IACK,yCAAkB,GAA1B,UAA2B,GAAW;QACpC,IAAI,CAAC;YACH,0BAA0B;YAC1B,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;YACxB,gCAAgC;YAChC,IAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACzC,wDAAwD;YACxD,OAAO,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;YACpC,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AAjKD,IAiKC"}
|
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
import { AcDbFontInfo, AcDbFontLoader } from '@mlightcad/data-model';
|
|
2
2
|
import { AcTrRenderer } from '@mlightcad/three-renderer';
|
|
3
|
+
/**
|
|
4
|
+
* Font loader implementation for CAD text rendering.
|
|
5
|
+
*
|
|
6
|
+
* This class implements the {@link AcDbFontLoader} interface and provides functionality to:
|
|
7
|
+
* - Fetch available font metadata from a CDN
|
|
8
|
+
* - Load required fonts for CAD text rendering
|
|
9
|
+
* - Handle font loading errors and emit appropriate events
|
|
10
|
+
* - Manage font availability checking
|
|
11
|
+
*
|
|
12
|
+
* The font loader works with a Three.js renderer to load fonts that are used
|
|
13
|
+
* for rendering CAD text entities like MText and Text.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const renderer = new AcTrRenderer();
|
|
18
|
+
* const fontLoader = new AcApFontLoader(renderer);
|
|
19
|
+
*
|
|
20
|
+
* // Load specific fonts
|
|
21
|
+
* await fontLoader.load(['Arial', 'SimSun']);
|
|
22
|
+
*
|
|
23
|
+
* // Get all available fonts
|
|
24
|
+
* const fonts = await fontLoader.getAvaiableFonts();
|
|
25
|
+
* console.log('Available fonts:', fonts);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
3
28
|
export declare class AcApFontLoader implements AcDbFontLoader {
|
|
29
|
+
/** The Three.js renderer used for font loading */
|
|
4
30
|
private _cadRenderer;
|
|
31
|
+
/** Cache of available fonts fetched from the CDN */
|
|
5
32
|
private _avaiableFonts;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new font loader instance.
|
|
35
|
+
*
|
|
36
|
+
* @param renderer - The Three.js renderer that will use the loaded fonts
|
|
37
|
+
*/
|
|
6
38
|
constructor(renderer: AcTrRenderer);
|
|
7
39
|
/**
|
|
8
40
|
* Avaiable fonts to load.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApFontLoader.d.ts","sourceRoot":"","sources":["../../src/app/AcApFontLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAKxD,qBAAa,cAAe,YAAW,cAAc;IACnD,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,cAAc,CAAgB;
|
|
1
|
+
{"version":3,"file":"AcApFontLoader.d.ts","sourceRoot":"","sources":["../../src/app/AcApFontLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAKxD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,cAAe,YAAW,cAAc;IACnD,kDAAkD;IAClD,OAAO,CAAC,YAAY,CAAc;IAClC,oDAAoD;IACpD,OAAO,CAAC,cAAc,CAAgB;IAEtC;;;;OAIG;gBACS,QAAQ,EAAE,YAAY;IAKlC;;OAEG;IACH,IAAI,aAAa,mBAEhB;IAED;;OAEG;IACG,gBAAgB;IAoBtB;;OAEG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE;CAyB/B"}
|
|
@@ -36,7 +36,37 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import { find, findIndex } from 'lodash-es';
|
|
38
38
|
import { eventBus } from '../editor';
|
|
39
|
+
/**
|
|
40
|
+
* Font loader implementation for CAD text rendering.
|
|
41
|
+
*
|
|
42
|
+
* This class implements the {@link AcDbFontLoader} interface and provides functionality to:
|
|
43
|
+
* - Fetch available font metadata from a CDN
|
|
44
|
+
* - Load required fonts for CAD text rendering
|
|
45
|
+
* - Handle font loading errors and emit appropriate events
|
|
46
|
+
* - Manage font availability checking
|
|
47
|
+
*
|
|
48
|
+
* The font loader works with a Three.js renderer to load fonts that are used
|
|
49
|
+
* for rendering CAD text entities like MText and Text.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const renderer = new AcTrRenderer();
|
|
54
|
+
* const fontLoader = new AcApFontLoader(renderer);
|
|
55
|
+
*
|
|
56
|
+
* // Load specific fonts
|
|
57
|
+
* await fontLoader.load(['Arial', 'SimSun']);
|
|
58
|
+
*
|
|
59
|
+
* // Get all available fonts
|
|
60
|
+
* const fonts = await fontLoader.getAvaiableFonts();
|
|
61
|
+
* console.log('Available fonts:', fonts);
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
39
64
|
var AcApFontLoader = /** @class */ (function () {
|
|
65
|
+
/**
|
|
66
|
+
* Creates a new font loader instance.
|
|
67
|
+
*
|
|
68
|
+
* @param renderer - The Three.js renderer that will use the loaded fonts
|
|
69
|
+
*/
|
|
40
70
|
function AcApFontLoader(renderer) {
|
|
41
71
|
this._cadRenderer = renderer;
|
|
42
72
|
this._avaiableFonts = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApFontLoader.js","sourceRoot":"","sources":["../../src/app/AcApFontLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC;
|
|
1
|
+
{"version":3,"file":"AcApFontLoader.js","sourceRoot":"","sources":["../../src/app/AcApFontLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IAME;;;;OAIG;IACH,wBAAY,QAAsB;QAChC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAA;QAC5B,IAAI,CAAC,cAAc,GAAG,EAAE,CAAA;IAC1B,CAAC;IAKD,sBAAI,yCAAa;QAHjB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,cAAc,CAAA;QAC5B,CAAC;;;OAAA;IAED;;OAEG;IACG,yCAAgB,GAAtB;;;;;;6BACM,CAAA,IAAI,CAAC,cAAc,CAAC,MAAM,IAAI,CAAC,CAAA,EAA/B,wBAA+B;wBAC3B,YAAU,wDAAwD,CAAA;wBAClE,eAAe,GAAG,SAAO,GAAG,YAAY,CAAA;;;;wBAE3B,qBAAM,KAAK,CAAC,eAAe,CAAC,EAAA;;wBAAvC,QAAQ,GAAG,SAA4B;wBAC7C,KAAA,IAAI,CAAA;w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CAAC,IAAI,CAAC,iBAAiB,EAAE;oCAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;oCACvB,GAAG,EAAE,IAAI,CAAC,GAAG;iCACd,CAAC,CAAA;4BACJ,CAAC;wBACH,CAAC,CAAC,CAAA;;;;;KACH;IACH,qBAAC;AAAD,CAAC,AA1ED,IA0EC"}
|
|
@@ -1,44 +1,232 @@
|
|
|
1
1
|
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
2
|
/**
|
|
3
|
-
* Font mappings.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Font mappings for CAD text rendering.
|
|
4
|
+
*
|
|
5
|
+
* Maps original font names to replacement font names when the original
|
|
6
|
+
* font is not available in the system.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const fontMapping: AcApFontMapping = {
|
|
11
|
+
* 'AutoCAD Font': 'Arial',
|
|
12
|
+
* 'SimSun': 'Microsoft YaHei'
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
6
15
|
*/
|
|
7
16
|
export type AcApFontMapping = Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Configuration settings for the CAD application.
|
|
19
|
+
*
|
|
20
|
+
* Contains various UI and rendering preferences that can be persisted
|
|
21
|
+
* and modified during runtime.
|
|
22
|
+
*/
|
|
8
23
|
export interface AcApSettings {
|
|
24
|
+
/** Whether debug mode is enabled for development features */
|
|
9
25
|
isDebug: boolean;
|
|
26
|
+
/** Whether the command line interface is visible */
|
|
10
27
|
isShowCommandLine: boolean;
|
|
28
|
+
/** Whether coordinate display is visible */
|
|
11
29
|
isShowCoordinate: boolean;
|
|
30
|
+
/** Whether the toolbar is visible */
|
|
12
31
|
isShowToolbar: boolean;
|
|
32
|
+
/** Whether performance statistics are displayed */
|
|
13
33
|
isShowStats: boolean;
|
|
34
|
+
/** Font mapping configuration for text rendering */
|
|
14
35
|
fontMapping: AcApFontMapping;
|
|
15
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Event arguments for settings modification events.
|
|
39
|
+
*
|
|
40
|
+
* @template T - The settings type, defaults to AcApSettings
|
|
41
|
+
*/
|
|
16
42
|
export interface AcApSettingManagerEventArgs<T extends AcApSettings = AcApSettings> {
|
|
43
|
+
/** The setting key that was modified */
|
|
17
44
|
key: keyof T;
|
|
45
|
+
/** The new value of the setting */
|
|
18
46
|
value: unknown;
|
|
19
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Singleton settings manager for the CAD application.
|
|
50
|
+
*
|
|
51
|
+
* This class manages application-wide settings with:
|
|
52
|
+
* - Persistent storage using localStorage
|
|
53
|
+
* - Event notification when settings change
|
|
54
|
+
* - Type-safe setting access
|
|
55
|
+
* - Default value fallbacks
|
|
56
|
+
*
|
|
57
|
+
* The settings are automatically saved to localStorage and restored on application start.
|
|
58
|
+
*
|
|
59
|
+
* @template T - The settings interface type, defaults to AcApSettings
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // Get the singleton instance
|
|
64
|
+
* const settings = AcApSettingManager.instance;
|
|
65
|
+
*
|
|
66
|
+
* // Set a setting value
|
|
67
|
+
* settings.set('isShowToolbar', false);
|
|
68
|
+
*
|
|
69
|
+
* // Get a setting value
|
|
70
|
+
* const showToolbar = settings.get('isShowToolbar');
|
|
71
|
+
*
|
|
72
|
+
* // Toggle a boolean setting
|
|
73
|
+
* settings.toggle('isDebug');
|
|
74
|
+
*
|
|
75
|
+
* // Listen for setting changes
|
|
76
|
+
* settings.events.modified.addEventListener(args => {
|
|
77
|
+
* console.log(`Setting ${args.key} changed to:`, args.value);
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
20
81
|
export declare class AcApSettingManager<T extends AcApSettings = AcApSettings> {
|
|
82
|
+
/** Singleton instance */
|
|
21
83
|
private static _instance?;
|
|
84
|
+
/** Events fired when settings are modified */
|
|
22
85
|
readonly events: {
|
|
86
|
+
/** Fired when any setting is modified */
|
|
23
87
|
modified: AcCmEventManager<AcApSettingManagerEventArgs<T>>;
|
|
24
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Gets the singleton instance of the settings manager.
|
|
91
|
+
*
|
|
92
|
+
* Creates a new instance if one doesn't exist yet.
|
|
93
|
+
*
|
|
94
|
+
* @returns The singleton settings manager instance
|
|
95
|
+
*/
|
|
25
96
|
static get instance(): AcApSettingManager<AcApSettings>;
|
|
97
|
+
/**
|
|
98
|
+
* Sets a setting value and persists it to localStorage.
|
|
99
|
+
*
|
|
100
|
+
* Fires a modified event after the setting is saved.
|
|
101
|
+
*
|
|
102
|
+
* @template K - The setting key type
|
|
103
|
+
* @param key - The setting key to modify
|
|
104
|
+
* @param value - The new value for the setting
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* settings.set('isShowToolbar', false);
|
|
109
|
+
* settings.set('fontMapping', { 'Arial': 'Helvetica' });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
26
112
|
set<K extends keyof T>(key: K, value: T[K]): void;
|
|
113
|
+
/**
|
|
114
|
+
* Gets a setting value.
|
|
115
|
+
*
|
|
116
|
+
* Returns the stored value or the default value if not set.
|
|
117
|
+
*
|
|
118
|
+
* @template K - The setting key type
|
|
119
|
+
* @param key - The setting key to retrieve
|
|
120
|
+
* @returns The setting value
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const isDebug = settings.get('isDebug');
|
|
125
|
+
* const fontMapping = settings.get('fontMapping');
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
27
128
|
get<K extends keyof T>(key: K): NonNullable<AcApSettings & T>[K];
|
|
129
|
+
/**
|
|
130
|
+
* Toggles a boolean setting value.
|
|
131
|
+
*
|
|
132
|
+
* Only works with boolean settings. The caller should ensure the setting is boolean.
|
|
133
|
+
*
|
|
134
|
+
* @template K - The setting key type
|
|
135
|
+
* @param key - The boolean setting key to toggle
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* settings.toggle('isDebug'); // false -> true
|
|
140
|
+
* settings.toggle('isShowToolbar'); // true -> false
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
28
143
|
toggle<K extends keyof T>(key: K): void;
|
|
144
|
+
/**
|
|
145
|
+
* Gets whether debug mode is enabled.
|
|
146
|
+
*
|
|
147
|
+
* @returns True if debug mode is enabled
|
|
148
|
+
*/
|
|
29
149
|
get isDebug(): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Sets whether debug mode is enabled.
|
|
152
|
+
*
|
|
153
|
+
* @param value - True to enable debug mode
|
|
154
|
+
*/
|
|
30
155
|
set isDebug(value: boolean);
|
|
156
|
+
/**
|
|
157
|
+
* Gets whether the command line is visible.
|
|
158
|
+
*
|
|
159
|
+
* @returns True if command line should be shown
|
|
160
|
+
*/
|
|
31
161
|
get isShowCommandLine(): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Sets whether the command line is visible.
|
|
164
|
+
*
|
|
165
|
+
* @param value - True to show the command line
|
|
166
|
+
*/
|
|
32
167
|
set isShowCommandLine(value: boolean);
|
|
168
|
+
/**
|
|
169
|
+
* Gets whether coordinate display is visible.
|
|
170
|
+
*
|
|
171
|
+
* @returns True if coordinates should be displayed
|
|
172
|
+
*/
|
|
33
173
|
get isShowCoordinate(): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Sets whether coordinate display is visible.
|
|
176
|
+
*
|
|
177
|
+
* @param value - True to show coordinates
|
|
178
|
+
*/
|
|
34
179
|
set isShowCoordinate(value: boolean);
|
|
180
|
+
/**
|
|
181
|
+
* Gets whether the toolbar is visible.
|
|
182
|
+
*
|
|
183
|
+
* @returns True if toolbar should be shown
|
|
184
|
+
*/
|
|
35
185
|
get isShowToolbar(): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Sets whether the toolbar is visible.
|
|
188
|
+
*
|
|
189
|
+
* @param value - True to show the toolbar
|
|
190
|
+
*/
|
|
36
191
|
set isShowToolbar(value: boolean);
|
|
192
|
+
/**
|
|
193
|
+
* Gets whether performance statistics are displayed.
|
|
194
|
+
*
|
|
195
|
+
* @returns True if stats should be shown
|
|
196
|
+
*/
|
|
37
197
|
get isShowStats(): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Sets whether performance statistics are displayed.
|
|
200
|
+
*
|
|
201
|
+
* @param value - True to show stats
|
|
202
|
+
*/
|
|
38
203
|
set isShowStats(value: boolean);
|
|
204
|
+
/**
|
|
205
|
+
* Gets the font mapping configuration.
|
|
206
|
+
*
|
|
207
|
+
* @returns The current font mapping
|
|
208
|
+
*/
|
|
39
209
|
get fontMapping(): AcApFontMapping;
|
|
210
|
+
/**
|
|
211
|
+
* Sets the font mapping configuration.
|
|
212
|
+
*
|
|
213
|
+
* @param value - The new font mapping
|
|
214
|
+
*/
|
|
40
215
|
set fontMapping(value: AcApFontMapping);
|
|
216
|
+
/**
|
|
217
|
+
* Sets a single font mapping entry.
|
|
218
|
+
*
|
|
219
|
+
* @param originalFont - The original font name
|
|
220
|
+
* @param mappedFont - The replacement font name
|
|
221
|
+
*/
|
|
41
222
|
setFontMapping(originalFont: string, mappedFont: string): void;
|
|
223
|
+
/**
|
|
224
|
+
* Gets the current settings object.
|
|
225
|
+
*
|
|
226
|
+
* This method combines localStorage values with default values.
|
|
227
|
+
*
|
|
228
|
+
* @returns The current settings object
|
|
229
|
+
*/
|
|
42
230
|
get settings(): NonNullable<AcApSettings & T>;
|
|
43
231
|
}
|
|
44
232
|
//# sourceMappingURL=AcApSettingManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApSettingManager.d.ts","sourceRoot":"","sources":["../../src/app/AcApSettingManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAGxD
|
|
1
|
+
{"version":3,"file":"AcApSettingManager.d.ts","sourceRoot":"","sources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