jvs-ppt-ui 0.0.32 → 0.0.34
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 +23678 -21439
- package/dist/lib/jvs-ppt-ui.umd.js +136 -100
- package/dist/lib/style.css +1 -1
- package/package.json +2 -1
- package/src/components/CanvasArea.vue +77 -35
- package/src/components/Header.vue +184 -26
- package/src/components/PitchImportDialog.vue +29 -6
- package/src/components/PptEditor.vue +53 -1
- package/src/components/QuickColorPopover.vue +2 -1
- package/src/components/SidebarLeft.vue +367 -41
- package/src/components/SidebarRight.vue +183 -134
- package/src/components/canvas/CanvasTransformHandles.vue +27 -36
- package/src/components/canvas/elements/CanvasMediaElement.vue +4 -3
- package/src/components/canvas/elements/CanvasShapeElement.vue +9 -6
- package/src/components/sidebar/panels/LayoutThumbSvg.vue +9 -6
- package/src/components/sidebar/panels/SidebarShapeFormatPanel.vue +1 -1
- package/src/components/sidebar/panels/SidebarTextFormatPanel.vue +1 -1
- package/src/composables/canvas/useCanvasFormatting.ts +20 -13
- package/src/composables/canvas/useCanvasText.ts +4 -3
- package/src/composables/canvas/useCanvasTransform.ts +37 -10
- package/src/composables/sidebar/useSidebarElementTransform.ts +86 -57
- package/src/composables/sidebar/useSidebarTextFormat.ts +242 -19
- package/src/composables/useSlides.ts +93 -28
- package/src/configs/slideTemplates.ts +1001 -0
- package/src/style.css +265 -2
- package/src/types/index.ts +37 -1
- package/src/utils/canvas/elementStyles.ts +55 -20
- package/src/utils/canvas/formatPainter.ts +177 -30
- package/src/utils/muxHlsToMp4.ts +569 -0
- package/src/utils/pitchConverter.ts +512 -13
- package/dist/lib/templates/index.json +0 -5
|
@@ -0,0 +1,1001 @@
|
|
|
1
|
+
import { reactive, ref } from 'vue'
|
|
2
|
+
import type { StyleRecipe } from '../composables/presetThemes'
|
|
3
|
+
import { isPitchTemplateData, convertPitchTemplateToDeck } from '../utils/pitchConverter'
|
|
4
|
+
|
|
5
|
+
export interface SlideTemplateItem {
|
|
6
|
+
id: string
|
|
7
|
+
name: string
|
|
8
|
+
category?: string
|
|
9
|
+
/** 对应的模板完整 JSON 文件名(如 Launch.json) */
|
|
10
|
+
fileName?: string
|
|
11
|
+
/** 模板总页数(一级列表仅加载第一页时,用于展示真实总页数) */
|
|
12
|
+
slidesCount?: number
|
|
13
|
+
/** 第一页幻灯片数据(用于一级列表渲染真实第一页) */
|
|
14
|
+
firstSlide?: any
|
|
15
|
+
/** 可选:服务端按需加载的模板 JSON 地址(配置后点击模板才按需请求全部 slider) */
|
|
16
|
+
jsonUrl?: string
|
|
17
|
+
/** 可选:封面预览图地址(未加载完整 JSON 前可优先展示轻量封面) */
|
|
18
|
+
coverUrl?: string
|
|
19
|
+
/** 模板包含的主题配方 */
|
|
20
|
+
styleRecipes?: StyleRecipe[]
|
|
21
|
+
/** 模板内的所有幻灯片列表(未加载全部前僅包含 [firstSlide]) */
|
|
22
|
+
slides: any[]
|
|
23
|
+
/** 标记是否已按需加载完整 slides */
|
|
24
|
+
loaded?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 外部传入模板支持的标准入参格式:
|
|
29
|
+
* 1. 完整 Deck 对象:{ title/name, slides: [...], styleRecipes?: [...] }
|
|
30
|
+
* 2. 按需加载索引项:{ id?, name, category?, slidesCount?, firstSlide?, jsonUrl?, fileName?, coverUrl? }
|
|
31
|
+
* 3. Pitch 原始导出对象:{ presentations: [...] }
|
|
32
|
+
*/
|
|
33
|
+
export type SlideTemplateInput = Partial<SlideTemplateItem> & {
|
|
34
|
+
title?: string
|
|
35
|
+
slides?: any[]
|
|
36
|
+
data?: any[]
|
|
37
|
+
presentations?: any[]
|
|
38
|
+
[key: string]: any
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function makeTextEl(
|
|
42
|
+
id: string,
|
|
43
|
+
content: string,
|
|
44
|
+
left: number,
|
|
45
|
+
top: number,
|
|
46
|
+
width: number,
|
|
47
|
+
height: number,
|
|
48
|
+
opts: {
|
|
49
|
+
fontSize?: number
|
|
50
|
+
color?: string
|
|
51
|
+
fontWeight?: string
|
|
52
|
+
textAlign?: 'left' | 'center' | 'right'
|
|
53
|
+
lineHeight?: number
|
|
54
|
+
textType?: string
|
|
55
|
+
} = {}
|
|
56
|
+
) {
|
|
57
|
+
const fontSize = opts.fontSize || 20
|
|
58
|
+
const color = opts.color || '#0F172A'
|
|
59
|
+
const fontWeight = opts.fontWeight || 'normal'
|
|
60
|
+
const textAlign = opts.textAlign || 'left'
|
|
61
|
+
const lineHeight = opts.lineHeight || 1.3
|
|
62
|
+
return {
|
|
63
|
+
id,
|
|
64
|
+
type: 'text',
|
|
65
|
+
textType: opts.textType || (fontSize >= 40 ? 'title' : fontSize >= 28 ? 'headline' : 'normalText'),
|
|
66
|
+
content: `<div style="text-align: ${textAlign}; line-height: ${lineHeight};"><span style="font-size: ${fontSize}px; color: ${color}; font-weight: ${fontWeight};">${content}</span></div>`,
|
|
67
|
+
left,
|
|
68
|
+
top,
|
|
69
|
+
width,
|
|
70
|
+
height,
|
|
71
|
+
style: {
|
|
72
|
+
left: `${left}px`,
|
|
73
|
+
top: `${top}px`,
|
|
74
|
+
width: `${width}px`,
|
|
75
|
+
height: `${height}px`,
|
|
76
|
+
fontSize: `${fontSize}px`,
|
|
77
|
+
color,
|
|
78
|
+
fontWeight,
|
|
79
|
+
textAlign,
|
|
80
|
+
lineHeight,
|
|
81
|
+
fontFamily: "'SourceHanSansCN', sans-serif"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function makeRectEl(
|
|
87
|
+
id: string,
|
|
88
|
+
left: number,
|
|
89
|
+
top: number,
|
|
90
|
+
width: number,
|
|
91
|
+
height: number,
|
|
92
|
+
fill: string,
|
|
93
|
+
opts: {
|
|
94
|
+
borderRadius?: number
|
|
95
|
+
borderColor?: string
|
|
96
|
+
borderWidth?: number
|
|
97
|
+
gradient?: any
|
|
98
|
+
circle?: boolean
|
|
99
|
+
} = {}
|
|
100
|
+
) {
|
|
101
|
+
const r = opts.borderRadius || 0
|
|
102
|
+
let path = `M 0 0 L ${width} 0 L ${width} ${height} L 0 ${height} Z`
|
|
103
|
+
if (r > 0 && !opts.circle) {
|
|
104
|
+
const cr = Math.min(r, width / 2, height / 2)
|
|
105
|
+
path = `M ${cr} 0 L ${width - cr} 0 Q ${width} 0 ${width} ${cr} L ${width} ${height - cr} Q ${width} ${height} ${width - cr} ${height} L ${cr} ${height} Q 0 ${height} 0 ${height - cr} L 0 ${cr} Q 0 0 ${cr} 0 Z`
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
id,
|
|
109
|
+
type: 'shape',
|
|
110
|
+
shapType: opts.circle ? 'ellipse' : r > 0 ? 'roundRect' : 'rect',
|
|
111
|
+
content: opts.circle ? 'circle' : path,
|
|
112
|
+
path: opts.circle ? undefined : path,
|
|
113
|
+
viewBox: [width, height] as [number, number],
|
|
114
|
+
left,
|
|
115
|
+
top,
|
|
116
|
+
width,
|
|
117
|
+
height,
|
|
118
|
+
fill,
|
|
119
|
+
gradient: opts.gradient,
|
|
120
|
+
style: {
|
|
121
|
+
left: `${left}px`,
|
|
122
|
+
top: `${top}px`,
|
|
123
|
+
width: `${width}px`,
|
|
124
|
+
height: `${height}px`,
|
|
125
|
+
fill,
|
|
126
|
+
borderRadius: opts.circle ? '50%' : r ? `${r}px` : '0px',
|
|
127
|
+
borderColor: opts.borderColor || 'transparent',
|
|
128
|
+
borderWidth: opts.borderWidth ? `${opts.borderWidth}px` : '0px',
|
|
129
|
+
borderStyle: opts.borderWidth ? 'solid' : 'none'
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 1. Launch 模板 (对应图二 Launch.json / Launch.pptx 与图三 Launch)
|
|
136
|
+
*/
|
|
137
|
+
const launchTemplateSlides = [
|
|
138
|
+
{
|
|
139
|
+
id: 'launch-s1',
|
|
140
|
+
title: '01 · Product Launch Cover',
|
|
141
|
+
background: '#F8FAFC',
|
|
142
|
+
bgType: 'color',
|
|
143
|
+
showMasterElements: false,
|
|
144
|
+
elements: [
|
|
145
|
+
makeRectEl('l1-pill', 560, 74, 160, 28, '#DBEAFE', { borderRadius: 14 }),
|
|
146
|
+
makeTextEl('l1-tag', 'RELEASE 2026', 560, 79, 160, 20, { fontSize: 12, color: '#2563EB', fontWeight: 'bold', textAlign: 'center' }),
|
|
147
|
+
makeTextEl('l1-title', 'Product Launch', 240, 118, 800, 76, { fontSize: 54, color: '#2563EB', fontWeight: 'bold', textAlign: 'center' }),
|
|
148
|
+
makeTextEl('l1-sub', 'A quick description of what is to come in this major release', 340, 198, 600, 32, { fontSize: 18, color: '#64748B', textAlign: 'center' }),
|
|
149
|
+
// Mockup outer frame
|
|
150
|
+
makeRectEl('l1-frame', 230, 260, 820, 460, '#0F172A', { borderRadius: 20 }),
|
|
151
|
+
makeRectEl('l1-screen', 246, 276, 788, 444, '#FFFFFF', { borderRadius: 12 }),
|
|
152
|
+
// Dashboard widgets inside screen
|
|
153
|
+
makeRectEl('l1-side', 246, 276, 150, 444, '#F1F5F9', { borderRadius: 8 }),
|
|
154
|
+
makeRectEl('l1-card1', 420, 304, 280, 140, '#EFF6FF', { borderRadius: 10 }),
|
|
155
|
+
makeRectEl('l1-card2', 720, 304, 286, 140, '#F8FAFC', { borderRadius: 10, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
156
|
+
makeTextEl('l1-stat1', '+148%', 440, 328, 200, 50, { fontSize: 34, color: '#2563EB', fontWeight: 'bold' }),
|
|
157
|
+
makeTextEl('l1-stat1-lbl', 'Active User Growth', 440, 386, 220, 28, { fontSize: 14, color: '#475569' }),
|
|
158
|
+
makeTextEl('l1-stat2', '99.98%', 740, 328, 200, 50, { fontSize: 34, color: '#0F172A', fontWeight: 'bold' }),
|
|
159
|
+
makeTextEl('l1-stat2-lbl', 'Cloud SLA Uptime', 740, 386, 220, 28, { fontSize: 14, color: '#64748B' }),
|
|
160
|
+
// Bar chart bars in dashboard
|
|
161
|
+
makeRectEl('l1-bar1', 440, 540, 48, 120, '#93C5FD', { borderRadius: 6 }),
|
|
162
|
+
makeRectEl('l1-bar2', 515, 500, 48, 160, '#60A5FA', { borderRadius: 6 }),
|
|
163
|
+
makeRectEl('l1-bar3', 590, 470, 48, 190, '#3B82F6', { borderRadius: 6 }),
|
|
164
|
+
makeRectEl('l1-bar4', 665, 510, 48, 150, '#60A5FA', { borderRadius: 6 }),
|
|
165
|
+
makeRectEl('l1-bar5', 740, 440, 48, 220, '#2563EB', { borderRadius: 6 }),
|
|
166
|
+
makeRectEl('l1-bar6', 815, 420, 48, 240, '#1D4ED8', { borderRadius: 6 })
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: 'launch-s2',
|
|
171
|
+
title: '02 · Launch Agenda',
|
|
172
|
+
background: '#FFFFFF',
|
|
173
|
+
bgType: 'color',
|
|
174
|
+
showMasterElements: false,
|
|
175
|
+
elements: [
|
|
176
|
+
makeTextEl('l2-kicker', 'OVERVIEW', 96, 84, 300, 28, { fontSize: 14, color: '#2563EB', fontWeight: 'bold' }),
|
|
177
|
+
makeTextEl('l2-title', 'What we are launching today', 96, 118, 700, 64, { fontSize: 44, color: '#0F172A', fontWeight: 'bold' }),
|
|
178
|
+
makeRectEl('l2-c1', 96, 228, 344, 380, '#F8FAFC', { borderRadius: 16, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
179
|
+
makeRectEl('l2-c2', 468, 228, 344, 380, '#EFF6FF', { borderRadius: 16, borderColor: '#BFDBFE', borderWidth: 1 }),
|
|
180
|
+
makeRectEl('l2-c3', 840, 228, 344, 380, '#F8FAFC', { borderRadius: 16, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
181
|
+
makeTextEl('l2-n1', '01', 128, 264, 100, 48, { fontSize: 32, color: '#2563EB', fontWeight: 'bold' }),
|
|
182
|
+
makeTextEl('l2-t1', 'Market Context', 128, 336, 280, 40, { fontSize: 24, color: '#0F172A', fontWeight: 'bold' }),
|
|
183
|
+
makeTextEl('l2-d1', 'Why teams struggle with legacy workflows and fragmented tools.', 128, 392, 280, 120, { fontSize: 16, color: '#475569' }),
|
|
184
|
+
makeTextEl('l2-n2', '02', 500, 264, 100, 48, { fontSize: 32, color: '#2563EB', fontWeight: 'bold' }),
|
|
185
|
+
makeTextEl('l2-t2', 'Core Capabilities', 500, 336, 280, 40, { fontSize: 24, color: '#1E3A8A', fontWeight: 'bold' }),
|
|
186
|
+
makeTextEl('l2-d2', 'Real-time collaboration, AI copilot, and instant cloud deployment.', 500, 392, 280, 120, { fontSize: 16, color: '#1E40AF' }),
|
|
187
|
+
makeTextEl('l2-n3', '03', 872, 264, 100, 48, { fontSize: 32, color: '#2563EB', fontWeight: 'bold' }),
|
|
188
|
+
makeTextEl('l2-t3', 'Rollout & Pricing', 872, 336, 280, 40, { fontSize: 24, color: '#0F172A', fontWeight: 'bold' }),
|
|
189
|
+
makeTextEl('l2-d3', 'Global availability schedule, migration guide, and tier breakdown.', 872, 392, 280, 120, { fontSize: 16, color: '#475569' })
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: 'launch-s3',
|
|
194
|
+
title: '03 · Key Feature Highlight',
|
|
195
|
+
background: '#1E40AF',
|
|
196
|
+
bgType: 'color',
|
|
197
|
+
showMasterElements: false,
|
|
198
|
+
elements: [
|
|
199
|
+
makeTextEl('l3-tag', 'KEY BREAKTHROUGH', 96, 110, 400, 28, { fontSize: 14, color: '#93C5FD', fontWeight: 'bold' }),
|
|
200
|
+
makeTextEl('l3-title', '10x faster workflow from idea to production', 96, 152, 560, 160, { fontSize: 48, color: '#FFFFFF', fontWeight: 'bold', lineHeight: 1.2 }),
|
|
201
|
+
makeTextEl('l3-desc', 'Built from the ground up with zero-latency streaming architecture and intelligent automation.', 96, 350, 520, 100, { fontSize: 20, color: '#DBEAFE', lineHeight: 1.5 }),
|
|
202
|
+
makeRectEl('l3-panel', 700, 110, 484, 500, '#1E3A8A', { borderRadius: 20, borderColor: '#3B82F6', borderWidth: 1 }),
|
|
203
|
+
makeRectEl('l3-subcard1', 740, 156, 404, 180, '#2563EB', { borderRadius: 14 }),
|
|
204
|
+
makeTextEl('l3-m1', '3.2 ms', 772, 184, 300, 64, { fontSize: 44, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
205
|
+
makeTextEl('l3-m1-sub', 'Average edge response latency worldwide', 772, 258, 340, 40, { fontSize: 16, color: '#BFDBFE' }),
|
|
206
|
+
makeRectEl('l3-subcard2', 740, 368, 404, 196, '#0F172A', { borderRadius: 14 }),
|
|
207
|
+
makeTextEl('l3-m2', 'Zero Config', 772, 402, 300, 52, { fontSize: 36, color: '#38BDF8', fontWeight: 'bold' }),
|
|
208
|
+
makeTextEl('l3-m2-sub', 'Out-of-the-box SSO, RBAC, and audit logs', 772, 470, 340, 48, { fontSize: 16, color: '#94A3B8' })
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
id: 'launch-s4',
|
|
213
|
+
title: '04 · Performance Metrics',
|
|
214
|
+
background: '#F8FAFC',
|
|
215
|
+
bgType: 'color',
|
|
216
|
+
showMasterElements: false,
|
|
217
|
+
elements: [
|
|
218
|
+
makeTextEl('l4-title', 'Early Beta Impact & Metrics', 96, 80, 800, 56, { fontSize: 40, color: '#0F172A', fontWeight: 'bold' }),
|
|
219
|
+
makeRectEl('l4-b1', 96, 176, 520, 220, '#FFFFFF', { borderRadius: 16, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
220
|
+
makeRectEl('l4-b2', 664, 176, 520, 220, '#FFFFFF', { borderRadius: 16, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
221
|
+
makeRectEl('l4-b3', 96, 428, 520, 220, '#FFFFFF', { borderRadius: 16, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
222
|
+
makeRectEl('l4-b4', 664, 428, 520, 220, '#2563EB', { borderRadius: 16 }),
|
|
223
|
+
makeTextEl('l4-v1', '4.9 / 5.0', 136, 212, 360, 68, { fontSize: 48, color: '#2563EB', fontWeight: 'bold' }),
|
|
224
|
+
makeTextEl('l4-l1', 'Customer satisfaction score across 500+ beta teams', 136, 296, 440, 60, { fontSize: 17, color: '#475569' }),
|
|
225
|
+
makeTextEl('l4-v2', '68%', 704, 212, 360, 68, { fontSize: 48, color: '#0F172A', fontWeight: 'bold' }),
|
|
226
|
+
makeTextEl('l4-l2', 'Reduction in weekly manual reporting time', 704, 296, 440, 60, { fontSize: 17, color: '#475569' }),
|
|
227
|
+
makeTextEl('l4-v3', '120K+', 136, 464, 360, 68, { fontSize: 48, color: '#0F172A', fontWeight: 'bold' }),
|
|
228
|
+
makeTextEl('l4-l3', 'Projects migrated during early access phase', 136, 548, 440, 60, { fontSize: 17, color: '#475569' }),
|
|
229
|
+
makeTextEl('l4-v4', '3.4x ROI', 704, 464, 360, 68, { fontSize: 48, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
230
|
+
makeTextEl('l4-l4', 'Average return within the first 90 days of deployment', 704, 548, 440, 60, { fontSize: 17, color: '#DBEAFE' })
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
id: 'launch-s5',
|
|
235
|
+
title: '05 · Go-to-Market Roadmap',
|
|
236
|
+
background: '#FFFFFF',
|
|
237
|
+
bgType: 'color',
|
|
238
|
+
showMasterElements: false,
|
|
239
|
+
elements: [
|
|
240
|
+
makeTextEl('l5-title', 'Rollout Timeline', 96, 84, 700, 56, { fontSize: 40, color: '#0F172A', fontWeight: 'bold' }),
|
|
241
|
+
makeRectEl('l5-line', 96, 360, 1088, 6, '#DBEAFE', { borderRadius: 3 }),
|
|
242
|
+
makeRectEl('l5-dot1', 160, 344, 38, 38, '#2563EB', { circle: true }),
|
|
243
|
+
makeRectEl('l5-dot2', 460, 344, 38, 38, '#2563EB', { circle: true }),
|
|
244
|
+
makeRectEl('l5-dot3', 760, 344, 38, 38, '#3B82F6', { circle: true }),
|
|
245
|
+
makeRectEl('l5-dot4', 1060, 344, 38, 38, '#93C5FD', { circle: true }),
|
|
246
|
+
makeTextEl('l5-q1', 'Phase 1 · Closed Beta', 96, 220, 240, 36, { fontSize: 20, color: '#2563EB', fontWeight: 'bold' }),
|
|
247
|
+
makeTextEl('l5-q1d', 'Core engine & design partner validation', 96, 262, 240, 64, { fontSize: 15, color: '#64748B' }),
|
|
248
|
+
makeTextEl('l5-q2', 'Phase 2 · Public Launch', 396, 412, 240, 36, { fontSize: 20, color: '#0F172A', fontWeight: 'bold' }),
|
|
249
|
+
makeTextEl('l5-q2d', 'Self-serve onboarding & template library', 396, 454, 240, 64, { fontSize: 15, color: '#64748B' }),
|
|
250
|
+
makeTextEl('l5-q3', 'Phase 3 · Enterprise', 696, 220, 240, 36, { fontSize: 20, color: '#0F172A', fontWeight: 'bold' }),
|
|
251
|
+
makeTextEl('l5-q3d', 'Dedicated VPC, SAML SSO & custom SLAs', 696, 262, 240, 64, { fontSize: 15, color: '#64748B' }),
|
|
252
|
+
makeTextEl('l5-q4', 'Phase 4 · Ecosystem', 960, 412, 240, 36, { fontSize: 20, color: '#0F172A', fontWeight: 'bold' }),
|
|
253
|
+
makeTextEl('l5-q4d', 'Open plugin SDK & marketplace release', 960, 454, 240, 64, { fontSize: 15, color: '#64748B' })
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
id: 'launch-s6',
|
|
258
|
+
title: '06 · Ready to Launch',
|
|
259
|
+
background: '#0F172A',
|
|
260
|
+
bgType: 'color',
|
|
261
|
+
showMasterElements: false,
|
|
262
|
+
elements: [
|
|
263
|
+
makeTextEl('l6-title', 'Ready to experience the new standard?', 190, 220, 900, 120, { fontSize: 52, color: '#FFFFFF', fontWeight: 'bold', textAlign: 'center' }),
|
|
264
|
+
makeTextEl('l6-sub', 'Start your free 14-day workspace trial today at launch.example.com', 290, 368, 700, 40, { fontSize: 20, color: '#94A3B8', textAlign: 'center' }),
|
|
265
|
+
makeRectEl('l6-btn', 510, 448, 260, 60, '#2563EB', { borderRadius: 30 }),
|
|
266
|
+
makeTextEl('l6-btntxt', 'Get Started Now →', 510, 464, 260, 32, { fontSize: 18, color: '#FFFFFF', fontWeight: 'bold', textAlign: 'center' })
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* 2. Async Pitch Deck 模板 (对应图一、图二 Async Pitch Deck.json / .pptx)
|
|
273
|
+
*/
|
|
274
|
+
const asyncPitchDeckSlides = [
|
|
275
|
+
{
|
|
276
|
+
id: 'async-s1',
|
|
277
|
+
title: '01 · Async Pitch Deck Cover',
|
|
278
|
+
background: '#F8F8F9',
|
|
279
|
+
bgType: 'color',
|
|
280
|
+
showMasterElements: false,
|
|
281
|
+
elements: [
|
|
282
|
+
makeRectEl('a1-line', 96, 152, 168, 3, '#A78BFA'),
|
|
283
|
+
makeTextEl('a1-comp', 'Company name', 96, 168, 360, 40, { fontSize: 24, color: '#18181B' }),
|
|
284
|
+
makeTextEl('a1-title', 'Pitch\nDeck', 96, 360, 480, 240, { fontSize: 96, color: '#111827', fontWeight: 'bold', lineHeight: 1.05 }),
|
|
285
|
+
// Right phone mockup & floating purple card (matching user screenshot)
|
|
286
|
+
makeRectEl('a1-phone-border', 780, 120, 360, 580, '#111827', { borderRadius: 44 }),
|
|
287
|
+
makeRectEl('a1-phone-screen', 794, 134, 332, 552, '#FFFFFF', { borderRadius: 34 }),
|
|
288
|
+
makeRectEl('a1-pie', 870, 330, 180, 180, '#6366F1', {
|
|
289
|
+
circle: true,
|
|
290
|
+
gradient: {
|
|
291
|
+
type: 'linear',
|
|
292
|
+
path: 'line',
|
|
293
|
+
rot: 45,
|
|
294
|
+
colors: [
|
|
295
|
+
{ pos: '0%', color: '#4F46E5' },
|
|
296
|
+
{ pos: '100%', color: '#C4B5FD' }
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
}),
|
|
300
|
+
makeRectEl('a1-card', 640, 290, 210, 230, '#5B3DF5', { borderRadius: 16 }),
|
|
301
|
+
makeTextEl('a1-card-txt', 'April 20, 2032', 660, 390, 170, 32, { fontSize: 16, color: '#FFFFFF', fontWeight: 'bold', textAlign: 'center' })
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
id: 'async-s2',
|
|
306
|
+
title: '02 · Section Divider',
|
|
307
|
+
background: '#5B3DF5',
|
|
308
|
+
bgType: 'color',
|
|
309
|
+
showMasterElements: false,
|
|
310
|
+
elements: [
|
|
311
|
+
makeRectEl('a2-badge', 610, 130, 60, 60, '#FFFFFF', { borderRadius: 12 }),
|
|
312
|
+
makeTextEl('a2-title', 'Pitch Deck', 96, 500, 700, 110, { fontSize: 76, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
313
|
+
makeTextEl('a2-sub', '2026 Investor Overview', 980, 560, 220, 32, { fontSize: 16, color: '#DDD6FE', textAlign: 'right' })
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
id: 'async-s3',
|
|
318
|
+
title: '03 · Executive Summary',
|
|
319
|
+
background: '#5B3DF5',
|
|
320
|
+
bgType: 'color',
|
|
321
|
+
showMasterElements: false,
|
|
322
|
+
elements: [
|
|
323
|
+
makeRectEl('a3-card', 80, 70, 540, 580, '#FFFFFF', { borderRadius: 28 }),
|
|
324
|
+
makeTextEl('a3-h', 'What we are\nbuilding &\nwhy now', 136, 150, 420, 240, { fontSize: 52, color: '#5B3DF5', fontWeight: 'bold', lineHeight: 1.15 }),
|
|
325
|
+
makeTextEl('a3-b1', '01 · Distributed teams need async-first storytelling tools.', 690, 160, 500, 80, { fontSize: 22, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
326
|
+
makeTextEl('a3-b2', '02 · 84% of decision makers review decks before live meetings.', 690, 290, 500, 80, { fontSize: 22, color: '#DDD6FE', fontWeight: 'bold' }),
|
|
327
|
+
makeTextEl('a3-b3', '03 · Interactive analytics turn static slides into conversion pipelines.', 690, 420, 500, 80, { fontSize: 22, color: '#DDD6FE', fontWeight: 'bold' })
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: 'async-s4',
|
|
332
|
+
title: '04 · Four Pillars Overview',
|
|
333
|
+
background: '#F8F8F9',
|
|
334
|
+
bgType: 'color',
|
|
335
|
+
showMasterElements: false,
|
|
336
|
+
elements: [
|
|
337
|
+
makeRectEl('a4-c1', 80, 120, 260, 480, '#FFFFFF', { borderRadius: 16, borderColor: '#E4E4E7', borderWidth: 1 }),
|
|
338
|
+
makeRectEl('a4-c2', 368, 120, 260, 480, '#5B3DF5', { borderRadius: 16 }),
|
|
339
|
+
makeRectEl('a4-c3', 656, 120, 260, 480, '#FFFFFF', { borderRadius: 16, borderColor: '#E4E4E7', borderWidth: 1 }),
|
|
340
|
+
makeRectEl('a4-c4', 944, 120, 256, 480, '#FFFFFF', { borderRadius: 16, borderColor: '#E4E4E7', borderWidth: 1 }),
|
|
341
|
+
makeRectEl('a4-img1', 100, 144, 220, 220, '#E2E8F0', { borderRadius: 12 }),
|
|
342
|
+
makeRectEl('a4-img3', 676, 144, 220, 220, '#E2E8F0', { borderRadius: 12 }),
|
|
343
|
+
makeRectEl('a4-img4', 964, 144, 216, 220, '#E2E8F0', { borderRadius: 12 }),
|
|
344
|
+
makeTextEl('a4-t1', 'Problem', 104, 420, 200, 40, { fontSize: 24, color: '#18181B', fontWeight: 'bold' }),
|
|
345
|
+
makeTextEl('a4-t2', 'Solution', 392, 420, 200, 40, { fontSize: 24, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
346
|
+
makeTextEl('a4-t3', 'Product', 680, 420, 200, 40, { fontSize: 24, color: '#18181B', fontWeight: 'bold' }),
|
|
347
|
+
makeTextEl('a4-t4', 'Business', 968, 420, 200, 40, { fontSize: 24, color: '#18181B', fontWeight: 'bold' })
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
id: 'async-s5',
|
|
352
|
+
title: '05 · Traction & ARR Growth',
|
|
353
|
+
background: '#FFFFFF',
|
|
354
|
+
bgType: 'color',
|
|
355
|
+
showMasterElements: false,
|
|
356
|
+
elements: [
|
|
357
|
+
makeTextEl('a5-tag', 'TRACTION', 96, 80, 240, 28, { fontSize: 14, color: '#5B3DF5', fontWeight: 'bold' }),
|
|
358
|
+
makeTextEl('a5-title', '$4.8M ARR with 142% Net Dollar Retention', 96, 118, 900, 64, { fontSize: 42, color: '#111827', fontWeight: 'bold' }),
|
|
359
|
+
makeRectEl('a5-bar1', 140, 480, 140, 140, '#EDE9FE', { borderRadius: 12 }),
|
|
360
|
+
makeRectEl('a5-bar2', 340, 410, 140, 210, '#DDD6FE', { borderRadius: 12 }),
|
|
361
|
+
makeRectEl('a5-bar3', 540, 330, 140, 290, '#C4B5FD', { borderRadius: 12 }),
|
|
362
|
+
makeRectEl('a5-bar4', 740, 250, 140, 370, '#8B5CF6', { borderRadius: 12 }),
|
|
363
|
+
makeRectEl('a5-bar5', 940, 160, 140, 460, '#5B3DF5', { borderRadius: 12 }),
|
|
364
|
+
makeTextEl('a5-l1', 'Q1', 140, 634, 140, 28, { fontSize: 16, color: '#64748B', textAlign: 'center' }),
|
|
365
|
+
makeTextEl('a5-l2', 'Q2', 340, 634, 140, 28, { fontSize: 16, color: '#64748B', textAlign: 'center' }),
|
|
366
|
+
makeTextEl('a5-l3', 'Q3', 540, 634, 140, 28, { fontSize: 16, color: '#64748B', textAlign: 'center' }),
|
|
367
|
+
makeTextEl('a5-l4', 'Q4', 740, 634, 140, 28, { fontSize: 16, color: '#64748B', textAlign: 'center' }),
|
|
368
|
+
makeTextEl('a5-l5', 'Q1 (E)', 940, 634, 140, 28, { fontSize: 16, color: '#5B3DF5', fontWeight: 'bold', textAlign: 'center' })
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
id: 'async-s6',
|
|
373
|
+
title: '06 · The Ask & Use of Funds',
|
|
374
|
+
background: '#18181B',
|
|
375
|
+
bgType: 'color',
|
|
376
|
+
showMasterElements: false,
|
|
377
|
+
elements: [
|
|
378
|
+
makeTextEl('a6-tag', 'SERIES A ROUND', 96, 96, 300, 28, { fontSize: 14, color: '#A78BFA', fontWeight: 'bold' }),
|
|
379
|
+
makeTextEl('a6-title', 'Raising $12M to scale global enterprise GTM', 96, 138, 860, 110, { fontSize: 48, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
380
|
+
makeRectEl('a6-b1', 96, 300, 340, 280, '#27272A', { borderRadius: 20 }),
|
|
381
|
+
makeRectEl('a6-b2', 470, 300, 340, 280, '#5B3DF5', { borderRadius: 20 }),
|
|
382
|
+
makeRectEl('a6-b3', 844, 300, 340, 280, '#27272A', { borderRadius: 20 }),
|
|
383
|
+
makeTextEl('a6-p1', '45%', 136, 344, 200, 64, { fontSize: 48, color: '#A78BFA', fontWeight: 'bold' }),
|
|
384
|
+
makeTextEl('a6-d1', 'R&D and AI Engine Engineering', 136, 430, 260, 80, { fontSize: 18, color: '#E4E4E7' }),
|
|
385
|
+
makeTextEl('a6-p2', '35%', 510, 344, 200, 64, { fontSize: 48, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
386
|
+
makeTextEl('a6-d2', 'Enterprise Sales & Marketing Expansion', 510, 430, 260, 80, { fontSize: 18, color: '#EDE9FE' }),
|
|
387
|
+
makeTextEl('a6-p3', '20%', 884, 344, 200, 64, { fontSize: 48, color: '#A78BFA', fontWeight: 'bold' }),
|
|
388
|
+
makeTextEl('a6-d3', 'Operations & International Customer Success', 884, 430, 260, 80, { fontSize: 18, color: '#E4E4E7' })
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
]
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* 3. Pitch Deck 模板 (对应图二 Pitch Deck.json / Pitch Deck.pptx)
|
|
395
|
+
*/
|
|
396
|
+
const pitchDeckSlides = [
|
|
397
|
+
{
|
|
398
|
+
id: 'pd-s1',
|
|
399
|
+
title: '01 · Pitch Deck Cover',
|
|
400
|
+
background: '#0F172A',
|
|
401
|
+
bgType: 'color',
|
|
402
|
+
showMasterElements: false,
|
|
403
|
+
elements: [
|
|
404
|
+
makeRectEl('p1-glow', 720, -60, 620, 620, '#4F46E5', {
|
|
405
|
+
circle: true,
|
|
406
|
+
gradient: {
|
|
407
|
+
type: 'linear',
|
|
408
|
+
path: 'line',
|
|
409
|
+
rot: 135,
|
|
410
|
+
colors: [
|
|
411
|
+
{ pos: '0%', color: '#6366F1' },
|
|
412
|
+
{ pos: '100%', color: '#EC4899' }
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
}),
|
|
416
|
+
makeTextEl('p1-badge', 'INVESTOR PRESENTATION · 2026', 96, 120, 420, 28, { fontSize: 14, color: '#818CF8', fontWeight: 'bold' }),
|
|
417
|
+
makeTextEl('p1-title', 'Next-Gen Cloud\nIntelligence', 96, 180, 720, 180, { fontSize: 64, color: '#FFFFFF', fontWeight: 'bold', lineHeight: 1.15 }),
|
|
418
|
+
makeTextEl('p1-sub', 'Transforming raw operational telemetry into autonomous decisions.', 96, 390, 580, 64, { fontSize: 20, color: '#94A3B8' }),
|
|
419
|
+
makeRectEl('p1-tagbox', 96, 540, 220, 48, '#1E293B', { borderRadius: 24, borderColor: '#334155', borderWidth: 1 }),
|
|
420
|
+
makeTextEl('p1-tagtxt', 'Series B · Pitch Deck', 96, 553, 220, 24, { fontSize: 14, color: '#E2E8F0', textAlign: 'center' })
|
|
421
|
+
]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
id: 'pd-s2',
|
|
425
|
+
title: '02 · The Problem',
|
|
426
|
+
background: '#FFFFFF',
|
|
427
|
+
bgType: 'color',
|
|
428
|
+
showMasterElements: false,
|
|
429
|
+
elements: [
|
|
430
|
+
makeTextEl('p2-kicker', 'THE PROBLEM', 96, 84, 240, 28, { fontSize: 14, color: '#4F46E5', fontWeight: 'bold' }),
|
|
431
|
+
makeTextEl('p2-title', 'Enterprise data is growing 5x faster than engineering headcount', 96, 124, 960, 110, { fontSize: 42, color: '#0F172A', fontWeight: 'bold' }),
|
|
432
|
+
makeRectEl('p2-c1', 96, 280, 520, 320, '#F8FAFC', { borderRadius: 20, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
433
|
+
makeRectEl('p2-c2', 664, 280, 520, 320, '#EEF2FF', { borderRadius: 20, borderColor: '#C7D2FE', borderWidth: 1 }),
|
|
434
|
+
makeTextEl('p2-n1', '73%', 136, 320, 300, 72, { fontSize: 56, color: '#0F172A', fontWeight: 'bold' }),
|
|
435
|
+
makeTextEl('p2-t1', 'Of collected enterprise logs are never analyzed before expiration due to pipeline cost.', 136, 412, 440, 120, { fontSize: 18, color: '#475569' }),
|
|
436
|
+
makeTextEl('p2-n2', '$4.2M', 704, 320, 300, 72, { fontSize: 56, color: '#4F46E5', fontWeight: 'bold' }),
|
|
437
|
+
makeTextEl('p2-t2', 'Average annual cost of preventable downtime per Fortune 1000 organization.', 704, 412, 440, 120, { fontSize: 18, color: '#3730A3' })
|
|
438
|
+
]
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
id: 'pd-s3',
|
|
442
|
+
title: '03 · Our Solution',
|
|
443
|
+
background: '#F8FAFC',
|
|
444
|
+
bgType: 'color',
|
|
445
|
+
showMasterElements: false,
|
|
446
|
+
elements: [
|
|
447
|
+
makeTextEl('p3-kicker', 'THE SOLUTION', 96, 84, 240, 28, { fontSize: 14, color: '#4F46E5', fontWeight: 'bold' }),
|
|
448
|
+
makeTextEl('p3-title', 'Autonomous observability in three layers', 96, 124, 880, 60, { fontSize: 42, color: '#0F172A', fontWeight: 'bold' }),
|
|
449
|
+
makeRectEl('p3-r1', 96, 224, 1088, 120, '#FFFFFF', { borderRadius: 16, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
450
|
+
makeRectEl('p3-r2', 96, 368, 1088, 120, '#FFFFFF', { borderRadius: 16, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
451
|
+
makeRectEl('p3-r3', 96, 512, 1088, 120, '#4F46E5', { borderRadius: 16 }),
|
|
452
|
+
makeTextEl('p3-rt1', '01 · Zero-Copy Edge Ingestion', 136, 264, 420, 40, { fontSize: 24, color: '#0F172A', fontWeight: 'bold' }),
|
|
453
|
+
makeTextEl('p3-rd1', 'Filter and compress telemetry at the edge before cloud egress.', 600, 268, 540, 40, { fontSize: 17, color: '#475569' }),
|
|
454
|
+
makeTextEl('p3-rt2', '02 · Causal Graph Correlation', 136, 408, 420, 40, { fontSize: 24, color: '#0F172A', fontWeight: 'bold' }),
|
|
455
|
+
makeTextEl('p3-rd2', 'Pinpoint root cause across microservices in under 5 seconds.', 600, 412, 540, 40, { fontSize: 17, color: '#475569' }),
|
|
456
|
+
makeTextEl('p3-rt3', '03 · Automated Remediation Agent', 136, 552, 460, 40, { fontSize: 24, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
457
|
+
makeTextEl('p3-rd3', 'Self-healing playbooks that roll back bad deploys automatically.', 600, 556, 540, 40, { fontSize: 17, color: '#E0E7FF' })
|
|
458
|
+
]
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
id: 'pd-s4',
|
|
462
|
+
title: '04 · Market Opportunity (TAM / SAM / SOM)',
|
|
463
|
+
background: '#FFFFFF',
|
|
464
|
+
bgType: 'color',
|
|
465
|
+
showMasterElements: false,
|
|
466
|
+
elements: [
|
|
467
|
+
makeTextEl('p4-kicker', 'MARKET SIZE', 96, 84, 240, 28, { fontSize: 14, color: '#4F46E5', fontWeight: 'bold' }),
|
|
468
|
+
makeTextEl('p4-title', 'A $68B addressable cloud operations market', 96, 124, 880, 60, { fontSize: 42, color: '#0F172A', fontWeight: 'bold' }),
|
|
469
|
+
makeRectEl('p4-c1', 120, 220, 400, 400, '#EEF2FF', { circle: true }),
|
|
470
|
+
makeRectEl('p4-c2', 190, 290, 260, 260, '#C7D2FE', { circle: true }),
|
|
471
|
+
makeRectEl('p4-c3', 250, 350, 140, 140, '#4F46E5', { circle: true }),
|
|
472
|
+
makeTextEl('p4-som', '$3.2B\nSOM', 260, 392, 120, 64, { fontSize: 22, color: '#FFFFFF', fontWeight: 'bold', textAlign: 'center' }),
|
|
473
|
+
makeTextEl('p4-i1', 'TAM · $68B Global Cloud Ops', 620, 250, 520, 40, { fontSize: 24, color: '#0F172A', fontWeight: 'bold' }),
|
|
474
|
+
makeTextEl('p4-id1', 'All enterprise cloud monitoring, APM, and security analytics spend.', 620, 296, 520, 48, { fontSize: 16, color: '#64748B' }),
|
|
475
|
+
makeTextEl('p4-i2', 'SAM · $18B Cloud-Native Enterprises', 620, 380, 520, 40, { fontSize: 24, color: '#3730A3', fontWeight: 'bold' }),
|
|
476
|
+
makeTextEl('p4-id2', 'Organizations running Kubernetes and multi-region microservices.', 620, 426, 520, 48, { fontSize: 16, color: '#64748B' }),
|
|
477
|
+
makeTextEl('p4-i3', 'SOM · $3.2B Core Target Segment', 620, 510, 520, 40, { fontSize: 24, color: '#4F46E5', fontWeight: 'bold' }),
|
|
478
|
+
makeTextEl('p4-id3', 'Mid-to-large FinTech, SaaS, and E-commerce engineering teams.', 620, 556, 520, 48, { fontSize: 16, color: '#64748B' })
|
|
479
|
+
]
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
id: 'pd-s5',
|
|
483
|
+
title: '05 · Founding Team',
|
|
484
|
+
background: '#F8FAFC',
|
|
485
|
+
bgType: 'color',
|
|
486
|
+
showMasterElements: false,
|
|
487
|
+
elements: [
|
|
488
|
+
makeTextEl('p5-title', 'Built by veterans in distributed systems', 96, 84, 880, 60, { fontSize: 42, color: '#0F172A', fontWeight: 'bold' }),
|
|
489
|
+
makeRectEl('p5-m1', 96, 196, 340, 420, '#FFFFFF', { borderRadius: 20, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
490
|
+
makeRectEl('p5-m2', 470, 196, 340, 420, '#FFFFFF', { borderRadius: 20, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
491
|
+
makeRectEl('p5-m3', 844, 196, 340, 420, '#FFFFFF', { borderRadius: 20, borderColor: '#E2E8F0', borderWidth: 1 }),
|
|
492
|
+
makeRectEl('p5-av1', 206, 240, 120, 120, '#DBEAFE', { circle: true }),
|
|
493
|
+
makeRectEl('p5-av2', 580, 240, 120, 120, '#E0E7FF', { circle: true }),
|
|
494
|
+
makeRectEl('p5-av3', 954, 240, 120, 120, '#FCE7F3', { circle: true }),
|
|
495
|
+
makeTextEl('p5-n1', 'Alex Rivera', 126, 392, 280, 36, { fontSize: 22, color: '#0F172A', fontWeight: 'bold', textAlign: 'center' }),
|
|
496
|
+
makeTextEl('p5-r1', 'CEO & Co-Founder\nEx-VP Engineering, CloudScale', 126, 440, 280, 80, { fontSize: 15, color: '#64748B', textAlign: 'center' }),
|
|
497
|
+
makeTextEl('p5-n2', 'Dr. Lin Chen', 500, 392, 280, 36, { fontSize: 22, color: '#0F172A', fontWeight: 'bold', textAlign: 'center' }),
|
|
498
|
+
makeTextEl('p5-r2', 'CTO & Co-Founder\nPhD Distributed Systems, MIT', 500, 440, 280, 80, { fontSize: 15, color: '#64748B', textAlign: 'center' }),
|
|
499
|
+
makeTextEl('p5-n3', 'Sarah Jenkins', 874, 392, 280, 36, { fontSize: 22, color: '#0F172A', fontWeight: 'bold', textAlign: 'center' }),
|
|
500
|
+
makeTextEl('p5-r3', 'CRO\nScaled ARR $2M → $80M at DataPulse', 874, 440, 280, 80, { fontSize: 15, color: '#64748B', textAlign: 'center' })
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
]
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* 4. Remote Learning Lesson Plan 模板 (对应图二 Remote Learning Lesson Plan.json / .pptx)
|
|
507
|
+
*/
|
|
508
|
+
const remoteLearningSlides = [
|
|
509
|
+
{
|
|
510
|
+
id: 'rl-s1',
|
|
511
|
+
title: '01 · Lesson Plan Cover',
|
|
512
|
+
background: '#FFFBEB',
|
|
513
|
+
bgType: 'color',
|
|
514
|
+
showMasterElements: false,
|
|
515
|
+
elements: [
|
|
516
|
+
makeRectEl('r1-blob1', 820, 80, 360, 540, '#FEF3C7', { borderRadius: 32 }),
|
|
517
|
+
makeRectEl('r1-card', 860, 140, 280, 420, '#F59E0B', { borderRadius: 24 }),
|
|
518
|
+
makeTextEl('r1-badge', 'WEEK 04 · INTERACTIVE MODULE', 96, 130, 360, 28, { fontSize: 14, color: '#D97706', fontWeight: 'bold' }),
|
|
519
|
+
makeTextEl('r1-title', 'Remote Learning\nLesson Plan', 96, 184, 680, 170, { fontSize: 60, color: '#1E293B', fontWeight: 'bold', lineHeight: 1.15 }),
|
|
520
|
+
makeTextEl('r1-sub', 'Engaging daily structure, goals, and collaborative exercises for virtual classrooms.', 96, 384, 600, 72, { fontSize: 20, color: '#64748B' }),
|
|
521
|
+
makeRectEl('r1-pill', 96, 510, 240, 48, '#10B981', { borderRadius: 24 }),
|
|
522
|
+
makeTextEl('r1-pilltxt', 'Grade 6–8 · Science', 96, 522, 240, 28, { fontSize: 16, color: '#FFFFFF', fontWeight: 'bold', textAlign: 'center' })
|
|
523
|
+
]
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
id: 'rl-s2',
|
|
527
|
+
title: '02 · Learning Objectives',
|
|
528
|
+
background: '#FFFFFF',
|
|
529
|
+
bgType: 'color',
|
|
530
|
+
showMasterElements: false,
|
|
531
|
+
elements: [
|
|
532
|
+
makeTextEl('r2-tag', 'TODAY’S GOALS', 96, 80, 260, 28, { fontSize: 14, color: '#10B981', fontWeight: 'bold' }),
|
|
533
|
+
makeTextEl('r2-title', 'What students will master today', 96, 118, 820, 60, { fontSize: 42, color: '#1E293B', fontWeight: 'bold' }),
|
|
534
|
+
makeRectEl('r2-c1', 96, 220, 344, 390, '#ECFDF5', { borderRadius: 20 }),
|
|
535
|
+
makeRectEl('r2-c2', 468, 220, 344, 390, '#FFFBEB', { borderRadius: 20 }),
|
|
536
|
+
makeRectEl('r2-c3', 840, 220, 344, 390, '#EFF6FF', { borderRadius: 20 }),
|
|
537
|
+
makeTextEl('r2-n1', 'Goal 01', 132, 264, 200, 36, { fontSize: 22, color: '#059669', fontWeight: 'bold' }),
|
|
538
|
+
makeTextEl('r2-t1', 'Understand core concepts through visual simulation and guided inquiry.', 132, 324, 272, 140, { fontSize: 18, color: '#065F46' }),
|
|
539
|
+
makeTextEl('r2-n2', 'Goal 02', 504, 264, 200, 36, { fontSize: 22, color: '#D97706', fontWeight: 'bold' }),
|
|
540
|
+
makeTextEl('r2-t2', 'Collaborate in small breakout rooms to solve real-world scenarios.', 504, 324, 272, 140, { fontSize: 18, color: '#92400E' }),
|
|
541
|
+
makeTextEl('r2-n3', 'Goal 03', 876, 264, 200, 36, { fontSize: 22, color: '#2563EB', fontWeight: 'bold' }),
|
|
542
|
+
makeTextEl('r2-t3', 'Complete the 5-minute reflection quiz and share key takeaways.', 876, 324, 272, 140, { fontSize: 18, color: '#1E40AF' })
|
|
543
|
+
]
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
id: 'rl-s3',
|
|
547
|
+
title: '03 · 45-Minute Class Schedule',
|
|
548
|
+
background: '#FFFBEB',
|
|
549
|
+
bgType: 'color',
|
|
550
|
+
showMasterElements: false,
|
|
551
|
+
elements: [
|
|
552
|
+
makeTextEl('r3-title', 'Class Schedule & Pacing', 96, 84, 700, 56, { fontSize: 40, color: '#1E293B', fontWeight: 'bold' }),
|
|
553
|
+
makeRectEl('r3-s1', 96, 184, 1088, 104, '#FFFFFF', { borderRadius: 16 }),
|
|
554
|
+
makeRectEl('r3-s2', 96, 308, 1088, 104, '#FFFFFF', { borderRadius: 16 }),
|
|
555
|
+
makeRectEl('r3-s3', 96, 432, 1088, 104, '#FFFFFF', { borderRadius: 16 }),
|
|
556
|
+
makeRectEl('r3-s4', 96, 556, 1088, 104, '#FFFFFF', { borderRadius: 16 }),
|
|
557
|
+
makeTextEl('r3-t1', '00–10 min · Warm-up & Icebreaker Poll', 136, 222, 600, 36, { fontSize: 22, color: '#D97706', fontWeight: 'bold' }),
|
|
558
|
+
makeTextEl('r3-t2', '10–25 min · Core Mini-Lesson & Live Demo', 136, 346, 600, 36, { fontSize: 22, color: '#1E293B', fontWeight: 'bold' }),
|
|
559
|
+
makeTextEl('r3-t3', '25–38 min · Breakout Group Activity', 136, 470, 600, 36, { fontSize: 22, color: '#059669', fontWeight: 'bold' }),
|
|
560
|
+
makeTextEl('r3-t4', '38–45 min · Wrap-up & Exit Ticket', 136, 594, 600, 36, { fontSize: 22, color: '#2563EB', fontWeight: 'bold' })
|
|
561
|
+
]
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
id: 'rl-s4',
|
|
565
|
+
title: '04 · Homework & Resources',
|
|
566
|
+
background: '#065F46',
|
|
567
|
+
bgType: 'color',
|
|
568
|
+
showMasterElements: false,
|
|
569
|
+
elements: [
|
|
570
|
+
makeTextEl('r4-title', 'Before Next Class', 96, 110, 600, 64, { fontSize: 48, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
571
|
+
makeRectEl('r4-box1', 96, 220, 520, 380, '#047857', { borderRadius: 20 }),
|
|
572
|
+
makeRectEl('r4-box2', 664, 220, 520, 380, '#FFFFFF', { borderRadius: 20 }),
|
|
573
|
+
makeTextEl('r4-h1', 'Reading & Practice', 136, 264, 420, 40, { fontSize: 26, color: '#A7F3D0', fontWeight: 'bold' }),
|
|
574
|
+
makeTextEl('r4-p1', '• Read Chapter 4 (pages 42–48)\n• Watch the 6-minute lab video\n• Post 1 question on the class board', 136, 332, 440, 180, { fontSize: 20, color: '#ECFDF5', lineHeight: 1.6 }),
|
|
575
|
+
makeTextEl('r4-h2', 'Need Extra Help?', 704, 264, 420, 40, { fontSize: 26, color: '#065F46', fontWeight: 'bold' }),
|
|
576
|
+
makeTextEl('r4-p2', 'Virtual office hours are open Tuesday & Thursday from 3:30 PM to 4:30 PM.', 704, 332, 440, 180, { fontSize: 20, color: '#334155', lineHeight: 1.6 })
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* 5. Pride and Inclusion Deck (对应图三左上 Pride Every Day)
|
|
583
|
+
*/
|
|
584
|
+
const prideTemplateSlides = [
|
|
585
|
+
{
|
|
586
|
+
id: 'pride-s1',
|
|
587
|
+
title: '01 · Pride Every Day Cover',
|
|
588
|
+
background: 'linear-gradient(135deg, #FCA5A5 0%, #FDE68A 35%, #A7F3D0 70%, #C4B5FD 100%)',
|
|
589
|
+
bgType: 'gradient',
|
|
590
|
+
showMasterElements: false,
|
|
591
|
+
elements: [
|
|
592
|
+
makeTextEl('pr1-top', 'CULTURE & BELONGING', 440, 96, 400, 24, { fontSize: 13, color: '#1E293B', fontWeight: 'bold', textAlign: 'center' }),
|
|
593
|
+
makeTextEl('pr1-title', 'Pride Every Day', 240, 260, 800, 110, { fontSize: 72, color: '#1E1B4B', fontWeight: 'bold', textAlign: 'center' }),
|
|
594
|
+
makeTextEl('pr1-sub', 'Building a workplace where everyone belongs', 390, 560, 500, 56, { fontSize: 18, color: '#312E81', textAlign: 'center' })
|
|
595
|
+
]
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
id: 'pride-s2',
|
|
599
|
+
title: '02 · Inclusive Values',
|
|
600
|
+
background: '#FAF5FF',
|
|
601
|
+
bgType: 'color',
|
|
602
|
+
showMasterElements: false,
|
|
603
|
+
elements: [
|
|
604
|
+
makeTextEl('pr2-title', 'Our Core Inclusion Commitments', 96, 92, 860, 60, { fontSize: 42, color: '#1E1B4B', fontWeight: 'bold' }),
|
|
605
|
+
makeRectEl('pr2-c1', 96, 210, 344, 390, '#FFFFFF', { borderRadius: 20, borderColor: '#E9D5FF', borderWidth: 1 }),
|
|
606
|
+
makeRectEl('pr2-c2', 468, 210, 344, 390, '#FFFFFF', { borderRadius: 20, borderColor: '#E9D5FF', borderWidth: 1 }),
|
|
607
|
+
makeRectEl('pr2-c3', 840, 210, 344, 390, '#FFFFFF', { borderRadius: 20, borderColor: '#E9D5FF', borderWidth: 1 }),
|
|
608
|
+
makeTextEl('pr2-h1', 'Equal Voice', 132, 264, 272, 40, { fontSize: 24, color: '#6D28D9', fontWeight: 'bold' }),
|
|
609
|
+
makeTextEl('pr2-d1', ' psychological safety and open dialogue across every team.', 132, 326, 272, 140, { fontSize: 17, color: '#475569' }),
|
|
610
|
+
makeTextEl('pr2-h2', 'Inclusive Benefits', 504, 264, 272, 40, { fontSize: 24, color: '#DB2777', fontWeight: 'bold' }),
|
|
611
|
+
makeTextEl('pr2-d2', 'Comprehensive healthcare and family support for all employees.', 504, 326, 272, 140, { fontSize: 17, color: '#475569' }),
|
|
612
|
+
makeTextEl('pr2-h3', 'Community ERGs', 876, 264, 272, 40, { fontSize: 24, color: '#059669', fontWeight: 'bold' }),
|
|
613
|
+
makeTextEl('pr2-d3', 'Funded employee resource groups and mentorship programs.', 876, 326, 272, 140, { fontSize: 17, color: '#475569' })
|
|
614
|
+
]
|
|
615
|
+
}
|
|
616
|
+
]
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* 6. AI Software Sales Deck (对应图三右上 AI Software Sales)
|
|
620
|
+
*/
|
|
621
|
+
const aiSalesTemplateSlides = [
|
|
622
|
+
{
|
|
623
|
+
id: 'ais-s1',
|
|
624
|
+
title: '01 · AI Software Sales Cover',
|
|
625
|
+
background: 'linear-gradient(135deg, #134E4A 0%, #064E3B 55%, #022C22 100%)',
|
|
626
|
+
bgType: 'gradient',
|
|
627
|
+
showMasterElements: false,
|
|
628
|
+
elements: [
|
|
629
|
+
makeRectEl('ais1-logo', 88, 76, 72, 36, '#FFFFFF', { borderRadius: 6 }),
|
|
630
|
+
makeTextEl('ais1-logotxt', 'LOGO', 88, 84, 72, 20, { fontSize: 12, color: '#064E3B', fontWeight: 'bold', textAlign: 'center' }),
|
|
631
|
+
makeTextEl('ais1-title', 'AI Software Sales', 88, 460, 820, 100, { fontSize: 64, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
632
|
+
makeTextEl('ais1-sub', 'ENTERPRISE REVENUE AUTOMATION SUITE', 88, 590, 500, 28, { fontSize: 14, color: '#6EE7B7', fontWeight: 'bold' })
|
|
633
|
+
]
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
id: 'ais-s2',
|
|
637
|
+
title: '02 · ROI & Efficiency Gains',
|
|
638
|
+
background: '#022C22',
|
|
639
|
+
bgType: 'color',
|
|
640
|
+
showMasterElements: false,
|
|
641
|
+
elements: [
|
|
642
|
+
makeTextEl('ais2-title', 'Why Revenue Teams Switch to AI Copilot', 88, 88, 900, 60, { fontSize: 40, color: '#FFFFFF', fontWeight: 'bold' }),
|
|
643
|
+
makeRectEl('ais2-c1', 88, 200, 530, 400, '#064E3B', { borderRadius: 20 }),
|
|
644
|
+
makeRectEl('ais2-c2', 662, 200, 530, 400, '#065F46', { borderRadius: 20 }),
|
|
645
|
+
makeTextEl('ais2-m1', '+42% Win Rate', 132, 260, 440, 64, { fontSize: 48, color: '#34D399', fontWeight: 'bold' }),
|
|
646
|
+
makeTextEl('ais2-d1', 'Real-time objection handling and automated deal coaching on every call.', 132, 356, 440, 120, { fontSize: 19, color: '#D1FAE5' }),
|
|
647
|
+
makeTextEl('ais2-m2', '11 hrs / week', 706, 260, 440, 64, { fontSize: 48, color: '#A7F3D0', fontWeight: 'bold' }),
|
|
648
|
+
makeTextEl('ais2-d2', 'Saved per account executive through instant CRM sync and follow-up drafting.', 706, 356, 440, 120, { fontSize: 19, color: '#D1FAE5' })
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
]
|
|
652
|
+
|
|
653
|
+
const defaultBuiltinTemplateList: SlideTemplateItem[] = [
|
|
654
|
+
{
|
|
655
|
+
id: 'tpl-launch',
|
|
656
|
+
name: 'Launch',
|
|
657
|
+
fileName: 'Launch.json',
|
|
658
|
+
category: 'Product',
|
|
659
|
+
slidesCount: 35,
|
|
660
|
+
jsonUrl: '/templates/' + encodeURIComponent('Launch.json'),
|
|
661
|
+
slides: [launchTemplateSlides[0]],
|
|
662
|
+
loaded: false
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
id: 'tpl-async-pitch-deck',
|
|
666
|
+
name: 'Async Pitch Deck',
|
|
667
|
+
fileName: 'Async Pitch Deck.json',
|
|
668
|
+
category: 'Pitch',
|
|
669
|
+
slidesCount: 61,
|
|
670
|
+
jsonUrl: '/templates/' + encodeURIComponent('Async Pitch Deck.json'),
|
|
671
|
+
slides: [asyncPitchDeckSlides[0]],
|
|
672
|
+
loaded: false
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
id: 'tpl-pitch-deck',
|
|
676
|
+
name: 'Pitch Deck',
|
|
677
|
+
fileName: 'Pitch Deck.json',
|
|
678
|
+
category: 'Pitch',
|
|
679
|
+
slidesCount: 43,
|
|
680
|
+
jsonUrl: '/templates/' + encodeURIComponent('Pitch Deck.json'),
|
|
681
|
+
slides: [pitchDeckSlides[0]],
|
|
682
|
+
loaded: false
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
id: 'tpl-remote-learning-lesson-plan',
|
|
686
|
+
name: 'Remote Learning Lesson Plan',
|
|
687
|
+
fileName: 'Remote Learning Lesson Plan.json',
|
|
688
|
+
category: 'Education',
|
|
689
|
+
slidesCount: 30,
|
|
690
|
+
jsonUrl: '/templates/' + encodeURIComponent('Remote Learning Lesson Plan.json'),
|
|
691
|
+
slides: [remoteLearningSlides[0]],
|
|
692
|
+
loaded: false
|
|
693
|
+
}
|
|
694
|
+
]
|
|
695
|
+
|
|
696
|
+
export const builtinSlideTemplates = reactive<SlideTemplateItem[]>(
|
|
697
|
+
defaultBuiltinTemplateList.map(item => ({ ...item, slides: [...item.slides] }))
|
|
698
|
+
)
|
|
699
|
+
|
|
700
|
+
export const customTemplateBaseUrl = ref<string>('')
|
|
701
|
+
let customTemplatesProvided = false
|
|
702
|
+
let firstPageIndexPromise: Promise<void> | null = null
|
|
703
|
+
let firstPageIndexLoaded = false
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* 当宿主配置了非默认的 templateBaseUrl(如 '/ppt-templates' 或 'https://cdn.example.com/ppt')时,
|
|
707
|
+
* 自动将模板 JSON 内默认写死的 '/templates/image/...'、'/templates/mp4/...'、'/templates/mp3/...' 替换为目标前缀
|
|
708
|
+
*/
|
|
709
|
+
export function rewriteSlideTemplateAssetUrls(slide: any, baseUrl?: string): any {
|
|
710
|
+
const base = (baseUrl !== undefined ? baseUrl : customTemplateBaseUrl.value || '').trim().replace(/\/+$/, '')
|
|
711
|
+
if (!slide || typeof slide !== 'object' || !base || base === '/templates') return slide
|
|
712
|
+
|
|
713
|
+
const replaceUrl = (val: any): any => {
|
|
714
|
+
if (typeof val !== 'string') return val
|
|
715
|
+
if (val.startsWith('/templates/')) {
|
|
716
|
+
return `${base}/${val.slice('/templates/'.length)}`
|
|
717
|
+
}
|
|
718
|
+
return val.replace(/url\((['"]?)\/templates\//g, `url($1${base}/`)
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
if (typeof slide.background === 'string') {
|
|
722
|
+
slide.background = replaceUrl(slide.background)
|
|
723
|
+
} else if (slide.background && typeof slide.background === 'object' && slide.background.image?.src) {
|
|
724
|
+
slide.background.image.src = replaceUrl(slide.background.image.src)
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
const walkElements = (elements: any[]) => {
|
|
728
|
+
if (!Array.isArray(elements)) return
|
|
729
|
+
for (const el of elements) {
|
|
730
|
+
if (!el || typeof el !== 'object') continue
|
|
731
|
+
if (typeof el.src === 'string') el.src = replaceUrl(el.src)
|
|
732
|
+
if (typeof el.content === 'string' && (el.type === 'image' || el.type === 'video' || el.type === 'audio' || el.content.startsWith('/templates/'))) {
|
|
733
|
+
el.content = replaceUrl(el.content)
|
|
734
|
+
}
|
|
735
|
+
if (typeof el.poster === 'string') el.poster = replaceUrl(el.poster)
|
|
736
|
+
if (el.style && typeof el.style.backgroundImage === 'string') {
|
|
737
|
+
el.style.backgroundImage = replaceUrl(el.style.backgroundImage)
|
|
738
|
+
}
|
|
739
|
+
if (Array.isArray(el.elements)) {
|
|
740
|
+
walkElements(el.elements)
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
if (Array.isArray(slide.elements)) {
|
|
746
|
+
walkElements(slide.elements)
|
|
747
|
+
}
|
|
748
|
+
return slide
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* 将宿主传入的任意模板项规范化为标准 SlideTemplateItem
|
|
753
|
+
*/
|
|
754
|
+
export function normalizeTemplateInput(raw: SlideTemplateInput | string, idx = 0): SlideTemplateItem {
|
|
755
|
+
if (typeof raw === 'string') {
|
|
756
|
+
return parseTemplateJsonToDeck(raw, `自定义模板 ${idx + 1}`)
|
|
757
|
+
}
|
|
758
|
+
if (!raw || typeof raw !== 'object') {
|
|
759
|
+
throw new Error('无效的模板数据格式')
|
|
760
|
+
}
|
|
761
|
+
if (isPitchTemplateData(raw)) {
|
|
762
|
+
const converted = convertPitchTemplateToDeck(raw)
|
|
763
|
+
return parseTemplateJsonToDeck(converted, raw.name || raw.title || `自定义模板 ${idx + 1}`)
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
const rawTitle = (raw.name || raw.title || `自定义模板 ${idx + 1}`).trim()
|
|
767
|
+
const cleanName = rawTitle.replace(/-\d{10,16}$/, '').trim() || rawTitle
|
|
768
|
+
const slides = Array.isArray(raw.slides) ? raw.slides : (Array.isArray(raw.data) ? raw.data : [])
|
|
769
|
+
const firstSlide = raw.firstSlide || slides[0] || null
|
|
770
|
+
const hasRemoteSource = Boolean(raw.jsonUrl || raw.fileName)
|
|
771
|
+
const isAlreadyLoaded = raw.loaded !== undefined
|
|
772
|
+
? Boolean(raw.loaded)
|
|
773
|
+
: (slides.length > 1 || (slides.length === 1 && !hasRemoteSource))
|
|
774
|
+
|
|
775
|
+
const base = customTemplateBaseUrl.value ? customTemplateBaseUrl.value.replace(/\/+$/, '') : '/templates'
|
|
776
|
+
const resolvedJsonUrl = raw.jsonUrl || (raw.fileName ? `${base}/${encodeURIComponent(raw.fileName)}` : undefined)
|
|
777
|
+
|
|
778
|
+
return {
|
|
779
|
+
id: raw.id || `tpl-custom-${idx}-${Date.now().toString(36)}`,
|
|
780
|
+
name: cleanName,
|
|
781
|
+
category: raw.category,
|
|
782
|
+
fileName: raw.fileName,
|
|
783
|
+
jsonUrl: resolvedJsonUrl,
|
|
784
|
+
coverUrl: raw.coverUrl,
|
|
785
|
+
slidesCount: raw.slidesCount || (slides.length > 0 ? slides.length : (firstSlide ? 1 : 0)),
|
|
786
|
+
firstSlide,
|
|
787
|
+
styleRecipes: Array.isArray(raw.styleRecipes) ? raw.styleRecipes : undefined,
|
|
788
|
+
slides: slides.length > 0 ? slides : (firstSlide ? [firstSlide] : []),
|
|
789
|
+
loaded: isAlreadyLoaded
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* 供插件宿主设置或替换模板列表
|
|
795
|
+
*/
|
|
796
|
+
export function setCustomTemplates(
|
|
797
|
+
templates?: SlideTemplateInput[] | null,
|
|
798
|
+
options?: { replaceBuiltin?: boolean; baseUrl?: string }
|
|
799
|
+
) {
|
|
800
|
+
if (options?.baseUrl !== undefined) {
|
|
801
|
+
customTemplateBaseUrl.value = (options.baseUrl || '').trim()
|
|
802
|
+
}
|
|
803
|
+
if (!templates || !Array.isArray(templates)) {
|
|
804
|
+
return
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
const normalized = templates
|
|
808
|
+
.map((item, idx) => {
|
|
809
|
+
try {
|
|
810
|
+
return normalizeTemplateInput(item, idx)
|
|
811
|
+
} catch (e) {
|
|
812
|
+
console.warn('[slideTemplates] 跳过格式不合法的自定义模板项:', e)
|
|
813
|
+
return null
|
|
814
|
+
}
|
|
815
|
+
})
|
|
816
|
+
.filter((item): item is SlideTemplateItem => item !== null)
|
|
817
|
+
|
|
818
|
+
const replaceBuiltin = options?.replaceBuiltin !== false
|
|
819
|
+
if (replaceBuiltin) {
|
|
820
|
+
customTemplatesProvided = true
|
|
821
|
+
builtinSlideTemplates.splice(0, builtinSlideTemplates.length, ...normalized)
|
|
822
|
+
} else {
|
|
823
|
+
customTemplatesProvided = true
|
|
824
|
+
const existingIds = new Set(normalized.map(t => t.id))
|
|
825
|
+
const defaults = defaultBuiltinTemplateList
|
|
826
|
+
.filter(t => !existingIds.has(t.id))
|
|
827
|
+
.map(item => ({ ...item, slides: [...item.slides] }))
|
|
828
|
+
builtinSlideTemplates.splice(0, builtinSlideTemplates.length, ...normalized, ...defaults)
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* 动态追加单个模板到模板库顶部
|
|
834
|
+
*/
|
|
835
|
+
export function addCustomTemplate(template: SlideTemplateInput): SlideTemplateItem {
|
|
836
|
+
const item = normalizeTemplateInput(template, 0)
|
|
837
|
+
const existIdx = builtinSlideTemplates.findIndex(t => t.id === item.id || t.name === item.name)
|
|
838
|
+
if (existIdx !== -1) {
|
|
839
|
+
builtinSlideTemplates.splice(existIdx, 1, item)
|
|
840
|
+
} else {
|
|
841
|
+
builtinSlideTemplates.unshift(item)
|
|
842
|
+
}
|
|
843
|
+
return item
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* 按优先级请求模板 JSON 文件(同时兼容自定义 templateBaseUrl、开发环境、Nginx/Docker 部署及子路径部署)
|
|
848
|
+
*/
|
|
849
|
+
export async function fetchTemplateJsonWithFallback(fileName: string): Promise<any> {
|
|
850
|
+
const encoded = encodeURIComponent(fileName)
|
|
851
|
+
const customBase = customTemplateBaseUrl.value ? customTemplateBaseUrl.value.replace(/\/+$/, '') : ''
|
|
852
|
+
const candidates = [
|
|
853
|
+
...(customBase ? [`${customBase}/${encoded}`] : []),
|
|
854
|
+
`/templates/${encoded}`,
|
|
855
|
+
`./templates/${encoded}`,
|
|
856
|
+
`/jvs-ppt-ui/templates/${encoded}`,
|
|
857
|
+
`/__ppt_template_file?file=${encoded}`
|
|
858
|
+
]
|
|
859
|
+
let lastErr: any = null
|
|
860
|
+
for (const url of candidates) {
|
|
861
|
+
try {
|
|
862
|
+
const res = await fetch(url)
|
|
863
|
+
if (!res.ok) continue
|
|
864
|
+
const contentType = res.headers.get('content-type') || ''
|
|
865
|
+
if (contentType.includes('text/html')) continue
|
|
866
|
+
return await res.json()
|
|
867
|
+
} catch (err) {
|
|
868
|
+
lastErr = err
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
throw lastErr || new Error(`无法加载模板文件: ${fileName}`)
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* 加载抽离出的第一页索引文件 `templates-first-page.json`
|
|
876
|
+
* 一级列表仅渲染模板名称 + 第一页 (`firstSlide`),点击后再按需加载对应模板全部 slider
|
|
877
|
+
*/
|
|
878
|
+
export function ensureTemplatesFirstPageLoaded(): Promise<void> {
|
|
879
|
+
if (customTemplatesProvided || firstPageIndexLoaded) return Promise.resolve()
|
|
880
|
+
if (firstPageIndexPromise) return firstPageIndexPromise
|
|
881
|
+
|
|
882
|
+
firstPageIndexPromise = (async () => {
|
|
883
|
+
try {
|
|
884
|
+
const data = await fetchTemplateJsonWithFallback('templates-first-page.json')
|
|
885
|
+
if (customTemplatesProvided) return
|
|
886
|
+
const list = Array.isArray(data) ? data : (Array.isArray(data?.templates) ? data.templates : [])
|
|
887
|
+
if (list.length === 0) return
|
|
888
|
+
|
|
889
|
+
const base = customTemplateBaseUrl.value ? customTemplateBaseUrl.value.replace(/\/+$/, '') : '/templates'
|
|
890
|
+
const nextTemplates: SlideTemplateItem[] = list.map((item: any, idx: number) => {
|
|
891
|
+
const name = (item.name || item.title || `模板 ${idx + 1}`).trim()
|
|
892
|
+
const fileName = item.fileName || `${name}.json`
|
|
893
|
+
const firstSlide = rewriteSlideTemplateAssetUrls(
|
|
894
|
+
item.firstSlide || (Array.isArray(item.slides) ? item.slides[0] : null),
|
|
895
|
+
base
|
|
896
|
+
)
|
|
897
|
+
return {
|
|
898
|
+
id: item.id || `tpl-${idx}`,
|
|
899
|
+
name,
|
|
900
|
+
category: item.category,
|
|
901
|
+
fileName,
|
|
902
|
+
slidesCount: item.slidesCount || (Array.isArray(item.slides) ? item.slides.length : 1),
|
|
903
|
+
firstSlide,
|
|
904
|
+
jsonUrl: item.jsonUrl || `${base}/${encodeURIComponent(fileName)}`,
|
|
905
|
+
coverUrl: item.coverUrl,
|
|
906
|
+
slides: firstSlide ? [firstSlide] : [],
|
|
907
|
+
loaded: false
|
|
908
|
+
}
|
|
909
|
+
})
|
|
910
|
+
|
|
911
|
+
builtinSlideTemplates.splice(0, builtinSlideTemplates.length, ...nextTemplates)
|
|
912
|
+
firstPageIndexLoaded = true
|
|
913
|
+
} catch (err) {
|
|
914
|
+
console.warn('[slideTemplates] 加载 templates-first-page.json 失败,使用内置兜底封面:', err)
|
|
915
|
+
} finally {
|
|
916
|
+
firstPageIndexPromise = null
|
|
917
|
+
}
|
|
918
|
+
})()
|
|
919
|
+
|
|
920
|
+
return firstPageIndexPromise
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* 轻量克隆单页幻灯片并生成全新 ID(不调用 JSON.stringify,避免大体积 Base64 媒体字符串拷贝或超长崩溃)
|
|
925
|
+
*/
|
|
926
|
+
export function cloneSlideForInsertion(sourceSlide: any): any {
|
|
927
|
+
const uid = () => Date.now().toString(36) + Math.random().toString(36).substring(2, 7)
|
|
928
|
+
|
|
929
|
+
const cloneEl = (el: any): any => {
|
|
930
|
+
if (!el || typeof el !== 'object') return el
|
|
931
|
+
const nextEl: any = {
|
|
932
|
+
...el,
|
|
933
|
+
id: `el_${uid()}`
|
|
934
|
+
}
|
|
935
|
+
// 兼容去重后的模板 JSON:使 src 与 content 共享同一字符串指针(0 额外内存)
|
|
936
|
+
if ((nextEl.type === 'image' || nextEl.type === 'video' || nextEl.type === 'audio') && nextEl.content && !nextEl.src) {
|
|
937
|
+
nextEl.src = nextEl.content
|
|
938
|
+
}
|
|
939
|
+
if (el.style && typeof el.style === 'object') {
|
|
940
|
+
nextEl.style = { ...el.style }
|
|
941
|
+
}
|
|
942
|
+
if (el.gradient && typeof el.gradient === 'object') {
|
|
943
|
+
nextEl.gradient = {
|
|
944
|
+
...el.gradient,
|
|
945
|
+
colors: Array.isArray(el.gradient.colors) ? el.gradient.colors.map((c: any) => ({ ...c })) : undefined
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (Array.isArray(el.elements)) {
|
|
949
|
+
nextEl.elements = el.elements.map(cloneEl)
|
|
950
|
+
}
|
|
951
|
+
return nextEl
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
let clonedBg = sourceSlide?.background
|
|
955
|
+
if (clonedBg && typeof clonedBg === 'object') {
|
|
956
|
+
clonedBg = {
|
|
957
|
+
...clonedBg,
|
|
958
|
+
image: clonedBg.image ? { ...clonedBg.image } : undefined,
|
|
959
|
+
gradient: clonedBg.gradient ? { ...clonedBg.gradient } : undefined
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
return {
|
|
964
|
+
...sourceSlide,
|
|
965
|
+
id: `slide_${uid()}`,
|
|
966
|
+
background: clonedBg,
|
|
967
|
+
elements: Array.isArray(sourceSlide?.elements) ? sourceSlide.elements.map(cloneEl) : []
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* 将外部导入或远端拉取的 JSON 数据解析为标准 SlideTemplateItem
|
|
973
|
+
*/
|
|
974
|
+
export function parseTemplateJsonToDeck(rawData: any, fallbackName = '自定义模板'): SlideTemplateItem {
|
|
975
|
+
let deck = rawData
|
|
976
|
+
if (typeof deck === 'string') {
|
|
977
|
+
deck = JSON.parse(deck)
|
|
978
|
+
}
|
|
979
|
+
if (isPitchTemplateData(deck)) {
|
|
980
|
+
deck = convertPitchTemplateToDeck(deck)
|
|
981
|
+
}
|
|
982
|
+
const slides = Array.isArray(deck) ? deck : (deck?.slides || deck?.data || [])
|
|
983
|
+
if (!Array.isArray(slides) || slides.length === 0) {
|
|
984
|
+
throw new Error('该 JSON 文件中未包含有效的幻灯片列表 (slides)')
|
|
985
|
+
}
|
|
986
|
+
slides.forEach((s: any) => rewriteSlideTemplateAssetUrls(s))
|
|
987
|
+
|
|
988
|
+
// 清洗形如 "Launch-1794452735159" 的时间戳后缀,还原干净模板名
|
|
989
|
+
const rawTitle = (deck?.title || fallbackName || '自定义模板').trim()
|
|
990
|
+
const cleanName = rawTitle.replace(/-\d{10,16}$/, '').trim() || rawTitle
|
|
991
|
+
|
|
992
|
+
return {
|
|
993
|
+
id: `tpl-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
994
|
+
name: cleanName,
|
|
995
|
+
slidesCount: slides.length,
|
|
996
|
+
firstSlide: slides[0],
|
|
997
|
+
styleRecipes: Array.isArray(deck?.styleRecipes) ? deck.styleRecipes : undefined,
|
|
998
|
+
slides,
|
|
999
|
+
loaded: true
|
|
1000
|
+
}
|
|
1001
|
+
}
|