@easybits.cloud/html-tailwind-generator 0.2.28 → 0.2.30

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.
@@ -8,14 +8,17 @@ var DOCUMENT_SYSTEM_PROMPT = `You are a professional document designer who creat
8
8
 
9
9
  RULES:
10
10
  - Each page is a <section> element sized for letter paper
11
- - Page structure: <section class="w-[8.5in] min-h-[11in] bg-white relative overflow-hidden p-[0.75in]">
11
+ - Page structure: <section class="w-[8.5in] min-h-[11in] relative overflow-hidden">
12
+ - The section itself has NO padding \u2014 backgrounds, gradients, and decorative elements go edge-to-edge
13
+ - For text content, use an inner wrapper: <div class="px-[0.75in] py-[0.5in]">...content...</div>
14
+ - Cover pages and decorative sections can use full-bleed backgrounds (bg-primary, gradients, images that fill the entire page)
12
15
  - Content MUST NOT overflow page boundaries \u2014 be conservative with spacing
13
16
  - Use Tailwind CDN classes ONLY (no custom CSS, no @apply, no @import)
14
17
  - NO JavaScript, only HTML+Tailwind
15
18
  - All text content in Spanish unless the prompt specifies otherwise
16
19
  - Use real content from the source material, not Lorem ipsum
17
20
  - NOT responsive \u2014 fixed letter size, no breakpoints needed
18
- - Background is always white paper; use colored accents for decoration
21
+ - Sections can have ANY background \u2014 full-bleed color, gradients, or white. Not limited to white paper.
19
22
 
20
23
  DESIGN:
21
24
  - Professional, colorful designs: geometric decorations, gradients, accent colors
@@ -30,8 +33,8 @@ COLOR SYSTEM \u2014 use semantic classes for decorative elements:
30
33
  - bg-primary, text-primary, bg-primary-light, bg-primary-dark, text-on-primary
31
34
  - bg-surface, bg-surface-alt, text-on-surface, text-on-surface-muted
32
35
  - bg-secondary, text-secondary, bg-accent, text-accent
33
- - Page background is ALWAYS white (bg-white on the section itself)
34
- - Use semantic colors for headers, sidebars, decorative bars, table headers, accents
36
+ - Use semantic colors freely for full-page backgrounds, headers, sidebars, decorative bars, table headers, accents
37
+ - Cover pages should use bold full-bleed backgrounds (bg-primary, gradients)
35
38
  - CONTRAST RULE: on bg-primary \u2192 text-on-primary. On white/bg-surface \u2192 text-on-surface or text-primary
36
39
  - Gradients: from-primary to-primary-dark
37
40
 
@@ -46,7 +49,7 @@ TAILWIND v3 NOTES:
46
49
  var DOCUMENT_PROMPT_SUFFIX = `
47
50
 
48
51
  OUTPUT FORMAT: NDJSON \u2014 one JSON object per line, NO wrapper array, NO markdown fences.
49
- Each line: {"label": "Page Title", "html": "<section class='w-[8.5in] min-h-[11in] bg-white relative overflow-hidden p-[0.75in]'>...</section>"}
52
+ Each line: {"label": "Page Title", "html": "<section class='w-[8.5in] min-h-[11in] relative overflow-hidden'>...</section>"}
50
53
 
51
54
  Generate 3-8 pages depending on content length. First page = cover/title page.
52
55
  Each page must fit within letter size (8.5" \xD7 11"). Be conservative with spacing.
@@ -61,7 +64,9 @@ async function generateDocument(options) {
61
64
  } = options;
62
65
  const extra = extraInstructions ? `
63
66
  Additional instructions: ${extraInstructions}` : "";
64
- const logoInstruction = logoUrl ? `
67
+ const isDataUrl = logoUrl?.startsWith("data:");
68
+ const logoInstruction = logoUrl ? isDataUrl ? `
69
+ LOGO: The user's company logo is provided as an image above. Include it on the cover page and as a small header element on other pages. Use <img data-logo="true" alt="Logo" class="h-12 object-contain" /> as placeholder \u2014 the system will inject the real src.` : `
65
70
  LOGO: Include this logo on the cover page and as a small header on other pages:
