@zhangqingcq/vgce 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/README.md +83 -83
  2. package/dist/style.css +2 -2
  3. package/dist/vgce.js +7001 -6946
  4. package/dist/vgce.umd.cjs +62 -62
  5. package/package.json +10 -8
  6. package/src/App.vue +1 -3
  7. package/src/components/svg-analysis/index.vue +0 -2
  8. package/src/components/svg-editor/center-panel/index.vue +0 -1
  9. package/src/components/svg-editor/component-tree/index.vue +0 -1
  10. package/src/components/svg-editor/connection-panel/index.vue +0 -1
  11. package/src/components/svg-editor/export-json/index.vue +0 -1
  12. package/src/components/svg-editor/handle-panel/index.vue +0 -1
  13. package/src/components/svg-editor/import-json/index.vue +0 -1
  14. package/src/components/svg-editor/index.vue +0 -1
  15. package/src/components/svg-editor/left-panel/index.vue +0 -1
  16. package/src/components/svg-editor/right-panel/code-edit-modal.vue +0 -1
  17. package/src/components/svg-editor/right-panel/common-animate.vue +0 -1
  18. package/src/components/svg-editor/right-panel/condition.vue +0 -1
  19. package/src/components/svg-editor/right-panel/dynamic-el-form-item.vue +4 -4
  20. package/src/components/svg-editor/right-panel/index.vue +1 -2
  21. package/src/components/svg-editor/right-panel/list.vue +0 -1
  22. package/src/components/svg-viewer/index.vue +100 -87
  23. package/src/components/vue3-ruler-tool/index.vue +0 -1
  24. package/src/config/files/clock-a.vue +0 -2
  25. package/src/config/files/common-table.vue +0 -1
  26. package/src/config/files/light-a.vue +0 -2
  27. package/src/config/files/now-time.vue +0 -1
  28. package/src/config/files/pie-charts.vue +0 -1
  29. package/src/config/files/progress.vue +0 -1
  30. package/src/config/files/svg-text.vue +0 -2
  31. package/src/config/files/switch-a.vue +0 -2
  32. package/src/config/svg/stateless/index.ts +1 -5
  33. package/src/config/types.ts +2 -2
  34. package/src/hooks.ts +0 -1
  35. package/src/index.ts +2 -4
  36. package/src/main.ts +0 -1
  37. package/src/stores/config/index.ts +0 -1
  38. package/src/stores/global/index.ts +0 -2
  39. package/src/stores/main.ts +0 -3
  40. package/src/stores/svg-edit-layout/index.ts +0 -1
  41. package/src/stores/system/index.ts +0 -1
  42. package/src/utils/fetch.ts +0 -2
  43. package/src/utils/proxy.ts +0 -1
  44. package/src/views/EditorS.vue +0 -1
  45. package/types/index.d.ts +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangqingcq/vgce",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Vector graphics configure editor. svg组态编辑器。基于vue3.3+ts+element-plus+vite",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -62,29 +62,31 @@
62
62
  "animate.css": "^4.1.1",
63
63
  "axios": "^1.4.0",
64
64
  "echarts": "^5.4.1",
65
- "element-plus": "^2.3.7",
65
+ "element-plus": "^2.3.8",
66
66
  "lodash": "^4.17.21",
67
67
  "mqtt": "^4.3.7",
68
- "pinia": "^2.0.36",
68
+ "pinia": "^2.1.3",
69
69
  "vue": "^3.3.4",
70
70
  "vue-echarts": "^6.5.1",
71
- "vue-router": "^4.2.0",
71
+ "vue-router": "^4.2.2",
72
72
  "vue3-ace-editor": "^2.2.2"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@tsconfig/node18": "^2.0.1",
76
- "@types/node": "^18.16.8",
76
+ "@types/node": "^18.16.17",
77
77
  "@vitejs/plugin-vue": "^4.2.3",
78
78
  "@vitejs/plugin-vue-jsx": "^3.0.1",
79
79
  "@vue/tsconfig": "^0.4.0",
80
80
  "less": "^4.1.3",
