dsh-ppt 0.26.0 → 0.27.1

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 +16 -0
  2. package/README.en.md +5 -4
  3. package/README.md +5 -4
  4. package/docs/USAGE.en.md +1 -0
  5. package/docs/USAGE.md +1 -0
  6. package/docs/VALIDATION.md +4 -0
  7. package/docs/assets/intro/workflow-en-dark.svg +1 -1
  8. package/docs/assets/intro/workflow-en-light.svg +1 -1
  9. package/docs/assets/intro/workflow-en-mobile-dark.svg +1 -1
  10. package/docs/assets/intro/workflow-en-mobile-light.svg +1 -1
  11. package/docs/assets/intro/workflow-zh-dark.svg +1 -1
  12. package/docs/assets/intro/workflow-zh-light.svg +1 -1
  13. package/docs/assets/intro/workflow-zh-mobile-dark.svg +1 -1
  14. package/docs/assets/intro/workflow-zh-mobile-light.svg +1 -1
  15. package/lib/client.js +96 -12
  16. package/lib/execution.js +8 -4
  17. package/lib/tools.js +56 -1
  18. package/lib/types.d.ts +64 -0
  19. package/lib/workbench.js +67 -3
  20. package/package.json +1 -1
  21. package/skills/dsh-ppt/SKILL.md +3 -3
  22. package/skills/dsh-ppt/package.json +1 -1
  23. package/skills/dsh-ppt/scripts/build-deck.mjs +15 -3
  24. package/skills/dsh-ppt/scripts/deck-absorb.mjs +114 -1
  25. package/skills/dsh-ppt/scripts/deck-advanced.mjs +106 -15
  26. package/skills/dsh-ppt/scripts/deck-chrome.mjs +114 -6
  27. package/skills/dsh-ppt/scripts/deck-core.mjs +6 -0
  28. package/skills/dsh-ppt/scripts/deck-covers.mjs +804 -0
  29. package/skills/dsh-ppt/scripts/deck-director.mjs +118 -1
  30. package/skills/dsh-ppt/scripts/deck-icons.mjs +469 -0
  31. package/skills/dsh-ppt/scripts/deck-layouts.mjs +519 -92
  32. package/skills/dsh-ppt/scripts/deck-media.mjs +159 -15
  33. package/skills/dsh-ppt/scripts/deck-taste.mjs +347 -0
@@ -11,7 +11,18 @@ import { normalizeVisual, applyVisualActions } from './deck-visual.mjs'
11
11
  import { absorbPptx, CHROME_STYLE_IDS } from './deck-absorb.mjs'
12
12
  import { extractPptxSlides } from './deck-import.mjs'
13
13
  import { renderHandoutMarkdown, computePaceBudget, renderOnePagerHtml } from './deck-delivery.mjs'
14
- import { SCENARIO_TEMPLATES, findScenarioTemplate, buildScenarioSlides, listScenarioTemplates, inferThemeFromContent, promoteMarkdownSlides, auditSlideAesthetics } from './deck-director.mjs'
14
+ import { SCENARIO_TEMPLATES, findScenarioTemplate, buildScenarioSlides, listScenarioTemplates, inferThemeFromContent, promoteMarkdownSlides, optimizeVisualRhythm, auditSlideAesthetics } from './deck-director.mjs'
15
+ import {
16
+ CARD_MATERIALS,
17
+ ICON_MODES,
18
+ resolveTasteRecipe,
19
+ resolveActiveTaste,
20
+ sanitizeCustomTasteRecipe,
21
+ loadWorkspaceTasteRecipes,
22
+ saveWorkspaceTasteRecipe,
23
+ listAllTasteRecipes,
24
+ listCuratedTasteRecipes,
25
+ } from './deck-taste.mjs'
15
26
  export { readRenderReceipt } from './deck-render.mjs'
16
27
  export { dataNotes, dataReport } from './deck-data.mjs'
17
28
  export { buildDeck, resolveLanguage } from './deck-core.mjs'
@@ -20,7 +31,8 @@ export { absorbPptx } from './deck-absorb.mjs'
20
31
  export { extractPptxSlides } from './deck-import.mjs'
