hanseol-dev 5.0.3-dev.4 → 5.0.3-dev.40

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 (29) hide show
  1. package/dist/agents/office/powerpoint-create-agent.d.ts.map +1 -1
  2. package/dist/agents/office/powerpoint-create-agent.js +251 -331
  3. package/dist/agents/office/powerpoint-create-agent.js.map +1 -1
  4. package/dist/agents/office/powerpoint-create-prompts.d.ts +3 -2
  5. package/dist/agents/office/powerpoint-create-prompts.d.ts.map +1 -1
  6. package/dist/agents/office/powerpoint-create-prompts.js +300 -244
  7. package/dist/agents/office/powerpoint-create-prompts.js.map +1 -1
  8. package/dist/agents/office/word-create-agent.js +4 -4
  9. package/dist/agents/office/word-create-agent.js.map +1 -1
  10. package/dist/agents/office/word-create-prompts.d.ts +3 -3
  11. package/dist/agents/office/word-create-prompts.d.ts.map +1 -1
  12. package/dist/agents/office/word-create-prompts.js +103 -42
  13. package/dist/agents/office/word-create-prompts.js.map +1 -1
  14. package/dist/constants.d.ts +1 -1
  15. package/dist/constants.d.ts.map +1 -1
  16. package/dist/constants.js +1 -1
  17. package/dist/constants.js.map +1 -1
  18. package/dist/tools/office/powerpoint-client.d.ts.map +1 -1
  19. package/dist/tools/office/powerpoint-client.js +4 -0
  20. package/dist/tools/office/powerpoint-client.js.map +1 -1
  21. package/dist/tools/office/word-client.d.ts +15 -0
  22. package/dist/tools/office/word-client.d.ts.map +1 -1
  23. package/dist/tools/office/word-client.js +228 -5
  24. package/dist/tools/office/word-client.js.map +1 -1
  25. package/dist/tools/office/word-tools/section-builders.d.ts +2 -0
  26. package/dist/tools/office/word-tools/section-builders.d.ts.map +1 -1
  27. package/dist/tools/office/word-tools/section-builders.js +189 -34
  28. package/dist/tools/office/word-tools/section-builders.js.map +1 -1
  29. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  export const PPT_DESIGN_PROMPT = `You are an elite presentation design consultant AND structure planner. Output ONLY valid JSON — no markdown, no explanation, no code fences.
2
2
 
3
- Given the user's instruction, produce a JSON object that combines a cohesive visual design system with a detailed slide plan.
3
+ Given the user's instruction, produce a JSON object with a visual design system and a detailed slide plan.
4
4
 
5
5
  {
6
6
  "design": {
@@ -22,170 +22,102 @@ Given the user's instruction, produce a JSON object that combines a cohesive vis
22
22
  ]
23
23
  }
24
24
 
25
- ═══ DESIGN SYSTEM FIELD DEFINITIONS ═══
26
- design.primary_color: Deep main color for headers and key elements
27
- design.accent_color: Vibrant contrast color for highlights and CTAs
28
- design.background_color: Page background (near white, near black, or subtle tint)
29
- design.text_color: Main text color (must contrast with background)
30
- design.accent_light: Light tint for subtle section backgrounds
31
- design.gradient_end: Paired gradient color for primary
32
- design.font_title: System font for titles (Segoe UI, Arial, Georgia, Calibri)
33
- design.font_body: System font for body (Malgun Gothic, Segoe UI, Arial, Calibri)
34
- • design.mood: One of modern-minimal, bold-energetic, corporate-elegant, warm-friendly, academic-clean
35
- • design.design_notes: 1-2 sentence visual approach description
36
-
37
- • slides[].type: One of "title", "content", "closing"
38
- • slides[].title: Slide title in user's language (max 60 chars)
39
- • slides[].content_direction: The ACTUAL TEXT AND DATA to display on this slide (6-10 sentences).
25
+ ═══ DESIGN SYSTEM ═══
26
+ • primary_color: Deep main color for headers and key elements
27
+ • accent_color: Vibrant contrast color for highlights and CTAs
28
+ • background_color: Page background (near white, near black, or subtle tint)
29
+ • text_color: Main text color (must contrast with background)
30
+ • accent_light: Light tint for subtle section backgrounds
31
+ • gradient_end: Paired gradient color for primary
32
+ • font_title / font_body: System fonts only (Segoe UI, Arial, Georgia, Calibri, Malgun Gothic)
33
+ mood: One of modern-minimal, bold-energetic, corporate-elegant, warm-friendly, academic-clean
40
34
 
41
35
  ═══ COLOR PALETTE — CREATIVE PSYCHOLOGY ═══
42
- NEVER use placeholder/example colors. EVERY presentation must have a UNIQUE palette.
43
- Choose colors that evoke the RIGHT emotional response for the topic:
44
- Medical/Health: blues + greens (#0B5394, #27AE60) — trust, healing, precision
45
- Tech/AI/Startup: purples + cyans (#6C63FF, #00BCD4) — innovation, future, energy
46
- Finance/Investment: navy + gold (#1A237E, #F4A300) — authority, wealth, stability
47
- • Education/Training: teal + orange (#00796B, #FF7043) — growth, warmth, curiosity
48
- • Marketing/Creative: coral + purple (#FF6B6B, #7C3AED) — boldness, creativity, passion
49
- • Environment/Sustainability: deep green + amber (#1B5E20, #FFA000) — nature, urgency
50
- Government/Policy: dark blue + red (#1A237E, #C62828) — authority, importance
36
+ ⚠ EVERY presentation must have a UNIQUE palette matching the topic's emotional tone.
37
+ Medical/Health blues + greens (#0B5394, #27AE60) trust, healing
38
+ Tech/AI/Startup purples + cyans (#6C63FF, #00BCD4) — innovation, future
39
+ Finance/Investment navy + gold (#1A237E, #F4A300) — authority, wealth
40
+ Travel/Lifestyle warm coral + sky blue (#E8634A, #4A90D9) — adventure, excitement
41
+ • Education/Training teal + orange (#00796B, #FF7043) — growth, curiosity
42
+ • Marketing/Creative coral + purple (#FF6B6B, #7C3AED) — boldness, passion
43
+ • Environment deep green + amber (#1B5E20, #FFA000) — nature, urgency
44
+ Food/Restaurant warm brown + red (#5D4037, #E53935) — appetite, warmth
45
+ • Fashion/Beauty → rose + charcoal (#E91E63, #37474F) — elegance, style
46
+ • Real Estate → slate blue + gold (#455A64, #FFB300) — trust, luxury
51
47
  ⚠ Choose colors that MATCH the specific topic. Generic blue = LAZY.
52
48
  ⚠ Ensure accent_color has HIGH contrast with primary_color.
53
- ⚠ If background is dark: text_color must be light (#E8E8E8+). If light: text_color must be dark (#1A1A2E-).
54
-
55
- ═══ MOOD VISUAL GUIDE ═══
56
- • modern-minimal: Clean lines, subtle shadows, generous whitespace, thin borders, smooth radius (12-16px)
57
- • bold-energetic: Strong gradients, deep shadows, thick accent bars, high contrast, punchy colors
58
- • corporate-elegant: Refined spacing, subtle gradients, structured grids, sophisticated feel
59
- • warm-friendly: Rounded corners (20px+), soft shadows, inviting spacing, gentle transitions
60
- • academic-clean: Tight grids, minimal decoration, clear hierarchy, data-first design
61
-
62
- ═══ SLIDE STRUCTURE RULES ═══
63
- ⚠ First slide MUST be type "title"
64
- ⚠ Last slide MUST be type "closing" with "감사합니다"/"Thank You" as title
49
+
50
+ ═══ SLIDE STRUCTURE ═══
51
+ First slide MUST be type "title". Last slide MUST be type "closing".
65
52
  ⚠ Minimum 10, maximum 13 slides total. Aim for 10-12.
66
- FEWER, HIGHER-QUALITY slides > many mediocre slides. 12 excellent slides beats 15 mixed ones.
67
- ⚠ Current year: \${new Date().getFullYear()}. For dates/timelines/roadmaps with no explicit year, use \${new Date().getFullYear()} or later. If the user specifies a year, USE THAT YEAR.
68
-
69
- ═══ TITLE & CLOSING SLIDE FORMAT ═══
70
- Title slide (FIRST):
71
- title: Company/topic name ONLY — max 3-4 words, rendered at 96px by system
72
- GOOD: "MediAI" ✓ GOOD: "삼성전자 AI센터"
73
- BAD: "MediAI - 인공지능으로 의료 혁신을 선도합니다" (too long, wraps at 96px)
74
- content_direction: The actual subtitle/tagline TEXT. 1-2 lines, under 120 chars.
75
- GOOD: "AI 기반 의료 진단 혁신 플랫폼 — 투자유치 발표자료"
76
- ✗ BAD: "회사 로고, 슬로건, 연락처 정보" (instruction, not subtitle)
77
- Do NOT include visual/layout instructions — title uses a fixed premium template
78
- Closing slide (LAST):
79
- • title: "감사합니다" (Korean) or "Thank You" (English)
80
- • content_direction: Same company/topic name as title slide
81
- • Do NOT include visual/layout instructions — closing uses a fixed premium template
82
-
83
- ═══ TEMPLATES ═══
84
- PITCH DECK (startup/사업계획서/피치덱): 12 slides
53
+ Current year: \${new Date().getFullYear()}.
54
+
55
+ ═══ TITLE & CLOSING FORMAT ═══
56
+ Title slide:
57
+ title: Company/topic name ONLY — max 3-4 words (rendered at 96px)
58
+ ✓ "드림투어" "MediAI" ✗ "MediAI - AI 의료 혁신" (too long)
59
+ content_direction: The actual subtitle/tagline TEXT (1-2 lines, under 120 chars)
60
+ Closing slide:
61
+ title: "감사합니다" (Korean) / "Thank You" (English)
62
+ content_direction: Company/topic name
63
+
64
+ ═══ TOPIC-SPECIFIC TEMPLATES ═══
65
+ PITCH DECK (사업계획서/피치덱): 12 slides
85
66
  title → problem → solution → market size → product(1) → product(2) → business model → competition → traction → team → financials → closing
86
67
 
87
- BUSINESS REPORT (보고서/분석/실적): 10 slides
68
+ MARKETING PROPOSAL (마케팅/제안서): 12 slides
69
+ title → company intro → market analysis → target audience → product/service showcase(1) → product/service showcase(2) → marketing strategy → promotions/pricing → SNS/partnerships → performance KPIs → expected results → closing
70
+
71
+ BUSINESS REPORT (보고서/실적): 10 slides
88
72
  title → executive summary → key metrics → analysis → comparison → spotlight → breakdown → action plan → recommendations → closing
89
73
 
90
- TRAINING (교육/세미나/강의): 10 slides
74
+ TRAINING (교육/세미나): 10 slides
91
75
  title → objectives → core concepts → key data → process → details → case study → summary → key takeaway → closing
92
76
 
93
- PRODUCT LAUNCH (제품/출시/소개): 11 slides
77
+ PRODUCT LAUNCH (제품/출시): 11 slides
94
78
  title → market need → overview → key feature → features → metrics → use cases → pricing → timeline → CTA → closing
95
79
 
96
- GENERAL (발표/프레젠테이션): 10 slides
80
+ GENERAL: 10 slides
97
81
  title → overview → key points → data → detail → spotlight → comparison → process → summary → closing
98
82
 
99
- ═══ THE #1 RULE — ONE VISUAL APPROACH PER SLIDE ═══
100
- ⚠⚠⚠ Each slide's content_direction MUST describe EXACTLY ONE visual layout.
101
- The HTML renderer creates ONE visual element per slide — no more.
102
- If a topic needs 2 visual elements, SPLIT IT INTO 2 SLIDES.
103
-
104
- GOOD content_direction (ONE visual each):
105
- "총매출 1,250억원(전년비 15%↑), 영업이익 180억원(14.4%), 순이익 120억원. Layout: bar chart"
106
- "Comparison table: 4 rows × 3 columns. Highlight MediAI row. Layout: comparison table"
107
- "$45B 시장 규모, 28% 연평균 성장률, 5% 1년 내 점유율 목표. Layout: big numbers"
108
- ✓ "데이터 수집 전처리 AI 분석 결과 리포트 의사 확인. Layout: process flow"
109
- ✓ "매출 구성: 구독형 45%, 라이선스 30%, 컨설팅 25%. Layout: donut chart"
110
- "목표 달성률: 매출 92%, 고객 확보 87%, 시장점유율 73%, 만족도 95%. Layout: progress bars"
111
-
112
- BAD content_direction (MULTIPLE visuals = OVERFLOW):
113
- "테이블로 수익 모델 + 수익 그래프 + 파트너십 + 라이선싱" ← 4 sections!
114
- "원형 차트 + 투자 조건 테이블 + 단계적 계획 + 바 차트" ← 4 sections!
115
-
116
- ═══ SPLITTING DENSE TOPICS INTO MULTIPLE SLIDES ═══
117
- If a user topic has 4+ sub-items, you MUST split it into 2 slides:
118
- "비즈니스모델" "수익 모델" (pricing table) + "수익 성장 전망" (bar chart)
119
- "시장분석" "시장 규모" (3 big metrics) + "고객 세분화" (pie chart or cards)
120
- "투자조건" "투자 조건" (table) + "자금 사용 계획" (pie or bar chart)
121
- "경쟁우위" "경쟁사 비교" (comparison table) + "핵심 차별화" (3 card grid)
122
- "경쟁분석" "경쟁사 비교" (comparison table ONLY) + "SWOT 분석" (2×2 grid ONLY)
123
- "AI 솔루션" "핵심 기능" (3 card grid) + "진단 프로세스" (process flow)
124
- • "제품/플랫폼" → "핵심 기능" (3 card grid with feature descriptions)
125
- • "마케팅/GTM 전략" → "마케팅 채널 전략" (3 cards) + "성과 지표" (metrics or table)
126
- • "로드맵" → "단기 로드맵" (3 milestone cards) + "장기 비전" (3 milestone cards)
127
- • "팀 소개" (4+ members) → "창업진 소개" (2-3 people) + "핵심 팀원" (2-3 people)
128
-
129
- ═══ CONTENT DENSITY — FILL THE SLIDE ═══
130
- ⚠⚠⚠ Each slide is 1920×1080px. Content MUST fill 85-95% of vertical space. EMPTY slides = FAILURE.
131
- ⚠ content_direction MUST contain 6-10 sentences of ACTUAL DATA and details.
132
- ⚠ Each item: title + 3-5 detailed bullets with specific numbers, names, and descriptions.
133
- ⚠ Tables: 4-5 data rows × 3-4 columns for rich comparison. Fill EVERY cell with real data. Column headers MUST be descriptive — NEVER generic "Column 1".
134
- ⚠ Timeline/Roadmap: 3 milestones (MAX 3) with dates, descriptions, and key metrics.
135
- ⚠ Process/Flow: 3-4 steps (MAX 4) — each step with short title + concise description.
136
- ⚠ Data/metrics: 3-4 big numbers with trend indicators AND supporting context text below each.
137
- ⚠ Cards: 3-4 cards, each with a title + 3-4 bullet points + a summary sentence.
138
- ⚠ Donut/Pie charts: include 4-5 segments with labels + a summary box below the chart.
139
- ⚠ The more SPECIFIC DATA you include in content_direction, the better the slide will look.
140
-
141
- ═══ content_direction QUALITY RULES ═══
142
- ⚠ content_direction = REAL CONTENT the viewer will read. NOT layout instructions.
143
- Include: specific numbers, names, descriptions, bullet point text, table data.
144
- MUST be DETAILED — 6-10 sentences with specific data. Sparse directions produce empty slides.
145
- Each item/card/row MUST include: title + 3-4 supporting details with specific data.
146
- Optionally end with ONE short layout hint (e.g., "Layout: 3-column cards" or "Layout: comparison table").
147
-
148
- ✓ GOOD: "총매출 1,250억원(전년비 15%↑), 영업이익 180억원(14.4%), 순이익 95억원(7.6%). 사업부별: 클라우드 45%(562억), AI솔루션 30%(375억), 컨설팅 25%(312억). 클라우드가 전년비 32% 성장하며 최대 성장 동력. Layout: bar chart"
149
- ✓ GOOD: "3 core services: (1) 클라우드 인프라 — 하이브리드 클라우드 구축, AWS/Azure 호환, 99.9% SLA 보장, 50+ 기업 고객 (2) AI 솔루션 — 자연어처리/영상분석, 진단 정확도 98.2%, 월 100만건 처리 (3) 컨설팅 — 디지털 전환 자문, 평균 ROI 250%, 12개월 효과. Layout: 3-column cards"
150
- ✗ BAD: "클라우드, AI, 컨설팅 3개 서비스" ← Too sparse!
151
- ✗ BAD: "왼쪽에 개요 텍스트, 오른쪽에 카드" ← Layout instruction, NOT content!
152
- ✗ BAD: "#accent_light 배경, #primary 글씨" ← CSS instruction, NOT content!
83
+ ═══ content_direction = THE #1 PRIORITY ═══
84
+ ⚠⚠⚠ content_direction is the REAL DATA AND TEXT that will appear on the slide.
85
+ Each content_direction MUST be 6-10 sentences of SPECIFIC DATA:
86
+ - Include: numbers, percentages, names, descriptions, dates, comparisons
87
+ - The MORE specific data you provide, the better the slide will look
88
+ - Each item/section: title + 3-4 supporting details with real numbers
89
+ content_direction MUST describe ONE focused topic per slide.
90
+ If a topic has 4+ sub-items, SPLIT into 2 slides.
91
+ NEVER include layout/CSS instructions in content_direction. Just the DATA.
92
+ GOOD: "한국인 유럽 여행객은 연평균 31% 성장. 2022년 180만 명, 2023년 240만 명, 2024년 310만 명. 2027년 시장 규모 7.2조 원 전망. 코로나19 이후 회복세, 유로화 약세, 직항 노선 확대가 수요 증가를 견인하고 있다."
93
+ GOOD: "베스트셀러 1번 상품: 드림 유로피안 클래식 - 프랑스·스위스·이탈리아 3국 10일 코스. 1인 349만원(세금 포함). 4성급 호텔 9박, 매일 조식+7회 식사 포함. 주요 일정: Day 1-3 파리(에펠탑, 루브르, 센 강 유람선), Day 4-5 스위스(융프라우요하 등반, 열차), Day 6-9 이탈리아(로마 콜로세움, 피렌체, 베네치아), Day 10 귀국."
94
+ BAD: "3개 서비스 소개. Layout: cards" Too sparse, has layout hint!
95
+ ✗ BAD: "왼쪽에 텍스트, 오른쪽에 차트" ← Layout instruction!
96
+
97
+ ═══ SLIDE CONTENT VARIETY ═══
98
+ Each slide's content should naturally suggest a DIFFERENT visual treatment.
99
+ Vary what you write about across slides:
100
+ - Some slides: key metrics/numbers (naturally displayed as large metric spotlights)
101
+ - Some slides: comparison data (naturally shown as tables or side-by-side)
102
+ - Some slides: step-by-step processes (naturally shown as flows)
103
+ - Some slides: category breakdowns (naturally shown as charts or card grids)
104
+ - Some slides: timeline/roadmap items (naturally shown as milestone sequences)
105
+ - Some slides: detailed feature descriptions (naturally shown as rich cards)
106
+ Don't make every slide a list of items. Mix data-heavy slides with narrative slides.
107
+ AVOID having 3+ consecutive slides with the same content structure (e.g., all lists of 3-4 items).
153
108
 
154
109
  ═══ OVERVIEW / AGENDA SLIDES ═══
155
- ⚠ Overview/agenda slides: MAXIMUM 5 items. Numbered list (1-5) or compact 2-column grid.
156
- Each item: short title (2-3 words) + 1-line description only.
157
- If 10+ sections, group related topics: "시장 및 경쟁" instead of separate "시장 분석" + "경쟁 분석".
158
-
159
- ═══ LAYOUT VARIETY — MANDATORY ═══
160
- ⚠⚠⚠ You MUST vary the visual approach. No more than 2 slides with the same layout hint.
161
- Available layouts (use at least 5 different types across the presentation):
162
- - "2×2 grid": 4 cards in 2 rows × 2 columns (MAX 2 slides)
163
- - "bar chart": CSS vertical/horizontal bars showing data trends
164
- - "donut chart": conic-gradient pie/donut with metric labels
165
- - "comparison table": styled table with 3-4 rows, colored headers
166
- - "process flow": horizontal step boxes connected by arrows (→)
167
- - "big numbers": 2-3 large metric spotlights (72-96px) with trend indicators
168
- - "2-column split": left panel + right content
169
- - "timeline": 3-4 milestone steps horizontal with dates
170
- - "progress bars": horizontal bars showing completion percentages
171
- - "hero stat": one large central metric with supporting context
172
- ⚠ Each content_direction MUST end with a "Layout:" hint specifying the visual type.
173
- ⚠ If your plan has 3+ slides all using "cards/grid" layout, REWRITE to use charts, tables, flows instead.
174
- ⚠ A 10-slide deck MUST have: at least 2 chart/data-viz slides, at least 1 table slide, at least 1 process/flow slide.
175
- ⚠ NEVER plan a presentation where every slide is cards — that is LAZY and BORING.
110
+ ⚠ Overview slides: MAXIMUM 5 items, numbered list with short titles + 1-line descriptions.
111
+ If 10+ sections, group related topics.
176
112
 
177
113
  ═══ HARD RULES ═══
178
- ⚠ First slide MUST be type "title"
179
- ⚠ Last slide MUST be type "closing" with "감사합니다"/"Thank You" as title
180
114
  ⚠ ALL titles and content_direction MUST be in the SAME language as the user's instruction
181
- ⚠ content_direction: MUST contain ACTUAL TEXT/DATA. Layout hint is optional at the END.
182
- content_direction that is ONLY layout/visual instructions (no real data) = FAILURE.
183
- HARD MAXIMUM: 13 slides total. Slides beyond 13 are DISCARDED by the system.
184
- Each slide's content_direction must be unique and substantive no generic placeholders
185
- ⚠ NEVER use "스크린샷", "screenshot", "이미지", "사진", "placeholder", "[내용]" in content_direction
186
- Do NOT create a separate "연락처"/"Contact" slide — the closing slide already handles this.
187
-
188
- Output ONLY the JSON object. No preamble, no markdown fences, no explanation.`;
115
+ ⚠ content_direction with NO real data = FAILURE
116
+ HARD MAXIMUM: 13 slides. Slides beyond 13 are DISCARDED.
117
+ NEVER use "스크린샷", "screenshot", "이미지", "사진", "placeholder" in content_direction
118
+ Do NOT create a separate "연락처" slideclosing handles this.
119
+
120
+ Output ONLY the JSON object.`;
189
121
  export function extractLayoutHint(contentDirection) {
190
122
  const match = contentDirection.match(/Layout:\s*(.+?)$/im);
191
123
  if (!match)
@@ -334,27 +266,117 @@ ${layoutCss}
334
266
 
335
267
  Output the complete HTML now.`;