81
81
  "npm-run-all": "^4.1.5",
82
82
  "prettier": "3.0.0",
83
- "typescript": "~5.1.6",
84
- "vite": "4.3.9",
83
+ "typescript": "~5.0.4",
84
+ "unplugin-auto-import": "^0.16.6",
85
+ "unplugin-vue-components": "^0.25.1",
86
+ "vite": "^4.3.9",
85
87
  "vite-plugin-svg-icons": "^2.0.1",
86
88
  "vite-plugin-windicss": "^1.9.0",
87
- "vue-tsc": "^1.8.4",
89
+ "vue-tsc": "^1.6.5",
88
90
  "windicss": "^3.5.6"
89
91
  },
90
92
  "engines": {
package/src/App.vue CHANGED
@@ -1,6 +1,4 @@
1
- <script setup lang="ts">
2
- import { RouterView } from 'vue-router'
3
- </script>
1
+ <script setup lang="ts"></script>
4
2
 
5
3
  <template>
6
4
  <RouterView />
@@ -1,6 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
3
-
4
2
  const props = withDefaults(defineProps<{ name: string; props?: object }>(), { props: () => ({}) })
5
3
  const symbolId = computed(() => `#svg-${props.name}`)
6
4
  </script>
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { computed, getCurrentInstance, onMounted, reactive, ref } from 'vue'
3
2
  import { pinia } from '@/hooks'
4
3
  import { useConfigStore } from '@/stores/config'
5
4
  import { useGlobalStore } from '@/stores/global'
@@ -1,5 +1,4 @@
1
1
  <script lang="ts" setup>
2
- import { ref } from 'vue'
3
2
  import { pinia } from '@/hooks'
4
3
  import { useGlobalStore } from '@/stores/global'
5
4
  import { ElTree } from 'element-plus'
@@ -5,7 +5,6 @@
5
5
  import type { ISystemStraightLine } from '@/components/config/types'
6
6
  import { pinia } from '@/hooks'
7
7
  import { useConfigStore } from '@/stores/config'
8
- import { ref } from 'vue'
9
8
  import { useGlobalStore } from '@/stores/global'
10
9
  import { EGlobalStoreIntention, EMouseInfoState } from '@/stores/global/types'
11
10
  import type { IDoneJson } from '@/stores/global/types'
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { onMounted, ref } from 'vue'
3
2
  import { VAceEditor } from 'vue3-ace-editor'
4
3
  import '@/components/ace-edit'
5
4
  import { pinia } from '@/hooks'
@@ -2,7 +2,6 @@
2
2
  <script lang="ts" setup>
3
3
  import { pinia } from '@/hooks'
4
4
  import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
5
- import { ref } from 'vue'
6
5
  import { useGlobalStore } from '@/stores/global'
7
6
  import { EGlobalStoreIntention, EMouseInfoState, EScaleInfoType } from '@/stores/global/types'
8
7
  import type { IDoneJson } from '@/stores/global/types'
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { ref } from 'vue'
3
2
  import { VAceEditor } from 'vue3-ace-editor'
4
3
  import '@/components/ace-edit'
5
4
 
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { getCurrentInstance, onMounted, reactive, ref } from 'vue'
3
2
  import {
4
3
  ElContainer,
5
4
  ElHeader,
@@ -1,6 +1,5 @@
1
1
  <!--左侧工具栏-->
2
2
  <script lang="ts" setup>
3
- import { ref } from 'vue'
4
3
  import { ElCollapse, ElCollapseItem, ElIcon, ElMessage } from 'element-plus'
5
4
  import type { IConfig, IConfigItem } from '@/config/types'
6
5
  import { pinia } from '@/hooks'
@@ -2,7 +2,6 @@
2
2
  import { VAceEditor } from 'vue3-ace-editor'
3
3
  import '@/components/ace-edit'
4
4
  import { ElButton, ElDialog } from 'element-plus'
5
- import { computed, ref } from 'vue'
6
5
 
7
6
  const props = withDefaults(defineProps<{ modelValue: any; lang: string; title: string }>(), {
8
7
  modelValue: () => ({}),
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import { ElTag, ElDrawer, ElTabs, ElTabPane, ElScrollbar, ElIcon } from 'element-plus'
3
- import { ref, watch } from 'vue'
4
3
  import { common_animate_list } from '@/components/config'
5
4
  import SvgAnalysis from '@/components/svg-analysis/index.vue'
6
5
 
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
3
2
  import { ElFormItem, ElInput, ElOption, ElSelect } from 'element-plus/es'
4
3
  import type { ICondition } from '@/config/types'
5
4
  import { EConditionType } from '@/config/types'
@@ -59,22 +59,22 @@
59
59
  v-else-if="attr_item.type === EConfigItemPropsType.InputNumber"
60
60
  v-model="attr_item.val"
61
61
  :disabled="Boolean(attr_item?.disabled)"
62
- ></el-input-number>
62
+ />
63
63
  <el-input
64
64
  v-else-if="attr_item.type === EConfigItemPropsType.Input"
65
65
  v-model="attr_item.val"
66
66
  :disabled="Boolean(attr_item?.disabled)"
67
- ></el-input>
67
+ />
68
68
  <el-color-picker
69
69
  v-else-if="attr_item.type === EConfigItemPropsType.Color"
70
70
  v-model="attr_item.val"
71
71
  :disabled="Boolean(attr_item?.disabled)"
72
- ></el-color-picker>
72
+ />
73
73
  <el-switch
74
74
  v-else-if="attr_item.type === EConfigItemPropsType.Switch"
75
75
  v-model="attr_item.val"
76
76
  :disabled="Boolean(attr_item?.disabled)"
77
- ></el-switch>
77
+ />
78
78
  <code-edit-modal
79
79
  v-else-if="attr_item.type === EConfigItemPropsType.JsonEdit"
80
80
  v-model="attr_item.val"
@@ -14,7 +14,6 @@
14
14
  ElTabPane,
15
15
  ElTabs
16
16
  } from 'element-plus'
17
- import { ref } from 'vue'
18
17
  import { pinia } from '@/hooks'
19
18
  import { useConfigStore } from '@/stores/config'
20
19
  import { useGlobalStore } from '@/stores/global'
@@ -248,7 +247,7 @@
248
247
  </el-form-item>
249
248
  <div
250
249
  v-for="(e, k) in globalStore.handle_svg_info!.info.state"
251
- :key="'state' + k"
250
+ :key="'state' + String(k)"
252
251
  v-if="globalStore.handle_svg_info!.info.state"
253
252
  >
254
253
  <el-form-item class="props-row" :label="String(k)" size="small"> {{ e?.default }}</el-form-item>
@@ -2,7 +2,6 @@
2
2
  import type { IAttrItem } from '@/config/types'
3
3
  import { ElIcon, ElInput } from 'element-plus'
4
4
  import SvgAnalysis from '@/components/svg-analysis/index.vue'
5
- import { computed } from 'vue'
6
5
 
7
6
  const props = withDefaults(defineProps<{ modelValue: IAttrItem[] }>(), {
8
7
  modelValue: () => [
@@ -1,5 +1,4 @@
1
- <script setup lang="ts">
2
- import { getCurrentInstance, onMounted, onBeforeUnmount, reactive } from 'vue'
1
+ <script setup lang='ts'>
3
2
  import { pinia } from '@/hooks'
4
3
  import { useGlobalStore } from '@/stores/global'
5
4
  import { EGlobalStoreIntention, EMouseInfoState } from '@/stores/global/types'
@@ -16,6 +15,7 @@
16
15
 
17
16
  import { sub, close } from '@/utils/mqtt-net'
18
17
 
18
+ const emit = defineEmits(['on-message'])
19
19
  //注册所有组件
20
20
  const instance = getCurrentInstance()
21
21
  Object.keys(vueComp).forEach((key: string) => {
@@ -27,45 +27,51 @@
27
27
  const props = withDefaults(defineProps<{ data?: IDataModel; canvasDrag?: boolean }>(), {
28
28
  canvasDrag: true
29
29
  })
30
- const preview_data = reactive(
31
- props.data ?? {
32
- layout_center: {
33
- x: 0,
34
- y: 0
35
- },
36
- config: {
37
- svg: {
38
- background_color: '#fff',
39
- scale: 1,
40
- position_center: {
41
- x: -333,
42
- y: -113
43
- },
44
- svg_position_center: {
45
- x: 50,
46
- y: 50
47
- }
30
+ const preview_data = reactive(props.data ?? {
31
+ layout_center: {
32
+ x: 0,
33
+ y: 0
34
+ },
35
+ config: {
36
+ svg: {
37
+ background_color: '#fff',
38
+ scale: 1,
39
+ position_center: {
40
+ x: -333,
41
+ y: -113
48
42
  },
49
- net: { mqtt: { url: '', user: '', pwd: '', topics: '' } }
43
+ svg_position_center: {
44
+ x: 50,
45
+ y: 50
46
+ }
50
47
  },
51
- done_json: []
52
- }
53
- )
48
+ net: {
49
+ mqtt: {
50
+ url: '',
51
+ user: '',
52
+ pwd: '',
53
+ topics: ''
54
+ }
55
+ }
56
+ },
57
+ done_json: []
58
+ })
54
59
  const globalStore = useGlobalStore(pinia)
55
60
 
56
61
  const onCanvasMouseMove = (e: MouseEvent) => {
57
62
  //如果鼠标不是按下状态 连线除外
58
- if (
59
- globalStore.mouse_info.state != EMouseInfoState.Down &&
60
- globalStore.intention !== EGlobalStoreIntention.Connection
61
- ) {
63
+ if (globalStore.mouse_info.state != EMouseInfoState.Down && globalStore.intention !==
64
+ EGlobalStoreIntention.Connection) {
62
65
  return
63
66
  }
64
67
  if (!props.canvasDrag) {
65
68
  console.log(props.canvasDrag)
66
69
  return
67
70
  }
68
- const { clientX, clientY } = e
71
+ const {
72
+ clientX,
73
+ clientY
74
+ } = e
69
75
  globalStore.mouse_info.new_position_x =
70
76
  globalStore.mouse_info.now_position_x + clientX - globalStore.mouse_info.position_x
71
77
  globalStore.mouse_info.new_position_y =
@@ -96,7 +102,10 @@
96
102
  }
97
103
  const onCanvasMouseDown = (e: MouseEvent) => {
98
104
  console.log('onCanvasMouseDown', e)
99
- const { clientX, clientY } = e
105
+ const {
106
+ clientX,
107
+ clientY
108
+ } = e
100
109
  //点击画布 未选中组件 拖动画布
101
110
  globalStore.intention = EGlobalStoreIntention.MoveCanvas
102
111
  globalStore.setMouseInfo({
@@ -109,16 +118,12 @@
109
118
  new_position_y: preview_data.layout_center.y
110
119
  })
111
120
  }
112
- const getActualBoundScale = (
113
- actual_bound: {
114
- x: number
115
- y: number
116
- width: number
117
- height: number
118
- },
119
- scale_x: number,
120
- scale_y: number
121
- ) => {
121
+ const getActualBoundScale = (actual_bound: {
122
+ x: number
123
+ y: number
124
+ width: number
125
+ height: number
126
+ }, scale_x: number, scale_y: number) => {
122
127
  return {
123
128
  x: actual_bound.x - (actual_bound.width / 2) * scale_x + actual_bound.width / 2,
124
129
  y: actual_bound.y - (actual_bound.height / 2) * scale_y + actual_bound.height / 2,
@@ -158,7 +163,8 @@
158
163
  break
159
164
  }
160
165
  }
161
- } else {
166
+ }
167
+ else {
162
168
  t = root
163
169
  }
164
170
 
@@ -169,12 +175,14 @@
169
175
  for (let a of e.attrs) {
170
176
  if (t.state && t.state.hasOwnProperty(a.key)) {
171
177
  t.state[a.key].default = valFormat(a.val)
172
- } else if (t.props.hasOwnProperty(a.key)) {
178
+ }
179
+ else if (t.props.hasOwnProperty(a.key)) {
173
180
  t.props[a.key].val = valFormat(a.val)
174
181
  }
175
182
  }
176
183
  }
177
- } else if (e.action === EEventAction.JavaScript) {
184
+ }
185
+ else if (e.action === EEventAction.JavaScript) {
178
186
  const t = new Function(e.scripts)
179
187
  t()
180
188
  }
@@ -215,6 +223,11 @@
215
223
  sub(m.url, m.user, m.pwd, m.topics, (topics: string, message: string) => {
216
224
  console.log(topics)
217
225
  console.log(message.toString())
226
+ //暂时先暴露给外部,让用户自己处理消息,后期功能会补上
227
+ emit('on-message', {
228
+ topics,
229
+ message
230
+ })
218
231
  })
219
232
  }
220
233
  }
@@ -225,81 +238,81 @@
225
238
  </script>
226
239
 
227
240
  <template>
228
- <div class="canvas" @mousedown="onCanvasMouseDown" @mousemove="onCanvasMouseMove" @mouseup="onCanvasMouseUp">
241
+ <div class='canvas' @mousedown='onCanvasMouseDown' @mousemove='onCanvasMouseMove' @mouseup='onCanvasMouseUp'>
229
242
  <svg
230
- xmlns="http://www.w3.org/2000/svg"
231
- :style="{ backgroundColor: preview_data.config.svg.background_color }"
232
- width="100%"
233
- height="100%"
243
+ xmlns='http://www.w3.org/2000/svg'
244
+ :style='{ backgroundColor: preview_data.config.svg.background_color }'
245
+ width='100%'
246
+ height='100%'
234
247
  >
235
248
  <g
236
- :transform="`translate(${preview_data.config.svg.position_center.x + preview_data.layout_center.x},${
249
+ :transform='`translate(${preview_data.config.svg.position_center.x + preview_data.layout_center.x},${
237
250
  preview_data.config.svg.position_center.y + preview_data.layout_center.y
238
- })rotate(${0})scale(${preview_data.config.svg.scale})`"
251
+ })rotate(${0})scale(${preview_data.config.svg.scale})`'
239
252
  >
240
253
  <g
241
- v-for="item in preview_data.done_json"
242
- :key="item.id"
243
- :transform="`translate(${item.x},${item.y})rotate(0)scale(1)`"
244
- v-show="item.display"
245
- @click="eventHandle(item)"
254
+ v-for='item in preview_data.done_json'
255
+ :key='item.id'
256
+ :transform='`translate(${item.x},${item.y})rotate(0)scale(1)`'
257
+ v-show='item.display'
258
+ @click='eventHandle(item)'
246
259
  >
247
- <g :class="`${getCommonClass(item)}`">
260
+ <g :class='`${getCommonClass(item)}`'>
248
261
  <g
249
- :transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
262
+ :transform='`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
250
263
  item.actual_bound.y + item.actual_bound.height / 2
251
264
  })rotate(${item.rotate}) scale(1) translate(${-(item.actual_bound.x + item.actual_bound.width / 2)},${-(
252
265
  item.actual_bound.y +
253
266
  item.actual_bound.height / 2
254
- )})`"
267
+ )})`'
255
268
  >
256
- <connection-line v-if="item.type === EDoneJsonType.ConnectionLine" :item-info="item" />
269
+ <connection-line v-if='item.type === EDoneJsonType.ConnectionLine' :item-info='item' />
257
270
  <use
258
- v-else-if="item.type === EDoneJsonType.File"
259
- :xlink:href="`#svg-${item.name}`"
260
- v-bind="prosToVBind(item)"
261
- width="100"
262
- height="100"
263
- :id="item.id"
264
- :transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
271
+ v-else-if='item.type === EDoneJsonType.File'
272
+ :xlink:href='`#svg-${item.name}`'
273
+ v-bind='prosToVBind(item)'
274
+ width='100'
275
+ height='100'
276
+ :id='item.id'
277
+ :transform='`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
265
278
  item.actual_bound.y + item.actual_bound.height / 2
266
279
  }) scale(${item.scale_x},${item.scale_y}) translate(${-(
267
280
  item.actual_bound.x +
268
281
  item.actual_bound.width / 2
269
- )},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
282
+ )},${-(item.actual_bound.y + item.actual_bound.height / 2)})`'
270
283
  />
271
284
  <component
272
- v-else-if="item.type === EDoneJsonType.CustomSvg"
273
- :is="item.tag"
274
- v-bind="prosToVBind(item)"
275
- width="100"
276
- height="100"
277
- :id="item.id"
278
- @on-change="eventHandle(item)"
279
- :transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
285
+ v-else-if='item.type === EDoneJsonType.CustomSvg'
286
+ :is='item.tag'
287
+ v-bind='prosToVBind(item)'
288
+ width='100'
289
+ height='100'
290
+ :id='item.id'
291
+ @on-change='eventHandle(item)'
292
+ :transform='`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
280
293
  item.actual_bound.y + item.actual_bound.height / 2