21
32
  export { renderHandoutMarkdown, computePaceBudget, renderOnePagerHtml } from './deck-delivery.mjs'
22
33
  export { extractOfficeSource, importOfficeDeck } from './deck-office.mjs'
23
- export { inferThemeFromContent } from './deck-director.mjs'
34
+ export { inferThemeFromContent, optimizeVisualRhythm } from './deck-director.mjs'
35
+ export { listAllTasteRecipes, listCuratedTasteRecipes, loadWorkspaceTasteRecipes, saveWorkspaceTasteRecipe, resolveTasteRecipe } from './deck-taste.mjs'
24
36
 
25
37
  export function buildThemePreview(options = {}) {
26
38
  return buildThemePreviewFromThemes(options, resolveLanguage, DECK_VERSION)
@@ -141,6 +153,23 @@ function normalizeBrand(input, assets, cwd) {
141
153
  if (!CHROME_STYLE_SET.has(cs)) fail('brand.chromeStyle 需为 ' + CHROME_STYLE_IDS.join(' / '))
142
154
  brand.chromeStyle = cs
143
155
  }
156
+ if (input.cardMaterial !== undefined && input.cardMaterial !== null && input.cardMaterial !== '') {
157
+ const cm = String(input.cardMaterial).trim().toLowerCase()
158
+ if (!CARD_MATERIALS.includes(cm)) fail('brand.cardMaterial 需为 ' + CARD_MATERIALS.join(' / '))
159
+ brand.cardMaterial = cm
160
+ }
161
+ if (input.iconMode !== undefined && input.iconMode !== null && input.iconMode !== '') {
162
+ const im = String(input.iconMode).trim().toLowerCase()
163
+ if (!ICON_MODES.includes(im)) fail('brand.iconMode 需为 ' + ICON_MODES.join(' / '))
164
+ brand.iconMode = im
165
+ }
166
+ if (input.taste !== undefined && input.taste !== null && input.taste !== '') {
167
+ brand.taste = String(input.taste).trim().slice(0, 64)
168
+ }
169
+ if (input.tasteRecipe && typeof input.tasteRecipe === 'object' && !Array.isArray(input.tasteRecipe)) {
170
+ const cleanRecipe = sanitizeCustomTasteRecipe(input.tasteRecipe)
171
+ if (cleanRecipe) brand.tasteRecipe = cleanRecipe
172
+ }
144
173
  if (input.logo) brand.logoAssetId = addAsset({ src: input.logo }, assets, cwd, '品牌 Logo')
145
174
  else if (input.logoAssetId) {
146
175
  if (!assets[input.logoAssetId]) fail('品牌 Logo 嵌入资产不存在')
@@ -199,7 +228,7 @@ function validateRawSlides(slides) {
199
228
  }
200
229
 
201
230
  function snapshot(manifest) {
202
- return clone(Object.fromEntries(['title', 'theme', 'language', 'motion', 'slides', 'brand', 'template', 'dataModel', 'targetMinutes'].filter(k => manifest[k] !== undefined).map(k => [k, manifest[k]])))
231
+ return clone(Object.fromEntries(['title', 'theme', 'language', 'motion', 'slides', 'brand', 'template', 'dataModel', 'targetMinutes', 'taste'].filter(k => manifest[k] !== undefined).map(k => [k, manifest[k]])))
203
232
  }
204
233
 
205
234
  function collectAssets(manifest) {
@@ -389,7 +418,7 @@ async function exportPptx(manifest, theme, language, signal) {
389
418
  manifest.slides.forEach((source, index) => {
390
419
  abort(signal)
391
420
  const slide = slides[index]
392
- const boxes = MEDIA_LAYOUTS.has(source.layout) ? mediaBoxes(source.layout, source.variant, source) : mediaBoxes('image')
421
+ const boxes = MEDIA_LAYOUTS.has(source.layout) ? mediaBoxes(source.layout, source.variant, source, manifest) : mediaBoxes('image')
393
422
  if (Array.isArray(boxes.gallery) && Array.isArray(source.images) && source.images.length > 1) {
394
423
  boxes.gallery.forEach((gBox, gIdx) => {
395
424
  const img = source.images[gIdx]
@@ -405,12 +434,16 @@ async function exportPptx(manifest, theme, language, signal) {
405
434
  }
406
435
  } else {
407
436
  const font = pptxEastAsianFont(theme.fonts.body)
408
- const spec = buildOfficeKitChartSpec(source.chart, theme, source.visual, font)
437
+ const activeTaste = resolveActiveTaste(manifest, source)
438
+ const chartForSpec = activeTaste.chartSpotlight && source.chart.highlight === undefined && source.chart.spotlight === undefined
439
+ ? { ...source.chart, spotlight: true }
440
+ : source.chart
441
+ const spec = buildOfficeKitChartSpec(chartForSpec, theme, source.visual, font)
409
442
  lib.addSlideChart(slide, { ...emu(boxes.chart), name: 'Editable data chart', spec })
410
443
  }
411
444
  }
412
445
  if (manifest.brand?.logoAssetId) putImage(slide, manifest.brand.logoAssetId, LOGO_BOX, 'contain', 'Brand logo', manifest.brand.name)
413
- if (manifest.brand?.footer && !lib.findShapeByName(slide, 'Footer source')) {
446
+ if (manifest.brand?.footer && source.layout !== 'cover' && source.layout !== 'closing' && !lib.findShapeByName(slide, 'Footer source')) {
414
447
  const footer = lib.addSlideTextBox(slide, { ...emu(FOOTER_BOX), text: manifest.brand.footer, name: 'Brand footer' })
415
448
  lib.setShapeTextFormat(footer, { size: 10, font: pptxEastAsianFont(theme.fonts.body), color: theme.palette.muted })
416
449
  }
@@ -502,7 +535,7 @@ function validateSnapshot(value, assets) {
502
535
  validateDataSnapshot(value, normalizeSlides)
503
536
  if (value.brand != null) {
504
537
  if (Object.hasOwn(value.brand, 'logo')) fail('工程品牌仅支持嵌入的 logoAssetId,不读取本地 logo 路径')
505
- for (const key of ['primaryColor', 'secondaryColor', 'backgroundColor', 'textColor', 'fontFamily', 'headingFont', 'coverMode', 'coverBg', 'name', 'footer', 'chromeStyle']) {
538
+ for (const key of ['primaryColor', 'secondaryColor', 'backgroundColor', 'textColor', 'fontFamily', 'headingFont', 'coverMode', 'coverBg', 'name', 'footer', 'chromeStyle', 'cardMaterial', 'iconMode', 'taste']) {
506
539
  if (value.brand[key] !== undefined && typeof value.brand[key] !== 'string') fail('工程 brand.' + key + ' 必须为字符串')
507
540
  }
508
541
  normalizeBrand(value.brand, assets, '.')
@@ -587,11 +620,21 @@ export async function buildDeckAsync(options = {}) {
587
620
  absorbed = await absorbPptx({ pptxPath: String(options.referencePptx).trim(), cwd, extractLogo: true, signal: options.signal })
588
621
  }
589
622
 
623
+ const workspaceTastes = loadWorkspaceTasteRecipes(cwd)
624
+ const resolvedTaste = options.taste !== undefined && options.taste !== null && options.taste !== ''
625
+ ? resolveTasteRecipe(options.taste, workspaceTastes)
626
+ : (absorbed?.styleRecipe && options.cloneStructure === true ? absorbed.styleRecipe : null)
627
+ if (options.taste !== undefined && options.taste !== null && options.taste !== '' && !resolvedTaste) {
628
+ fail('未知品味配方 taste:' + String(options.taste))
629
+ }
630
+
590
631
  const rawThemeOpt = typeof options.theme === 'string' && options.theme.trim() ? options.theme.trim() : undefined
591
632
  let chosenThemeId = rawThemeOpt
592
633
  let directorHint = null
593
- if (chosenThemeId === 'auto' || (!chosenThemeId && (options.persona || absorbed || scenario))) {
594
- if (absorbed && (!rawThemeOpt || rawThemeOpt === 'auto') && !options.persona && !scenario) {
634
+ if (chosenThemeId === 'auto' || (!chosenThemeId && (options.persona || absorbed || scenario || resolvedTaste))) {
635
+ if (resolvedTaste?.theme && (!rawThemeOpt || rawThemeOpt === 'auto') && !options.persona) {
636
+ chosenThemeId = resolvedTaste.theme
637
+ } else if (absorbed && (!rawThemeOpt || rawThemeOpt === 'auto') && !options.persona && !scenario) {
595
638
  chosenThemeId = absorbed.recommendedTheme
596
639
  } else {
597
640
  directorHint = inferThemeFromContent({
@@ -631,12 +674,27 @@ export async function buildDeckAsync(options = {}) {
631
674
  }
632
675
  }
633
676
  }
634
- if (directorHint?.tableStyle === 'booktabs') {
635
- normalized.deck.slides = normalized.deck.slides.map(s => s.layout === 'table' && !s.tableStyle ? { ...s, tableStyle: 'booktabs' } : s)
677
+ if (directorHint?.tableStyle === 'booktabs' || resolvedTaste?.tableStyle) {
678
+ const effTableStyle = resolvedTaste?.tableStyle || directorHint?.tableStyle
679
+ normalized.deck.slides = normalized.deck.slides.map(s => s.layout === 'table' && !s.tableStyle ? { ...s, tableStyle: effTableStyle } : s)
680
+ }
681
+ if (resolvedTaste && options.smartLayout !== false) {
682
+ normalized.deck.slides = optimizeVisualRhythm(normalized.deck.slides, resolvedTaste)
636
683
  }
637
684
 
638
685
  const assets = {}
639
686
  let brandInput = options.brand
687
+ if (resolvedTaste && options.brand !== null) {
688
+ const tasteBrandBase = {
689
+ ...(resolvedTaste.brand && typeof resolvedTaste.brand === 'object' ? resolvedTaste.brand : {}),
690
+ ...(resolvedTaste.chromeStyle ? { chromeStyle: resolvedTaste.chromeStyle } : {}),
691
+ ...(resolvedTaste.cardMaterial ? { cardMaterial: resolvedTaste.cardMaterial } : {}),
692
+ ...(resolvedTaste.iconMode ? { iconMode: resolvedTaste.iconMode } : {}),
693
+ taste: resolvedTaste.id,
694
+ ...(!listCuratedTasteRecipes().some(r => r.id === resolvedTaste.id) ? { tasteRecipe: resolvedTaste } : {}),
695
+ }
696
+ brandInput = { ...tasteBrandBase, ...(brandInput || {}) }
697
+ }
640
698
  if (absorbed) {
641
699
  const baseAbsorbedBrand = {
642
700
  ...absorbed.sanitizedBrand,
@@ -650,7 +708,7 @@ export async function buildDeckAsync(options = {}) {
650
708
  ) {
651
709
  delete baseAbsorbedBrand.backgroundColor
652
710
  }
653
- brandInput = options.brand === null ? null : { ...baseAbsorbedBrand, ...(options.brand || {}) }
711
+ brandInput = options.brand === null ? null : { ...baseAbsorbedBrand, ...(brandInput || {}) }
654
712
  }
655
713
  const brand = normalizeBrand(brandInput, assets, cwd)
656
714
 
@@ -670,6 +728,7 @@ export async function buildDeckAsync(options = {}) {
670
728
  theme: normalized.theme.id,
671
729
  language: normalized.language.id,
672
730
  motion: normalized.motion,
731
+ ...(resolvedTaste ? { taste: listCuratedTasteRecipes().some(r => r.id === resolvedTaste.id) ? resolvedTaste.id : resolvedTaste } : {}),
673
732
  ...(targetMinutesRaw !== undefined ? { targetMinutes: targetMinutesRaw } : {}),
674
733
  ...(scenario ? { template: scenario.id } : {}),
675
734
  ...(brand ? { brand } : {}),
@@ -758,6 +817,7 @@ export async function editDeck(options = {}) {
758
817
  if (
759
818
  options.brand === undefined &&
760
819
  options.theme === undefined &&
820
+ options.taste === undefined &&
761
821
  options.referencePptx === undefined &&
762
822
  options.order === undefined &&
763
823
  options.duplicate === undefined &&
@@ -766,12 +826,12 @@ export async function editDeck(options = {}) {
766
826
  options.targetMinutes === undefined &&
767
827
  options.saveAs !== true
768
828
  ) {
769
- fail('请提供 edits、theme、referencePptx、order、duplicate、remove、append、targetMinutes 或 brand')
829
+ fail('请提供 edits、theme、taste、referencePptx、order、duplicate、remove、append、targetMinutes 或 brand')
770
830
  }
771
831
  }
772
832
  const used = new Set()
773
833
  const allowed = new Set([
774
- 'layout', 'variant', 'chrome', 'title', 'subtitle', 'kicker', 'takeaway', 'source',
834
+ 'layout', 'variant', 'chrome', 'cardMaterial', 'iconMode', 'title', 'subtitle', 'kicker', 'takeaway', 'source',
775
835
  'text', 'formula', 'mermaid', 'activeIndex', 'tableStyle', 'bullets', 'items', 'cards', 'metrics',
776
836
  'columns', 'steps', 'quadrants', 'rows', 'notes', 'image', 'images', 'chart', 'visual',
777
837
  ])
@@ -867,6 +927,37 @@ export async function editDeck(options = {}) {
867
927
  next.brand = normalizeBrand({ ...next.brand, ...absorbedBrand }, next.assets, cwd)
868
928
  }
869
929
 
930
+ if (options.taste !== undefined) {
931
+ if (options.taste === null || options.taste === '') {
932
+ delete next.taste
933
+ if (next.brand) {
934
+ delete next.brand.taste
935
+ delete next.brand.tasteRecipe
936
+ delete next.brand.cardMaterial
937
+ delete next.brand.iconMode
938
+ }
939
+ } else {
940
+ const wsTastes = loadWorkspaceTasteRecipes(cwd)
941
+ const tr = resolveTasteRecipe(options.taste, wsTastes)
942
+ if (!tr) fail('未知品味配方 taste:' + String(options.taste))
943
+ const isBuiltin = listCuratedTasteRecipes().some(r => r.id === tr.id)
944
+ next.taste = isBuiltin ? tr.id : tr
945
+ if (options.theme === undefined && tr.theme) next.theme = resolveTheme(tr.theme).id
946
+ next.brand = normalizeBrand({
947
+ ...(next.brand || {}),
948
+ ...(tr.brand && typeof tr.brand === 'object' ? tr.brand : {}),
949
+ ...(tr.chromeStyle ? { chromeStyle: tr.chromeStyle } : {}),
950
+ ...(tr.cardMaterial ? { cardMaterial: tr.cardMaterial } : {}),
951
+ ...(tr.iconMode ? { iconMode: tr.iconMode } : {}),
952
+ taste: tr.id,
953
+ ...(!isBuiltin ? { tasteRecipe: tr } : {}),
954
+ }, next.assets, cwd)
955
+ if (options.optimizeRhythm !== false) {
956
+ next.slides = optimizeVisualRhythm(next.slides, tr)
957
+ }
958
+ }
959
+ }
960
+
870
961
  if (options.targetMinutes !== undefined) {
871
962
  if (options.targetMinutes === null) {
872
963
  delete next.targetMinutes
@@ -907,7 +998,7 @@ export async function undoDeck(options = {}) {
907
998
  expected(state.manifest, options.expectedRevision)
908
999
  if (!state.manifest.history.length) fail('该工程没有可撤销的修改')
909
1000
  const next = clone(state.manifest), prior = next.history.pop()
910
- for (const key of ['brand', 'template', 'dataModel', 'targetMinutes']) delete next[key]
1001
+ for (const key of ['brand', 'template', 'dataModel', 'targetMinutes', 'taste']) delete next[key]
911
1002
  Object.assign(next, prior)
912
1003
  return saveRevision(state, next, options.signal)
913
1004
  }
@@ -504,6 +504,7 @@ export function normalizeSlideItems(rawItems, layout) {
504
504
  const milestone = entry.milestone === true ? true : undefined
505
505
  const role = stripInlineMarkdown(entry.role ?? '')
506
506
  const conversion = stripInlineMarkdown(entry.conversion ?? '')
507
+ const icon = stripInlineMarkdown(entry.icon ?? '')
507
508
  const bullets = Array.isArray(entry.bullets ?? entry.items)
508
509
  ? (entry.bullets ?? entry.items).map((b) => cleanRichText(String(b))).filter(Boolean).slice(0, 8)
509
510
  : undefined
@@ -520,6 +521,7 @@ export function normalizeSlideItems(rawItems, layout) {
520
521
  ...(milestone ? { milestone } : {}),
521
522
  ...(role ? { role } : {}),
522
523
  ...(conversion ? { conversion } : {}),
524
+ ...(icon ? { icon } : {}),
523
525
  ...(status ? { status } : {}),
524
526
  ...(bullets?.length ? { bullets } : {}),
525
527
  }
@@ -577,6 +579,21 @@ export function ooxmlLinearGradientFill(stops, angleDeg = 135) {
577
579
  return '<a:gradFill rotWithShape="1"><a:gsLst>' + gsLst + '</a:gsLst><a:lin ang="' + ang + '" scaled="1"/></a:gradFill>'
578
580
  }
579
581
 
582
+ export function ooxmlRadialGradientFill(stops, pathType = 'circle', fillToRect = { l: 50000, t: 50000, r: 50000, b: 50000 }) {
583
+ const gsLst = stops.map((s) => {
584
+ const pos = Math.round(Math.max(0, Math.min(1, s.offset)) * 100000)
585
+ const alpha = s.alpha !== undefined && s.alpha < 0.999
586
+ ? '<a:alpha val="' + Math.round(Math.max(0, Math.min(1, s.alpha)) * 100000) + '"/>'
587
+ : ''
588
+ return '<a:gs pos="' + pos + '"><a:srgbClr val="' + hex6(s.color) + '">' + alpha + '</a:srgbClr></a:gs>'
589
+ }).join('')
590
+ const f = fillToRect || { l: 50000, t: 50000, r: 50000, b: 50000 }
591
+ return (
592
+ '<a:gradFill rotWithShape="1"><a:gsLst>' + gsLst + '</a:gsLst>' +
593
+ '<a:path path="' + escapeXml(pathType) + '"><a:fillToRect l="' + Math.round(f.l) + '" t="' + Math.round(f.t) + '" r="' + Math.round(f.r) + '" b="' + Math.round(f.b) + '"/></a:path></a:gradFill>'
594
+ )
595
+ }
596
+
580
597
  export function ooxmlRichParagraph(textOrRuns, options = {}) {
581
598
  const {
582
599
  sizePt = 16,
@@ -666,7 +683,10 @@ export function ooxmlShape(id, name, boxIn, options = {}) {
666
683
  fillAlpha = 1,
667
684
  gradientStops = null,
668
685
  gradientAngle = 135,
686
+ radialGradientStops = null,
687
+ radialFillToRect = null,
669
688
  stroke = '',
689
+ strokeAlpha = 1,
670
690
  strokePt = 0.75,
671
691
  dash = '',
672
692
  shadow = false,
@@ -684,13 +704,15 @@ export function ooxmlShape(id, name, boxIn, options = {}) {
684
704
  : adj !== undefined && preset === 'roundRect'
685
705
  ? '<a:avLst><a:gd name="adj" fmla="val ' + Math.round(adj) + '"/></a:avLst>'
686
706
  : '<a:avLst/>'
687
- const fillXml = gradientStops
688
- ? ooxmlLinearGradientFill(gradientStops, gradientAngle)
689
- : fill
690
- ? ooxmlSolidFill(fill, fillAlpha)
691
- : '<a:noFill/>'
707
+ const fillXml = radialGradientStops
708
+ ? ooxmlRadialGradientFill(radialGradientStops, 'circle', radialFillToRect)
709
+ : gradientStops
710
+ ? ooxmlLinearGradientFill(gradientStops, gradientAngle)
711
+ : fill
712
+ ? ooxmlSolidFill(fill, fillAlpha)
713
+ : '<a:noFill/>'
692
714
  const lnXml = stroke
693
- ? '<a:ln w="' + ptToEmu(strokePt) + '" cap="flat">' + ooxmlSolidFill(stroke) + (dash ? '<a:prstDash val="' + dash + '"/>' : '') + '</a:ln>'
715
+ ? '<a:ln w="' + ptToEmu(strokePt) + '" cap="flat">' + ooxmlSolidFill(stroke, strokeAlpha) + (dash ? '<a:prstDash val="' + dash + '"/>' : '') + '</a:ln>'
694
716
  : '<a:ln><a:noFill/></a:ln>'
695
717
  const effectXml = shadow
696
718
  ? '<a:effectLst><a:outerShdw blurRad="152400" dist="38100" dir="5400000" algn="tl" rotWithShape="0"><a:srgbClr val="0F172A"><a:alpha val="9000"/></a:srgbClr></a:outerShdw></a:effectLst>'
@@ -1033,6 +1055,7 @@ export function renderSurfaceCardPptx(name, box, opts, nextIdFn, chromeCfg, them
1033
1055
  focal = false,
1034
1056
  stroke,
1035
1057
  accentBarColor = tk.accentPrimary,
1058
+ cardMaterial = 'solid',
1036
1059
  paragraphs = [],
1037
1060
  anchor = 't',
1038
1061
  marginsIn = { l: 0.08, r: 0.08, t: 0.05, b: 0.05 },
@@ -1041,6 +1064,91 @@ export function renderSurfaceCardPptx(name, box, opts, nextIdFn, chromeCfg, them
1041
1064
  } = opts
1042
1065
  const radius = chromeCfg.cardRadiusPx
1043
1066
  const preset = radius > 0 ? 'roundRect' : 'rect'
1067
+
1068
+ // 材质 A:无框通透模式(McKinsey / Apple Editorial —— 零底色框,仅顶部强规则线与底部极细发丝线)
1069
+ if (cardMaterial === 'frameless') {
1070
+ const out = [
1071
+ ooxmlLine(nextIdFn(), name + ' top hairline', { x: box.x, y: box.y }, { x: box.x + box.w, y: box.y }, {
1072
+ color: focal ? accentBarColor : tk.hairline,
1073
+ widthPt: focal ? 2.0 : 0.85,
1074
+ }),
1075
+ ooxmlLine(nextIdFn(), name + ' bottom hairline', { x: box.x, y: box.y + box.h }, { x: box.x + box.w, y: box.y + box.h }, {
1076
+ color: tk.hairline,
1077
+ widthPt: 0.5,
1078
+ }),
1079
+ ]
1080
+ if (paragraphs.length > 0) {
1081
+ out.push(ooxmlShape(nextIdFn(), name, box, {
1082
+ txBox: true,
1083
+ anchor,
1084
+ marginsIn,
1085
+ fontScale,
1086
+ paragraphs,
1087
+ }))
1088
+ }
1089
+ return out.join('')
1090
+ }
1091
+
1092
+ // 材质 B:出版物双发丝线模式(Monocle / FT / Nature —— 顶部双轨发丝线 + 极克制底衬)
1093
+ if (cardMaterial === 'editorial-rule') {
1094
+ const out = [
1095
+ ooxmlLine(nextIdFn(), name + ' editorial rule 1', { x: box.x, y: box.y }, { x: box.x + box.w, y: box.y }, {
1096
+ color: focal ? accentBarColor : tk.inkPrimary,
1097
+ widthPt: focal ? 1.75 : 1.0,
1098
+ }),
1099
+ ooxmlLine(nextIdFn(), name + ' editorial rule 2', { x: box.x, y: box.y + 0.045 }, { x: box.x + box.w, y: box.y + 0.045 }, {
1100
+ color: tk.hairline,
1101
+ widthPt: 0.5,
1102
+ }),
1103
+ ooxmlLine(nextIdFn(), name + ' editorial bottom', { x: box.x, y: box.y + box.h }, { x: box.x + box.w, y: box.y + box.h }, {
1104
+ color: tk.hairline,
1105
+ widthPt: 0.5,
1106
+ }),
1107
+ ]
1108
+ if (paragraphs.length > 0) {
1109
+ out.push(ooxmlShape(nextIdFn(), name, box, {
1110
+ txBox: true,
1111
+ anchor,
1112
+ marginsIn,
1113
+ fontScale,
1114
+ paragraphs,
1115
+ }))
1116
+ }
1117
+ return out.join('')
1118
+ }
1119
+
1120
+ // 材质 C:发布会玻璃拟态(Apple Keynote / Linear Craft —— 半透明叠加 + 微亮边缘描边 + 顶部 1px 高光条)
1121
+ if (cardMaterial === 'glass') {
1122
+ const glassRadius = Math.max(12, radius || 14)
1123
+ const glassFill = theme.dark ? (focal ? tk.surface2 : tk.surface1) : tk.surface1
1124
+ const glassStroke = stroke !== undefined
1125
+ ? stroke
1126
+ : (focal ? accentBarColor : (theme.dark ? '#FFFFFF' : tk.hairline))
1127
+ const glassStrokeAlpha = focal ? (theme.dark ? 0.65 : 0.85) : (theme.dark ? 0.16 : 0.72)
1128
+ const out = [
1129
+ ooxmlShape(nextIdFn(), name, box, {
1130
+ preset: 'roundRect',
1131
+ adj: roundRectAdj(box.w, box.h, glassRadius),
1132
+ fill: glassFill,
1133
+ fillAlpha: theme.dark ? (focal ? 0.84 : 0.66) : 0.86,
1134
+ stroke: glassStroke,
1135
+ strokeAlpha: glassStrokeAlpha,
1136
+ strokePt: focal ? 1.0 : 0.75,
1137
+ shadow: theme.shadow,
1138
+ txBox,
1139
+ anchor,
1140
+ marginsIn,
1141
+ fontScale,
1142
+ paragraphs,
1143
+ }),
1144
+ ooxmlLine(nextIdFn(), name + ' glass specular', { x: box.x + 0.16, y: box.y + 0.012 }, { x: box.x + box.w - 0.16, y: box.y + 0.012 }, {
1145
+ color: focal ? accentBarColor : (theme.dark ? '#FFFFFF' : accentBarColor),
1146
+ widthPt: focal ? 1.25 : 0.6,
1147
+ }),
1148
+ ]
1149
+ return out.join('')
1150
+ }
1151
+
1044
1152
  const resolvedFill = chromeCfg.cardBorderless && focal && fill === tk.surface1 ? tk.surface2 : fill
1045
1153
  const resolvedStroke = stroke !== undefined
1046
1154
  ? stroke
@@ -1023,6 +1023,10 @@ function normalizeSlideContent(raw, index) {
1023
1023
  const variant = stripInlineMarkdown(source.variant ?? alias?.variant ?? '')
1024
1024
  const rawChrome = typeof source.chrome === 'string' ? source.chrome.trim() : ''
1025
1025
  const chrome = VALID_CHROME_STYLES.has(rawChrome) ? rawChrome : undefined
1026
+ const rawMat = typeof source.cardMaterial === 'string' ? source.cardMaterial.trim().toLowerCase() : ''
1027
+ const cardMaterial = ['solid', 'frameless', 'glass', 'editorial-rule'].includes(rawMat) ? rawMat : undefined
1028
+ const rawIconMode = typeof source.iconMode === 'string' ? source.iconMode.trim().toLowerCase() : ''
1029
+ const iconMode = ['off', 'explicit', 'auto'].includes(rawIconMode) ? rawIconMode : undefined
1026
1030
  const title = stripInlineMarkdown(source.title ?? '')
1027
1031
  const subtitle = cleanRichText(source.subtitle ?? '')
1028
1032
  const kicker = stripInlineMarkdown(source.kicker ?? '')
@@ -1068,6 +1072,8 @@ function normalizeSlideContent(raw, index) {
1068
1072
  const commonExtras = {
1069
1073
  ...(variant !== '' ? { variant } : {}),
1070
1074
  ...(chrome ? { chrome } : {}),
1075
+ ...(cardMaterial ? { cardMaterial } : {}),
1076
+ ...(iconMode ? { iconMode } : {}),
1071
1077
  ...(formula !== '' ? { formula } : {}),
1072
1078
  ...(mermaid !== '' ? { mermaid } : {}),
1073
1079
  ...(takeaway !== '' ? { takeaway } : {}),