canva-pptx 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.
Files changed (87) hide show
  1. package/README.md +1147 -0
  2. package/package.json +63 -0
  3. package/src/AdvancedComponents/accordionList.js +39 -0
  4. package/src/AdvancedComponents/calendarGrid.js +50 -0
  5. package/src/AdvancedComponents/certificateFrame.js +35 -0
  6. package/src/AdvancedComponents/deviceMockup.js +59 -0
  7. package/src/AdvancedComponents/featureGrid.js +70 -0
  8. package/src/AdvancedComponents/funnelDiagram.js +49 -0
  9. package/src/AdvancedComponents/ganttChart.js +35 -0
  10. package/src/AdvancedComponents/invoiceTable.js +32 -0
  11. package/src/AdvancedComponents/matrixGrid.js +43 -0
  12. package/src/AdvancedComponents/mindMap.js +43 -0
  13. package/src/AdvancedComponents/orgChart.js +76 -0
  14. package/src/AdvancedComponents/personaCard.js +44 -0
  15. package/src/AdvancedComponents/processCycle.js +47 -0
  16. package/src/AdvancedComponents/pyramidHierarchy.js +38 -0
  17. package/src/AdvancedComponents/saasFeatureBlock.js +38 -0
  18. package/src/AdvancedComponents/swotMatrix.js +55 -0
  19. package/src/AdvancedComponents/teamMemberProfile.js +75 -0
  20. package/src/AdvancedComponents/trafficLight.js +35 -0
  21. package/src/AdvancedComponents/vennDiagram.js +35 -0
  22. package/src/AdvancedComponents/winLossChart.js +43 -0
  23. package/src/components/StatMetric.js +43 -0
  24. package/src/components/alertBox.js +46 -0
  25. package/src/components/avatarGroup.js +56 -0
  26. package/src/components/badge.js +40 -0
  27. package/src/components/breadcrumbNav.js +31 -0
  28. package/src/components/browserWindow.js +86 -0
  29. package/src/components/brushStroke.js +23 -0
  30. package/src/components/callToAction.js +27 -0
  31. package/src/components/card.js +64 -0
  32. package/src/components/chart.js +19 -0
  33. package/src/components/codeBlock.js +40 -0
  34. package/src/components/codeDiff.js +51 -0
  35. package/src/components/comparisonTable.js +43 -0
  36. package/src/components/cornerAccent.js +32 -0
  37. package/src/components/dotPattern.js +30 -0
  38. package/src/components/geometricConfetti.js +34 -0
  39. package/src/components/gradientMesh.js +32 -0
  40. package/src/components/iconList.js +43 -0
  41. package/src/components/image.js +11 -0
  42. package/src/components/kanbanColumn.js +38 -0
  43. package/src/components/link.js +23 -0
  44. package/src/components/organicBlob.js +45 -0
  45. package/src/components/pricingColumn.js +53 -0
  46. package/src/components/progressBar.js +55 -0
  47. package/src/components/ratingStars.js +25 -0
  48. package/src/components/shape.js +12 -0
  49. package/src/components/slide.js +5 -0
  50. package/src/components/socialBar.js +59 -0
  51. package/src/components/squiggleLine.js +26 -0
  52. package/src/components/stepProcess.js +39 -0
  53. package/src/components/table.js +23 -0
  54. package/src/components/tagCloud.js +39 -0
  55. package/src/components/testimonialCard.js +54 -0
  56. package/src/components/text.js +14 -0
  57. package/src/components/theme.js +7 -0
  58. package/src/components/timeline.js +73 -0
  59. package/src/components/waveDecoration.js +35 -0
  60. package/src/core/PPTManager.js +17 -0
  61. package/src/index.js +225 -0
  62. package/src/layout/bento.js +47 -0
  63. package/src/layout/checkerboard.js +36 -0
  64. package/src/layout/filmStrip.js +29 -0
  65. package/src/layout/gallery.js +50 -0
  66. package/src/layout/grid.js +37 -0
  67. package/src/layout/hero.js +30 -0
  68. package/src/layout/magazine.js +39 -0
  69. package/src/layout/radial.js +34 -0
  70. package/src/layout/sidebar.js +26 -0
  71. package/src/layout/splitScreen.js +36 -0
  72. package/src/layout/zPattern.js +29 -0
  73. package/src/system/animation.js +36 -0
  74. package/src/system/contrastChecker.js +35 -0
  75. package/src/system/dataAdapter.js +36 -0
  76. package/src/system/layoutDebugger.js +40 -0
  77. package/src/system/markdownEngine.js +45 -0
  78. package/src/system/masterOverlay.js +50 -0
  79. package/src/system/sectionDivider.js +41 -0
  80. package/src/system/smartIcon.js +33 -0
  81. package/src/system/smartText.js +44 -0
  82. package/src/system/speakerNotes.js +12 -0
  83. package/src/system/syntaxHighlighter.js +71 -0
  84. package/src/system/themeGenerator.js +25 -0
  85. package/src/system/tocGenerator.js +68 -0
  86. package/src/system/watermark.js +26 -0
  87. package/src/themes/index.js +93 -0