281
294
  }) scale(${item.scale_x},${item.scale_y}) translate(${-(
282
295
  item.actual_bound.x +
283
296
  item.actual_bound.width / 2
284
- )},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
297
+ )},${-(item.actual_bound.y + item.actual_bound.height / 2)})`'
285
298
  />
286
299
  <foreignObject
287
- v-else-if="item.type === EDoneJsonType.Vue"
288
- v-bind="getActualBoundScale(item.actual_bound, item.scale_x, item.scale_y)"
289
- :id="`foreign-object${item.id}`"
300
+ v-else-if='item.type === EDoneJsonType.Vue'
301
+ v-bind='getActualBoundScale(item.actual_bound, item.scale_x, item.scale_y)'
302
+ :id='`foreign-object${item.id}`'
290
303
  >
291
304
  <component
292
- :is="item.tag"
293
- v-bind="prosToVBind(item)"
294
- :id="item.id"
295
- @on-change="eventHandle(item)"
296
- :transform="`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
305
+ :is='item.tag'
306
+ v-bind='prosToVBind(item)'
307
+ :id='item.id'
308
+ @on-change='eventHandle(item)'
309
+ :transform='`translate(${item.actual_bound.x + item.actual_bound.width / 2},${
297
310
  item.actual_bound.y + item.actual_bound.height / 2
