jvs-ppt-ui 0.0.12 → 0.0.15

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 (66) hide show
  1. package/dist/lib/check_imgs.html +18 -0
  2. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.css +187 -27
  3. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.js +1 -1
  4. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.json +345 -65
  5. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.ttf +0 -0
  6. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.woff +0 -0
  7. package/dist/lib/jvs-ppt-ui/iconfont/iconfont.woff2 +0 -0
  8. package/dist/lib/jvs-ppt-ui/img/al.png +0 -0
  9. package/dist/lib/jvs-ppt-ui/img/d.png +0 -0
  10. package/dist/lib/jvs-ppt-ui/img/dl.png +0 -0
  11. package/dist/lib/jvs-ppt-ui/img/l.png +0 -0
  12. package/dist/lib/jvs-ppt-ui.es.js +38582 -37350
  13. package/dist/lib/jvs-ppt-ui.umd.js +98 -98
  14. package/dist/lib/style.css +1 -1
  15. package/package.json +1 -1
  16. package/scripts/check-icons.mjs +22 -0
  17. package/scripts/patch-anim-icons.mjs +45 -0
  18. package/src/App.vue +3 -3
  19. package/src/assets/iconfont/iconfont.css +187 -27
  20. package/src/assets/iconfont/iconfont.js +1 -1
  21. package/src/assets/iconfont/iconfont.json +345 -65
  22. package/src/assets/iconfont/iconfont.ttf +0 -0
  23. package/src/assets/iconfont/iconfont.woff +0 -0
  24. package/src/assets/iconfont/iconfont.woff2 +0 -0
  25. package/src/components/CanvasArea.vue +210 -83
  26. package/src/components/ChartTypeSelector.vue +505 -148
  27. package/src/components/Header.vue +292 -39
  28. package/src/components/PresentationMode.vue +2 -1
  29. package/src/components/QuickBorderPopover.vue +51 -11
  30. package/src/components/QuickColorPopover.vue +65 -21
  31. package/src/components/SidebarLeft.vue +194 -92
  32. package/src/components/SidebarRight.vue +39 -35
  33. package/src/components/TemplateGallery.vue +1153 -1182
  34. package/src/components/ToastNotification.vue +2 -2
  35. package/src/components/Toolbar.vue +825 -733
  36. package/src/components/canvas/CanvasQuickToolbar.vue +17 -30
  37. package/src/components/canvas/elements/CanvasGroupElement.vue +6 -0
  38. package/src/components/canvas/elements/CanvasShapeElement.vue +113 -10
  39. package/src/components/canvas/elements/CanvasTextElement.vue +4 -3
  40. package/src/components/sidebar/common/SidebarAlignGroup.vue +104 -50
  41. package/src/components/sidebar/common/SidebarBorderAccordion.vue +373 -146
  42. package/src/components/sidebar/common/SidebarPositionGroup.vue +358 -149
  43. package/src/components/sidebar/common/SidebarReflectionAccordion.vue +429 -203
  44. package/src/components/sidebar/common/SidebarShadowAccordion.vue +844 -416
  45. package/src/components/sidebar/panels/GradientEditor.vue +671 -316
  46. package/src/components/sidebar/panels/LayoutThumbSvg.vue +33 -16
  47. package/src/components/sidebar/panels/SidebarAnimationPanel.vue +701 -138
  48. package/src/components/sidebar/panels/SidebarDesignPanel.vue +1596 -419
  49. package/src/components/sidebar/panels/SidebarMediaFormatPanel.vue +12 -0
  50. package/src/components/sidebar/panels/SidebarShapeFormatPanel.vue +652 -173
  51. package/src/components/sidebar/panels/SidebarTextFormatPanel.vue +1938 -1427
  52. package/src/components/sidebar/panels/SidebarTransitionPanel.vue +780 -210
  53. package/src/composables/canvas/useCanvasShortcuts.ts +20 -6
  54. package/src/composables/canvas/useCanvasText.ts +1 -1
  55. package/src/composables/canvas/useCanvasTransform.ts +20 -0
  56. package/src/composables/presetThemes.ts +43 -44
  57. package/src/composables/sidebar/useSidebarAnimation.ts +101 -25
  58. package/src/composables/sidebar/useSidebarDesign.ts +30 -11
  59. package/src/composables/sidebar/useSidebarElementTransform.ts +27 -5
  60. package/src/composables/sidebar/useSidebarImage.ts +10 -2
  61. package/src/composables/sidebar/useSidebarShapeFormat.ts +323 -99
  62. package/src/composables/useSlides.ts +338 -162
  63. package/src/main.ts +2 -0
  64. package/src/style.css +924 -359
  65. package/src/utils/canvas/elementStyles.ts +20 -1
  66. package/src/utils/groupFlip.ts +108 -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 SidebarAlignGroup from '../common/SidebarAlignGroup.vue'
4
4
  import SidebarPositionGroup from '../common/SidebarPositionGroup.vue'
5
5
  import SidebarBorderAccordion from '../common/SidebarBorderAccordion.vue'
@@ -10,8 +10,11 @@ import GradientEditor from './GradientEditor.vue'
10
10
  import { SHAPE_LIST } from '../../../utils/shapes'
11
11
  import { isImagePlaceholder, getElementGradientConfig, getElementGradientCss } from '../../../utils/canvas/elementStyles'
12
12
  import { isEllipseShape } from '../../../utils/line'
13
+ import { PATTERN_PRESETS, parseColor, generateGradientEndColor } from '../../../composables/sidebar/useSidebarShapeFormat'
13
14
 
14
15
  const shapePopoverVisible = ref(false)
16
+ const fillPopoverVisible = ref(false)
17
+ const imageFileInputRef = ref<HTMLInputElement | null>(null)
15
18
 