66
71
  <img src="${logoUrl}" alt="Logo" class="h-12 object-contain" />
67
72
  Use this exact <img> tag \u2014 do NOT invent a different logo.` : "";
@@ -101,4 +106,4 @@ export {
101
106
  DOCUMENT_PROMPT_SUFFIX,
102
107
  generateDocument
103
108
  };
104
- //# sourceMappingURL=chunk-5Y3R63LZ.js.map
109
+ //# sourceMappingURL=chunk-23X3KWDC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generateDocument.ts"],"sourcesContent":["import { streamGenerate, dataUrlToImagePart } from \"./streamCore\";\nimport type { Section3 } from \"./types\";\n\nexport const DOCUMENT_SYSTEM_PROMPT = `You are a professional document designer who creates stunning letter-sized (8.5\" × 11\") document pages using HTML + Tailwind CSS.\n\nRULES:\n- Each page is a <section> element sized for letter paper\n- Page structure: <section class=\"w-[8.5in] min-h-[11in] relative overflow-hidden\">\n- The section itself has NO padding — backgrounds, gradients, and decorative elements go edge-to-edge\n- For text content, use an inner wrapper: <div class=\"px-[0.75in] py-[0.5in]\">...content...</div>\n- Cover pages and decorative sections can use full-bleed backgrounds (bg-primary, gradients, images that fill the entire page)\n- Content MUST NOT overflow page boundaries — be conservative with spacing\n- Use Tailwind CDN classes ONLY (no custom CSS, no @apply, no @import)\n- NO JavaScript, only HTML+Tailwind\n- All text content in Spanish unless the prompt specifies otherwise\n- Use real content from the source material, not Lorem ipsum\n- NOT responsive — fixed letter size, no breakpoints needed\n- Sections can have ANY background — full-bleed color, gradients, or white. Not limited to white paper.\n\nDESIGN:\n- Professional, colorful designs: geometric decorations, gradients, accent colors\n- Typography: use font weights (font-light to font-black), good hierarchy\n- Tables: Tailwind table classes, alternating row colors, clean borders\n- Decorative elements: colored sidebars, header bands, icon accents, SVG shapes\n- First page MUST be a cover/title page with impactful design\n- Use page-appropriate content density — don't cram too much on one page\n- For numerical data: styled tables, colored bars, progress elements\n\nCOLOR SYSTEM — use semantic classes for decorative elements:\n- bg-primary, text-primary, bg-primary-light, bg-primary-dark, text-on-primary\n- bg-surface, bg-surface-alt, text-on-surface, text-on-surface-muted\n- bg-secondary, text-secondary, bg-accent, text-accent\n- Use semantic colors freely for full-page backgrounds, headers, sidebars, decorative bars, table headers, accents\n- Cover pages should use bold full-bleed backgrounds (bg-primary, gradients)\n- CONTRAST RULE: on bg-primary → text-on-primary. On white/bg-surface → text-on-surface or text-primary\n- Gradients: from-primary to-primary-dark\n\nIMAGES:\n- EVERY image MUST use: <img data-image-query=\"english search query\" alt=\"description\" class=\"w-full h-auto object-cover rounded-xl\"/>\n- NEVER include a src attribute — the system auto-replaces data-image-query with a real image\n- For avatar-like elements, use colored divs with initials instead of img tags\n\nTAILWIND v3 NOTES:\n- Standard Tailwind v3 classes (shadow-sm, shadow-md, rounded-md, etc.)\n- Borders: border + border-gray-200 for visible borders`;\n\nexport const DOCUMENT_PROMPT_SUFFIX = `\n\nOUTPUT FORMAT: NDJSON — one JSON object per line, NO wrapper array, NO markdown fences.\nEach line: {\"label\": \"Page Title\", \"html\": \"<section class='w-[8.5in] min-h-[11in] relative overflow-hidden'>...</section>\"}\n\nGenerate 3-8 pages depending on content length. First page = cover/title page.\nEach page must fit within letter size (8.5\" × 11\"). Be conservative with spacing.\nMake each page visually distinct — different layouts, different accent placements.`;\n\nexport interface GenerateDocumentOptions {\n anthropicApiKey?: string;\n openaiApiKey?: string;\n prompt: string;\n logoUrl?: string;\n referenceImage?: string;\n extraInstructions?: string;\n model?: string;\n pexelsApiKey?: string;\n persistImage?: (tempUrl: string, query: string) => Promise<string>;\n onSection?: (section: Section3) => void;\n onImageUpdate?: (sectionId: string, html: string) => void;\n onDone?: (sections: Section3[]) => void;\n onError?: (error: Error) => void;\n}\n\n/**\n * Generate a multi-page document with streaming AI + image enrichment.\n */\nexport async function generateDocument(options: GenerateDocumentOptions): Promise<Section3[]> {\n const {\n prompt,\n logoUrl,\n referenceImage,\n extraInstructions,\n ...rest\n } = options;\n\n const extra = extraInstructions ? `\\nAdditional instructions: ${extraInstructions}` : \"\";\n const isDataUrl = logoUrl?.startsWith(\"data:\");\n const logoInstruction = logoUrl\n ? isDataUrl\n ? `\\nLOGO: The user's company logo is provided as an image above. Include it on the cover page and as a small header element on other pages. Use <img data-logo=\"true\" alt=\"Logo\" class=\"h-12 object-contain\" /> as placeholder — the system will inject the real src.`\n : `\\nLOGO: Include this logo on the cover page and as a small header on other pages:\\n<img src=\"${logoUrl}\" alt=\"Logo\" class=\"h-12 object-contain\" />\\nUse this exact <img> tag — do NOT invent a different logo.`\n : \"\";\n\n const content: any[] = [];\n\n // If logo is a data URL, send it as vision input so AI can see it\n if (logoUrl?.startsWith(\"data:\")) {\n const converted = dataUrlToImagePart(logoUrl);\n if (converted) {\n content.push({ type: \"image\", ...converted });\n }\n }\n\n if (referenceImage) {\n const converted = dataUrlToImagePart(referenceImage);\n if (converted) {\n content.push({ type: \"image\", ...converted });\n } else {\n content.push({ type: \"image\", image: referenceImage });\n }\n content.push({\n type: \"text\",\n text: `Create a professional document inspired by this reference image for: ${prompt}${logoInstruction}${extra}${DOCUMENT_PROMPT_SUFFIX}`,\n });\n } else {\n content.push({\n type: \"text\",\n text: `Create a professional document for: ${prompt}${logoInstruction}${extra}${DOCUMENT_PROMPT_SUFFIX}`,\n });\n }\n\n return streamGenerate({\n ...rest,\n systemPrompt: DOCUMENT_SYSTEM_PROMPT,\n userContent: content,\n });\n}\n"],"mappings":";;;;;;AAGO,IAAM,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2C/B,IAAM,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BtC,eAAsB,iBAAiB,SAAuD;AAC5F,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,QAAQ,oBAAoB;AAAA,2BAA8B,iBAAiB,KAAK;AACtF,QAAM,YAAY,SAAS,WAAW,OAAO;AAC7C,QAAM,kBAAkB,UACpB,YACE;AAAA,0QACA;AAAA;AAAA,YAAgG,OAAO;AAAA,mEACzG;AAEJ,QAAM,UAAiB,CAAC;AAGxB,MAAI,SAAS,WAAW,OAAO,GAAG;AAChC,UAAM,YAAY,mBAAmB,OAAO;AAC5C,QAAI,WAAW;AACb,cAAQ,KAAK,EAAE,MAAM,SAAS,GAAG,UAAU,CAAC;AAAA,IAC9C;AAAA,EACF;AAEA,MAAI,gBAAgB;AAClB,UAAM,YAAY,mBAAmB,cAAc;AACnD,QAAI,WAAW;AACb,cAAQ,KAAK,EAAE,MAAM,SAAS,GAAG,UAAU,CAAC;AAAA,IAC9C,OAAO;AACL,cAAQ,KAAK,EAAE,MAAM,SAAS,OAAO,eAAe,CAAC;AAAA,IACvD;AACA,YAAQ,KAAK;AAAA,MACX,MAAM;AAAA,MACN,MAAM,wEAAwE,MAAM,GAAG,eAAe,GAAG,KAAK,GAAG,sBAAsB;AAAA,IACzI,CAAC;AAAA,EACH,OAAO;AACL,YAAQ,KAAK;AAAA,MACX,MAAM;AAAA,MACN,MAAM,uCAAuC,MAAM,GAAG,eAAe,GAAG,KAAK,GAAG,sBAAsB;AAAA,IACxG,CAAC;AAAA,EACH;AAEA,SAAO,eAAe;AAAA,IACpB,GAAG;AAAA,IACH,cAAc;AAAA,IACd,aAAa;AAAA,EACf,CAAC;AACH;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { S as Section3 } from './types-Flpl4wDs.js';
2
2
 