package/README.md ADDED
@@ -0,0 +1,1147 @@
1
+ # canva-pptx
2
+
3
+ **Professional Programmable PowerPoint Generator for Node.js**
4
+
5
+ `canva-pptx` is a high-level, component-based engine built on top of `pptxgenjs`. It transforms PowerPoint generation from a manual coordinate-pushing task into a modular design process. It provides a robust abstraction layer, allowing developers to build complex, branded presentations using reusable components, automated layouts, and theme-driven styling.
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Installation](#installation)
10
+ 2. [Getting Started](#getting-started)
11
+ 3. [Core & Theme System](#core--theme-system)
12
+ 4. [Layout Engines](#layout-engines)
13
+ 5. [Base Components](#base-components)
14
+ 6. [Utility Components](#utility-components)
15
+ 7. [Advanced Components (Standard)](#advanced-components-standard)
16
+ 8. [Advanced Components (Enterprise)](#advanced-components-enterprise)
17
+ 9. [Visual Decorations](#visual-decorations)
18
+ 10. [System Engines & Tools](#system-engines--tools)
19
+
20
+ ---
21
+
22
+ <a name="installation"></a>
23
+ ## Installation
24
+
25
+ Install the package via NPM. This will also install the necessary peer dependencies required for PowerPoint generation.
26
+
27
+ ```bash
28
+ npm install canva-pptx
29
+ ```
30
+
31
+ ---
32
+
33
+ <a name="getting-started"></a>
34
+ ## Getting Started
35
+
36
+ This example initializes the manager, creates a slide, and saves the file. It demonstrates the basic workflow: Instance -> Slide -> Component -> Output.
37
+
38
+ ```javascript
39
+ const { PPTManager, addSlide, addText } = require("canva-pptx");
40
+
41
+ async function main() {
42
+ // Initialize the core manager
43
+ const manager = new PPTManager();
44
+ const pptx = manager.getPptx();
45
+
46
+ // Create a new slide instance
47
+ const slide = addSlide(pptx);
48
+
49
+ // Add a simple text component with absolute positioning
50
+ addText(slide, "Hello World", {
51
+ x: 1, y: 1, w: 8, h: 1,
52
+ fontSize: 24,
53
+ color: "333333",
54
+ align: "center",
55
+ bold: true
56
+ });
57
+
58
+ // Export the generated file to the local file system
59
+ await manager.save("Presentation.pptx");
60
+ }
61
+
62
+ main();
63
+ ```
64
+
65
+ ---
66
+
67
+ <a name="core--theme-system"></a>
68
+ ## Core & Theme System
69
+
70
+ The Theme System allows you to define a design token set (colors, fonts, sizes) once and apply it globally, ensuring brand consistency across hundreds of slides.
71
+
72
+ ### PPTManager
73
+
74
+ The main wrapper class that handles the PptxGenJS instance, file saving, and global configurations.
75
+
76
+ * **Usage**: `new PPTManager()`
77
+ * **Methods**:
78
+ * `getPptx()`: Returns the underlying PptxGenJS instance for direct manipulation if needed.
79
+ * `save(filename)`: Finalizes the presentation and writes the `.pptx` file.
80
+ * `setAuthor(name)`: Sets the metadata for the presentation author.
81
+
82
+ ### registerTheme
83
+
84
+ Registers a new theme configuration globally. You can define multiple themes (e.g., "dark", "corporate") and switch between them at runtime.
85
+
86
+ ```javascript
87
+ registerTheme("corporate", {
88
+ primary: "0078D7",
89
+ secondary: "2B2B2B",
90
+ accent: "FFB900",
91
+ background: "FFFFFF",
92
+ heading: { fontFace: "Arial", bold: true, color: "0078D7", fontSize: 32 },
93
+ body: { fontFace: "Arial", color: "333333", fontSize: 14 },
94
+ spacing: 0.25 // Global padding/margin token
95
+ });
96
+ ```
97
+
98
+ ### getTheme
99
+
100
+ Retrieves a registered theme object. Useful for passing theme values into components dynamically to ensure they match the brand palette.
101
+
102
+ ```javascript
103
+ const theme = getTheme("corporate");
104
+ console.log(theme.primary); // Outputs: 0078D7
105
+ // Example: Use theme color for a custom shape
106
+ addShape(slide, "rect", { x: 1, y: 1, fill: theme.accent });
107
+ ```
108
+
109
+ ### applyTheme
110
+
111
+ Applies the theme's background settings and default text styles to a specific slide. This automates the repetitive task of setting background colors or master slides.
112
+
113
+ ```javascript
114
+ applyTheme(slide, theme); // Sets slide background color and default font families
115
+ ```
116
+
117
+ ---
118
+
119
+ <a name="layout-engines"></a>
120
+ ## Layout Engines
121
+
122
+ Layout engines calculate the X, Y, Width, and Height for elements automatically. Instead of manual math, you describe the *intent* (e.g., "split screen") and the engine does the geometry.
123
+
124
+ ### getHeroLayout
125
+
126
+ Calculates centered coordinates for a title slide (Title and Subtitle). Perfect for opening slides or section headers.
127
+
128
+ * **Options**: `align` ("center" | "left").
129
+
130
+ ```javascript
131
+ const layout = getHeroLayout({ align: "center", margin: 1 });
132
+ addText(slide, "Title", layout.title);
133
+ addText(slide, "Subtitle", { ...layout.subtitle, color: "666666" });
134
+ ```
135
+
136
+ ### getSplitScreen
137
+
138
+ Divides the slide into two vertical or horizontal zones. Great for comparing "Current State" vs "Future State".
139
+
140
+ * **Options**: `type` ("vertical" | "horizontal"), `ratio` (0.0 - 1.0).
141
+
142
+ ```javascript
143
+ const split = getSplitScreen({ type: "vertical", ratio: 0.5 });
144
+ // Left side: Text content
145
+ addText(slide, "Left Side Description", { ...split.left, valign: "middle" });
146
+ // Right side: Supporting visual
147
+ addImage(slide, "img.png", { ...split.right, sizing: { type: "contain" } });
148
+ ```
149
+
150
+ ### getBentoLayout
151
+
152
+ Generates a modern grid of varying box sizes (bento box style). Inspired by Apple-style marketing slides.
153
+
154
+ * **Options**: `feature-left`, `feature-right`, `quadrant`.
155
+
156
+ ```javascript
157
+ const boxes = getBentoLayout("feature-left", { x: 0.5, y: 1, w: 9, h: 4 });
158
+ addText(slide, "Big Box (Main Feature)", boxes[0]); // Large box on left
159
+ addText(slide, "Small Box 1", boxes[1]); // Top-right small box
160
+ addText(slide, "Small Box 2", boxes[2]); // Bottom-right small box
161
+ ```
162
+
163
+ ### getRadialLayout
164
+
165
+ Arranges items in a circle around a central point. Ideal for showing ecosystem cycles or central concepts.
166
+
167
+ * **Parameters**: Count (number), Options (`x`, `y`, `radius`, `itemSize`).
168
+
169
+ ```javascript
170
+ const points = getRadialLayout(5, { x: 5, y: 3, radius: 2, itemSize: 1 });
171
+ points.forEach((pos, index) => {
172
+ addShape(slide, "oval", { ...pos, fill: "0078D7" });
173
+ addText(slide, `Node ${index + 1}`, pos);
174
+ });
175
+ ```
176
+
177
+ ### getMagazineLayout
178
+
179
+ Creates a layout with one large focus area and a sidebar list of smaller items, resembling a magazine feature page.
180
+
181
+ * **Options**: `focusPosition` ("left" | "right").
182
+
183
+ ```javascript
184
+ const mag = getMagazineLayout(3, { focusPosition: "left", margin: 0.5 });
185
+ // mag.focus: The primary content area
186
+ addText(slide, "Feature Article", mag.focus);
187
+ // mag.side: Array of coordinates for smaller supporting items
188
+ mag.side.forEach((pos, i) => addText(slide, `Bullet ${i+1}`, pos));
189
+ ```
190
+
191
+ ### getCheckerboardLayout
192
+
193
+ Creates a zig-zag pattern ideal for alternating text and image rows for high readability.
194
+
195
+ ```javascript
196
+ const rows = getCheckerboardLayout(2, { y: 1, h: 4, margin: 0.2 });
197
+ // Row 1: Text on Left, Media on Right
198
+ addText(slide, "Text Block 1", rows[0].text);
199
+ addImage(slide, "img1.png", rows[0].media);
200
+ // Row 2: Media on Left, Text on Right (Auto-swapped)
201
+ addText(slide, "Text Block 2", rows[1].text);
202
+ ```
203
+
204
+ ### getFilmStripLayout
205
+
206
+ Creates a horizontal row of identical frames, simulating a film strip or a process gallery.
207
+
208
+ ```javascript
209
+ const strips = getFilmStripLayout(4, { x: 0.5, y: 2, w: 9, h: 2, gap: 0.1 });
210
+ strips.forEach((pos, i) => {
211
+ addImage(slide, `step-${i}.png`, pos);
212
+ addText(slide, `Step ${i+1}`, { ...pos, y: pos.y + pos.h });
213
+ });
214
+ ```
215
+
216
+ ### createGrid
217
+
218
+ Generates a standard uniform grid layout with customizable rows, columns, and gutters.
219
+
220
+ ```javascript
221
+ const grid = createGrid({ rows: 2, cols: 2, x: 1, y: 1, w: 8, h: 4, gap: 0.2 });
222
+ // grid[0] is top-left, grid[1] is top-right, grid[2] is bottom-left, etc.
223
+ grid.forEach((cell, i) => addShape(slide, "rect", { ...cell, line: { color: "CCC" } }));
224
+ ```
225
+
226
+ ### getZPattern
227
+
228
+ Generates a layout optimized for scanning content in a 'Z' shape (Top-Left, Top-Right, Bottom-Left, Bottom-Right), which follows natural eye movement.
229
+
230
+ ```javascript
231
+ const zLayout = getZPattern({ margin: 0.5, topH: 1, bottomH: 1 });
232
+ addText(slide, "Headline", zLayout.topLeft);
233
+ addText(slide, "Logo/Icon", zLayout.topRight);
234
+ addText(slide, "Description", zLayout.bottomLeft);
235
+ addText(slide, "CTA Button", zLayout.bottomRight);
236
+ ```
237
+
238
+ ### getSidebarLayout
239
+
240
+ Creates a layout with a dedicated narrow sidebar for navigation or summary and a large main content area.
241
+
242
+ ```javascript
243
+ const layout = getSidebarLayout({ width: 2.5, position: "left", gap: 0.3 });
244
+ addText(slide, "Navigation / Metadata", { ...layout.sidebar, fill: "F1F1F1" });
245
+ addText(slide, "Main Body Content", layout.content);
246
+ ```
247
+
248
+ ### getGalleryLayout
249
+
250
+ Creates a layout optimized for displaying multiple images in a pleasing grid with uniform spacing.
251
+
252
+ ```javascript
253
+ const frames = getGalleryLayout(6, { x: 0.5, y: 1, w: 9, h: 4, cols: 3 });
254
+ frames.forEach((frame, i) => {
255
+ addImage(slide, `photo-${i}.jpg`, { ...frame, sizing: { type: "cover" } });
256
+ });
257
+ ```
258
+
259
+ ---
260
+
261
+ <a name="base-components"></a>
262
+ ## Base Components
263
+
264
+ Base components map directly to PptxGenJS primitives but are enhanced with theme awareness and simplified APIs.
265
+
266
+ ### addSlide
267
+
268
+ Creates and returns a new slide object within the presentation instance.
269
+
270
+ ```javascript
271
+ const slide = addSlide(pptx);
272
+ // You can also pass a master slide name
273
+ const masterSlide = addSlide(pptx, { masterName: "TITLE_SLIDE" });
274
+ ```
275
+
276
+ ### addText
277
+
278
+ Renders text. Supports all standard formatting options including alignment, bullets, and shadow.
279
+
280
+ ```javascript
281
+ addText(slide, "Hello World", {
282
+ x: 1, y: 1, w: 5, h: 1,
283
+ fontSize: 18,
284
+ color: "333333",
285
+ align: "center",
286
+ valign: "middle"
287
+ });
288
+ ```
289
+
290
+ ### addImage
291
+
292
+ Renders an image from a local path, base64 string, or URL.
293
+
294
+ ```javascript
295
+ addImage(slide, "./photo.jpg", {
296
+ x: 1, y: 1, w: 4, h: 3,
297
+ sizing: { type: "cover", w: 4, h: 3 },
298
+ rounding: true // Adds rounded corners
299
+ });
300
+ ```
301
+
302
+ ### addShape
303
+
304
+ Renders a geometric shape (rect, oval, line, etc.). Useful for background accents and diagrams.
305
+
306
+ ```javascript
307
+ addShape(slide, "rect", {
308
+ x: 1, y: 1, w: 2, h: 2,
309
+ fill: { color: "FF0000", transparency: 50 },
310
+ line: { color: "000000", width: 2 }
311
+ });
312
+ ```
313
+
314
+ ### addTable
315
+
316
+ Renders a data table with automatic row/column styling based on the current theme.
317
+
318
+ ```javascript
319
+ addTable(slide, [
320
+ ["Header 1", "Header 2"],
321
+ ["Row 1 Col 1", "Row 1 Col 2"]
322
+ ], {
323
+ x: 1, y: 1, w: 8,
324
+ colW: [4, 4],
325
+ border: { type: "solid", color: "CCCCCC" }
326
+ });
327
+ ```
328
+
329
+ ### addChart
330
+
331
+ Renders a chart (bar, pie, line, scatter). Wraps the complex PptxGenJS chart API into a cleaner interface.
332
+
333
+ ```javascript
334
+ addChart(slide, "bar", [
335
+ { name: "Projected", values: [10, 20, 30] },
336
+ { name: "Actual", values: [12, 18, 29] }
337
+ ], {
338
+ x: 1, y: 1, w: 6, h: 3,
339
+ showLegend: true,
340
+ chartColors: ["0078D7", "FFB900"]
341
+ });
342
+ ```
343
+
344
+ ### addCard
345
+
346
+ Renders a content card with a Title and Body text inside a stylized container (box with shadow/border).
347
+
348
+ ```javascript
349
+ addCard(slide, {
350
+ title: "Project Milestone",
351
+ body: "The project has reached 50% completion as of October.",
352
+ x: 1, y: 1, w: 3, h: 2,
353
+ theme: "light",
354
+ shadow: true
355
+ });
356
+ ```
357
+
358
+ ### addLink
359
+
360
+ Adds a hyperlink to text or shapes, allowing for interactive presentations or external references.
361
+
362
+ ```javascript
363
+ addLink(slide, "Visit Documentation", "https://github.com/fairoz-539/canva-pptx", {
364
+ x: 1, y: 1,
365
+ fontSize: 12,
366
+ color: "0000FF",
367
+ underline: true
368
+ });
369
+ ```
370
+
371
+ ---
372
+
373
+ <a name="utility-components"></a>
374
+ ## Utility Components
375
+
376
+ ### addBrowserWindow
377
+
378
+ Wraps content or an image in a container that resembles a web browser frame. Perfect for software demos and UI/UX presentations.
379
+
380
+ ```javascript
381
+ addBrowserWindow(slide, {
382
+ x: 1, y: 1, w: 8, h: 5,
383
+ url: "https://mysite.com/dashboard",
384
+ imagePath: "./screenshot.png",
385
+ browserColor: "E0E0E0"
386
+ });
387
+ ```
388
+
389
+ ### addSocialBar
390
+
391
+ Renders a row of social media icons (LinkedIn, Twitter, etc.). Useful for contact or "About Us" slides.
392
+
393
+ ```javascript
394
+ addSocialBar(slide, [
395
+ { type: "linkedin", url: "https://linkedin.com/in/fairoz" },
396
+ { type: "twitter", url: "https://twitter.com/fairoz" },
397
+ { type: "github", url: "https://github.com/fairoz-539" }
398
+ ], { x: 1, y: 5, iconSize: 0.4 });
399
+ ```
400
+
401
+ ### addCodeDiff
402
+
403
+ Renders a code block that highlights additions (green) and deletions (red). Essential for technical reviews and developer updates.
404
+
405
+ ```javascript
406
+ const diff = `- var x = 1;\n+ const x = 2;`;
407
+ addCodeDiff(slide, diff, {
408
+ x: 1, y: 1, w: 6, h: 4,
409
+ fontSize: 10,
410
+ title: "refactor(core): update variable declaration"
411
+ });
412
+ ```
413
+
414
+ ---
415
+
416
+ <a name="advanced-components-standard"></a>
417
+ ## Advanced Components (Standard)
418
+
419
+ ### addProgressBar
420
+
421
+ Visualizes a percentage value as a horizontal bar. Useful for status reports and project tracking.
422
+
423
+ ```javascript
424
+ addProgressBar(slide, 75, {
425
+ x: 1, y: 1, w: 5, h: 0.3,
426
+ color: "007AFF",
427
+ trackColor: "E5E5EA",
428
+ label: "Overall Progress: 75%"
429
+ });
430
+ ```
431
+
432
+ ### addStatMetric
433
+
434
+ Displays a large number with a descriptive label below it. Ideal for KPIs, financial results, and impact metrics.
435
+
436
+ ```javascript
437
+ addStatMetric(slide, {
438
+ value: "$10M",
439
+ label: "Annual Revenue",
440
+ x: 1, y: 1, w: 3, h: 2,
441
+ color: "28A745"
442
+ });
443
+ ```
444
+
445
+ ### addBadge
446
+
447
+ Renders a small pill-shaped tag with text. Used for status indicators (e.g., "New", "Stable", "In Progress").
448
+
449
+ ```javascript
450
+ addBadge(slide, "BETA", {
451
+ x: 1, y: 1,
452
+ color: "FFFFFF",
453
+ backgroundColor: "6F42C1",
454
+ fontSize: 10
455
+ });
456
+ ```
457
+
458
+ ### addCodeBlock
459
+
460
+ Renders a standard block of code with a dark background and syntax-like coloring for readability.
461
+
462
+ ```javascript
463
+ addCodeBlock(slide, "function init() {\n console.log('App Started');\n}", {
464
+ x: 1, y: 1, w: 6, h: 3,
465
+ language: "javascript"
466
+ });
467
+ ```
468
+
469
+ ### addTimeline
470
+
471
+ Renders a linear timeline with milestones. Perfect for roadmaps and historical overviews.
472
+
473
+ ```javascript
474
+ addTimeline(slide, [
475
+ { date: "Q1 2023", title: "Inception", desc: "Project Kickoff" },
476
+ { date: "Q3 2023", title: "Beta", desc: "First release" },
477
+ { date: "Q1 2024", title: "Launch", desc: "Global rollout" }
478
+ ], { x: 1, y: 2, w: 8, color: "0078D7" });
479
+ ```
480
+
481
+ ### addAvatarGroup
482
+
483
+ Renders overlapping circles with initials or images to represent a team or group of contributors.
484
+
485
+ ```javascript
486
+ addAvatarGroup(slide, [
487
+ { initials: "FA", color: "FF5733" },
488
+ { initials: "JD", color: "33FF57" },
489
+ { initials: "SK", color: "3357FF" }
490
+ ], { x: 1, y: 1, size: 0.6 });
491
+ ```
492
+
493
+ ### addTestimonialCard
494
+
495
+ Renders a quote with author attribution, styling, and optional profile image.
496
+
497
+ ```javascript
498
+ addTestimonialCard(slide, "The best automation tool we've used!", "Jane Doe, CTO", {
499
+ x: 1, y: 1, w: 5, h: 2.5,
500
+ quoteColor: "666666"
501
+ });
502
+ ```
503
+
504
+ ### addAlertBox
505
+
506
+ Renders a colored box for warnings, errors, or success messages.
507
+
508
+ ```javascript
509
+ addAlertBox(slide, "Session Timeout: Please log in again.", "warning", {
510
+ x: 1, y: 1, w: 6,
511
+ showIcon: true
512
+ });
513
+ ```
514
+
515
+ ### addIconList
516
+
517
+ Renders a vertical list where each item has a custom bullet icon instead of standard dots.
518
+
519
+ ```javascript
520
+ addIconList(slide, ["Secure Encryption", "Cloud Sync", "Offline Mode"], {
521
+ x: 1, y: 1, w: 4,
522
+ icon: "check",
523
+ iconColor: "28A745"
524
+ });
525
+ ```
526
+
527
+ ### addPricingColumn
528
+
529
+ Renders a pricing tier card (e.g., Basic, Pro) with a price, features, and a CTA area.
530
+
531
+ ```javascript
532
+ addPricingColumn(slide, {
533
+ name: "Enterprise",
534
+ price: "$99/mo",
535
+ features: ["Unlimited Users", "24/7 Support", "Custom API"],
536
+ highlight: true
537
+ }, { x: 1, y: 1, w: 2.5, h: 4.5 });
538
+ ```
539
+
540
+ ### addStepProcess
541
+
542
+ Visualizes a linear step-by-step process with connecting arrows or lines.
543
+
544
+ ```javascript
545
+ addStepProcess(slide, ["Design", "Develop", "Test", "Deploy"], {
546
+ x: 1, y: 2, w: 8,
547
+ activeStep: 2 // Highlights 'Develop'
548
+ });
549
+ ```
550
+
551
+ ### addComparisonTable
552
+
553
+ Renders a feature comparison table (e.g., Free vs Paid) with checkmarks and cross symbols.
554
+
555
+ ```javascript
556
+ addComparisonTable(slide, {
557
+ headers: ["Features", "Free", "Premium"],
558
+ rows: [
559
+ ["HD Video", false, true],
560
+ ["Cloud Storage", "1GB", "Unlimited"]
561
+ ]
562
+ }, { x: 1, y: 1, w: 7 });
563
+ ```
564
+
565
+ ### addRatingStars
566
+
567
+ Renders a star rating (0-5) visually using vector shapes. Supports partial stars (e.g., 4.5).
568
+
569
+ ```javascript
570
+ addRatingStars(slide, 4.7, {
571
+ x: 1, y: 1,
572
+ size: 0.4,
573
+ color: "FFD700",
574
+ totalStars: 5
575
+ });
576
+ ```
577
+
578
+ ### addBreadcrumbNav
579
+
580
+ Renders a navigation path (Home > Section > Page) to provide context in large presentations.
581
+
582
+ ```javascript
583
+ addBreadcrumbNav(slide, ["Settings", "Security", "2FA Setup"], {
584
+ x: 0.5, y: 0.5,
585
+ activeColor: "0078D7"
586
+ });
587
+ ```
588
+
589
+ ### addTagCloud
590
+
591
+ Renders a cluster of keywords or tags with randomized or weighted sizes.
592
+
593
+ ```javascript
594
+ addTagCloud(slide, ["React", "Node.js", "TypeScript", "PowerPoint", "Automation"], {
595
+ x: 1, y: 1, w: 6,
596
+ colors: ["333", "666", "999"]
597
+ });
598
+ ```
599
+
600
+ ### addKanbanColumn
601
+
602
+ Renders a task column (like Trello/Jira) with individual cards nested inside.
603
+
604
+ ```javascript
605
+ addKanbanColumn(slide, "In Progress", [
606
+ { title: "Fix Auth Bug", priority: "High" },
607
+ { title: "Update Docs", priority: "Low" }
608
+ ], { x: 1, y: 1, w: 2.8, h: 5 });
609
+ ```
610
+
611
+ ### addCallToAction
612
+
613
+ Renders a prominent button-style link to prompt user interaction or external navigation.
614
+
615
+ ```javascript
616
+ addCallToAction(slide, "Get Started Now", "https://example.com/signup", {
617
+ x: 4, y: 3, w: 2.5,
618
+ backgroundColor: "0078D7",
619
+ color: "FFFFFF"
620
+ });
621
+ ```
622
+
623
+ ---
624
+
625
+ <a name="advanced-components-enterprise"></a>
626
+ ## Advanced Components (Enterprise)
627
+
628
+ ### addFeatureGrid
629
+
630
+ Renders a grid of small blocks, each containing an icon, title, and description. Ideal for product feature pages.
631
+
632
+ ```javascript
633
+ addFeatureGrid(slide, [
634
+ { title: "Real-time", desc: "Collaborate instantly.", icon: "clock" },
635
+ { title: "Secure", desc: "End-to-end encryption.", icon: "lock" }
636
+ ], { x: 1, y: 1, w: 8, columns: 2 });
637
+ ```
638
+
639
+ ### addTeamMemberProfile
640
+
641
+ Renders a detailed profile card for a team member with a bio, role, and contact info.
642
+
643
+ ```javascript
644
+ addTeamMemberProfile(slide, {
645
+ name: "Jane Smith",
646
+ role: "Lead Engineer",
647
+ bio: "Expert in Node.js and cloud architecture.",
648
+ image: "jane.jpg"
649
+ }, { x: 1, y: 1, w: 3 });
650
+ ```
651
+
652
+ ### addSWOTMatrix
653
+
654
+ Renders a 2x2 grid for Strengths, Weaknesses, Opportunities, and Threats analysis.
655
+
656
+ ```javascript
657
+ addSWOTMatrix(slide, {
658
+ strengths: ["Strong Brand", "Patented Tech"],
659
+ weaknesses: ["High Costs"],
660
+ opportunities: ["Market Expansion"],
661
+ threats: ["New Regulations"]
662
+ }, { x: 1, y: 1, w: 8, h: 4.5 });
663
+ ```
664
+
665
+ ### addProcessCycle
666
+
667
+ Renders a circular flow of steps, useful for continuous improvement (PDCA) or lifecycle cycles.
668
+
669
+ ```javascript
670
+ addProcessCycle(slide, ["Discovery", "Definition", "Design", "Delivery"], {
671
+ x: 4, y: 3,
672
+ radius: 2.2,
673
+ arrowStyle: "curved"
674
+ });
675
+ ```
676
+
677
+ ### addFunnelDiagram
678
+
679
+ Renders a sales or marketing funnel visualization with widening stages.
680
+
681
+ ```javascript
682
+ addFunnelDiagram(slide, [
683
+ { label: "Awareness", value: "5000" },
684
+ { label: "Consideration", value: "1200" },
685
+ { label: "Conversion", value: "300" }
686
+ ], { x: 3, y: 1, w: 4, h: 4, fill: ["D1E9FF", "74B9FF", "0984E3"] });
687
+ ```
688
+
689
+ ### addPyramidHierarchy
690
+
691
+ Renders a pyramid divided into levels to show organizational or conceptual hierarchy.
692
+
693
+ ```javascript
694
+ addPyramidHierarchy(slide, ["Executive", "Management", "Operations"], {
695
+ x: 3, y: 1, w: 4, h: 4,
696
+ direction: "up"
697
+ });
698
+ ```
699
+
700
+ ### addDeviceMockup
701
+
702
+ Renders a device frame (phone, tablet, or laptop) with a custom image inside the screen area.
703
+
704
+ ```javascript
705
+ addDeviceMockup(slide, "laptop", "dashboard-preview.png", {
706
+ x: 2, y: 1, h: 4,
707
+ frameColor: "333333"
708
+ });
709
+ ```
710
+
711
+ ### addAccordionList
712
+
713
+ Renders a list that looks like an open/closed accordion menu, useful for FAQs or technical specs.
714
+
715
+ ```javascript
716
+ addAccordionList(slide, [
717
+ { title: "How it works?", content: "It uses PptxGenJS under the hood.", open: true },
718
+ { title: "Is it free?", content: "Yes, licensed under MIT." }
719
+ ], { x: 1, y: 1, w: 6 });
720
+ ```
721
+
722
+ ### addTrafficLight
723
+
724
+ Renders a Red/Yellow/Green status indicator, perfect for project health dashboards.
725
+
726
+ ```javascript
727
+ addTrafficLight(slide, "yellow", {
728
+ x: 1, y: 1,
729
+ label: "At Risk",
730
+ orientation: "horizontal"
731
+ });
732
+ ```
733
+
734
+ ### addVennDiagram
735
+
736
+ Renders overlapping circles (2 or 3 sets) to show relationships and commonalities.
737
+
738
+ ```javascript
739
+ addVennDiagram(slide, ["Sales", "Marketing", "Product"], {
740
+ x: 3, y: 2,
741
+ radius: 1.5,
742
+ opacity: 0.6
743
+ });
744
+ ```
745
+
746
+ ### addOrgChart
747
+
748
+ Renders a hierarchical tree (Parent -> Children) automatically. Handles line routing and node spacing.
749
+
750
+ ```javascript
751
+ addOrgChart(slide, {
752
+ name: "CEO",
753
+ children: [
754
+ { name: "VP Sales", children: [{ name: "AE" }] },
755
+ { name: "VP Eng", children: [{ name: "Staff Eng" }] }
756
+ ]
757
+ }, { x: 1, y: 1, w: 8, h: 4 });
758
+ ```
759
+
760
+ ### addCalendarGrid
761
+
762
+ Renders a monthly calendar view with highlighted events and color-coded days.
763
+
764
+ ```javascript
765
+ addCalendarGrid(slide, "December 2025", [
766
+ { day: 25, title: "Holiday", color: "FF0000" },
767
+ { day: 31, title: "NYE Party", color: "00FF00" }
768
+ ], { x: 1, y: 1, w: 7, h: 5 });
769
+ ```
770
+
771
+ ### addGanttChart
772
+
773
+ Renders a project timeline with horizontal bars indicating duration, dependencies, and progress.
774
+
775
+ ```javascript
776
+ addGanttChart(slide, [
777
+ { name: "Phase A", start: 0, end: 0.4, progress: 100 },
778
+ { name: "Phase B", start: 0.4, end: 0.9, progress: 20 }
779
+ ], { x: 1, y: 1, w: 8, h: 4 });
780
+ ```
781
+
782
+ ### addPersonaCard
783
+
784
+ Renders a UX persona profile including a photo, goals, frustrations, and personality traits.
785
+
786
+ ```javascript
787
+ addPersonaCard(slide, {
788
+ name: "Alex the Admin",
789
+ role: "IT Manager",
790
+ goals: ["Efficiency", "Security"],
791
+ frustrations: ["Slow legacy tools"]
792
+ }, { x: 1, y: 1, w: 4.5, h: 5 });
793
+ ```
794
+
795
+ ### addMatrixGrid
796
+
797
+ Renders a 2x2 consulting matrix (e.g., Eisenhower Matrix, Impact/Effort) with labeled axes.
798
+
799
+ ```javascript
800
+ addMatrixGrid(slide, ["Do First", "Schedule", "Delegate", "Eliminate"], {
801
+ x: 2, y: 1, w: 6, h: 4,
802
+ xAxis: "Urgency",
803
+ yAxis: "Importance"
804
+ });
805
+ ```
806
+
807
+ ### addMindMap
808
+
809
+ Renders a central node with branching child nodes in a spider-diagram style.
810
+
811
+ ```javascript
812
+ addMindMap(slide, "New Product", ["Market Research", "Design", "Pricing", "Launch"], {
813
+ x: 2, y: 1, w: 6, h: 4,
814
+ nodeColor: "E1F5FE"
815
+ });
816
+ ```
817
+
818
+ ### addInvoiceTable
819
+
820
+ Renders a formal financial table with itemized lines and a calculated total/tax row.
821
+
822
+ ```javascript
823
+ addInvoiceTable(slide, [
824
+ { desc: "Consulting", qty: 10, rate: 150 },
825
+ { desc: "Design", qty: 5, rate: 100 }
826
+ ], { x: 1, y: 1, w: 7, currency: "$" });
827
+ ```
828
+
829
+ ### addCertificateFrame
830
+
831
+ Renders a decorative border, formal typography, and seal area for awards or recognition.
832
+
833
+ ```javascript
834
+ addCertificateFrame(slide, "John Smith", "Outstanding Achievement in Sales 2025", {
835
+ date: "2026-01-01",
836
+ signatureName: "CEO Name"
837
+ });
838
+ ```
839
+
840
+ ### addSaaSFeatureBlock
841
+
842
+ Renders a side-by-side Image + Text layout block for modern feature explanations.
843
+
844
+ ```javascript
845
+ addSaaSFeatureBlock(slide, "Cloud Sync", "Your data is always available.", "cloud.png", {
846
+ x: 1, y: 1,
847
+ imageSide: "right"
848
+ });
849
+ ```
850
+
851
+ ### addWinLossChart
852
+
853
+ Renders a diverging bar chart showing positive vs negative values, ideal for quarterly performance.
854
+
855
+ ```javascript
856
+ addWinLossChart(slide, [
857
+ { label: "Jan", value: 15 },
858
+ { label: "Feb", value: -10 },
859
+ { label: "Mar", value: 25 }
860
+ ], { x: 1, y: 1, w: 7, h: 3 });
861
+ ```
862
+
863
+ ---
864
+
865
+ <a name="visual-decorations"></a>
866
+ ## Visual Decorations
867
+
868
+ ### addOrganicBlob
869
+
870
+ Adds fluid, organic SVG-style shapes to the background to break the "square" feel of PowerPoint.
871
+
872
+ ```javascript
873
+ addOrganicBlob(slide, {
874
+ x: -1, y: -1,
875
+ size: 4,
876
+ color: "E3F2FD",
877
+ opacity: 0.4,
878
+ seed: 123 // Ensures consistent shape generation
879
+ });
880
+ ```
881
+
882
+ ### addWaveDecoration
883
+
884
+ Adds a wave graphic at the bottom or top of the slide for a modern web-design aesthetic.
885
+
886
+ ```javascript
887
+ addWaveDecoration(slide, {
888
+ position: "bottom",
889
+ color: "007AFF",
890
+ height: 1.5,
891
+ frequency: 2
892
+ });
893
+ ```
894
+
895
+ ### addDotPattern
896
+
897
+ Adds a grid of subtle dots to provide background texture and professional depth.
898
+
899
+ ```javascript
900
+ addDotPattern(slide, {
901
+ x: 0, y: 0, w: 10, h: 5.6,
902
+ color: "EEEEEE",
903
+ spacing: 0.2,
904
+ dotSize: 0.02
905
+ });
906
+ ```
907
+
908
+ ### addBrushStroke
909
+
910
+ Adds a paint-brush effect behind text or images to highlight key sections with an "artistic" touch.
911
+
912
+ ```javascript
913
+ addBrushStroke(slide, {
914
+ x: 1, y: 1, w: 4, h: 1.2,
915
+ color: "FFF9C4",
916
+ angle: -2
917
+ });
918
+ ```
919
+
920
+ ### addGeometricConfetti
921
+
922
+ Scatters small geometric shapes (triangles, circles, squares) for a celebratory or high-energy look.
923
+
924
+ ```javascript
925
+ addGeometricConfetti(slide, {
926
+ count: 40,
927
+ colors: ["#FF5252", "#FFEB3B", "#2196F3"],
928
+ spread: "full"
929
+ });
930
+ ```
931
+
932
+ ### addGradientMesh
933
+
934
+ Adds a blurry, multi-color gradient background (mesh gradient) for a premium, high-end feel.
935
+
936
+ ```javascript
937
+ addGradientMesh(slide, {
938
+ colors: ["FF8A80", "FFD180", "80D8FF"],
939
+ steps: 10
940
+ });
941
+ ```
942
+
943
+ ### addSquiggleLine
944
+
945
+ Adds a hand-drawn wavy line separator to add personality and a human touch to the design.
946
+
947
+ ```javascript
948
+ addSquiggleLine(slide, {
949
+ x: 1, y: 2.5, w: 8,
950
+ color: "333333",
951
+ weight: 2
952
+ });
953
+ ```
954
+
955
+ ### addCornerAccent
956
+
957
+ Adds a decorative geometric shape to a specific corner of the slide to frame the content.
958
+
959
+ ```javascript
960
+ addCornerAccent(slide, "top-right", {
961
+ color: "0078D7",
962
+ size: 1.5,
963
+ style: "triangle"
964
+ });
965
+ ```
966
+
967
+ ---
968
+
969
+ <a name="system-engines--tools"></a>
970
+ ## System Engines & Tools
971
+
972
+ ### renderMarkdown
973
+
974
+ Parses a Markdown string and generates slides automatically. It maps `#` to new slides, `##` to headers, and `-` to bullet points.
975
+
976
+ ```javascript
977
+ const md = `
978
+ # Welcome Slide
979
+ This is an automated presentation.
980
+
981
+ # Feature List
982
+ - Automatic Generation
983
+ - Theme Support
984
+ - Easy API
985
+ `;
986
+ renderMarkdown(manager, md, { theme: "corporate" });
987
+ ```
988
+
989
+ ### addTableOfContents / addToTOC
990
+
991
+ Builds an agenda slide dynamically. You call `addToTOC` during the generation process, and then `addTableOfContents` generates the summary slide.
992
+
993
+ ```javascript
994
+ addToTOC("Introduction", 1);
995
+ addToTOC("Market Analysis", 5);
996
+ // ... later
997
+ addTableOfContents(manager, {
998
+ title: "Agenda",
999
+ columns: 2,
1000
+ showPageNumbers: true
1001
+ });
1002
+ ```
1003
+
1004
+ ### applyMaster
1005
+
1006
+ Applies a global master overlay (footer, logo, page numbers, confidentiality watermarks) to a specific slide.
1007
+
1008
+ ```javascript
1009
+ applyMaster(slide, {
1010
+ footer: "© 2026 Canva-PPTX Inc.",
1011
+ showPageNumber: true,
1012
+ logoPath: "./logo.png"
1013
+ });
1014
+ ```
1015
+
1016
+ ### addSmartIcon
1017
+
1018
+ Renders an icon from integrated libraries (like FontAwesome or Lucide) by name.
1019
+
1020
+ ```javascript
1021
+ addSmartIcon(slide, "home", {
1022
+ x: 1, y: 1,
1023
+ size: 0.5,
1024
+ color: "333333"
1025
+ });
1026
+ ```
1027
+
1028
+ ### addSmartText
1029
+
1030
+ Renders text with intelligent resizing logic—it automatically shrinks the font size if the text exceeds the container height.
1031
+
1032
+ ```javascript
1033
+ addSmartText(slide, "This is a very long title that might overflow the box...", {
1034
+ x: 1, y: 1, w: 4, h: 1,
1035
+ minFontSize: 10,
1036
+ maxFontSize: 24
1037
+ });
1038
+ ```
1039
+
1040
+ ### jsonToTableData / csvToTableData
1041
+
1042
+ Converts raw data formats (JSON/CSV) into the specific 2D array format required by PptxGenJS tables.
1043
+
1044
+ ```javascript
1045
+ const tableData = csvToTableData("ID,Name,Status\n1,App,Active\n2,API,Pending");
1046
+ addTable(slide, tableData, { x: 1, y: 1 });
1047
+ ```
1048
+
1049
+ ### jsonToChartData
1050
+
1051
+ Converts raw JSON arrays into the complex data series format required for PptxGenJS charts.
1052
+
1053
+ ```javascript
1054
+ const raw = [{ month: "Jan", val: 10 }, { month: "Feb", val: 20 }];
1055
+ const chartData = jsonToChartData(raw, "month", "val");
1056
+ addChart(slide, "line", chartData, { x: 1, y: 1 });
1057
+ ```
1058
+
1059
+ ### animate
1060
+
1061
+ Applies entrance or exit animations (Fade, Fly In, Zoom) to slide elements for dynamic presentations.
1062
+
1063
+ ```javascript
1064
+ const text = addText(slide, "Animate Me", { x: 1, y: 1 });
1065
+ animate(slide, text, "fadeIn", { duration: 500, delay: 200 });
1066
+ ```
1067
+
1068
+ ### debugSlide
1069
+
1070
+ Draws a visible coordinate grid (inches) and borders on all elements to help you align layouts during development.
1071
+
1072
+ ```javascript
1073
+ debugSlide(slide, {
1074
+ showGrid: true,
1075
+ gridColor: "FF0000",
1076
+ opacity: 0.1
1077
+ });
1078
+ ```
1079
+
1080
+ ### addSpeakerNotes
1081
+
1082
+ Adds invisible text notes to the slide that are only visible in Presenter Mode.
1083
+
1084
+ ```javascript
1085
+ addSpeakerNotes(slide, "Key talking point: Remind the audience about the 20% growth.");
1086
+ ```
1087
+
1088
+ ### generateTheme
1089
+
1090
+ Helper to generate a full color palette (light, dark, muted, secondary) from a single base brand color using HSL math.
1091
+
1092
+ ```javascript
1093
+ const palette = generateTheme("007AFF");
1094
+ // Result: { main: "007AFF", light: "E3F2FD", dark: "004A99", ... }
1095
+ ```
1096
+
1097
+ ### addWatermark
1098
+
1099
+ Stamps text across the slide background at an angle (e.g., "DRAFT", "CONFIDENTIAL", "INTERNAL ONLY").
1100
+
1101
+ ```javascript
1102
+ addWatermark(slide, "DRAFT", {
1103
+ color: "CCCCCC",
1104
+ opacity: 0.15,
1105
+ fontSize: 100,
1106
+ angle: 45
1107
+ });
1108
+ ```
1109
+
1110
+ ### addSectionDivider
1111
+
1112
+ Automatically creates a standalone slide acting as a chapter break with a large centered title and contrasting background.
1113
+
1114
+ ```javascript
1115
+ addSectionDivider(manager, "Chapter 1", "The Foundation of Our Strategy", {
1116
+ theme: "dark"
1117
+ });
1118
+ ```
1119
+
1120
+ ### checkContrast
1121
+
1122
+ Calculates the contrast ratio between two hex colors and logs a warning to the console if the text is not readable per WCAG accessibility standards.
1123
+
1124
+ ```javascript
1125
+ checkContrast("Headline", "FFFFFF", "0078D7"); // Returns contrast ratio and pass/fail
1126
+ ```
1127
+
1128
+ ---
1129
+
1130
+ ## License
1131
+
1132
+ This project is licensed under the **MIT License**. You are free to use, modify, and distribute this software as permitted by the license terms.
1133
+
1134
+ ## Support & Contributing
1135
+
1136
+ We welcome contributions to `canva-pptx`!
1137
+
1138
+ * **Report Bugs**: Please use the GitHub Issues tab to report bugs or request features.
1139
+ * **Submit Pull Requests**: Fork the repository and submit a PR for review.
1140
+ * **Contact**: For enterprise support or specific feature requests, please contact the author via GitHub.
1141
+
1142
+ ## Author
1143
+
1144
+ **Fairoz Ahmed** GitHub: [https://github.com/fairoz-539](https://github.com/fairoz-539)
1145
+
1146
+ ---
1147
+ *Built with logic, designed for business.*