mxcad-app 1.0.5 → 1.0.6
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 +44 -20
- package/dist/chunks/lib.js +2322 -2324
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +23 -3236
- package/dist/index.js +5 -6
- package/dist/index.umd.js +2 -2
- package/dist/mxcad.d.ts +26042 -0
- package/dist/mxcadAppAssets/plugins/pluginIdentifyPattern/index.js +76 -74
- package/dist/mxcadAppAssets/plugins/pluginIdentifyPattern/index.js.map +1 -1
- package/dist/mxcadAppAssets/plugins/test.js +3 -3
- package/dist/mxcadAppAssets/plugins/test.js.map +1 -1
- package/dist/mxdraw.d.ts +5707 -0
- package/package.json +18 -6
package/README.md
CHANGED
|
@@ -23,6 +23,10 @@ yarn add mxcad-app
|
|
|
23
23
|
|
|
24
24
|
## 🚀 使用方法(3分钟搞定)
|
|
25
25
|
|
|
26
|
+
## 核心依赖库
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
26
30
|
### 基于 vite
|
|
27
31
|
|
|
28
32
|
main.js
|
|
@@ -115,10 +119,34 @@ import { setStaticAssetPath } from "mxcad-app";
|
|
|
115
119
|
setStaticAssetPath("https://unpkg.com/mxcad-app/dist/mxcadAppAssets");
|
|
116
120
|
```
|
|
117
121
|
|
|
118
|
-
|
|
122
|
+
## 核心依赖库
|
|
123
|
+
|
|
124
|
+
`mxcad-app`内置了[`mxcad`](https://www.mxdraw3d.com/mxcad_docs/zh/1.%E5%BC%80%E5%A7%8B/2.%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8.html) 核心库,你可以直接使用`mxcad` 不需要安装`mxcad`。
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
import { MxCpp } from 'mxcad'
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
如果不是模块化的方式使用,`mxcad`在`window.MxCAD`挂载你可以直接使用`MxCAD`访问到需要的方法和类。
|
|
132
|
+
|
|
133
|
+
`mxcad`依赖`mxdraw`, 你也可以使用`mxdraw`
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
import * as Mx from 'mxdraw'
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
如果不是模块化的方式使用, `mxdraw` 在 `window.Mx` 挂载。你可以直接使用`Mx`访问到需要的方法和类。
|
|
140
|
+
|
|
141
|
+
直接引入`mxcad`和`mxdraw`模块的前提是要使用构建工具构建。我们提供给了webpack和vite的插件, 用于支持模块化开发。
|
|
119
142
|
|
|
120
|
-
|
|
143
|
+
只要使用了插件就可以直接使用`import`引入`mxcad`和`mxdraw`模块。
|
|
121
144
|
|
|
145
|
+
### 使用 mxcad-app 依赖映射
|
|
146
|
+
|
|
147
|
+
你可以直接引入使用mxcad-app内部使用的mxcad和mxdraw模块。同时你也可以添加配置`libraryNames`使用其他的外部依赖的npm库。
|
|
148
|
+
目前支持的依赖映射的库有`vue`, `axios`, `vuetify`, `vuetify/components`, `mapboxgl`, `pinia` 你也可以访问`window.MXCADAPP_EXTERNALLIBRARIES`获取到所有提供的依赖库,从而不依赖与构建工具的使用。
|
|
149
|
+
比如`vue`框架,只需要添加依赖映射配置, 如:
|
|
122
150
|
vite.config.js
|
|
123
151
|
|
|
124
152
|
```js
|
|
@@ -142,18 +170,13 @@ module.exports = {
|
|
|
142
170
|
// 其他配置...
|
|
143
171
|
plugins: [
|
|
144
172
|
new MxCadAssetsWebpackPlugin({
|
|
145
|
-
libraryNames: ["vue"]
|
|
146
|
-
// 自定义UI配置
|
|
147
|
-
transformMxServerConfig: (config)=> {
|
|
148
|
-
config.title = "自定义标题"
|
|
149
|
-
return config
|
|
150
|
-
}
|
|
173
|
+
libraryNames: ["vue"]
|
|
151
174
|
}),
|
|
152
175
|
],
|
|
153
176
|
};
|
|
154
177
|
```
|
|
155
178
|
|
|
156
|
-
|
|
179
|
+
就可以正常使用mxcad-app中的vue模块(mxcad-app打包的内部vue模块)
|
|
157
180
|
```js
|
|
158
181
|
import { ref } from "vue";
|
|
159
182
|
const n = ref(1)
|
|
@@ -179,7 +202,18 @@ export default {
|
|
|
179
202
|
transformMxServerConfig: (config) => {
|
|
180
203
|
config.serverUrl = "/api/cad"; // 修改API地址
|
|
181
204
|
return config;
|
|
182
|
-
}
|
|
205
|
+
},
|
|
206
|
+
// 修改快捷命令(命令别名)
|
|
207
|
+
// transformMxQuickCommand: (config) => config
|
|
208
|
+
|
|
209
|
+
// 修改草图与注释UI模式的配置
|
|
210
|
+
// transformMxSketchesAndNotesUiConfig: (config) => config
|
|
211
|
+
|
|
212
|
+
// 修改UI配置
|
|
213
|
+
// transformMxUiConfig: (config) => config,
|
|
214
|
+
|
|
215
|
+
// 修改Vuetify主题配置
|
|
216
|
+
// transformVuetifyThemeConfig: (config) => config
|
|
183
217
|
})
|
|
184
218
|
]
|
|
185
219
|
};
|
|
@@ -203,16 +237,6 @@ module.exports = {
|
|
|
203
237
|
};
|
|
204
238
|
```
|
|
205
239
|
|
|
206
|
-
### 配置项说明
|
|
207
|
-
- `transformMxcadUiConfig` - 修改主界面配置
|
|
208
|
-
- `transformMxServerConfig` - 修改服务器配置
|
|
209
|
-
- `transformVuetifyThemeConfig` - 修改主题配置
|
|
210
|
-
- `transformMxQuickCommand` - 修改快捷命令
|
|
211
|
-
- `transformMxSketchesAndNotesUiConfig` - 修改草图工具配置
|
|
212
|
-
- `transformMxUiConfig` - 修改通用UI配置
|
|
213
|
-
|
|
214
|
-
函数接收原始配置对象,返回修改后的配置对象(支持Promise)
|
|
215
|
-
|
|
216
240
|
## 📚 常见问题速查
|
|
217
241
|
|
|
218
242
|
**Q: 支持哪些CAD格式?**
|