3
- declare const DOCUMENT_SYSTEM_PROMPT = "You are a professional document designer who creates stunning letter-sized (8.5\" \u00D7 11\") document pages using HTML + Tailwind CSS.\n\nRULES:\n- Each page is a <section> element sized for letter paper\n- Page structure: <section class=\"w-[8.5in] min-h-[11in] bg-white relative overflow-hidden p-[0.75in]\">\n- Content MUST NOT overflow page boundaries \u2014 be conservative with spacing\n- Use Tailwind CDN classes ONLY (no custom CSS, no @apply, no @import)\n- NO JavaScript, only HTML+Tailwind\n- All text content in Spanish unless the prompt specifies otherwise\n- Use real content from the source material, not Lorem ipsum\n- NOT responsive \u2014 fixed letter size, no breakpoints needed\n- Background is always white paper; use colored accents for decoration\n\nDESIGN:\n- Professional, colorful designs: geometric decorations, gradients, accent colors\n- Typography: use font weights (font-light to font-black), good hierarchy\n- Tables: Tailwind table classes, alternating row colors, clean borders\n- Decorative elements: colored sidebars, header bands, icon accents, SVG shapes\n- First page MUST be a cover/title page with impactful design\n- Use page-appropriate content density \u2014 don't cram too much on one page\n- For numerical data: styled tables, colored bars, progress elements\n\nCOLOR SYSTEM \u2014 use semantic classes for decorative elements:\n- bg-primary, text-primary, bg-primary-light, bg-primary-dark, text-on-primary\n- bg-surface, bg-surface-alt, text-on-surface, text-on-surface-muted\n- bg-secondary, text-secondary, bg-accent, text-accent\n- Page background is ALWAYS white (bg-white on the section itself)\n- Use semantic colors for headers, sidebars, decorative bars, table headers, accents\n- CONTRAST RULE: on bg-primary \u2192 text-on-primary. On white/bg-surface \u2192 text-on-surface or text-primary\n- Gradients: from-primary to-primary-dark\n\nIMAGES:\n- EVERY image MUST use: <img data-image-query=\"english search query\" alt=\"description\" class=\"w-full h-auto object-cover rounded-xl\"/>\n- NEVER include a src attribute \u2014 the system auto-replaces data-image-query with a real image\n- For avatar-like elements, use colored divs with initials instead of img tags\n\nTAILWIND v3 NOTES:\n- Standard Tailwind v3 classes (shadow-sm, shadow-md, rounded-md, etc.)\n- Borders: border + border-gray-200 for visible borders";
4
- declare const DOCUMENT_PROMPT_SUFFIX = "\n\nOUTPUT FORMAT: NDJSON \u2014 one JSON object per line, NO wrapper array, NO markdown fences.\nEach line: {\"label\": \"Page Title\", \"html\": \"<section class='w-[8.5in] min-h-[11in] bg-white relative overflow-hidden p-[0.75in]'>...</section>\"}\n\nGenerate 3-8 pages depending on content length. First page = cover/title page.\nEach page must fit within letter size (8.5\" \u00D7 11\"). Be conservative with spacing.\nMake each page visually distinct \u2014 different layouts, different accent placements.";
3
+ declare const DOCUMENT_SYSTEM_PROMPT = "You are a professional document designer who creates stunning letter-sized (8.5\" \u00D7 11\") document pages using HTML + Tailwind CSS.\n\nRULES:\n- Each page is a <section> element sized for letter paper\n- Page structure: <section class=\"w-[8.5in] min-h-[11in] relative overflow-hidden\">\n- The section itself has NO padding \u2014 backgrounds, gradients, and decorative elements go edge-to-edge\n- For text content, use an inner wrapper: <div class=\"px-[0.75in] py-[0.5in]\">...content...</div>\n- Cover pages and decorative sections can use full-bleed backgrounds (bg-primary, gradients, images that fill the entire page)\n- Content MUST NOT overflow page boundaries \u2014 be conservative with spacing\n- Use Tailwind CDN classes ONLY (no custom CSS, no @apply, no @import)\n- NO JavaScript, only HTML+Tailwind\n- All text content in Spanish unless the prompt specifies otherwise\n- Use real content from the source material, not Lorem ipsum\n- NOT responsive \u2014 fixed letter size, no breakpoints needed\n- Sections can have ANY background \u2014 full-bleed color, gradients, or white. Not limited to white paper.\n\nDESIGN:\n- Professional, colorful designs: geometric decorations, gradients, accent colors\n- Typography: use font weights (font-light to font-black), good hierarchy\n- Tables: Tailwind table classes, alternating row colors, clean borders\n- Decorative elements: colored sidebars, header bands, icon accents, SVG shapes\n- First page MUST be a cover/title page with impactful design\n- Use page-appropriate content density \u2014 don't cram too much on one page\n- For numerical data: styled tables, colored bars, progress elements\n\nCOLOR SYSTEM \u2014 use semantic classes for decorative elements:\n- bg-primary, text-primary, bg-primary-light, bg-primary-dark, text-on-primary\n- bg-surface, bg-surface-alt, text-on-surface, text-on-surface-muted\n- bg-secondary, text-secondary, bg-accent, text-accent\n- Use semantic colors freely for full-page backgrounds, headers, sidebars, decorative bars, table headers, accents\n- Cover pages should use bold full-bleed backgrounds (bg-primary, gradients)\n- CONTRAST RULE: on bg-primary \u2192 text-on-primary. On white/bg-surface \u2192 text-on-surface or text-primary\n- Gradients: from-primary to-primary-dark\n\nIMAGES:\n- EVERY image MUST use: <img data-image-query=\"english search query\" alt=\"description\" class=\"w-full h-auto object-cover rounded-xl\"/>\n- NEVER include a src attribute \u2014 the system auto-replaces data-image-query with a real image\n- For avatar-like elements, use colored divs with initials instead of img tags\n\nTAILWIND v3 NOTES:\n- Standard Tailwind v3 classes (shadow-sm, shadow-md, rounded-md, etc.)\n- Borders: border + border-gray-200 for visible borders";
4
+ declare const DOCUMENT_PROMPT_SUFFIX = "\n\nOUTPUT FORMAT: NDJSON \u2014 one JSON object per line, NO wrapper array, NO markdown fences.\nEach line: {\"label\": \"Page Title\", \"html\": \"<section class='w-[8.5in] min-h-[11in] relative overflow-hidden'>...</section>\"}\n\nGenerate 3-8 pages depending on content length. First page = cover/title page.\nEach page must fit within letter size (8.5\" \u00D7 11\"). Be conservative with spacing.\nMake each page visually distinct \u2014 different layouts, different accent placements.";
5
5
  interface GenerateDocumentOptions {
6
6
  anthropicApiKey?: string;
7
7
  openaiApiKey?: string;
@@ -2,7 +2,7 @@ import {
2
2
  DOCUMENT_PROMPT_SUFFIX,
3
3
  DOCUMENT_SYSTEM_PROMPT,
4
4
  generateDocument
5
- } from "./chunk-5Y3R63LZ.js";
5
+ } from "./chunk-23X3KWDC.js";
6
6
  import "./chunk-PNEUKC6I.js";
