@zhangqingcq/vgce 0.0.14 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. package/README.md +38 -3
  2. package/dist/vgce.js +5040 -5305
  3. package/dist/vgce.umd.cjs +43 -143
  4. package/package.json +3 -2
  5. package/src/App.vue +11 -0
  6. package/src/assets/base.less +49 -0
  7. package/src/assets/icons/add.svg +1 -0
  8. package/src/assets/icons/delete.svg +12 -0
  9. package/src/assets/icons/export.svg +1 -0
  10. package/src/assets/icons/group.svg +13 -0
  11. package/src/assets/icons/import.svg +1 -0
  12. package/src/assets/icons/lock.svg +7 -0
  13. package/src/assets/icons/menu-fold.svg +9 -0
  14. package/src/assets/icons/menu-unfold.svg +9 -0
  15. package/src/assets/icons/preview.svg +6 -0
  16. package/src/assets/icons/redo.svg +8 -0
  17. package/src/assets/icons/return.svg +8 -0
  18. package/src/assets/icons/rotate.svg +1 -0
  19. package/src/assets/icons/save.svg +9 -0
  20. package/src/assets/icons/setting.svg +6 -0
  21. package/src/assets/icons/undo.svg +7 -0
  22. package/src/assets/icons/ungroup.svg +16 -0
  23. package/src/assets/icons/unlock.svg +7 -0
  24. package/src/assets/main.less +6 -0
  25. package/src/assets/svgs/alternator.svg +8 -0
  26. package/src/assets/svgs/bot-2.svg +1 -0
  27. package/src/assets/svgs/circuit-breaker.svg +11 -0
  28. package/src/assets/svgs/clock-a.svg +23 -0
  29. package/src/assets/svgs/common-table.svg +7 -0
  30. package/src/assets/svgs/el-button.svg +10 -0
  31. package/src/assets/svgs/el-tag.svg +13 -0
  32. package/src/assets/svgs/house.svg +1 -0
  33. package/src/assets/svgs/light.svg +24 -0
  34. package/src/assets/svgs/now-time.svg +9 -0
  35. package/src/assets/svgs/package.svg +1 -0
  36. package/src/assets/svgs/pie-charts.svg +10 -0
  37. package/src/assets/svgs/progress-a.svg +1 -0
  38. package/src/assets/svgs/reservoir.svg +10 -0
  39. package/src/assets/svgs/svg-text.svg +5 -0
  40. package/src/assets/svgs/switch-a.svg +5 -0
  41. package/src/components/ace-edit/index.ts +27 -0
  42. package/src/components/config/index.ts +450 -0
  43. package/src/components/config/types.ts +25 -0
  44. package/src/components/svg-analysis/index.vue +11 -0
  45. package/src/components/svg-editor/center-panel/index.vue +867 -0
  46. package/src/components/svg-editor/center-panel/types.ts +11 -0
  47. package/src/components/svg-editor/component-tree/index.vue +33 -0
  48. package/src/components/svg-editor/connection-line/index.vue +125 -0
  49. package/src/components/svg-editor/connection-panel/index.vue +198 -0
  50. package/src/components/svg-editor/export-json/index.vue +37 -0
  51. package/src/components/svg-editor/handle-panel/index.vue +342 -0
  52. package/src/components/svg-editor/import-json/index.vue +37 -0
  53. package/src/components/svg-editor/index.vue +280 -0
  54. package/src/components/svg-editor/left-panel/index.vue +83 -0
  55. package/src/components/svg-editor/right-panel/code-edit-modal.vue +50 -0
  56. package/src/components/svg-editor/right-panel/common-animate.vue +96 -0
  57. package/src/components/svg-editor/right-panel/condition.vue +101 -0
  58. package/src/components/svg-editor/right-panel/dynamic-el-form-item.vue +97 -0
  59. package/src/components/svg-editor/right-panel/index.vue +304 -0
  60. package/src/components/svg-editor/right-panel/list.vue +86 -0
  61. package/src/components/svg-editor/top-panel/index.vue +139 -0
  62. package/src/components/svg-editor/types.ts +22 -0
  63. package/src/components/svg-viewer/index.vue +340 -0
  64. package/src/components/vue3-ruler-tool/index.vue +506 -0
  65. package/src/config/files/clock-a.vue +66 -0
  66. package/src/config/files/common-table.vue +49 -0
  67. package/src/config/files/light-a.vue +72 -0
  68. package/src/config/files/now-time.vue +53 -0
  69. package/src/config/files/pie-charts.vue +72 -0
  70. package/src/config/files/progress.vue +40 -0
  71. package/src/config/files/svg-text.vue +39 -0
  72. package/src/config/files/switch-a.vue +45 -0
  73. package/src/config/index.ts +28 -0
  74. package/src/config/svg/animation/index.ts +8 -0
  75. package/src/config/svg/animation/reservoir.ts +32 -0
  76. package/src/config/svg/custom/clock-a.ts +23 -0
  77. package/src/config/svg/custom/index.ts +11 -0
  78. package/src/config/svg/custom/light.ts +29 -0
  79. package/src/config/svg/custom/svg-text.ts +54 -0
  80. package/src/config/svg/custom/switch-a.ts +29 -0
  81. package/src/config/svg/index.ts +12 -0
  82. package/src/config/svg/stateful/circuit-breaker.ts +38 -0
  83. package/src/config/svg/stateful/index.ts +8 -0
  84. package/src/config/svg/stateless/alternator.ts +28 -0
  85. package/src/config/svg/stateless/bot-2.ts +22 -0
  86. package/src/config/svg/stateless/house.ts +22 -0
  87. package/src/config/svg/stateless/index.ts +14 -0
  88. package/src/config/types.ts +126 -0
  89. package/src/config/vue/component/button.ts +57 -0
  90. package/src/config/vue/component/common-table.ts +124 -0
  91. package/src/config/vue/component/index.ts +13 -0
  92. package/src/config/vue/component/now-time.ts +29 -0
  93. package/src/config/vue/component/progress.ts +29 -0
  94. package/src/config/vue/component/tag.ts +46 -0
  95. package/src/config/vue/echarts/index.ts +8 -0
  96. package/src/config/vue/echarts/pie-charts.ts +60 -0
  97. package/src/config/vue/index.ts +5 -0
  98. package/src/hooks.ts +47 -0
  99. package/src/index.ts +14 -0
  100. package/src/main.ts +15 -0
  101. package/src/router.ts +24 -0
  102. package/src/stores/config/index.ts +44 -0
  103. package/src/stores/config/types.ts +27 -0
  104. package/src/stores/global/index.ts +109 -0
  105. package/src/stores/global/types.ts +115 -0
  106. package/src/stores/main.ts +10 -0
  107. package/src/stores/svg-edit-layout/index.ts +17 -0
  108. package/src/stores/svg-edit-layout/types.ts +8 -0
  109. package/src/stores/system/index.ts +174 -0
  110. package/src/stores/system/types.ts +43 -0
  111. package/src/utils/fetch.ts +351 -0
  112. package/src/utils/file-read-write.ts +26 -0
  113. package/src/utils/index.ts +397 -0
  114. package/src/utils/mqtt-net.ts +48 -0
  115. package/src/utils/proxy.ts +7 -0
  116. package/src/utils/scale-core.ts +214 -0
  117. package/src/utils/types.ts +13 -0
  118. package/src/views/EditorS.vue +18 -0
  119. package/src/views/Preview.vue +12 -0
