dsh-ppt 0.24.2 → 0.26.0
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/CHANGELOG.md +16 -0
- package/README.en.md +13 -13
- package/README.md +13 -13
- package/docs/DATA.md +2 -2
- package/docs/REFERENCE.en.md +8 -8
- package/docs/REFERENCE.zh.md +8 -8
- package/docs/USAGE.en.md +11 -7
- package/docs/USAGE.md +11 -7
- package/docs/VALIDATION.md +4 -0
- package/docs/WORKBENCH.md +4 -4
- package/docs/assets/intro/workflow-en-dark.svg +1 -1
- package/docs/assets/intro/workflow-en-light.svg +1 -1
- package/docs/assets/intro/workflow-en-mobile-dark.svg +1 -1
- package/docs/assets/intro/workflow-en-mobile-light.svg +1 -1
- package/docs/assets/intro/workflow-zh-dark.svg +1 -1
- package/docs/assets/intro/workflow-zh-light.svg +1 -1
- package/docs/assets/intro/workflow-zh-mobile-dark.svg +1 -1
- package/docs/assets/intro/workflow-zh-mobile-light.svg +1 -1
- package/lib/client.js +3435 -467
- package/lib/ecosystem.d.ts +73 -0
- package/lib/ecosystem.js +1352 -0
- package/lib/execution.d.ts +6 -1
- package/lib/execution.js +69 -0
- package/lib/tools.js +77 -0
- package/lib/types.d.ts +57 -1
- package/lib/workbench-language.js +4 -0
- package/lib/workbench.d.ts +2 -0
- package/lib/workbench.js +331 -8
- package/package.json +1 -1
- package/skills/dsh-ppt/SKILL.md +3 -3
- package/skills/dsh-ppt/package.json +1 -1
- package/skills/dsh-ppt/references/advanced.md +10 -5
- package/skills/dsh-ppt/references/syntax.md +1 -0
- package/skills/dsh-ppt/scripts/build-deck.mjs +39 -8
- package/skills/dsh-ppt/scripts/deck-advanced.mjs +50 -13
- package/skills/dsh-ppt/scripts/deck-chrome.mjs +1706 -0
- package/skills/dsh-ppt/scripts/deck-core.mjs +116 -6
- package/skills/dsh-ppt/scripts/deck-delivery.mjs +636 -41
- package/skills/dsh-ppt/scripts/deck-diagrams.mjs +2842 -0
- package/skills/dsh-ppt/scripts/deck-director.mjs +49 -3
- package/skills/dsh-ppt/scripts/deck-layouts.mjs +482 -5270
- package/skills/dsh-ppt/scripts/deck-mermaid.mjs +2737 -0
- package/skills/dsh-ppt/scripts/deck-office.mjs +1541 -0
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
import { basename } from 'node:path'
|
|
2
|
+
import { deriveBrandedTheme, resolveTheme, relativeLuminance } from './deck-themes.mjs'
|
|
3
|
+
import { renderChartSvg } from './deck-media.mjs'
|
|
4
|
+
import { renderMermaidHtml, MERMAID_CSS } from './deck-mermaid.mjs'
|
|
5
|
+
import { latexToMathMl } from './deck-math.mjs'
|
|
2
6
|
|
|
3
7
|
const escape = value => String(value ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c])
|
|
4
8
|
|
|
9
|
+
const VISUAL_DIAGRAM_LAYOUTS = new Set([
|
|
10
|
+
'chart', 'chart-split', 'table', 'gantt', 'architecture', 'harvey',
|
|
11
|
+
'tam', 'org', 'marimekko', 'sankey', 'value-chain', 'swot',
|
|
12
|
+
'process', 'matrix', 'mermaid', 'flowchart', 'sequence',
|
|
13
|
+
'image', 'image-left', 'image-right', 'gallery',
|
|
14
|
+
])
|
|
15
|
+
|
|
5
16
|
function cleanLine(value) {
|
|
6
17
|
return String(value ?? '').replace(/\s+/g, ' ').trim()
|
|
7
18
|
}
|
|
8
19
|
|
|
20
|
+
function stripMd(value) {
|
|
21
|
+
return cleanLine(String(value ?? '').replace(/\*\*([^*]+)\*\*/g, '$1').replace(/`([^`]+)`/g, '$1'))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function collectSlideCopy(slide) {
|
|
25
|
+
const parts = [
|
|
26
|
+
slide?.title,
|
|
27
|
+
slide?.subtitle,
|
|
28
|
+
slide?.takeaway,
|
|
29
|
+
slide?.text,
|
|
30
|
+
...(Array.isArray(slide?.bullets) ? slide.bullets : []),
|
|
31
|
+
]
|
|
32
|
+
if (Array.isArray(slide?.items)) {
|
|
33
|
+
for (const it of slide.items) {
|
|
34
|
+
if (!it || typeof it !== 'object') continue
|
|
35
|
+
parts.push(it.tag, it.title, it.value, it.unit, it.delta, it.text)
|
|
36
|
+
if (Array.isArray(it.bullets)) parts.push(...it.bullets)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return parts.filter(Boolean).map(stripMd).join(' ')
|
|
40
|
+
}
|
|
41
|
+
|
|
9
42
|
function slideCueLines(slide) {
|
|
10
43
|
const cues = []
|
|
11
44
|
if (typeof slide?.takeaway === 'string' && slide.takeaway.trim()) {
|
|
@@ -30,23 +63,113 @@ function slideCueLines(slide) {
|
|
|
30
63
|
return cues.join('\n')
|
|
31
64
|
}
|
|
32
65
|
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
66
|
+
function hasVisualComprehensionLoad(slide) {
|
|
67
|
+
if (!slide) return false
|
|
68
|
+
if (slide.chart || (Array.isArray(slide.rows) && slide.rows.length > 0)) return true
|
|
69
|
+
if (typeof slide.mermaid === 'string' && slide.mermaid.trim()) return true
|
|
70
|
+
return VISUAL_DIAGRAM_LAYOUTS.has(slide.layout)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Deterministic Speaking-Pace Time Budgeter.
|
|
75
|
+
* Computes per-slide seconds at 220 CJK chars/min + 145 EN words/min from `notes`
|
|
76
|
+
* (falling back to slide copy) plus +12s visual comprehension for charts/tables/diagrams.
|
|
77
|
+
* @param {object} manifest
|
|
78
|
+
* @param {number} [targetMinutes]
|
|
79
|
+
*/
|
|
80
|
+
export function computePaceBudget(manifest, targetMinutes) {
|
|
81
|
+
const slides = Array.isArray(manifest?.slides) ? manifest.slides : []
|
|
82
|
+
const rawTarget = targetMinutes ?? manifest?.targetMinutes
|
|
83
|
+
const explicitTarget = Number.isFinite(Number(rawTarget)) && Number(rawTarget) > 0
|
|
84
|
+
? Number(rawTarget)
|
|
85
|
+
: undefined
|
|
86
|
+
|
|
87
|
+
const rawEntries = slides.map((slide, i) => {
|
|
88
|
+
const rawNotes = cleanLine(slide?.notes)
|
|
89
|
+
const usedNotes = rawNotes.length > 0
|
|
90
|
+
const text = usedNotes ? stripMd(rawNotes) : collectSlideCopy(slide)
|
|
91
|
+
const cjkChars = (text.match(/[\u3400-\u9fff]/g) || []).length
|
|
92
|
+
const latinWords = (text.replace(/[\u3400-\u9fff]/g, ' ').match(/[A-Za-z0-9]+/g) || []).length
|
|
93
|
+
const speechSeconds = (cjkChars / 220) * 60 + (latinWords / 145) * 60
|
|
94
|
+
const visualBonusSeconds = hasVisualComprehensionLoad(slide) ? 12 : 0
|
|
95
|
+
const isFraming = ['cover', 'closing', 'section'].includes(slide?.layout)
|
|
96
|
+
const floorSeconds = isFraming ? 15 : 22
|
|
97
|
+
const seconds = Math.max(floorSeconds, Math.round(speechSeconds + visualBonusSeconds))
|
|
98
|
+
return {
|
|
99
|
+
slide: i + 1,
|
|
100
|
+
id: slide?.id,
|
|
101
|
+
title: cleanLine(slide?.title) || `Slide ${i + 1}`,
|
|
102
|
+
layout: slide?.layout || 'bullets',
|
|
103
|
+
source: usedNotes ? 'notes' : 'copy',
|
|
104
|
+
cjkChars,
|
|
105
|
+
latinWords,
|
|
106
|
+
visualBonusSeconds,
|
|
107
|
+
seconds,
|
|
108
|
+
isFraming,
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
const estimatedSeconds = rawEntries.reduce((sum, e) => sum + e.seconds, 0)
|
|
113
|
+
const effectiveTargetMinutes = explicitTarget ?? Math.max(1, Math.round(estimatedSeconds / 60))
|
|
114
|
+
const targetSeconds = Math.round(effectiveTargetMinutes * 60)
|
|
115
|
+
const slideCount = Math.max(1, slides.length)
|
|
116
|
+
const targetSliceSeconds = targetSeconds / slideCount
|
|
117
|
+
const scaleFactor = estimatedSeconds > 0 ? targetSeconds / estimatedSeconds : 1
|
|
118
|
+
|
|
119
|
+
const overBudgetSlides = []
|
|
120
|
+
const underBudgetSlides = []
|
|
121
|
+
|
|
122
|
+
const perSlide = rawEntries.map((entry) => {
|
|
123
|
+
const recommendedSeconds = explicitTarget
|
|
124
|
+
? Math.max(entry.isFraming ? 12 : 15, Math.round(entry.seconds * scaleFactor))
|
|
125
|
+
: entry.seconds
|
|
126
|
+
let status = 'on-track'
|
|
127
|
+
let reason = ''
|
|
128
|
+
if (entry.seconds > 150 || (explicitTarget && entry.seconds > targetSliceSeconds * 1.45)) {
|
|
129
|
+
status = 'over-budget'
|
|
130
|
+
reason = entry.seconds > 150 ? 'exceeds 150s single-slide cap' : 'exceeds 1.45x target slice'
|
|
131
|
+
overBudgetSlides.push(entry.slide)
|
|
132
|
+
} else if (!entry.isFraming && explicitTarget && entry.seconds < targetSliceSeconds * 0.55) {
|
|
133
|
+
status = 'under-budget'
|
|
134
|
+
reason = 'below 0.55x target slice'
|
|
135
|
+
underBudgetSlides.push(entry.slide)
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
...entry,
|
|
139
|
+
recommendedSeconds,
|
|
140
|
+
minutes: Math.round((entry.seconds / 60) * 10) / 10,
|
|
141
|
+
status,
|
|
142
|
+
...(reason ? { reason } : {}),
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
const estimatedMinutes = Math.round((estimatedSeconds / 60) * 10) / 10
|
|
147
|
+
const deltaSeconds = estimatedSeconds - targetSeconds
|
|
148
|
+
const deckStatus = explicitTarget
|
|
149
|
+
? (estimatedSeconds > targetSeconds * 1.15 || overBudgetSlides.length > 0
|
|
150
|
+
? 'over-budget'
|
|
151
|
+
: (estimatedSeconds < targetSeconds * 0.65 ? 'under-budget' : 'on-track'))
|
|
152
|
+
: (overBudgetSlides.length > 0 ? 'over-budget' : 'on-track')
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
targetMinutes: effectiveTargetMinutes,
|
|
156
|
+
explicitTarget: Boolean(explicitTarget),
|
|
157
|
+
targetSeconds,
|
|
158
|
+
estimatedSeconds,
|
|
159
|
+
estimatedMinutes,
|
|
160
|
+
deltaSeconds,
|
|
161
|
+
status: deckStatus,
|
|
162
|
+
overBudgetSlides,
|
|
163
|
+
underBudgetSlides,
|
|
164
|
+
slides: perSlide,
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function fmtSeconds(totalSec) {
|
|
169
|
+
const s = Math.max(0, Math.round(Number(totalSec) || 0))
|
|
170
|
+
const m = Math.floor(s / 60)
|
|
171
|
+
const r = s % 60
|
|
172
|
+
return String(m).padStart(2, '0') + ':' + String(r).padStart(2, '0')
|
|
50
173
|
}
|
|
51
174
|
|
|
52
175
|
/**
|
|
@@ -58,8 +181,13 @@ export function renderHandoutMarkdown(manifest, language) {
|
|
|
58
181
|
const lang = language || manifest?.language || 'zh'
|
|
59
182
|
const en = lang === 'en'
|
|
60
183
|
const slides = Array.isArray(manifest?.slides) ? manifest.slides : []
|
|
61
|
-
const
|
|
184
|
+
const pace = computePaceBudget(manifest)
|
|
62
185
|
const title = cleanLine(manifest?.title) || (en ? 'Presentation Handout' : '演示文稿讲义')
|
|
186
|
+
const statusLabel = (st) => {
|
|
187
|
+
if (st === 'over-budget') return en ? 'OVER-BUDGET' : '超预算'
|
|
188
|
+
if (st === 'under-budget') return en ? 'UNDER-BUDGET' : '偏短'
|
|
189
|
+
return en ? 'ON-TRACK' : '适中'
|
|
190
|
+
}
|
|
63
191
|
|
|
64
192
|
const lines = [
|
|
65
193
|
`# ${title} — ${en ? 'Speaker Handout & Script' : '演讲者讲义与逐页手稿'}`,
|
|
@@ -67,7 +195,10 @@ export function renderHandoutMarkdown(manifest, language) {
|
|
|
67
195
|
`## ${en ? 'Executive Overview' : '演示概览'}`,
|
|
68
196
|
`- **${en ? 'Theme' : '视觉主题'}**: \`${cleanLine(manifest?.theme || 'consulting')}\``,
|
|
69
197
|
`- **${en ? 'Slides' : '总页数'}**: ${slides.length}`,
|
|
70
|
-
`- **${en ? 'Estimated Speaking Time' : '预计演讲时长'}**: ~${
|
|
198
|
+
`- **${en ? 'Estimated Speaking Time' : '预计演讲时长'}**: ~${pace.estimatedMinutes} ${en ? 'min' : '分钟'} (${fmtSeconds(pace.estimatedSeconds)})${pace.explicitTarget ? ` · ${en ? 'Target' : '目标'}: ${pace.targetMinutes} ${en ? 'min' : '分钟'} [${statusLabel(pace.status)}]` : ''}`,
|
|
199
|
+
...(pace.overBudgetSlides.length > 0
|
|
200
|
+
? [`- **${en ? 'Over-Budget Slides' : '超预算警告页'}**: ${pace.overBudgetSlides.map(n => `#${n}`).join(', ')}`]
|
|
201
|
+
: []),
|
|
71
202
|
'',
|
|
72
203
|
'---',
|
|
73
204
|
'',
|
|
@@ -75,13 +206,13 @@ export function renderHandoutMarkdown(manifest, language) {
|
|
|
75
206
|
|
|
76
207
|
slides.forEach((slide, idx) => {
|
|
77
208
|
const slideTitle = cleanLine(slide?.title) || (en ? `Slide ${idx + 1}` : `第 ${idx + 1} 页`)
|
|
78
|
-
const
|
|
209
|
+
const budget = pace.slides[idx] || { seconds: 45, minutes: 0.8, status: 'on-track' }
|
|
79
210
|
lines.push(`## ${en ? `Slide ${idx + 1}` : `第 ${idx + 1} 页`} · ${slideTitle}`)
|
|
80
211
|
const cleanKicker = cleanLine(slide?.kicker)
|
|
81
212
|
const meta = [
|
|
82
213
|
`**${en ? 'Layout' : '版式'}**: \`${slide?.layout || 'bullets'}${slide?.variant ? `[${slide.variant}]` : ''}\``,
|
|
83
214
|
(cleanKicker && cleanKicker !== slideTitle) ? `**${en ? 'Section' : '章节'}**: ${cleanKicker}` : '',
|
|
84
|
-
`**${en ? 'Pace' : '建议时长'}**: ~${
|
|
215
|
+
`**${en ? 'Pace' : '建议时长'}**: ${fmtSeconds(budget.seconds)} (~${budget.minutes} ${en ? 'min' : '分钟'} · ${statusLabel(budget.status)})`,
|
|
85
216
|
].filter(Boolean)
|
|
86
217
|
lines.push(meta.join(' · '))
|
|
87
218
|
lines.push('')
|
|
@@ -96,6 +227,13 @@ export function renderHandoutMarkdown(manifest, language) {
|
|
|
96
227
|
lines.push('')
|
|
97
228
|
}
|
|
98
229
|
|
|
230
|
+
if (slide?.mermaid) {
|
|
231
|
+
lines.push('```mermaid')
|
|
232
|
+
lines.push(String(slide.mermaid).trim())
|
|
233
|
+
lines.push('```')
|
|
234
|
+
lines.push('')
|
|
235
|
+
}
|
|
236
|
+
|
|
99
237
|
if (Array.isArray(slide?.items) && slide.items.length > 0) {
|
|
100
238
|
lines.push(`### ${en ? 'Key Metrics & Structured Items' : '核心指标与结构要素'}`)
|
|
101
239
|
for (const it of slide.items) {
|
|
@@ -166,6 +304,426 @@ export function renderHandoutMarkdown(manifest, language) {
|
|
|
166
304
|
return lines.join('\n')
|
|
167
305
|
}
|
|
168
306
|
|
|
307
|
+
function safeBrandedTheme(manifest) {
|
|
308
|
+
try {
|
|
309
|
+
return deriveBrandedTheme(manifest?.theme || 'consulting', manifest?.brand)
|
|
310
|
+
} catch {
|
|
311
|
+
return resolveTheme('consulting')
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function renderOnePagerVisualHtml(slide, theme, en) {
|
|
316
|
+
const layout = slide.layout || 'bullets'
|
|
317
|
+
if (slide.chart) {
|
|
318
|
+
let svg = ''
|
|
319
|
+
try {
|
|
320
|
+
svg = renderChartSvg(slide.chart, theme)
|
|
321
|
+
} catch {
|
|
322
|
+
svg = ''
|
|
323
|
+
}
|
|
324
|
+
const items = Array.isArray(slide.items) ? slide.items.slice(0, 3) : []
|
|
325
|
+
return `
|
|
326
|
+
<div class="op-vis-card">
|
|
327
|
+
<div class="op-vis-head"><span class="op-badge">${escape(slide.chart.kind || 'chart')}</span><h4>${escape(stripMd(slide.title))}</h4></div>
|
|
328
|
+
${svg ? `<div class="op-chart-svg">${svg}</div>` : ''}
|
|
329
|
+
${items.length ? `<div class="op-mini-notes">${items.map(it => `<div><strong>${escape(stripMd(it.title || it.tag || ''))}</strong> ${escape(stripMd(it.text || ''))}</div>`).join('')}</div>` : ''}
|
|
330
|
+
${slide.takeaway ? `<p class="op-takeaway">▸ ${escape(stripMd(slide.takeaway))}</p>` : ''}
|
|
331
|
+
${slide.source ? `<p class="op-source">${escape(stripMd(slide.source))}</p>` : ''}
|
|
332
|
+
</div>`
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (layout === 'sankey') {
|
|
336
|
+
const flows = (Array.isArray(slide.items) && slide.items.length
|
|
337
|
+
? slide.items.map(it => `${stripMd(it.tag || '')} ──(${stripMd((it.value ?? '') + (it.unit ?? ''))})──▶ ${stripMd(it.title || '')}`)
|
|
338
|
+
: (Array.isArray(slide.bullets) ? slide.bullets.map(stripMd) : [])).slice(0, 6)
|
|
339
|
+
return `
|
|
340
|
+
<div class="op-vis-card">
|
|
341
|
+
<div class="op-vis-head"><span class="op-badge">SANKEY</span><h4>${escape(stripMd(slide.title))}</h4></div>
|
|
342
|
+
<ul class="op-flow-list">${flows.map(f => `<li>${escape(f)}</li>`).join('')}</ul>
|
|
343
|
+
${slide.takeaway ? `<p class="op-takeaway">▸ ${escape(stripMd(slide.takeaway))}</p>` : ''}
|
|
344
|
+
</div>`
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (layout === 'gantt') {
|
|
348
|
+
const cols = Array.isArray(slide.columns) && slide.columns.length ? slide.columns : ['Q1', 'Q2', 'Q3', 'Q4']
|
|
349
|
+
const items = (Array.isArray(slide.items) ? slide.items : []).slice(0, 6)
|
|
350
|
+
return `
|
|
351
|
+
<div class="op-vis-card">
|
|
352
|
+
<div class="op-vis-head"><span class="op-badge">GANTT</span><h4>${escape(stripMd(slide.title))}</h4></div>
|
|
353
|
+
<div class="op-gantt-list">${items.map(it => {
|
|
354
|
+
const start = Math.max(0, Number(it.start ?? 0))
|
|
355
|
+
const span = Math.max(0.4, Number(it.span ?? 1))
|
|
356
|
+
const left = Math.min(90, (start / Math.max(1, cols.length)) * 100).toFixed(1)
|
|
357
|
+
const width = Math.min(100 - Number(left), (span / Math.max(1, cols.length)) * 100).toFixed(1)
|
|
358
|
+
return `<div class="op-gantt-row"><span class="op-gantt-lbl">${escape(stripMd(it.title || it.tag || ''))}</span><div class="op-gantt-track"><span class="op-gantt-bar" style="left:${left}%;width:${width}%"></span></div></div>`
|
|
359
|
+
}).join('')}</div>
|
|
360
|
+
<div class="op-gantt-axis">${cols.slice(0, 8).map(c => `<span>${escape(stripMd(c))}</span>`).join('')}</div>
|
|
361
|
+
</div>`
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (layout === 'mermaid' || layout === 'flowchart' || layout === 'sequence' || slide.mermaid) {
|
|
365
|
+
const src = String(slide.mermaid || '').trim()
|
|
366
|
+
const lines = src.split(/\r?\n/).map(l => l.trim()).filter(Boolean)
|
|
367
|
+
const kind = /^sequenceDiagram/i.test(lines[0] || '') ? 'SEQUENCE' : 'FLOWCHART'
|
|
368
|
+
let mermaidBody = ''
|
|
369
|
+
try {
|
|
370
|
+
mermaidBody = renderMermaidHtml(slide, 0)
|
|
371
|
+
} catch {
|
|
372
|
+
mermaidBody = ''
|
|
373
|
+
}
|
|
374
|
+
return `
|
|
375
|
+
<div class="op-vis-card">
|
|
376
|
+
<div class="op-vis-head"><span class="op-badge">${kind}</span><h4>${escape(stripMd(slide.title))}</h4></div>
|
|
377
|
+
${mermaidBody ? `<div class="op-mermaid-wrap">${mermaidBody}</div>` : `<pre class="op-mermaid-code">${escape(lines.slice(0, 10).join('\n'))}</pre>`}
|
|
378
|
+
${slide.takeaway ? `<p class="op-takeaway">▸ ${escape(stripMd(slide.takeaway))}</p>` : ''}
|
|
379
|
+
</div>`
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (Array.isArray(slide.rows) && slide.rows.length > 0) {
|
|
383
|
+
const rows = slide.rows.slice(0, 6)
|
|
384
|
+
const head = rows[0] || []
|
|
385
|
+
const body = rows.slice(1)
|
|
386
|
+
return `
|
|
387
|
+
<div class="op-vis-card">
|
|
388
|
+
<div class="op-vis-head"><span class="op-badge">${escape(layout.toUpperCase())}</span><h4>${escape(stripMd(slide.title))}</h4></div>
|
|
389
|
+
<div class="op-tbl-wrap"><table class="op-table">
|
|
390
|
+
<thead><tr>${head.slice(0, 6).map(c => `<th>${escape(stripMd(c))}</th>`).join('')}</tr></thead>
|
|
391
|
+
<tbody>${body.map(r => `<tr>${head.slice(0, 6).map((_, ci) => `<td>${escape(stripMd(r?.[ci] ?? ''))}</td>`).join('')}</tr>`).join('')}</tbody>
|
|
392
|
+
</table></div>
|
|
393
|
+
${slide.takeaway ? `<p class="op-takeaway">▸ ${escape(stripMd(slide.takeaway))}</p>` : ''}
|
|
394
|
+
</div>`
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (slide.formula) {
|
|
398
|
+
const rawFormula = String(slide.formula).trim()
|
|
399
|
+
let mathHtml = ''
|
|
400
|
+
try {
|
|
401
|
+
mathHtml = latexToMathMl(rawFormula, { display: true, className: 'deck-math is-block' })
|
|
402
|
+
} catch {
|
|
403
|
+
mathHtml = ''
|
|
404
|
+
}
|
|
405
|
+
return `
|
|
406
|
+
<div class="op-vis-card">
|
|
407
|
+
<div class="op-vis-head"><span class="op-badge">FORMULA</span><h4>${escape(stripMd(slide.title))}</h4></div>
|
|
408
|
+
<div class="op-formula">${mathHtml || escape(rawFormula)}</div>
|
|
409
|
+
${slide.takeaway ? `<p class="op-takeaway">▸ ${escape(stripMd(slide.takeaway))}</p>` : ''}
|
|
410
|
+
</div>`
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return ''
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Generate a standalone, print-to-PDF-ready A4 Executive One-Pager HTML
|
|
418
|
+
* with an interactive "切换长图战报 / Mobile Long-Card" mode switcher.
|
|
419
|
+
* @param {object} manifest
|
|
420
|
+
* @param {string} [language]
|
|
421
|
+
*/
|
|
422
|
+
export function renderOnePagerHtml(manifest, language) {
|
|
423
|
+
const lang = language || manifest?.language || 'zh'
|
|
424
|
+
const en = lang === 'en'
|
|
425
|
+
const theme = safeBrandedTheme(manifest)
|
|
426
|
+
const tk = theme.tokens || {}
|
|
427
|
+
const pal = theme.palette || {}
|
|
428
|
+
const slides = Array.isArray(manifest?.slides) ? manifest.slides : []
|
|
429
|
+
const pace = computePaceBudget(manifest)
|
|
430
|
+
const title = cleanLine(manifest?.title) || (en ? 'Executive One-Pager' : '高管一页纸战报')
|
|
431
|
+
|
|
432
|
+
const cover = slides.find(s => s.layout === 'cover') || slides[0] || {}
|
|
433
|
+
const closing = [...slides].reverse().find(s => s.layout === 'closing') || null
|
|
434
|
+
const takeaways = slides.map(s => stripMd(s.takeaway)).filter(Boolean)
|
|
435
|
+
const thesis = stripMd(cover.subtitle) || takeaways[0] || stripMd(slides.find(s => s.layout === 'statement')?.title) || title
|
|
436
|
+
|
|
437
|
+
// Extract Top KPI Strip (up to 4 cards)
|
|
438
|
+
const kpis = []
|
|
439
|
+
for (const s of slides) {
|
|
440
|
+
if (s.layout === 'kpi' && Array.isArray(s.items)) {
|
|
441
|
+
for (const it of s.items) {
|
|
442
|
+
if (it && (it.value !== undefined || it.title)) {
|
|
443
|
+
kpis.push({
|
|
444
|
+
label: stripMd(it.tag || it.title || ''),
|
|
445
|
+
value: stripMd(it.value ?? ''),
|
|
446
|
+
unit: stripMd(it.unit ?? ''),
|
|
447
|
+
delta: stripMd(it.delta ?? ''),
|
|
448
|
+
note: stripMd(it.text ?? ''),
|
|
449
|
+
status: it.status || 'accent',
|
|
450
|
+
})
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (kpis.length === 0) {
|
|
456
|
+
kpis.push(
|
|
457
|
+
{ label: en ? 'Total Slides' : '演示总页数', value: String(slides.length), unit: en ? 'slides' : '页', delta: '', note: '', status: 'accent' },
|
|
458
|
+
{ label: en ? 'Est. Duration' : '预计演讲时长', value: String(pace.estimatedMinutes), unit: en ? 'min' : '分钟', delta: fmtSeconds(pace.estimatedSeconds), note: '', status: pace.status === 'over-budget' ? 'warning' : 'positive' },
|
|
459
|
+
)
|
|
460
|
+
}
|
|
461
|
+
const topKpis = kpis.slice(0, 4)
|
|
462
|
+
|
|
463
|
+
// Key Visuals (Charts / Tables / Sankey / Gantt / Mermaid / Formulas)
|
|
464
|
+
const visualSlides = slides.filter(s =>
|
|
465
|
+
s.chart || s.mermaid || s.formula ||
|
|
466
|
+
['sankey', 'gantt', 'marimekko', 'harvey', 'table', 'mermaid', 'flowchart', 'sequence'].includes(s.layout) ||
|
|
467
|
+
(Array.isArray(s.rows) && s.rows.length > 0)
|
|
468
|
+
)
|
|
469
|
+
const visualsHtml = visualSlides.slice(0, 4).map(s => renderOnePagerVisualHtml(s, theme, en)).filter(Boolean).join('')
|
|
470
|
+
|
|
471
|
+
// Core Pillars
|
|
472
|
+
const pillarSlides = slides.filter(s => !['cover', 'closing', 'section', 'agenda'].includes(s.layout))
|
|
473
|
+
const pillars = []
|
|
474
|
+
for (const s of pillarSlides) {
|
|
475
|
+
if (pillars.length >= 6) break
|
|
476
|
+
const pts = []
|
|
477
|
+
if (Array.isArray(s.items)) {
|
|
478
|
+
for (const it of s.items.slice(0, 3)) {
|
|
479
|
+
const line = [stripMd(it.title || it.tag), stripMd(it.text)].filter(Boolean).join(': ')
|
|
480
|
+
if (line) pts.push(line)
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (pts.length === 0 && Array.isArray(s.bullets)) {
|
|
484
|
+
for (const b of s.bullets.slice(0, 3)) pts.push(stripMd(b))
|
|
485
|
+
}
|
|
486
|
+
if (pts.length === 0 && s.takeaway) pts.push(stripMd(s.takeaway))
|
|
487
|
+
if (s.title || pts.length) {
|
|
488
|
+
pillars.push({
|
|
489
|
+
kicker: stripMd(s.kicker || s.layout || ''),
|
|
490
|
+
title: stripMd(s.title),
|
|
491
|
+
points: pts.slice(0, 3),
|
|
492
|
+
takeaway: stripMd(s.takeaway),
|
|
493
|
+
})
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// Action Items
|
|
498
|
+
const actions = []
|
|
499
|
+
if (closing) {
|
|
500
|
+
if (Array.isArray(closing.items)) {
|
|
501
|
+
for (const it of closing.items.slice(0, 4)) {
|
|
502
|
+
actions.push({
|
|
503
|
+
tag: stripMd(it.tag || ''),
|
|
504
|
+
title: stripMd(it.title || ''),
|
|
505
|
+
text: stripMd(it.text || ''),
|
|
506
|
+
})
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (actions.length === 0 && Array.isArray(closing.bullets)) {
|
|
510
|
+
for (const b of closing.bullets.slice(0, 4)) {
|
|
511
|
+
actions.push({ tag: en ? 'Action' : '行动', title: stripMd(b), text: '' })
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
if (actions.length === 0 && closing.subtitle) {
|
|
515
|
+
actions.push({ tag: en ? 'Next' : '下一步', title: stripMd(closing.title), text: stripMd(closing.subtitle) })
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (actions.length === 0 && takeaways.length > 0) {
|
|
519
|
+
takeaways.slice(0, 3).forEach((t, idx) => actions.push({ tag: `#${idx + 1}`, title: t, text: '' }))
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const badgeText = (st) => st === 'over-budget'
|
|
523
|
+
? (en ? 'Over' : '超预算')
|
|
524
|
+
: st === 'under-budget'
|
|
525
|
+
? (en ? 'Short' : '偏短')
|
|
526
|
+
: (en ? 'OK' : '适中')
|
|
527
|
+
|
|
528
|
+
const paceRowsHtml = pace.slides.map(ps => `
|
|
529
|
+
<tr>
|
|
530
|
+
<td class="num">${ps.slide}</td>
|
|
531
|
+
<td>${escape(ps.title)}</td>
|
|
532
|
+
<td><code>${escape(ps.layout)}</code></td>
|
|
533
|
+
<td class="num">${fmtSeconds(ps.seconds)}</td>
|
|
534
|
+
<td><span class="op-pace-pill op-pace-${escape(ps.status)}">${escape(badgeText(ps.status))}</span></td>
|
|
535
|
+
</tr>`).join('')
|
|
536
|
+
|
|
537
|
+
const toggleLabelLong = en ? 'Mobile Long-Card' : '切换长图战报'
|
|
538
|
+
const toggleLabelA4 = en ? 'A4 Print View' : '切换 A4 报告视图'
|
|
539
|
+
const printLabel = en ? 'Print / Export PDF' : '打印 / 导出 PDF'
|
|
540
|
+
const headerBg = tk.coverIsDark === true && tk.coverBg ? tk.coverBg : (pal.accent || '#0B1F3A')
|
|
541
|
+
const headerFg = relativeLuminance(headerBg) > 0.35 ? '#0F172A' : '#FFFFFF'
|
|
542
|
+
const headerChipBg = headerFg === '#FFFFFF' ? 'rgba(255,255,255,.16)' : 'rgba(15,23,42,.10)'
|
|
543
|
+
|
|
544
|
+
return `<!DOCTYPE html>
|
|
545
|
+
<html lang="${en ? 'en' : 'zh-CN'}">
|
|
546
|
+
<head>
|
|
547
|
+
<meta charset="UTF-8">
|
|
548
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
549
|
+
<title>${escape(title)} · ${en ? 'Executive One-Pager' : '高管一页纸战报'}</title>
|
|
550
|
+
<style>
|
|
551
|
+
:root{
|
|
552
|
+
--bg:${pal.bg || '#FFFFFF'};
|
|
553
|
+
--panel:${pal.panel || '#F8FAFC'};
|
|
554
|
+
--fg:${pal.fg || '#0F172A'};
|
|
555
|
+
--muted:${pal.muted || '#64748B'};
|
|
556
|
+
--accent:${pal.accent || '#0057B8'};
|
|
557
|
+
--accent2:${pal.accent2 || '#0EA5E9'};
|
|
558
|
+
--surface1:${tk.surface1 || pal.panel || '#F8FAFC'};
|
|
559
|
+
--surface2:${tk.surface2 || '#EEF2F7'};
|
|
560
|
+
--hairline:${tk.hairline || '#DCE3EE'};
|
|
561
|
+
--ink-secondary:${tk.inkSecondary || pal.muted || '#475569'};
|
|
562
|
+
--ink-on-accent:${tk.inkOnAccent || '#FFFFFF'};
|
|
563
|
+
--accent-text:${tk.accentText || pal.accent || '#0057B8'};
|
|
564
|
+
--accent-soft:${tk.accentSoft || '#E8F0FE'};
|
|
565
|
+
--positive:${tk.positive || '#0D7A4E'};
|
|
566
|
+
--negative:${tk.negative || '#C81E1E'};
|
|
567
|
+
--warning:${tk.warning || '#B45309'};
|
|
568
|
+
--cover-bg:${headerBg};
|
|
569
|
+
--header-fg:${headerFg};
|
|
570
|
+
--header-chip-bg:${headerChipBg};
|
|
571
|
+
--font-heading:${theme.fonts?.heading || 'system-ui, sans-serif'};
|
|
572
|
+
--font-body:${theme.fonts?.body || 'system-ui, sans-serif'};
|
|
573
|
+
}
|
|
574
|
+
*{box-sizing:border-box}
|
|
575
|
+
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
576
|
+
body{margin:0;background:color-mix(in srgb,var(--surface2) 70%,var(--bg));color:var(--fg);font-family:var(--font-body);line-height:1.5;padding:18px 16px 40px;transition:background .2s}
|
|
577
|
+
.op-toolbar{max-width:960px;margin:0 auto 14px;display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
|
|
578
|
+
.op-toolbar-title{font-size:13px;color:var(--muted);font-weight:600}
|
|
579
|
+
.op-toolbar-actions{display:flex;gap:8px;flex-wrap:wrap}
|
|
580
|
+
.op-btn{border:1px solid var(--hairline);background:var(--bg);color:var(--fg);border-radius:99px;padding:7px 14px;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
|
|
581
|
+
.op-btn:hover{border-color:var(--accent);color:var(--accent)}
|
|
582
|
+
.op-btn.primary{background:var(--accent);color:var(--ink-on-accent);border-color:var(--accent)}
|
|
583
|
+
.op-sheet{max-width:960px;margin:0 auto;background:var(--bg);border:1px solid var(--hairline);border-radius:16px;padding:24px 26px;box-shadow:0 12px 32px rgba(15,23,42,.08);transition:max-width .25s ease}
|
|
584
|
+
body.long-card .op-sheet{max-width:440px;padding:18px 16px;border-radius:22px}
|
|
585
|
+
body.long-card .op-kpi-strip{grid-template-columns:repeat(2,minmax(0,1fr))}
|
|
586
|
+
body.long-card .op-grid,body.long-card .op-pillars,body.long-card .op-actions{grid-template-columns:1fr}
|
|
587
|
+
.op-header{background:var(--cover-bg);color:var(--header-fg);border-radius:12px;padding:18px 20px;margin-bottom:16px;display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap}
|
|
588
|
+
.op-kicker{font-size:11px;letter-spacing:.1em;text-transform:uppercase;opacity:.85;margin-bottom:4px;font-weight:700}
|
|
589
|
+
.op-header h1{margin:0;font-family:var(--font-heading);font-size:22px;line-height:1.25}
|
|
590
|
+
.op-thesis{margin:6px 0 0;font-size:13.5px;opacity:.92;max-width:64ch}
|
|
591
|
+
.op-meta{display:flex;gap:8px;flex-wrap:wrap;font-size:12px}
|
|
592
|
+
.op-meta-chip{background:var(--header-chip-bg);padding:4px 10px;border-radius:99px;white-space:nowrap}
|
|
593
|
+
.op-section-title{font-family:var(--font-heading);font-size:13px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--accent);margin:16px 0 8px;display:flex;align-items:center;gap:8px}
|
|
594
|
+
.op-section-title::after{content:"";flex:1;height:1px;background:var(--hairline)}
|
|
595
|
+
.op-kpi-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin-bottom:14px}
|
|
596
|
+
.op-kpi{background:var(--surface1);border:1px solid var(--hairline);border-top:3px solid var(--accent);border-radius:10px;padding:11px 13px;break-inside:avoid}
|
|
597
|
+
.op-kpi-lbl{font-size:11.5px;color:var(--muted);font-weight:600}
|
|
598
|
+
.op-kpi-val{font-size:22px;font-weight:800;font-variant-numeric:tabular-nums;color:var(--fg);margin:2px 0}
|
|
599
|
+
.op-kpi-val small{font-size:12px;font-weight:600;color:var(--muted);margin-left:3px}
|
|
600
|
+
.op-kpi-delta{font-size:11.5px;font-weight:700;color:var(--positive)}
|
|
601
|
+
.op-kpi-note{font-size:11.5px;color:var(--muted);margin-top:2px}
|
|
602
|
+
.op-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:14px}
|
|
603
|
+
.op-vis-card{background:var(--surface1);border:1px solid var(--hairline);border-radius:10px;padding:12px 14px;break-inside:avoid}
|
|
604
|
+
.op-vis-head{display:flex;align-items:center;gap:8px;margin-bottom:8px}
|
|
605
|
+
.op-vis-head h4{margin:0;font-size:14px;font-family:var(--font-heading);line-height:1.3}
|
|
606
|
+
.op-badge{font-size:10px;font-weight:700;padding:2px 7px;border-radius:99px;background:color-mix(in srgb,var(--accent) 14%,transparent);color:var(--accent);text-transform:uppercase;flex-shrink:0}
|
|
607
|
+
.op-chart-svg{position:relative}
|
|
608
|
+
.op-chart-svg svg{width:100%;height:auto;max-height:190px;display:block}
|
|
609
|
+
.op-mermaid-wrap{max-height:210px;overflow:hidden;display:flex;align-items:center;justify-content:center}
|
|
610
|
+
.op-mermaid-wrap svg.deck-mermaid-svg{max-height:210px;width:100%;height:auto}
|
|
611
|
+
${MERMAID_CSS}
|
|
612
|
+
.op-mini-notes{font-size:12px;color:var(--muted);margin-top:6px;display:grid;gap:3px}
|
|
613
|
+
.op-takeaway{margin:7px 0 0;font-size:12px;color:var(--fg);background:color-mix(in srgb,var(--accent) 8%,transparent);padding:5px 8px;border-radius:6px;border-left:3px solid var(--accent)}
|
|
614
|
+
.op-source{margin:5px 0 0;font-size:11px;color:var(--muted)}
|
|
615
|
+
.op-tbl-wrap{overflow-x:auto}
|
|
616
|
+
.op-table{width:100%;border-collapse:collapse;font-size:12px}
|
|
617
|
+
.op-table th,.op-table td{padding:5px 7px;border-bottom:1px solid var(--hairline);text-align:left}
|
|
618
|
+
.op-table th{color:var(--muted);font-weight:700;background:var(--surface2)}
|
|
619
|
+
.op-table td.num{text-align:right;font-variant-numeric:tabular-nums}
|
|
620
|
+
.op-flow-list{margin:0;padding-left:16px;font-size:12.5px;display:grid;gap:4px}
|
|
621
|
+
.op-gantt-list{display:grid;gap:6px;font-size:12px}
|
|
622
|
+
.op-gantt-row{display:grid;grid-template-columns:110px 1fr;align-items:center;gap:8px}
|
|
623
|
+
.op-gantt-lbl{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
624
|
+
.op-gantt-track{position:relative;height:12px;background:var(--surface2);border-radius:99px;overflow:hidden}
|
|
625
|
+
.op-gantt-bar{position:absolute;top:0;bottom:0;background:var(--accent);border-radius:99px}
|
|
626
|
+
.op-gantt-axis{display:flex;justify-content:space-between;font-size:10.5px;color:var(--muted);margin-top:6px;padding-left:118px}
|
|
627
|
+
.op-mermaid-code{margin:0;padding:8px 10px;background:var(--surface2);border-radius:8px;font-size:11px;overflow:auto;max-height:150px;white-space:pre-wrap}
|
|
628
|
+
.op-formula{padding:12px 14px;background:var(--surface2);border-radius:8px;font-size:15px;text-align:center;color:var(--fg);overflow-x:auto}
|
|
629
|
+
.op-formula .deck-math{font-size:18px;color:var(--fg)}
|
|
630
|
+
.op-pillars{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-bottom:14px}
|
|
631
|
+
.op-pillar{background:var(--surface1);border:1px solid var(--hairline);border-radius:10px;padding:11px 13px;break-inside:avoid}
|
|
632
|
+
.op-pillar-kicker{font-size:10.5px;font-weight:700;color:var(--accent);text-transform:uppercase}
|
|
633
|
+
.op-pillar h4{margin:2px 0 6px;font-size:13.5px;font-family:var(--font-heading)}
|
|
634
|
+
.op-pillar ul{margin:0;padding-left:16px;font-size:12px;color:var(--muted);display:grid;gap:3px}
|
|
635
|
+
.op-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px;margin-bottom:14px}
|
|
636
|
+
.op-action{background:var(--surface1);border:1px solid var(--hairline);border-left:3px solid var(--accent2);border-radius:8px;padding:9px 11px;font-size:12.5px;break-inside:avoid}
|
|
637
|
+
.op-action strong{display:block;margin-bottom:2px}
|
|
638
|
+
.op-pace-box{background:var(--surface1);border:1px solid var(--hairline);border-radius:10px;padding:12px 14px;break-inside:avoid}
|
|
639
|
+
.op-pace-summary{display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px;font-size:12.5px;margin-bottom:8px}
|
|
640
|
+
.op-pace-pill{display:inline-block;padding:1px 7px;border-radius:99px;font-size:11px;font-weight:700}
|
|
641
|
+
.op-pace-on-track{background:color-mix(in srgb,var(--positive) 15%,transparent);color:var(--positive)}
|
|
642
|
+
.op-pace-over-budget{background:color-mix(in srgb,var(--negative) 15%,transparent);color:var(--negative)}
|
|
643
|
+
.op-pace-under-budget{background:color-mix(in srgb,var(--warning) 15%,transparent);color:var(--warning)}
|
|
644
|
+
@media(max-width:700px){.op-grid,.op-pillars{grid-template-columns:1fr}}
|
|
645
|
+
@media print{
|
|
646
|
+
@page{size:A4 portrait;margin:11mm}
|
|
647
|
+
body{background:#fff;padding:0}
|
|
648
|
+
.op-toolbar{display:none!important}
|
|
649
|
+
.op-sheet{max-width:none!important;border:none;box-shadow:none;padding:0}
|
|
650
|
+
}
|
|
651
|
+
</style>
|
|
652
|
+
</head>
|
|
653
|
+
<body>
|
|
654
|
+
<div class="op-toolbar">
|
|
655
|
+
<span class="op-toolbar-title">${escape(en ? 'dsh-ppt Executive One-Pager' : 'dsh-ppt 高管一页纸战报')}</span>
|
|
656
|
+
<div class="op-toolbar-actions">
|
|
657
|
+
<button id="mode-toggle" class="op-btn" type="button" data-mode="a4">${escape(toggleLabelLong)}</button>
|
|
658
|
+
<button id="print-btn" class="op-btn primary" type="button" onclick="window.print()">${escape(printLabel)}</button>
|
|
659
|
+
</div>
|
|
660
|
+
</div>
|
|
661
|
+
<main class="op-sheet">
|
|
662
|
+
<header class="op-header">
|
|
663
|
+
<div>
|
|
664
|
+
<div class="op-kicker">${escape(stripMd(cover.kicker || (en ? 'EXECUTIVE BRIEF' : '高管摘要战报')))}</div>
|
|
665
|
+
<h1>${escape(title)}</h1>
|
|
666
|
+
${thesis && thesis !== title ? `<p class="op-thesis">${escape(thesis)}</p>` : ''}
|
|
667
|
+
</div>
|
|
668
|
+
<div class="op-meta">
|
|
669
|
+
<span class="op-meta-chip">${slides.length} ${escape(en ? 'Slides' : '页')}</span>
|
|
670
|
+
<span class="op-meta-chip">${escape(en ? 'Pace' : '预计时长')}: ~${pace.estimatedMinutes} ${escape(en ? 'min' : '分钟')}</span>
|
|
671
|
+
<span class="op-meta-chip">${escape(theme.id || 'consulting')}</span>
|
|
672
|
+
</div>
|
|
673
|
+
</header>
|
|
674
|
+
|
|
675
|
+
<div class="op-section-title">${escape(en ? 'Top KPI Strip' : '核心指标概览')}</div>
|
|
676
|
+
<section class="op-kpi-strip">
|
|
677
|
+
${topKpis.map(k => `<div class="op-kpi">
|
|
678
|
+
<div class="op-kpi-lbl">${escape(k.label)}</div>
|
|
679
|
+
<div class="op-kpi-val">${escape(k.value)}${k.unit ? `<small>${escape(k.unit)}</small>` : ''}</div>
|
|
680
|
+
${k.delta ? `<div class="op-kpi-delta">${escape(k.delta)}</div>` : ''}
|
|
681
|
+
${k.note ? `<div class="op-kpi-note">${escape(k.note)}</div>` : ''}
|
|
682
|
+
</div>`).join('')}
|
|
683
|
+
</section>
|
|
684
|
+
|
|
685
|
+
${visualsHtml ? `<div class="op-section-title">${escape(en ? 'Key Visuals & Evidence' : '关键图表与核心证据')}</div><section class="op-grid">${visualsHtml}</section>` : ''}
|
|
686
|
+
|
|
687
|
+
${pillars.length ? `<div class="op-section-title">${escape(en ? 'Core Pillars' : '核心支柱与论证')}</div><section class="op-pillars">
|
|
688
|
+
${pillars.map(p => `<div class="op-pillar">
|
|
689
|
+
${p.kicker ? `<div class="op-pillar-kicker">${escape(p.kicker)}</div>` : ''}
|
|
690
|
+
<h4>${escape(p.title)}</h4>
|
|
691
|
+
${p.points.length ? `<ul>${p.points.map(pt => `<li>${escape(pt)}</li>`).join('')}</ul>` : ''}
|
|
692
|
+
${p.takeaway ? `<p class="op-takeaway">▸ ${escape(p.takeaway)}</p>` : ''}
|
|
693
|
+
</div>`).join('')}
|
|
694
|
+
</section>` : ''}
|
|
695
|
+
|
|
696
|
+
${actions.length ? `<div class="op-section-title">${escape(en ? 'Action Items' : '下一步行动')}</div><section class="op-actions">
|
|
697
|
+
${actions.map(a => `<div class="op-action">${a.tag ? `<span class="op-badge">${escape(a.tag)}</span> ` : ''}<strong>${escape(a.title)}</strong>${a.text ? `<span>${escape(a.text)}</span>` : ''}</div>`).join('')}
|
|
698
|
+
</section>` : ''}
|
|
699
|
+
|
|
700
|
+
<div class="op-section-title">${escape(en ? 'Speaking Pace Budget' : '演讲配速预算')}</div>
|
|
701
|
+
<section class="op-pace-box">
|
|
702
|
+
<div class="op-pace-summary">
|
|
703
|
+
<span><strong>${escape(en ? 'Total Estimated' : '总计预计')}:</strong> ${fmtSeconds(pace.estimatedSeconds)} (~${pace.estimatedMinutes} ${escape(en ? 'min' : '分钟')}) · <strong>${escape(en ? 'Target' : '目标')}:</strong> ${pace.targetMinutes} ${escape(en ? 'min' : '分钟')}</span>
|
|
704
|
+
<span class="op-pace-pill op-pace-${escape(pace.status)}">${escape(badgeText(pace.status))}</span>
|
|
705
|
+
</div>
|
|
706
|
+
<div class="op-tbl-wrap"><table class="op-table">
|
|
707
|
+
<thead><tr><th>#</th><th>${escape(en ? 'Slide' : '页面')}</th><th>${escape(en ? 'Layout' : '版式')}</th><th>${escape(en ? 'Budget' : '预算')}</th><th>${escape(en ? 'Status' : '状态')}</th></tr></thead>
|
|
708
|
+
<tbody>${paceRowsHtml}</tbody>
|
|
709
|
+
</table></div>
|
|
710
|
+
</section>
|
|
711
|
+
</main>
|
|
712
|
+
<script>
|
|
713
|
+
(function(){
|
|
714
|
+
var btn = document.getElementById('mode-toggle');
|
|
715
|
+
if (!btn) return;
|
|
716
|
+
btn.addEventListener('click', function(){
|
|
717
|
+
var longMode = document.body.classList.toggle('long-card');
|
|
718
|
+
btn.dataset.mode = longMode ? 'long-card' : 'a4';
|
|
719
|
+
btn.textContent = longMode ? ${JSON.stringify(toggleLabelA4)} : ${JSON.stringify(toggleLabelLong)};
|
|
720
|
+
});
|
|
721
|
+
})();
|
|
722
|
+
</script>
|
|
723
|
+
</body>
|
|
724
|
+
</html>`
|
|
725
|
+
}
|
|
726
|
+
|
|
169
727
|
/** Offline, sibling-file links only. No credentials or application server needed. */
|
|
170
728
|
export function renderDelivery(manifest, files = {}, language) {
|
|
171
729
|
const label = (zh, en) => language === 'en' ? en : language === 'bilingual' ? zh + ' · ' + en : zh
|
|
@@ -175,6 +733,7 @@ export function renderDelivery(manifest, files = {}, language) {
|
|
|
175
733
|
const download = (kind, text, id) => files[kind] ? `<a id="${id}" href="${escape(href(files[kind]))}" download>${escape(text)}</a>` : ''
|
|
176
734
|
const pptxLabel = label('下载 PPTX', 'Download PPTX')
|
|
177
735
|
const handoutLabel = label('下载讲义 (.md)', 'Download handout (.md)')
|
|
736
|
+
const onePagerLabel = label('下载一页纸战报 (.html)', 'Download One-Pager (.html)')
|
|
178
737
|
const reviewLabel = label('检查与导出', 'Review and export')
|
|
179
738
|
const outline = manifest.slides.map((slide, i) => `<li><button type="button" data-review-slide="${i + 1}"><span>${i + 1}</span>${escape(slide.title || label('无标题', 'Untitled'))}</button></li>`).join('')
|
|
180
739
|
const rows = issues.map(issue => `<li><button type="button" data-review-slide="${issue.slide}"><strong>${escape(label('第 ' + issue.slide + ' 页', 'Slide ' + issue.slide))} · ${escape(issue.message)}</strong><span>${escape(issue.suggestion)}</span></button></li>`).join('')
|
|
@@ -182,31 +741,52 @@ export function renderDelivery(manifest, files = {}, language) {
|
|
|
182
741
|
: manifest.quality ? label('静态检查发现 ' + issues.length + ' 项提示;请核对实际显示。', 'Static checks found ' + issues.length + ' item(s); review the actual slides.')
|
|
183
742
|
: label('此项目没有静态质量报告,请逐页检查。', 'No static quality report is available; review every slide.')
|
|
184
743
|
|
|
744
|
+
const slugBase = files.json
|
|
745
|
+
? basename(files.json, '.json')
|
|
746
|
+
: (manifest.title || 'presentation').replace(/[^\p{L}\p{N}._-]+/gu, '-').replace(/^-+|-+$/g, '') || 'presentation'
|
|
747
|
+
|
|
185
748
|
const handoutMarkdown = renderHandoutMarkdown(manifest, language)
|
|
186
|
-
const handoutFileName = files.handout
|
|
187
|
-
? basename(files.handout)
|
|
188
|
-
: (files.json ? basename(files.json, '.json') : (manifest.title || 'presentation').replace(/[^\p{L}\p{N}._-]+/gu, '-').replace(/^-+|-+$/g, '') || 'presentation') + '.handout.md'
|
|
749
|
+
const handoutFileName = files.handout ? basename(files.handout) : slugBase + '.handout.md'
|
|
189
750
|
const handoutLink = files.handout
|
|
190
751
|
? `<a id="download-handout" href="${escape(href(files.handout))}" download>${escape(handoutLabel)}</a>`
|
|
191
752
|
: `<a id="download-handout" href="#handout" download="${escape(handoutFileName)}">${escape(handoutLabel)}</a>`
|
|
192
753
|
|
|
754
|
+
const onePagerHtml = renderOnePagerHtml(manifest, language)
|
|
755
|
+
const onePagerFileName = files.onepager ? basename(files.onepager) : slugBase + '.onepager.html'
|
|
756
|
+
const onePagerLink = files.onepager
|
|
757
|
+
? `<a id="download-onepager" href="${escape(href(files.onepager))}" download>${escape(onePagerLabel)}</a>`
|
|
758
|
+
: `<a id="download-onepager" href="#onepager" download="${escape(onePagerFileName)}">${escape(onePagerLabel)}</a>`
|
|
759
|
+
|
|
760
|
+
const paceBudget = computePaceBudget(manifest)
|
|
761
|
+
const paceSummaryText = label(
|
|
762
|
+
`预计演讲时长 ${paceBudget.estimatedMinutes} 分钟(目标 ${paceBudget.targetMinutes} 分钟)${paceBudget.overBudgetSlides.length ? ` · 超预算页:${paceBudget.overBudgetSlides.join(', ')}` : ''}`,
|
|
763
|
+
`Estimated speaking pace: ${paceBudget.estimatedMinutes} min (target ${paceBudget.targetMinutes} min)${paceBudget.overBudgetSlides.length ? ` · Over-budget slides: ${paceBudget.overBudgetSlides.join(', ')}` : ''}`
|
|
764
|
+
)
|
|
765
|
+
|
|
193
766
|
const slideCues = (manifest.slides || []).map((s) => slideCueLines(s))
|
|
194
|
-
const targetMinutes =
|
|
767
|
+
const targetMinutes = paceBudget.targetMinutes
|
|
195
768
|
const deliveryConfig = {
|
|
196
769
|
lang: language || 'zh',
|
|
197
770
|
title: String(manifest.title || 'Presentation'),
|
|
198
771
|
channelId: String(manifest.deckId || manifest.title || 'dsh-ppt').slice(0, 64),
|
|
199
772
|
slideCues,
|
|
200
773
|
targetMinutes,
|
|
774
|
+
slideBudgets: paceBudget.slides.map(s => ({ seconds: s.seconds, status: s.status })),
|
|
201
775
|
handoutMarkdown,
|
|
202
776
|
handoutFileName,
|
|
203
777
|
hasSiblingHandout: Boolean(files.handout),
|
|
778
|
+
onePagerHtml,
|
|
779
|
+
onePagerFileName,
|
|
780
|
+
hasSiblingOnePager: Boolean(files.onepager),
|
|
204
781
|
labels: {
|
|
205
782
|
presenterTitle: label('演讲者提词台', 'Presenter Console'),
|
|
206
783
|
currentSlide: label('当前画面', 'CURRENT SLIDE'),
|
|
207
784
|
nextSlide: label('下一页预览', 'NEXT SLIDE'),
|
|
208
785
|
teleprompter: label('演讲提词器', 'TELEPROMPTER'),
|
|
209
786
|
autoCueBadge: label('自动提纲提示(无手写备注)', 'Auto cue (no speaker notes)'),
|
|
787
|
+
paceBudgetLabel: label('本页预算', 'Budget'),
|
|
788
|
+
paceOverLabel: label('超预算', 'Over'),
|
|
789
|
+
paceShortLabel: label('偏短', 'Short'),
|
|
210
790
|
noNotes: label('本页暂无演讲备注与要点提示', 'No notes or cues for this slide'),
|
|
211
791
|
elapsed: label('已用时间', 'Elapsed'),
|
|
212
792
|
remaining: label('目标倒计时', 'Remaining'),
|
|
@@ -236,7 +816,8 @@ export function renderDelivery(manifest, files = {}, language) {
|
|
|
236
816
|
<dialog id="review-panel" aria-labelledby="review-title">
|
|
237
817
|
<div class="review-head"><h2 id="review-title">${escape(reviewLabel)}</h2><button id="review-close" type="button">${escape(label('关闭', 'Close'))}</button></div>
|
|
238
818
|
<p id="review-summary">${escape(summary)}</p>
|
|
239
|
-
<
|
|
819
|
+
<p id="review-pace" class="review-pace">${escape(paceSummaryText)}</p>
|
|
820
|
+
<div class="review-exports">${download('pptx', pptxLabel, 'review-download-pptx')}${download('json', label('保存可编辑项目', 'Save project'), 'download-project')}${handoutLink}${onePagerLink}</div>
|
|
240
821
|
<p>${escape(label('用 PowerPoint / WPS 打开 PPTX 可直接修改文字、图片和图表。让 Agent 继续修改时,使用保存的项目文件;按 P 打开双屏演讲者提词台,按 L 开启虚拟激光笔。', 'Open the PPTX in PowerPoint / WPS to edit text, images and charts. Use the saved project when asking your Agent to revise it; press P for Dual-Screen Presenter Console and L for Virtual Laser Pointer.'))}</p>
|
|
241
822
|
<h3>${escape(label('检查提示 · 点击定位页面', 'Review items · click to open slide'))}</h3>
|
|
242
823
|
${issues.length ? `<ul id="review-issues">${rows}</ul>` : `<p>${escape(manifest.quality ? label('静态检查未发现问题;仍需核对实际排版和事实。', 'No static issues found; check the actual layout and facts.') : label('暂无报告。', 'No report available.'))}</p>`}
|
|
@@ -257,6 +838,7 @@ function initDelivery(go, setOverview, current, total, cfg) {
|
|
|
257
838
|
const panel = document.getElementById('review-panel')
|
|
258
839
|
const toggle = document.getElementById('review-toggle')
|
|
259
840
|
const handoutBtn = document.getElementById('download-handout')
|
|
841
|
+
const onePagerBtn = document.getElementById('download-onepager')
|
|
260
842
|
const laserDot = document.getElementById('dsh-laser-dot')
|
|
261
843
|
|
|
262
844
|
previous.addEventListener('click', () => go(Math.max(0, current() - 1)))
|
|
@@ -275,20 +857,30 @@ function initDelivery(go, setOverview, current, total, cfg) {
|
|
|
275
857
|
if (Number.isInteger(slide) && slide >= 1 && slide <= total) { go(slide - 1); setOverview(false); panel.close() }
|
|
276
858
|
}))
|
|
277
859
|
|
|
860
|
+
const triggerBlobDownload = (content, mime, fileName) => {
|
|
861
|
+
try {
|
|
862
|
+
const blob = new Blob([content || ''], { type: mime })
|
|
863
|
+
const url = URL.createObjectURL(blob)
|
|
864
|
+
const a = document.createElement('a')
|
|
865
|
+
a.href = url
|
|
866
|
+
a.download = fileName
|
|
867
|
+
document.body.appendChild(a)
|
|
868
|
+
a.click()
|
|
869
|
+
a.remove()
|
|
870
|
+
setTimeout(() => { try { URL.revokeObjectURL(url) } catch (_) {} }, 2500)
|
|
871
|
+
} catch (_) {}
|
|
872
|
+
}
|
|
873
|
+
|
|
278
874
|
if (handoutBtn && cfg && !cfg.hasSiblingHandout) {
|
|
279
875
|
handoutBtn.addEventListener('click', (event) => {
|
|
280
876
|
event.preventDefault()
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
a.click()
|
|
289
|
-
a.remove()
|
|
290
|
-
setTimeout(() => { try { URL.revokeObjectURL(url) } catch (_) {} }, 2500)
|
|
291
|
-
} catch (_) {}
|
|
877
|
+
triggerBlobDownload(cfg.handoutMarkdown || '', 'text/markdown;charset=utf-8', cfg.handoutFileName || 'handout.md')
|
|
878
|
+
})
|
|
879
|
+
}
|
|
880
|
+
if (onePagerBtn && cfg && !cfg.hasSiblingOnePager) {
|
|
881
|
+
onePagerBtn.addEventListener('click', (event) => {
|
|
882
|
+
event.preventDefault()
|
|
883
|
+
triggerBlobDownload(cfg.onePagerHtml || '', 'text/html;charset=utf-8', cfg.onePagerFileName || 'onepager.html')
|
|
292
884
|
})
|
|
293
885
|
}
|
|
294
886
|
|
|
@@ -339,6 +931,7 @@ function initDelivery(go, setOverview, current, total, cfg) {
|
|
|
339
931
|
total,
|
|
340
932
|
slides: slidesList.map(s => s.outerHTML),
|
|
341
933
|
cues: cfg?.slideCues || [],
|
|
934
|
+
budgets: cfg?.slideBudgets || [],
|
|
342
935
|
})
|
|
343
936
|
}
|
|
344
937
|
|
|
@@ -355,6 +948,7 @@ function initDelivery(go, setOverview, current, total, cfg) {
|
|
|
355
948
|
nextTitle: titleOf(nxt),
|
|
356
949
|
notes: rawNotes,
|
|
357
950
|
cue: fallbackCue,
|
|
951
|
+
budget: cfg?.slideBudgets?.[i] || null,
|
|
358
952
|
blank: document.body.classList.contains('blank-black') ? 'black' : (document.body.classList.contains('blank-white') ? 'white' : null),
|
|
359
953
|
laser: laserActive,
|
|
360
954
|
})
|
|
@@ -379,6 +973,7 @@ function initDelivery(go, setOverview, current, total, cfg) {
|
|
|
379
973
|
'.lbl-row{display:flex;align-items:center;justify-content:space-between;gap:8px}',
|
|
380
974
|
'.lbl{color:var(--accent);font-size:11px;font-weight:700;letter-spacing:.12em;text-transform:uppercase}',
|
|
381
975
|
'.cue-badge{font-size:11px;color:var(--muted);padding:2px 8px;border-radius:99px;border:1px solid color-mix(in srgb,var(--muted) 35%,transparent)}',
|
|
976
|
+
'.cue-badge.is-over{color:#EF4444;border-color:#EF4444}.cue-badge.is-short{color:#F59E0B;border-color:#F59E0B}',
|
|
382
977
|
'.pv{position:relative;width:100%;aspect-ratio:16/9;overflow:hidden;border-radius:8px;background:var(--bg);border:1px solid color-mix(in srgb,var(--muted) 25%,transparent);--pv-scale:.3}',
|
|
383
978
|
'.pv.laser-on{cursor:crosshair}',
|
|
384
979
|
'.pv-slide{position:absolute;left:0;top:0;transform:translate(var(--pv-x,0px),var(--pv-y,0px)) scale(var(--pv-scale,.25));transform-origin:top left;pointer-events:none}',
|
|
@@ -404,7 +999,7 @@ function initDelivery(go, setOverview, current, total, cfg) {
|
|
|
404
999
|
'.hint{color:var(--muted);font-size:11px;width:100%}',
|
|
405
1000
|
].join('')
|
|
406
1001
|
const js = [
|
|
407
|
-
`var total=0,index=0,elapsed=0,started=Date.now(),paused=false,notesSize=20,slides=[],cues=[],targetSecs=${targetSecs},curBlank=null,laserOn=false,initialized=false,readyTries=0;`,
|
|
1002
|
+
`var total=0,index=0,elapsed=0,started=Date.now(),paused=false,notesSize=20,slides=[],cues=[],budgets=[],targetSecs=${targetSecs},curBlank=null,laserOn=false,initialized=false,readyTries=0;`,
|
|
408
1003
|
`var bc=null;try{if(typeof BroadcastChannel==="function"&&${JSON.stringify(channelName)})bc=new BroadcastChannel(${JSON.stringify(channelName)});}catch(_){bc=null;}`,
|
|
409
1004
|
'function q(id){return document.getElementById(id)}',
|
|
410
1005
|
'function post(m){try{if(bc)bc.postMessage(m)}catch(_){}try{if(window.opener)window.opener.postMessage(m,"*")}catch(_){}}',
|
|
@@ -415,13 +1010,13 @@ function initDelivery(go, setOverview, current, total, cfg) {
|
|
|
415
1010
|
'function fit(){fitBox(q("pv-cur"));fitBox(q("pv-next"));var th=q("thumbs").children;for(var i=0;i<th.length;i++){fitBox(th[i])}}',
|
|
416
1011
|
'function setSlide(box,html){var dot=box.id==="pv-cur"?q("pv-laser-preview"):null;box.innerHTML="";var f=document.createElement("div");f.className="pv-slide";f.innerHTML=html;box.appendChild(f);if(dot)box.appendChild(dot)}',
|
|
417
1012
|
'function buildThumbs(){var box=q("thumbs");box.innerHTML="";slides.forEach(function(html,i){var t=document.createElement("div");t.className="thumb";var f=document.createElement("div");f.className="pv-slide";f.innerHTML=html;t.appendChild(f);t.addEventListener("click",function(){post({__dshPpt:"cmd",kind:"go",index:i})});box.appendChild(t)});fit()}',
|
|
418
|
-
'function renderState(st){index=st.index;total=st.total||total;q("pcounter").textContent=(index+1)+" / "+total;setSlide(q("pv-cur"),slides[index]||"");setSlide(q("pv-next"),slides[(index+1)%total]||"");var hasNotes=Boolean(st.notes&&st.notes.trim());var cue=st.cue||cues[index]||"";q("pcue-badge").style.display=(!hasNotes&&cue)?"inline-block":"none";q("pnotes").textContent=hasNotes?st.notes:(cue||' + JSON.stringify(L.noNotes || 'No notes') + ');q("pprog").style.width=((index+1)/Math.max(1,total)*100)+"%";curBlank=st.blank||null;q("pv-black").setAttribute("aria-pressed",curBlank==="black"?"true":"false");q("pv-white").setAttribute("aria-pressed",curBlank==="white"?"true":"false");q("pv-black").textContent=curBlank==="black"?' + JSON.stringify(L.unblack || 'Unblack') + ':' + JSON.stringify(L.black || 'Black') + ';q("pv-white").textContent=curBlank==="white"?' + JSON.stringify(L.unwhite || 'Unwhite') + ':' + JSON.stringify(L.white || 'White') + ';if(typeof st.laser==="boolean"){laserOn=st.laser;syncLaserUi()}var th=q("thumbs").children;for(var i=0;i<th.length;i++){th[i].classList.toggle("is-current",i===index)}fit()}',
|
|
1013
|
+
'function renderState(st){index=st.index;total=st.total||total;q("pcounter").textContent=(index+1)+" / "+total;setSlide(q("pv-cur"),slides[index]||"");setSlide(q("pv-next"),slides[(index+1)%total]||"");var hasNotes=Boolean(st.notes&&st.notes.trim());var cue=st.cue||cues[index]||"";q("pcue-badge").style.display=(!hasNotes&&cue)?"inline-block":"none";var b=st.budget||budgets[index];var be=q("pslide-budget");if(b&&be){var txt=' + JSON.stringify(L.paceBudgetLabel || 'Budget') + '+" "+fmt((b.seconds||0)*1000,false);if(b.status==="over-budget")txt+=" · "+' + JSON.stringify(L.paceOverLabel || 'Over') + ';else if(b.status==="under-budget")txt+=" · "+' + JSON.stringify(L.paceShortLabel || 'Short') + ';be.textContent=txt;be.classList.toggle("is-over",b.status==="over-budget");be.classList.toggle("is-short",b.status==="under-budget");be.style.display="inline-block"}else if(be){be.style.display="none"}q("pnotes").textContent=hasNotes?st.notes:(cue||' + JSON.stringify(L.noNotes || 'No notes') + ');q("pprog").style.width=((index+1)/Math.max(1,total)*100)+"%";curBlank=st.blank||null;q("pv-black").setAttribute("aria-pressed",curBlank==="black"?"true":"false");q("pv-white").setAttribute("aria-pressed",curBlank==="white"?"true":"false");q("pv-black").textContent=curBlank==="black"?' + JSON.stringify(L.unblack || 'Unblack') + ':' + JSON.stringify(L.black || 'Black') + ';q("pv-white").textContent=curBlank==="white"?' + JSON.stringify(L.unwhite || 'Unwhite') + ':' + JSON.stringify(L.white || 'White') + ';if(typeof st.laser==="boolean"){laserOn=st.laser;syncLaserUi()}var th=q("thumbs").children;for(var i=0;i<th.length;i++){th[i].classList.toggle("is-current",i===index)}fit()}',
|
|
419
1014
|
'function syncLaserUi(){q("laser-btn").setAttribute("aria-pressed",laserOn?"true":"false");q("pv-cur").classList.toggle("laser-on",laserOn);if(!laserOn)q("pv-laser-preview").style.display="none"}',
|
|
420
1015
|
'function toggleLaser(){laserOn=!laserOn;syncLaserUi();post({__dshPpt:"cmd",kind:"laser",active:laserOn,x:0.5,y:0.5})}',
|
|
421
1016
|
'function togglePause(){paused=!paused;if(!paused)started=Date.now()-elapsed;var b=q("pause");b.setAttribute("aria-pressed",paused?"true":"false");b.textContent=paused?' + JSON.stringify(L.resume || 'Resume') + ':' + JSON.stringify(L.pause || 'Pause') + '}',
|
|
422
1017
|
'function resetTimer(){started=Date.now();elapsed=0}',
|
|
423
1018
|
'function applyNotesSize(){document.documentElement.style.setProperty("--notes-size",notesSize+"px")}',
|
|
424
|
-
'function handleMsg(d){if(!d)return;if(d.__dshPpt==="init"&&!initialized){initialized=true;slides=d.slides||[];cues=d.cues||[];total=d.total||slides.length;var st=document.createElement("style");st.textContent=d.css||"";document.head.appendChild(st);q("ptitle").textContent=d.title||"";buildThumbs()}else if(d.__dshPpt==="state"){renderState(d)}else if(d.__dshPpt==="close"){window.close()}}',
|
|
1019
|
+
'function handleMsg(d){if(!d)return;if(d.__dshPpt==="init"&&!initialized){initialized=true;slides=d.slides||[];cues=d.cues||[];budgets=d.budgets||[];total=d.total||slides.length;var st=document.createElement("style");st.textContent=d.css||"";document.head.appendChild(st);q("ptitle").textContent=d.title||"";buildThumbs()}else if(d.__dshPpt==="state"){renderState(d)}else if(d.__dshPpt==="close"){window.close()}}',
|
|
425
1020
|
'window.addEventListener("message",function(e){handleMsg(e.data)});if(bc){bc.onmessage=function(e){handleMsg(e.data)}}',
|
|
426
1021
|
'window.addEventListener("resize",fit);',
|
|
427
1022
|
'window.addEventListener("beforeunload",function(){post({__dshPpt:"cmd",kind:"closed"})});',
|
|
@@ -445,7 +1040,7 @@ function initDelivery(go, setOverview, current, total, cfg) {
|
|
|
445
1040
|
+ '<div class="card"><div class="lbl-row"><span class="lbl">' + escape(L.currentSlide || 'CURRENT') + '</span></div><div class="pv" id="pv-cur"><div id="pv-laser-preview"></div></div></div>'
|
|
446
1041
|
+ '<div class="card"><div class="lbl">' + escape(L.nextSlide || 'NEXT') + '</div><div class="pv" id="pv-next"></div></div>'
|
|
447
1042
|
+ '<div class="card"><div class="lbl">SLIDES</div><div id="thumbs"></div></div>'
|
|
448
|
-
+ '</div><div class="col"><div class="card card-notes"><div class="lbl-row"><span class="lbl">' + escape(L.teleprompter || 'TELEPROMPTER') + '</span><span id="pcue-badge" class="cue-badge" style="display:none">' + escape(L.autoCueBadge || 'Auto cue') + '</span></div><div id="pnotes"></div></div></div></main>'
|
|
1043
|
+
+ '</div><div class="col"><div class="card card-notes"><div class="lbl-row"><span class="lbl">' + escape(L.teleprompter || 'TELEPROMPTER') + '</span><span style="display:flex;gap:6px;align-items:center"><span id="pslide-budget" class="cue-badge" style="display:none"></span><span id="pcue-badge" class="cue-badge" style="display:none">' + escape(L.autoCueBadge || 'Auto cue') + '</span></span></div><div id="pnotes"></div></div></div></main>'
|
|
449
1044
|
+ '<footer>'
|
|
450
1045
|
+ '<button id="prev">◀</button><button id="next">▶</button>'
|
|
451
1046
|
+ '<button id="pause" aria-pressed="false">' + escape(L.pause || 'Pause') + '</button>'
|