7
7
  import "./chunk-FM4IJA64.js";
8
8
  export {
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  DOCUMENT_PROMPT_SUFFIX,
16
16
  DOCUMENT_SYSTEM_PROMPT,
17
17
  generateDocument
18
- } from "./chunk-5Y3R63LZ.js";
18
+ } from "./chunk-23X3KWDC.js";
19
19
  import {
20
20
  extractJsonObjects
21
21
  } from "./chunk-PNEUKC6I.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easybits.cloud/html-tailwind-generator",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
4
4
  "description": "AI-powered landing page generator with Tailwind CSS — canvas editor, streaming generation, and one-click deploy",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/generateDocument.ts"],"sourcesContent":["import { streamGenerate, dataUrlToImagePart } from \"./streamCore\";\nimport type { Section3 } from \"./types\";\n\nexport const DOCUMENT_SYSTEM_PROMPT = `You are a professional document designer who creates stunning letter-sized (8.5\" × 11\") document pages using HTML + Tailwind CSS.\n\nRULES:\n- Each page is a <section> element sized for letter paper\n- Page structure: <section class=\"w-[8.5in] min-h-[11in] bg-white relative overflow-hidden p-[0.75in]\">\n- Content MUST NOT overflow page boundaries — be conservative with spacing\n- Use Tailwind CDN classes ONLY (no custom CSS, no @apply, no @import)\n- NO JavaScript, only HTML+Tailwind\n- All text content in Spanish unless the prompt specifies otherwise\n- Use real content from the source material, not Lorem ipsum\n- NOT responsive — fixed letter size, no breakpoints needed\n- Background is always white paper; use colored accents for decoration\n\nDESIGN:\n- Professional, colorful designs: geometric decorations, gradients, accent colors\n- Typography: use font weights (font-light to font-black), good hierarchy\n- Tables: Tailwind table classes, alternating row colors, clean borders\n- Decorative elements: colored sidebars, header bands, icon accents, SVG shapes\n- First page MUST be a cover/title page with impactful design\n- Use page-appropriate content density — don't cram too much on one page\n- For numerical data: styled tables, colored bars, progress elements\n\nCOLOR SYSTEM — use semantic classes for decorative elements:\n- bg-primary, text-primary, bg-primary-light, bg-primary-dark, text-on-primary\n- bg-surface, bg-surface-alt, text-on-surface, text-on-surface-muted\n- bg-secondary, text-secondary, bg-accent, text-accent\n- Page background is ALWAYS white (bg-white on the section itself)\n- Use semantic colors for headers, sidebars, decorative bars, table headers, accents\n- CONTRAST RULE: on bg-primary → text-on-primary. On white/bg-surface → text-on-surface or text-primary\n- Gradients: from-primary to-primary-dark\n\nIMAGES:\n- EVERY image MUST use: <img data-image-query=\"english search query\" alt=\"description\" class=\"w-full h-auto object-cover rounded-xl\"/>\n- NEVER include a src attribute — the system auto-replaces data-image-query with a real image\n- For avatar-like elements, use colored divs with initials instead of img tags\n\nTAILWIND v3 NOTES:\n- Standard Tailwind v3 classes (shadow-sm, shadow-md, rounded-md, etc.)\n- Borders: border + border-gray-200 for visible borders`;\n\nexport const DOCUMENT_PROMPT_SUFFIX = `\n\nOUTPUT FORMAT: NDJSON — one JSON object per line, NO wrapper array, NO markdown fences.\nEach line: {\"label\": \"Page Title\", \"html\": \"<section class='w-[8.5in] min-h-[11in] bg-white relative overflow-hidden p-[0.75in]'>...</section>\"}\n\nGenerate 3-8 pages depending on content length. First page = cover/title page.\nEach page must fit within letter size (8.5\" × 11\"). Be conservative with spacing.\nMake each page visually distinct — different layouts, different accent placements.`;\n\nexport interface GenerateDocumentOptions {\n anthropicApiKey?: string;\n openaiApiKey?: string;\n prompt: string;\n logoUrl?: string;\n referenceImage?: string;\n extraInstructions?: string;\n model?: string;\n pexelsApiKey?: string;\n persistImage?: (tempUrl: string, query: string) => Promise<string>;\n onSection?: (section: Section3) => void;\n onImageUpdate?: (sectionId: string, html: string) => void;\n onDone?: (sections: Section3[]) => void;\n onError?: (error: Error) => void;\n}\n\n/**\n * Generate a multi-page document with streaming AI + image enrichment.\n */\nexport async function generateDocument(options: GenerateDocumentOptions): Promise<Section3[]> {\n const {\n prompt,\n logoUrl,\n referenceImage,\n extraInstructions,\n ...rest\n } = options;\n\n const extra = extraInstructions ? `\\nAdditional instructions: ${extraInstructions}` : \"\";\n const logoInstruction = logoUrl\n ? `\\nLOGO: Include this logo on the cover page and as a small header on other pages:\\n<img src=\"${logoUrl}\" alt=\"Logo\" class=\"h-12 object-contain\" />\\nUse this exact <img> tag — do NOT invent a different logo.`\n : \"\";\n\n const content: any[] = [];\n\n // If logo is a data URL, send it as vision input so AI can see it\n if (logoUrl?.startsWith(\"data:\")) {\n const converted = dataUrlToImagePart(logoUrl);\n if (converted) {\n content.push({ type: \"image\", ...converted });\n }\n }\n\n if (referenceImage) {\n const converted = dataUrlToImagePart(referenceImage);\n if (converted) {\n content.push({ type: \"image\", ...converted });\n } else {\n content.push({ type: \"image\", image: referenceImage });\n }\n content.push({\n type: \"text\",\n text: `Create a professional document inspired by this reference image for: ${prompt}${logoInstruction}${extra}${DOCUMENT_PROMPT_SUFFIX}`,\n });\n } else {\n content.push({\n type: \"text\",\n text: `Create a professional document for: ${prompt}${logoInstruction}${extra}${DOCUMENT_PROMPT_SUFFIX}`,\n });\n }\n\n return streamGenerate({\n ...rest,\n systemPrompt: DOCUMENT_SYSTEM_PROMPT,\n userContent: content,\n });\n}\n"],"mappings":";;;;;;AAGO,IAAM,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwC/B,IAAM,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BtC,eAAsB,iBAAiB,SAAuD;AAC5F,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,QAAQ,oBAAoB;AAAA,2BAA8B,iBAAiB,KAAK;AACtF,QAAM,kBAAkB,UACpB;AAAA;AAAA,YAAgG,OAAO;AAAA,mEACvG;AAEJ,QAAM,UAAiB,CAAC;AAGxB,MAAI,SAAS,WAAW,OAAO,GAAG;AAChC,UAAM,YAAY,mBAAmB,OAAO;AAC5C,QAAI,WAAW;AACb,cAAQ,KAAK,EAAE,MAAM,SAAS,GAAG,UAAU,CAAC;AAAA,IAC9C;AAAA,EACF;AAEA,MAAI,gBAAgB;AAClB,UAAM,YAAY,mBAAmB,cAAc;AACnD,QAAI,WAAW;AACb,cAAQ,KAAK,EAAE,MAAM,SAAS,GAAG,UAAU,CAAC;AAAA,IAC9C,OAAO;AACL,cAAQ,KAAK,EAAE,MAAM,SAAS,OAAO,eAAe,CAAC;AAAA,IACvD;AACA,YAAQ,KAAK;AAAA,MACX,MAAM;AAAA,MACN,MAAM,wEAAwE,MAAM,GAAG,eAAe,GAAG,KAAK,GAAG,sBAAsB;AAAA,IACzI,CAAC;AAAA,EACH,OAAO;AACL,YAAQ,KAAK;AAAA,MACX,MAAM;AAAA,MACN,MAAM,uCAAuC,MAAM,GAAG,eAAe,GAAG,KAAK,GAAG,sBAAsB;AAAA,IACxG,CAAC;AAAA,EACH;AAEA,SAAO,eAAe;AAAA,IACpB,GAAG;AAAA,IACH,cAAc;AAAA,IACd,aAAa;AAAA,EACf,CAAC;AACH;","names":[]}