@mlightcad/cad-simple-viewer 1.0.0 → 1.0.2
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 +1348 -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 +229 -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 +76 -7
- package/lib/editor/global/eventBus.d.ts.map +1 -1
- package/lib/editor/global/eventBus.js +38 -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":"AcApDocument.js","sourceRoot":"","sources":["../../src/app/AcApDocument.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAEb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC;
|
|
1
|
+
{"version":3,"file":"AcApDoc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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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
@@ -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":["../../src/app/AcApSettingManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAGxD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAEpD;;;;;GAKG;AACH,MAAM,W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CAPnC;IAED;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAEnC;IAED;;;;OAIG;IACH,IAAI,gBAAgB,IASQ,OAAO,CAPlC;IAED;;;;OAIG;IACH,IAAI,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAElC;IAED;;;;OAIG;IACH,IAAI,aAAa,IASQ,OAAO,CAP/B;IAED;;;;OAIG;IACH,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,EAE/B;IAED;;;;OAIG;IACH,IAAI,WAAW,IASQ,OAAO,CAP7B;IAED;;;;OAIG;IACH,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,EAE7B;IAED;;;;OAIG;IACH,IAAI,WAAW,IASQ,eAAe,CAPrC;IAED;;;;OAIG;IACH,IAAI,WAAW,CAAC,KAAK,EAAE,eAAe,EAErC;IAED;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAMvD;;;;;;OAMG;IACH,IAAI,QAAQ,kCAIX;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
2
|
import { defaults } from 'lodash-es';
|
|
3
|
+
/** Default values for all application settings */
|
|
3
4
|
var DEFAULT_VALUES = {
|
|
4
5
|
isDebug: false,
|
|
5
6
|
isShowCommandLine: true,
|
|
@@ -8,14 +9,57 @@ var DEFAULT_VALUES = {
|
|
|
8
9
|
isShowStats: false,
|
|
9
10
|
fontMapping: {}
|
|
10
11
|
};
|
|
12
|
+
/** Local storage key for persisting settings */
|
|
11
13
|
var SETTINGS_LS_KEY = 'settings';
|
|
14
|
+
/**
|
|
15
|
+
* Singleton settings manager for the CAD application.
|
|
16
|
+
*
|
|
17
|
+
* This class manages application-wide settings with:
|
|
18
|
+
* - Persistent storage using localStorage
|
|
19
|
+
* - Event notification when settings change
|
|
20
|
+
* - Type-safe setting access
|
|
21
|
+
* - Default value fallbacks
|
|
22
|
+
*
|
|
23
|
+
* The settings are automatically saved to localStorage and restored on application start.
|
|
24
|
+
*
|
|
25
|
+
* @template T - The settings interface type, defaults to AcApSettings
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Get the singleton instance
|
|
30
|
+
* const settings = AcApSettingManager.instance;
|
|
31
|
+
*
|
|
32
|
+
* // Set a setting value
|
|
33
|
+
* settings.set('isShowToolbar', false);
|
|
34
|
+
*
|
|
35
|
+
* // Get a setting value
|
|
36
|
+
* const showToolbar = settings.get('isShowToolbar');
|
|
37
|
+
*
|
|
38
|
+
* // Toggle a boolean setting
|
|
39
|
+
* settings.toggle('isDebug');
|
|
40
|
+
*
|
|
41
|
+
* // Listen for setting changes
|
|
42
|
+
* settings.events.modified.addEventListener(args => {
|
|
43
|
+
* console.log(`Setting ${args.key} changed to:`, args.value);
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
12
47
|
var AcApSettingManager = /** @class */ (function () {
|
|
13
48
|
function AcApSettingManager() {
|
|
49
|
+
/** Events fired when settings are modified */
|
|
14
50
|
this.events = {
|
|
51
|
+
/** Fired when any setting is modified */
|
|
15
52
|
modified: new AcCmEventManager()
|
|
16
53
|
};
|
|
17
54
|
}
|
|
18
55
|
Object.defineProperty(AcApSettingManager, "instance", {
|
|
56
|
+
/**
|
|
57
|
+
* Gets the singleton instance of the settings manager.
|
|
58
|
+
*
|
|
59
|
+
* Creates a new instance if one doesn't exist yet.
|
|
60
|
+
*
|
|
61
|
+
* @returns The singleton settings manager instance
|
|
62
|
+
*/
|
|
19
63
|
get: function () {
|
|
20
64
|
if (!this._instance) {
|
|
21
65
|
this._instance = new AcApSettingManager();
|
|
@@ -25,6 +69,21 @@ var AcApSettingManager = /** @class */ (function () {
|
|
|
25
69
|
enumerable: false,
|
|
26
70
|
configurable: true
|
|
27
71
|
});
|
|
72
|
+
/**
|
|
73
|
+
* Sets a setting value and persists it to localStorage.
|
|
74
|
+
*
|
|
75
|
+
* Fires a modified event after the setting is saved.
|
|
76
|
+
*
|
|
77
|
+
* @template K - The setting key type
|
|
78
|
+
* @param key - The setting key to modify
|
|
79
|
+
* @param value - The new value for the setting
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* settings.set('isShowToolbar', false);
|
|
84
|
+
* settings.set('fontMapping', { 'Arial': 'Helvetica' });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
28
87
|
AcApSettingManager.prototype.set = function (key, value) {
|
|
29
88
|
var toggles = this.settings;
|
|
30
89
|
toggles[key] = value;
|
|
@@ -34,18 +93,57 @@ var AcApSettingManager = /** @class */ (function () {
|
|
|
34
93
|
value: value
|
|
35
94
|
});
|
|
36
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* Gets a setting value.
|
|
98
|
+
*
|
|
99
|
+
* Returns the stored value or the default value if not set.
|
|
100
|
+
*
|
|
101
|
+
* @template K - The setting key type
|
|
102
|
+
* @param key - The setting key to retrieve
|
|
103
|
+
* @returns The setting value
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const isDebug = settings.get('isDebug');
|
|
108
|
+
* const fontMapping = settings.get('fontMapping');
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
37
111
|
AcApSettingManager.prototype.get = function (key) {
|
|
38
112
|
return this.settings[key];
|
|
39
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* Toggles a boolean setting value.
|
|
116
|
+
*
|
|
117
|
+
* Only works with boolean settings. The caller should ensure the setting is boolean.
|
|
118
|
+
*
|
|
119
|
+
* @template K - The setting key type
|
|
120
|
+
* @param key - The boolean setting key to toggle
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* settings.toggle('isDebug'); // false -> true
|
|
125
|
+
* settings.toggle('isShowToolbar'); // true -> false
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
40
128
|
AcApSettingManager.prototype.toggle = function (key) {
|
|
41
129
|
var value = this.get(key);
|
|
42
130
|
// @ts-expect-error The caller should guarantee the correct feature name passed to this function
|
|
43
131
|
this.set(key, !value);
|
|
44
132
|
};
|
|
45
133
|
Object.defineProperty(AcApSettingManager.prototype, "isDebug", {
|
|
134
|
+
/**
|
|
135
|
+
* Gets whether debug mode is enabled.
|
|
136
|
+
*
|
|
137
|
+
* @returns True if debug mode is enabled
|
|
138
|
+
*/
|
|
46
139
|
get: function () {
|
|
47
140
|
return this.get('isDebug');
|
|
48
141
|
},
|
|
142
|
+
/**
|
|
143
|
+
* Sets whether debug mode is enabled.
|
|
144
|
+
*
|
|
145
|
+
* @param value - True to enable debug mode
|
|
146
|
+
*/
|
|
49
147
|
set: function (value) {
|
|
50
148
|
this.set('isDebug', value);
|
|
51
149
|
},
|
|
@@ -53,9 +151,19 @@ var AcApSettingManager = /** @class */ (function () {
|
|
|
53
151
|
configurable: true
|
|
54
152
|
});
|
|
55
153
|
Object.defineProperty(AcApSettingManager.prototype, "isShowCommandLine", {
|
|
154
|
+
/**
|
|
155
|
+
* Gets whether the command line is visible.
|
|
156
|
+
*
|
|
157
|
+
* @returns True if command line should be shown
|
|
158
|
+
*/
|
|
56
159
|
get: function () {
|
|
57
160
|
return this.get('isShowCommandLine');
|
|
58
161
|
},
|
|
162
|
+
/**
|
|
163
|
+
* Sets whether the command line is visible.
|
|
164
|
+
*
|
|
165
|
+
* @param value - True to show the command line
|
|
166
|
+
*/
|
|
59
167
|
set: function (value) {
|
|
60
168
|
this.set('isShowCommandLine', value);
|
|
61
169
|
},
|
|
@@ -63,9 +171,19 @@ var AcApSettingManager = /** @class */ (function () {
|
|
|
63
171
|
configurable: true
|
|
64
172
|
});
|
|
65
173
|
Object.defineProperty(AcApSettingManager.prototype, "isShowCoordinate", {
|
|
174
|
+
/**
|
|
175
|
+
* Gets whether coordinate display is visible.
|
|
176
|
+
*
|
|
177
|
+
* @returns True if coordinates should be displayed
|
|
178
|
+
*/
|
|
66
179
|
get: function () {
|
|
67
180
|
return this.get('isShowCoordinate');
|
|
68
181
|
},
|
|
182
|
+
/**
|
|
183
|
+
* Sets whether coordinate display is visible.
|
|
184
|
+
*
|
|
185
|
+
* @param value - True to show coordinates
|
|
186
|
+
*/
|
|
69
187
|
set: function (value) {
|
|
70
188
|
this.set('isShowCoordinate', value);
|
|
71
189
|
},
|
|
@@ -73,9 +191,19 @@ var AcApSettingManager = /** @class */ (function () {
|
|
|
73
191
|
configurable: true
|
|
74
192
|
});
|
|
75
193
|
Object.defineProperty(AcApSettingManager.prototype, "isShowToolbar", {
|
|
194
|
+
/**
|
|
195
|
+
* Gets whether the toolbar is visible.
|
|
196
|
+
*
|
|
197
|
+
* @returns True if toolbar should be shown
|
|
198
|
+
*/
|
|
76
199
|
get: function () {
|
|
77
200
|
return this.get('isShowToolbar');
|
|
78
201
|
},
|
|
202
|
+
/**
|
|
203
|
+
* Sets whether the toolbar is visible.
|
|
204
|
+
*
|
|
205
|
+
* @param value - True to show the toolbar
|
|
206
|
+
*/
|
|
79
207
|
set: function (value) {
|
|
80
208
|
this.set('isShowToolbar', value);
|
|
81
209
|
},
|
|
@@ -83,9 +211,19 @@ var AcApSettingManager = /** @class */ (function () {
|
|
|
83
211
|
configurable: true
|
|
84
212
|
});
|
|
85
213
|
Object.defineProperty(AcApSettingManager.prototype, "isShowStats", {
|
|
214
|
+
/**
|
|
215
|
+
* Gets whether performance statistics are displayed.
|
|
216
|
+
*
|
|
217
|
+
* @returns True if stats should be shown
|
|
218
|
+
*/
|
|
86
219
|
get: function () {
|
|
87
220
|
return this.get('isShowStats');
|
|
88
221
|
},
|
|
222
|
+
/**
|
|
223
|
+
* Sets whether performance statistics are displayed.
|
|
224
|
+
*
|
|
225
|
+
* @param value - True to show stats
|
|
226
|
+
*/
|
|
89
227
|
set: function (value) {
|
|
90
228
|
this.set('isShowStats', value);
|
|
91
229
|
},
|
|
@@ -93,21 +231,44 @@ var AcApSettingManager = /** @class */ (function () {
|
|
|
93
231
|
configurable: true
|
|
94
232
|
});
|
|
95
233
|
Object.defineProperty(AcApSettingManager.prototype, "fontMapping", {
|
|
234
|
+
/**
|
|
235
|
+
* Gets the font mapping configuration.
|
|
236
|
+
*
|
|
237
|
+
* @returns The current font mapping
|
|
238
|
+
*/
|
|
96
239
|
get: function () {
|
|
97
240
|
return this.get('fontMapping');
|
|
98
241
|
},
|
|
242
|
+
/**
|
|
243
|
+
* Sets the font mapping configuration.
|
|
244
|
+
*
|
|
245
|
+
* @param value - The new font mapping
|
|
246
|
+
*/
|
|
99
247
|
set: function (value) {
|
|
100
248
|
this.set('fontMapping', value);
|
|
101
249
|
},
|
|
102
250
|
enumerable: false,
|
|
103
251
|
configurable: true
|
|
104
252
|
});
|
|
253
|
+
/**
|
|
254
|
+
* Sets a single font mapping entry.
|
|
255
|
+
*
|
|
256
|
+
* @param originalFont - The original font name
|
|
257
|
+
* @param mappedFont - The replacement font name
|
|
258
|
+
*/
|
|
105
259
|
AcApSettingManager.prototype.setFontMapping = function (originalFont, mappedFont) {
|
|
106
260
|
var mapping = this.get('fontMapping');
|
|
107
261
|
mapping[originalFont] = mappedFont;
|
|
108
262
|
this.set('fontMapping', mapping);
|
|
109
263
|
};
|
|
110
264
|
Object.defineProperty(AcApSettingManager.prototype, "settings", {
|
|
265
|
+
/**
|
|
266
|
+
* Gets the current settings object.
|
|
267
|
+
*
|
|
268
|
+
* This method combines localStorage values with default values.
|
|
269
|
+
*
|
|
270
|
+
* @returns The current settings object
|
|
271
|
+
*/
|
|
111
272
|
get: function () {
|
|
112
273
|
var values = localStorage.getItem(SETTINGS_LS_KEY);
|
|
113
274
|
var results = (values == null ? {} : JSON.parse(values));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApSettingManager.js","sourceRoot":"","sources":["../../src/app/AcApSettingManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;A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Ae,EAAE,KAAK,CAAC,CAAA;QAClC,CAAC;;;OATA;IAgBD,sBAAI,2CAAW;QALf;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;QAChC,CAAC;QAED;;;;WAIG;aACH,UAAgB,KAAc;YAC5B,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;QAChC,CAAC;;;OATA;IAgBD,sBAAI,2CAAW;QALf;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;QAChC,CAAC;QAED;;;;WAIG;aACH,UAAgB,KAAsB;YACpC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;QAChC,CAAC;;;OATA;IAWD;;;;;OAKG;IACH,2CAAc,GAAd,UAAe,YAAoB,EAAE,UAAkB;QACrD,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAoB,CAAA;QAC1D,OAAO,CAAC,YAAY,CAAC,GAAG,UAAU,CAAA;QAClC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;IASD,sBAAI,wCAAQ;QAPZ;;;;;;WAMG;aACH;YACE,IAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;YACpD,IAAM,OAAO,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAM,CAAA;YAC/D,OAAO,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;QAC1C,CAAC;;;OAAA;IACH,yBAAC;AAAD,CAAC,AA5ND,IA4NC"}
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { AcApContext } from '../app';
|
|
2
2
|
import { AcEdCommand } from '../command';
|
|
3
|
+
/**
|
|
4
|
+
* Command for converting the current CAD drawing to SVG format.
|
|
5
|
+
*
|
|
6
|
+
* This command creates an SVG converter and initiates the conversion
|
|
7
|
+
* process to export the current drawing as an SVG file. The command:
|
|
8
|
+
* - Creates a new SVG converter instance
|
|
9
|
+
* - Converts all entities in the current document to SVG
|
|
10
|
+
* - Automatically downloads the SVG file
|
|
11
|
+
*
|
|
12
|
+
* This is useful for exporting drawings to a web-friendly vector format
|
|
13
|
+
* that can be displayed in browsers or used in web applications.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const convertCmd = new AcApConvertToSvgCmd();
|
|
18
|
+
* convertCmd.execute(context); // Converts and downloads as SVG
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
export declare class AcApConvertToSvgCmd extends AcEdCommand {
|
|
22
|
+
/**
|
|
23
|
+
* Executes the SVG conversion command.
|
|
24
|
+
*
|
|
25
|
+
* Creates a converter instance and initiates the conversion process
|
|
26
|
+
* for the current document.
|
|
27
|
+
*
|
|
28
|
+
* @param _context - The application context (unused in this command)
|
|
29
|
+
*/
|
|
4
30
|
execute(_context: AcApContext): void;
|
|
5
31
|
}
|
|
6
32
|
//# sourceMappingURL=AcApConvertToSvgCmd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcApConvertToSvgCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApConvertToSvgCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,OAAO,CAAC,QAAQ,EAAE,WAAW;CAI9B"}
|
|
1
|
+
{"version":3,"file":"AcApConvertToSvgCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApConvertToSvgCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAClD;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,EAAE,WAAW;CAI9B"}
|