dsh-ppt 0.27.2 → 0.28.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.
@@ -479,7 +479,7 @@ function parseBulletToItem(rawBullet, index, layout) {
479
479
  }
480
480
  }
481
481
 
482
- const EXTENDED_ITEM_LAYOUTS = new Set(['sankey', 'value-chain', 'marimekko', 'swot'])
482
+ const EXTENDED_ITEM_LAYOUTS = new Set(['sankey', 'value-chain', 'marimekko', 'swot', 'quadrant', 'radar', 'dumbbell', 'heatmap'])
483
483
 
484
484
  export function normalizeSlideItems(rawItems, layout) {
485
485
  if (!Array.isArray(rawItems) || rawItems.length === 0) return undefined
@@ -505,10 +505,21 @@ export function normalizeSlideItems(rawItems, layout) {
505
505
  const role = stripInlineMarkdown(entry.role ?? '')
506
506
  const conversion = stripInlineMarkdown(entry.conversion ?? '')
507
507
  const icon = stripInlineMarkdown(entry.icon ?? '')
508
+ const avatar = stripInlineMarkdown(entry.avatar ?? '')
509
+ const xNum = entry.x !== undefined && entry.x !== null && entry.x !== '' ? Number(entry.x) : NaN
510
+ const x = Number.isFinite(xNum) ? xNum : undefined
511
+ const yNum = entry.y !== undefined && entry.y !== null && entry.y !== '' ? Number(entry.y) : NaN
512
+ const y = Number.isFinite(yNum) ? yNum : undefined
513
+ const sizeNum = entry.size !== undefined && entry.size !== null && entry.size !== '' ? Number(entry.size) : NaN
514
+ const size = Number.isFinite(sizeNum) ? Math.max(1, sizeNum) : undefined
515
+ const beforeNum = entry.before !== undefined && entry.before !== null && entry.before !== '' ? Number(entry.before) : NaN
516
+ const before = Number.isFinite(beforeNum) ? beforeNum : undefined
517
+ const afterNum = entry.after !== undefined && entry.after !== null && entry.after !== '' ? Number(entry.after) : NaN
518
+ const after = Number.isFinite(afterNum) ? afterNum : undefined
508
519
  const bullets = Array.isArray(entry.bullets ?? entry.items)
509
520
  ? (entry.bullets ?? entry.items).map((b) => cleanRichText(String(b))).filter(Boolean).slice(0, 8)
510
521
  : undefined
511
- if (!title && !text && !value && (!bullets || bullets.length === 0)) return null
522
+ if (!title && !text && !value && x === undefined && before === undefined && (!bullets || bullets.length === 0)) return null
512
523
  return {
513
524
  ...(tag ? { tag } : {}),
514
525
  ...(title ? { title } : {}),
@@ -522,6 +533,12 @@ export function normalizeSlideItems(rawItems, layout) {
522
533
  ...(role ? { role } : {}),
523
534
  ...(conversion ? { conversion } : {}),
524
535
  ...(icon ? { icon } : {}),
536
+ ...(avatar ? { avatar } : {}),
537
+ ...(x !== undefined ? { x } : {}),
538
+ ...(y !== undefined ? { y } : {}),
539
+ ...(size !== undefined ? { size } : {}),
540
+ ...(before !== undefined ? { before } : {}),
541
+ ...(after !== undefined ? { after } : {}),
525
542
  ...(status ? { status } : {}),
526
543
  ...(bullets?.length ? { bullets } : {}),
527
544
  }
@@ -695,6 +712,8 @@ export function ooxmlShape(id, name, boxIn, options = {}) {
695
712
  marginsIn = { l: 0.08, r: 0.08, t: 0.05, b: 0.05 },
696
713
  fontScale = 100000,
697
714
  autofit = true,
715
+ rot = 0,
716
+ vert = '',
698
717
  paragraphs = [],
699
718
  } = options
700
719
 
@@ -731,10 +750,10 @@ export function ooxmlShape(id, name, boxIn, options = {}) {
731
750
  '<p:sp>' +
732
751
  '<p:nvSpPr><p:cNvPr id="' + id + '" name="' + escapeXml(name) + '"/>' +
733
752
  '<p:cNvSpPr' + (txBox ? ' txBox="1"' : '') + '/><p:nvPr/></p:nvSpPr>' +
734
- '<p:spPr><a:xfrm><a:off x="' + b.x + '" y="' + b.y + '"/><a:ext cx="' + b.w + '" cy="' + b.h + '"/></a:xfrm>' +
753
+ '<p:spPr><a:xfrm' + (rot ? ' rot="' + Math.round(rot) + '"' : '') + '><a:off x="' + b.x + '" y="' + b.y + '"/><a:ext cx="' + b.w + '" cy="' + b.h + '"/></a:xfrm>' +
735
754
  '<a:prstGeom prst="' + preset + '">' + avLst + '</a:prstGeom>' +
736
755
  fillXml + lnXml + effectXml + '</p:spPr>' +
737
- '<p:txBody><a:bodyPr wrap="square" rtlCol="0" lIns="' + lIns + '" tIns="' + tIns + '" rIns="' + rIns + '" bIns="' + bIns + '" anchor="' + anchor + '">' +
756
+ '<p:txBody><a:bodyPr wrap="' + (vert ? 'none' : 'square') + '" rtlCol="0"' + (vert ? ' vert="' + escapeXml(vert) + '"' : '') + ' lIns="' + lIns + '" tIns="' + tIns + '" rIns="' + rIns + '" bIns="' + bIns + '" anchor="' + anchor + '">' +
738
757
  fitXml + '</a:bodyPr><a:lstStyle/>' + bodyContent + '</p:txBody>' +
739
758
  '</p:sp>'
740
759
  )
@@ -1172,8 +1191,10 @@ export function renderSurfaceCardPptx(name, box, opts, nextIdFn, chromeCfg, them
1172
1191
  }),
1173
1192
  ]
1174
1193
  if (chromeCfg.cardTopBar) {
1175
- out.push(ooxmlShape(nextIdFn(), name + ' top bar', { x: box.x, y: box.y, w: box.w, h: 0.05 }, {
1176
- preset: 'rect',
1194
+ const barInset = radius > 0 ? Math.min(0.12, (radius / 96) * 0.85) : 0
1195
+ out.push(ooxmlShape(nextIdFn(), name + ' top bar', { x: box.x + barInset, y: box.y, w: Math.max(0.2, box.w - barInset * 2), h: 0.045 }, {
1196
+ preset: radius > 0 ? 'roundRect' : 'rect',
1197
+ adj: radius > 0 ? 50000 : undefined,
1177
1198
  fill: focal ? accentBarColor : tk.hairline,
1178
1199
  }))
1179
1200
  }
@@ -412,6 +412,8 @@ function createSection(heading = '', level = 0, coverOnly = false) {
412
412
  directive: null,
413
413
  formula: '',
414
414
  mermaid: '',
415
+ code: '',
416
+ codeLang: '',
415
417
  takeaway: '',
416
418
  source: '',
417
419
  }
@@ -569,6 +571,10 @@ export function parseMarkdownDeck(titleInput, content, lang = 'zh') {
569
571
  let inMermaidFence = false
570
572
  let mermaidFenceMarker = ''
571
573
  let mermaidFenceLines = []
574
+ let inCodeFence = false
575
+ let codeFenceMarker = ''
576
+ let codeFenceLang = ''
577
+ let codeFenceLines = []
572
578
 
573
579
  const flush = () => {
574
580
  if (inMermaidFence && mermaidFenceLines.length > 0) {
@@ -578,6 +584,14 @@ export function parseMarkdownDeck(titleInput, content, lang = 'zh') {
578
584
  current.mermaid = current.mermaid ? current.mermaid + '\n' + pendingMermaid : pendingMermaid
579
585
  }
580
586
  }
587
+ if (inCodeFence && codeFenceLines.length > 0) {
588
+ if (current === null) current = createSection()
589
+ const pendingCode = codeFenceLines.join('\n').trimEnd()
590
+ if (pendingCode.trim() !== '') {
591
+ current.code = current.code ? current.code + '\n\n' + pendingCode : pendingCode
592
+ if (!current.codeLang && codeFenceLang) current.codeLang = codeFenceLang
593
+ }
594
+ }
581
595
  if (
582
596
  current !== null &&
583
597
  (current.heading !== '' ||
@@ -585,6 +599,7 @@ export function parseMarkdownDeck(titleInput, content, lang = 'zh') {
585
599
  current.paragraphs.length > 0 ||
586
600
  current.formula !== '' ||
587
601
  current.mermaid !== '' ||
602
+ current.code !== '' ||
588
603
  current.table !== null ||
589
604
  current.quote.length > 0 ||
590
605
  current.directive !== null)
@@ -599,6 +614,10 @@ export function parseMarkdownDeck(titleInput, content, lang = 'zh') {
599
614
  inMermaidFence = false
600
615
  mermaidFenceMarker = ''
601
616
  mermaidFenceLines = []
617
+ inCodeFence = false
618
+ codeFenceMarker = ''
619
+ codeFenceLang = ''
620
+ codeFenceLines = []
602
621
  }
603
622
 
604
623
  for (const rawLine of body.split('\n')) {
@@ -619,6 +638,24 @@ export function parseMarkdownDeck(titleInput, content, lang = 'zh') {
619
638
  continue
620
639
  }
621
640
 
641
+ if (inCodeFence) {
642
+ if (line.startsWith(codeFenceMarker) && new RegExp('^' + codeFenceMarker + '\\s*$').test(line)) {
643
+ if (current === null) current = createSection()
644
+ const joinedCode = codeFenceLines.join('\n').trimEnd()
645
+ if (joinedCode.trim() !== '') {
646
+ current.code = current.code ? current.code + '\n\n' + joinedCode : joinedCode
647
+ if (!current.codeLang && codeFenceLang) current.codeLang = codeFenceLang
648
+ }
649
+ inCodeFence = false
650
+ codeFenceMarker = ''
651
+ codeFenceLang = ''
652
+ codeFenceLines = []
653
+ } else {
654
+ codeFenceLines.push(rawLine)
655
+ }
656
+ continue
657
+ }
658
+
622
659
  const mermaidOpen = /^(`{3,}|~{3,})\s*mermaid\b.*$/i.exec(line)
623
660
  if (mermaidOpen !== null) {
624
661
  if (current === null) current = createSection()
@@ -628,6 +665,16 @@ export function parseMarkdownDeck(titleInput, content, lang = 'zh') {
628
665
  continue
629
666
  }
630
667
 
668
+ const codeOpen = /^(`{3,}|~{3,})\s*([a-zA-Z][\w.+-]*)\s*$/.exec(line)
669
+ if (codeOpen !== null) {
670
+ if (current === null) current = createSection()
671
+ inCodeFence = true
672
+ codeFenceMarker = codeOpen[1]
673
+ codeFenceLang = codeOpen[2]
674
+ codeFenceLines = []
675
+ continue
676
+ }
677
+
631
678
  if (inMathBlock) {
632
679
  if (line === '$$') {
633
680
  if (current === null) current = createSection()
@@ -911,6 +958,24 @@ export function parseMarkdownDeck(titleInput, content, lang = 'zh') {
911
958
  continue
912
959
  }
913
960
 
961
+ if (section.code !== '') {
962
+ const label = section.heading || (ui.pointKicker + ' ' + (++pointRef.count))
963
+ const rawPoints = [...section.bullets, ...section.paragraphs]
964
+ const slide = {
965
+ layout: 'code',
966
+ kicker: label,
967
+ title: label,
968
+ code: section.code,
969
+ ...(section.codeLang ? { language: section.codeLang } : {}),
970
+ ...(rawPoints.length > 0 ? { bullets: rawPoints } : {}),
971
+ ...(section.takeaway ? { takeaway: section.takeaway } : {}),
972
+ ...(section.source ? { source: section.source } : {}),
973
+ }
974
+ if (specials.length === 0 && notes !== '') slide.notes = notes
975
+ slides.push(slide)
976
+ continue
977
+ }
978
+
914
979
  if (section.formula !== '') {
915
980
  const label = section.heading || (ui.pointKicker + ' ' + (++pointRef.count))
916
981
  const rawPoints = [...section.bullets, ...section.paragraphs]
@@ -1060,12 +1125,25 @@ function normalizeSlideContent(raw, index) {
1060
1125
  ? source.columns.map((c) => stripInlineMarkdown(c)).filter(Boolean)
1061
1126
  : undefined
1062
1127
 
1128
+ const rawCode = typeof source.code === 'string'
1129
+ ? source.code.replace(/\r\n?/g, '\n').replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, '').trimEnd()
1130
+ : ''
1131
+ const codeLanguage = stripInlineMarkdown(source.language ?? '')
1132
+ const filename = stripInlineMarkdown(source.filename ?? '')
1133
+ const url = stripInlineMarkdown(source.url ?? '')
1134
+ const rawCoverPattern = String(source.coverPattern ?? '').trim().toLowerCase()
1135
+ const coverPattern = ['dots', 'grid', 'rings'].includes(rawCoverPattern) ? rawCoverPattern : ''
1136
+ const xLabel = stripInlineMarkdown(source.xLabel ?? '')
1137
+ const yLabel = stripInlineMarkdown(source.yLabel ?? '')
1138
+ const hasStringQuadrants = Array.isArray(source.quadrants) && source.quadrants.length === 4 && source.quadrants.every((q) => typeof q === 'string')
1139
+ const quadrantLabels = hasStringQuadrants ? source.quadrants.map((q) => stripInlineMarkdown(q)) : undefined
1140
+
1063
1141
  const rawItemsInput = source.items
1064
1142
  ?? source.cards
1065
1143
  ?? source.metrics
1066
1144
  ?? (!hasStringColumns ? source.columns : undefined)
1067
1145
  ?? source.steps
1068
- ?? source.quadrants
1146
+ ?? (!hasStringQuadrants && layout !== 'quadrant' ? source.quadrants : undefined)
1069
1147
  ?? (layout === 'sankey' && bullets.length > 0 ? bullets : undefined)
1070
1148
  const items = normalizeSlideItems(rawItemsInput, layout)
1071
1149
 
@@ -1076,6 +1154,14 @@ function normalizeSlideContent(raw, index) {
1076
1154
  ...(iconMode ? { iconMode } : {}),
1077
1155
  ...(formula !== '' ? { formula } : {}),
1078
1156
  ...(mermaid !== '' ? { mermaid } : {}),
1157
+ ...(rawCode !== '' ? { code: rawCode } : {}),
1158
+ ...(codeLanguage !== '' ? { language: codeLanguage } : {}),
1159
+ ...(filename !== '' ? { filename } : {}),
1160
+ ...(url !== '' ? { url } : {}),
1161
+ ...(coverPattern !== '' ? { coverPattern } : {}),
1162
+ ...(xLabel !== '' ? { xLabel } : {}),
1163
+ ...(yLabel !== '' ? { yLabel } : {}),
1164
+ ...(quadrantLabels ? { quadrants: quadrantLabels } : {}),
1079
1165
  ...(takeaway !== '' ? { takeaway } : {}),
1080
1166
  ...(slideSource !== '' ? { source: slideSource } : {}),
1081
1167
  ...(activeIndex !== undefined ? { activeIndex } : {}),
@@ -1109,7 +1195,7 @@ function normalizeSlideContent(raw, index) {
1109
1195
  return { layout, kicker, title: truncate(quoteText, 220), subtitle, ...commonExtras }
1110
1196
  }
1111
1197
 
1112
- if (layout === 'harvey' || layout === 'marimekko' || layout === 'sankey') {
1198
+ if (layout === 'harvey' || layout === 'marimekko' || layout === 'sankey' || layout === 'quadrant' || layout === 'radar' || layout === 'dumbbell' || layout === 'heatmap') {
1113
1199
  let rows = []
1114
1200
  if (Array.isArray(source.rows)) {
1115
1201
  rows = source.rows
@@ -1125,6 +1211,7 @@ function normalizeSlideContent(raw, index) {
1125
1211
  bullets,
1126
1212
  ...(rows.length ? { rows } : {}),
1127
1213
  ...(tableStyle ? { tableStyle } : {}),
1214
+ ...(layout === 'radar' && source.chart ? { chart: deckMedia.normalizeChart(source.chart, index + 1) } : {}),
1128
1215
  ...commonExtras,
1129
1216
  }
1130
1217
  }
@@ -1149,7 +1236,10 @@ function normalizeSlideContent(raw, index) {
1149
1236
  }
1150
1237
  }
1151
1238
 
1152
- return { layout, kicker, title, subtitle, text, bullets, ...commonExtras }
1239
+ const preservedImage = (layout === 'cover' || layout === 'mockup') && source.image && typeof source.image === 'object'
1240
+ ? { image: source.image }
1241
+ : {}
1242
+ return { layout, kicker, title, subtitle, text, bullets, ...preservedImage, ...commonExtras }
1153
1243
  }
1154
1244
 
1155
1245
  function checkSlideLimit(slides, limit) {
@@ -30,11 +30,127 @@ export const POSTER_COVER_VARIANTS = new Set([
30
30
  'split-bleed',
31
31
  ])
32
32
 
33
+ export const COVER_PATTERNS = new Set(['dots', 'grid', 'rings'])
34
+
35
+ /**
36
+ * 封面轻量矢量几何底纹(dots / grid / rings)—— 零外部依赖,低透明度克制点缀。
37
+ */
38
+ export function renderCoverPatternPptx(pattern, theme, nextId) {
39
+ const p = String(pattern || '').trim().toLowerCase()
40
+ if (!COVER_PATTERNS.has(p)) return ''
41
+ const tk = theme.tokens
42
+ const col = theme.dark ? '#FFFFFF' : tk.accentPrimary
43
+ const out = []
44
+ if (p === 'grid') {
45
+ for (let gx = 0.8; gx <= 12.6; gx += 1.18) {
46
+ out.push(ooxmlLine(nextId(), 'Cover Pattern V', { x: gx, y: 0 }, { x: gx, y: CANVAS_IN.h }, { color: tk.hairline, widthPt: 0.4 }))
47
+ }
48
+ for (let gy = 0.75; gy <= 6.8; gy += 1.15) {
49
+ out.push(ooxmlLine(nextId(), 'Cover Pattern H', { x: 0, y: gy }, { x: CANVAS_IN.w, y: gy }, { color: tk.hairline, widthPt: 0.4 }))
50
+ }
51
+ } else if (p === 'rings') {
52
+ ;[3.6, 5.4, 7.2].forEach((d, ri) => {
53
+ out.push(ooxmlShape(nextId(), `Cover Pattern Ring ${ri + 1}`, { x: 10.6 - d / 2, y: 3.75 - d / 2, w: d, h: d }, {
54
+ preset: 'ellipse',
55
+ fill: '',
56
+ stroke: col,
57
+ strokeAlpha: theme.dark ? 0.10 : 0.12,
58
+ strokePt: 0.75,
59
+ }))
60
+ })
61
+ } else if (p === 'dots') {
62
+ for (let r = 0; r < 5; r += 1) {
63
+ for (let c = 0; c < 6; c += 1) {
64
+ out.push(ooxmlShape(nextId(), `Cover Dot ${r}-${c}`, { x: 9.8 + c * 0.54, y: 0.9 + r * 0.54, w: 0.06, h: 0.06 }, {
65
+ preset: 'ellipse',
66
+ fill: col,
67
+ fillAlpha: theme.dark ? 0.16 : 0.18,
68
+ }))
69
+ }
70
+ }
71
+ }
72
+ return out.join('')
73
+ }
74
+
33
75
  export function renderPosterCoverPptx(slide, ctx) {
34
76
  const { coverVariant, title, subtitle, kicker, metaText, total, theme, langAttr, manifest, idBase, nextId } = ctx
35
- if (!POSTER_COVER_VARIANTS.has(coverVariant)) return null
36
77
  const tk = theme.tokens
78
+ const hasHeroPhoto = Boolean(slide?.image?.assetId || slide?.image?.src)
79
+
80
+ // Poster Cover 0:封面真图混排(左侧深邃渐变排版区 + 右侧全出血高清视觉图,0 遮挡 + WCAG AAA 对比)
81
+ if (hasHeroPhoto) {
82
+ const shapes = []
83
+ const panelW = 6.65
84
+ const darkBase = tk.coverBg && relativeLuminance(tk.coverBg) < 0.25
85
+ ? tk.coverBg
86
+ : mixHex(tk.accentPrimary, '#070B14', 0.62)
87
+ const darkEnd = mixHex(darkBase, tk.accentSecondary, 0.22)
88
+ shapes.push(ooxmlShape(nextId(), 'Photo Cover Left Panel', { x: 0, y: 0, w: panelW, h: CANVAS_IN.h }, {
89
+ preset: 'rect',
90
+ gradientStops: [
91
+ { offset: 0, color: darkBase },
92
+ { offset: 1, color: darkEnd },
93
+ ],
94
+ gradientAngle: 145,
95
+ }))
96
+ shapes.push(ooxmlShape(nextId(), 'Photo Cover Top Accent', { x: 0, y: 0, w: panelW, h: 0.08 }, {
97
+ preset: 'rect',
98
+ fill: tk.accentPrimary,
99
+ }))
100
+ if (kicker !== '') {
101
+ shapes.push(ooxmlShape(idBase + 4, 'Kicker', { x: 0.76, y: 1.38, w: panelW - 1.32, h: 0.36 }, {
102
+ txBox: true,
103
+ anchor: 'ctr',
104
+ marginsIn: { l: 0, r: 0, t: 0, b: 0 },
105
+ paragraphs: [
106
+ ooxmlRichParagraph(kicker.toUpperCase(), { sizePt: 11, color: '#FDE68A', bold: true, lang: langAttr, font: theme.fonts.body, spc: 180 }),
107
+ ],
108
+ }))
109
+ }
110
+ const titleBox = { x: 0.76, y: 1.88, w: panelW - 1.32, h: 2.38 }
111
+ const titleFit = computeTextFit(title, titleBox, 'coverTitle', { maxPt: 38, minPt: 24, padXPt: 2, padYPt: 4 })
112
+ shapes.push(ooxmlShape(idBase + 2, 'Title', titleBox, {
113
+ txBox: true,
114
+ anchor: 'ctr',
115
+ marginsIn: { l: 0, r: 0, t: 0, b: 0 },
116
+ fontScale: titleFit.fontScale,
117
+ paragraphs: [
118
+ ooxmlRichParagraph(title, { sizePt: titleFit.fontPt, color: '#F8FAFC', bold: true, lang: langAttr, font: theme.fonts.heading, lineHeight: titleFit.lineHeight }),
119
+ ],
120
+ }))
121
+ shapes.push(ooxmlShape(nextId(), 'Photo Cover Rule', { x: 0.76, y: 4.38, w: 1.10, h: 0.055 }, {
122
+ preset: 'rect',
123
+ fill: tk.accentPrimary,
124
+ }))
125
+ if (subtitle !== '') {
126
+ const subBox = { x: 0.76, y: 4.62, w: panelW - 1.32, h: 1.35 }
127
+ const subFit = computeTextFit(subtitle, subBox, 'body', { maxPt: 16.5, minPt: 13, padXPt: 2, padYPt: 2 })
128
+ shapes.push(ooxmlShape(idBase + 3, 'Subtitle', subBox, {
129
+ txBox: true,
130
+ anchor: 't',
131
+ marginsIn: { l: 0, r: 0, t: 0, b: 0 },
132
+ fontScale: subFit.fontScale,
133
+ paragraphs: [
134
+ ooxmlRichParagraph(subtitle, { sizePt: subFit.fontPt, color: '#CBD5E1', lang: langAttr, font: theme.fonts.body, lineHeight: 1.44 }),
135
+ ],
136
+ }))
137
+ }
138
+ if (metaText) {
139
+ shapes.push(ooxmlShape(nextId(), 'Cover meta', { x: 0.76, y: 6.46, w: panelW - 1.32, h: 0.42 }, {
140
+ txBox: true,
141
+ anchor: 'ctr',
142
+ marginsIn: { l: 0, r: 0, t: 0, b: 0 },
143
+ paragraphs: [
144
+ ooxmlRichParagraph(metaText, { sizePt: 10.5, color: '#94A3B8', lang: langAttr, font: theme.fonts.body }),
145
+ ],
146
+ }))
147
+ }
148
+ return shapes.join('')
149
+ }
150
+
151
+ if (!POSTER_COVER_VARIANTS.has(coverVariant)) return null
37
152
  const shapes = []
153
+ const patXml = renderCoverPatternPptx(slide?.coverPattern, theme, nextId)
38
154
 
39
155
  // Poster Cover 1:Apple / Linear Keynote 光晕剧场封面
40
156
  if (coverVariant === 'keynote-glow') {
@@ -55,6 +171,7 @@ export function renderPosterCoverPptx(slide, ctx) {
55
171
  gradientStops: gradStops,
56
172
  gradientAngle: 135,
57
173
  }))
174
+ if (patXml) shapes.push(patXml)
58
175
  // 右上主氛围径向光斑 + 左下辅氛围径向光斑(4段柔滑过渡避免 LibreOffice 椭圆边界断层)
59
176
  shapes.push(ooxmlShape(nextId(), 'Ambient Glow Primary', { x: 6.7, y: -2.2, w: 8.8, h: 8.8 }, {
60
177
  preset: 'ellipse',
@@ -169,6 +286,7 @@ export function renderPosterCoverPptx(slide, ctx) {
169
286
 
170
287
  // Poster Cover 2:瑞士杂志网格封面(Monocle / FT / Nature)
171
288
  if (coverVariant === 'editorial-grid') {
289
+ if (patXml) shapes.push(patXml)
172
290
  shapes.push(ooxmlShape(nextId(), 'Editorial Top Rule', { x: 0.62, y: 0.42, w: 12.09, h: 0.04 }, {
173
291
  preset: 'rect',
174
292
  fill: tk.inkPrimary,
@@ -305,6 +423,7 @@ export function renderPosterCoverPptx(slide, ctx) {
305
423
  }
306
424
 
307
425
  // Poster Cover 3 & 4:建筑感非对称封面(architectural / split-bleed —— 麦肯锡/东方极简)
426
+ if (patXml) shapes.push(patXml)
308
427
  const isSplitBleed = coverVariant === 'split-bleed'
309
428
  const wingW = isSplitBleed ? 5.25 : 4.25
310
429
  const wingX = CANVAS_IN.w - wingW
@@ -443,11 +562,39 @@ export function renderPosterCoverPptx(slide, ctx) {
443
562
 
444
563
  export function renderPosterCoverHtml(slide, ctx) {
445
564
  const { coverVariant, title, subtitle, kicker, meta, total, langId, manifest, theme } = ctx
565
+ const rawAsset = slide?.image?.assetId && manifest?.assets?.[slide.image.assetId]
566
+ const photoData = rawAsset
567
+ ? (String(rawAsset.data || '').startsWith('data:') ? rawAsset.data : `data:${rawAsset.mime};base64,${rawAsset.data}`)
568
+ : (typeof slide?.image?.src === 'string' && slide.image.src.startsWith('data:image/') ? slide.image.src : '')
569
+
570
+ if (photoData) {
571
+ const tk = theme?.tokens
572
+ const darkBase = tk?.coverBg && relativeLuminance(tk.coverBg) < 0.25
573
+ ? tk.coverBg
574
+ : mixHex(tk?.accentPrimary || '#0057B8', '#070B14', 0.62)
575
+ const darkEnd = mixHex(darkBase, tk?.accentSecondary || '#0E7490', 0.22)
576
+ return (
577
+ '<div class="cover-shell is-photo-split">' +
578
+ `<div class="photo-cover-left" style="background:linear-gradient(145deg,${darkBase},${darkEnd})">` +
579
+ (kicker !== '' ? '<div class="kicker">' + escapeHtml(kicker) + '</div>' : '') +
580
+ '<h1>' + renderInlineHtml(title) + '</h1>' +
581
+ '<div class="arch-rule"></div>' +
582
+ (subtitle !== '' ? '<div class="subtitle">' + renderInlineHtml(subtitle) + '</div>' : '') +
583
+ (meta !== '' ? '<div class="meta">' + escapeHtml(meta) + '</div>' : '') +
584
+ '</div>' +
585
+ `<div class="photo-cover-right"><img src="${photoData}" alt="${escapeHtml(slide.image?.alt || title)}"/></div>` +
586
+ '</div>'
587
+ )
588
+ }
589
+
446
590
  if (!POSTER_COVER_VARIANTS.has(coverVariant)) return null
591
+ const patClass = COVER_PATTERNS.has(String(slide?.coverPattern || '').toLowerCase())
592
+ ? ' cover-pat-' + String(slide.coverPattern).toLowerCase()
593
+ : ''
447
594
 
448
595
  if (coverVariant === 'keynote-glow') {
449
596
  return (
450
- '<div class="cover-shell is-keynote-glow">' +
597
+ '<div class="cover-shell is-keynote-glow' + patClass + '">' +
451
598
  '<div class="cover-glow-orb orb-a" aria-hidden="true"></div>' +
452
599
  '<div class="cover-glow-orb orb-b" aria-hidden="true"></div>' +
453
600
  '<div class="cover-center-stack">' +
@@ -801,4 +948,11 @@ export const AESTHETIC_STUDIO_CSS = `
801
948
  .deck-icon-badge--ring{border:1.25px solid var(--accent);background:transparent}
802
949
  .deck-icon-badge--solid{background:var(--accent);color:var(--ink-on-accent)}
803
950
  .deck-icon-badge--bare{width:auto;height:auto;padding:2px;background:transparent}
951
+ .cover-shell.is-photo-split{display:grid;grid-template-columns:1fr 1fr;height:100%;border-radius:calc(var(--radius) * 1.2);overflow:hidden}
952
+ .photo-cover-left{padding:clamp(32px,4.2vw,58px);display:flex;flex-direction:column;justify-content:center;gap:16px;color:#F8FAFC;border-top:5px solid var(--accent)}
953
+ .photo-cover-left .kicker{color:#FDE68A}.photo-cover-left h1{color:#F8FAFC}.photo-cover-left .subtitle{color:#CBD5E1}.photo-cover-left .meta{color:#94A3B8;margin-top:auto;border-top:1px solid rgba(255,255,255,.15);padding-top:12px}
954
+ .photo-cover-right{position:relative;overflow:hidden;background:#0F172A}
955
+ .photo-cover-right img{width:100%;height:100%;object-fit:cover;display:block}
956
+ .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
+ .cover-pat-dots{background-image:radial-gradient(color-mix(in srgb,var(--accent) 26%,transparent) 1.5px,transparent 1.5px);background-size:24px 24px}
804
958
  `
@@ -105,6 +105,25 @@ import {
105
105
  renderMermaidHtml,
106
106
  MERMAID_CSS,
107
107
  } from './deck-mermaid.mjs'
108
+ import {
109
+ SHOWCASE_LAYOUTS,
110
+ tokenizeCodeLine,
111
+ extractCodeSource,
112
+ computeMockupGeometry,
113
+ renderShowcaseSlideBodyPptx,
114
+ renderShowcaseSlideBodyHtml,
115
+ SHOWCASE_CSS,
116
+ } from './deck-showcase.mjs'
117
+ import {
118
+ PRO_CHART_LAYOUTS,
119
+ computeQuadrantModel,
120
+ computeRadarModel,
121
+ computeDumbbellModel,
122
+ computeHeatmapModel,
123
+ renderProChartSlideBodyPptx,
124
+ renderProChartSlideBodyHtml,
125
+ PRO_CHARTS_CSS,
126
+ } from './deck-charts-pro.mjs'
108
127
 
109
128
  export {
110
129
  CANVAS_IN,
@@ -160,6 +179,17 @@ export {
160
179
  POSTER_COVER_VARIANTS,
161
180
  resolveSectionAgendaChapters,
162
181
  AESTHETIC_STUDIO_CSS,
182
+ SHOWCASE_LAYOUTS,
183
+ tokenizeCodeLine,
184
+ extractCodeSource,
185
+ computeMockupGeometry,
186
+ PRO_CHART_LAYOUTS,
187
+ computeQuadrantModel,
188
+ computeRadarModel,
189
+ computeDumbbellModel,
190
+ computeHeatmapModel,
191
+ SHOWCASE_CSS,
192
+ PRO_CHARTS_CSS,
163
193
  }
164
194
 
165
195
  export const CORE_LAYOUTS = new Set([
@@ -185,11 +215,26 @@ export const CORE_LAYOUTS = new Set([
185
215
  'harvey',
186
216
  'tam',
187
217
  'org',
218
+ 'mockup',
219
+ 'code',
220
+ 'quadrant',
221
+ 'radar',
222
+ 'dumbbell',
223
+ 'heatmap',
188
224
  'table',
189
225
  'closing',
190
226
  ])
191
227
 
192
228
  export const LAYOUT_ALIASES = Object.freeze({
229
+ device: { layout: 'mockup', variant: 'browser' },
230
+ browser: { layout: 'mockup', variant: 'browser' },
231
+ mobile: { layout: 'mockup', variant: 'mobile' },
232
+ snippet: { layout: 'code', variant: 'editor' },
233
+ 'bubble-matrix': { layout: 'quadrant' },
234
+ 'magic-quadrant': { layout: 'quadrant' },
235
+ spider: { layout: 'radar' },
236
+ slope: { layout: 'dumbbell' },
237
+ 'heat-matrix': { layout: 'heatmap' },
193
238
  'kpi-grid': { layout: 'kpi', variant: 'grid' },
194
239
  scorecard: { layout: 'kpi', variant: 'grid' },
195
240
  bento: { layout: 'cards', variant: 'bento' },
@@ -834,6 +879,37 @@ export function renderCoreSlidePptx(slide, index, total, theme, langAttr, manife
834
879
  return shapes.join('')
835
880
  }
836
881
 
882
+ const showcaseShapes = renderShowcaseSlideBodyPptx(slide, {
883
+ theme,
884
+ langAttr,
885
+ chromeCfg,
886
+ nextId,
887
+ bodyTopY,
888
+ bodyBottomY,
889
+ bodyH,
890
+ manifest,
891
+ })
892
+ if (showcaseShapes !== null) {
893
+ shapes.push(showcaseShapes)
894
+ shapes.push(renderSlideChromePptx(slide, index, total, theme, langAttr, manifest, nextId))
895
+ return shapes.join('')
896
+ }
897
+
898
+ const proChartShapes = renderProChartSlideBodyPptx(slide, {
899
+ theme,
900
+ langAttr,
901
+ chromeCfg,
902
+ nextId,
903
+ bodyTopY,
904
+ bodyBottomY,
905
+ bodyH,
906
+ })
907
+ if (proChartShapes !== null) {
908
+ shapes.push(proChartShapes)
909
+ shapes.push(renderSlideChromePptx(slide, index, total, theme, langAttr, manifest, nextId))
910
+ return shapes.join('')
911
+ }
912
+
837
913
  const diagramShapes = renderDiagramSlideBodyPptx(slide, {
838
914
  theme,
839
915
  langAttr,
@@ -2013,6 +2089,8 @@ export function renderCoreSlideHtml(slide, index, total, ui, langId, manifest =
2013
2089
  renderSlideHeaderHtml({ ...slide, kicker }, chromeStyle, folioText, isFraming, fallbackKicker)
2014
2090
 
2015
2091
  let inner = ''
2092
+ const showcaseHtml = renderShowcaseSlideBodyHtml(slide, { theme, langId, manifest })
2093
+ const proChartHtml = renderProChartSlideBodyHtml(slide, { theme, langId, manifest })
2016
2094
  const diagramHtml = renderDiagramSlideBodyHtml(slide, { theme, langId, chromeStyle })
2017
2095
 
2018
2096
  if (layout === 'cover') {
@@ -2095,6 +2173,10 @@ export function renderCoreSlideHtml(slide, index, total, ui, langId, manifest =
2095
2173
  '</div>'
2096
2174
  } else if (layout === 'mermaid') {
2097
2175
  inner = renderHeader() + renderMermaidHtml(slide, index)
2176
+ } else if (showcaseHtml !== null) {
2177
+ inner = renderHeader() + showcaseHtml
2178
+ } else if (proChartHtml !== null) {
2179
+ inner = renderHeader() + proChartHtml
2098
2180
  } else if (diagramHtml !== null) {
2099
2181
  inner = renderHeader(layout === 'harvey' ? ui.tableKicker : '') + diagramHtml
2100
2182
  } else if (layout === 'table' && (slide.tableStyle || slide.visual?.tableStyle) === 'harvey') {
@@ -2454,6 +2536,8 @@ math.deck-math.is-inline{font-size:1.06em;vertical-align:middle}
2454
2536
  .callout-hero.is-omath{padding:22px 30px;display:flex;align-items:center;justify-content:center}
2455
2537
  .formula-caption{text-align:center;color:var(--ink-secondary);font-size:clamp(14px,1.35vw,18px);margin-top:-6px}
2456
2538
  ${AESTHETIC_STUDIO_CSS}
2539
+ ${SHOWCASE_CSS}
2540
+ ${PRO_CHARTS_CSS}
2457
2541
  ${DIAGRAMS_CSS}
2458
2542
  ${CHROME_CSS}
2459
2543
  ${MERMAID_CSS}