@@ -0,0 +1,450 @@
1
+ import { EConfigAnimationsType, EConfigItemPropsType, EDoneJsonType } from '@/config/types'
2
+ import type { ISystemStraightLine, IAnimateConfig } from './types'
3
+
4
+ export const straight_line_system: ISystemStraightLine = Object.seal({
5
+ name: 'straight-line',
6
+ title: '直线',
7
+ type: EDoneJsonType.StraightLine,
8
+ config: {
9
+ can_zoom: false,
10
+ have_anchor: false,
11
+ actual_rect: false
12
+ },
13
+ display: true,
14
+ props: {
15
+ fill: {
16
+ title: '填充色',
17
+ type: EConfigItemPropsType.Color,
18
+ val: '#ff0000'
19
+ },
20
+ start_x: {
21
+ title: '起点x坐标',
22
+ type: EConfigItemPropsType.InputNumber,
23
+ val: 0
24
+ },
25
+ start_y: {
26
+ title: '起点y坐标',
27
+ type: EConfigItemPropsType.InputNumber,
28
+ val: 0
29
+ },
30
+ end_x: {
31
+ title: '终点x坐标',
32
+ type: EConfigItemPropsType.InputNumber,
33
+ val: 0
34
+ },
35
+ end_y: {
36
+ title: '终点y坐标',
37
+ type: EConfigItemPropsType.InputNumber,
38
+ val: 0
39
+ }
40
+ },
41
+ bind_anchors: {
42
+ start: null,
43
+ end: null
44
+ },
45
+ events: []
46
+ })
47
+ export const connection_line_system: ISystemStraightLine = {
48
+ name: 'connection_line',
49
+ title: '连接线',
50
+ type: EDoneJsonType.ConnectionLine,
51
+ config: {
52
+ can_zoom: false,
53
+ have_anchor: false,
54
+ actual_rect: false
55
+ },
56
+ display: true,
57
+ props: {
58
+ stroke: {
59
+ title: '线条颜色',
60
+ type: EConfigItemPropsType.Color,
61
+ val: '#ff0000'
62
+ },
63
+ 'stroke-width': {
64
+ title: '线条宽度',
65
+ type: EConfigItemPropsType.InputNumber,
66
+ val: 2
67
+ },
68
+ point_position: {
69
+ title: '点坐标',
70
+ type: EConfigItemPropsType.JsonEdit,
71
+ val: []
72
+ }
73
+ },
74
+ animations: {
75
+ type: {
76
+ title: '动画类型',
77
+ type: EConfigItemPropsType.Select,
78
+ val: EConfigAnimationsType.None,
79
+ options: [
80
+ {
81
+ label: '无',
82
+ value: EConfigAnimationsType.None
83
+ },
84
+ {
85
+ label: '电流',
86
+ value: EConfigAnimationsType.Electricity
87
+ },
88
+ {
89
+ label: '轨迹',
90
+ value: EConfigAnimationsType.Track
91
+ },
92
+ {
93
+ label: '水珠',
94
+ value: EConfigAnimationsType.WaterDrop
95
+ }
96
+ ]
97
+ },
98
+ dur: {
99
+ title: '持续时间',
100
+ type: EConfigItemPropsType.InputNumber,
101
+ val: 20
102
+ },
103
+ repeatCount: {
104
+ title: '循环次数',
105
+ type: EConfigItemPropsType.Input,
106
+ val: 'indefinite',
107
+ disabled: true
108
+ },
109
+ color: {
110
+ title: '颜色',
111
+ type: EConfigItemPropsType.Color,
112
+ val: '#0a7ae2'
113
+ },
114
+ reverse: {
115
+ title: '反转动画',
116
+ type: EConfigItemPropsType.Switch,
117
+ val: false
118
+ }
119
+ },
120
+ bind_anchors: {
121
+ start: null,
122
+ end: null
123
+ },
124
+ events: []
125
+ }
126
+ export const common_animate_list: Array<{ label: string; children: IAnimateConfig[] }> = [
127
+ {
128
+ label: '进入',
129
+ children: [
130
+ {
131
+ label: '渐显',
132
+ value: 'fadeIn'
133
+ },
134
+ {
135
+ label: '向右进入',
136
+ value: 'fadeInLeft'
137
+ },
138
+ {
139
+ label: '向左进入',
140
+ value: 'fadeInRight'
141
+ },
142
+ {
143
+ label: '向上进入',
144
+ value: 'fadeInUp'
145
+ },
146
+ {
147
+ label: '向下进入',
148
+ value: 'fadeInDown'
149
+ },
150
+ {
151
+ label: '向右长距进入',
152
+ value: 'fadeInLeftBig'
153
+ },
154
+ {
155
+ label: '向左长距进入',
156
+ value: 'fadeInRightBig'
157
+ },
158
+ {
159
+ label: '向上长距进入',
160
+ value: 'fadeInUpBig'
161
+ },
162
+ {
163
+ label: '向下长距进入',
164
+ value: 'fadeInDownBig'
165
+ },
166
+ {
167
+ label: '旋转进入',
168
+ value: 'rotateIn'
169
+ },
170
+ {
171
+ label: '左顺时针旋转',
172
+ value: 'rotateInDownLeft'
173
+ },
174
+ {
175
+ label: '右逆时针旋转',
176
+ value: 'rotateInDownRight'
177
+ },
178
+ {
179
+ label: '左逆时针旋转',
180
+ value: 'rotateInUpLeft'
181
+ },
182
+ {
183
+ label: '右逆时针旋转',
184
+ value: 'rotateInUpRight'
185
+ },
186
+ {
187
+ label: '弹入',
188
+ value: 'bounceIn'
189
+ },
190
+ {
191
+ label: '向右弹入',
192
+ value: 'bounceInLeft'
193
+ },
194
+ {
195
+ label: '向左弹入',
196
+ value: 'bounceInRight'
197
+ },
198
+ {
199
+ label: '向上弹入',
200
+ value: 'bounceInUp'
201
+ },
202
+ {
203
+ label: '向下弹入',
204
+ value: 'bounceInDown'
205
+ },
206
+ {
207
+ label: '光速从右进入',
208
+ value: 'lightSpeedInRight'
209
+ },
210
+ {
211
+ label: '光速从左进入',
212
+ value: 'lightSpeedInLeft'
213
+ },
214
+ {
215
+ label: '光速从右退出',
216
+ value: 'lightSpeedOutRight'
217
+ },
218
+ {
219
+ label: '光速从左退出',
220
+ value: 'lightSpeedOutLeft'
221
+ },
222
+ {
223
+ label: 'Y轴旋转',
224
+ value: 'flip'
225
+ },
226
+ {
227
+ label: '中心X轴旋转',
228
+ value: 'flipInX'
229
+ },
230
+ {
231
+ label: '中心Y轴旋转',
232
+ value: 'flipInY'
233
+ },
234
+ {
235
+ label: '左长半径旋转',
236
+ value: 'rollIn'
237
+ },
238
+ {
239
+ label: '由小变大进入',
240
+ value: 'zoomIn'
241
+ },
242
+ {
243
+ label: '左变大进入',
244
+ value: 'zoomInLeft'
245
+ },
246
+ {
247
+ label: '右变大进入',
248
+ value: 'zoomInRight'
249
+ },
250
+ {
251
+ label: '向上变大进入',
252
+ value: 'zoomInUp'
253
+ },
254
+ {
255
+ label: '向下变大进入',
256
+ value: 'zoomInDown'
257
+ },
258
+ {
259
+ label: '向右滑动展开',
260
+ value: 'slideInLeft'
261
+ },
262
+ {
263
+ label: '向左滑动展开',
264
+ value: 'slideInRight'
265
+ },
266
+ {
267
+ label: '向上滑动展开',
268
+ value: 'slideInUp'
269
+ },
270
+ {
271
+ label: '向下滑动展开',
272
+ value: 'slideInDown'
273
+ }
274
+ ]
275
+ },
276
+ {
277
+ label: '强调',
278
+ children: [
279
+ {
280
+ label: '弹跳',
281
+ value: 'bounce'
282
+ },
283
+ {
284
+ label: '闪烁',
285
+ value: 'flash'
286
+ },
287
+ {
288
+ label: '放大缩小',
289
+ value: 'pulse'
290
+ },
291
+ {
292
+ label: '放大缩小弹簧',
293
+ value: 'rubberBand'
294
+ },
295
+ {
296
+ label: '左右晃动',
297
+ value: 'headShake'
298
+ },
299
+ {
300
+ label: '左右扇形摇摆',
301
+ value: 'swing'
302
+ },
303
+ {
304
+ label: '放大晃动缩小',
305
+ value: 'tada'
306
+ },
307
+ {
308
+ label: '扇形摇摆',
309
+ value: 'wobble'
310
+ },
311
+ {
312
+ label: '左右上下晃动',
313
+ value: 'jello'
314
+ },
315
+ {
316
+ label: 'Y轴旋转',
317
+ value: 'flip'
318
+ }
319
+ ]
320
+ },
321
+ {
322
+ label: '退出',
323
+ children: [
324
+ {
325
+ label: '渐隐',
326
+ value: 'fadeOut'
327
+ },
328
+ {
329
+ label: '向左退出',
330
+ value: 'fadeOutLeft'
331
+ },
332
+ {
333
+ label: '向右退出',
334
+ value: 'fadeOutRight'
335
+ },
336
+ {
337
+ label: '向上退出',
338
+ value: 'fadeOutUp'
339
+ },
340
+ {
341
+ label: '向下退出',
342
+ value: 'fadeOutDown'
343
+ },
344
+ {
345
+ label: '向左长距退出',
346
+ value: 'fadeOutLeftBig'
347
+ },
348
+ {
349
+ label: '向右长距退出',
350
+ value: 'fadeOutRightBig'
351
+ },
352
+ {
353
+ label: '向上长距退出',
354
+ value: 'fadeOutUpBig'
355
+ },
356
+ {
357
+ label: '向下长距退出',
358
+ value: 'fadeOutDownBig'
359
+ },
360
+ {
361
+ label: '旋转退出',
362
+ value: 'rotateOut'
363
+ },
364
+ {
365
+ label: '左顺时针旋转',
366
+ value: 'rotateOutDownLeft'
367
+ },
368
+ {
369
+ label: '右逆时针旋转',
370
+ value: 'rotateOutDownRight'
371
+ },
372
+ {
373
+ label: '左逆时针旋转',
374
+ value: 'rotateOutUpLeft'
375
+ },
376
+ {
377
+ label: '右逆时针旋转',
378
+ value: 'rotateOutUpRight'
379
+ },
380
+ {
381
+ label: '弹出',
382
+ value: 'bounceOut'
383
+ },
384
+ {
385
+ label: '向左弹出',
386
+ value: 'bounceOutLeft'
387
+ },
388
+ {
389
+ label: '向右弹出',
390
+ value: 'bounceOutRight'
391
+ },
392
+ {
393
+ label: '向上弹出',
394
+ value: 'bounceOutUp'
395
+ },
396
+ {
397
+ label: '向下弹出',
398
+ value: 'bounceOutDown'
399
+ },
400
+ {
401
+ label: '中心X轴旋转',
402
+ value: 'flipOutX'
403
+ },
404
+ {
405
+ label: '中心Y轴旋转',
406
+ value: 'flipOutY'
407
+ },
408
+ {
409
+ label: '左长半径旋转',
410
+ value: 'rollOut'
411
+ },
412
+ {
413
+ label: '由小变大退出',
414
+ value: 'zoomOut'
415
+ },
416
+ {
417
+ label: '左变大退出',
418
+ value: 'zoomOutLeft'
419
+ },
420
+ {
421
+ label: '右变大退出',
422
+ value: 'zoomOutRight'
423
+ },
424
+ {
425
+ label: '向上变大退出',
426
+ value: 'zoomOutUp'
427
+ },
428
+ {
429
+ label: '向下变大退出',
430
+ value: 'zoomOutDown'
431
+ },
432
+ {
433
+ label: '向左滑动收起',
434
+ value: 'slideOutLeft'
435
+ },
436
+ {
437
+ label: '向右滑动收起',
438
+ value: 'slideOutRight'
439
+ },
440
+ {
441
+ label: '向上滑动收起',
442
+ value: 'slideOutUp'
443
+ },
444
+ {
445
+ label: '向下滑动收起',
446
+ value: 'slideOutDown'
447
+ }
448
+ ]
449
+ }
450
+ ]
@@ -0,0 +1,25 @@
1
+ import type { IConfigItem } from '@/config/types'
2
+
3
+ export interface ISystemStraightLine extends IConfigItem {
4
+ //绑定锚点
5
+ bind_anchors: {
6
+ start: IBindAnchors | null
7
+ end: IBindAnchors | null
8
+ }
9
+ }
10
+ export interface IBindAnchors {
11
+ type: ELineBindAnchors
12
+ target_id: string
13
+ }
14
+
15
+ export interface IAnimateConfig {
16
+ label: string
17
+ value: string
18
+ }
19
+
20
+ export enum ELineBindAnchors {
21
+ TopCenter = 'TopCenter',
22
+ Left = 'Left',
23
+ Right = 'Right',
24
+ BottomCenter = 'BottomCenter'
25
+ }
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ const props = withDefaults(defineProps<{ name: string; props?: object }>(), { props: () => ({}) })
5
+ const symbolId = computed(() => `#svg-${props.name}`)
6
+ </script>
7
+ <template>
8
+ <svg aria-hidden="true">
9
+ <use :xlink:href="symbolId" v-bind="props.props" />
10
+ </svg>
11
+ </template>