jvs-ppt-ui 0.0.36 → 0.0.38

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 (62) hide show
  1. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.css +7 -3
  2. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.js +1 -1
  3. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.json +7 -0
  4. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.ttf +0 -0
  5. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.woff +0 -0
  6. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.woff2 +0 -0
  7. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_01de32e3d01df54a.svg +9 -0
  8. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_12935f21f0b1ae78.png +0 -0
  9. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_201146e666f28fff.png +0 -0
  10. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_32ef4f2c1d76ea32.svg +15 -0
  11. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_571054b13f220252.svg +10 -0
  12. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_5b14f99769a8894c.svg +10 -0
  13. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_62fc021bdae89b21.png +0 -0
  14. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_649d2b36f7fc251e.png +0 -0
  15. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_7e57de8ea8d46aba.png +0 -0
  16. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_9ad1284e63535689.svg +15 -0
  17. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_9ff268d3709d6454.png +0 -0
  18. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_b8f80ac591d69945.png +0 -0
  19. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_dce239981c2cd1aa.svg +15 -0
  20. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_e2ea31ca7735e5c0.png +0 -0
  21. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_e585ddb9ec5c408e.png +0 -0
  22. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_f3335fad3673d648.svg +10 -0
  23. package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_fb925327432cc7e7.svg +15 -0
  24. package/dist/lib/jvs-ppt-ui/layout-library/layout-library.json +1 -0
  25. package/dist/lib/jvs-ppt-ui.es.js +80182 -21671
  26. package/dist/lib/jvs-ppt-ui.umd.js +112 -112
  27. package/dist/lib/style.css +1 -1
  28. package/package.json +1 -1
  29. package/scripts/patch-pptxtojson.cjs +33 -0
  30. package/src/assets/chart/baseArea.png +0 -0
  31. package/src/assets/chart/baseBar.png +0 -0
  32. package/src/assets/chart/baseHistogram.png +0 -0
  33. package/src/assets/chart/basePie.png +0 -0
  34. package/src/assets/chart/bubbleChart.png +0 -0
  35. package/src/assets/chart/circyChart.png +0 -0
  36. package/src/assets/chart/compPolyline.png +0 -0
  37. package/src/assets/chart/lineChart.png +0 -0
  38. package/src/assets/chart/otherLine.png +0 -0
  39. package/src/assets/chart/otherLineChart.png +0 -0
  40. package/src/assets/chart/perHistogram.png +0 -0
  41. package/src/assets/chart/radarChart.png +0 -0
  42. package/src/assets/chart/roseChart.png +0 -0
  43. package/src/assets/chart/roseCircyChart.png +0 -0
  44. package/src/assets/chart/stackArea.png +0 -0
  45. package/src/assets/chart/stackBar.png +0 -0
  46. package/src/assets/chart/stackHistogram.png +0 -0
  47. package/src/assets/iconfont/iconfont.js +1 -1
  48. package/src/components/CanvasArea.vue +53 -14
  49. package/src/components/ChartTypeSelector.vue +15 -67
  50. package/src/components/Header.vue +10 -7
  51. package/src/components/SidebarLeft.vue +411 -35
  52. package/src/components/sidebar/common/SidebarPositionGroup.vue +199 -33
  53. package/src/components/sidebar/panels/LayoutThumbSvg.vue +82 -14
  54. package/src/components/sidebar/panels/SidebarImageFormatPanel.vue +37 -33
  55. package/src/composables/canvas/useCanvasCrop.ts +25 -2
  56. package/src/composables/sidebar/useSidebarElementTransform.ts +13 -7
  57. package/src/composables/useSlides.ts +141 -3
  58. package/src/configs/layoutLibrary.ts +113 -0
  59. package/src/style.css +107 -17
  60. package/src/utils/pptxAnimationInjector.ts +36 -4
  61. package/src/assets/chart/baseMap.png +0 -0
  62. package/src/assets/chart/boxplot.png +0 -0
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { ref, computed } from 'vue'
2
+ import { ref, computed, nextTick } from 'vue'
3
3
  import { useSlides } from '../../../composables/useSlides'
4
4
 