298
311
  }) scale(${item.scale_x},${item.scale_y}) translate(${-(
299
312
  item.actual_bound.x +
300
313
  item.actual_bound.width / 2
301
- )},${-(item.actual_bound.y + item.actual_bound.height / 2)})`"
302
- >{{ item.tag_slot }}
314
+ )},${-(item.actual_bound.y + item.actual_bound.height / 2)})`'
315
+ >{{ item.tag_slot }}
303
316
  </component>
304
317
  </foreignObject>
305
318
  </g>
@@ -310,7 +323,7 @@
310
323
  </div>
311
324
  </template>
312
325
 
313
- <style lang="less" scoped>
326
+ <style lang='less' scoped>
314
327
  .canvas {
315
328
  width: 100%;
316
329
  height: 100vh;
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import { computed, defineComponent, onBeforeUnmount, onMounted, ref } from 'vue'
3
2
  import { pinia } from '@/hooks'
4
3
  import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
5
4
 
@@ -1,6 +1,4 @@
1
1
  <script lang="ts" setup>
2
- import { ref } from 'vue'
3
-
4
2
  const props = withDefaults(defineProps<{ id: string }>(), { id: '' })
5
3
  const nowTime = ref(new Date())
6
4
  const s = nowTime.value.getSeconds()
@@ -4,7 +4,6 @@
4
4
  </el-table>
5
5
  </template>
6
6
  <script setup lang="ts">
7
- import { ref, watchEffect } from 'vue'
8
7
  import { ElTable, ElTableColumn } from 'element-plus'
9
8
 
10
9
  const props = withDefaults(
@@ -1,6 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { watch } from 'vue'
3
-
4
2
  const props = withDefaults(defineProps<{ id: string; isOpen: boolean }>(), {
5
3
  id: '',
6
4
  isOpen: false
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { computed, onMounted, ref, onUnmounted } from 'vue'
3
2
  const props = defineProps({
4
3
  fontColor: {
5
4
  type: String,
@@ -4,7 +4,6 @@
4
4
  import { PieChart } from 'echarts/charts'
5
5
  import { TitleComponent, TooltipComponent, LegendComponent } from 'echarts/components'
6
6
  import VChart, { THEME_KEY } from 'vue-echarts'
7
- import { watch, provide, reactive } from 'vue'
8
7
  use([SVGRenderer, PieChart, TitleComponent, TooltipComponent, LegendComponent])
9
8
 
10
9
  provide(THEME_KEY, 'dark')
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ElProgress } from 'element-plus'
3
3
  import type { ProgressColor } from 'element-plus'
4
- import { watch } from 'vue'
5
4
 
6
5
  const colors: ProgressColor[] = [
7
6
  {
@@ -1,7 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  // 文字的内容决定了长度 所以没办法预先定义中心点 导致连线有偏移
3
- import { nextTick, watch } from 'vue'
4
-
5
3
  const emit = defineEmits(['resize'])
6
4
 
7
5
  const props = defineProps({
@@ -1,6 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { watch } from 'vue'
3
-
4
2
  const props = defineProps({
5
3
  id: {
6
4
  type: String,
@@ -6,9 +6,5 @@ import { svg_bot_2 } from './bot-2'
6
6
  export const stateless_group: IConfigComponentGroup = {
7
7
  groupType: 'stateless',
8
8
  title: '静态图标',
9
- list: [
10
- alternator_svg_file,
11
- svg_house,
12
- svg_bot_2
13
- ]
9
+ list: [alternator_svg_file, svg_house, svg_bot_2]
14
10
  }
@@ -37,7 +37,7 @@ export interface IAnimations {
37
37
  }
38
38
 
39
39
  export interface IConfigItemProps {
40
- [key: string]: {
40
+ [key: keyof any]: {
41
41
  title: string
42
42
  type: EConfigItemPropsType
43
43
  val: any
@@ -77,7 +77,7 @@ interface IDoneJsonConfig {
77
77
  }
78
78
 
79
79
  export interface IConfigItemState {
80
- OnOff?: {
80
+ [k: keyof any]: {
81
81
  title: string
82
82
  default: false
83
83
  props: { [key: string]: { openVal: any; closeVal: any } }
package/src/hooks.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { IDataModel } from '@/components/svg-editor/types'
2
- import { createPinia } from 'pinia'
3
2
  import { useConfigStore } from '@/stores/config'
4
3
  import { useGlobalStore } from '@/stores/global'
5
4
  import type { IDoneJson } from '@/stores/global/types'
package/src/index.ts CHANGED
@@ -8,7 +8,5 @@ import 'virtual:windi.css'
8
8
  import 'virtual:svg-icons-register'
9
9
  import './assets/main.less'
10
10
 
11
- import SvgEditor from '@/components/svg-editor/index.vue'
12
- import SvgViewer from '@/components/svg-viewer/index.vue'
13
-
14
- export { SvgEditor, SvgViewer }
11
+ export { default as SvgEditor } from '@/components/svg-editor/index.vue'
12
+ export { default as SvgViewer } from '@/components/svg-viewer/index.vue'
package/src/main.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { createApp } from 'vue'
2
1
  import { pinia } from '@/hooks'
3
2
 
4
3
  import App from './App.vue'
@@ -1,4 +1,3 @@
1
- import { defineStore } from 'pinia'
2
1
  import { objectDeepClone } from '@/utils'
3
2
  import { connection_line_system } from '@/components/config'
4
3
 
@@ -1,5 +1,3 @@
1
- import { defineStore } from 'pinia'
2
- import { nextTick } from 'vue'
3
1
  import { config } from '@/config'
4
2
  import type { IConfigItem } from '@/config/types'
5
3
  import { isOfType, objectDeepClone, setSvgActualInfo } from '@/utils'