dsh-ppt 0.32.1 → 0.33.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.
@@ -18,6 +18,7 @@ import {
18
18
  computeTextFit,
19
19
  ooxmlRichParagraph,
20
20
  ooxmlShape,
21
+ ooxmlCustGeomShape,
21
22
  ooxmlLine,
22
23
  computeBadgePillWidth,
23
24
  renderSlideChromePptx,
@@ -30,16 +31,17 @@ export const POSTER_COVER_VARIANTS = new Set([
30
31
  'split-bleed',
31
32
  ])
32
33
 
33
- export const COVER_PATTERNS = new Set(['dots', 'grid', 'rings'])
34
+ export const COVER_PATTERNS = new Set(['dots', 'grid', 'rings', 'waves', 'isometric-mesh', 'editorial-arcs'])
34
35
 
35
36
  /**
36
- * 封面轻量矢量几何底纹(dots / grid / rings)—— 零外部依赖,低透明度克制点缀。
37
+ * 封面高定程序化矢量底纹(dots / grid / rings / waves / isometric-mesh / editorial-arcs)—— 零外部依赖,低透明度克制点缀。
37
38
  */
38
39
  export function renderCoverPatternPptx(pattern, theme, nextId) {
39
40
  const p = String(pattern || '').trim().toLowerCase()
40
41
  if (!COVER_PATTERNS.has(p)) return ''
41
42
  const tk = theme.tokens
42
43
  const col = theme.dark ? '#FFFFFF' : tk.accentPrimary
44
+ const col2 = theme.dark ? tk.accentPrimary : (tk.accentSecondary || tk.accentPrimary)
43
45
  const out = []
44
46
  if (p === 'grid') {
45
47
  for (let gx = 0.8; gx <= 12.6; gx += 1.18) {
@@ -68,10 +70,88 @@ export function renderCoverPatternPptx(pattern, theme, nextId) {
68
70
  }))
69
71
  }
70
72
  }
73
+ } else if (p === 'waves') {
74
+ // 4 flowing cubic-Bezier topographic waves across the lower-right horizon
75
+ for (let wi = 0; wi < 4; wi += 1) {
76
+ const yOff = 4.55 + wi * 0.52
77
+ const box = { x: 4.8, y: yOff, w: 8.55, h: 2.15 }
78
+ const pathXml =
79
+ `<a:moveTo><a:pt x="0" y="7400"/></a:moveTo>` +
80
+ `<a:cubicBezTo><a:pt x="2800" y="${2200 + wi * 450}"/><a:pt x="5600" y="${9600 - wi * 380}"/><a:pt x="10000" y="${1600 + wi * 520}"/></a:cubicBezTo>`
81
+ out.push(ooxmlCustGeomShape(nextId(), `Cover Wave ${wi + 1}`, box, pathXml, {
82
+ pathW: 10000,
83
+ pathH: 10000,
84
+ fill: '',
85
+ stroke: wi % 2 === 0 ? col : col2,
86
+ strokeAlpha: theme.dark ? (0.18 - wi * 0.025) : (0.20 - wi * 0.028),
87
+ strokePt: wi === 0 ? 1.4 : 0.9,
88
+ }))
89
+ }
90
+ } else if (p === 'isometric-mesh') {
91
+ // Architectural isometric diamond lattice cascading across the right margin
92
+ const rx = 0.62, ry = 0.34
93
+ const cells = [[0, 0], [1, 0], [2, 0], [0.5, 1], [1.5, 1], [1, 2], [2, 2], [1.5, 3]]
94
+ cells.forEach(([gx, gy], ci) => {
95
+ const bx = 9.2 + gx * (rx * 1.95) - rx
96
+ const by = 0.75 + gy * (ry * 2.05) - ry
97
+ const pathXml = '<a:moveTo><a:pt x="5000" y="0"/></a:moveTo><a:lnTo><a:pt x="10000" y="5000"/></a:lnTo><a:lnTo><a:pt x="5000" y="10000"/></a:lnTo><a:lnTo><a:pt x="0" y="5000"/></a:lnTo><a:close/>'
98
+ out.push(ooxmlCustGeomShape(nextId(), `Cover Iso Tile ${ci + 1}`, { x: bx, y: by, w: rx * 2, h: ry * 2 }, pathXml, {
99
+ pathW: 10000,
100
+ pathH: 10000,
101
+ fill: ci % 3 === 0 ? col : '',
102
+ fillAlpha: ci % 3 === 0 ? (theme.dark ? 0.08 : 0.09) : 0,
103
+ stroke: ci % 2 === 0 ? col : col2,
104
+ strokeAlpha: theme.dark ? 0.16 : 0.18,
105
+ strokePt: 0.75,
106
+ }))
107
+ })
108
+ } else if (p === 'editorial-arcs') {
109
+ // Swiss concentric quarter-arcs + golden-ratio crosshair rules on the right edge
110
+ ;[4.2, 6.2, 8.2].forEach((d, ri) => {
111
+ out.push(ooxmlShape(nextId(), `Cover Editorial Arc ${ri + 1}`, { x: 12.8 - d / 2, y: 6.9 - d / 2, w: d, h: d }, {
112
+ preset: 'ellipse',
113
+ fill: '',
114
+ stroke: ri === 0 ? col2 : col,
115
+ strokeAlpha: theme.dark ? (0.14 - ri * 0.025) : (0.16 - ri * 0.03),
116
+ strokePt: ri === 0 ? 1.1 : 0.65,
117
+ }))
118
+ })
119
+ out.push(ooxmlLine(nextId(), 'Editorial Crosshair V', { x: 9.75, y: 0.4 }, { x: 9.75, y: 7.1 }, { color: tk.hairline, widthPt: 0.5 }))
120
+ out.push(ooxmlLine(nextId(), 'Editorial Crosshair H', { x: 8.1, y: 4.85 }, { x: 13.0, y: 4.85 }, { color: tk.hairline, widthPt: 0.5 }))
71
121
  }