336
268
  }
337
- export function validateSlideHtml(html, layoutType) {
269
+ export function buildFreeHtmlPrompt(title, contentDirection, design, slideIndex, totalSlides, language) {
270
+ const langRule = language === 'ko'
271
+ ? 'ALL visible text MUST be in Korean. Write naturally in Korean. Never use Chinese characters (漢字).'
272
+ : 'ALL visible text MUST be in English.';
273
+ const variants = [
274
+ `Background: ${design.background_color}. Elements use white background with box-shadow.`,
275
+ `Top accent bar (height:4px, linear-gradient(90deg, ${design.accent_color}, ${design.primary_color})). Background: ${design.background_color}.`,
276
+ `Subtle gradient background: linear-gradient(150deg, ${design.background_color} 0%, ${design.accent_light}40 100%). Stronger shadows.`,
277
+ ];
278
+ const styleGuide = variants[slideIndex % variants.length];
279
+ return `You are a world-class presentation designer. Create ONE slide as a complete HTML page.
280
+ Output ONLY the complete HTML (<!DOCTYPE html> to </html>). No explanation, no markdown fences.
281
+
282
+ ═══ SLIDE ${slideIndex + 1} OF ${totalSlides} ═══
283
+ Title: "${title}"
284
+
285
+ ═══ CONTENT TO VISUALIZE ═══
286
+ ${contentDirection}
287
+
288
+ ═══ DESIGN SYSTEM ═══
289
+ Primary: ${design.primary_color} | Accent: ${design.accent_color} | BG: ${design.background_color}
290
+ Text: ${design.text_color} | Light: ${design.accent_light} | Gradient: ${design.gradient_end}
291
+ Title Font: ${design.font_title} | Body Font: ${design.font_body} | Mood: ${design.mood}
292
+
293
+ ═══ STYLE FOR THIS SLIDE ═══
294
+ ${styleGuide}
295
+
296
+ ═══ YOUR CREATIVE MISSION ═══
297
+ Design the BEST possible visual layout for THIS specific content.
298
+ Think like a professional designer: what visual structure best communicates this information?
299
+
300
+ You have FULL CREATIVE FREEDOM. Choose the most appropriate visual approach:
301
+ • Card grids (2×2, 1×3, 1×4) with icons, stats, bullet details
302
+ • Styled data tables (<table>) with colored headers and alternating rows
303
+ • CSS bar charts: vertical bars using flex-end alignment + height percentages
304
+ • Donut/pie charts: conic-gradient on border-radius:50% elements
305
+ • Horizontal progress bars with labeled tracks and percentage fills
306
+ • Step-by-step process flows with numbered circles + arrow (→) connectors
307
+ • Timeline layouts with dated milestone cards in a horizontal row
308
+ • Dashboard panels: 2-3 large metric spotlights (80-100px numbers)
309
+ • 2-column split: left summary/data + right detailed content or bullets
310
+ • Feature showcases with emoji/icon badges
311
+ • Itinerary/schedule: day-by-day breakdown with locations and activities
312
+ • Ranking/leaderboard: ordered items with visual indicators
313
+ • Comparison matrices: side-by-side analysis with visual scoring
314
+ • SWOT or quadrant grids for strategic analysis
315
+ • Package/pricing comparison: side-by-side product cards with highlights
316
+ • Any OTHER CSS-only visual that serves the content perfectly
317
+
318
+ ⚠ Choose the layout that BEST fits THIS content. A travel itinerary needs a schedule layout, not a pie chart. Financial data needs charts/tables, not icon grids. Be creative and appropriate.
319
+
320
+ ═══ MANDATORY CSS BOILERPLATE (copy into <style>) ═══
321
+ * { margin:0; padding:0; box-sizing:border-box; }
322
+ html, body { width:1920px; height:1080px; overflow:hidden; font-family:"${design.font_body}","${design.font_title}","Segoe UI","Malgun Gothic",Arial,sans-serif; word-break:keep-all; overflow-wrap:break-word; }
323
+ body { display:flex; flex-direction:column; padding:60px 80px; height:1080px; background:${design.background_color}; color:${design.text_color}; font-size:26px; }
324
+
325
+ ═══ HTML STRUCTURE ═══
326
+ body has EXACTLY 2 direct children:
327
+ 1. .slide-title (flex:0 0 auto) — h1 with title + accent bar
328
+ .slide-title h1 { font-size:48px; font-weight:700; color:${design.primary_color}; font-family:"${design.font_title}","Segoe UI",sans-serif; }
329
+ Below h1: <div style="width:80px;height:3px;background:${design.accent_color};border-radius:2px;margin-top:12px"></div>
330
+ 2. .content (flex:1) — stretches to fill ALL remaining vertical space
331
+ ⚠ .content class name is REQUIRED.
332
+ ⚠ ALL layout elements MUST be DIRECT children of .content — no wrapper divs.
333
+
334
+ ═══ DESIGN RULES ═══
335
+ • ${langRule}
336
+ • Complete HTML: <!DOCTYPE html> through </html>. ALL styling in <style>.
337
+ • NO <img>, NO external resources, NO JavaScript, NO external fonts.
338
+ • System fonts ONLY. CSS for visuals: gradients, shapes, shadows, borders.
339
+ • Title: 48px bold. Body: 26-32px. MINIMUM any visible text: 26px (except page numbers at 12px).
340
+ • ⚠ ABSOLUTELY NO OVERFLOW — content MUST fit within 1080px total height. If you include too much content, the bottom will be CLIPPED and invisible. It is better to have 15% empty space than 1px of clipping. Limit yourself to 5-6 major content sections max.
341
+ • The available height for .content is approximately 900px (1080 - 60px top padding - 60px bottom padding - ~60px title). Design within this constraint.
342
+ • NEVER use position:absolute for layout (ok for page numbers). Use flexbox/grid.
343
+ • NEVER use justify-content:center on .content — it creates dead space. Use stretch/space-evenly.
344
+ • Use gradients, box-shadow (0 4px 20px rgba(0,0,0,0.06)), border-radius (12-20px).
345
+ • Cards/elements: white (#fff) background with subtle shadow on light slides.
346
+ • Table headers: dark background (${design.primary_color}) with white text.
347
+ • Generate REAL professional content from the direction. No placeholders.
348
+ • ⚠ NEVER use bracket placeholders like [Team Name], [Email], [YYYY], [Author]. Instead, INVENT realistic fictional content for ALL fields — names, emails, dates, numbers, etc.
349
+ • If user specified a year, USE THAT YEAR. Default to ${new Date().getFullYear()} only when no year given.
350
+ • Page number: bottom-right "${slideIndex + 1}" (12px, opacity 0.4, position:absolute ok for this).
351
+
352
+ Output the complete HTML now.`;
353
+ }
354
+ export function validateSlideHtml(html, _layoutType) {
338
355
  if (!html.includes('<!DOCTYPE') && !html.includes('<!doctype')) {
339
356
  return { pass: false, feedback: 'Missing <!DOCTYPE html> declaration. Start with <!DOCTYPE html><html>.' };
340
357
  }
341
358
  if (!html.includes('<html') || !html.includes('</html>')) {
342
359
  return { pass: false, feedback: 'Missing <html> or </html> tags. Output must be a complete HTML document.' };
343
360
  }
344
- const layoutFeedback = checkLayoutCompliance(html, layoutType);
345
- if (layoutFeedback) {
346
- return { pass: false, feedback: layoutFeedback };
347
- }
348
361
  if (/<img\s/i.test(html)) {
349
362
  return { pass: false, feedback: 'Forbidden: <img> tags are not allowed. Use CSS gradients, shapes, and backgrounds instead.' };
350
363
  }
351
- if (/position\s*:\s*absolute/i.test(html)) {
352
- return { pass: false, feedback: 'Forbidden: position:absolute is not allowed. Use flexbox or grid for all layout.' };
364
+ if (/<script[\s>]/i.test(html)) {
365
+ return { pass: false, feedback: 'Forbidden: <script> tags are not allowed. This is a static slide no JavaScript.' };
366
+ }
367
+ const absCount = (html.match(/position\s*:\s*absolute/gi) || []).length;
368
+ if (absCount > 6) {
369
+ return { pass: false, feedback: `Too many position:absolute (${absCount}). Use flexbox/grid for main layout.` };
370
+ }
371
+ const externalUrls = html.match(/url\(\s*['"]?https?:\/\//gi) || [];
372
+ if (externalUrls.length > 0) {
373
+ return { pass: false, feedback: 'Forbidden: External URLs detected in CSS url(). No external resources allowed.' };
353
374
  }
354
- if (/https?:\/\/(?!.*$)/i.test(html) && !/https?:\/\/[^"')\s]*\.(nip\.io|localhost)/i.test(html)) {
355
- const externalUrls = html.match(/url\(\s*['"]?https?:\/\//gi) || [];
356
- if (externalUrls.length > 0) {
357
- return { pass: false, feedback: 'Forbidden: External URLs detected in CSS url(). No external resources allowed.' };
375
+ const scaleMatches = html.match(/transform\s*:[^;]*scale\(\s*([\d.]+)/gi) || [];
376
+ for (const m of scaleMatches) {
377
+ const val = parseFloat(m.replace(/.*scale\(\s*/i, ''));
378
+ if (val > 0 && val < 0.9) {
379
+ return { pass: false, feedback: `Forbidden: transform:scale(${val}) shrinks content. Use full 1920×1080 layout without scaling.` };
358
380
  }
359
381
  }
360
382
  const placeholderPatterns = [
@@ -364,33 +386,40 @@ export function validateSlideHtml(html, layoutType) {
364
386
  /Display value \(e\.g\./i,
365
387
  /1-2 sentence key insight/i,
366
388
  /Category name/i,
367
- /Another detail/i,
368
- /Third point/i,
369
- /Fourth point/i,
370
- /Brief context/i,
371
389
  /Segment name/i,
390
+ /Lorem ipsum/i,
391
+ /\[placeholder\]/i,
392
+ /\[내용\]/i,
393
+ /\[.{2,20}을\s*입력/i,
394
+ /\[YYYY/i,
395
+ /\[이메일/i,
396
+ /\[작성자/i,
397
+ /\[직급/i,
398
+ /\[NNNN\]/i,
399
+ /\[MM월/i,
400
+ /\[담당자\s*명\]/i,
372
401
  ];
373
402
  for (const pattern of placeholderPatterns) {
374
403
  if (pattern.test(html)) {
375
- return { pass: false, feedback: `Placeholder text detected: "${pattern.source}". Generate REAL content, not schema examples.` };
404
+ return { pass: false, feedback: `Placeholder text detected: "${pattern.source}". Generate REAL content.` };
376
405
  }
377
406
  }
378
407
  const textElements = (html.match(/<(p|li|td|th|span|div|h[1-6])[^>]*>[^<]{2,}/gi) || []).length;
379
408
  if (textElements < 5) {
380
- return { pass: false, feedback: `Low content density: only ${textElements} text elements found. Need at least 5 text-bearing elements for a complete slide.` };
409
+ return { pass: false, feedback: `Low content density: only ${textElements} text elements. Need at least 5.` };
381
410
  }
382
411
  const visibleText = html.replace(/<style[\s\S]*?<\/style>/gi, '')
383
412
  .replace(/<[^>]+>/g, ' ')
384
413
  .replace(/\s+/g, ' ')
385
414
  .trim();
386
- if (visibleText.length > 3000) {
387
- return { pass: false, feedback: `Content overflow risk: ${visibleText.length} chars of visible text. Reduce to under 3000 chars to prevent overflow on 1920×1080.` };
415
+ if (visibleText.length > 1500) {
416
+ return { pass: false, feedback: `Content overflow risk: ${visibleText.length} chars of visible text. Reduce to under 1500 chars. Remove 1-2 sections or shorten text to prevent bottom clipping.` };
388
417
  }
389
418
  const smallFonts = html.match(/font-size\s*:\s*(\d+)px/gi) || [];
390
419
  for (const match of smallFonts) {
391
420
  const size = parseInt(match.replace(/[^0-9]/g, ''), 10);
392
- if (size > 0 && size < 18 && size !== 12) {
393
- return { pass: false, feedback: `Font too small: found font-size:${size}px. Minimum allowed is 18px (except 12px for page numbers). Increase font size or reduce content.` };
421
+ if (size > 0 && size < 20 && size > 13) {
422
+ return { pass: false, feedback: `Font too small: found font-size:${size}px. Minimum allowed is 20px (except 12-13px for page numbers). Increase font size or reduce content.` };
394
423
  }
395
424
  }
396
425
  return { pass: true, feedback: '' };
@@ -531,64 +560,64 @@ export function buildContentFillJsonPrompt(slideTitle, contentDirection, layoutT
531
560
  const schemas = {
532
561
  cards: `{
533
562
  "cards": [
534
- { "icon": "single emoji", "title": "Card title (2-5 words)", "bullets": ["Detail with number/data", "Another detail", "Third point", "Fourth point"], "stat": "Key metric (e.g., 97.8% 정확도)" }
563
+ { "icon": "single emoji", "title": "Short card title (2-5 words)", "bullets": ["Detail with data", "Another detail", "Third point"], "stat": "Key metric with number" }
535
564
  ]
536
565
  }
537
- RULES: 3-4 cards. Each: icon + title + 4-5 bullets with specific data + stat.`,
566
+ RULES: 3-4 cards. Each: icon + title + 3 bullets (MAX 3, keep each under 25 chars) + stat.`,
538
567
  bar_chart: `{
539
568
  "bars": [
540
- { "label": "Category name", "value": "Display value (e.g. 1,250억원)", "height": 85 }
569
+ { "label": "Category name (under 15 chars)", "value": "Number with unit", "height": 85 }
541
570
  ],
542
571
  "insight": "1-2 sentence key insight about the data"
543
572
  }
544
- RULES: 4-6 bars. height: 10-90 (tallest=85, others proportional). Values with units.`,
573
+ RULES: 4-5 bars (MAX 5). height: 10-90 (tallest=85, others proportional). Values must include units.`,
545
574
  donut_chart: `{
546
575
  "segments": [
547
- { "label": "Segment name", "value": "Display value (e.g. 562억원)", "percent": 45 }
576
+ { "label": "Segment name", "value": "Number with unit", "percent": 45 }
548
577
  ],
549
- "centerText": "Center label (e.g. 총 1,250억원)",
578
+ "centerText": "Total or summary label",
550
579
  "summary": "1-2 sentence summary"
551
580
  }
552
581
  RULES: 3-5 segments. Percents MUST sum to exactly 100.`,
553
582
  table: `{
554
- "headers": ["Company Name", "Market Share", "Key Strength", "Accuracy"],
555
- "rows": [["data", "data", "data", "data"]],
583
+ "headers": ["Descriptive column name", "Another column", "Third column", "Fourth column"],
584
+ "rows": [["real data", "real data", "real data", "real data"]],
556
585
  "highlightRow": 0,
557
586
  "summary": "1-2 sentence summary"
558
587
  }
559
- RULES: 3-4 columns. 4-5 rows. ALL cells real data. highlightRow: 0-indexed or null.
560
- ⚠ headers MUST be meaningful column names describing the data — NEVER use generic "Column 1", "Column 2" etc.`,
588
+ RULES: 3-4 columns. 4-5 rows. ALL cells must contain real data. highlightRow: 0-indexed or null.
589
+ ⚠ headers MUST be meaningful column names — NEVER use generic "Column 1", "Column 2".`,
561
590
  process_flow: `{
562
591
  "steps": [
563
- { "title": "Step name (2-4 words)", "desc": "2-3 sentence description with details", "detail": "Duration or metric" }
592
+ { "title": "Step name (2-4 words)", "desc": "2-3 sentence description with specific details", "detail": "Duration or key metric" }
564
593
  ]
565
594
  }
566
595
  RULES: 3-4 steps (MAX 4). Each: title + detailed description + time/metric.`,
567
596
  big_numbers: `{
568
597
  "metrics": [
569
- { "value": "1,250", "unit": "억원", "label": "Metric Name", "desc": "1-2 sentence context", "trend": "▲ 15%", "positive": true }
598
+ { "value": "Number only", "unit": "Unit text", "label": "Metric name", "desc": "1-2 sentence context", "trend": "▲ or ▼ + percentage", "positive": true }
570
599
  ]
571
600
  }
572
- RULES: 2-3 metrics. value=number only, unit=separate. trend: ▲/▼ + percentage.`,
601
+ RULES: 2-3 metrics. value=number only, unit=separate field. trend: ▲/▼ + percentage.`,
573
602
  timeline: `{
574
603
  "milestones": [
575
- { "date": "2026 Q1", "title": "Milestone name", "desc": "2-3 sentence description", "kpi": "Target metric" }
604
+ { "date": "Date or period", "title": "Milestone name", "desc": "2-3 sentence description", "kpi": "Target metric" }
576
605
  ]
577
606
  }
578
607
  RULES: 3 milestones (MAX 3). Each with date, description, and KPI target.`,
579
608
  progress_bars: `{
580
609
  "bars": [
581
- { "label": "Category name", "value": "Display (e.g. 92%)", "percent": 92, "detail": "Brief context" }
610
+ { "label": "Category name", "value": "Display value with unit", "percent": 75, "detail": "Brief context" }
582
611
  ]
583
612
  }
584
613
  RULES: 4-6 bars. percent: 5-100. Include context detail for each.`,
585
614
  hero_stat: `{
586
- "number": "97.8",
587
- "unit": "%",
588
- "label": "Metric Name",
615
+ "number": "The big number",
616
+ "unit": "Unit or symbol",
617
+ "label": "What this number measures",
589
618
  "context": "2-3 sentence context explaining significance",
590
619
  "supporting": [
591
- { "value": "45개국", "label": "Supporting metric name" }
620
+ { "value": "Number with unit", "label": "Supporting metric name" }
592
621
  ]
593
622
  }
594
623
  RULES: 1 hero number + context + 2-3 supporting metrics.`,
@@ -600,7 +629,7 @@ RULES: 1 hero number + context + 2-3 supporting metrics.`,
600
629
  "rightTitle": "Right column heading",
601
630
  "rightBullets": ["Detailed bullet point with data"]
602
631
  }
603
- RULES: Left: 3-4 key-value items. Right: 3-4 detailed bullets. Keep each bullet under 30 chars.`,
632
+ RULES: Left: 3-4 key-value items with REAL data. Right: 3-4 detailed bullets with REAL data. Keep each bullet under 30 chars.`,
604
633
  };
605
634
  return `Extract content from the direction below and output ONLY valid JSON.
606
635
  Do NOT output markdown fences, explanations, or anything besides the JSON object.
@@ -646,6 +675,19 @@ export function parseContentFillJson(raw, layoutType) {
646
675
  }
647
676
  if (!parsed)
648
677
  return null;
678
+ const jsonStr = JSON.stringify(parsed);
679
+ const ellipsisMatches = jsonStr.match(/"\.\.\."|\u2026/g) || [];
680
+ const totalStringValues = jsonStr.match(/"[^"]+"/g) || [];
681
+ if (ellipsisMatches.length > 0 && totalStringValues.length > 0) {
682
+ const ellipsisRatio = ellipsisMatches.length / totalStringValues.length;
683
+ if (ellipsisRatio > 0.3) {
684
+ return null;
685
+ }
686
+ }
687
+ const stringLiteralMatches = jsonStr.match(/"string"/g) || [];
688
+ if (stringLiteralMatches.length >= 2) {
689
+ return null;
690
+ }
649
691
  switch (layoutType) {
650
692
  case 'cards':
651
693
  if (!Array.isArray(parsed['cards']) || parsed['cards'].length === 0)
@@ -686,8 +728,15 @@ export function parseContentFillJson(raw, layoutType) {
686
728
  case 'two_col_split':
687
729
  if (!parsed['leftTitle'] && !parsed['rightTitle'])
688
730
  return null;
731
+ if (!Array.isArray(parsed['leftItems']) || parsed['leftItems'].length === 0)
732
+ return null;
733
+ if (!Array.isArray(parsed['rightBullets']) || parsed['rightBullets'].length === 0)
734
+ return null;
689
735
  break;
690
736
  }
737
+ const allText = JSON.stringify(parsed).replace(/[{}\[\]",:]/g, '').trim();
738
+ if (allText.length < 50)
739
+ return null;
691
740
  return parsed;
692
741
  }
693
742
  function getCardTextColor(design) {
@@ -738,21 +787,21 @@ function buildCardsContent(design, data) {
738
787
  const cols = n <= 3 ? `repeat(${n},1fr)` : '1fr 1fr';
739
788
  const is2x2 = n === 4;
740
789
  const gridExtra = is2x2 ? 'grid-template-rows:1fr 1fr' : 'grid-template-rows:1fr';
741
- const cardPad = is2x2 ? '28px 24px' : '36px 32px';
742
- const cardGap = is2x2 ? '10px' : '14px';
743
- const h2Size = is2x2 ? '32px' : '34px';
744
- const liSize = is2x2 ? '26px' : '28px';
745
- const liMargin = is2x2 ? '8px' : '12px';
790
+ const cardPad = is2x2 ? '28px 24px' : '48px 36px';
791
+ const cardGap = is2x2 ? '10px' : '16px';
792
+ const h2Size = is2x2 ? '32px' : '40px';
793
+ const liSize = is2x2 ? '26px' : '30px';
794
+ const liMargin = is2x2 ? '8px' : '14px';
746
795
  const cardText = getCardTextColor(design);
747
796
  const css = `.content{flex:1;display:grid;grid-template-columns:${cols};${gridExtra};gap:24px}
748
797
  .card{background:#fff;border-radius:16px;padding:${cardPad};box-shadow:0 4px 20px rgba(0,0,0,0.06);display:flex;flex-direction:column;gap:${cardGap};overflow:hidden;color:${cardText}}
749
798
  .card-icon{font-size:36px;line-height:1}
750
799
  .card h2{font-size:${h2Size};font-weight:700;color:${design.primary_color}}
751
- .card ul{list-style:none;flex:1}
800
+ .card ul{list-style:none;flex:1;display:flex;flex-direction:column;justify-content:center}
752
801
  .card li{margin-bottom:${liMargin};padding-left:22px;position:relative;font-size:${liSize};line-height:1.4}
753
802
  .card li::before{content:"•";color:${design.accent_color};position:absolute;left:0;font-weight:bold}
754
803
  .card-stat{margin-top:auto;padding-top:12px;border-top:2px solid ${design.accent_light};font-size:24px;font-weight:600;color:${design.accent_color}}`;
755
- const maxBullets = n <= 3 ? 5 : 3;
804
+ const maxBullets = 3;
756
805
  const cards = (data.cards || []).slice(0, 4).map(c => `
757
806
  <div class="card">
758
807
  <div class="card-icon">${c.icon || '📌'}</div>
@@ -773,7 +822,7 @@ function buildBarChartContent(design, data) {
773
822
  .bar-label{font-size:24px;font-weight:600;color:${design.text_color};text-align:center;min-width:120px;word-break:keep-all;padding:12px 0;flex-shrink:0}
774
823
  .insight-row{padding:20px 60px;background:${design.accent_light};border-radius:12px;margin-top:16px;font-size:26px;color:${cardText};line-height:1.5;flex-shrink:0}`;
775
824
  const maxH = Math.max(...(data.bars || []).map(b => b.height || 50), 1);
776
- const bars = (data.bars || []).slice(0, 6).map(b => {
825
+ const bars = (data.bars || []).slice(0, 5).map(b => {
777
826
  const normalized = Math.max(8, Math.round(((b.height || 50) / maxH) * 85));
778
827
  return `
779
828
  <div class="bar-group">
@@ -802,16 +851,16 @@ function buildDonutChartContent(design, data) {
802
851
  cumPct += pct;
803
852
  return `${segColors[i % segColors.length]} ${start.toFixed(1)}% ${cumPct.toFixed(1)}%`;
804
853
  }).join(',');
805
- const css = `.content{flex:1;display:grid;grid-template-columns:1.2fr 1fr;gap:40px;align-items:center;align-content:center}
854
+ const css = `.content{flex:1;display:grid;grid-template-columns:1.2fr 1fr;gap:40px;align-items:center;align-content:center;padding:0}
806
855
  .donut-wrap{display:flex;justify-content:center;align-items:center}
807
- .donut{width:500px;height:500px;border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 8px 32px rgba(0,0,0,0.08)}
808
- .donut-hole{width:240px;height:240px;border-radius:50%;background:${design.background_color};display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px}
809
- .donut-center{font-size:30px;font-weight:800;color:${design.primary_color};text-align:center;line-height:1.3}
810
- .legend{display:flex;flex-direction:column;gap:28px}
811
- .legend-item{display:flex;align-items:center;gap:16px;font-size:28px;padding:12px 16px;background:#fff;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,0.04);color:${getCardTextColor(design)}}
856
+ .donut{width:600px;height:600px;border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 8px 32px rgba(0,0,0,0.08)}
857
+ .donut-hole{width:290px;height:290px;border-radius:50%;background:${design.background_color};display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px}
858
+ .donut-center{font-size:34px;font-weight:800;color:${design.primary_color};text-align:center;line-height:1.3}
859
+ .legend{display:flex;flex-direction:column;gap:24px}
860
+ .legend-item{display:flex;align-items:center;gap:16px;font-size:28px;padding:14px 18px;background:#fff;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,0.04);color:${getCardTextColor(design)}}
812
861
  .legend-dot{width:24px;height:24px;border-radius:50%;flex-shrink:0}
813
862
  .legend-value{font-weight:700;color:${design.primary_color};margin-left:auto;white-space:nowrap}
814
- .chart-summary{grid-column:1/3;padding:16px 24px;background:${design.accent_light};border-radius:12px;font-size:26px;color:${getCardTextColor(design)};line-height:1.5}`;
863
+ .chart-summary{padding:16px 20px;background:${design.accent_light};border-radius:12px;font-size:24px;color:${getCardTextColor(design)};line-height:1.5;margin-top:8px}`;
815
864
  const legendHtml = segs.map((s, i) => `
816
865
  <div class="legend-item">
817
866
  <div class="legend-dot" style="background:${segColors[i % segColors.length]}"></div>
@@ -826,26 +875,27 @@ function buildDonutChartContent(design, data) {
826
875
  <div class="donut-hole"><div class="donut-center">${escapeHtmlTemplate(data.centerText || '')}</div></div>
827
876
  </div>
828
877
  </div>
829
- <div class="legend">${legendHtml}</div>
830
- ${data.summary ? `<div class="chart-summary">${escapeHtmlTemplate(data.summary)}</div>` : ''}
878
+ <div class="legend">${legendHtml}
879
+ ${data.summary ? `<div class="chart-summary">${escapeHtmlTemplate(data.summary)}</div>` : ''}
880
+ </div>
831
881
  </div>`,
832
882
  };
833
883
  }
834
884
  function buildTableContent(design, data) {
835
885
  const cardText = getCardTextColor(design);
836
- const css = `.content{flex:1;display:flex;flex-direction:column}
837
- .data-table{width:100%;border-collapse:collapse;background:#fff;box-shadow:0 4px 12px rgba(0,0,0,0.05);flex:1}
838
- .data-table th{background:${design.primary_color};color:#fff;font-size:28px;text-align:left;padding:22px 28px;font-weight:700}
839
- .data-table td{font-size:28px;color:${cardText};padding:22px 28px;border-bottom:1px solid ${design.accent_light}}
886
+ const maxCols = Math.min((data.headers || []).length, 4);
887
+ const css = `.content{flex:1;display:flex;flex-direction:column;justify-content:center}
888
+ .data-table{width:100%;border-collapse:collapse;background:#fff;box-shadow:0 4px 12px rgba(0,0,0,0.05);border-radius:12px;overflow:hidden;table-layout:fixed}
889
+ .data-table th{background:${design.primary_color};color:#fff;font-size:28px;text-align:left;padding:22px 28px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
890
+ .data-table td{font-size:28px;color:${cardText};padding:22px 28px;border-bottom:1px solid ${design.accent_light};overflow:hidden;word-break:break-word}
840
891
  .data-table tr:last-child td{border-bottom:none}
841
892
  .data-table tr:nth-child(even){background:${design.accent_light}20}
842
893
  .data-table tr.highlight td{background:${design.accent_color}15;font-weight:600}
843
- .table-summary{margin-top:auto;padding:16px 24px;background:${design.accent_light};border-radius:12px;font-size:26px;color:${cardText};line-height:1.5}`;
844
- const headers = (data.headers || []).slice(0, 4).map(h => `<th>${escapeHtmlTemplate(h)}</th>`).join('');
845
- const maxCols = Math.min((data.headers || []).length, 4);
894
+ .table-summary{margin-top:20px;padding:16px 24px;background:${design.accent_light};border-radius:12px;font-size:26px;color:${cardText};line-height:1.5}`;
895
+ const headers = (data.headers || []).slice(0, maxCols).map(h => `<th>${escapeHtmlTemplate(String(h || '').slice(0, 25))}</th>`).join('');
846
896
  const rows = (data.rows || []).slice(0, 5).map((row, ri) => {
847
897
  const cls = ri === data.highlightRow ? ' class="highlight"' : '';
848
- const cells = (row || []).slice(0, maxCols).map(c => `<td>${escapeHtmlTemplate(String(c || ''))}</td>`).join('');
898
+ const cells = (row || []).slice(0, maxCols).map(c => `<td>${escapeHtmlTemplate(String(c || '').slice(0, 50))}</td>`).join('');
849
899
  return `<tr${cls}>${cells}</tr>`;
850
900
  }).join('\n');
851
901
  return {
@@ -863,19 +913,21 @@ function buildProcessFlowContent(design, data) {
863
913
  const descSz = n <= 3 ? '28px' : '26px';
864
914
  const detailSz = n <= 3 ? '28px' : '26px';
865
915
  const css = `.content{flex:1;display:flex;align-items:stretch;gap:0}
866
- .step{flex:1;display:flex;flex-direction:column;align-items:center;padding:36px 24px;background:#fff;border-radius:16px;text-align:center;gap:16px;box-shadow:0 4px 20px rgba(0,0,0,0.06)}
916
+ .step{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:36px 24px;background:#fff;border-radius:16px;text-align:center;gap:16px;box-shadow:0 4px 20px rgba(0,0,0,0.06)}
867
917
  .step-num{width:52px;height:52px;border-radius:50%;background:linear-gradient(135deg,${design.primary_color},${design.gradient_end});color:#fff;display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:700;flex-shrink:0}
868
918
  .step-title{font-size:${titleSz};font-weight:700;color:${design.primary_color}}
869
- .step-desc{font-size:${descSz};color:${cardText};line-height:1.5;flex:1}
870
- .step-detail{font-size:${detailSz};color:${design.accent_color};font-weight:600;padding-top:14px;border-top:2px solid ${design.accent_color}40;margin-top:auto}
919
+ .step-desc{font-size:${descSz};color:${cardText};line-height:1.5}
920
+ .step-detail{font-size:${detailSz};color:${design.accent_color};font-weight:600;padding-top:14px;border-top:2px solid ${design.accent_color}40}
871
921
  .arrow{width:48px;display:flex;align-items:center;justify-content:center;font-size:40px;color:${design.accent_color};flex-shrink:0}`;
872
922
  const steps = (data.steps || []).slice(0, 4);
923
+ const maxDescLen = n <= 3 ? 120 : 80;
873
924
  const stepsHtml = steps.map((s, i) => {
925
+ const desc = (s.desc || '').slice(0, maxDescLen);
874
926
  const stepDiv = `
875
927
  <div class="step">
876
928
  <div class="step-num">${i + 1}</div>
877
929
  <div class="step-title">${escapeHtmlTemplate(s.title || '')}</div>
878
- <div class="step-desc">${escapeHtmlTemplate(s.desc || '')}</div>
930
+ <div class="step-desc">${escapeHtmlTemplate(desc)}</div>
879
931
  ${s.detail ? `<div class="step-detail">${escapeHtmlTemplate(s.detail)}</div>` : ''}
880
932
  </div>`;
881
933
  return i < steps.length - 1 ? stepDiv + '\n <div class="arrow">→</div>' : stepDiv;
@@ -884,13 +936,13 @@ function buildProcessFlowContent(design, data) {
884
936
  }
885
937
  function buildBigNumbersContent(design, data) {
886
938
  const cardText = getCardTextColor(design);
887
- const css = `.content{flex:1;display:flex;gap:40px;align-items:stretch}
888
- .metric-card{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:48px 32px;border-radius:20px;background:#fff;box-shadow:0 4px 24px rgba(0,0,0,0.06);text-align:center;gap:20px}
889
- .metric-value{font-size:88px;font-weight:800;color:${design.primary_color};line-height:1}
890
- .metric-unit{font-size:34px;font-weight:600;color:${design.accent_color}}
891
- .metric-label{font-size:30px;font-weight:600;color:${cardText}}
892
- .metric-desc{font-size:26px;color:${cardText}aa;line-height:1.5}
893
- .metric-trend{font-size:28px;font-weight:600;margin-top:auto}`;
939
+ const css = `.content{flex:1;display:flex;gap:40px;align-items:center}
940
+ .metric-card{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:56px 36px;border-radius:20px;background:#fff;box-shadow:0 6px 28px rgba(0,0,0,0.08);text-align:center;gap:20px;border-top:4px solid ${design.accent_color}}
941
+ .metric-value{font-size:100px;font-weight:800;color:${design.primary_color};line-height:1}
942
+ .metric-unit{font-size:36px;font-weight:600;color:${design.accent_color}}
943
+ .metric-label{font-size:32px;font-weight:600;color:${cardText}}
944
+ .metric-desc{font-size:26px;color:${cardText}aa;line-height:1.5;max-width:90%}
945
+ .metric-trend{font-size:28px;font-weight:600}`;
894
946
  const metrics = (data.metrics || []).slice(0, 3).map(m => `
895
947
  <div class="metric-card">
896
948
  <div class="metric-value">${escapeHtmlTemplate(m.value || '')}</div>
@@ -902,16 +954,16 @@ function buildBigNumbersContent(design, data) {
902
954
  return { css, html: `<div class="content">${metrics}\n</div>` };
903
955
  }
904
956
  function buildTimelineContent(design, data) {
905
- const titleSz = '38px';
906
- const descSz = '30px';
907
- const kpiSz = '28px';
908
- const pad = '40px 36px';
909
- const css = `.content{flex:1;display:flex;align-items:stretch;gap:20px}
910
- .milestone{flex:1;display:flex;flex-direction:column;padding:${pad};border-radius:16px;background:#fff;box-shadow:0 4px 20px rgba(0,0,0,0.06);gap:16px}
911
- .ms-date{display:inline-block;padding:8px 16px;border-radius:8px;background:${design.primary_color};color:#fff;font-size:24px;font-weight:700;align-self:flex-start}
957
+ const titleSz = '40px';
958
+ const descSz = '32px';
959
+ const kpiSz = '30px';
960
+ const pad = '44px 40px';
961
+ const css = `.content{flex:1;display:flex;align-items:stretch;gap:24px}
962
+ .milestone{flex:1;display:flex;flex-direction:column;justify-content:center;padding:${pad};border-radius:16px;background:#fff;box-shadow:0 4px 20px rgba(0,0,0,0.06);gap:18px}
963
+ .ms-date{display:inline-block;padding:8px 18px;border-radius:8px;background:${design.primary_color};color:#fff;font-size:26px;font-weight:700;align-self:flex-start}
912
964
  .ms-title{font-size:${titleSz};font-weight:700;color:${design.primary_color}}
913
- .ms-desc{font-size:${descSz};color:${getCardTextColor(design)};line-height:1.55;flex:1}
914
- .ms-kpi{font-size:${kpiSz};font-weight:600;color:${design.accent_color};padding-top:16px;border-top:2px solid ${design.accent_light};margin-top:auto}`;
965
+ .ms-desc{font-size:${descSz};color:${getCardTextColor(design)};line-height:1.55}
966
+ .ms-kpi{font-size:${kpiSz};font-weight:600;color:${design.accent_color};padding-top:16px;border-top:2px solid ${design.accent_light}}`;
915
967
  const milestones = (data.milestones || []).slice(0, 3).map((m) => `
916
968
  <div class="milestone">
917
969
  <div class="ms-date">${escapeHtmlTemplate(m.date || '')}</div>
@@ -922,14 +974,18 @@ function buildTimelineContent(design, data) {
922
974
  return { css, html: `<div class="content">${milestones}\n</div>` };
923
975
  }
924
976
  function buildProgressBarsContent(design, data) {
925
- const css = `.content{flex:1;display:flex;flex-direction:column;justify-content:space-evenly;gap:0;padding:20px 0}
977
+ const barCount = Math.min((data.bars || []).length, 6);
978
+ const barGap = barCount >= 5 ? '28px' : '44px';
979
+ const barHeight = barCount >= 5 ? '44px' : '56px';
980
+ const barRadius = barCount >= 5 ? '22px' : '28px';
981
+ const css = `.content{flex:1;display:flex;flex-direction:column;justify-content:center;gap:${barGap};padding:20px 0}
926
982
  .bar-item{display:flex;flex-direction:column;gap:10px}
927
983
  .bar-header{display:flex;justify-content:space-between;align-items:baseline}
928
- .bar-label{font-size:28px;font-weight:600;color:${design.text_color}}
929
- .bar-val{font-size:28px;font-weight:700;color:${design.primary_color}}
930
- .bar-track{width:100%;height:44px;background:${design.accent_light};border-radius:22px;overflow:hidden}
931
- .bar-fill{height:100%;border-radius:22px;background:linear-gradient(90deg,${design.primary_color},${design.accent_color})}
932
- .bar-detail{font-size:22px;color:${design.text_color}88;margin-top:-2px}`;
984
+ .bar-label{font-size:32px;font-weight:600;color:${design.text_color}}
985
+ .bar-val{font-size:32px;font-weight:700;color:${design.primary_color}}
986
+ .bar-track{width:100%;height:${barHeight};background:${design.accent_light};border-radius:${barRadius};overflow:hidden}
987
+ .bar-fill{height:100%;border-radius:${barRadius};background:linear-gradient(90deg,${design.primary_color},${design.accent_color})}
988
+ .bar-detail{font-size:26px;color:${design.text_color}88;margin-top:-2px}`;
933
989
  const bars = (data.bars || []).slice(0, 6).map(b => `
934
990
  <div class="bar-item">
935
991
  <div class="bar-header"><span class="bar-label">${escapeHtmlTemplate(b.label || '')}</span><span class="bar-val">${escapeHtmlTemplate(b.value || '')}</span></div>
@@ -968,11 +1024,11 @@ function buildTwoColSplitContent(design, data) {
968
1024
  const css = `.content{flex:1;display:grid;grid-template-columns:1fr 1fr;gap:40px;align-items:stretch}
969
1025
  .col{display:flex;flex-direction:column;gap:14px;justify-content:space-evenly}
970
1026
  .col h2{font-size:36px;font-weight:700;color:${design.primary_color};margin-bottom:12px;padding-bottom:12px;border-bottom:3px solid ${design.accent_color}}
971
- .kv-item{display:flex;justify-content:space-between;align-items:center;padding:22px 24px;background:#fff;border-radius:12px;box-shadow:0 2px 12px rgba(0,0,0,0.04);font-size:28px;color:${getCardTextColor(design)}}
1027
+ .kv-item{display:flex;justify-content:space-between;align-items:center;padding:28px 28px;background:#fff;border-radius:14px;box-shadow:0 2px 12px rgba(0,0,0,0.04);font-size:30px;color:${getCardTextColor(design)}}
972
1028
  .kv-label{color:${getCardTextColor(design)};font-weight:500}
973
- .kv-value{color:${design.primary_color};font-weight:700;font-size:28px}
974
- .col ul{list-style:none;display:flex;flex-direction:column;gap:10px}
975
- .col li{padding:16px 16px 16px 30px;position:relative;font-size:28px;line-height:1.5;background:#fff;border-radius:10px;box-shadow:0 1px 8px rgba(0,0,0,0.03);color:${getCardTextColor(design)}}
1029
+ .kv-value{color:${design.primary_color};font-weight:700;font-size:30px}
1030
+ .col ul{list-style:none;display:flex;flex-direction:column;gap:12px}
1031
+ .col li{padding:20px 20px 20px 34px;position:relative;font-size:28px;line-height:1.5;background:#fff;border-radius:12px;box-shadow:0 1px 8px rgba(0,0,0,0.03);color:${getCardTextColor(design)}}
976
1032
  .col li::before{content:"•";color:${design.accent_color};position:absolute;left:12px;font-weight:bold}`;
977
1033
  const leftItems = (data.leftItems || []).slice(0, 4).map(item => `
978
1034
  <div class="kv-item"><span class="kv-label">${escapeHtmlTemplate(item.label || '')}</span><span class="kv-value">${escapeHtmlTemplate(item.value || '')}</span></div>`).join('');
@@ -1018,9 +1074,9 @@ CSS:
1018
1074
  .card { display:flex; flex-direction:column; justify-content:flex-start; gap:12px; padding:32px 28px; border-radius:16px; background:#fff; box-shadow:0 4px 20px rgba(0,0,0,0.06); overflow:hidden; }
1019
1075
 
1020
1076
  ⚠ grid-template-rows:1fr 1fr is CRITICAL — it forces cards to stretch and fill vertical space. Without it, cards collapse to content height leaving huge empty bottom.
1021
- • MAX 4 cards (2×2). Each: icon/badge + title (32-40px) + 4-5 bullets (26px) with specific data + stat/metric at bottom.
1077
+ • MAX 4 cards (2×2). Each: icon/badge + title (32-40px) + 3 bullets (26px, MAX 3 per card, each under 25 chars) + stat/metric at bottom.
1022
1078
  • If only 3 items: grid-template-columns:1fr 1fr 1fr; grid-template-rows:1fr; (all 3 in one row)
1023
- • MINIMUM CARD CONTENT: title + 4-5 detailed bullet points with numbers/data + bottom metric. A card with only 2 bullets = FAILURE.
1079
+ • MINIMUM CARD CONTENT: title + 3 bullet points with numbers/data + bottom metric. A card with only 1 bullet = FAILURE.
1024
1080
  • Card bottom stat: use margin-top:auto to push it to card bottom, creating visual anchor.
1025
1081
  • ⚠ NEVER have empty grid cells. If you have 3 items, use 3 columns. If 4, use 2×2.`,
1026
1082
  bar_chart: `═══ REQUIRED LAYOUT: BAR CHART ═══
@@ -1183,7 +1239,7 @@ CRITICAL PATTERN — your .content MUST be a vertical stack of .bar-item divs:
1183
1239
 
1184
1240
  ⚠ justify-content:space-evenly distributes bars across the full height — NO empty bottom.
1185
1241
  ⚠ Each bar: header row (label + percentage) + track div containing fill div with style="width:XX%".
1186
- ⚠ 4-6 bars. Bar height:44px. Use gradient fills. The structure above is non-negotiable.
1242
+ ⚠ 4-5 bars (MAX 5). Bar height:44px. Use gradient fills. Labels under 15 chars. The structure above is non-negotiable.
1187
1243
  ⚠⚠⚠ .bar-item divs MUST be DIRECT children of .content. Do NOT wrap them in a container div.`,
1188
1244
  hero_stat: `═══ REQUIRED LAYOUT: HERO STAT ═══
1189
1245
  ⚠⚠⚠ You MUST create a SINGLE LARGE CENTRAL METRIC. Cards/tables = FAILURE.