dsh-ppt 0.34.0 → 0.35.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.
@@ -100,6 +100,12 @@ import {
100
100
  renderCoreSlidePptx,
101
101
  renderCoreSlideHtml,
102
102
  LAYOUT_CSS,
103
+ buildLayoutCss,
104
+ EXEC_CHART_LAYOUTS,
105
+ computeIssueTreeModel,
106
+ computeTreemapModel,
107
+ computeGaugeModel,
108
+ computePricingModel,
103
109
  } from './deck-layouts.mjs'
104
110
 
105
111
  export {
@@ -166,6 +172,12 @@ export {
166
172
  has2dMathConstruct,
167
173
  measureMathAst,
168
174
  fitFormulaBoxIn,
175
+ buildLayoutCss,
176
+ EXEC_CHART_LAYOUTS,
177
+ computeIssueTreeModel,
178
+ computeTreemapModel,
179
+ computeGaugeModel,
180
+ computePricingModel,
169
181
  }
170
182
 
171
183
  /**
@@ -1155,12 +1167,15 @@ function normalizeSlideContent(raw, index) {
1155
1167
  const rawEvidenceIds = Array.isArray(source.evidenceIds)
1156
1168
  ? [...new Set(source.evidenceIds.map((id) => stripInlineMarkdown(id).trim().toUpperCase()).filter(Boolean))].slice(0, 12)
1157
1169
  : undefined
1170
+ const rawReveal = String(source.reveal ?? '').trim().toLowerCase()
1171
+ const reveal = rawReveal === 'step' || rawReveal === 'all' ? rawReveal : undefined
1158
1172
 
1159
1173
  const commonExtras = {
1160
1174
  ...(variant !== '' ? { variant } : {}),
1161
1175
  ...(chrome ? { chrome } : {}),
1162
1176
  ...(cardMaterial ? { cardMaterial } : {}),
1163
1177
  ...(iconMode ? { iconMode } : {}),
1178
+ ...(reveal ? { reveal } : {}),
1164
1179
  ...(formula !== '' ? { formula } : {}),
1165
1180
  ...(mermaid !== '' ? { mermaid } : {}),
1166
1181
  ...(rawCode !== '' ? { code: rawCode } : {}),
@@ -1206,7 +1221,7 @@ function normalizeSlideContent(raw, index) {
1206
1221
  return { layout, kicker, title: truncate(quoteText, 220), subtitle, ...commonExtras }
1207
1222
  }
1208
1223
 
1209
- if (layout === 'harvey' || layout === 'marimekko' || layout === 'sankey' || layout === 'quadrant' || layout === 'radar' || layout === 'dumbbell' || layout === 'heatmap' || layout === 'map' || layout === 'isometric') {
1224
+ if (layout === 'harvey' || layout === 'marimekko' || layout === 'sankey' || layout === 'quadrant' || layout === 'radar' || layout === 'dumbbell' || layout === 'heatmap' || layout === 'map' || layout === 'isometric' || layout === 'treemap') {
1210
1225
  let rows = []
1211
1226
  if (Array.isArray(source.rows)) {
1212
1227
  rows = source.rows
@@ -1302,7 +1317,9 @@ export function normalizeBuildOptions(options = {}) {
1302
1317
  const outputDir = resolvePath(String(options.outputDir ?? '.').trim() || '.')
1303
1318
  const fileName = sanitizeFileName(options.fileName ?? title)
1304
1319
  const overwrite = options.overwrite === true
1305
- return { title, theme, language, motion, deck, outputDir, fileName, overwrite }
1320
+ const rawMotionProfile = String(options.motionProfile ?? '').trim().toLowerCase()
1321
+ const motionProfile = ['subtle', 'executive', 'keynote'].includes(rawMotionProfile) ? rawMotionProfile : undefined
1322
+ return { title, theme, language, motion, ...(motionProfile ? { motionProfile } : {}), deck, outputDir, fileName, overwrite }
1306
1323
  }
1307
1324
 
1308
1325
  /**
@@ -1388,6 +1405,7 @@ export function buildDeck(options = {}) {
1388
1405
  theme: theme.id,
1389
1406
  language: language.id,
1390
1407
  motion,
1408
+ ...(normalized.motionProfile ? { motionProfile: normalized.motionProfile } : {}),
1391
1409
  ...(targetMinutes !== undefined ? { targetMinutes } : {}),
1392
1410
  slideCount: deck.slides.length,
1393
1411
  slides: deck.slides,
@@ -1448,8 +1466,17 @@ body.motion .bullets li{
1448
1466
  opacity:0;animation:bullet-in .55s cubic-bezier(.22,.8,.36,1) forwards;
1449
1467
  animation-delay:calc(var(--i, 0)*90ms + .12s);
1450
1468
  }
1451
- @keyframes bullet-in{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}`
1469
+ @keyframes bullet-in{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
1470
+ body.motion .slide[data-reveal="step"] [data-reveal-step]{opacity:0;transform:translateY(14px);transition:opacity .38s ease,transform .38s ease}
1471
+ body.motion .slide[data-reveal="step"] [data-reveal-step].is-revealed,body.overview .slide[data-reveal="step"] [data-reveal-step]{opacity:1;transform:none}`
1452
1472
  : ''
1473
+ const needsMediaCss = Boolean(
1474
+ manifest.brand?.logoAssetId ||
1475
+ manifest.brand?.footer ||
1476
+ manifest.brand?.watermark ||
1477
+ manifest.slides.some((s) => deckMedia.MEDIA_LAYOUTS.has(s.layout) || s.image || (Array.isArray(s.images) && s.images.length > 0) || s.chart)
1478
+ )
1479
+ const treeShakenLayoutCss = buildLayoutCss(manifest.slides)
1453
1480
  const slides = manifest.slides.map((slide, index) => {
1454
1481
  const label = slide.title || slide.kicker || (ui.slide + ' ' + (index + 1))
1455
1482
  return '<div class="slide-frame" data-frame="' + (index + 1) + '" tabindex="-1" role="button" aria-label="' + escapeHtml(String(label)) + '">' +
@@ -1516,8 +1543,8 @@ body{
1516
1543
  }
1517
1544
  .slide.is-active{display:flex}
1518
1545
  ${motionCss}
1519
- ${LAYOUT_CSS}
1520
- ${deckMedia.MEDIA_CSS}
1546
+ ${treeShakenLayoutCss}
1547
+ ${needsMediaCss ? deckMedia.MEDIA_CSS : ''}
1521
1548
  ${VISUAL_CSS}
1522
1549
  .kicker{
1523
1550
  color:var(--accent-text);font-weight:700;letter-spacing:.14em;text-transform:uppercase;
@@ -1672,7 +1699,7 @@ body.presenting #hud:hover{opacity:1;pointer-events:auto}
1672
1699
  html,body{height:auto;overflow:visible;background:#fff}
1673
1700
  .slide-frame{position:relative;display:block !important}
1674
1701
  .slide{position:relative;display:block !important;height:100vh;page-break-after:always;padding:48px}
1675
- ${motion ? 'body.motion .bullets li{opacity:1 !important;animation:none !important}' : ''}
1702
+ ${motion ? 'body.motion .bullets li{opacity:1 !important;transform:none !important;animation:none !important}\n body.motion .slide[data-reveal="step"] [data-reveal-step]{opacity:1 !important;transform:none !important;animation:none !important}' : ''}
1676
1703
  #progress,#hud,#notes-panel,#help-panel,#toast{display:none !important}
1677
1704
  }
1678
1705
  ${delivery.css}
@@ -1793,12 +1820,32 @@ ${slides}
1793
1820
 
1794
1821
  function updatePresenter() { sendState(); }
1795
1822
 
1823
+ function resetStepReveal(slideEl) {
1824
+ if (!slideEl || slideEl.dataset.reveal !== 'step') return;
1825
+ slideEl.querySelectorAll('[data-reveal-step]').forEach(function (el) { el.classList.remove('is-revealed'); });
1826
+ }
1827
+ function advanceStep(dir) {
1828
+ const curSlide = slides[index];
1829
+ if (!curSlide || curSlide.dataset.reveal !== 'step' || !document.body.classList.contains('motion')) return false;
1830
+ const steps = Array.from(curSlide.querySelectorAll('[data-reveal-step]'));
1831
+ if (steps.length === 0) return false;
1832
+ if (dir > 0) {
1833
+ const nextHidden = steps.find(function (el) { return !el.classList.contains('is-revealed'); });
1834
+ if (nextHidden) { nextHidden.classList.add('is-revealed'); return true; }
1835
+ return false;
1836
+ }
1837
+ const revealed = steps.filter(function (el) { return el.classList.contains('is-revealed'); });
1838
+ if (revealed.length > 0) { revealed[revealed.length - 1].classList.remove('is-revealed'); return true; }
1839
+ return false;
1840
+ }
1841
+
1796
1842
  function go(next) {
1797
1843
  if (document.body.classList.contains('blank-black') || document.body.classList.contains('blank-white')) setBlank(null);
1798
1844
  const wrapped = next < 0 || next >= total;
1799
1845
  index = (next + total) % total;
1800
1846
  slides.forEach(function (slide, i) {
1801
1847
  slide.classList.toggle('is-active', i === index);
1848
+ if (i === index) resetStepReveal(slide);
1802
1849
  if (frames[i]) frames[i].classList.toggle('is-current', i === index);
1803
1850
  });
1804
1851
  counter.textContent = ui.slide + ' ' + (index + 1) + ' ' + ui.of + ' ' + total;
@@ -2021,9 +2068,11 @@ ${slides}
2021
2068
  }
2022
2069
  const inOverview = document.body.classList.contains('overview');
2023
2070
  if (key === 'ArrowRight' || key === 'PageDown' || key === ' ' || (key === 'ArrowDown' && !inOverview)) {
2024
- event.preventDefault(); go(index + 1);
2071
+ event.preventDefault();
2072
+ if (inOverview || !advanceStep(1)) go(index + 1);
2025
2073
  } else if (key === 'ArrowLeft' || key === 'PageUp' || (key === 'ArrowUp' && !inOverview)) {
2026
- event.preventDefault(); go(index - 1);
2074
+ event.preventDefault();
2075
+ if (inOverview || !advanceStep(-1)) go(index - 1);
2027
2076
  } else if (/^[1-9]$/.test(key) && !inOverview) {
2028
2077
  const jumped = Number(key);
2029
2078
  if (jumped <= total) { event.preventDefault(); go(jumped - 1); }
@@ -2111,10 +2160,20 @@ function renderHtmlSlide(slide, index, ui, langId, manifest = {}, theme) {
2111
2160
  const total = manifest.slides?.length ?? 1
2112
2161
  const number = String(index + 1).padStart(2, '0')
2113
2162
  const chromeStyle = resolveChromeStyle(theme, slide, manifest.brand)
2114
- const inner = deckMedia.MEDIA_LAYOUTS.has(layout)
2163
+ let inner = deckMedia.MEDIA_LAYOUTS.has(layout)
2115
2164
  ? deckMedia.renderMediaHtml(slide, manifest, theme)
2116
2165
  : renderCoreSlideHtml(slide, index, total, ui, langId, manifest, theme)
2117
2166
 
2167
+ const isStepReveal = slide.reveal === 'step'
2168
+ if (isStepReveal && inner.includes('data-item-index="')) {
2169
+ let stepSeq = 0
2170
+ inner = inner.replace(/data-item-index="(\d+)"/g, (_, idxStr) => {
2171
+ stepSeq += 1
2172
+ return `data-item-index="${idxStr}" data-reveal-step="${stepSeq}"`
2173
+ })
2174
+ }
2175
+ const revealAttr = isStepReveal ? ' data-reveal="step"' : ''
2176
+
2118
2177
  const notesAttr = typeof slide.notes === 'string' && slide.notes.trim() !== ''
2119
2178
  ? ' data-notes="' + escapeHtml(slide.notes) + '"'
2120
2179
  : ''
@@ -2133,7 +2192,7 @@ function renderHtmlSlide(slide, index, ui, langId, manifest = {}, theme) {
2133
2192
  ? '<div class="brand-watermark" aria-label="Watermark">' + escapeHtml(manifest.brand.watermark.trim()) + '</div>'
2134
2193
  : ''
2135
2194
 
2136
- return '<section class="' + slideClasses + '" data-index="' + number + '"' + chromeAttr + notesAttr + densityAttr + tableStyleAttr + (visualStyle ? ' style="' + escapeHtml(visualStyle) + '"' : '') + '>' +
2195
+ return '<section class="' + slideClasses + '" data-index="' + number + '"' + chromeAttr + revealAttr + notesAttr + densityAttr + tableStyleAttr + (visualStyle ? ' style="' + escapeHtml(visualStyle) + '"' : '') + '>' +
2137
2196
  '<div class="slide-inner">' + inner + '</div>' +
2138
2197
  watermarkHtml +
2139
2198
  (hasLogo ? '<img class="brand-logo" src="' + escapeHtml(manifest.assets?.[manifest.brand.logoAssetId]?.data ?? '') + '" alt="' + escapeHtml(manifest.brand.name || 'Logo') + '"/>' : '') +
@@ -2223,15 +2282,70 @@ function bulletTimingXml(spid, clicks) {
2223
2282
  '<p:bldLst><p:bldP spid="' + spid + '" grpId="0"/></p:bldLst></p:timing>'
2224
2283
  }
2225
2284
 
2285
+ function multiShapeTimingXml(spids) {
2286
+ let id = 2
2287
+ const nextId = () => { id += 1; return String(id) }
2288
+ const clickPars = spids.map((spid, grpIdx) =>
2289
+ '<p:par><p:cTn id="' + nextId() + '" fill="hold"><p:stCondLst><p:cond delay="indefinite"/></p:stCondLst><p:childTnLst>' +
2290
+ '<p:par><p:cTn id="' + nextId() + '" presetID="10" presetClass="entr" presetSubtype="0" fill="hold" grpId="' + grpIdx + '" nodeType="clickEffect">' +
2291
+ '<p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst>' +
2292
+ '<p:set><p:cBhvr><p:cTn id="' + nextId() + '" dur="1" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst></p:cTn>' +
2293
+ '<p:tgtEl><p:spTgt spid="' + spid + '"/></p:tgtEl>' +
2294
+ '<p:attrNameLst><p:attrName>style.visibility</p:attrName></p:attrNameLst></p:cBhvr>' +
2295
+ '<p:to><p:strVal val="visible"/></p:to></p:set>' +
2296
+ '<p:animEffect transition="in" filter="fade"><p:cBhvr><p:cTn id="' + nextId() + '" dur="350"/>' +
2297
+ '<p:tgtEl><p:spTgt spid="' + spid + '"/></p:tgtEl></p:cBhvr></p:animEffect>' +
2298
+ '</p:childTnLst></p:cTn></p:par>' +
2299
+ '</p:childTnLst></p:cTn></p:par>',
2300
+ )
2301
+ const bldPs = spids.map((spid, grpIdx) => '<p:bldP spid="' + spid + '" grpId="' + grpIdx + '"/>').join('')
2302
+ return '<p:timing><p:tnLst><p:par>' +
2303
+ '<p:cTn id="1" dur="indefinite" restart="never" nodeType="tmRoot"><p:childTnLst>' +
2304
+ '<p:seq concurrent="1" nextAc="seek"><p:cTn id="2" dur="indefinite" nodeType="mainSeq"><p:childTnLst>' +
2305
+ clickPars.join('') +
2306
+ '</p:childTnLst></p:cTn>' +
2307
+ '<p:prevCondLst><p:cond evt="onPrev" delay="0"><p:tgtEl><p:sldTgt/></p:tgtEl></p:cond></p:prevCondLst>' +
2308
+ '<p:nextCondLst><p:cond evt="onNext" delay="0"><p:tgtEl><p:sldTgt/></p:tgtEl></p:cond></p:nextCondLst>' +
2309
+ '</p:seq></p:childTnLst></p:cTn></p:par></p:tnLst>' +
2310
+ '<p:bldLst>' + bldPs + '</p:bldLst></p:timing>'
2311
+ }
2312
+
2313
+ function extractStepRevealSpids(shapesXml) {
2314
+ const spids = []
2315
+ const seen = new Set()
2316
+ const stepNameRe = /<p:cNvPr\s+id="(\d+)"\s+name="((?:KPI Surface|KPI Hero Surface|KPI Sat Val|Card Surface|Card Hero Surface|Comparison Card|Issue Card|Matrix Surface|Matrix Cell|Matrix Quadrant|Step Surface|Timeline Card|Timeline Step|Stage |Layer |Chevron |Iso Info Card|Iso Pillar Cap|Iso Stack Card|IssueTree Branch|Pricing Card|Gauge Row)[^"]*)"/gi
2317
+ for (const m of shapesXml.matchAll(stepNameRe)) {
2318
+ const spid = m[1]
2319
+ const name = m[2]
2320
+ if (/hairline|rule|bar|shadow|top|bottom|accent|editorial|label|tag|badge|head|title|desc|stripe|axis|connector|number|rail|leader|anchor|tick|pill/i.test(name)) continue
2321
+ if (!seen.has(spid)) {
2322
+ seen.add(spid)
2323
+ spids.push(spid)
2324
+ }
2325
+ }
2326
+ return spids.slice(0, 8)
2327
+ }
2328
+
2329
+ function transitionXmlFor(motionProfile) {
2330
+ if (motionProfile === 'subtle') return '<p:transition spd="fast"><p:fade/></p:transition>'
2331
+ if (motionProfile === 'keynote') return '<p:transition spd="med"><p:push dir="l"/></p:transition>'
2332
+ return '<p:transition spd="med"><p:fade/></p:transition>'
2333
+ }
2334
+
2226
2335
  function slideXml(slide, index, total, theme, langId, motion, manifest = {}) {
2227
2336
  const p = theme.palette
2228
2337
  const shapesXml = slideShapeList(slide, index, total, theme, langId, manifest)
2229
2338
  let motionXml = ''
2230
2339
  if (motion) {
2231
- motionXml = '<p:transition spd="med"><p:fade/></p:transition>'
2340
+ motionXml = transitionXmlFor(manifest.motionProfile)
2232
2341
  const bullets = Array.isArray(slide.bullets) ? slide.bullets : []
2233
2342
  const bodySpid = (index + 1) * 10 + 3
2234
- if (slide.layout === 'bullets' && bullets.length >= 2 && shapesXml.includes('id="' + bodySpid + '"')) {
2343
+ if (slide.reveal === 'step' && slide.layout !== 'bullets') {
2344
+ const stepSpids = extractStepRevealSpids(shapesXml)
2345
+ if (stepSpids.length >= 2) {
2346
+ motionXml += multiShapeTimingXml(stepSpids)
2347
+ }
2348
+ } else if (slide.layout === 'bullets' && bullets.length >= 2 && shapesXml.includes('id="' + bodySpid + '"')) {
2235
2349
  motionXml += bulletTimingXml(bodySpid, bullets.length)
2236
2350
  }
2237
2351
  }
@@ -2387,7 +2501,7 @@ function slideLayoutRelXml() {
2387
2501
  '</Relationships>'
2388
2502
  }
2389
2503
 
2390
- function themeXml(theme) {
2504
+ export function themeXml(theme) {
2391
2505
  const p = theme.palette
2392
2506
  const series = theme.tokens?.chartSeries ?? [p.accent, p.accent2, p.fg, p.muted, p.accent, p.accent2]
2393
2507
  const color = (name, value) => '<a:' + name + '><a:srgbClr val="' + hex(value) + '"/></a:' + name + '>'
@@ -2471,7 +2585,7 @@ function appXml(slideCount, notesCount) {
2471
2585
  '</Properties>'
2472
2586
  }
2473
2587
 
2474
- function buildZip(entries) {
2588
+ export function buildZip(entries) {
2475
2589
  const chunks = []
2476
2590
  const central = []
2477
2591
  let offset = 0
@@ -11,7 +11,8 @@ const VISUAL_DIAGRAM_LAYOUTS = new Set([
11
11
  'chart', 'chart-split', 'table', 'gantt', 'architecture', 'harvey',
12
12
  'tam', 'org', 'marimekko', 'sankey', 'value-chain', 'swot',
13
13
  'process', 'matrix', 'mermaid', 'flowchart', 'sequence',
14
- 'quadrant', 'radar', 'dumbbell', 'heatmap', 'map', 'isometric', 'mockup', 'code',
14
+ 'quadrant', 'radar', 'dumbbell', 'heatmap', 'map', 'isometric',
15
+ 'issue-tree', 'treemap', 'gauge', 'pricing', 'mockup', 'code',
15
16
  'image', 'image-left', 'image-right', 'gallery',
16
17
  ])
17
18
 
@@ -961,18 +962,36 @@ export function renderDelivery(manifest, files = {}, language) {
961
962
  autoTourStart: label('自动导览', 'Auto-Tour'),
962
963
  autoTourStop: label('停止导览', 'Stop Tour'),
963
964
  qaFinished: label('Q&A 倒计时结束', 'Q&A time is up'),
965
+ reviewCommentSaved: label('已保存当前页审阅批注', 'Review comment pinned to slide'),
966
+ reviewCommentEmpty: label('暂无批注;按 R 添加当前页修改意见并导出给 AI 修订', 'No comments yet; add feedback for this slide and export JSON for AI revision'),
967
+ reviewExported: label('已导出 review-feedback.json,可直接发给 AI 自动修订', 'Exported review-feedback.json for AI revision'),
964
968
  hint: label('← → 翻页 · P/空格 暂停 · T 重置 · A+/A- 字号 · L 激光笔 · B/W 黑白屏 · Esc 结束', '← → Navigate · T Reset · A+/A- Zoom · L Laser · B/W Blank · Esc End'),
965
969
  },
966
970
  }
967
971
 
968
972
  return {
969
973
  body: `<div id="delivery-bar">
970
- <span id="delivery-status">${escape(draft ? label('待补全草稿', 'Draft: content needed') : label('演示文稿 · Ctrl+K 速搜 · D 标注 · T 计时 · A 导览', 'Presentation · Ctrl+K Jump · D Draw · T Timer · A Tour'))}</span>
974
+ <span id="delivery-status">${escape(draft ? label('待补全草稿', 'Draft: content needed') : label('演示文稿 · Ctrl+K 速搜 · R 批注 · D 标注 · T 计时 · A 导览', 'Presentation · Ctrl+K Jump · R Comment · D Draw · T Timer · A Tour'))}</span>
971
975
  <button id="dsh-jump-open" type="button" title="Ctrl/Cmd+K">${escape(label('速搜 (⌘K)', 'Search (⌘K)'))}</button>
976
+ <button id="dsh-comments-btn" type="button" title="R">${escape(label('批注 (R)', 'Comments (R)'))}</button>
972
977
  <button id="dsh-autotour-btn" type="button" aria-pressed="false" title="A">${escape(label('自动导览', 'Auto-Tour'))}</button>
973
978
  ${download('pptx', pptxLabel, 'download-pptx')}
974
979
  <button id="review-toggle" type="button" aria-haspopup="dialog">${escape(reviewLabel)}</button>
975
980
  </div>
981
+ <aside id="dsh-review-comments" hidden role="region" aria-label="${escape(label('离线审阅批注面板', 'Offline Review Comments'))}">
982
+ <div class="dsh-rc-head">
983
+ <strong>${escape(label('审阅批注 · 离线回流 AI', 'Review Comments · Export for AI'))}</strong>
984
+ <button type="button" id="dsh-rc-close" aria-label="${escape(label('关闭', 'Close'))}">✕</button>
985
+ </div>
986
+ <div id="dsh-rc-slide-ctx" class="dsh-rc-ctx"></div>
987
+ <input id="dsh-rc-author" type="text" placeholder="${escape(label('审阅人(可选,如 老板 / CFO)', 'Reviewer (optional, e.g. CFO)'))}"/>
988
+ <textarea id="dsh-rc-input" rows="3" placeholder="${escape(label('输入本页修改意见(如:把第3项数字放大并补充对比口径)…', 'Write slide-pinned revision note…'))}"></textarea>
989
+ <div class="dsh-rc-actions">
990
+ <button type="button" id="dsh-rc-add">${escape(label('添加批注', 'Pin Comment'))}</button>
991
+ <button type="button" id="dsh-rc-export">${escape(label('导出 Feedback JSON', 'Export Feedback JSON'))}</button>
992
+ </div>
993
+ <ul id="dsh-rc-list"></ul>
994
+ </aside>
976
995
  <div id="dsh-laser-dot" aria-hidden="true"></div>
977
996
  <canvas id="dsh-draw-canvas" aria-label="${escape(label('实时白板标注画布', 'Live annotation canvas'))}"></canvas>
978
997
  <div id="dsh-draw-bar" hidden role="toolbar" aria-label="${escape(label('白板标注工具条', 'Whiteboard pen toolbar'))}">
@@ -1058,6 +1077,106 @@ function initDelivery(go, setOverview, current, total, cfg) {
1058
1077
  const subSpeedBtn = document.getElementById('dsh-sub-speed')
1059
1078
  const subPauseBtn = document.getElementById('dsh-sub-pause')
1060
1079
  const subStopBtn = document.getElementById('dsh-sub-stop')
1080
+ const commentsBtn = document.getElementById('dsh-comments-btn')
1081
+ const commentsDrawer = document.getElementById('dsh-review-comments')
1082
+ const rcCloseBtn = document.getElementById('dsh-rc-close')
1083
+ const rcSlideCtx = document.getElementById('dsh-rc-slide-ctx')
1084
+ const rcAuthor = document.getElementById('dsh-rc-author')
1085
+ const rcInput = document.getElementById('dsh-rc-input')
1086
+ const rcAddBtn = document.getElementById('dsh-rc-add')
1087
+ const rcExportBtn = document.getElementById('dsh-rc-export')
1088
+ const rcList = document.getElementById('dsh-rc-list')
1089
+
1090
+ // --- Wave 3E: 'R' Offline Stakeholder Review Comment Drawer ---
1091
+ const rcStorageKey = 'dsh-ppt-feedback-' + (cfg?.channelId || 'deck')
1092
+ let reviewComments = []
1093
+ try {
1094
+ const rawSaved = localStorage.getItem(rcStorageKey)
1095
+ if (rawSaved) {
1096
+ const parsed = JSON.parse(rawSaved)
1097
+ if (Array.isArray(parsed)) reviewComments = parsed
1098
+ }
1099
+ } catch (_) {}
1100
+ function persistComments() {
1101
+ try { localStorage.setItem(rcStorageKey, JSON.stringify(reviewComments)) } catch (_) {}
1102
+ }
1103
+ function updateCommentsContext(idx) {
1104
+ if (!rcSlideCtx) return
1105
+ const i = typeof idx === 'number' ? idx : current()
1106
+ const sl = document.querySelectorAll('.slide')[i]
1107
+ const heading = sl ? (sl.querySelector('h1,h2,.statement-title,.quote-text')?.textContent || '').trim() : ''
1108
+ rcSlideCtx.textContent = `P${String(i + 1).padStart(2, '0')} · ${heading || ('Slide ' + (i + 1))}`
1109
+ }
1110
+ function renderCommentsList() {
1111
+ if (!rcList) return
1112
+ if (commentsBtn) {
1113
+ const baseLbl = (commentsBtn.dataset.baseLbl ||= commentsBtn.textContent)
1114
+ commentsBtn.textContent = reviewComments.length > 0 ? `${baseLbl} (${reviewComments.length})` : baseLbl
1115
+ }
1116
+ if (reviewComments.length === 0) {
1117
+ rcList.innerHTML = `<li class="dsh-rc-empty">${escape(cfg?.labels?.reviewCommentEmpty || 'No comments')}</li>`
1118
+ return
1119
+ }
1120
+ rcList.innerHTML = reviewComments.map((c, idx) =>
1121
+ `<li><button type="button" class="dsh-rc-jump" data-rc-slide="${c.slide}"><strong>P${String(c.slide).padStart(2, '0')}</strong>${c.author ? ` <em>${escape(c.author)}</em>` : ''}:${escape(c.text)}</button><button type="button" class="dsh-rc-del" data-rc-del="${idx}" aria-label="Delete">✕</button></li>`
1122
+ ).join('')
1123
+ rcList.querySelectorAll('[data-rc-slide]').forEach((btn) => {
1124
+ btn.addEventListener('click', () => {
1125
+ const s = Number(btn.dataset.rcSlide)
1126
+ if (Number.isInteger(s) && s >= 1 && s <= total) go(s - 1)
1127
+ })
1128
+ })
1129
+ rcList.querySelectorAll('[data-rc-del]').forEach((btn) => {
1130
+ btn.addEventListener('click', () => {
1131
+ const idx = Number(btn.dataset.rcDel)
1132
+ if (Number.isInteger(idx) && idx >= 0 && idx < reviewComments.length) {
1133
+ reviewComments.splice(idx, 1)
1134
+ persistComments()
1135
+ renderCommentsList()
1136
+ }
1137
+ })
1138
+ })
1139
+ }
1140
+ function toggleCommentsDrawer(forceOpen) {
1141
+ if (!commentsDrawer) return
1142
+ const willOpen = typeof forceOpen === 'boolean' ? forceOpen : commentsDrawer.hidden
1143
+ commentsDrawer.hidden = !willOpen
1144
+ if (willOpen) {
1145
+ updateCommentsContext(current())
1146
+ renderCommentsList()
1147
+ setTimeout(() => rcInput?.focus(), 20)
1148
+ }
1149
+ }
1150
+ commentsBtn?.addEventListener('click', () => toggleCommentsDrawer())
1151
+ rcCloseBtn?.addEventListener('click', () => toggleCommentsDrawer(false))
1152
+ rcAddBtn?.addEventListener('click', () => {
1153
+ const txt = String(rcInput?.value || '').trim()
1154
+ if (!txt) return
1155
+ const slideNum = current() + 1
1156
+ reviewComments.push({
1157
+ id: 'rc-' + Date.now() + '-' + Math.random().toString(36).slice(2, 6),
1158
+ slide: slideNum,
1159
+ author: String(rcAuthor?.value || '').trim() || 'Reviewer',
1160
+ text: txt,
1161
+ createdAt: new Date().toISOString(),
1162
+ })
1163
+ if (rcInput) rcInput.value = ''
1164
+ persistComments()
1165
+ renderCommentsList()
1166
+ showToast(cfg?.labels?.reviewCommentSaved || 'Comment pinned')
1167
+ })
1168
+ rcExportBtn?.addEventListener('click', () => {
1169
+ const payload = {
1170
+ schemaVersion: 1,
1171
+ deckId: cfg?.channelId || '',
1172
+ title: cfg?.title || document.title,
1173
+ exportedAt: new Date().toISOString(),
1174
+ comments: reviewComments,
1175
+ }
1176
+ triggerBlobDownload(JSON.stringify(payload, null, 2), 'application/json;charset=utf-8', 'review-feedback.json')
1177
+ showToast(cfg?.labels?.reviewExported || 'Exported review-feedback.json')
1178
+ })
1179
+ renderCommentsList()
1061
1180
 
1062
1181
  previous.addEventListener('click', () => go(Math.max(0, current() - 1)))
1063
1182
  next.addEventListener('click', () => go(Math.min(total - 1, current() + 1)))
@@ -1719,7 +1838,11 @@ function initDelivery(go, setOverview, current, total, cfg) {
1719
1838
  event.preventDefault()
1720
1839
  if (tourActive) stopAutoTour()
1721
1840
  else startAutoTour()
1841
+ } else if (lower === 'r') {
1842
+ event.preventDefault()
1843
+ toggleCommentsDrawer()
1722
1844
  } else if (lower === 'escape') {
1845
+ if (commentsDrawer && !commentsDrawer.hidden) { event.preventDefault(); toggleCommentsDrawer(false); return }
1723
1846
  if (drawActive) { event.preventDefault(); setDrawActive(false); return }
1724
1847
  if (laserActive) {
1725
1848
  applyLaser(false)
@@ -1744,6 +1867,7 @@ function initDelivery(go, setOverview, current, total, cfg) {
1744
1867
  if (consoleOpen()) sendConsoleState(index)
1745
1868
  if (drawActive || strokesBySlide.has(index)) redrawCanvas(index)
1746
1869
  if (tourActive) updateSubtitleBar(index)
1870
+ if (commentsDrawer && !commentsDrawer.hidden) updateCommentsContext(index)
1747
1871
  }
1748
1872
  }
1749
1873
 
@@ -1818,5 +1942,19 @@ button:focus-visible,a:focus-visible,input:focus-visible{outline:2px solid var(-
1818
1942
  #notes-panel,#help-panel{bottom:160px}
1819
1943
  #review-panel{padding:18px}
1820
1944
  }
1821
- @media print{#delivery-bar,#review-panel,#dsh-laser-dot,#dsh-draw-canvas,#dsh-draw-bar,#dsh-qa-timer,#dsh-sub-bar,#dsh-jump-dialog{display:none!important}}
1945
+ #dsh-review-comments{position:fixed;top:64px;right:22px;z-index:93;width:min(360px,calc(100vw - 24px));max-height:74vh;display:flex;flex-direction:column;gap:8px;padding:14px;border-radius:14px;background:color-mix(in srgb,var(--panel) 97%,transparent);color:var(--fg);border:1px solid var(--accent);box-shadow:0 18px 46px rgba(0,0,0,.38);backdrop-filter:blur(8px);overflow:hidden}
1946
+ #dsh-review-comments[hidden]{display:none}
1947
+ .dsh-rc-head{display:flex;justify-content:space-between;align-items:center;font-size:13px}
1948
+ .dsh-rc-head button{border:1px solid var(--muted);border-radius:8px;background:transparent;color:var(--fg);padding:2px 7px;cursor:pointer}
1949
+ .dsh-rc-ctx{font-size:12px;font-weight:700;color:var(--accent)}
1950
+ #dsh-rc-author,#dsh-rc-input{width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--muted);background:var(--bg);color:var(--fg);font:inherit;font-size:12.5px}
1951
+ .dsh-rc-actions{display:flex;gap:8px}
1952
+ .dsh-rc-actions button{flex:1;padding:7px 10px;border-radius:8px;border:1px solid var(--accent);background:var(--accent);color:var(--bg);font:inherit;font-size:12px;font-weight:700;cursor:pointer}
1953
+ #dsh-rc-export{background:var(--bg);color:var(--fg);border-color:var(--muted)}
1954
+ #dsh-rc-list{list-style:none;margin:0;padding:0;overflow:auto;display:flex;flex-direction:column;gap:6px;max-height:30vh}
1955
+ #dsh-rc-list li{display:flex;gap:6px;align-items:flex-start;background:var(--bg);border:1px solid color-mix(in srgb,var(--muted) 30%,transparent);border-radius:8px;padding:7px 8px;font-size:12px}
1956
+ .dsh-rc-jump{flex:1;text-align:left;background:transparent;border:0;color:var(--fg);font:inherit;cursor:pointer;padding:0;line-height:1.4}
1957
+ .dsh-rc-del{background:transparent;border:0;color:var(--muted);cursor:pointer;padding:0 4px}
1958
+ .dsh-rc-empty{color:var(--muted);justify-content:center}
1959
+ @media print{#delivery-bar,#review-panel,#dsh-review-comments,#dsh-laser-dot,#dsh-draw-canvas,#dsh-draw-bar,#dsh-qa-timer,#dsh-sub-bar,#dsh-jump-dialog{display:none!important}}
1822
1960
  `