@mlightcad/cad-simple-viewer 1.4.7 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +88 -88
  3. package/dist/index.js +6014 -5042
  4. package/dist/index.umd.cjs +22 -22
  5. package/lib/app/AcApAnnotation.d.ts +46 -0
  6. package/lib/app/AcApAnnotation.d.ts.map +1 -0
  7. package/lib/app/AcApAnnotation.js +134 -0
  8. package/lib/app/AcApAnnotation.js.map +1 -0
  9. package/lib/app/AcApDocManager.d.ts +118 -6
  10. package/lib/app/AcApDocManager.d.ts.map +1 -1
  11. package/lib/app/AcApDocManager.js +162 -6
  12. package/lib/app/AcApDocManager.js.map +1 -1
  13. package/lib/app/AcApDocument.d.ts +16 -14
  14. package/lib/app/AcApDocument.d.ts.map +1 -1
  15. package/lib/app/AcApDocument.js +48 -31
  16. package/lib/app/AcApDocument.js.map +1 -1
  17. package/lib/app/AcDbOpenDatabaseOptions.d.ts +28 -0
  18. package/lib/app/AcDbOpenDatabaseOptions.d.ts.map +1 -0
  19. package/lib/app/AcDbOpenDatabaseOptions.js +2 -0
  20. package/lib/app/AcDbOpenDatabaseOptions.js.map +1 -0
  21. package/lib/app/index.d.ts +2 -0
  22. package/lib/app/index.d.ts.map +1 -1
  23. package/lib/app/index.js +2 -0
  24. package/lib/app/index.js.map +1 -1
  25. package/lib/command/AcApBaseRevCmd.d.ts +36 -0
  26. package/lib/command/AcApBaseRevCmd.d.ts.map +1 -0
  27. package/lib/command/AcApBaseRevCmd.js +68 -0
  28. package/lib/command/AcApBaseRevCmd.js.map +1 -0
  29. package/lib/command/AcApCircleCmd.d.ts +1 -0
  30. package/lib/command/AcApCircleCmd.d.ts.map +1 -1
  31. package/lib/command/AcApCircleCmd.js +4 -2
  32. package/lib/command/AcApCircleCmd.js.map +1 -1
  33. package/lib/command/AcApConvertToSvgCmd.d.ts +1 -1
  34. package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -1
  35. package/lib/command/AcApConvertToSvgCmd.js +44 -2
  36. package/lib/command/AcApConvertToSvgCmd.js.map +1 -1
  37. package/lib/command/AcApDimLinearCmd.d.ts +1 -0
  38. package/lib/command/AcApDimLinearCmd.d.ts.map +1 -1
  39. package/lib/command/AcApDimLinearCmd.js +4 -2
  40. package/lib/command/AcApDimLinearCmd.js.map +1 -1
  41. package/lib/command/AcApEraseCmd.d.ts +1 -0
  42. package/lib/command/AcApEraseCmd.d.ts.map +1 -1
  43. package/lib/command/AcApEraseCmd.js +14 -4
  44. package/lib/command/AcApEraseCmd.js.map +1 -1
  45. package/lib/command/AcApLineCmd.d.ts +1 -0
  46. package/lib/command/AcApLineCmd.d.ts.map +1 -1
  47. package/lib/command/AcApLineCmd.js +4 -2
  48. package/lib/command/AcApLineCmd.js.map +1 -1
  49. package/lib/command/AcApLogCmd.d.ts +1 -1
  50. package/lib/command/AcApLogCmd.d.ts.map +1 -1
  51. package/lib/command/AcApLogCmd.js +44 -3
  52. package/lib/command/AcApLogCmd.js.map +1 -1
  53. package/lib/command/AcApOpenCmd.d.ts +1 -1
  54. package/lib/command/AcApOpenCmd.d.ts.map +1 -1
  55. package/lib/command/AcApOpenCmd.js +42 -1
  56. package/lib/command/AcApOpenCmd.js.map +1 -1
  57. package/lib/command/AcApPanCmd.d.ts +1 -1
  58. package/lib/command/AcApPanCmd.d.ts.map +1 -1
  59. package/lib/command/AcApPanCmd.js +43 -2
  60. package/lib/command/AcApPanCmd.js.map +1 -1
  61. package/lib/command/AcApQNewCmd.d.ts +1 -1
  62. package/lib/command/AcApQNewCmd.d.ts.map +1 -1
  63. package/lib/command/AcApQNewCmd.js +44 -2
  64. package/lib/command/AcApQNewCmd.js.map +1 -1
  65. package/lib/command/AcApRectCmd.d.ts +23 -0
  66. package/lib/command/AcApRectCmd.d.ts.map +1 -0
  67. package/lib/command/AcApRectCmd.js +134 -0
  68. package/lib/command/AcApRectCmd.js.map +1 -0
  69. package/lib/command/AcApRegenCmd.d.ts +1 -1
  70. package/lib/command/AcApRegenCmd.d.ts.map +1 -1
  71. package/lib/command/AcApRegenCmd.js +42 -1
  72. package/lib/command/AcApRegenCmd.js.map +1 -1
  73. package/lib/command/AcApRevCircleCmd.d.ts +10 -0
  74. package/lib/command/AcApRevCircleCmd.d.ts.map +1 -0
  75. package/lib/command/AcApRevCircleCmd.js +83 -0
  76. package/lib/command/AcApRevCircleCmd.js.map +1 -0
  77. package/lib/command/AcApRevCloudCmd.d.ts +26 -0
  78. package/lib/command/AcApRevCloudCmd.d.ts.map +1 -0
  79. package/lib/command/AcApRevCloudCmd.js +234 -0
  80. package/lib/command/AcApRevCloudCmd.js.map +1 -0
  81. package/lib/command/AcApRevRectCmd.d.ts +10 -0
  82. package/lib/command/AcApRevRectCmd.d.ts.map +1 -0
  83. package/lib/command/AcApRevRectCmd.js +83 -0
  84. package/lib/command/AcApRevRectCmd.js.map +1 -0
  85. package/lib/command/AcApRevVisibilityCmd.d.ts +15 -0
  86. package/lib/command/AcApRevVisibilityCmd.d.ts.map +1 -0
  87. package/lib/command/AcApRevVisibilityCmd.js +90 -0
  88. package/lib/command/AcApRevVisibilityCmd.js.map +1 -0
  89. package/lib/command/AcApSelectCmd.d.ts +1 -1
  90. package/lib/command/AcApSelectCmd.d.ts.map +1 -1
  91. package/lib/command/AcApSelectCmd.js +43 -2
  92. package/lib/command/AcApSelectCmd.js.map +1 -1
  93. package/lib/command/AcApSketchCmd.d.ts +32 -0
  94. package/lib/command/AcApSketchCmd.d.ts.map +1 -0
  95. package/lib/command/AcApSketchCmd.js +171 -0
  96. package/lib/command/AcApSketchCmd.js.map +1 -0
  97. package/lib/command/AcApSwitchBgCmd.d.ts +15 -0
  98. package/lib/command/AcApSwitchBgCmd.d.ts.map +1 -0
  99. package/lib/command/AcApSwitchBgCmd.js +88 -0
  100. package/lib/command/AcApSwitchBgCmd.js.map +1 -0
  101. package/lib/command/AcApSysVarCmd.d.ts +2 -1
  102. package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
  103. package/lib/command/AcApSysVarCmd.js +6 -5
  104. package/lib/command/AcApSysVarCmd.js.map +1 -1
  105. package/lib/command/AcApZoomCmd.d.ts +1 -1
  106. package/lib/command/AcApZoomCmd.d.ts.map +1 -1
  107. package/lib/command/AcApZoomCmd.js +42 -1
  108. package/lib/command/AcApZoomCmd.js.map +1 -1
  109. package/lib/command/index.d.ts +8 -0
  110. package/lib/command/index.d.ts.map +1 -1
  111. package/lib/command/index.js +8 -0
  112. package/lib/command/index.js.map +1 -1
  113. package/lib/editor/command/AcEdCommand.d.ts +81 -22
  114. package/lib/editor/command/AcEdCommand.d.ts.map +1 -1
  115. package/lib/editor/command/AcEdCommand.js +157 -15
  116. package/lib/editor/command/AcEdCommand.js.map +1 -1
  117. package/lib/editor/command/AcEdCommandIterator.d.ts +1 -1
  118. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -1
  119. package/lib/editor/command/AcEdCommandStack.d.ts +31 -6
  120. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
  121. package/lib/editor/command/AcEdCommandStack.js +55 -11
  122. package/lib/editor/command/AcEdCommandStack.js.map +1 -1
  123. package/lib/editor/input/AcEditor.d.ts +14 -0
  124. package/lib/editor/input/AcEditor.d.ts.map +1 -1
  125. package/lib/editor/input/AcEditor.js +5 -1
  126. package/lib/editor/input/AcEditor.js.map +1 -1
  127. package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
  128. package/lib/editor/input/ui/AcEdCommandLine.js +2 -2
  129. package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
  130. package/lib/editor/view/AcEdOpenMode.d.ts +26 -0
  131. package/lib/editor/view/AcEdOpenMode.d.ts.map +1 -0
  132. package/lib/editor/view/AcEdOpenMode.js +27 -0
  133. package/lib/editor/view/AcEdOpenMode.js.map +1 -0
  134. package/lib/editor/view/index.d.ts +2 -0
  135. package/lib/editor/view/index.d.ts.map +1 -1
  136. package/lib/editor/view/index.js +2 -0
  137. package/lib/editor/view/index.js.map +1 -1
  138. package/lib/i18n/en/command.d.ts +18 -0
  139. package/lib/i18n/en/command.d.ts.map +1 -1
  140. package/lib/i18n/en/command.js +19 -1
  141. package/lib/i18n/en/command.js.map +1 -1
  142. package/lib/i18n/en/jig.d.ts +8 -0
  143. package/lib/i18n/en/jig.d.ts.map +1 -1
  144. package/lib/i18n/en/jig.js +8 -0
  145. package/lib/i18n/en/jig.js.map +1 -1
  146. package/lib/i18n/zh/command.d.ts +18 -0
  147. package/lib/i18n/zh/command.d.ts.map +1 -1
  148. package/lib/i18n/zh/command.js +18 -0
  149. package/lib/i18n/zh/command.js.map +1 -1
  150. package/lib/i18n/zh/jig.d.ts +8 -0
  151. package/lib/i18n/zh/jig.d.ts.map +1 -1
  152. package/lib/i18n/zh/jig.js +8 -0
  153. package/lib/i18n/zh/jig.js.map +1 -1
  154. package/lib/index.d.ts +1 -0
  155. package/lib/index.d.ts.map +1 -1
  156. package/lib/index.js +1 -0
  157. package/lib/index.js.map +1 -1
  158. package/lib/plugin/AcApPlugin.d.ts +83 -0
  159. package/lib/plugin/AcApPlugin.d.ts.map +1 -0
  160. package/lib/plugin/AcApPlugin.js +2 -0
  161. package/lib/plugin/AcApPlugin.js.map +1 -0
  162. package/lib/plugin/AcApPluginExample.d.ts +23 -0
  163. package/lib/plugin/AcApPluginExample.d.ts.map +1 -0
  164. package/lib/plugin/AcApPluginExample.js +160 -0
  165. package/lib/plugin/AcApPluginExample.js.map +1 -0
  166. package/lib/plugin/AcApPluginManager.d.ts +206 -0
  167. package/lib/plugin/AcApPluginManager.d.ts.map +1 -0
  168. package/lib/plugin/AcApPluginManager.js +499 -0
  169. package/lib/plugin/AcApPluginManager.js.map +1 -0
  170. package/lib/plugin/index.d.ts +4 -0
  171. package/lib/plugin/index.d.ts.map +1 -0
  172. package/lib/plugin/index.js +4 -0
  173. package/lib/plugin/index.js.map +1 -0
  174. package/lib/view/AcTrView2d.d.ts.map +1 -1
  175. package/lib/view/AcTrView2d.js +8 -1
  176. package/lib/view/AcTrView2d.js.map +1 -1
  177. package/package.json +5 -5
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 mlight-lee
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 mlight-lee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,89 +1,89 @@
1
- # CAD Simple Viewer
2
-
3
- This package provides the **high-performance** core components of a CAD viewer such as document management, command handling, and collaboration between the UI and rendering engines. It's designed for optimal performance when handling large CAD files.
4
-
5
- This module doesn't depend on any UI framework and doesn't provide any UI except canvas. If you want to integrate a high-performance CAD viewer into a web application with your own UI, this module is the correct choice.
6
-
7
- ## Key Features
8
- - Document management optimized for large files
9
- - Efficient command stack and undo/redo operations
10
- - Optimized integration with rendering engines
11
- - Performance-focused settings and context management
12
- - Framework-agnostic design for maximum flexibility
13
-
14
- ## When Should You Choose cad-simple-viewer?
15
-
16
- Use `cad-simple-viewer` if you need **core CAD logic only** (document management, command stack, rendering engine integration) without any UI framework dependencies. This package is ideal if:
17
-
18
- - You want to build your **own custom UI** or integrate CAD functionality into a non-Vue or non-web environment.
19
- - You require maximum flexibility and performance for handling large CAD files, and plan to connect the logic to your own rendering or UI layer.
20
- - You want a framework-agnostic solution that provides only the essential CAD operations and canvas rendering.
21
-
22
- **Recommended for:** Custom integrations, headless CAD processing, or advanced users building highly tailored CAD solutions.
23
-
24
- ## Directory Structure (partial)
25
- - `src/app/` – Document/context management, settings
26
- - `src/command/` – Command implementations (open, zoom, select, etc.)
27
- - `src/editor/` – Command stack, input handling, global functions
28
- - `src/view/` – Layout and scene management
29
- - `src/util/` – Utilities
30
-
31
- ## Installation
32
-
33
- ```bash
34
- npm install @mlightcad/cad-simple-viewer
35
- ```
36
-
37
- ## Usage
38
-
39
- Please refer to [cad-simple-viewer-example](https://github.com/mlight-lee/cad-simple-viewer-example) on basic usage and advanced usage.
40
-
41
- While `cad-simple-viewer` doesn't support saving drawings to DWG/DXF files, it provides comprehensive support for **modifying drawings in real-time**. You can add, edit, and delete entities within the drawing, and the viewer will automatically update to reflect these changes.
42
-
43
- When you modify entities, you're working directly with the underlying drawing database. The viewer automatically detects these changes and updates the display accordingly. This real-time synchronization ensures that:
44
-
45
- - All modifications are immediately visible
46
- - The command stack properly tracks changes for undo/redo operations. This will be implemented soon.
47
-
48
- This capability makes `cad-simple-viewer` suitable for applications that need to not only display CAD files but also allow users to interact with and modify the drawing content.
49
-
50
- **Important Note**: The usage patterns in `cad-simple-viewer` are **very similar to AutoCAD RealDWG**. If you're familiar with AutoCAD RealDWG development, you'll find the API structure and workflow nearly identical. The main difference is that we use the [**realdwg-web API**](https://mlight-lee.github.io/realdwg-web/) instead of the native RealDWG libraries.
51
-
52
- In [cad-simple-viewer-example](https://github.com/mlight-lee/cad-simple-viewer-example) it demonstrates how to create one drawing with [**realdwg-web API**](https://mlight-lee.github.io/realdwg-web/).
53
-
54
- ## Available Exports
55
-
56
- ### Core Classes
57
-
58
- - `AcApContext` - Main application context
59
- - `AcApDocManager` - Document management
60
- - `AcApDocument` - Individual document handling
61
- - `AcApSettingManager` - Settings management
62
-
63
- ### Commands
64
-
65
- - `AcApOpenCmd` - Open file command
66
- - `AcApZoomCmd` - Zoom command
67
- - `AcApPanCmd` - Pan command
68
- - `AcApSelectCmd` - Selection command
69
- - `AcApConvertToSvgCmd` - SVG conversion command
70
-
71
- ### Editor Components
72
-
73
- - `AcEditor` - Main editor class
74
- - `AcEdCommandStack` - Command stack management
75
- - `AcEdSelectionSet` - Selection handling
76
- - `AcEdInputPoint` - Input point management
77
-
78
- ### View Components
79
-
80
- - `AcTrScene` - Scene management
81
- - `AcTrLayoutView` - Layout view handling
82
- - `AcTrView2d` - 2D view management
83
-
84
- ## Role in MLightCAD
85
- This package acts as the core logic layer, connecting the frontend UI with the rendering engines and managing all document-related operations.
86
-
87
- ## License
88
-
1
+ # CAD Simple Viewer
2
+
3
+ This package provides the **high-performance** core components of a CAD viewer such as document management, command handling, and collaboration between the UI and rendering engines. It's designed for optimal performance when handling large CAD files.
4
+
5
+ This module doesn't depend on any UI framework and doesn't provide any UI except canvas. If you want to integrate a high-performance CAD viewer into a web application with your own UI, this module is the correct choice.
6
+
7
+ ## Key Features
8
+ - Document management optimized for large files
9
+ - Efficient command stack and undo/redo operations
10
+ - Optimized integration with rendering engines
11
+ - Performance-focused settings and context management
12
+ - Framework-agnostic design for maximum flexibility
13
+
14
+ ## When Should You Choose cad-simple-viewer?
15
+
16
+ Use `cad-simple-viewer` if you need **core CAD logic only** (document management, command stack, rendering engine integration) without any UI framework dependencies. This package is ideal if:
17
+
18
+ - You want to build your **own custom UI** or integrate CAD functionality into a non-Vue or non-web environment.
19
+ - You require maximum flexibility and performance for handling large CAD files, and plan to connect the logic to your own rendering or UI layer.
20
+ - You want a framework-agnostic solution that provides only the essential CAD operations and canvas rendering.
21
+
22
+ **Recommended for:** Custom integrations, headless CAD processing, or advanced users building highly tailored CAD solutions.
23
+
24
+ ## Directory Structure (partial)
25
+ - `src/app/` – Document/context management, settings
26
+ - `src/command/` – Command implementations (open, zoom, select, etc.)
27
+ - `src/editor/` – Command stack, input handling, global functions
28
+ - `src/view/` – Layout and scene management
29
+ - `src/util/` – Utilities
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install @mlightcad/cad-simple-viewer
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ Please refer to [cad-simple-viewer-example](https://github.com/mlight-lee/cad-simple-viewer-example) on basic usage and advanced usage.
40
+
41
+ While `cad-simple-viewer` doesn't support saving drawings to DWG/DXF files, it provides comprehensive support for **modifying drawings in real-time**. You can add, edit, and delete entities within the drawing, and the viewer will automatically update to reflect these changes.
42
+
43
+ When you modify entities, you're working directly with the underlying drawing database. The viewer automatically detects these changes and updates the display accordingly. This real-time synchronization ensures that:
44
+
45
+ - All modifications are immediately visible
46
+ - The command stack properly tracks changes for undo/redo operations. This will be implemented soon.
47
+
48
+ This capability makes `cad-simple-viewer` suitable for applications that need to not only display CAD files but also allow users to interact with and modify the drawing content.
49
+
50
+ **Important Note**: The usage patterns in `cad-simple-viewer` are **very similar to AutoCAD RealDWG**. If you're familiar with AutoCAD RealDWG development, you'll find the API structure and workflow nearly identical. The main difference is that we use the [**realdwg-web API**](https://mlight-lee.github.io/realdwg-web/) instead of the native RealDWG libraries.
51
+
52
+ In [cad-simple-viewer-example](https://github.com/mlight-lee/cad-simple-viewer-example) it demonstrates how to create one drawing with [**realdwg-web API**](https://mlight-lee.github.io/realdwg-web/).
53
+
54
+ ## Available Exports
55
+
56
+ ### Core Classes
57
+
58
+ - `AcApContext` - Main application context
59
+ - `AcApDocManager` - Document management
60
+ - `AcApDocument` - Individual document handling
61
+ - `AcApSettingManager` - Settings management
62
+
63
+ ### Commands
64
+
65
+ - `AcApOpenCmd` - Open file command
66
+ - `AcApZoomCmd` - Zoom command
67
+ - `AcApPanCmd` - Pan command
68
+ - `AcApSelectCmd` - Selection command
69
+ - `AcApConvertToSvgCmd` - SVG conversion command
70
+
71
+ ### Editor Components
72
+
73
+ - `AcEditor` - Main editor class
74
+ - `AcEdCommandStack` - Command stack management
75
+ - `AcEdSelectionSet` - Selection handling
76
+ - `AcEdInputPoint` - Input point management
77
+
78
+ ### View Components
79
+
80
+ - `AcTrScene` - Scene management
81
+ - `AcTrLayoutView` - Layout view handling
82
+ - `AcTrView2d` - 2D view management
83
+
84
+ ## Role in MLightCAD
85
+ This package acts as the core logic layer, connecting the frontend UI with the rendering engines and managing all document-related operations.
86
+
87
+ ## License
88
+
89
89
  MIT