import type {Idea,Slide} from '../content/ideas'; type Template=NonNullable; export function Ref17Cover({template,slide,masthead=template.masthead,guides=false}:{template:Template;slide:Slide;masthead?:string[];guides?:boolean}){ const scale=10,W=template.width*scale,H=template.height*scale; const slot=(id:string)=>{const s=template.slots.find(s=>s.id===id);if(!s)throw Error('Missing source slot '+id);return s.box.map(v=>v*scale)}; const [mx,my,mw,mh]=slot('I01'),[cx,cy,cw,ch]=slot('I02'),[dx,dy,dw,dh]=slot('D02'),[bx,by,bw,bh]=slot('D03'),[lx,ly,lw,lh]=slot('D01'); const [aX,aY,aW,aH]=slot('T01'),[bX,bY,bW,bH]=slot('T02'),[tX,tY,tW,tH]=slot('T03'),[sX,sY,sW,sH]=slot('T04'); const first=masthead[0]||'STUDY',second=masthead[1]||'Skills',body=slide.body.split('\n').slice(0,3); const font1=Math.min(aH*1.2,aW/Math.max(1,first.length*.72)),font2=Math.min(bH,bW/Math.max(1,second.length*.59)); const titleSize=Math.min(tH*.72,tW/Math.max(1,Array.from(slide.heading).length*1.06)); const bodySize=Math.min(32,...body.map(s=>sW/Math.max(1,Array.from(s).reduce((n,c)=>n+(/[\u3400-\u9fff]/.test(c)?1:.5),0)))); const accent=slide.accent||'#d8ddd4'; return {(slide.label||slide.heading)+' · 模板试版'}源自 ref-17 的九个固定构件。图片位使用色块,占位文案可替换,暂无具体工具内容。 {first} {second} {slide.heading} {slide.kicker||'TEMPLATE / XX'} {body.map((line,i)=>{line})} CONTENTPLACEHOLDER {guides&&} ; }