5
5
  const props = withDefaults(defineProps<{
@@ -36,7 +36,7 @@ const emit = defineEmits<{
36
36
  (e: 'adjustZIndex', command: any): void
37
37
  }>()
38
38
 
39
- const { activeSlide, selectedElementId, selectedElementIds } = useSlides()
39
+ const { activeSlide, selectedElementId, selectedElementIds, undo, redo } = useSlides()
40
40
 
41
41
  const selectedIds = computed(() => {
42
42
  if (selectedElementIds.value && selectedElementIds.value.length > 0) {
@@ -74,36 +74,184 @@ const canMoveDown = computed(() => {
74
74
  const canMoveTop = computed(() => canMoveUp.value)
75
75
  const canMoveBottom = computed(() => canMoveDown.value)
76
76
 
77
+ type FieldKey = 'X' | 'Y' | 'W' | 'H' | 'ROTATE'
78
+ const MIN_ELEMENT_DIMENSION = 10
79
+
80
+ const focusedField = ref<FieldKey | null>(null)
81
+ const draftText = ref<string>('')
82
+ const focusInitialVal = ref<number>(0)
83
+ const fieldUndoStack = ref<string[]>([])
84
+ const fieldRedoStack = ref<string[]>([])
85
+
77
86
  const rotateInputRef = ref<HTMLInputElement | null>(null)
78
- const rotateDisplayLen = computed(() => Math.max(1, String(props.elementRotate ?? 0).length))
87
+ const rotateDisplayLen = computed(() => {
88
+ const text = focusedField.value === 'ROTATE' ? draftText.value : String(props.elementRotate ?? 0)
89
+ return Math.max(1, text.length)
90
+ })
79
91
 
80
- function focusRotateInput(e: MouseEvent) {
81
- if (e.target !== rotateInputRef.value) {
82
- rotateInputRef.value?.focus()
83
- rotateInputRef.value?.select()
92
+ function getPropVal(field: FieldKey): number {
93
+ switch (field) {
94
+ case 'X': return props.elementX ?? 0
95
+ case 'Y': return props.elementY ?? 0
96
+ case 'W': return props.elementW ?? MIN_ELEMENT_DIMENSION
97
+ case 'H': return props.elementH ?? MIN_ELEMENT_DIMENSION
98
+ case 'ROTATE': return props.elementRotate ?? 0
84
99
  }
85
100
  }
86
101
 
87
- function onRotateInput(e: Event) {
88
- const target = e.target as HTMLInputElement
89
- const raw = target.value
90
- if (raw === '' || raw === '-') return
91
- const val = Number(raw)
92
- if (isNaN(val)) return
102
+ function emitFieldVal(field: FieldKey, val: number) {
103
+ switch (field) {
104
+ case 'X': emit('update:elementX', val); break
105
+ case 'Y': emit('update:elementY', val); break
106
+ case 'W': emit('update:elementW', val); break
107
+ case 'H': emit('update:elementH', val); break
108
+ case 'ROTATE': emit('update:elementRotate', val); break
109
+ }
110
+ }
111
+
112
+ function normalizeRotateVal(val: number): number {
93
113
  let deg = Math.round(val) % 360
94
114
  if (deg < 0) deg += 360
95
- emit('update:elementRotate', deg)
115
+ return deg
116
+ }
117
+
118
+ function onFieldFocus(field: FieldKey) {
119
+ const curVal = getPropVal(field)
120
+ focusedField.value = field
121
+ draftText.value = String(curVal)
122
+ focusInitialVal.value = curVal
123
+ fieldUndoStack.value = [draftText.value]
124
+ fieldRedoStack.value = []
125
+ }
126
+
127
+ function recordDraftChange(text: string) {
128
+ draftText.value = text
129
+ const stack = fieldUndoStack.value
130
+ if (stack.length === 0 || stack[stack.length - 1] !== text) {
131
+ stack.push(text)
132
+ if (stack.length > 50) stack.shift()
133
+ }
134
+ fieldRedoStack.value = []
96
135
  }
97
136
 
98
- function onRotateBlur(e: Event) {
137
+ function applyDraftIfValid(field: FieldKey, rawText: string) {
138
+ const raw = rawText.trim()
139
+ if (raw === '' || raw === '-') return
140
+ const num = Number(raw)
141
+ if (isNaN(num)) return
142
+ if (field === 'W' || field === 'H') {
143
+ if (num < MIN_ELEMENT_DIMENSION) return
144
+ emitFieldVal(field, num)
145
+ } else if (field === 'ROTATE') {
146
+ emitFieldVal(field, normalizeRotateVal(num))
147
+ } else {
148
+ emitFieldVal(field, num)
149
+ }
150
+ }
151
+
152
+ function onFieldInput(field: FieldKey, e: Event) {
153
+ const target = e.target as HTMLInputElement
154
+ recordDraftChange(target.value)
155
+ applyDraftIfValid(field, target.value)
156
+ }
157
+
158
+ function onFieldBlur(field: FieldKey, e: Event) {
99
159
  const target = e.target as HTMLInputElement
100
- if (target.value === '' || target.value === '-' || isNaN(Number(target.value))) {
101
- target.value = String(props.elementRotate ?? 0)
160
+ const raw = target.value.trim()
161
+ let finalVal: number
162
+
163
+ if (field === 'W' || field === 'H') {
164
+ const fallback = Math.max(MIN_ELEMENT_DIMENSION, focusInitialVal.value || getPropVal(field))
165
+ if (raw === '' || raw === '-' || isNaN(Number(raw))) {
166
+ finalVal = fallback
167
+ } else {
168
+ finalVal = Math.max(MIN_ELEMENT_DIMENSION, Number(raw))
169
+ }
170
+ } else if (field === 'ROTATE') {
171
+ const fallback = normalizeRotateVal(focusInitialVal.value || getPropVal(field))
172
+ if (raw === '' || raw === '-' || isNaN(Number(raw))) {
173
+ finalVal = fallback
174
+ } else {
175
+ finalVal = normalizeRotateVal(Number(raw))
176
+ }
102
177
  } else {
103
- let val = Math.round(Number(target.value)) % 360
104
- if (val < 0) val += 360
105
- target.value = String(val)
106
- emit('update:elementRotate', val)
178
+ const fallback = focusInitialVal.value ?? getPropVal(field)
179
+ if (raw === '' || raw === '-' || isNaN(Number(raw))) {
180
+ finalVal = fallback
181
+ } else {
182
+ finalVal = Number(raw)
183
+ }
184
+ }
185
+
186
+ focusedField.value = null
187
+ draftText.value = String(finalVal)
188
+ fieldUndoStack.value = []
189
+ fieldRedoStack.value = []
190
+ target.value = String(finalVal)
191
+ emitFieldVal(field, finalVal)
192
+ }
193
+
194
+ function onFieldKeyDown(field: FieldKey, e: KeyboardEvent) {
195
+ if (e.key === 'Enter') {
196
+ ;(e.target as HTMLElement)?.blur()
197
+ return
198
+ }
199
+ const isMod = e.ctrlKey || e.metaKey
200
+ if (!isMod) return
201
+ const key = e.key.toLowerCase()
202
+ const isUndo = key === 'z' && !e.shiftKey
203
+ const isRedo = key === 'y' || (key === 'z' && e.shiftKey)
204
+ if (!isUndo && !isRedo) return
205
+
206
+ // 彻底阻止浏览器原生 input 撤销栈将已回填的值重复拼接(如 92 变 9292)
207
+ e.preventDefault()
208
+ e.stopPropagation()
209
+ const target = e.target as HTMLInputElement
210
+
211
+ if (isUndo) {
212
+ if (fieldUndoStack.value.length > 1) {
213
+ const current = fieldUndoStack.value.pop()!
214
+ fieldRedoStack.value.push(current)
215
+ const prev = fieldUndoStack.value[fieldUndoStack.value.length - 1]
216
+ draftText.value = prev
217
+ target.value = prev
218
+ applyDraftIfValid(field, prev)
219
+ } else {
220
+ if (undo) undo()
221
+ nextTick(() => {
222
+ const nextVal = String(getPropVal(field))
223
+ draftText.value = nextVal
224
+ focusInitialVal.value = Number(nextVal) || 0
225
+ fieldUndoStack.value = [nextVal]
226
+ fieldRedoStack.value = []
227
+ target.value = nextVal
228
+ })
229
+ }
230
+ } else if (isRedo) {
231
+ if (fieldRedoStack.value.length > 0) {
232
+ const next = fieldRedoStack.value.pop()!
233
+ fieldUndoStack.value.push(next)
234
+ draftText.value = next
235
+ target.value = next
236
+ applyDraftIfValid(field, next)
237
+ } else {
238
+ if (redo) redo()
239
+ nextTick(() => {
240
+ const nextVal = String(getPropVal(field))
241
+ draftText.value = nextVal
242
+ focusInitialVal.value = Number(nextVal) || 0
243
+ fieldUndoStack.value = [nextVal]
244
+ fieldRedoStack.value = []
245
+ target.value = nextVal
246
+ })
247
+ }
248
+ }
249
+ }
250
+
251
+ function focusRotateInput(e: MouseEvent) {
252
+ if (e.target !== rotateInputRef.value) {
253
+ rotateInputRef.value?.focus()
254
+ rotateInputRef.value?.select()
107
255
  }
108
256
  }
109
257
  </script>
@@ -115,14 +263,22 @@ function onRotateBlur(e: Event) {
115
263
  <div class="pos-main-cols">
116
264
  <div class="custom-num-input">
117
265
  <span class="custom-num-prefix">X</span>
118
- <input type="number" step="any" :value="elementX"
119
- @input="emit('update:elementX', Number(($event.target as HTMLInputElement).value))"
266
+ <input type="number" step="any"
267
+ :value="focusedField === 'X' ? draftText : elementX"
268
+ @focus="onFieldFocus('X')"
269
+ @input="onFieldInput('X', $event)"
270
+ @blur="onFieldBlur('X', $event)"
271
+ @keydown="onFieldKeyDown('X', $event)"
120
272
  class="custom-num-field" />
121
273
  </div>
122
274
  <div class="custom-num-input">
123
275
  <span class="custom-num-prefix">Y</span>
124
- <input type="number" step="any" :value="elementY"
125
- @input="emit('update:elementY', Number(($event.target as HTMLInputElement).value))"
276
+ <input type="number" step="any"
277
+ :value="focusedField === 'Y' ? draftText : elementY"
278
+ @focus="onFieldFocus('Y')"
279
+ @input="onFieldInput('Y', $event)"
280
+ @blur="onFieldBlur('Y', $event)"
281
+ @keydown="onFieldKeyDown('Y', $event)"
126
282
  class="custom-num-field" />
127
283
  </div>
128
284
  </div>
@@ -134,14 +290,23 @@ function onRotateBlur(e: Event) {
134
290
  <div class="pos-main-cols">
135
291
  <div class="custom-num-input">
136
292
  <span class="custom-num-prefix">W</span>
137
- <input type="number" step="any" :value="elementW"
138
- @input="emit('update:elementW', Number(($event.target as HTMLInputElement).value))"
293
+ <input type="number" step="any" :min="MIN_ELEMENT_DIMENSION"
294
+ :value="focusedField === 'W' ? draftText : elementW"
295
+ @focus="onFieldFocus('W')"
296
+ @input="onFieldInput('W', $event)"
297
+ @blur="onFieldBlur('W', $event)"
298
+ @keydown="onFieldKeyDown('W', $event)"
139
299
  class="custom-num-field" />
140
300
  </div>
141
301
  <div class="custom-num-input" :class="{ 'is-disabled': disableHeight }">
142
302
  <span class="custom-num-prefix">H</span>
143
- <input type="number" step="any" :value="elementH" :disabled="disableHeight" :readonly="disableHeight"
144
- @input="!disableHeight && emit('update:elementH', Number(($event.target as HTMLInputElement).value))"
303
+ <input type="number" step="any" :min="MIN_ELEMENT_DIMENSION"
304
+ :value="focusedField === 'H' ? draftText : elementH"
305
+ :disabled="disableHeight" :readonly="disableHeight"
306
+ @focus="!disableHeight && onFieldFocus('H')"
307
+ @input="!disableHeight && onFieldInput('H', $event)"
308
+ @blur="!disableHeight && onFieldBlur('H', $event)"
309
+ @keydown="!disableHeight && onFieldKeyDown('H', $event)"
145
310
  class="custom-num-field" />
146
311
  </div>
147
312
  </div>
@@ -169,10 +334,11 @@ function onRotateBlur(e: Event) {
169
334
  ref="rotateInputRef"
170
335
  type="text"
171
336
  inputmode="numeric"
172
- :value="elementRotate ?? 0"
173
- @input="onRotateInput"
174
- @blur="onRotateBlur"
175
- @keydown.enter="($event.target as HTMLElement).blur()"
337
+ :value="focusedField === 'ROTATE' ? draftText : (elementRotate ?? 0)"
338
+ @focus="onFieldFocus('ROTATE')"
339
+ @input="onFieldInput('ROTATE', $event)"
340
+ @blur="onFieldBlur('ROTATE', $event)"
341
+ @keydown="onFieldKeyDown('ROTATE', $event)"
176
342
  class="custom-num-field rotate-num-field"
177
343
  :style="{ width: `calc(${rotateDisplayLen}ch + 6px)` }"
178
344
  />
@@ -160,7 +160,7 @@ function getLayoutSvgElements(elements: any[]) {
160
160
 
161
161
  const fontSize = parseFloat(el.style?.fontSize || el.fontSize || (isPlaceholder ? (el.placeholder?.type === 'title' ? '28' : '16') : '16')) || 16
162
162
 
163
- const defaultWidthFallback = isVertical ? ((60 / baseW) * 100) : 0
163
+ const defaultWidthFallback = isVertical ? (((fontSize + 24) / baseW) * 100) : 0
164
164
  const defaultHeightFallback = ((fontSize * 1.25) / baseH) * 100
165
165
  const rawWVal = (el.style?.width && el.style.width !== 'auto') ? el.style.width : el.width
166
166
  const rawHVal = (el.style?.height && el.style.height !== 'auto') ? el.style.height : (el.height && el.height !== 'auto' ? el.height : undefined)
@@ -194,7 +194,7 @@ function getLayoutSvgElements(elements: any[]) {
194
194
  const baseRatio = 100 / baseW
195
195
  const rawSvgSize = fontSize * baseRatio
196
196
  const svgFontSize = isPlaceholder
197
- ? +(Math.max(1.8, Math.min(4.5, rawSvgSize * 1.15))).toFixed(2)
197
+ ? +(Math.max(1.5, Math.min(7.5, rawSvgSize * 1.05))).toFixed(2)
198
198
  : +(Math.max(1.4, Math.min(14, rawSvgSize))).toFixed(2)
199
199
 
200
200
  const rawSegments: { text: string; indent: number }[] = []
@@ -260,7 +260,8 @@ function getLayoutSvgElements(elements: any[]) {
260
260
  const lineHeight = +(svgFontSize * (fontSize >= 72 ? 1.05 : 1.25)).toFixed(2)
261
261
  const lineCount = Math.min(parsedTextLines.length, 6)
262
262
  const totalTextH = lineCount * lineHeight
263
- const vAlign = el.verticalAlign || el.style?.verticalAlign || 'top'
263
+ const defaultVAlign = (!isVertical && isPlaceholder && h > svgFontSize * 3.8 && fontSize < 32) ? 'top' : 'middle'
264
+ const vAlign = el.verticalAlign || el.style?.verticalAlign || defaultVAlign
264
265
  let textStartY = +(y + svgFontSize * 0.95).toFixed(2)
265
266
  if (h > totalTextH) {
266
267
  if (vAlign === 'bottom' || vAlign === 'down') {
@@ -273,6 +274,11 @@ function getLayoutSvgElements(elements: any[]) {
273
274
 
274
275
  const isTitle = el.type === 'text' && (el.name?.includes('标题') || el.placeholder?.type === 'title' || fontSize >= 24)
275
276
  const isText = el.type === 'text'
277
+ const fontFamily = (el.style?.fontFamily && el.style.fontFamily !== '默认字体' && el.style.fontFamily !== 'inherit')
278
+ ? el.style.fontFamily
279
+ : ((el.fontFamily && el.fontFamily !== '默认字体' && el.fontFamily !== 'inherit')
280
+ ? el.fontFamily
281
+ : 'sans-serif')
276
282
 
277
283
  const color = parseColorString(el.style?.color || el.color, isPlaceholder ? (isTitle ? '#0f172a' : '#64748b') : (isTitle ? '#0f172a' : '#334155'))
278
284
  const rawFillVal = (el.style && el.style.fill !== undefined) ? el.style.fill : el.fill
@@ -297,7 +303,7 @@ function getLayoutSvgElements(elements: any[]) {
297
303
  const rawOpacity = el.style?.opacity !== undefined ? parseFloat(el.style.opacity) : (el.opacity !== undefined ? parseFloat(el.opacity) : 1)
298
304
  const opacity = isNaN(rawOpacity) ? 1 : rawOpacity
299
305
  const inlineAlignMatch = rawContentStr ? rawContentStr.match(/text-align:\s*(left|center|right)/i) : null
300
- const textAlign = el.style?.textAlign || el.textAlign || (inlineAlignMatch ? inlineAlignMatch[1].toLowerCase() : (el.type === 'shape' ? 'center' : (isTitle && !isVertical && isPlaceholder ? 'center' : 'left')))
306
+ const textAlign = el.style?.textAlign || el.textAlign || (inlineAlignMatch ? inlineAlignMatch[1].toLowerCase() : (el.type === 'shape' ? 'center' : 'left'))
301
307
  const pattern = getElementPattern(el)
302
308
  const rawBr = parseFloat(el.style?.borderRadius || el.borderRadius || 0) || 0
303
309
  const rx = rawBr > 0 ? +((rawBr / baseW) * 100).toFixed(2) : (el.type === 'shape' ? 0.8 : 0)
@@ -379,6 +385,13 @@ function getLayoutSvgElements(elements: any[]) {
379
385
  }
380
386
  }
381
387
 
388
+ const chartColors: string[] = Array.isArray(el.style?.chartColors) && el.style.chartColors.length > 0
389
+ ? el.style.chartColors
390
+ : (Array.isArray(el.themeColors) && el.themeColors.length > 0
391
+ ? el.themeColors
392
+ : ['#2563eb', '#3b82f6', '#60a5fa', '#93c5fd'])
393
+ const chartType = String(el.chartType || 'bar').toLowerCase()
394
+
382
395
  return {
383
396
  id: el.id,
384
397
  rawEl: el,
@@ -389,6 +402,8 @@ function getLayoutSvgElements(elements: any[]) {
389
402
  isCircle,
390
403
  isImagePlaceholder,
391
404
  type: el.type || 'text',
405
+ chartType,
406
+ chartColors,
392
407
  isImage: el.type === 'image' || Boolean(el.src || el.imageSrc || el.picBase64 || el.base64 || getElementImageSrc(el)),
393
408
  imageSrc: getElementImageSrc(el),
394
409
  clipViewBox,
@@ -413,6 +428,7 @@ function getLayoutSvgElements(elements: any[]) {
413
428
  isPlaceholder,
414
429
  textAlign,
415
430
  svgFontSize,
431
+ fontFamily,
416
432
  isTitle,
417
433
  isText,
418
434
  cleanText,
@@ -564,7 +580,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
564
580
  text-anchor="middle"
565
581
  :fill="item.color || '#ffffff'"
566
582
  :font-size="item.svgFontSize"
567
- font-family="sans-serif"
583
+ :font-family="item.fontFamily"
568
584
  font-weight="bold"
569
585
  style="pointer-events: none; user-select: none;"
570
586
  >{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
@@ -588,7 +604,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
588
604
  text-anchor="middle"
589
605
  :fill="item.color || '#ffffff'"
590
606
  :font-size="item.svgFontSize"
591
- font-family="sans-serif"
607
+ :font-family="item.fontFamily"
592
608
  font-weight="bold"
593
609
  style="pointer-events: none; user-select: none;"
594
610
  >{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
@@ -602,7 +618,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
602
618
  text-anchor="middle"
603
619
  :fill="item.color || '#ffffff'"
604
620
  :font-size="item.svgFontSize"
605
- font-family="sans-serif"
621
+ :font-family="item.fontFamily"
606
622
  font-weight="bold"
607
623
  style="pointer-events: none; user-select: none;"
608
624
  >{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
@@ -625,17 +641,22 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
625
641
  v-for="(lineObj, lIdx) in item.parsedTextLines.slice(0, 6)"
626
642
  :key="lIdx"
627
643
  :x="item.isVertical
628
- ? (item.x + item.w * 0.5)
644
+ ? (item.x + item.w * 0.5 - (lIdx - (Math.min(item.parsedTextLines.length, 6) - 1) / 2) * item.lineHeight)
629
645
  : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15)
630
646
  ? (item.x + item.w * 0.5)
631
647
  : (item.textAlign === 'right'
632
648
  ? (item.x + item.w - (item.isPlaceholder ? 1 : 0))
633
649
  : (item.x + (lineObj.indent || 0) * 2.5 + (item.isPlaceholder ? 1 : 0))))"
634
- :y="item.textStartY + lIdx * item.lineHeight"
635
- :text-anchor="item.isVertical ? 'middle' : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15) ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
650
+ :y="item.isVertical
651
+ ? (item.textAlign === 'center' ? item.yCenter : (item.textAlign === 'right' ? (item.y + item.h - 1.2) : (item.y + 1.2)))
652
+ : (item.textStartY + lIdx * item.lineHeight)"
653
+ :text-anchor="item.isVertical
654
+ ? (item.textAlign === 'center' ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))
655
+ : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15) ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
656
+ :dominant-baseline="item.isVertical ? 'central' : undefined"
636
657
  :fill="item.color || (item.isTitle ? '#0f172a' : '#64748b')"
637
658
  :font-size="item.svgFontSize"
638
- font-family="sans-serif"
659
+ :font-family="item.fontFamily"
639
660
  :font-weight="item.isTitle ? 'bold' : 'normal'"
640
661
  :style="{ writingMode: item.isVertical ? 'vertical-rl' : 'horizontal-tb', pointerEvents: 'none', userSelect: 'none' }"
641
662
  >{{ lineObj.text.length > 20 ? lineObj.text.substring(0, 20) + '...' : lineObj.text }}</text>
@@ -650,12 +671,15 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
650
671
  ? item.x + item.w - (item.isPlaceholder ? 1 : 0)
651
672
  : item.x + (item.isPlaceholder ? 1 : 0)))"
652
673
  :y="item.isVertical
653
- ? item.y + item.svgFontSize * 1.2
674
+ ? (item.textAlign === 'center' ? item.yCenter : (item.textAlign === 'right' ? (item.y + item.h - 1.2) : (item.y + 1.2)))
654
675
  : (item.textStartY || Math.min(thumbSvgHeight - 1, item.y + item.h * 0.5 + item.svgFontSize * 0.35))"
655
- :text-anchor="item.isVertical ? 'middle' : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15) ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
676
+ :text-anchor="item.isVertical
677
+ ? (item.textAlign === 'center' ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))
678
+ : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15) ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
679
+ :dominant-baseline="item.isVertical ? 'central' : undefined"
656
680
  :fill="item.color || (item.isTitle ? '#0f172a' : '#64748b')"
657
681
  :font-size="item.svgFontSize"
658
- font-family="sans-serif"
682
+ :font-family="item.fontFamily"
659
683
  :font-weight="item.isTitle ? 'bold' : 'normal'"
660
684
  :style="{ writingMode: item.isVertical ? 'vertical-rl' : 'horizontal-tb', pointerEvents: 'none', userSelect: 'none' }"
661
685
  >{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
@@ -677,6 +701,50 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
677
701
  />
678
702
  </g>
679
703
  </g>
704
+ <g v-else-if="item.type === 'chart'" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined">
705
+ <template v-if="item.chartType === 'donut' || item.chartType === 'ring' || item.chartType === 'pie'">
706
+ <circle
707
+ :cx="item.cx"
708
+ :cy="item.cy"
709
+ :r="Math.max(1.5, Math.min(item.w, item.h) * 0.36)"
710
+ :fill="item.chartType === 'pie' ? (item.chartColors[0] || '#2563eb') : 'none'"
711
+ :stroke="item.chartColors[0] || '#2563eb'"
712
+ :stroke-width="item.chartType === 'pie' ? 0.4 : Math.max(1.2, Math.min(item.w, item.h) * 0.14)"
713
+ />
714
+ <circle
715
+ v-if="item.chartType !== 'pie'"
716
+ :cx="item.cx"
717
+ :cy="item.cy"
718
+ :r="Math.max(1.5, Math.min(item.w, item.h) * 0.36)"
719
+ fill="none"
720
+ :stroke="item.chartColors[2] || item.chartColors[1] || '#93c5fd'"
721
+ :stroke-width="Math.max(1.2, Math.min(item.w, item.h) * 0.14)"
722
+ :stroke-dasharray="`${Math.max(2, Math.min(item.w, item.h) * 0.8)} ${Math.max(4, Math.min(item.w, item.h) * 2)}`"
723
+ />
724
+ </template>
725
+ <template v-else-if="item.chartType === 'line' || item.chartType === 'area'">
726
+ <polyline
727
+ :points="`${item.x + item.w * 0.08},${item.y + item.h * 0.82} ${item.x + item.w * 0.35},${item.y + item.h * 0.58} ${item.x + item.w * 0.65},${item.y + item.h * 0.38} ${item.x + item.w * 0.92},${item.y + item.h * 0.16}`"
728
+ fill="none"
729
+ :stroke="item.chartColors[0] || '#2563eb'"
730
+ stroke-width="1.1"
731
+ stroke-linecap="round"
732
+ stroke-linejoin="round"
733
+ />
734
+ <line :x1="item.x + item.w * 0.06" :y1="item.y + item.h * 0.88" :x2="item.x + item.w * 0.94" :y2="item.y + item.h * 0.88" :stroke="item.chartColors[3] || '#cbd5e1'" stroke-width="0.4" />
735
+ </template>
736
+ <template v-else-if="item.chartType === 'horizontal-bar'">
737
+ <rect :x="item.x + item.w * 0.08" :y="item.y + item.h * 0.15" :width="item.w * 0.78" :height="item.h * 0.16" rx="0.5" :fill="item.chartColors[0] || '#2563eb'" />
738
+ <rect :x="item.x + item.w * 0.08" :y="item.y + item.h * 0.42" :width="item.w * 0.56" :height="item.h * 0.16" rx="0.5" :fill="item.chartColors[1] || item.chartColors[0] || '#3b82f6'" />
739
+ <rect :x="item.x + item.w * 0.08" :y="item.y + item.h * 0.69" :width="item.w * 0.38" :height="item.h * 0.16" rx="0.5" :fill="item.chartColors[2] || item.chartColors[0] || '#60a5fa'" />
740
+ </template>
741
+ <template v-else>
742
+ <rect :x="item.x + item.w * 0.1" :y="item.y + item.h * 0.45" :width="item.w * 0.14" :height="item.h * 0.45" rx="0.5" :fill="item.chartColors[0] || '#2563eb'" />
743
+ <rect :x="item.x + item.w * 0.31" :y="item.y + item.h * 0.25" :width="item.w * 0.14" :height="item.h * 0.65" rx="0.5" :fill="item.chartColors[1] || item.chartColors[0] || '#3b82f6'" />
744
+ <rect :x="item.x + item.w * 0.52" :y="item.y + item.h * 0.35" :width="item.w * 0.14" :height="item.h * 0.55" rx="0.5" :fill="item.chartColors[2] || item.chartColors[0] || '#60a5fa'" />
745
+ <rect :x="item.x + item.w * 0.73" :y="item.y + item.h * 0.15" :width="item.w * 0.14" :height="item.h * 0.75" rx="0.5" :fill="item.chartColors[3] || item.chartColors[0] || '#93c5fd'" />
746
+ </template>
747
+ </g>
680
748
  <rect v-else :x="item.x" :y="item.y" :width="item.w" :height="item.h" rx="1" fill="none" stroke="#e2e8f0" stroke-width="0.8" />
681
749
  </template>
682
750
  </template>
@@ -301,7 +301,7 @@ function applyPresetFilter(values: Record<string, string>) {
301
301
 
302
302
  <!-- Image Actions (Crop, Replace, Reset, Set Background) -->
303
303
  <div class="control-group"
304
- style="padding: 0 16px; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; border-bottom: 1px solid #EEEFF0; padding-bottom: 12px;">
304
+ style="padding: 0 16px; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; margin-bottom: 12px;">
305
305
  <!-- Row 1 -->
306
306
  <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px;">
307
307
  <!-- 剪裁 split dropdown group -->
@@ -389,12 +389,16 @@ function applyPresetFilter(values: Record<string, string>) {
389
389
  </div>
390
390
 
391
391
  <!-- 1. 蒙版 Accordion -->
392
- <div class="control-group shape-accordion-group"
393
- style="border-bottom: 1px solid #EEEFF0; padding-bottom: 12px; margin-top: 8px;">
394
- <div class="shape-accordion-header" @click="toggleMaskHeader" style="padding: 0 16px;">
392
+ <div class="control-group shape-accordion-group">
393
+ <div class="shape-accordion-header" @click="toggleMaskHeader">
395
394
  <span class="control-label shape-accordion-header-label">
396
- <span class="accordion-arrow"
397
- :style="{ transform: (enableColorMask && isMaskExpanded) ? 'rotate(90deg)' : 'rotate(0deg)' }">▶</span>蒙版
395
+ <span>蒙版</span>
396
+ <span class="accordion-arrow">
397
+ <svg class="icon" style="width: 14px; height: 14px;">
398
+ <use :href="(enableColorMask && isMaskExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"
399
+ :xlink:href="(enableColorMask && isMaskExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"></use>
400
+ </svg>
401
+ </span>
398
402
  </span>
399
403
  <el-switch v-model="enableColorMask" size="small" @click.stop />
400
404
  </div>
@@ -435,12 +439,16 @@ function applyPresetFilter(values: Record<string, string>) {
435
439
  </div>
436
440
 
437
441
  <!-- 2. 滤镜 Accordion -->
438
- <div class="control-group shape-accordion-group"
439
- style="border-bottom: 1px solid #EEEFF0; padding-bottom: 12px; margin-top: 8px;">
440
- <div class="shape-accordion-header" @click="toggleFiltersHeader" style="padding: 0 16px;">
442
+ <div class="control-group shape-accordion-group">
443
+ <div class="shape-accordion-header" @click="toggleFiltersHeader">
441
444
  <span class="control-label shape-accordion-header-label">
442
- <span class="accordion-arrow"
443
- :style="{ transform: (enableFilters && isFiltersExpanded) ? 'rotate(90deg)' : 'rotate(0deg)' }">▶</span>滤镜
445
+ <span>滤镜</span>
446
+ <span class="accordion-arrow">
447
+ <svg class="icon" style="width: 14px; height: 14px;">
448
+ <use :href="(enableFilters && isFiltersExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"
449
+ :xlink:href="(enableFilters && isFiltersExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"></use>
450
+ </svg>
451
+ </span>
444
452
  </span>
445
453
  <el-switch v-model="enableFilters" size="small" @click.stop />
446
454
  </div>
@@ -661,37 +669,41 @@ function applyPresetFilter(values: Record<string, string>) {
661
669
  }
662
670
 
663
671
  .shape-accordion-group {
664
- margin-top: 2px;
672
+ border-bottom: 1px solid #f1f5f9;
673
+ padding-bottom: 12px;
674
+ margin-bottom: 12px;
665
675
  }
666
676
 
667
677
  .shape-accordion-header {
668
- height: 34px;
669
- padding: 0 16px;
670
678
  display: flex;
671
679
  align-items: center;
672
- // justify-content: space-between;
680
+ justify-content: space-between;
681
+ padding: 0 16px;
682
+ height: 34px;
673
683
  cursor: pointer;
674
684
  user-select: none;
675
685
  }
676
686
 
677
687
  .shape-accordion-header-label {
678
- font-size: 13px;
679
- font-weight: 700;
680
- color: var(--text-primary, #0f172a);
688
+ font-size: 14px;
689
+ font-weight: 400;
690
+ color: #1e293b;
681
691
  display: flex;
682
692
  align-items: center;
683
693
  gap: 6px;
684
- width: 80px;
685
694
  flex-shrink: 0;
686
- text-align: left;
687
695
  }
688
696
 
689
697
  .accordion-arrow {
690
- font-size: 9px;
691
- transition: transform 0.2s;
692
- display: inline-block;
693
- color: #0f172a;
694
- transform-origin: center;
698
+ display: flex;
699
+ align-items: center;
700
+ justify-content: center;
701
+ color: #64748b;
702
+ }
703
+
704
+ :deep(.el-switch) {
705
+ --el-switch-on-color: #2563eb;
706
+ --el-switch-off-color: #cbd5e1;
695
707
  }
696
708
 
697
709
  .shape-accordion-content {
@@ -788,12 +800,4 @@ function applyPresetFilter(values: Record<string, string>) {
788
800
  color: var(--text-primary, #1e293b) !important;
789
801
  }
790
802
  }
791
-
792
- :deep(.el-switch__core) {
793
- border-radius: 4px !important;
794
- }
795
-
796
- :deep(.el-switch__action) {
797
- border-radius: 3px !important;
798
- }
799
803
  </style>