dsh-ppt 0.33.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.en.md +8 -10
  3. package/README.md +8 -10
  4. package/docs/USAGE.en.md +44 -35
  5. package/docs/USAGE.md +45 -36
  6. package/docs/VALIDATION.md +8 -0
  7. package/lib/client.js +116 -17
  8. package/lib/ecosystem.js +10 -0
  9. package/lib/execution.js +36 -5
  10. package/lib/tools.js +74 -4
  11. package/lib/types.d.ts +79 -1
  12. package/lib/workbench.js +255 -14
  13. package/package.json +2 -2
  14. package/skills/dsh-ppt/SKILL.md +34 -31
  15. package/skills/dsh-ppt/package.json +1 -1
  16. package/skills/dsh-ppt/references/office-pack.md +124 -0
  17. package/skills/dsh-ppt/references/research-plan.md +93 -62
  18. package/skills/dsh-ppt/scripts/build-deck.mjs +109 -3
  19. package/skills/dsh-ppt/scripts/deck-absorb.mjs +21 -0
  20. package/skills/dsh-ppt/scripts/deck-advanced.mjs +330 -37
  21. package/skills/dsh-ppt/scripts/deck-brand-kit.mjs +257 -0
  22. package/skills/dsh-ppt/scripts/deck-charts-exec.mjs +805 -0
  23. package/skills/dsh-ppt/scripts/deck-chrome.mjs +47 -1
  24. package/skills/dsh-ppt/scripts/deck-compose.mjs +386 -0
  25. package/skills/dsh-ppt/scripts/deck-core.mjs +136 -16
  26. package/skills/dsh-ppt/scripts/deck-delivery.mjs +750 -17
  27. package/skills/dsh-ppt/scripts/deck-evidence.mjs +811 -118
  28. package/skills/dsh-ppt/scripts/deck-export.mjs +652 -0
  29. package/skills/dsh-ppt/scripts/deck-i18n.mjs +170 -0
  30. package/skills/dsh-ppt/scripts/deck-layouts.mjs +72 -8
  31. package/skills/dsh-ppt/scripts/deck-media.mjs +22 -0
  32. package/skills/dsh-ppt/scripts/deck-office.mjs +1455 -14
  33. package/skills/dsh-ppt/scripts/deck-remix.mjs +471 -0
@@ -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
  : ''
@@ -2126,11 +2185,17 @@ function renderHtmlSlide(slide, index, ui, langId, manifest = {}, theme) {
2126
2185
  : ''
2127
2186
  const chromeAttr = ' data-chrome="' + escapeHtml(chromeStyle) + '"'
2128
2187
  const visualStyle = visualHtmlStyle(slide.visual)
2129
- const slideClasses = 'slide slide--' + escapeHtml(layout) + (layout === 'bullets' ? ' bullets' : '')
2188
+ const hasLogo = Boolean(manifest.brand?.logoAssetId)
2189
+ const isFramingSlide = layout === 'cover' || layout === 'closing' || layout === 'section'
2190
+ const slideClasses = 'slide slide--' + escapeHtml(layout) + (layout === 'bullets' ? ' bullets' : '') + (hasLogo ? ' has-brand-logo' : '')
2191
+ const watermarkHtml = (!isFramingSlide && typeof manifest.brand?.watermark === 'string' && manifest.brand.watermark.trim())
2192
+ ? '<div class="brand-watermark" aria-label="Watermark">' + escapeHtml(manifest.brand.watermark.trim()) + '</div>'
2193
+ : ''
2130
2194
 
2131
- 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) + '"' : '') + '>' +
2132
2196
  '<div class="slide-inner">' + inner + '</div>' +
2133
- (manifest.brand?.logoAssetId ? '<img class="brand-logo" src="' + escapeHtml(manifest.assets?.[manifest.brand.logoAssetId]?.data ?? '') + '" alt="' + escapeHtml(manifest.brand.name || 'Logo') + '"/>' : '') +
2197
+ watermarkHtml +
2198
+ (hasLogo ? '<img class="brand-logo" src="' + escapeHtml(manifest.assets?.[manifest.brand.logoAssetId]?.data ?? '') + '" alt="' + escapeHtml(manifest.brand.name || 'Logo') + '"/>' : '') +
2134
2199
  (manifest.brand?.footer ? '<div class="brand-footer">' + escapeHtml(manifest.brand.footer) + '</div>' : '') + '</section>'
2135
2200
  }
2136
2201
 
@@ -2217,15 +2282,70 @@ function bulletTimingXml(spid, clicks) {
2217
2282
  '<p:bldLst><p:bldP spid="' + spid + '" grpId="0"/></p:bldLst></p:timing>'
2218
2283
  }
2219
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
+
2220
2335
  function slideXml(slide, index, total, theme, langId, motion, manifest = {}) {
2221
2336
  const p = theme.palette
2222
2337
  const shapesXml = slideShapeList(slide, index, total, theme, langId, manifest)
2223
2338
  let motionXml = ''
2224
2339
  if (motion) {
2225
- motionXml = '<p:transition spd="med"><p:fade/></p:transition>'
2340
+ motionXml = transitionXmlFor(manifest.motionProfile)
2226
2341
  const bullets = Array.isArray(slide.bullets) ? slide.bullets : []
2227
2342
  const bodySpid = (index + 1) * 10 + 3
2228
- 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 + '"')) {
2229
2349
  motionXml += bulletTimingXml(bodySpid, bullets.length)
2230
2350
  }
2231
2351
  }
@@ -2381,7 +2501,7 @@ function slideLayoutRelXml() {
2381
2501
  '</Relationships>'
2382
2502
  }
2383
2503
 
2384
- function themeXml(theme) {
2504
+ export function themeXml(theme) {
2385
2505
  const p = theme.palette
2386
2506
  const series = theme.tokens?.chartSeries ?? [p.accent, p.accent2, p.fg, p.muted, p.accent, p.accent2]
2387
2507
  const color = (name, value) => '<a:' + name + '><a:srgbClr val="' + hex(value) + '"/></a:' + name + '>'
@@ -2465,7 +2585,7 @@ function appXml(slideCount, notesCount) {
2465
2585
  '</Properties>'
2466
2586
  }
2467
2587
 
2468
- function buildZip(entries) {
2588
+ export function buildZip(entries) {
2469
2589
  const chunks = []
2470
2590
  const central = []
2471
2591
  let offset = 0