jvs-ppt-ui 0.0.34 → 0.0.36

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.
@@ -292,6 +292,7 @@ watch(selectedElementId, (newId) => {
292
292
 
293
293
 
294
294
  const {
295
+ chartActiveTab,
295
296
  chartDataDialogVisible,
296
297
  tempChartDataText,
297
298
  tempChartLabels,
@@ -1400,6 +1401,30 @@ function handleUndockToPopover() {
1400
1401
  </div>
1401
1402
  </div>
1402
1403
 
1404
+ <!-- Sub tabs for Chart: 图表 vs 数据 -->
1405
+ <div
1406
+ v-if="activeTab === 'format' && selectedElement && selectedElementIds.length <= 1 && selectedElement.type === 'chart'"
1407
+ style="display: flex; height: 38px; border-bottom: 1px solid #edf0f3; padding: 0 16px; align-items: center; gap: 24px; background: #ffffff;">
1408
+ <div
1409
+ style="font-size: 13px; font-weight: 600; cursor: pointer; height: 100%; display: flex; align-items: center; position: relative; transition: color 0.15s ease;"
1410
+ :style="chartActiveTab === 'chart' ? { color: '#2563eb' } : { color: '#64748b' }"
1411
+ @click="chartActiveTab = 'chart'">
1412
+ 图表
1413
+ <div v-if="chartActiveTab === 'chart'"
1414
+ style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #2563eb; border-radius: 2px 2px 0 0;">
1415
+ </div>
1416
+ </div>
1417
+ <div
1418
+ style="font-size: 13px; font-weight: 600; cursor: pointer; height: 100%; display: flex; align-items: center; position: relative; transition: color 0.15s ease;"
1419
+ :style="chartActiveTab === 'data' ? { color: '#2563eb' } : { color: '#64748b' }"
1420
+ @click="chartActiveTab = 'data'">
1421
+ 数据
1422
+ <div v-if="chartActiveTab === 'data'"
1423
+ style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #2563eb; border-radius: 2px 2px 0 0;">
1424
+ </div>
1425
+ </div>
1426
+ </div>
1427
+
1403
1428
  <!-- Sub tabs for Slide Design/Format: Global vs Theme vs Layout -->
1404
1429
  <div v-if="activeTab === 'design' && !isMasterEditingView"
1405
1430
  style="display: flex; height: 38px; border-bottom: 1px solid var(--border-color); padding: 0 16px; align-items: center; gap: 20px; background: var(--bg-surface);">
@@ -1774,6 +1799,18 @@ function handleUndockToPopover() {
1774
1799
  @update:shape-pattern-bg="shapePatternBg = $event"
1775
1800
  @handle-shape-pattern-upload="handleShapePatternUpload"
1776
1801
  @clear-shape-pattern-fill="clearShapePatternFill"
1802
+ :chart-active-tab="chartActiveTab"
1803
+ v-model:labels="tempChartLabels"
1804
+ v-model:datasets="tempChartDatasets"
1805
+ v-model:csv-text="tempChartDataText"
1806
+ v-model:edit-mode="chartEditMode"
1807
+ @add-row="addChartRow"
1808
+ @remove-row="removeChartRow"
1809
+ @add-series="addChartSeries"
1810
+ @remove-series="removeChartSeries"
1811
+ @transpose="transposeChartData"
1812
+ @sync-from-table="syncStructuredToText"
1813
+ @sync-from-csv="syncTextToStructured"
1777
1814
  @update:border-alpha="borderAlpha = $event"
1778
1815
  @update:shadow-alpha="shadowAlpha = $event"
1779
1816
  @update:is-border-enabled="enableBorder = $event"
@@ -2219,8 +2256,9 @@ function handleUndockToPopover() {
2219
2256
 
2220
2257
 
2221
2258
 
2222
- <!-- Chart Data Editor Dialog (方案二:左表右图双栏实时预览版) -->
2259
+ <!-- Chart Data Editor Dialog (已抽离为右侧栏「编辑数据」独立 Tab,此处弹窗隐藏保留不调用) -->
2223
2260
  <ChartDataEditorDialog
2261
+ v-if="false"
2224
2262
  v-model:visible="chartDataDialogVisible"
2225
2263
  v-model:labels="tempChartLabels"
2226
2264
  v-model:datasets="tempChartDatasets"
@@ -43,6 +43,10 @@ watch(targetHtml, () => {
43
43
  syncContentToDom()
44
44
  })
45
45
 
46
+ watch(() => props.element, () => {
47
+ syncContentToDom(true)
48
+ })
49
+
46
50
  watch(() => props.isEditingText, (editing) => {
47
51
  if (!editing) {
48
52
  syncContentToDom(true)
@@ -3,6 +3,7 @@ import { computed } from 'vue'
3
3
  import { useSlides } from '../../../composables/useSlides'
4
4
  import { SHAPE_LIST, type ShapePoolItem } from '../../../utils/shapes'
5
5
  import {
6
+ getElementPattern,
6
7
  getElementGradientConfig,
7
8
  getElementBorderGradientConfig,
8
9
  hasElementBorderGradient,
@@ -21,6 +22,7 @@ const props = defineProps<{
21
22
  }>()
22
23
 
23
24
  const { logicalWidth, logicalHeight } = useSlides()
25
+ const instanceUid = Math.random().toString(36).slice(2, 8)
24
26
 
25
27
  const flatShapePoolItems: ShapePoolItem[] = SHAPE_LIST.flatMap(c => c.children)
26
28
 
@@ -131,8 +133,12 @@ function getLayoutSvgElements(elements: any[]) {
131
133
  (typeof el.id === 'string' && (el.id.startsWith('ph_title') || el.id.startsWith('ph_body') || el.id.startsWith('ph_subtitle') || el.id.startsWith('ph_0_') || el.id.startsWith('ph_1_') || el.id.startsWith('ph-')))
132
134
  )
133
135
  )
134
- const cleanContent = (typeof el.content === 'string') ? el.content.replace(/<[^>]*>/g, '').replace(/&nbsp;/gi, ' ').trim() : ''
135
- const cleanTextProp = (typeof el.text === 'string') ? el.text.trim() : (el.text?.content ? String(el.text.content).replace(/<[^>]*>/g, '').trim() : '')
136
+ const cleanContent = (el.type !== 'shape' && typeof el.content === 'string')
137
+ ? el.content.replace(/<[^>]*>/g, '').replace(/&nbsp;/gi, ' ').trim()
138
+ : ''
139
+ const cleanTextProp = (typeof el.text === 'string')
140
+ ? el.text.replace(/<[^>]*>/g, '').replace(/&nbsp;/gi, ' ').trim()
141
+ : (el.text?.content ? String(el.text.content).replace(/<[^>]*>/g, '').replace(/&nbsp;/gi, ' ').trim() : '')
136
142
  const phPrompt = el.placeholder?.prompt || (el.placeholder?.type === 'title' ? '单击此处编辑母版标题样式' : (el.placeholder?.type === 'subtitle' ? '单击此处编辑母版副标题样式' : (el.placeholder?.type === 'image' ? '单击图标添加图片' : '单击此处添加文本描述')))
137
143
 
138
144
  // 如果 content 含有真实有效文字,使用 content;如果是占位符且无自定义文字,使用占位符 prompt 提示
@@ -142,7 +148,7 @@ function getLayoutSvgElements(elements: any[]) {
142
148
  ? (typeof el.text === 'string' ? el.text : el.text.content)
143
149
  : (isPlaceholder
144
150
  ? phPrompt
145
- : (typeof el.content === 'string' ? el.content : '')))
151
+ : (el.type !== 'shape' && typeof el.content === 'string' ? el.content : '')))
146
152
 
147
153
  const writingMode = el.style?.writingMode || el.writingMode || ''
148
154
  const isVertical = Boolean(
@@ -152,11 +158,16 @@ function getLayoutSvgElements(elements: any[]) {
152
158
  rawContentStr.includes('writing-mode:vertical')
153
159
  )
154
160
 
161
+ const fontSize = parseFloat(el.style?.fontSize || el.fontSize || (isPlaceholder ? (el.placeholder?.type === 'title' ? '28' : '16') : '16')) || 16
162
+
155
163
  const defaultWidthFallback = isVertical ? ((60 / baseW) * 100) : 0
164
+ const defaultHeightFallback = ((fontSize * 1.25) / baseH) * 100
165
+ const rawWVal = (el.style?.width && el.style.width !== 'auto') ? el.style.width : el.width
166
+ const rawHVal = (el.style?.height && el.style.height !== 'auto') ? el.style.height : (el.height && el.height !== 'auto' ? el.height : undefined)
156
167
  const rawLeft = parseDimValue(el.style?.left ?? el.left, baseW)
157
168
  const rawTop = parseDimValue(el.style?.top ?? el.top, baseH)
158
- const rawWidth = parseDimValue(el.style?.width ?? el.width, baseW, defaultWidthFallback)
159
- const rawHeight = parseDimValue(el.style?.height ?? el.height ?? 50, baseH)
169
+ const rawWidth = parseDimValue(rawWVal, baseW, defaultWidthFallback)
170
+ const rawHeight = parseDimValue(rawHVal, baseH, defaultHeightFallback)
160
171
 
161
172
  const leftPct = parentLeftPct + (rawLeft * parentWidthPct / 100)
162
173
  const topPct = parentTopPct + (rawTop * parentHeightPct / 100)
@@ -179,12 +190,12 @@ function getLayoutSvgElements(elements: any[]) {
179
190
  ? `translate(${cx}, ${cy}) rotate(${rotate}) scale(${flipH ? -1 : 1}, ${flipV ? -1 : 1}) translate(${-cx}, ${-cy})`
180
191
  : undefined
181
192
 
182
- const fontSize = parseFloat(el.style?.fontSize || el.fontSize || (isPlaceholder ? (el.placeholder?.type === 'title' ? '28' : '16') : '16')) || 16
183
-
184
193
  // 缩略图字体按画布宽高真实几何比例计算,配合微缩优化保持和谐可辨识
185
194
  const baseRatio = 100 / baseW
186
195
  const rawSvgSize = fontSize * baseRatio
187
- const svgFontSize = +(Math.max(1.8, Math.min(4.5, rawSvgSize * 1.15))).toFixed(2)
196
+ const svgFontSize = isPlaceholder
197
+ ? +(Math.max(1.8, Math.min(4.5, rawSvgSize * 1.15))).toFixed(2)
198
+ : +(Math.max(1.4, Math.min(14, rawSvgSize))).toFixed(2)
188
199
 
189
200
  const rawSegments: { text: string; indent: number }[] = []
190
201
  if (rawContentStr) {
@@ -217,19 +228,19 @@ function getLayoutSvgElements(elements: any[]) {
217
228
  const availableW = Math.max(0.5, w - (isPlaceholder ? 0.6 : 0.4))
218
229
  const maxWeight = Math.max(1, availableW / (svgFontSize * 0.9))
219
230
  const canMultiLine = h >= svgFontSize * 1.6
220
- const maxLines = Math.max(1, Math.min(6, Math.floor(h / (svgFontSize * 1.2))))
231
+ const maxLines = Math.min(6, Math.max(rawSegments.length || 1, Math.floor(h / (svgFontSize * 1.1))))
221
232
 
222
- rawSegments.forEach(({ text, indent }) => {
223
- if (!isVertical && canMultiLine && text.length > maxWeight) {
233
+ rawSegments.forEach(({ text, indent }, segIdx) => {
234
+ if (!isVertical && canMultiLine && text.length > maxWeight && parsedTextLines.length + (rawSegments.length - segIdx) < maxLines) {
224
235
  let curLine = ''
225
236
  let curW = 0
226
237
  for (let i = 0; i < text.length; i++) {
227
238
  const ch = text[i]
228
239
  const isFull = /[\u4e00-\u9fa5\u3000-\u303f\uff01-\uff5e]/.test(ch)
229
240
  const weight = isFull ? 1.0 : 0.55
230
- if (curW + weight > maxWeight && curLine.length > 0) {
241
+ const canWrapMore = parsedTextLines.length + (rawSegments.length - segIdx) < maxLines
242
+ if (canWrapMore && curW + weight > maxWeight && curLine.length > 0) {
231
243
  parsedTextLines.push({ text: curLine, indent })
232
- if (parsedTextLines.length >= maxLines) break
233
244
  curLine = ch
234
245
  curW = weight
235
246
  } else {
@@ -240,27 +251,30 @@ function getLayoutSvgElements(elements: any[]) {
240
251
  if (curLine && parsedTextLines.length < maxLines) {
241
252
  parsedTextLines.push({ text: curLine, indent })
242
253
  }
243
- } else {
254
+ } else if (parsedTextLines.length < maxLines) {
244
255
  parsedTextLines.push({ text, indent })
245
256
  }
246
257
  })
247
258
 
248
259
  const cleanText = parsedTextLines.length > 0 ? parsedTextLines[0].text : ''
249
- const lineHeight = +(svgFontSize * 1.25).toFixed(2)
260
+ const lineHeight = +(svgFontSize * (fontSize >= 72 ? 1.05 : 1.25)).toFixed(2)
250
261
  const lineCount = Math.min(parsedTextLines.length, 6)
251
262
  const totalTextH = lineCount * lineHeight
252
- let textStartY = +(y + svgFontSize * 1.05).toFixed(2)
253
- if (h > totalTextH && (el.style?.verticalAlign !== 'top' && el.style?.verticalAlign !== 'up')) {
254
- // 垂直居中起始 y 坐标
255
- textStartY = +(y + (h - totalTextH) / 2 + svgFontSize * 0.85).toFixed(2)
263
+ const vAlign = el.verticalAlign || el.style?.verticalAlign || 'top'
264
+ let textStartY = +(y + svgFontSize * 0.95).toFixed(2)
265
+ if (h > totalTextH) {
266
+ if (vAlign === 'bottom' || vAlign === 'down') {
267
+ textStartY = +(y + h - totalTextH + svgFontSize * 0.85).toFixed(2)
268
+ } else if (vAlign !== 'top' && vAlign !== 'up') {
269
+ // 垂直居中起始 y 坐标
270
+ textStartY = +(y + (h - totalTextH) / 2 + svgFontSize * 0.85).toFixed(2)
271
+ }
256
272
  }
257
273
 
258
274
  const isTitle = el.type === 'text' && (el.name?.includes('标题') || el.placeholder?.type === 'title' || fontSize >= 24)
259
275
  const isText = el.type === 'text'
260
276
 
261
- const color = isPlaceholder
262
- ? (isTitle ? '#0f172a' : '#64748b')
263
- : parseColorString(el.style?.color || el.color, isTitle ? '#0f172a' : '#334155')
277
+ const color = parseColorString(el.style?.color || el.color, isPlaceholder ? (isTitle ? '#0f172a' : '#64748b') : (isTitle ? '#0f172a' : '#334155'))
264
278
  const rawFillVal = (el.style && el.style.fill !== undefined) ? el.style.fill : el.fill
265
279
  let fill = 'none'
266
280
  if (rawFillVal !== undefined && rawFillVal !== null) {
@@ -277,10 +291,16 @@ function getLayoutSvgElements(elements: any[]) {
277
291
  }
278
292
 
279
293
  const borderStyle = el.style?.borderStyle || el.borderStyle || 'none'
280
- const borderWidth = getElementBorderWidth(el) || (el.style?.borderWidth ? parseFloat(el.style.borderWidth) : (el.borderWidth ? parseFloat(el.borderWidth) : 0))
281
- const hasBorderGrad = hasElementBorderGradient(el)
294
+ const borderWidth = el.style?.enableBorder === false ? 0 : getElementBorderWidth(el)
295
+ const hasBorderGrad = el.style?.enableBorder === false ? false : hasElementBorderGradient(el)
282
296
  const borderColor = (!hasBorderGrad && borderWidth <= 0) ? 'none' : (getElementBorderColor(el) || parseColorString(el.style?.borderColor || el.borderColor, 'none'))
283
- const textAlign = el.style?.textAlign || el.textAlign || (isTitle && !isVertical ? 'center' : 'left')
297
+ const rawOpacity = el.style?.opacity !== undefined ? parseFloat(el.style.opacity) : (el.opacity !== undefined ? parseFloat(el.opacity) : 1)
298
+ const opacity = isNaN(rawOpacity) ? 1 : rawOpacity
299
+ 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')))
301
+ const pattern = getElementPattern(el)
302
+ const rawBr = parseFloat(el.style?.borderRadius || el.borderRadius || 0) || 0
303
+ const rx = rawBr > 0 ? +((rawBr / baseW) * 100).toFixed(2) : (el.type === 'shape' ? 0.8 : 0)
284
304
 
285
305
  let shapePath = ''
286
306
  let shapeViewBox: [number, number] = [200, 200]
@@ -326,8 +346,11 @@ function getLayoutSvgElements(elements: any[]) {
326
346
 
327
347
  let linePath = ''
328
348
  let lineColor = '#475569'
329
- let strokeWidth = 0.8
349
+ let strokeWidth = +(1.5 * baseRatio).toFixed(2)
330
350
  let strokeDashArray: string | undefined = undefined
351
+ const svgBorderWidth = (hasBorderGrad || borderWidth > 0)
352
+ ? Math.max(0.12, +((borderWidth || 1) * baseRatio).toFixed(2))
353
+ : 0
331
354
 
332
355
  if (el.type === 'line') {
333
356
  lineColor = parseColorString(
@@ -335,11 +358,11 @@ function getLayoutSvgElements(elements: any[]) {
335
358
  '#334155'
336
359
  )
337
360
  const rawStrokeWidth = parseFloat(el.style?.strokeWidth || el.strokeWidth || el.style?.borderWidth || el.borderWidth || 1) || 1
338
- strokeWidth = Math.min(2.5, Math.max(0.6, +(rawStrokeWidth * 0.8).toFixed(2)))
361
+ strokeWidth = Math.max(0.12, +(rawStrokeWidth * baseRatio).toFixed(2))
339
362
  if (el.lineStyle === 'dashed' || el.style?.borderStyle === 'dashed' || (el as any).borderType === 'dashed') {
340
- strokeDashArray = '2 1.5'
363
+ strokeDashArray = `${+(strokeWidth * 4).toFixed(2)} ${+(strokeWidth * 3).toFixed(2)}`
341
364
  } else if (el.lineStyle === 'dotted' || el.style?.borderStyle === 'dotted' || (el as any).borderType === 'dotted') {
342
- strokeDashArray = '0.8 1'
365
+ strokeDashArray = `${strokeWidth} ${+(strokeWidth * 2).toFixed(2)}`
343
366
  }
344
367
 
345
368
  const rawPath = getLineElementRenderPath(el) || getLineElementPath(el) || ''
@@ -359,6 +382,8 @@ function getLayoutSvgElements(elements: any[]) {
359
382
  return {
360
383
  id: el.id,
361
384
  rawEl: el,
385
+ pattern,
386
+ rx,
362
387
  gradient,
363
388
  borderGradient,
364
389
  isCircle,
@@ -380,9 +405,11 @@ function getLayoutSvgElements(elements: any[]) {
380
405
  yCenter: +(y + h * 0.5).toFixed(2),
381
406
  color,
382
407
  fill,
408
+ opacity,
383
409
  borderColor,
384
410
  borderStyle,
385
411
  borderWidth,
412
+ svgBorderWidth,
386
413
  isPlaceholder,
387
414
  textAlign,
388
415
  svgFontSize,
@@ -425,11 +452,24 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
425
452
  <template>
426
453
  <svg :viewBox="`0 0 100 ${thumbSvgHeight}`" preserveAspectRatio="none" class="layout-svg" :style="{ width: '100%', height: '100%', display: 'block', background: getSlideBackgroundCss(background || '#ffffff') }">
427
454
  <defs>
428
- <template v-for="item in svgItems" :key="`layout-grad-${item.id}`">
455
+ <template v-for="item in svgItems" :key="`layout-defs-${item.id}`">
456
+ <pattern
457
+ v-if="item.pattern"
458
+ :id="`layout-pat-${instanceUid}-${item.id}`"
459
+ width="100%"
460
+ height="100%"
461
+ patternUnits="objectBoundingBox"
462
+ patternContentUnits="objectBoundingBox"
463
+ >
464
+ <image :href="item.pattern" width="1" height="1" preserveAspectRatio="none" />
465
+ </pattern>
466
+ <clipPath v-if="item.isImage && item.imageSrc && item.rx > 0" :id="`layout-img-clip-${instanceUid}-${item.id}`">
467
+ <rect :x="item.x" :y="item.y" :width="item.w" :height="item.h" :rx="item.rx" />
468
+ </clipPath>
429
469
  <template v-if="item.gradient">
430
470
  <radialGradient
431
471
  v-if="item.gradient.path && item.gradient.path !== 'line'"
432
- :id="`layout-grad-${item.id}`"
472
+ :id="`layout-grad-${instanceUid}-${item.id}`"
433
473
  :cx="`${item.gradient.center ? Math.round(item.gradient.center.x * 100) : 50}%`"
434
474
  :cy="`${item.gradient.center ? Math.round(item.gradient.center.y * 100) : 50}%`"
435
475
  :r="item.gradient.path === 'rect' ? '60%' : (item.gradient.path === 'shape' || item.gradient.path === 'path' ? '70%' : '50%')"
@@ -446,7 +486,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
446
486
  </radialGradient>
447
487
  <linearGradient
448
488
  v-else
449
- :id="`layout-grad-${item.id}`"
489
+ :id="`layout-grad-${instanceUid}-${item.id}`"
450
490
  :x1="getSvgGradientCoords(item.rawEl).x1"
451
491
  :y1="getSvgGradientCoords(item.rawEl).y1"
452
492
  :x2="getSvgGradientCoords(item.rawEl).x2"
@@ -464,7 +504,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
464
504
  <template v-if="item.borderGradient">
465
505
  <radialGradient
466
506
  v-if="item.borderGradient.path && item.borderGradient.path !== 'line'"
467
- :id="`layout-bgrad-${item.id}`"
507
+ :id="`layout-bgrad-${instanceUid}-${item.id}`"
468
508
  :cx="`${item.borderGradient.center ? Math.round(item.borderGradient.center.x * 100) : 50}%`"
469
509
  :cy="`${item.borderGradient.center ? Math.round(item.borderGradient.center.y * 100) : 50}%`"
470
510
  :r="item.borderGradient.path === 'rect' ? '60%' : (item.borderGradient.path === 'shape' || item.borderGradient.path === 'path' ? '70%' : '50%')"
@@ -481,7 +521,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
481
521
  </radialGradient>
482
522
  <linearGradient
483
523
  v-else
484
- :id="`layout-bgrad-${item.id}`"
524
+ :id="`layout-bgrad-${instanceUid}-${item.id}`"
485
525
  :x1="getSvgGradientCoords(item.borderGradient).x1"
486
526
  :y1="getSvgGradientCoords(item.borderGradient).y1"
487
527
  :x2="getSvgGradientCoords(item.borderGradient).x2"
@@ -500,12 +540,12 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
500
540
  </defs>
501
541
  <template v-if="svgItems && svgItems.length > 0">
502
542
  <template v-for="item in svgItems" :key="item.id">
503
- <g v-if="item.isImage && item.imageSrc" :transform="item.transform">
543
+ <g v-if="item.isImage && item.imageSrc" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined" :clip-path="item.rx > 0 ? `url(#layout-img-clip-${instanceUid}-${item.id})` : undefined">
504
544
  <svg :x="item.x" :y="item.y" :width="item.w" :height="item.h" :viewBox="item.clipViewBox || '0 0 100 100'" preserveAspectRatio="none" style="overflow: hidden;">
505
545
  <image :href="item.imageSrc" x="0" y="0" width="100" height="100" preserveAspectRatio="none" />
506
546
  </svg>
507
547
  </g>
508
- <g v-else-if="item.isImagePlaceholder" :transform="item.transform">
548
+ <g v-else-if="item.isImagePlaceholder" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined">
509
549
  <rect :x="item.x" :y="item.y" :width="item.w" :height="item.h" fill="#d9dde3" rx="1.2" />
510
550
  <svg :x="item.cx - 2.2" :y="item.cy - 2.2" width="4.4" height="4.4" viewBox="0 0 24 24" fill="none">
511
551
  <rect x="3" y="3" width="18" height="18" rx="2" stroke="#475569" stroke-width="2" />
@@ -513,28 +553,61 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
513
553
  <path d="M21 15l-5-5L5 21" stroke="#475569" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
514
554
  </svg>
515
555
  </g>
516
- <g v-else-if="item.type === 'shape' && item.shapePath" :transform="item.transform">
556
+ <g v-else-if="item.type === 'shape' && item.shapePath" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined">
517
557
  <svg :x="item.x" :y="item.y" :width="item.w" :height="item.h" :viewBox="`0 0 ${item.shapeViewBox ? item.shapeViewBox[0] : 200} ${item.shapeViewBox ? item.shapeViewBox[1] : 200}`" preserveAspectRatio="none" style="overflow: visible;">
518
- <path :d="item.shapePath" :fill="item.gradient ? `url(#layout-grad-${item.id})` : (item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getHexColorWithoutAlpha(item.fill) : 'none')" :fill-opacity="!item.gradient && item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getAlphaFromColor(item.fill) : undefined" :stroke="item.borderGradient ? `url(#layout-bgrad-${item.id})` : (item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getHexColorWithoutAlpha(item.borderColor) : 'none')" :stroke-opacity="!item.borderGradient && item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getAlphaFromColor(item.borderColor) : undefined" :stroke-width="(item.borderGradient || item.borderWidth > 0) ? Math.min(1.5, Math.max(0.6, (item.borderWidth || 1) * 0.8)) : 0" :stroke-linecap="item.lineCap" vector-effect="non-scaling-stroke" />
558
+ <path :d="item.shapePath" :fill="item.pattern ? `url(#layout-pat-${instanceUid}-${item.id})` : (item.gradient ? `url(#layout-grad-${instanceUid}-${item.id})` : (item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getHexColorWithoutAlpha(item.fill) : 'none'))" :fill-opacity="!item.pattern && !item.gradient && item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getAlphaFromColor(item.fill) : undefined" :stroke="item.borderGradient ? `url(#layout-bgrad-${instanceUid}-${item.id})` : (item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getHexColorWithoutAlpha(item.borderColor) : 'none')" :stroke-opacity="!item.borderGradient && item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getAlphaFromColor(item.borderColor) : undefined" :stroke-width="(item.borderGradient || item.borderWidth > 0) ? Math.max(0.5, +((item.borderWidth || 1) * 0.25).toFixed(2)) : 0" :stroke-linecap="item.lineCap" vector-effect="non-scaling-stroke" />
519
559
  </svg>
560
+ <text
561
+ v-if="item.cleanText"
562
+ :x="item.x + item.w * 0.5"
563
+ :y="item.y + item.h * 0.5 + item.svgFontSize * 0.35"
564
+ text-anchor="middle"
565
+ :fill="item.color || '#ffffff'"
566
+ :font-size="item.svgFontSize"
567
+ font-family="sans-serif"
568
+ font-weight="bold"
569
+ style="pointer-events: none; user-select: none;"
570
+ >{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
520
571
  </g>
521
- <g v-else-if="item.type === 'shape' && item.isCircle" :transform="item.transform">
572
+ <g v-else-if="item.type === 'shape' && item.isCircle" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined">
522
573
  <ellipse
523
574
  :cx="item.x + item.w / 2"
524
575
  :cy="item.y + item.h / 2"
525
576
  :rx="item.w / 2"
526
577
  :ry="item.h / 2"
527
- :fill="item.gradient ? `url(#layout-grad-${item.id})` : (item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getHexColorWithoutAlpha(item.fill) : 'none')"
528
- :fill-opacity="!item.gradient && item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getAlphaFromColor(item.fill) : undefined"
529
- :stroke="item.borderGradient ? `url(#layout-bgrad-${item.id})` : (item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getHexColorWithoutAlpha(item.borderColor) : 'none')"
578
+ :fill="item.pattern ? `url(#layout-pat-${instanceUid}-${item.id})` : (item.gradient ? `url(#layout-grad-${instanceUid}-${item.id})` : (item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getHexColorWithoutAlpha(item.fill) : 'none'))"
579
+ :fill-opacity="!item.pattern && !item.gradient && item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getAlphaFromColor(item.fill) : undefined"
580
+ :stroke="item.borderGradient ? `url(#layout-bgrad-${instanceUid}-${item.id})` : (item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getHexColorWithoutAlpha(item.borderColor) : 'none')"
530
581
  :stroke-opacity="!item.borderGradient && item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getAlphaFromColor(item.borderColor) : undefined"
531
- :stroke-width="(item.borderGradient || item.borderWidth > 0) ? Math.min(1.5, Math.max(0.6, (item.borderWidth || 1) * 0.8)) : 0"
582
+ :stroke-width="item.svgBorderWidth"
532
583
  />
584
+ <text
585
+ v-if="item.cleanText"
586
+ :x="item.x + item.w * 0.5"
587
+ :y="item.y + item.h * 0.5 + item.svgFontSize * 0.35"
588
+ text-anchor="middle"
589
+ :fill="item.color || '#ffffff'"
590
+ :font-size="item.svgFontSize"
591
+ font-family="sans-serif"
592
+ font-weight="bold"
593
+ style="pointer-events: none; user-select: none;"
594
+ >{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
533
595
  </g>
534
- <g v-else-if="item.type === 'shape'" :transform="item.transform">
535
- <rect :x="item.x" :y="item.y" :width="item.w" :height="item.h" :fill="item.gradient ? `url(#layout-grad-${item.id})` : (item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getHexColorWithoutAlpha(item.fill) : 'none')" :fill-opacity="!item.gradient && item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getAlphaFromColor(item.fill) : undefined" :stroke="item.borderGradient ? `url(#layout-bgrad-${item.id})` : (item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getHexColorWithoutAlpha(item.borderColor) : 'none')" :stroke-opacity="!item.borderGradient && item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getAlphaFromColor(item.borderColor) : undefined" :stroke-width="(item.borderGradient || item.borderWidth > 0) ? Math.min(1.5, Math.max(0.6, (item.borderWidth || 1) * 0.8)) : 0" rx="1" />
596
+ <g v-else-if="item.type === 'shape'" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined">
597
+ <rect :x="item.x" :y="item.y" :width="item.w" :height="item.h" :fill="item.pattern ? `url(#layout-pat-${instanceUid}-${item.id})` : (item.gradient ? `url(#layout-grad-${instanceUid}-${item.id})` : (item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getHexColorWithoutAlpha(item.fill) : 'none'))" :fill-opacity="!item.pattern && !item.gradient && item.fill && item.fill !== 'transparent' && item.fill !== 'none' ? getAlphaFromColor(item.fill) : undefined" :stroke="item.borderGradient ? `url(#layout-bgrad-${instanceUid}-${item.id})` : (item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getHexColorWithoutAlpha(item.borderColor) : 'none')" :stroke-opacity="!item.borderGradient && item.borderWidth > 0 && item.borderColor && item.borderColor !== 'transparent' && item.borderColor !== 'none' ? getAlphaFromColor(item.borderColor) : undefined" :stroke-width="item.svgBorderWidth" :rx="item.rx" />
598
+ <text
599
+ v-if="item.cleanText"
600
+ :x="item.x + item.w * 0.5"
601
+ :y="item.y + item.h * 0.5 + item.svgFontSize * 0.35"
602
+ text-anchor="middle"
603
+ :fill="item.color || '#ffffff'"
604
+ :font-size="item.svgFontSize"
605
+ font-family="sans-serif"
606
+ font-weight="bold"
607
+ style="pointer-events: none; user-select: none;"
608
+ >{{ item.cleanText.length > 20 ? item.cleanText.substring(0, 20) + '...' : item.cleanText }}</text>
536
609
  </g>
537
- <g v-else-if="item.type === 'title' || item.type === 'text'" :transform="item.transform">
610
+ <g v-else-if="item.type === 'title' || item.type === 'text'" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined">
538
611
  <rect
539
612
  v-if="item.isPlaceholder || (item.fill && item.fill !== 'none' && item.fill !== 'transparent') || (!item.isPlaceholder && item.borderColor && item.borderColor !== 'none' && item.borderColor !== 'transparent' && item.borderWidth && Number(item.borderWidth) > 0)"
540
613
  :x="item.x"
@@ -542,8 +615,8 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
542
615
  :width="item.w"
543
616
  :height="item.h"
544
617
  :fill="item.fill && item.fill !== 'none' && item.fill !== 'transparent' ? item.fill : 'none'"
545
- :stroke="item.isPlaceholder ? '#f1f5f9' : (item.borderColor && item.borderColor !== 'none' ? item.borderColor : 'none')"
546
- :stroke-dasharray="!item.isPlaceholder && item.borderStyle === 'dashed' ? '1.5 1.5' : undefined"
618
+ :stroke="item.isPlaceholder ? (item.borderColor && item.borderColor !== 'none' ? item.borderColor : '#cbd5e1') : (item.borderColor && item.borderColor !== 'none' ? item.borderColor : 'none')"
619
+ :stroke-dasharray="item.isPlaceholder || item.borderStyle === 'dashed' ? '1.2 1.2' : undefined"
547
620
  :stroke-width="item.isPlaceholder ? '0.4' : '0.8'"
548
621
  rx="0.8"
549
622
  />
@@ -553,13 +626,13 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
553
626
  :key="lIdx"
554
627
  :x="item.isVertical
555
628
  ? (item.x + item.w * 0.5)
556
- : (item.textAlign === 'center' || item.w < 15
629
+ : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15)
557
630
  ? (item.x + item.w * 0.5)
558
631
  : (item.textAlign === 'right'
559
- ? (item.x + item.w - 1)
560
- : (item.x + (lineObj.indent || 0) * 2.5 + 1)))"
632
+ ? (item.x + item.w - (item.isPlaceholder ? 1 : 0))
633
+ : (item.x + (lineObj.indent || 0) * 2.5 + (item.isPlaceholder ? 1 : 0))))"
561
634
  :y="item.textStartY + lIdx * item.lineHeight"
562
- :text-anchor="item.isVertical ? 'middle' : (item.textAlign === 'center' || item.w < 15 ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
635
+ :text-anchor="item.isVertical ? 'middle' : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15) ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
563
636
  :fill="item.color || (item.isTitle ? '#0f172a' : '#64748b')"
564
637
  :font-size="item.svgFontSize"
565
638
  font-family="sans-serif"
@@ -571,15 +644,15 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
571
644
  <text
572
645
  :x="item.isVertical
573
646
  ? item.x + item.w * 0.5
574
- : (item.textAlign === 'center' || item.w < 15
647
+ : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15)
575
648
  ? item.x + item.w * 0.5
576
649
  : (item.textAlign === 'right'
577
- ? item.x + item.w - 1
578
- : item.x + 1))"
650
+ ? item.x + item.w - (item.isPlaceholder ? 1 : 0)
651
+ : item.x + (item.isPlaceholder ? 1 : 0)))"
579
652
  :y="item.isVertical
580
653
  ? item.y + item.svgFontSize * 1.2
581
654
  : (item.textStartY || Math.min(thumbSvgHeight - 1, item.y + item.h * 0.5 + item.svgFontSize * 0.35))"
582
- :text-anchor="item.isVertical ? 'middle' : (item.textAlign === 'center' || item.w < 15 ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
655
+ :text-anchor="item.isVertical ? 'middle' : (item.textAlign === 'center' || (item.isPlaceholder && item.w < 15) ? 'middle' : (item.textAlign === 'right' ? 'end' : 'start'))"
583
656
  :fill="item.color || (item.isTitle ? '#0f172a' : '#64748b')"
584
657
  :font-size="item.svgFontSize"
585
658
  font-family="sans-serif"
@@ -591,7 +664,7 @@ const svgItems = computed(() => getLayoutSvgElements(deduplicateElements(props.e
591
664
  <line v-else-if="!item.isPlaceholder && item.type === 'title'" :x1="item.textAlign === 'center' ? (item.x + item.w * 0.15) : item.x" :y1="item.yCenter" :x2="item.textAlign === 'center' ? (item.x + item.w * 0.85) : (item.x + item.w * 0.8)" :y2="item.yCenter" :stroke="item.color || '#3b82f6'" stroke-width="2" stroke-linecap="round" />
592
665
  <line v-else-if="!item.isPlaceholder" :x1="item.x" :y1="item.yCenter" :x2="item.x + item.w" :y2="item.yCenter" :stroke="item.color || '#64748b'" stroke-width="1.2" stroke-linecap="round" />
593
666
  </g>
594
- <g v-else-if="item.type === 'line'" :transform="item.transform">
667
+ <g v-else-if="item.type === 'line'" :transform="item.transform" :opacity="item.opacity !== undefined && item.opacity < 1 ? item.opacity : undefined">
595
668
  <g :transform="`translate(${item.x}, ${item.y})`">
596
669
  <path
597
670
  :d="item.linePath"