@presentation-md/export 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.js","sourceRoot":"","sources":["../../src/import/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AASzD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAChD,MAAM,MAAM,GAAG,sEAAsE,CAAC;AACtF,MAAM,QAAQ,GAAG,iCAAiC,CAAC;AACnD,MAAM,OAAO,GAAG,2BAA2B,CAAC;AAC5C,MAAM,OAAO,GAAG,oCAAoC,CAAC;AAErD,SAAS,cAAc,CAAC,GAAmB;IACzC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtD,OAAO,QAAQ,GAAG,CAAC,WAAW,WAAW,GAAG,EAAE,CAAC;AACjD,CAAC;AAED,uFAAuF;AACvF,SAAS,kBAAkB,CAAC,SAAiB,EAAE,QAAgB;IAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,OAAO,GAAG,IAAI,QAAQ,CAAC;AACzB,CAAC;AAED,KAAK,UAAU,UAAU,CACvB,GAAmB,EACnB,WAAmB,EACnB,IAAgB,EAChB,QAAkB;IAElB,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CA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C,MAAM;YAC9B,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,OAAO;YACnC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,QAAQ;SAC9B;QACD,MAAM;KACP,CAAC;IAEF,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,mCAAmC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Intermediate types for PPTX → Deck JSON import.
3
+ * See docs/superpowers/specs/2026-07-28-pptx-import-design.md
4
+ */
5
+ export interface ExtractedImage {
6
+ name: string;
7
+ contentType: string;
8
+ bytes: Uint8Array;
9
+ widthEmu?: number;
10
+ heightEmu?: number;
11
+ }
12
+ export interface ExtractedSlide {
13
+ number: number;
14
+ title?: string;
15
+ texts: string[];
16
+ tables: string[][];
17
+ images: ExtractedImage[];
18
+ notes?: string;
19
+ }
20
+ export interface ExtractedPresentation {
21
+ meta: {
22
+ title?: string;
23
+ author?: string;
24
+ subject?: string;
25
+ };
26
+ slides: ExtractedSlide[];
27
+ }
28
+ export interface ExtractOptions {
29
+ onWarn?: (msg: string) => void;
30
+ }
31
+ export interface MapOptions {
32
+ theme?: string;
33
+ /** If set, write images here and use relative paths instead of data URIs. */
34
+ assetsDir?: string;
35
+ onWarn?: (msg: string) => void;
36
+ }
37
+ export interface ImportOptions extends ExtractOptions, MapOptions {
38
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Intermediate types for PPTX → Deck JSON import.
3
+ * See docs/superpowers/specs/2026-07-28-pptx-import-design.md
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/import/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,9 @@
1
+ export declare const MAX_UNCOMPRESSED_BYTES: number;
2
+ export declare const MAX_ZIP_ENTRIES = 200;
3
+ export declare const MAX_MEDIA_BYTES: number;
4
+ export declare function assertZipEntrySafe(opts: {
5
+ entryCount: number;
6
+ uncompressedSize: number;
7
+ totalUncompressed: number;
8
+ isMedia?: boolean;
9
+ }): void;
@@ -0,0 +1,15 @@
1
+ export const MAX_UNCOMPRESSED_BYTES = 50 * 1024 * 1024;
2
+ export const MAX_ZIP_ENTRIES = 200;
3
+ export const MAX_MEDIA_BYTES = 10 * 1024 * 1024;
4
+ export function assertZipEntrySafe(opts) {
5
+ if (opts.entryCount > MAX_ZIP_ENTRIES) {
6
+ throw new Error(`PPTX has too many entries (>${MAX_ZIP_ENTRIES})`);
7
+ }
8
+ if (opts.totalUncompressed > MAX_UNCOMPRESSED_BYTES) {
9
+ throw new Error(`PPTX uncompressed size exceeds ${MAX_UNCOMPRESSED_BYTES} bytes`);
10
+ }
11
+ if (opts.isMedia && opts.uncompressedSize > MAX_MEDIA_BYTES) {
12
+ throw new Error(`Media blob exceeds ${MAX_MEDIA_BYTES} bytes`);
13
+ }
14
+ }
15
+ //# sourceMappingURL=zip-limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zip-limits.js","sourceRoot":"","sources":["../../src/import/zip-limits.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACvD,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhD,MAAM,UAAU,kBAAkB,CAAC,IAKlC;IACC,IAAI,IAAI,CAAC,UAAU,GAAG,eAAe,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,+BAA+B,eAAe,GAAG,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,IAAI,CAAC,iBAAiB,GAAG,sBAAsB,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,kCAAkC,sBAAsB,QAAQ,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,gBAAgB,GAAG,eAAe,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,sBAAsB,eAAe,QAAQ,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { ResolvedTheme } from "@presentation-md/core";
2
+ import { type Pptx } from "./pptx.js";
3
+ import type { DeckJson } from "./deck-types.js";
4
+ export type { DeckJson, DeckMeta, Slide, LayoutType, Card, Stat, Step, Cta, } from "./deck-types.js";
5
+ export interface PptxOptions {
6
+ /** Called for any content that couldn't be mapped exactly (e.g. remote images). */
7
+ onWarn?: (msg: string) => void;
8
+ /** Append a small attribution note to the final slide. Defaults to `true`. */
9
+ attribution?: boolean;
10
+ }
11
+ export interface BuildResult {
12
+ pptx: Pptx;
13
+ slideCount: number;
14
+ warnings: string[];
15
+ }
16
+ /**
17
+ * Build a PptxGenJS presentation from a (validated) deck and a resolved theme.
18
+ * Pure and runtime-agnostic — callers serialize via the `deckToPptx*` helpers
19
+ * or `result.pptx.write(...)` directly.
20
+ */
21
+ export declare function buildPptx(deck: DeckJson, theme: ResolvedTheme, opts?: PptxOptions): Promise<BuildResult>;
22
+ /** Serialize the deck to a PPTX ArrayBuffer (works in Node and the browser). */
23
+ export declare function deckToPptxArrayBuffer(deck: DeckJson, theme: ResolvedTheme, opts?: PptxOptions): Promise<ArrayBuffer>;
24
+ /** Serialize to a Node Buffer (server/CLI). */
25
+ export declare function deckToPptxBuffer(deck: DeckJson, theme: ResolvedTheme, opts?: PptxOptions): Promise<Buffer>;
26
+ /** Serialize to a Blob (browser/studio download). */
27
+ export declare function deckToPptxBlob(deck: DeckJson, theme: ResolvedTheme, opts?: PptxOptions): Promise<Blob>;
package/dist/index.js ADDED
@@ -0,0 +1,66 @@
1
+ import { PptxGenJS } from "./pptx.js";
2
+ import { buildContext } from "./context.js";
3
+ import { renderSlide } from "./layouts.js";
4
+ const ATTRIBUTION_TEXT = "Made with presentation-md";
5
+ const ATTRIBUTION_URL = "https://presentation-md.vercel.app/?ref=pptx";
6
+ const LAYOUT_NAME = "PMD_16x9";
7
+ /**
8
+ * Build a PptxGenJS presentation from a (validated) deck and a resolved theme.
9
+ * Pure and runtime-agnostic — callers serialize via the `deckToPptx*` helpers
10
+ * or `result.pptx.write(...)` directly.
11
+ */
12
+ export async function buildPptx(deck, theme, opts = {}) {
13
+ const warnings = [];
14
+ const warn = (msg) => {
15
+ warnings.push(msg);
16
+ opts.onWarn?.(msg);
17
+ };
18
+ const pptx = new PptxGenJS();
19
+ const ctx = buildContext(theme, { roundRect: pptx.ShapeType.roundRect, oval: pptx.ShapeType.ellipse }, warn);
20
+ pptx.defineLayout({ name: LAYOUT_NAME, width: ctx.width, height: ctx.height });
21
+ pptx.layout = LAYOUT_NAME;
22
+ if (deck.meta?.title)
23
+ pptx.title = deck.meta.title;
24
+ if (deck.meta?.company)
25
+ pptx.company = deck.meta.company;
26
+ if (deck.meta?.description)
27
+ pptx.subject = deck.meta.description;
28
+ pptx.author = "presentation-md";
29
+ const slides = Array.isArray(deck.slides) ? deck.slides : [];
30
+ slides.forEach((slideData, i) => {
31
+ const slide = pptx.addSlide();
32
+ renderSlide(slide, ctx, slideData);
33
+ const isLast = i === slides.length - 1;
34
+ if (isLast && opts.attribution !== false) {
35
+ slide.addText(ATTRIBUTION_TEXT, {
36
+ x: ctx.margin,
37
+ y: ctx.height - 0.4,
38
+ w: ctx.width - ctx.margin * 2,
39
+ h: 0.3,
40
+ fontFace: ctx.fonts.body,
41
+ color: ctx.colors.muted,
42
+ fontSize: 9,
43
+ align: "center",
44
+ valign: "middle",
45
+ hyperlink: { url: ATTRIBUTION_URL },
46
+ });
47
+ }
48
+ });
49
+ return { pptx, slideCount: slides.length, warnings };
50
+ }
51
+ /** Serialize the deck to a PPTX ArrayBuffer (works in Node and the browser). */
52
+ export async function deckToPptxArrayBuffer(deck, theme, opts) {
53
+ const { pptx } = await buildPptx(deck, theme, opts);
54
+ return (await pptx.write({ outputType: "arraybuffer" }));
55
+ }
56
+ /** Serialize to a Node Buffer (server/CLI). */
57
+ export async function deckToPptxBuffer(deck, theme, opts) {
58
+ const { pptx } = await buildPptx(deck, theme, opts);
59
+ return (await pptx.write({ outputType: "nodebuffer" }));
60
+ }
61
+ /** Serialize to a Blob (browser/studio download). */
62
+ export async function deckToPptxBlob(deck, theme, opts) {
63
+ const { pptx } = await buildPptx(deck, theme, opts);
64
+ return (await pptx.write({ outputType: "blob" }));
65
+ }
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAc3C,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,eAAe,GAAG,8CAA8C,CAAC;AAevE,MAAM,WAAW,GAAG,UAAU,CAAC;AAE/B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAc,EACd,KAAoB,EACpB,OAAoB,EAAE;IAEtB,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,CAAC,GAAW,EAAQ,EAAE;QACjC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,I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CAClC,IAAc,EACd,KAAoB,EACpB,IAAkB;IAElB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACpD,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAS,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ExportContext } from "./context.js";
2
+ import type { Slide } from "./deck-types.js";
3
+ import type { PptxSlide } from "./pptx.js";
4
+ /**
5
+ * Per-layout mappers: each turns a structured slide into native PPTX shapes
6
+ * (text boxes, tables, rounded rectangles) positioned in inches on the slide.
7
+ */
8
+ type PSlide = PptxSlide;
9
+ export declare function renderSlide(slide: PSlide, ctx: ExportContext, data: Slide): void;
10
+ export {};
@@ -0,0 +1,433 @@
1
+ function eyebrow(slide, ctx, text, x, y, w) {
2
+ slide.addText(text.toUpperCase(), {
3
+ x,
4
+ y,
5
+ w,
6
+ h: 0.35,
7
+ fontFace: ctx.fonts.body,
8
+ fontSize: 13,
9
+ bold: true,
10
+ color: ctx.colors.accent2,
11
+ charSpacing: 2,
12
+ align: "left",
13
+ valign: "middle",
14
+ });
15
+ }
16
+ function heading(slide, ctx, text, opts) {
17
+ slide.addText(text, {
18
+ fontFace: ctx.fonts.heading,
19
+ bold: ctx.fonts.headingBold,
20
+ color: ctx.colors.text,
21
+ fit: "shrink",
22
+ valign: "top",
23
+ align: "left",
24
+ ...opts,
25
+ });
26
+ }
27
+ function body(slide, ctx, text, opts) {
28
+ slide.addText(text, {
29
+ fontFace: ctx.fonts.body,
30
+ color: ctx.colors.muted,
31
+ fontSize: 16,
32
+ fit: "shrink",
33
+ valign: "top",
34
+ align: "left",
35
+ lineSpacingMultiple: 1.15,
36
+ ...opts,
37
+ });
38
+ }
39
+ /** title / closing share a centered hero block. */
40
+ function renderHero(slide, ctx, data) {
41
+ const x = ctx.margin;
42
+ const w = ctx.width - ctx.margin * 2;
43
+ let y = ctx.height * 0.32;
44
+ if (data.eyebrow) {
45
+ eyebrow(slide, ctx, data.eyebrow, x, y, w);
46
+ y += 0.5;
47
+ }
48
+ if (data.heading) {
49
+ heading(slide, ctx, data.heading, { x, y, w, h: 1.8, fontSize: 44 });
50
+ y += 1.9;
51
+ }
52
+ if (data.lead) {
53
+ body(slide, ctx, data.lead, { x, y, w, h: 1.2, fontSize: 20 });
54
+ y += 1.2;
55
+ }
56
+ if (data.cta?.label) {
57
+ const btnW = Math.min(3.2, w);
58
+ slide.addText(data.cta.label, {
59
+ shape: ctx.shapeRoundRect,
60
+ x,
61
+ y: y + 0.1,
62
+ w: btnW,
63
+ h: 0.6,
64
+ fill: { color: ctx.colors.accent },
65
+ color: ctx.colors.bg,
66
+ fontFace: ctx.fonts.body,
67
+ fontSize: 16,
68
+ bold: true,
69
+ align: "center",
70
+ valign: "middle",
71
+ rectRadius: 0.08,
72
+ ...(data.cta.href ? { hyperlink: { url: data.cta.href } } : {}),
73
+ });
74
+ }
75
+ }
76
+ function renderSection(slide, ctx, data) {
77
+ const x = ctx.margin;
78
+ const w = ctx.width - ctx.margin * 2;
79
+ if (data.number) {
80
+ slide.addText(data.number, {
81
+ x,
82
+ y: ctx.margin,
83
+ w,
84
+ h: 2,
85
+ fontFace: ctx.fonts.heading,
86
+ bold: true,
87
+ color: ctx.colors.accent,
88
+ fontSize: 96,
89
+ align: "left",
90
+ valign: "top",
91
+ });
92
+ }
93
+ let y = ctx.height * 0.42;
94
+ if (data.eyebrow) {
95
+ eyebrow(slide, ctx, data.eyebrow, x, y, w);
96
+ y += 0.5;
97
+ }
98
+ if (data.heading) {
99
+ heading(slide, ctx, data.heading, { x, y, w, h: 1.6, fontSize: 40 });
100
+ y += 1.7;
101
+ }
102
+ if (data.lead) {
103
+ body(slide, ctx, data.lead, { x, y, w, h: 1.0, fontSize: 18 });
104
+ }
105
+ }
106
+ function renderHeaderBlock(slide, ctx, data) {
107
+ const x = ctx.margin;
108
+ const w = ctx.width - ctx.margin * 2;
109
+ let y = ctx.margin;
110
+ if (data.eyebrow) {
111
+ eyebrow(slide, ctx, data.eyebrow, x, y, w);
112
+ y += 0.45;
113
+ }
114
+ if (data.heading) {
115
+ heading(slide, ctx, data.heading, { x, y, w, h: 1.0, fontSize: 30 });
116
+ y += 1.1;
117
+ }
118
+ return y;
119
+ }
120
+ function renderTwoColumn(slide, ctx, data) {
121
+ const colGap = 0.5;
122
+ const colW = (ctx.width - ctx.margin * 2 - colGap) / 2;
123
+ const leftX = ctx.margin;
124
+ const rightX = ctx.margin + colW + colGap;
125
+ let y = ctx.margin;
126
+ if (data.eyebrow) {
127
+ eyebrow(slide, ctx, data.eyebrow, leftX, y, colW);
128
+ y += 0.45;
129
+ }
130
+ if (data.heading) {
131
+ heading(slide, ctx, data.heading, { x: leftX, y, w: colW, h: 1.4, fontSize: 30 });
132
+ y += 1.5;
133
+ }
134
+ if (data.body) {
135
+ body(slide, ctx, data.body, { x: leftX, y, w: colW, h: ctx.height - y - ctx.margin, fontSize: 16 });
136
+ }
137
+ const imgY = ctx.margin;
138
+ const imgH = ctx.height - ctx.margin * 2;
139
+ addImageOrPlaceholder(slide, ctx, data, rightX, imgY, colW, imgH);
140
+ }
141
+ function addImageOrPlaceholder(slide, ctx, data, x, y, w, h) {
142
+ const src = data.image;
143
+ if (src && src.startsWith("data:")) {
144
+ try {
145
+ slide.addImage({ data: src, x, y, w, h, sizing: { type: "contain", w, h } });
146
+ return;
147
+ }
148
+ catch {
149
+ ctx.warn(`Failed to embed inline image; showed placeholder instead.`);
150
+ }
151
+ }
152
+ else if (src) {
153
+ // Remote/local URLs aren't embedded (no network in the exporter) — placeholder.
154
+ ctx.warn(`Image not embedded (remote images unsupported in export): ${src}`);
155
+ }
156
+ slide.addShape(ctx.shapeRoundRect, {
157
+ x,
158
+ y,
159
+ w,
160
+ h,
161
+ fill: { color: ctx.colors.cardBg },
162
+ line: { color: ctx.colors.border, width: 1 },
163
+ rectRadius: 0.08,
164
+ });
165
+ slide.addText(data.imageAlt || "Image", {
166
+ x,
167
+ y,
168
+ w,
169
+ h,
170
+ fontFace: ctx.fonts.body,
171
+ color: ctx.colors.muted,
172
+ fontSize: 14,
173
+ align: "center",
174
+ valign: "middle",
175
+ italic: true,
176
+ });
177
+ }
178
+ function renderFeatureGrid(slide, ctx, data) {
179
+ const top = renderHeaderBlock(slide, ctx, data);
180
+ const cards = data.cards ?? [];
181
+ if (cards.length === 0)
182
+ return;
183
+ let cols = typeof data.columns === "number" ? data.columns : 3;
184
+ cols = Math.max(1, Math.min(4, cols, cards.length));
185
+ const rows = Math.ceil(cards.length / cols);
186
+ const gap = 0.35;
187
+ const areaX = ctx.margin;
188
+ const areaW = ctx.width - ctx.margin * 2;
189
+ const areaY = top + 0.1;
190
+ const areaH = ctx.height - areaY - ctx.margin;
191
+ const cardW = (areaW - gap * (cols - 1)) / cols;
192
+ const cardH = (areaH - gap * (rows - 1)) / rows;
193
+ cards.forEach((card, i) => {
194
+ const r = Math.floor(i / cols);
195
+ const c = i % cols;
196
+ const x = areaX + c * (cardW + gap);
197
+ const y = areaY + r * (cardH + gap);
198
+ slide.addShape(ctx.shapeRoundRect, {
199
+ x,
200
+ y,
201
+ w: cardW,
202
+ h: cardH,
203
+ fill: { color: ctx.colors.cardBg },
204
+ line: { color: ctx.colors.border, width: 1 },
205
+ rectRadius: 0.06,
206
+ });
207
+ // Accent marker (stands in for the icon glyph).
208
+ slide.addShape(ctx.shapeRoundRect, {
209
+ x: x + 0.2,
210
+ y: y + 0.2,
211
+ w: 0.32,
212
+ h: 0.32,
213
+ fill: { color: ctx.colors.accent },
214
+ rectRadius: 0.05,
215
+ });
216
+ const pad = 0.2;
217
+ slide.addText(card.title, {
218
+ x: x + pad,
219
+ y: y + 0.6,
220
+ w: cardW - pad * 2,
221
+ h: 0.5,
222
+ fontFace: ctx.fonts.heading,
223
+ bold: true,
224
+ color: ctx.colors.text,
225
+ fontSize: 16,
226
+ fit: "shrink",
227
+ valign: "top",
228
+ });
229
+ if (card.body) {
230
+ slide.addText(card.body, {
231
+ x: x + pad,
232
+ y: y + 1.1,
233
+ w: cardW - pad * 2,
234
+ h: cardH - 1.25,
235
+ fontFace: ctx.fonts.body,
236
+ color: ctx.colors.muted,
237
+ fontSize: 12,
238
+ fit: "shrink",
239
+ valign: "top",
240
+ lineSpacingMultiple: 1.1,
241
+ });
242
+ }
243
+ });
244
+ }
245
+ function renderDataTable(slide, ctx, data) {
246
+ const top = renderHeaderBlock(slide, ctx, data);
247
+ const headers = Array.isArray(data.columns) ? data.columns : [];
248
+ const rows = data.rows ?? [];
249
+ const tableRows = [];
250
+ if (headers.length > 0) {
251
+ tableRows.push(headers.map((label) => ({
252
+ text: label,
253
+ options: {
254
+ bold: true,
255
+ color: ctx.colors.bg,
256
+ fill: { color: ctx.colors.accent },
257
+ fontFace: ctx.fonts.heading,
258
+ fontSize: 14,
259
+ },
260
+ })));
261
+ }
262
+ for (const row of rows) {
263
+ tableRows.push(row.map((cell) => ({
264
+ text: cell,
265
+ options: { color: ctx.colors.text, fontFace: ctx.fonts.body, fontSize: 13 },
266
+ })));
267
+ }
268
+ if (tableRows.length === 0)
269
+ return;
270
+ slide.addTable(tableRows, {
271
+ x: ctx.margin,
272
+ y: top + 0.1,
273
+ w: ctx.width - ctx.margin * 2,
274
+ border: { type: "solid", color: ctx.colors.border, pt: 1 },
275
+ align: "left",
276
+ valign: "middle",
277
+ autoPage: false,
278
+ rowH: 0.4,
279
+ });
280
+ }
281
+ function renderStatRow(slide, ctx, data) {
282
+ renderHeaderBlock(slide, ctx, data);
283
+ const stats = data.stats ?? [];
284
+ if (stats.length === 0)
285
+ return;
286
+ const gap = 0.4;
287
+ const areaW = ctx.width - ctx.margin * 2;
288
+ const cellW = (areaW - gap * (stats.length - 1)) / stats.length;
289
+ const y = ctx.height * 0.42;
290
+ stats.forEach((stat, i) => {
291
+ const x = ctx.margin + i * (cellW + gap);
292
+ slide.addText(stat.value, {
293
+ x,
294
+ y,
295
+ w: cellW,
296
+ h: 1.0,
297
+ fontFace: ctx.fonts.heading,
298
+ bold: true,
299
+ color: ctx.colors.accent,
300
+ fontSize: 40,
301
+ align: "center",
302
+ valign: "middle",
303
+ fit: "shrink",
304
+ });
305
+ slide.addText(stat.label, {
306
+ x,
307
+ y: y + 1.05,
308
+ w: cellW,
309
+ h: 0.7,
310
+ fontFace: ctx.fonts.body,
311
+ color: ctx.colors.muted,
312
+ fontSize: 14,
313
+ align: "center",
314
+ valign: "top",
315
+ fit: "shrink",
316
+ });
317
+ });
318
+ }
319
+ function renderTimeline(slide, ctx, data) {
320
+ const top = renderHeaderBlock(slide, ctx, data);
321
+ const steps = data.steps ?? [];
322
+ if (steps.length === 0)
323
+ return;
324
+ const areaY = top + 0.1;
325
+ const areaH = ctx.height - areaY - ctx.margin;
326
+ const stepH = areaH / steps.length;
327
+ const badge = 0.4;
328
+ const x = ctx.margin;
329
+ steps.forEach((step, i) => {
330
+ const y = areaY + i * stepH;
331
+ slide.addShape(ctx.shapeOval, {
332
+ x,
333
+ y: y + 0.05,
334
+ w: badge,
335
+ h: badge,
336
+ fill: { color: ctx.colors.accent },
337
+ });
338
+ slide.addText(String(i + 1), {
339
+ x,
340
+ y: y + 0.05,
341
+ w: badge,
342
+ h: badge,
343
+ fontFace: ctx.fonts.heading,
344
+ bold: true,
345
+ color: ctx.colors.bg,
346
+ fontSize: 14,
347
+ align: "center",
348
+ valign: "middle",
349
+ });
350
+ const textX = x + badge + 0.25;
351
+ const textW = ctx.width - textX - ctx.margin;
352
+ slide.addText(step.title, {
353
+ x: textX,
354
+ y,
355
+ w: textW,
356
+ h: 0.4,
357
+ fontFace: ctx.fonts.heading,
358
+ bold: true,
359
+ color: ctx.colors.text,
360
+ fontSize: 16,
361
+ valign: "middle",
362
+ fit: "shrink",
363
+ });
364
+ if (step.body) {
365
+ slide.addText(step.body, {
366
+ x: textX,
367
+ y: y + 0.4,
368
+ w: textW,
369
+ h: stepH - 0.5,
370
+ fontFace: ctx.fonts.body,
371
+ color: ctx.colors.muted,
372
+ fontSize: 13,
373
+ valign: "top",
374
+ fit: "shrink",
375
+ });
376
+ }
377
+ });
378
+ }
379
+ function renderQuote(slide, ctx, data) {
380
+ const x = ctx.margin * 1.5;
381
+ const w = ctx.width - x * 2;
382
+ if (data.quote) {
383
+ slide.addText(`“${data.quote}”`, {
384
+ x,
385
+ y: ctx.height * 0.28,
386
+ w,
387
+ h: 2.4,
388
+ fontFace: ctx.fonts.heading,
389
+ color: ctx.colors.text,
390
+ fontSize: 30,
391
+ italic: true,
392
+ align: "center",
393
+ valign: "middle",
394
+ fit: "shrink",
395
+ });
396
+ }
397
+ if (data.by) {
398
+ slide.addText(`— ${data.by}`, {
399
+ x,
400
+ y: ctx.height * 0.7,
401
+ w,
402
+ h: 0.6,
403
+ fontFace: ctx.fonts.body,
404
+ color: ctx.colors.accent2,
405
+ fontSize: 16,
406
+ bold: true,
407
+ align: "center",
408
+ valign: "top",
409
+ });
410
+ }
411
+ }
412
+ const RENDERERS = {
413
+ title: renderHero,
414
+ closing: renderHero,
415
+ section: renderSection,
416
+ "two-column": renderTwoColumn,
417
+ "feature-grid": renderFeatureGrid,
418
+ "data-table": renderDataTable,
419
+ "stat-row": renderStatRow,
420
+ timeline: renderTimeline,
421
+ quote: renderQuote,
422
+ };
423
+ export function renderSlide(slide, ctx, data) {
424
+ slide.background = { color: ctx.colors.bg };
425
+ const renderer = RENDERERS[data.layout];
426
+ if (!renderer) {
427
+ ctx.warn(`Unknown layout "${data.layout}" — rendered heading/lead only.`);
428
+ renderHero(slide, ctx, data);
429
+ return;
430
+ }
431
+ renderer(slide, ctx, data);
432
+ }
433
+ //# sourceMappingURL=layouts.js.map