72
122
  return out.join('')
73
123
  }
74
124
 
125
+ function renderCoverPatternSvgHtml(pattern, theme) {
126
+ const p = String(pattern || '').trim().toLowerCase()
127
+ if (!['waves', 'isometric-mesh', 'editorial-arcs'].includes(p)) return ''
128
+ const tk = theme?.tokens || {}
129
+ const col = theme?.dark ? '#FFFFFF' : (tk.accentPrimary || '#0057B8')
130
+ const col2 = theme?.dark ? (tk.accentPrimary || '#60A5FA') : (tk.accentSecondary || col)
131
+ if (p === 'waves') {
132
+ const paths = [0, 1, 2, 3].map((wi) => {
133
+ const y0 = 260 + wi * 38
134
+ return `<path d="M 380 ${y0 + 70} C 640 ${y0 - 30 + wi * 12}, 860 ${y0 + 110 - wi * 10}, 1280 ${y0 - 20 + wi * 16}" fill="none" stroke="${wi % 2 === 0 ? col : col2}" stroke-opacity="${(0.22 - wi * 0.03).toFixed(2)}" stroke-width="${wi === 0 ? 2 : 1.3}"/>`
135
+ }).join('')
136
+ return `<svg class="cover-pat-svg" viewBox="0 0 1280 720" preserveAspectRatio="none" aria-hidden="true">${paths}</svg>`
137
+ }
138
+ if (p === 'isometric-mesh') {
139
+ const rx = 60, ry = 32
140
+ const cells = [[0, 0], [1, 0], [2, 0], [0.5, 1], [1.5, 1], [1, 2], [2, 2], [1.5, 3]]
141
+ const polys = cells.map(([gx, gy], ci) => {
142
+ const cx = 880 + gx * (rx * 1.95)
143
+ const cy = 74 + gy * (ry * 2.05)
144
+ const pts = `${cx},${cy - ry} ${cx + rx},${cy} ${cx},${cy + ry} ${cx - rx},${cy}`
145
+ return `<polygon points="${pts}" fill="${ci % 3 === 0 ? col : 'none'}" fill-opacity="0.08" stroke="${ci % 2 === 0 ? col : col2}" stroke-opacity="0.18" stroke-width="1.2"/>`
146
+ }).join('')
147
+ return `<svg class="cover-pat-svg" viewBox="0 0 1280 720" preserveAspectRatio="xMaxYMin slice" aria-hidden="true">${polys}</svg>`
148
+ }
149
+ const arcs = [210, 310, 410].map((r, ri) =>
150
+ `<circle cx="1220" cy="660" r="${r}" fill="none" stroke="${ri === 0 ? col2 : col}" stroke-opacity="${(0.16 - ri * 0.03).toFixed(2)}" stroke-width="${ri === 0 ? 1.6 : 1}"/>`
151
+ ).join('')
152
+ return `<svg class="cover-pat-svg" viewBox="0 0 1280 720" preserveAspectRatio="xMaxYMax slice" aria-hidden="true">${arcs}<line x1="940" y1="40" x2="940" y2="680" stroke="${tk.hairline || '#CBD5E1'}" stroke-opacity="0.45"/><line x1="780" y1="465" x2="1260" y2="465" stroke="${tk.hairline || '#CBD5E1'}" stroke-opacity="0.45"/></svg>`
153
+ }
154
+
75
155
  export function renderPosterCoverPptx(slide, ctx) {
76
156
  const { coverVariant, title, subtitle, kicker, metaText, total, theme, langAttr, manifest, idBase, nextId } = ctx
77
157
  const tk = theme.tokens
@@ -591,10 +671,12 @@ export function renderPosterCoverHtml(slide, ctx) {
591
671
  const patClass = COVER_PATTERNS.has(String(slide?.coverPattern || '').toLowerCase())
592
672
  ? ' cover-pat-' + String(slide.coverPattern).toLowerCase()
593
673
  : ''
674
+ const patSvg = renderCoverPatternSvgHtml(slide?.coverPattern, theme)
594
675
 
595
676
  if (coverVariant === 'keynote-glow') {
596
677
  return (
597
678
  '<div class="cover-shell is-keynote-glow' + patClass + '">' +
679
+ patSvg +
598
680
  '<div class="cover-glow-orb orb-a" aria-hidden="true"></div>' +
599
681
  '<div class="cover-glow-orb orb-b" aria-hidden="true"></div>' +
600
682
  '<div class="cover-center-stack">' +
@@ -612,7 +694,8 @@ export function renderPosterCoverHtml(slide, ctx) {
612
694
  const yearMark = /\b(20\d{2})\b/.exec([kicker, title, subtitle, meta].join(' '))?.[1] || '01'
613
695
  const rightTag = manifest.brand?.name || (langId === 'en' ? 'SPECIAL REPORT' : '专题深度报告')
614
696
  return (
615
- '<div class="cover-shell is-editorial-grid">' +
697
+ '<div class="cover-shell is-editorial-grid' + patClass + '">' +
698
+ patSvg +
616
699
  '<div class="ed-top-bar"><span class="kicker">' + escapeHtml(kicker) + '</span><span class="ed-edition">' + escapeHtml(rightTag) + '</span></div>' +
617
700
  '<div class="ed-main-grid">' +
618
701
  '<div class="ed-copy"><div class="ed-accent-bar"></div><h1>' + renderInlineHtml(title) + '</h1>' +
@@ -955,4 +1038,7 @@ export const AESTHETIC_STUDIO_CSS = `
955
1038
  .photo-cover-right img{width:100%;height:100%;object-fit:cover;display:block}
956
1039
  .cover-pat-grid{background-image:linear-gradient(to right,color-mix(in srgb,var(--hairline) 42%,transparent) 1px,transparent 1px),linear-gradient(to bottom,color-mix(in srgb,var(--hairline) 42%,transparent) 1px,transparent 1px);background-size:48px 48px}
957
1040
  .cover-pat-dots{background-image:radial-gradient(color-mix(in srgb,var(--accent) 26%,transparent) 1.5px,transparent 1.5px);background-size:24px 24px}
1041
+ .cover-shell.is-editorial-grid,.cover-shell.is-architectural{position:relative}
1042
+ .cover-pat-svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:0}
1043
+ .cover-shell.is-editorial-grid > :not(.cover-pat-svg){position:relative;z-index:1}
958
1044
  `
@@ -11,6 +11,7 @@ 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
15
  'image', 'image-left', 'image-right', 'gallery',
15
16
  ])
16
17
 
@@ -12,6 +12,8 @@
12
12
  */
13
13
 
14
14
  import { stripInlineMarkdown } from './deck-layouts.mjs'
15
+ import { resolveTheme } from './deck-themes.mjs'
16
+ import { generateVisualBrief } from './deck-infographics.mjs'
15
17
  import { CURATED_EXEMPLARS, resolveExemplar, matchBestExemplar, getExemplarFewShotSlides } from './deck-exemplars.mjs'
16
18
 
17
19
  const MAX_EVIDENCE_ITEMS = 60
@@ -534,8 +536,10 @@ export function buildResearchPlan(options = {}) {
534
536
 
535
537
  let evCursor = 0
536
538
  const gaps = []
539
+ const resolvedThemeObj = resolveTheme(exemplar.theme || 'consulting')
540
+ const visualBriefs = []
537
541
  const storyboard = (exemplar.slots || []).map((slot) => {
538
- const needsQuant = QUANT_LAYOUTS.has(slot.layout) || slot.layout === 'table' || slot.layout === 'sankey'
542
+ const needsQuant = QUANT_LAYOUTS.has(slot.layout) || slot.layout === 'table' || slot.layout === 'sankey' || slot.layout === 'map'
539
543
  const assigned = []
540
544
  if (needsQuant && evidence.length > 0 && evCursor < evidence.length) {
541
545
  assigned.push(evidence[evCursor].id)
@@ -552,6 +556,18 @@ export function buildResearchPlan(options = {}) {
552
556
  : ''
553
557
  if (gap) gaps.push({ slide: slot.index, role: slot.role, layout: slot.layout, gap })
554
558
 
559
+ const wantsVisual = slot.layout === 'cover' || ['image', 'image-left', 'image-right'].includes(slot.layout)
560
+ const visualBrief = wantsVisual
561
+ ? generateVisualBrief({
562
+ layout: slot.layout,
563
+ variant: slot.variant || '',
564
+ title: slot.layout === 'cover' ? topic : `${topic} — ${slot.role}`,
565
+ }, resolvedThemeObj, langEn ? 'en' : 'zh')
566
+ : undefined
567
+ if (visualBrief) {
568
+ visualBriefs.push({ slide: slot.index, role: slot.role, layout: slot.layout, ...visualBrief })
569
+ }
570
+
555
571
  return {
556
572
  slide: slot.index,
557
573
  role: slot.role,
@@ -560,6 +576,7 @@ export function buildResearchPlan(options = {}) {
560
576
  boundEvidenceIds: assigned,
561
577
  titleGuide: langEn ? (slot.exampleTitleEn || slot.fillGuideEn || slot.role) : (slot.exampleTitleZh || slot.fillGuideZh || slot.role),
562
578
  fillGuide: langEn ? (slot.fillGuideEn || '') : (slot.fillGuideZh || ''),
579
+ ...(visualBrief ? { visualBrief } : {}),
563
580
  ...(gap ? { gap } : {}),
564
581
  }
565
582
  })
@@ -622,6 +639,7 @@ export function buildResearchPlan(options = {}) {
622
639
  },
623
640
  researchRounds,
624
641
  storyboard,
642
+ visualBriefs,
625
643
  fewShotSlides: getExemplarFewShotSlides(exemplar.id, langEn ? 'en' : 'zh'),
626
644
  planMarkdown: lines.join('\n'),
627
645
  }