jvs-ppt-ui 0.0.30 → 0.0.33
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.
- package/README.md +152 -0
- package/dist/lib/jvs-ppt-ui.es.js +39270 -34665
- package/dist/lib/jvs-ppt-ui.umd.js +141 -114
- package/dist/lib/style.css +1 -1
- package/package.json +2 -1
- package/src/components/CanvasArea.vue +9 -1
- package/src/components/ChartTypeSelector.vue +69 -29
- package/src/components/Header.vue +228 -29
- package/src/components/PitchImportDialog.vue +482 -0
- package/src/components/PptEditor.vue +53 -1
- package/src/components/SidebarLeft.vue +367 -41
- package/src/components/SidebarRight.vue +75 -35
- package/src/components/StyleBuilderDialog.vue +276 -105
- package/src/components/SvgChart.vue +1242 -833
- package/src/components/canvas/elements/CanvasGroupElement.vue +16 -2
- package/src/components/canvas/elements/CanvasMediaElement.vue +5 -3
- package/src/components/canvas/elements/CanvasShapeElement.vue +6 -4
- package/src/components/sidebar/dialogs/ChartDataEditorDialog.vue +1040 -0
- package/src/components/sidebar/panels/LayoutThumbSvg.vue +9 -6
- package/src/components/sidebar/panels/SidebarChartFormatPanel.vue +1479 -641
- package/src/components/sidebar/panels/SidebarDesignPanel.vue +32 -0
- package/src/composables/presetThemes.ts +49 -1
- package/src/composables/sidebar/useSidebarChart.ts +357 -194
- package/src/composables/useSlides.ts +110 -22
- package/src/configs/slideTemplates.ts +1001 -0
- package/src/style.css +267 -4
- package/src/types/index.ts +37 -1
- package/src/utils/canvas/elementStyles.ts +55 -20
- package/src/utils/muxHlsToMp4.ts +569 -0
- package/src/utils/pitchConverter.ts +1725 -0
- package/dist/lib/templates/index.json +0 -5
|
@@ -16,6 +16,8 @@ import { inferElementTextType, type SlideTextType } from '../utils/textTypes'
|
|
|
16
16
|
import { applyGroupGeometryFlip } from '../utils/groupFlip'
|
|
17
17
|
// 快捷键弹层异步化;mock DSL 模板(~77KB)改为触发时动态加载
|
|
18
18
|
const ShortcutsDialog = defineAsyncComponent(() => import('./ShortcutsDialog.vue'))
|
|
19
|
+
const PitchImportDialog = defineAsyncComponent(() => import('./PitchImportDialog.vue'))
|
|
20
|
+
const isLocalDev = import.meta.env.DEV
|
|
19
21
|
|
|
20
22
|
const { presentationTitle, exportSlides, importSlides, currentZipMeta, startPresentation, activeIndex, slides, notify, renderLatexToSvg, globalFontFamily, globalFontColor, globalThemeColor, themeSchemeFillMap, themeClrScheme, logicalWidth, logicalHeight, dslInputDialogVisible, aiPptDialogVisible, shortcutsDialogVisible, registerPPTParser, isMasterEditingView, enterMasterView, exitMasterView, zoomRatio, resetZoom, normalizeSlideBackground, getEffectiveMasterElementsForSlide, getEffectiveSlideBackground, uploadMediaResourcesInSlides, getCustomUploadHandler, isReadonly } = useSlides()
|
|
21
23
|
import { sanitizeNbspInHtml, checkIsVertical } from '../composables/useSlides'
|
|
@@ -24,6 +26,13 @@ import { sanitizeNbspInHtml, checkIsVertical } from '../composables/useSlides'
|
|
|
24
26
|
const shortcutsOpened = ref(false)
|
|
25
27
|
watch(shortcutsDialogVisible, v => { if (v) shortcutsOpened.value = true })
|
|
26
28
|
|
|
29
|
+
const pitchDialogVisible = ref(false)
|
|
30
|
+
const pitchDialogOpened = ref(false)
|
|
31
|
+
watch(pitchDialogVisible, v => { if (v) pitchDialogOpened.value = true })
|
|
32
|
+
const triggerPitchImport = () => {
|
|
33
|
+
pitchDialogVisible.value = true
|
|
34
|
+
}
|
|
35
|
+
|
|
27
36
|
function handleZoomCommand(command: string | number) {
|
|
28
37
|
if (command === 'reset') {
|
|
29
38
|
resetZoom()
|
|
@@ -123,12 +132,15 @@ const onJSONFileChange = (e: Event) => {
|
|
|
123
132
|
await ensurePptxShapes()
|
|
124
133
|
const data = JSON.parse(event.target?.result as string)
|
|
125
134
|
if (Array.isArray(data)) {
|
|
126
|
-
|
|
135
|
+
const isPitchTransit = data[0] === '^ '
|
|
136
|
+
if (!isPitchTransit && uploadMediaResourcesInSlides) {
|
|
127
137
|
await uploadMediaResourcesInSlides(data)
|
|
128
138
|
}
|
|
129
139
|
importSlides(data)
|
|
130
|
-
|
|
131
|
-
|
|
140
|
+
if (!isPitchTransit) {
|
|
141
|
+
const nameWithoutExt = file.name.substring(0, file.name.lastIndexOf('.'))
|
|
142
|
+
presentationTitle.value = nameWithoutExt
|
|
143
|
+
}
|
|
132
144
|
} else if (data && typeof data === 'object' && Array.isArray(data.slides)) {
|
|
133
145
|
const isRawPPTX = (() => {
|
|
134
146
|
if (!data.size || !Array.isArray(data.slides)) return false
|
|
@@ -3800,6 +3812,66 @@ function parseCustGeomToPolygon(custGeomXml: string): string | null {
|
|
|
3800
3812
|
return points.length >= 3 ? points.join(', ') : null
|
|
3801
3813
|
}
|
|
3802
3814
|
|
|
3815
|
+
// 解析 OOXML 自定义几何路径 <a:custGeom> 为标准 SVG path 与 viewBox,用于母版/版式装饰自由形状(如点阵背景、圆环弧、自定义多边形)
|
|
3816
|
+
function parseCustGeomToSvgPath(
|
|
3817
|
+
custGeomXml: string,
|
|
3818
|
+
pxWidth: number,
|
|
3819
|
+
pxHeight: number,
|
|
3820
|
+
emuCx: number,
|
|
3821
|
+
emuCy: number
|
|
3822
|
+
): { path: string; viewBox: [number, number] } | null {
|
|
3823
|
+
const pathBlocks = custGeomXml.match(/<a:path\b[\s\S]*?<\/a:path>/g) || []
|
|
3824
|
+
if (pathBlocks.length === 0) return null
|
|
3825
|
+
const targetW = pxWidth > 0 ? pxWidth : 200
|
|
3826
|
+
const targetH = pxHeight > 0 ? pxHeight : 200
|
|
3827
|
+
const dParts: string[] = []
|
|
3828
|
+
|
|
3829
|
+
for (const block of pathBlocks) {
|
|
3830
|
+
const openTag = (block.match(/<a:path\b[^>]*>/) || [''])[0]
|
|
3831
|
+
const wM = openTag.match(/\bw="(\d+)"/)
|
|
3832
|
+
const hM = openTag.match(/\bh="(\d+)"/)
|
|
3833
|
+
const pathW = wM ? parseInt(wM[1], 10) : (emuCx > 0 ? emuCx : targetW)
|
|
3834
|
+
const pathH = hM ? parseInt(hM[1], 10) : (emuCy > 0 ? emuCy : targetH)
|
|
3835
|
+
if (pathW <= 0 || pathH <= 0) continue
|
|
3836
|
+
const sx = targetW / pathW
|
|
3837
|
+
const sy = targetH / pathH
|
|
3838
|
+
const fmtX = (v: number) => +(v * sx).toFixed(2)
|
|
3839
|
+
const fmtY = (v: number) => +(v * sy).toFixed(2)
|
|
3840
|
+
|
|
3841
|
+
const cmdRegex = /<a:(moveTo|lnTo|cubicBezTo|quadBezTo)\b[^>]*>([\s\S]*?)<\/a:\1>|<a:(close)\b[^>]*\/?>/g
|
|
3842
|
+
let m: RegExpExecArray | null
|
|
3843
|
+
while ((m = cmdRegex.exec(block)) !== null) {
|
|
3844
|
+
if (m[3] === 'close') {
|
|
3845
|
+
dParts.push('Z')
|
|
3846
|
+
continue
|
|
3847
|
+
}
|
|
3848
|
+
const cmd = m[1]
|
|
3849
|
+
const inner = m[2] || ''
|
|
3850
|
+
const pts: Array<[number, number]> = []
|
|
3851
|
+
const ptRe = /<a:pt\b[^>]*x="(-?\d+)"[^>]*y="(-?\d+)"/g
|
|
3852
|
+
let pm: RegExpExecArray | null
|
|
3853
|
+
while ((pm = ptRe.exec(inner)) !== null) {
|
|
3854
|
+
pts.push([parseInt(pm[1], 10), parseInt(pm[2], 10)])
|
|
3855
|
+
}
|
|
3856
|
+
if (cmd === 'moveTo' && pts.length >= 1) {
|
|
3857
|
+
dParts.push(`M ${fmtX(pts[0][0])} ${fmtY(pts[0][1])}`)
|
|
3858
|
+
} else if (cmd === 'lnTo' && pts.length >= 1) {
|
|
3859
|
+
dParts.push(`L ${fmtX(pts[0][0])} ${fmtY(pts[0][1])}`)
|
|
3860
|
+
} else if (cmd === 'cubicBezTo' && pts.length >= 3) {
|
|
3861
|
+
dParts.push(`C ${fmtX(pts[0][0])} ${fmtY(pts[0][1])} ${fmtX(pts[1][0])} ${fmtY(pts[1][1])} ${fmtX(pts[2][0])} ${fmtY(pts[2][1])}`)
|
|
3862
|
+
} else if (cmd === 'quadBezTo' && pts.length >= 2) {
|
|
3863
|
+
dParts.push(`Q ${fmtX(pts[0][0])} ${fmtY(pts[0][1])} ${fmtX(pts[1][0])} ${fmtY(pts[1][1])}`)
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3868
|
+
if (dParts.length === 0) return null
|
|
3869
|
+
return {
|
|
3870
|
+
path: dParts.join(' '),
|
|
3871
|
+
viewBox: [targetW, targetH]
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3803
3875
|
function extractPrimaryTextColorFromHtml(html: string | undefined | null): string | null {
|
|
3804
3876
|
if (!html || typeof html !== 'string') return null
|
|
3805
3877
|
const clean = html.replace(/<[^>]*>/g, '').replace(/ /gi, '').trim()
|
|
@@ -4435,8 +4507,9 @@ const parsePPTXJSONData = (json: any, zipMeta?: any) => {
|
|
|
4435
4507
|
const rawLineCap = el.borderLineCap || el.border?.lineCap || el.lineCap || (el.outline?.lineCap)
|
|
4436
4508
|
const lineCap = (rawLineCap === 'rnd' || rawLineCap === 'round') ? 'round' : (rawLineCap === 'sq' || rawLineCap === 'square' ? 'square' : (rawLineCap === 'flat' ? 'flat' : undefined))
|
|
4437
4509
|
|
|
4510
|
+
const hasActualBorder = Boolean(outlineGrad || (el.borderWidth && el.borderWidth > 0))
|
|
4438
4511
|
const outline: any = {
|
|
4439
|
-
color: el.borderColor,
|
|
4512
|
+
color: hasActualBorder ? (el.borderColor || 'transparent') : 'transparent',
|
|
4440
4513
|
width: +(el.borderWidth * ratio).toFixed(2),
|
|
4441
4514
|
style: el.borderType,
|
|
4442
4515
|
gradient: outlineGrad,
|
|
@@ -4495,7 +4568,7 @@ const parsePPTXJSONData = (json: any, zipMeta?: any) => {
|
|
|
4495
4568
|
if (pattern) {
|
|
4496
4569
|
element.style.pattern = pattern
|
|
4497
4570
|
}
|
|
4498
|
-
element.style.borderColor = el.borderColor || (el.outline?.color || 'transparent')
|
|
4571
|
+
element.style.borderColor = hasActualBorder ? (el.borderColor || (el.outline?.color || 'transparent')) : 'transparent'
|
|
4499
4572
|
element.style.borderWidth = el.borderWidth !== undefined ? `${+(el.borderWidth * ratio).toFixed(2)}px` : (el.outline?.width !== undefined ? `${el.outline.width}px` : '0px')
|
|
4500
4573
|
element.style.borderStyle = el.borderType || (el.outline?.style || 'solid')
|
|
4501
4574
|
if (el.placeholderType === 'pic' && el.borderWidth > 0) element.style.enableBorder = true
|
|
@@ -6096,17 +6169,34 @@ const parsePPTXJSONData = (json: any, zipMeta?: any) => {
|
|
|
6096
6169
|
const clrMap: Record<string, string> = (zipMeta as any)?.clrMap || { bg1: 'lt1', tx1: 'dk1', bg2: 'lt2', tx2: 'dk2' }
|
|
6097
6170
|
const resolveSchemeSlot = (v: string) => clrMap[v] || (v === 'tx1' ? 'dk1' : v === 'bg1' ? 'lt1' : v === 'tx2' ? 'dk2' : v === 'bg2' ? 'lt2' : v)
|
|
6098
6171
|
|
|
6172
|
+
const applyAlphaToHex = (hex: string, xmlFragment: string): string => {
|
|
6173
|
+
if (!hex || !hex.startsWith('#')) return hex
|
|
6174
|
+
const alphaM = xmlFragment.match(/<a:alpha\s+val="(\d+)"/)
|
|
6175
|
+
if (!alphaM) return hex
|
|
6176
|
+
const alphaVal = Math.max(0, Math.min(100000, parseInt(alphaM[1], 10))) / 100000
|
|
6177
|
+
if (alphaVal >= 0.999) return hex.slice(0, 7).toUpperCase()
|
|
6178
|
+
const alphaHex = Math.round(alphaVal * 255).toString(16).padStart(2, '0').toUpperCase()
|
|
6179
|
+
return `${hex.slice(0, 7).toUpperCase()}${alphaHex}`
|
|
6180
|
+
}
|
|
6181
|
+
|
|
6099
6182
|
const parseSpGradFill = (gradXml: string): any => {
|
|
6100
6183
|
const gsList = gradXml.match(/<a:gs\b[\s\S]*?<\/a:gs>/g) || []
|
|
6101
6184
|
if (gsList.length === 0) return null
|
|
6102
|
-
const
|
|
6103
|
-
for (
|
|
6185
|
+
const rawStops: Array<{ posNum: number; idx: number; color: string }> = []
|
|
6186
|
+
for (let gIdx = 0; gIdx < gsList.length; gIdx++) {
|
|
6187
|
+
const gs = gsList[gIdx]
|
|
6104
6188
|
const posM = gs.match(/pos="(\d+)"/)
|
|
6105
6189
|
const posVal = posM ? Math.round(parseInt(posM[1], 10) / 1000) : 0
|
|
6106
6190
|
let col = '#FFFFFF'
|
|
6107
6191
|
const srgbM = gs.match(/<a:srgbClr\s+val="([0-9A-Fa-f]{6})"/)
|
|
6108
6192
|
if (srgbM) {
|
|
6109
|
-
|
|
6193
|
+
const lumModM = gs.match(/<a:lumMod val="(\d+)"/)
|
|
6194
|
+
const lumOffM = gs.match(/<a:lumOff val="(\d+)"/)
|
|
6195
|
+
const lumMod = lumModM ? parseInt(lumModM[1], 10) / 100000 : 1
|
|
6196
|
+
const lumOff = lumOffM ? parseInt(lumOffM[1], 10) / 100000 : 0
|
|
6197
|
+
const baseHex = '#' + srgbM[1].toUpperCase()
|
|
6198
|
+
col = (lumMod !== 1 || lumOff !== 0) ? applyLumAdjust(baseHex, lumMod, lumOff) : baseHex
|
|
6199
|
+
col = applyAlphaToHex(col, gs)
|
|
6110
6200
|
} else {
|
|
6111
6201
|
const schemeM = gs.match(/<a:schemeClr\s+val="([^"]+)"([\s\S]*?)<\/a:schemeClr>/) || gs.match(/<a:schemeClr\s+val="([^"]+)"\s*\/>/)
|
|
6112
6202
|
if (schemeM) {
|
|
@@ -6119,10 +6209,16 @@ const parsePPTXJSONData = (json: any, zipMeta?: any) => {
|
|
|
6119
6209
|
const slot = resolveSchemeSlot(val)
|
|
6120
6210
|
const baseHex = themeColors[slot] || themeColors[val] || (slot === 'dk1' || slot === 'tx1' ? '#000000' : '#FFFFFF')
|
|
6121
6211
|
col = (lumMod !== 1 || lumOff !== 0) ? applyLumAdjust(baseHex, lumMod, lumOff) : baseHex
|
|
6212
|
+
col = applyAlphaToHex(col, inner)
|
|
6122
6213
|
}
|
|
6123
6214
|
}
|
|
6124
|
-
|
|
6215
|
+
rawStops.push({ posNum: posVal, idx: gIdx, color: col })
|
|
6125
6216
|
}
|
|
6217
|
+
rawStops.sort((a, b) => a.posNum - b.posNum || a.idx - b.idx)
|
|
6218
|
+
const colors: Array<{ pos: string; color: string }> = rawStops.map(s => ({
|
|
6219
|
+
pos: `${s.posNum}%`,
|
|
6220
|
+
color: s.color
|
|
6221
|
+
}))
|
|
6126
6222
|
|
|
6127
6223
|
const pathMatch = gradXml.match(/<a:path\b[^>]*path="([^"]+)"/i)
|
|
6128
6224
|
const pathKind = pathMatch ? pathMatch[1].toLowerCase() : ''
|
|
@@ -6196,7 +6292,7 @@ const parsePPTXJSONData = (json: any, zipMeta?: any) => {
|
|
|
6196
6292
|
if (parsedG) return parsedG
|
|
6197
6293
|
}
|
|
6198
6294
|
|
|
6199
|
-
// 2. 提取单色填充元素(含子节点),便于读取 lumMod/lumOff
|
|
6295
|
+
// 2. 提取单色填充元素(含子节点),便于读取 lumMod/lumOff 与 alpha 透明度
|
|
6200
6296
|
const fillEl = spXml.match(/<a:solidFill[^>]*>([\s\S]*?)<\/a:solidFill>/)
|
|
6201
6297
|
if (fillEl) {
|
|
6202
6298
|
const inner = fillEl[1]
|
|
@@ -6207,18 +6303,23 @@ const parsePPTXJSONData = (json: any, zipMeta?: any) => {
|
|
|
6207
6303
|
const srgb = inner.match(/<a:srgbClr val="([0-9A-Fa-f]{6})"/)
|
|
6208
6304
|
if (srgb) {
|
|
6209
6305
|
const hex = '#' + srgb[1].toUpperCase()
|
|
6210
|
-
|
|
6306
|
+
const adjusted = (lumMod !== 1 || lumOff !== 0) ? applyLumAdjust(hex, lumMod, lumOff) : hex
|
|
6307
|
+
return applyAlphaToHex(adjusted, inner)
|
|
6211
6308
|
}
|
|
6212
6309
|
const sys = inner.match(/<a:sysClr[^>]*lastClr="([0-9A-Fa-f]{6})"/)
|
|
6213
6310
|
if (sys) {
|
|
6214
6311
|
const hex = '#' + sys[1].toUpperCase()
|
|
6215
|
-
|
|
6312
|
+
const adjusted = (lumMod !== 1 || lumOff !== 0) ? applyLumAdjust(hex, lumMod, lumOff) : hex
|
|
6313
|
+
return applyAlphaToHex(adjusted, inner)
|
|
6216
6314
|
}
|
|
6217
6315
|
const schemeVal = (inner.match(/<a:schemeClr val="(\w+)"/) || [])[1]
|
|
6218
6316
|
if (schemeVal) {
|
|
6219
6317
|
const slot = resolveSchemeSlot(schemeVal)
|
|
6220
6318
|
const hex = themeColors[slot] || themeColors[schemeVal] || ''
|
|
6221
|
-
if (hex)
|
|
6319
|
+
if (hex) {
|
|
6320
|
+
const adjusted = (lumMod !== 1 || lumOff !== 0) ? applyLumAdjust(hex, lumMod, lumOff) : hex
|
|
6321
|
+
return applyAlphaToHex(adjusted, inner)
|
|
6322
|
+
}
|
|
6222
6323
|
}
|
|
6223
6324
|
}
|
|
6224
6325
|
// p:style 里的主题填充引用(fillRef)
|
|
@@ -6373,42 +6474,108 @@ const parsePPTXJSONData = (json: any, zipMeta?: any) => {
|
|
|
6373
6474
|
} else {
|
|
6374
6475
|
// 非占位符 sp = 版式/母版自带装饰元素,按真实样式还原
|
|
6375
6476
|
const spPrXml = (sp.match(/<p:spPr[^>]*>[\s\S]*?<\/p:spPr>/) || [''])[0]
|
|
6376
|
-
|
|
6477
|
+
// 剥离 <a:ln> 与 <a:effectLst> 再解析填充,防止将边框色或阴影色误识别为形状填充色
|
|
6478
|
+
const spPrNoLnXml = spPrXml
|
|
6479
|
+
.replace(/<a:ln\b[\s\S]*?<\/a:ln>/g, '')
|
|
6480
|
+
.replace(/<a:ln\b[^>]*\/>/g, '')
|
|
6481
|
+
.replace(/<a:effectLst\b[\s\S]*?<\/a:effectLst>/g, '')
|
|
6482
|
+
const hasExplicitNoFill = /<a:noFill\b/.test(spPrNoLnXml)
|
|
6483
|
+
let resolved = hasExplicitNoFill ? '' : resolveSpFill(spPrNoLnXml)
|
|
6484
|
+
if (!resolved && !hasExplicitNoFill) {
|
|
6485
|
+
const styleXml = (sp.match(/<p:style\b[\s\S]*?<\/p:style>/) || [''])[0]
|
|
6486
|
+
const fillRefXml = (styleXml.match(/<a:fillRef\b[^>]*>[\s\S]*?<\/a:fillRef>/) || [''])[0]
|
|
6487
|
+
if (fillRefXml && !/\bidx="0"/.test(fillRefXml)) {
|
|
6488
|
+
resolved = resolveSpFill(fillRefXml)
|
|
6489
|
+
}
|
|
6490
|
+
}
|
|
6377
6491
|
const isGrad = resolved && typeof resolved === 'object'
|
|
6378
6492
|
const fill = isGrad ? 'transparent' : (resolved || 'transparent')
|
|
6379
6493
|
const gradient = isGrad ? resolved : undefined
|
|
6380
6494
|
|
|
6381
|
-
//
|
|
6495
|
+
// 解析旋转与翻转 (<a:xfrm rot="..." flipH="1" flipV="1">)
|
|
6496
|
+
const xfrmOpen = (spPrXml.match(/<a:xfrm\b[^>]*>/) || [''])[0]
|
|
6497
|
+
const rotM = xfrmOpen.match(/\brot="(-?\d+)"/)
|
|
6498
|
+
const rotate = rotM ? ((Math.round(parseInt(rotM[1], 10) / 60000) % 360) + 360) % 360 : 0
|
|
6499
|
+
const flipH = /\bflipH="(?:1|true)"/i.test(xfrmOpen)
|
|
6500
|
+
const flipV = /\bflipV="(?:1|true)"/i.test(xfrmOpen)
|
|
6501
|
+
|
|
6502
|
+
// 解析自定义几何路径 (<a:custGeom>) 或预设几何形状 (<a:prstGeom>)
|
|
6503
|
+
let shapePath: string | undefined = undefined
|
|
6504
|
+
let shapeViewBox: [number, number] | undefined = undefined
|
|
6505
|
+
let shapType: string = geom
|
|
6506
|
+
let pathFormula: string | undefined = undefined
|
|
6507
|
+
const custGeomMatch = spPrXml.match(/<a:custGeom\b[\s\S]*?<\/a:custGeom>/)
|
|
6508
|
+
if (custGeomMatch) {
|
|
6509
|
+
const parsedCust = parseCustGeomToSvgPath(custGeomMatch[0], pxWidth, pxHeight, cx, cy)
|
|
6510
|
+
if (parsedCust) {
|
|
6511
|
+
shapePath = parsedCust.path
|
|
6512
|
+
shapeViewBox = parsedCust.viewBox
|
|
6513
|
+
shapType = 'custom'
|
|
6514
|
+
}
|
|
6515
|
+
} else if (geom && geom !== 'rect' && geom !== 'ellipse') {
|
|
6516
|
+
const normGeom = geom.toLowerCase()
|
|
6517
|
+
for (const item of shapeList) {
|
|
6518
|
+
const itemPptxType = (item.pptxShapeType || '').toLowerCase()
|
|
6519
|
+
const itemFormula = (item.pathFormula || '').toLowerCase()
|
|
6520
|
+
if (itemPptxType === normGeom || itemFormula === normGeom) {
|
|
6521
|
+
if (item.pathFormula && shapeFormulas()[item.pathFormula]) {
|
|
6522
|
+
const formula = shapeFormulas()[item.pathFormula]
|
|
6523
|
+
const kps = formula.defaultValue ? [...formula.defaultValue] : []
|
|
6524
|
+
shapePath = formula.formula(pxWidth, pxHeight, kps)
|
|
6525
|
+
shapeViewBox = [pxWidth, pxHeight]
|
|
6526
|
+
pathFormula = item.pathFormula
|
|
6527
|
+
} else if (item.path) {
|
|
6528
|
+
shapePath = item.path
|
|
6529
|
+
shapeViewBox = item.viewBox || [200, 200]
|
|
6530
|
+
pathFormula = item.pathFormula
|
|
6531
|
+
}
|
|
6532
|
+
break
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
|
|
6537
|
+
// 解析装饰图元边框 <a:ln>(显式 <a:noFill/> 或无有效填充时严禁生成黑框)
|
|
6382
6538
|
let outline: any = undefined
|
|
6383
6539
|
let borderWidth = '0px'
|
|
6384
6540
|
let borderColor = 'transparent'
|
|
6385
|
-
const lnMatch = spPrXml.match(/<a:ln\b[^>]*>([\s\S]*?)<\/a:ln>/)
|
|
6386
|
-
if (lnMatch) {
|
|
6541
|
+
const lnMatch = spPrXml.match(/<a:ln\b[^>]*>([\s\S]*?)<\/a:ln>/)
|
|
6542
|
+
if (lnMatch && !/<a:noFill\b/.test(lnMatch[0])) {
|
|
6387
6543
|
const lnXml = lnMatch[0]
|
|
6388
|
-
const wM = lnXml.match(/\bw="(\d+)"/)
|
|
6389
|
-
const pxW = wM ? Math.max(1, Math.round(parseInt(wM[1], 10) / 9525)) : 1
|
|
6390
|
-
borderWidth = `${pxW}px`
|
|
6391
6544
|
const lnGradM = lnXml.match(/<a:gradFill\b[\s\S]*?<\/a:gradFill>/)
|
|
6392
6545
|
const lnGrad = lnGradM ? parseSpGradFill(lnGradM[0]) : undefined
|
|
6393
6546
|
const lnSolid = resolveSpFill(lnXml)
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6547
|
+
if (lnGrad || (typeof lnSolid === 'string' && lnSolid)) {
|
|
6548
|
+
const wM = lnXml.match(/\bw="(\d+)"/)
|
|
6549
|
+
const pxW = wM ? Math.max(1, Math.round(parseInt(wM[1], 10) / 9525)) : 1
|
|
6550
|
+
borderWidth = `${pxW}px`
|
|
6551
|
+
borderColor = typeof lnSolid === 'string' && lnSolid ? lnSolid : (lnGrad?.colors?.[0]?.color || 'transparent')
|
|
6552
|
+
outline = {
|
|
6553
|
+
color: borderColor,
|
|
6554
|
+
width: pxW,
|
|
6555
|
+
style: 'solid',
|
|
6556
|
+
gradient: lnGrad
|
|
6557
|
+
}
|
|
6400
6558
|
}
|
|
6401
6559
|
}
|
|
6402
6560
|
|
|
6403
6561
|
elements.push({
|
|
6404
6562
|
id: elId,
|
|
6405
6563
|
type: textContent ? 'text' : 'shape',
|
|
6564
|
+
shapType,
|
|
6565
|
+
pathFormula,
|
|
6566
|
+
path: shapePath,
|
|
6567
|
+
viewBox: shapeViewBox,
|
|
6406
6568
|
name: spName || (textContent ? (isMaster ? `母版文本 ${sIdx + 1}` : `版式文本 ${sIdx + 1}`) : (isMaster ? `母版装饰 ${sIdx + 1}` : `版式装饰 ${sIdx + 1}`)),
|
|
6407
6569
|
left: pxLeft,
|
|
6408
6570
|
top: pxTop,
|
|
6409
6571
|
width: pxWidth,
|
|
6410
6572
|
height: pxHeight,
|
|
6411
|
-
|
|
6573
|
+
rotate,
|
|
6574
|
+
flipH,
|
|
6575
|
+
flipV,
|
|
6576
|
+
isFlipH: flipH,
|
|
6577
|
+
isFlipV: flipV,
|
|
6578
|
+
content: textContent ? `<div>${textContent}</div>` : (shapePath || ''),
|
|
6412
6579
|
fill,
|
|
6413
6580
|
gradient,
|
|
6414
6581
|
outline,
|
|
@@ -6418,12 +6585,15 @@ const parsePPTXJSONData = (json: any, zipMeta?: any) => {
|
|
|
6418
6585
|
top: `${pxTop}px`,
|
|
6419
6586
|
width: `${pxWidth}px`,
|
|
6420
6587
|
height: `${pxHeight}px`,
|
|
6421
|
-
|
|
6588
|
+
rotate,
|
|
6589
|
+
flipH,
|
|
6590
|
+
flipV,
|
|
6591
|
+
borderRadius: geom === 'ellipse' ? '50%' : (geom === 'roundRect' && !shapePath ? '8px' : '0px'),
|
|
6422
6592
|
fill,
|
|
6423
6593
|
color: '#333333',
|
|
6424
6594
|
textAlign: 'center',
|
|
6425
6595
|
borderColor: outline?.gradient ? 'transparent' : borderColor,
|
|
6426
|
-
borderWidth: outline ? borderWidth :
|
|
6596
|
+
borderWidth: outline ? borderWidth : '0px',
|
|
6427
6597
|
borderStyle: outline ? 'solid' : undefined,
|
|
6428
6598
|
borderGradient: outline?.gradient
|
|
6429
6599
|
},
|
|
@@ -7614,6 +7784,21 @@ defineExpose({
|
|
|
7614
7784
|
<div class="import-label">JVS-PPT</div>
|
|
7615
7785
|
<div class="import-subtext">(专属格式)</div>
|
|
7616
7786
|
</div>
|
|
7787
|
+
|
|
7788
|
+
<!-- Pitch Template Import (仅本地开发可见) -->
|
|
7789
|
+
<div v-if="isLocalDev" class="import-card" @click="handleMenuAction(triggerPitchImport)">
|
|
7790
|
+
<div class="import-icon-box pitch-icon">
|
|
7791
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7792
|
+
<path
|
|
7793
|
+
d="M4 4C4 2.89543 4.89543 2 6 2H14L20 8V20C20 21.1046 19.1046 22 18 22H6C4.89543 22 4 21.1046 4 20V4Z"
|
|
7794
|
+
fill="#7c3aed" />
|
|
7795
|
+
<path d="M14 2V8H20L14 2Z" fill="#5b21b6" />
|
|
7796
|
+
<text x="7" y="17" fill="#fff" font-size="9" font-weight="900" font-family="Arial">P</text>
|
|
7797
|
+
</svg>
|
|
7798
|
+
</div>
|
|
7799
|
+
<div class="import-label">Pitch 模板</div>
|
|
7800
|
+
<div class="import-subtext">(本地开发)</div>
|
|
7801
|
+
</div>
|
|
7617
7802
|
</div>
|
|
7618
7803
|
|
|
7619
7804
|
<!-- Divider -->
|
|
@@ -7774,6 +7959,18 @@ defineExpose({
|
|
|
7774
7959
|
<span>退出母版</span>
|
|
7775
7960
|
</button>
|
|
7776
7961
|
|
|
7962
|
+
<!-- Pitch Template Converter Button (仅本地开发模式显示) -->
|
|
7963
|
+
<button v-if="isLocalDev && !isReadonly" class="btn-master-toggle" @click="triggerPitchImport" title="Pitch 模板拉取转换 (仅本地开发可见)"
|
|
7964
|
+
style="background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe;">
|
|
7965
|
+
<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2"
|
|
7966
|
+
stroke-linecap="round" stroke-linejoin="round" style="flex-shrink: 0;">
|
|
7967
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
|
7968
|
+
<polyline points="7 10 12 15 17 10" />
|
|
7969
|
+
<line x1="12" y1="15" x2="12" y2="3" />
|
|
7970
|
+
</svg>
|
|
7971
|
+
<span>Pitch 转换</span>
|
|
7972
|
+
</button>
|
|
7973
|
+
|
|
7777
7974
|
<!-- Slide Master Mode Toggle Button -->
|
|
7778
7975
|
<button v-if="!isMasterEditingView && !isReadonly" class="btn-master-toggle" @click="enterMasterView()" title="母版"
|
|
7779
7976
|
data-tooltip="母版">
|
|
@@ -7837,6 +8034,8 @@ defineExpose({
|
|
|
7837
8034
|
|
|
7838
8035
|
<!-- Shortcuts Dialog Modal -->
|
|
7839
8036
|
<ShortcutsDialog v-if="shortcutsOpened" v-model:visible="shortcutsDialogVisible" />
|
|
8037
|
+
<!-- Pitch Import Dialog Modal (Dev Only) -->
|
|
8038
|
+
<PitchImportDialog v-if="isLocalDev && pitchDialogOpened" v-model:visible="pitchDialogVisible" />
|
|
7840
8039
|
</header>
|
|
7841
8040
|
|
|
7842
8041
|
<teleport to="body">
|