16
19
  const props = defineProps<{
17
20
  element: any
@@ -200,12 +203,44 @@ function handleFitModeChange(val: string) {
200
203
 
201
204
  const currentShapeGradient = computed(() => {
202
205
  if (!props.element) return 'linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%)'
203
- const g = getElementGradientConfig(props.element)
206
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
204
207
  if (g?.css) return g.css
205
208
  const css = getElementGradientCss(props.element)
206
209
  if (css) return css
207
210
  if (g) return g
208
- return 'linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%)'
211
+ const startColor = (props.fillHex && props.fillHex !== 'transparent' && props.fillHex !== 'none') ? props.fillHex : '#3b82f6'
212
+ const endColor = props.gradientEndHex || generateGradientEndColor(startColor)
213
+ return `linear-gradient(135deg, ${startColor} 0%, ${endColor} 100%)`
214
+ })
215
+
216
+ const activeGradientStart = computed(() => {
217
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
218
+ if (g?.colors && g.colors.length > 0 && g.colors[0]?.color) {
219
+ return parseColor(g.colors[0].color).hex
220
+ }
221
+ if (props.gradientStartHex) return props.gradientStartHex
222
+ if (props.fillHex && props.fillHex !== 'transparent' && props.fillHex !== 'none') {
223
+ return props.fillHex
224
+ }
225
+ return '#3b82f6'
226
+ })
227
+
228
+ const activeGradientEnd = computed(() => {
229
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
230
+ if (g?.colors && g.colors.length > 1 && g.colors[g.colors.length - 1]?.color) {
231
+ return parseColor(g.colors[g.colors.length - 1].color).hex
232
+ }
233
+ if (props.gradientEndHex) return props.gradientEndHex
234
+ return generateGradientEndColor(activeGradientStart.value)
235
+ })
236
+
237
+ const activeGradientMid = computed(() => {
238
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
239
+ if (g?.colors && g.colors.length > 2) {
240
+ const midIdx = Math.floor(g.colors.length / 2)
241
+ return parseColor(g.colors[midIdx].color).hex
242
+ }
243
+ return generateGradientEndColor(activeGradientStart.value)
209
244
  })
210
245
 
211
246
  function onShapeGradientRealtime(config: any, css: string) {
@@ -215,6 +250,143 @@ function onShapeGradientRealtime(config: any, css: string) {
215
250
  function onShapeGradientCommit(config: any, css: string) {
216
251
  emit('update:elementGradient', config, css, true)
217
252
  }
253
+
254
+ const gradientEditorRef = ref<any>(null)
255
+
256
+ function getCurrentShapeTitle(el: any): string {
257
+ const item = getOriginalShapeItem(el)
258
+ if (item?.title) return item.title
259
+ if (el?.shapType === 'rect' || el?.content === 'rect') return '矩形'
260
+ if (el?.shapType === 'ellipse' || el?.content === 'circle') return '圆形'
261
+ return '矩形'
262
+ }
263
+
264
+
265
+
266
+ function formatHexDisplay(val: any): string {
267
+ if (!val || val === 'transparent') return '无'
268
+ let str = ''
269
+ if (typeof val === 'string') {
270
+ str = val
271
+ } else if (typeof val === 'object' && val !== null) {
272
+ if (val.type === 'color' && typeof val.value === 'string') {
273
+ str = val.value
274
+ } else if (typeof val.value === 'string') {
275
+ str = val.value
276
+ }
277
+ }
278
+ if (!str || str === 'transparent') return '无'
279
+ let clean = str.replace('#', '').trim().toUpperCase()
280
+ if (clean.length === 8) clean = clean.slice(0, 6)
281
+ return clean
282
+ }
283
+
284
+ const activeFillMode = computed(() => {
285
+ if (props.shapeFillType === 'solid') return 'solid'
286
+ if (props.shapeFillType === 'gradient') {
287
+ if (gradientEditorRef.value?.currentType) {
288
+ const ct = gradientEditorRef.value.currentType
289
+ return ct === 'path' ? 'gradient-linear' : `gradient-${ct}`
290
+ }
291
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
292
+ if (g?.type) {
293
+ return g.type === 'path' ? 'gradient-linear' : `gradient-${g.type}`
294
+ }
295
+ if (props.gradientPathType === 'circle') return 'gradient-radial'
296
+ if (props.gradientPathType === 'rect') return 'gradient-rect'
297
+ return 'gradient-linear'
298
+ }
299
+ if (props.shapeFillType === 'image') return 'image'
300
+ if (props.shapeFillType === 'pattern') return 'pattern'
301
+ return 'solid'
302
+ })
303
+
304
+ function selectFillMode(mode: string) {
305
+ if (!props.isFillEnabled) {
306
+ emit('update:isFillEnabled', true)
307
+ emit('update:isFillExpanded', true)
308
+ }
309
+ if (mode === 'solid') {
310
+ emit('update:shapeFillType', 'solid')
311
+ } else if (mode.startsWith('gradient-')) {
312
+ const gType = mode.replace('gradient-', '') as 'linear' | 'radial' | 'rect'
313
+ const path = gType === 'linear' ? 'line' : (gType === 'radial' ? 'circle' : 'rect')
314
+ emit('update:gradientPathType', path)
315
+ if (props.shapeFillType !== 'gradient') {
316
+ emit('update:shapeFillType', 'gradient')
317
+ }
318
+ nextTick(() => {
319
+ if (gradientEditorRef.value?.changeType) {
320
+ gradientEditorRef.value.changeType(gType)
321
+ }
322
+ })
323
+ } else if (mode === 'image') {
324
+ emit('update:shapeFillType', 'image')
325
+ } else if (mode === 'pattern') {
326
+ emit('update:shapeFillType', 'pattern')
327
+ }
328
+ }
329
+
330
+ function toggleFillHeader() {
331
+ if (!props.isFillEnabled) return
332
+ emit('update:isFillExpanded', !props.isFillExpanded)
333
+ }
334
+
335
+ function toggleFillSwitch(val: any) {
336
+ const boolVal = !!val
337
+ emit('update:isFillEnabled', boolVal)
338
+ emit('update:isFillExpanded', boolVal)
339
+ }
340
+
341
+ const currentPatternImage = computed(() => {
342
+ return props.shapePatternFill || props.element?.pattern || props.element?.style?.pattern || ''
343
+ })
344
+
345
+ function triggerImageUpload() {
346
+ imageFileInputRef.value?.click()
347
+ }
348
+
349
+ function handleImageFileChange(e: Event) {
350
+ emit('handleShapePatternUpload', e)
351
+ if (imageFileInputRef.value) {
352
+ imageFileInputRef.value.value = ''
353
+ }
354
+ }
355
+
356
+ function selectPatternPreset(url: string) {
357
+ emit('update:shapePatternFill', url)
358
+ }
359
+
360
+ const displayFillOpacity = computed(() => {
361
+ if (props.fillHex === 'transparent' || props.fillHex === 'none') {
362
+ return 0
363
+ }
364
+ const alpha = props.fillOpacity !== undefined ? props.fillOpacity : 100
365
+ return Math.max(0, Math.min(100, Math.round(alpha)))
366
+ })
367
+
368
+ function handleFillOpacityInput(e: Event) {
369
+ const target = e.target as HTMLInputElement
370
+ let val = parseInt(target.value)
371
+ if (isNaN(val)) val = 100
372
+ val = Math.max(0, Math.min(100, val))
373
+ emit('update:fillOpacity', val)
374
+ }
375
+
376
+ function onSelectFillColor(color: string) {
377
+ if (!color || color === 'transparent' || color === 'none') {
378
+ emit('update:fillHex', 'transparent')
379
+ emit('update:fillOpacity', 0)
380
+ return
381
+ }
382
+ const parsed = parseColor(color)
383
+ emit('update:fillHex', parsed.hex)
384
+ if (parsed.alpha !== undefined && parsed.alpha < 100) {
385
+ emit('update:fillOpacity', parsed.alpha)
386
+ } else if (!props.fillOpacity || props.fillOpacity === 0) {
387
+ emit('update:fillOpacity', 100)
388
+ }
389
+ }
218
390
  </script>
219
391
 
220
392
  <template>
@@ -277,34 +449,35 @@ function onShapeGradientCommit(config: any, css: string) {
277
449
 
278
450
  <!-- Replace Shape Dropdown -->
279
451
  <div v-if="(element?.type === 'shape' || isMultiSelect) && element?.type !== 'group'"
280
- class="control-group replace-shape-row">
281
- <span class="control-label shape-accordion-header-label">{{ isImgPh ? '遮罩形状' : '更换形状' }}</span>
282
- <el-popover v-model:visible="shapePopoverVisible" placement="bottom-end" :width="380" trigger="click"
452
+ class="replace-shape-section">
453
+ <div class="section-title">{{ isImgPh ? '遮罩形状' : '更换形状' }}</div>
454
+ <el-popover v-model:visible="shapePopoverVisible" placement="bottom" :width="380" trigger="click"
283
455
  popper-class="shape-popover-popper" :show-arrow="false">
284
456
  <template #reference>
285
- <div class="shape-select-btn">
286
- <div style="display: flex; align-items: center; height: 100%;">
457
+ <div class="shape-select-btn-full">
458
+ <div class="shape-btn-left">
287
459
  <template v-if="getOriginalShapeItem(element)">
288
460
  <svg
289
461
  :viewBox="`0 0 ${getOriginalShapeItem(element)?.viewBox?.[0]} ${getOriginalShapeItem(element)?.viewBox?.[1]}`"
290
- class="shape-preview-svg" style="overflow: visible;">
462
+ class="shape-preview-svg">
291
463
  <path :d="getOriginalShapeItem(element)?.path" fill="none" stroke="currentColor" stroke-width="2"
292
464
  vector-effect="non-scaling-stroke" />
293
465
  </svg>
294
466
  </template>
295
467
  <template v-else-if="element?.content || element?.path">
296
468
  <svg :viewBox="`0 0 ${element.viewBox?.[0] || 200} ${element.viewBox?.[1] || 200}`"
297
- class="shape-preview-svg" style="overflow: visible;">
469
+ class="shape-preview-svg">
298
470
  <path :d="safeShapePath(element.path || element.content)" fill="none" stroke="currentColor"
299
471
  stroke-width="2" vector-effect="non-scaling-stroke" />
300
472
  </svg>
301
473
  </template>
302
474
  <template v-else>
303
- <svg viewBox="0 0 200 200" class="shape-preview-svg" style="overflow: visible;">
475
+ <svg viewBox="0 0 200 200" class="shape-preview-svg">
304
476
  <path d="M 0 0 L 200 0 L 200 200 L 0 200 Z" fill="none" stroke="currentColor" stroke-width="2"
305
477
  vector-effect="non-scaling-stroke" />
306
478
  </svg>
307
479
  </template>
480
+ <span class="shape-title-text">{{ getCurrentShapeTitle(element) }}</span>
308
481
  </div>
309
482
  <svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2"
310
483
  class="dropdown-arrow-svg">
@@ -335,54 +508,123 @@ function onShapeGradientCommit(config: any, css: string) {
335
508
 
336
509
  <!-- Shape Fill Accordion -->
337
510
  <div v-if="element?.type !== 'table' && !isGroup" class="control-group shape-accordion-group">
338
- <div class="shape-accordion-header" @click="isFillEnabled && emit('update:isFillExpanded', !isFillExpanded)">
511
+ <div class="shape-accordion-header" @click="toggleFillHeader">
339
512
  <span class="control-label shape-accordion-header-label">
340
- <span class="accordion-arrow"
341
- :style="{ transform: (isFillEnabled && isFillExpanded) ? 'rotate(90deg)' : 'rotate(0deg)' }">▶</span>{{
342
- isImgPh
343
- ? '占位底色' : '填充' }}
513
+ <span>{{ isImgPh ? '占位底色' : '填充' }}</span>
514
+ <span class="accordion-arrow">
515
+ <svg class="icon" style="width: 14px; height: 14px;">
516
+ <use :href="(isFillEnabled && isFillExpanded) ? '#icon-xiala-zhankai' : '#icon-xiala-shouqi'"
517
+ :xlink:href="(isFillEnabled && isFillExpanded) ? '#icon-xiala-zhankai' : '#icon-xiala-shouqi'"></use>
518
+ </svg>
519
+ </span>
344
520
  </span>
345
- <el-switch :model-value="isFillEnabled" size="small" @click.stop
346
- @change="emit('update:isFillEnabled', $event); emit('update:isFillExpanded', $event)" />
521
+ <el-switch :model-value="isFillEnabled" size="small" @click.stop @change="toggleFillSwitch" />
347
522
  </div>
348
523
 
349
524
  <div v-show="isFillExpanded && isFillEnabled" class="shape-accordion-content">
350
- <!-- Dropdown for Fill Type -->
351
- <div class="shape-property-row">
352
- <span class="shape-property-label">填充类型</span>
353
- <el-select :model-value="shapeFillType" @update:model-value="emit('update:shapeFillType', $event)"
354
- size="small" class="custom-select" style="flex: 1;">
355
- <el-option label="纯色填充(S)" value="solid" />
356
- <el-option label="渐变填充(G)" value="gradient" />
357
- <el-option label="图片或纹理填充(P)" value="image" />
358
- <el-option label="图案填充(A)" value="pattern" />
359
- </el-select>
525
+ <!-- 7 Fill Type Buttons Bar -->
526
+ <div class="fill-types-bar">
527
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'solid' }"
528
+ @click="selectFillMode('solid')" title="纯色填充">
529
+ <svg viewBox="0 0 18 18" width="18" height="18">
530
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2"
531
+ :fill="activeFillMode === 'solid' ? (props.fillHex && props.fillHex !== 'transparent' ? props.fillHex : '#3b82f6') : '#cbd5e1'"
532
+ :stroke="activeFillMode === 'solid' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
533
+ </svg>
534
+ </button>
535
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'gradient-linear' }"
536
+ @click="selectFillMode('gradient-linear')" title="线性渐变">
537
+ <svg viewBox="0 0 18 18" width="18" height="18">
538
+ <defs>
539
+ <linearGradient id="fillBarLinear" x1="0" y1="0" x2="0" y2="1">
540
+ <stop offset="0%" :stop-color="activeFillMode === 'gradient-linear' ? activeGradientStart : '#94a3b8'" />
541
+ <stop offset="100%" :stop-color="activeFillMode === 'gradient-linear' ? activeGradientEnd : '#ffffff'" />
542
+ </linearGradient>
543
+ </defs>
544
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" fill="url(#fillBarLinear)" :stroke="activeFillMode === 'gradient-linear' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
545
+ </svg>
546
+ </button>
547
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'gradient-radial' }"
548
+ @click="selectFillMode('gradient-radial')" title="径向渐变">
549
+ <svg viewBox="0 0 18 18" width="18" height="18">
550
+ <defs>
551
+ <radialGradient id="fillBarRadial" cx="50%" cy="50%" r="50%">
552
+ <stop offset="15%" :stop-color="activeFillMode === 'gradient-radial' ? activeGradientEnd : '#ffffff'" />
553
+ <stop offset="100%" :stop-color="activeFillMode === 'gradient-radial' ? activeGradientStart : '#cbd5e1'" />
554
+ </radialGradient>
555
+ </defs>
556
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" fill="url(#fillBarRadial)" :stroke="activeFillMode === 'gradient-radial' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
557
+ </svg>
558
+ </button>
559
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'gradient-rect' }"
560
+ @click="selectFillMode('gradient-rect')" title="菱形渐变">
561
+ <svg viewBox="0 0 18 18" width="18" height="18">
562
+ <defs>
563
+ <radialGradient id="fillBarRect" cx="50%" cy="50%" r="50%">
564
+ <stop offset="0%" :stop-color="activeFillMode === 'gradient-rect' ? activeGradientEnd : '#ffffff'" />
565
+ <stop offset="60%" :stop-color="activeFillMode === 'gradient-rect' ? activeGradientMid : '#e2e8f0'" />
566
+ <stop offset="100%" :stop-color="activeFillMode === 'gradient-rect' ? activeGradientStart : '#94a3b8'" />
567
+ </radialGradient>
568
+ </defs>
569
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" fill="url(#fillBarRect)" :stroke="activeFillMode === 'gradient-rect' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
570
+ </svg>
571
+ </button>
572
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'image' }"
573
+ @click="selectFillMode('image')" title="图片填充">
574
+ <svg viewBox="0 0 18 18" width="18" height="18" fill="none">
575
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" :stroke="activeFillMode === 'image' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" fill="#ffffff" />
576
+ <circle cx="6" cy="6" r="1.5" :fill="activeFillMode === 'image' ? '#1E6FFF' : '#94a3b8'" />
577
+ <path d="M2.5 14L7 9.5L10.5 13L12.5 11L15.5 14" :stroke="activeFillMode === 'image' ? '#1E6FFF' : '#94a3b8'" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round" />
578
+ </svg>
579
+ </button>
580
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'pattern' }"
581
+ @click="selectFillMode('pattern')" title="纹理填充">
582
+ <svg viewBox="0 0 18 18" width="18" height="18">
583
+ <defs>
584
+ <pattern id="fillBarPattern" width="4" height="4" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
585
+ <line x1="0" y1="0" x2="0" y2="4" :stroke="activeFillMode === 'pattern' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
586
+ </pattern>
587
+ </defs>
588
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" fill="url(#fillBarPattern)" :stroke="activeFillMode === 'pattern' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
589
+ </svg>
590
+ </button>
360
591
  </div>
361
592
 
362
- <!-- Solid Fill -->
593
+ <!-- Solid Fill (Full-width Color Pill) -->
363
594
  <template v-if="shapeFillType === 'solid'">
364
- <div class="shape-property-row">
365
- <span class="shape-property-label">颜色</span>
366
- <QuickColorPopover :color="fillHex" :recent-colors="recentColors"
367
- @select-color="emit('update:fillHex', $event)">
595
+ <div class="full-color-pill">
596
+ <QuickColorPopover v-model:visible="fillPopoverVisible" :color="fillHex || '#000000'" :alpha="props.fillOpacity" :recent-colors="recentColors"
597
+ @select-color="onSelectFillColor">
368
598
  <template #reference>
369
- <div class="color-picker-pill-wrapper">
370
- <div style="display: flex; align-items: center; gap: 8px;">
371
- <div :style="{ background: fillHex }"
372
- style="width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.1);"></div>
373
- <span style="font-size: 12px; font-family: monospace; color: var(--text-primary);">{{ fillHex ===
374
- 'transparent' ? '无' : fillHex.toUpperCase() }}</span>
375
- </div>
599
+ <div class="color-left-info">
600
+ <div :style="{ background: fillHex || '#000000' }" class="color-square-preview"></div>
601
+ <span class="color-hex-text">
602
+ {{ formatHexDisplay(fillHex || '#000000') }}
603
+ </span>
376
604
  </div>
377
605
  </template>
378
606
  </QuickColorPopover>
607
+ <div class="color-opacity-input-wrapper" @click.stop title="不透明度 (0%为完全透明,100%为完全不透明)">
608
+ <input
609
+ type="number"
610
+ class="color-opacity-num-input"
611
+ :value="displayFillOpacity"
612
+ min="0"
613
+ max="100"
614
+ @input="handleFillOpacityInput"
615
+ @keydown.enter="($event.target as HTMLElement).blur()"
616
+ />
617
+ <span class="percent-unit">%</span>
618
+ </div>
379
619
  </div>
380
620
  </template>
381
621
 
382
- <!-- Gradient Fill (PPT 规范专业渐变编辑器) -->
622
+ <!-- Gradient Fill (GradientEditor with hideTypeButtons) -->
383
623
  <template v-else-if="shapeFillType === 'gradient'">
384
- <div style="padding: 2px 0 6px 0;">
624
+ <div style="padding: 0;">
385
625
  <GradientEditor
626
+ ref="gradientEditorRef"
627
+ :hide-type-buttons="true"
386
628
  :model-value="currentShapeGradient"
387
629
  :recent-colors="recentColors"
388
630
  @update:config="onShapeGradientRealtime"
@@ -391,15 +633,48 @@ function onShapeGradientCommit(config: any, css: string) {
391
633
  </div>
392
634
  </template>
393
635
 
394
- <!-- Fill Transparency Row -->
395
- <div v-if="shapeFillType !== 'gradient'" class="shape-property-row">
396
- <span class="shape-property-label">透明度</span>
397
- <div class="shape-slider-wrapper">
398
- <el-slider :model-value="fillOpacity" @update:model-value="emit('update:fillOpacity', $event)" :min="0"
399
- :max="100" size="small" style="flex: 1;" class="custom-slider" :show-tooltip="false" show-input
400
- :show-input-controls="false" />
636
+ <!-- Image Fill -->
637
+ <template v-else-if="shapeFillType === 'image'">
638
+ <div class="image-fill-section">
639
+ <input
640
+ ref="imageFileInputRef"
641
+ type="file"
642
+ accept="image/*"
643
+ style="display: none;"
644
+ @change="handleImageFileChange"
645
+ />
646
+ <div v-if="currentPatternImage" class="image-fill-preview-card">
647
+ <div class="image-fill-thumb" :style="{ backgroundImage: `url(${currentPatternImage})` }"></div>
648
+ <div class="image-fill-btn-group">
649
+ <button type="button" class="image-fill-sub-btn" @click="triggerImageUpload">更换图片</button>
650
+ <button type="button" class="image-fill-sub-btn danger" @click="emit('clearShapePatternFill')">清除</button>
651
+ </div>
652
+ </div>
653
+ <div v-else class="image-fill-upload-card" @click="triggerImageUpload">
654
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.6">
655
+ <rect x="3" y="3" width="18" height="18" rx="3" stroke="currentColor" />
656
+ <circle cx="8.5" cy="8.5" r="1.5" fill="currentColor" />
657
+ <path d="M21 15l-5-5L5 21" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" />
658
+ </svg>
659
+ <span class="upload-tip-text">点击上传图片</span>
660
+ </div>
401
661
  </div>
402
- </div>
662
+ </template>
663
+
664
+ <!-- Pattern Fill -->
665
+ <template v-else-if="shapeFillType === 'pattern'">
666
+ <div class="pattern-presets-grid">
667
+ <div
668
+ v-for="p in PATTERN_PRESETS"
669
+ :key="p.name"
670
+ class="pattern-preset-card"
671
+ :class="{ active: currentPatternImage === p.url }"
672
+ :title="p.name"
673
+ :style="{ backgroundImage: `url(${p.url})` }"
674
+ @click="selectPatternPreset(p.url)"
675
+ ></div>
676
+ </div>
677
+ </template>
403
678
  </div>
404
679
  </div>
405
680
 
@@ -437,41 +712,70 @@ function onShapeGradientCommit(config: any, css: string) {
437
712
  </template>
438
713
 
439
714
  <style scoped lang="scss">
440
- .replace-shape-row {
441
- display: flex;
442
- flex-direction: row;
443
- align-items: center;
444
- justify-content: space-between;
715
+ .corner-radius-section {
445
716
  padding: 0 16px;
446
- margin-top: 8px;
447
717
  margin-bottom: 12px;
448
- border-bottom: 1px solid #EEEFF0;
449
718
  padding-bottom: 12px;
719
+ border-bottom: 1px solid #edf0f3;
720
+ }
721
+
722
+ .section-title {
723
+ font-size: 13px;
724
+ font-weight: 500;
725
+ color: #1e293b;
726
+ margin-bottom: 8px;
727
+ text-align: left;
450
728
  }
451
729
 
452
- .shape-select-btn {
730
+
731
+
732
+ .replace-shape-section {
733
+ padding: 0 16px;
734
+ margin-bottom: 12px;
735
+ padding-bottom: 12px;
736
+ border-bottom: 1px solid #edf0f3;
737
+ }
738
+
739
+ .shape-select-btn-full {
740
+ width: 100%;
741
+ height: 34px;
742
+ background: #f8f9fa;
743
+ border: 1px solid #edf0f3;
744
+ border-radius: 8px;
745
+ padding: 0 12px;
453
746
  display: flex;
454
747
  align-items: center;
455
748
  justify-content: space-between;
456
- border: none;
457
- border-radius: 4px;
458
- padding: 0 10px;
459
- height: 32px;
460
- flex: 1;
461
- cursor: pointer;
462
- background: #F5F6F7;
463
749
  box-sizing: border-box;
750
+ cursor: pointer;
751
+ transition: all 0.15s ease;
752
+
753
+ &:hover {
754
+ background: #f1f5f9;
755
+ border-color: #e2e8f0;
756
+ }
757
+ }
758
+
759
+ .shape-btn-left {
760
+ display: flex;
761
+ align-items: center;
762
+ gap: 8px;
763
+ }
764
+
765
+ .shape-title-text {
766
+ font-size: 13px;
767
+ font-weight: 500;
768
+ color: #1e293b;
464
769
  }
465
770
 
466
771
  .shape-preview-svg {
467
- width: 18px;
468
- height: 18px;
772
+ width: 16px;
773
+ height: 16px;
469
774
  color: #1e293b;
470
775
  fill: none;
471
776
  stroke: currentColor;
472
- stroke-width: 2;
777
+ stroke-width: 1.8;
473
778
  display: block;
474
- overflow: visible;
475
779
  }
476
780
 
477
781
  .dropdown-arrow-svg {
@@ -479,15 +783,15 @@ function onShapeGradientCommit(config: any, css: string) {
479
783
  }
480
784
 
481
785
  .shape-accordion-group {
482
- border-bottom: 1px solid #EEEFF0;
786
+ border-bottom: 1px solid #edf0f3;
483
787
  padding-bottom: 12px;
484
- margin-bottom: 8px;
788
+ margin-bottom: 12px;
485
789
  }
486
790
 
487
791
  .shape-accordion-header {
488
792
  display: flex;
489
793
  align-items: center;
490
- // justify-content: space-between;
794
+ justify-content: space-between;
491
795
  padding: 0 16px;
492
796
  height: 32px;
493
797
  cursor: pointer;
@@ -495,101 +799,159 @@ function onShapeGradientCommit(config: any, css: string) {
495
799
 
496
800
  .shape-accordion-header-label {
497
801
  font-size: 13px;
498
- font-weight: 600;
499
- color: var(--text-primary);
802
+ font-weight: 500;
803
+ color: #1e293b;
500
804
  display: flex;
501
805
  align-items: center;
502
806
  gap: 6px;
503
- width: 80px;
504
- flex-shrink: 0;
505
- text-align: left;
807
+ user-select: none;
506
808
  }
507
809
 
508
810
  .accordion-arrow {
509
- font-size: 9px;
510
- transition: transform 0.2s;
511
- display: inline-block;
512
- color: #475569;
811
+ display: flex;
812
+ align-items: center;
813
+ justify-content: center;
814
+ color: #64748b;
513
815
  }
514
816
 
515
817
  .shape-accordion-content {
516
- padding: 12px 16px 0 16px;
818
+ padding: 10px 16px 0 16px;
517
819
  display: flex;
518
820
  flex-direction: column;
519
- gap: 12px;
520
821
  }
521
822
 
522
- .shape-property-row {
823
+ .fill-types-bar {
523
824
  display: flex;
524
825
  align-items: center;
525
826
  justify-content: space-between;
827
+ margin-bottom: 12px;
828
+ width: 100%;
829
+ height: 40px;
830
+ background: #f8f9fa;
831
+ border: 1px solid #edf0f3;
832
+ border-radius: 10px;
833
+ padding: 3px 4px;
834
+ box-sizing: border-box;
835
+ }
836
+
837
+ .fill-type-icon-btn {
838
+ width: 32px;
526
839
  height: 32px;
840
+ flex: 0 0 32px;
841
+ border-radius: 9px;
842
+ background: transparent;
843
+ border: 1px solid transparent;
844
+ display: flex;
845
+ align-items: center;
846
+ justify-content: center;
847
+ cursor: pointer;
527
848
  padding: 0;
528
- gap: 8px;
849
+ transition: all 0.15s ease;
850
+ box-sizing: border-box;
529
851
 
530
- ::v-deep(.el-input__wrapper) {
531
- height: 32px !important;
532
- display: flex;
533
- align-items: center;
534
- background: #F5F6F7;
535
- border-radius: 4px;
536
- padding: 0 8px;
537
- box-sizing: border-box;
538
- box-shadow: none !important;
852
+ &:hover:not(.active) {
853
+ background: rgba(0, 0, 0, 0.04);
854
+ }
855
+
856
+ &.active {
857
+ width: 32px;
858
+ height: 32px;
859
+ background: #FFFFFF;
860
+ border-radius: 9px 9px 9px 9px;
861
+ border: 1px solid #E5E7EB;
862
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
539
863
  }
540
864
  }
541
865
 
542
- .shape-property-label {
543
- font-size: 12px;
544
- color: var(--text-secondary);
545
- width: 80px;
546
- flex-shrink: 0;
547
- text-align: left;
866
+ :deep(.color-span-box),
867
+ :deep(.el-popover__reference-wrapper) {
868
+ display: block !important;
869
+ width: 100% !important;
548
870
  }
549
871
 
550
- .color-picker-pill-wrapper {
551
- position: relative;
872
+ .full-color-pill {
873
+ width: 100%;
874
+ height: 34px;
875
+ background: #f8f9fa;
876
+ border: 1px solid #edf0f3;
877
+ border-radius: 8px;
878
+ padding: 0 10px;
552
879
  display: flex;
553
880
  align-items: center;
554
881
  justify-content: space-between;
555
- background: #F5F6F7;
556
- border-radius: 4px;
557
- padding: 0 10px;
558
- height: 32px;
559
- flex: 1;
560
- cursor: pointer;
561
- border: none;
562
882
  box-sizing: border-box;
883
+ transition: all 0.15s ease;
884
+
885
+ &:hover {
886
+ background: #f1f5f9;
887
+ border-color: #e2e8f0;
888
+ }
889
+
890
+ :deep(.color-span-box) {
891
+ display: flex !important;
892
+ align-items: center !important;
893
+ flex: 1 !important;
894
+ height: 100% !important;
895
+ cursor: pointer;
896
+ }
563
897
  }
564
898
 
565
- .shape-border-style-wrapper {
899
+ .color-left-info {
566
900
  display: flex;
567
901
  align-items: center;
568
- justify-content: flex-end;
569
902
  gap: 8px;
570
903
  flex: 1;
904
+ height: 100%;
905
+ cursor: pointer;
906
+ }
907
+
908
+ .color-square-preview {
909
+ width: 16px;
910
+ height: 16px;
911
+ border-radius: 3px;
912
+ border: 1px solid rgba(0, 0, 0, 0.1);
913
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
571
914
  }
572
915
 
573
- .shape-border-width-wrapper {
916
+ .color-hex-text {
917
+ font-size: 13px;
918
+ font-weight: 500;
919
+ font-family: monospace, sans-serif;
920
+ color: #1e293b;
921
+ letter-spacing: 0.5px;
922
+ }
923
+
924
+ .color-opacity-input-wrapper {
574
925
  display: flex;
575
926
  align-items: center;
576
- background: #F5F6F7;
577
- border: none;
927
+ justify-content: flex-end;
928
+ height: 24px;
929
+ padding: 0 4px;
578
930
  border-radius: 4px;
579
- padding: 0 8px;
580
- height: 32px;
581
- box-sizing: border-box;
582
- position: relative;
931
+ transition: all 0.15s ease;
932
+ background: transparent;
933
+
934
+ &:hover {
935
+ background: rgba(0, 0, 0, 0.04);
936
+ }
937
+
938
+ &:focus-within {
939
+ background: #ffffff;
940
+ box-shadow: 0 0 0 1px #1E6FFF;
941
+ }
583
942
  }
584
943
 
585
- .shape-num-field {
944
+ .color-opacity-num-input {
945
+ width: 26px;
586
946
  border: none;
587
947
  background: transparent;
588
948
  outline: none;
589
949
  font-size: 12px;
590
- color: var(--text-primary);
591
- width: 100%;
592
- text-align: left;
950
+ font-weight: 500;
951
+ color: #475569;
952
+ text-align: right;
953
+ padding: 0 1px 0 0;
954
+ font-family: inherit;
593
955
 
594
956
  &::-webkit-outer-spin-button,
595
957
  &::-webkit-inner-spin-button {
@@ -598,47 +960,46 @@ function onShapeGradientCommit(config: any, css: string) {
598
960
  }
599
961
  }
600
962
 
601
- .shape-slider-wrapper {
602
- display: flex;
603
- align-items: center;
604
- gap: 10px;
605
- flex: 1;
963
+ .percent-unit {
964
+ font-size: 12px;
965
+ font-weight: 500;
966
+ color: #64748b;
967
+ user-select: none;
606
968
  }
607
969
 
608
- .custom-slider {
609
- --el-slider-height: 4px !important;
610
- --el-slider-button-size: 16px !important;
611
- --el-slider-button-wrapper-offset: -16px !important;
970
+ .shape-property-row {
971
+ display: flex;
972
+ align-items: center;
973
+ justify-content: space-between;
974
+ height: 32px;
975
+ padding: 0;
976
+ gap: 8px;
612
977
 
613
- :deep(.show-input) {
614
- margin-right: 16px;
978
+ ::v-deep(.el-input__wrapper) {
979
+ height: 32px !important;
980
+ display: flex;
981
+ align-items: center;
982
+ background: #f8f9fa;
983
+ border-radius: 6px;
984
+ padding: 0 8px;
985
+ box-sizing: border-box;
986
+ box-shadow: none !important;
615
987
  }
988
+ }
616
989
 
617
- :deep(.el-input-number) {
618
- width: 48px;
619
- height: 30px;
620
-
621
- .el-input__wrapper {
622
- padding: 4px;
623
- background: #F5F6F7;
624
- border: none;
625
- border-radius: 4px;
626
- box-shadow: none;
627
- }
628
-
629
- .el-input__inner {
630
- text-align: center;
631
- font-size: 12px;
632
- color: var(--text-primary);
633
- }
634
- }
990
+ .shape-property-label {
991
+ font-size: 12px;
992
+ color: #64748b;
993
+ width: 80px;
994
+ flex-shrink: 0;
995
+ text-align: left;
635
996
  }
636
997
 
637
998
  :deep(.custom-select) {
638
999
  .el-select__wrapper {
639
- background-color: #F5F6F7 !important;
640
- border: none !important;
641
- border-radius: 4px !important;
1000
+ background-color: #f8f9fa !important;
1001
+ border: 1px solid #edf0f3 !important;
1002
+ border-radius: 8px !important;
642
1003
  box-shadow: none !important;
643
1004
  height: 32px !important;
644
1005
  min-height: 32px !important;
@@ -646,51 +1007,169 @@ function onShapeGradientCommit(config: any, css: string) {
646
1007
  padding: 0 10px !important;
647
1008
 
648
1009
  &.is-focused {
649
- box-shadow: 0 0 0 1px var(--accent-primary, #6366f1) inset !important;
1010
+ border-color: #2563eb !important;
1011
+ box-shadow: 0 0 0 1px #2563eb inset !important;
650
1012
  }
651
1013
  }
652
1014
 
653
1015
  .el-select__selected-item {
654
1016
  font-size: 12px !important;
655
- color: var(--text-primary, #1e293b) !important;
1017
+ color: #1e293b !important;
656
1018
  }
657
1019
  }
658
1020
 
659
- :deep(.el-switch__core) {
660
- border-radius: 4px !important;
661
- }
1021
+ :deep(.el-switch) {
1022
+ --el-switch-on-color: #1E6FFF !important;
1023
+ --el-switch-off-color: #cbd5e1 !important;
662
1024
 
663
- :deep(.el-switch__action) {
664
- border-radius: 3px !important;
665
- }
1025
+ .el-switch__core {
1026
+ border-radius: 12px !important;
1027
+ height: 20px !important;
1028
+ min-width: 36px !important;
1029
+ }
666
1030
 
667
- :deep(.color-span-box) {
668
- width: 100%;
1031
+ .el-switch__action {
1032
+ width: 16px !important;
1033
+ height: 16px !important;
1034
+ border-radius: 50% !important;
1035
+ }
1036
+
1037
+ &.is-checked .el-switch__core .el-switch__action {
1038
+ left: calc(100% - 17px) !important;
1039
+ }
669
1040
  }
670
1041
 
671
1042
  .group-action-btn {
672
1043
  height: 32px;
673
1044
  border-radius: 6px;
674
- border: 1px solid var(--border-color, #e2e8f0);
1045
+ border: 1px solid #e2e8f0;
675
1046
  background: #ffffff;
676
1047
  display: flex;
677
1048
  align-items: center;
678
1049
  justify-content: center;
679
1050
  gap: 6px;
680
1051
  font-size: 12px;
681
- color: var(--text-primary, #1e293b);
1052
+ color: #1e293b;
682
1053
  cursor: pointer;
683
1054
  transition: all 0.15s ease;
1055
+
1056
+ &:hover:not(:disabled) {
1057
+ background: #f1f5f9;
1058
+ color: #2563eb;
1059
+ border-color: #2563eb;
1060
+ }
1061
+
1062
+ &:disabled {
1063
+ opacity: 0.4;
1064
+ cursor: not-allowed;
1065
+ }
1066
+ }
1067
+
1068
+ .image-fill-section {
1069
+ display: flex;
1070
+ flex-direction: column;
1071
+ gap: 8px;
684
1072
  }
685
1073
 
686
- .group-action-btn:hover:not(:disabled) {
687
- background: var(--bg-hover, #f1f5f9);
688
- color: var(--accent-primary, #d84b39);
689
- border-color: var(--accent-primary, #d84b39);
1074
+ .image-fill-upload-card {
1075
+ width: 100%;
1076
+ height: 64px;
1077
+ background: #f8f9fa;
1078
+ border: 1px dashed #cbd5e1;
1079
+ border-radius: 8px;
1080
+ display: flex;
1081
+ flex-direction: column;
1082
+ align-items: center;
1083
+ justify-content: center;
1084
+ gap: 6px;
1085
+ cursor: pointer;
1086
+ color: #64748b;
1087
+ transition: all 0.15s ease;
1088
+
1089
+ &:hover {
1090
+ background: #f1f5f9;
1091
+ border-color: #1E6FFF;
1092
+ color: #1E6FFF;
1093
+ }
1094
+
1095
+ .upload-tip-text {
1096
+ font-size: 12px;
1097
+ user-select: none;
1098
+ }
690
1099
  }
691
1100
 
692
- .group-action-btn:disabled {
693
- opacity: 0.4;
694
- cursor: not-allowed;
1101
+ .image-fill-preview-card {
1102
+ display: flex;
1103
+ align-items: center;
1104
+ justify-content: space-between;
1105
+ padding: 8px 10px;
1106
+ background: #f8f9fa;
1107
+ border: 1px solid #edf0f3;
1108
+ border-radius: 8px;
1109
+ box-sizing: border-box;
1110
+ }
1111
+
1112
+ .image-fill-thumb {
1113
+ width: 48px;
1114
+ height: 48px;
1115
+ border-radius: 6px;
1116
+ background-size: cover;
1117
+ background-position: center;
1118
+ background-repeat: no-repeat;
1119
+ border: 1px solid #e2e8f0;
1120
+ }
1121
+
1122
+ .image-fill-btn-group {
1123
+ display: flex;
1124
+ gap: 8px;
1125
+ }
1126
+
1127
+ .image-fill-sub-btn {
1128
+ padding: 4px 10px;
1129
+ font-size: 12px;
1130
+ border-radius: 6px;
1131
+ cursor: pointer;
1132
+ background: #ffffff;
1133
+ border: 1px solid #e2e8f0;
1134
+ color: #334155;
1135
+ transition: all 0.15s ease;
1136
+
1137
+ &:hover {
1138
+ background: #f8fafc;
1139
+ border-color: #cbd5e1;
1140
+ }
1141
+
1142
+ &.danger {
1143
+ color: #ef4444;
1144
+ border-color: #fecaca;
1145
+ &:hover {
1146
+ background: #fef2f2;
1147
+ border-color: #fca5a5;
1148
+ }
1149
+ }
1150
+ }
1151
+
1152
+ .pattern-presets-grid {
1153
+ display: grid;
1154
+ grid-template-columns: repeat(4, 1fr);
1155
+ gap: 8px;
1156
+ }
1157
+
1158
+ .pattern-preset-card {
1159
+ height: 38px;
1160
+ border-radius: 6px;
1161
+ border: 1px solid #e2e8f0;
1162
+ background-repeat: repeat;
1163
+ cursor: pointer;
1164
+ transition: all 0.15s ease;
1165
+
1166
+ &:hover {
1167
+ border-color: #94a3b8;
1168
+ }
1169
+
1170
+ &.active {
1171
+ border-color: #1E6FFF;
1172
+ box-shadow: 0 0 0 1px #1E6FFF;
1173
+ }
695
1174
  }
696
1175
  </style>