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.
- package/README.md +1147 -0
- package/package.json +63 -0
- package/src/AdvancedComponents/accordionList.js +39 -0
- package/src/AdvancedComponents/calendarGrid.js +50 -0
- package/src/AdvancedComponents/certificateFrame.js +35 -0
- package/src/AdvancedComponents/deviceMockup.js +59 -0
- package/src/AdvancedComponents/featureGrid.js +70 -0
- package/src/AdvancedComponents/funnelDiagram.js +49 -0
- package/src/AdvancedComponents/ganttChart.js +35 -0
- package/src/AdvancedComponents/invoiceTable.js +32 -0
- package/src/AdvancedComponents/matrixGrid.js +43 -0
- package/src/AdvancedComponents/mindMap.js +43 -0
- package/src/AdvancedComponents/orgChart.js +76 -0
- package/src/AdvancedComponents/personaCard.js +44 -0
- package/src/AdvancedComponents/processCycle.js +47 -0
- package/src/AdvancedComponents/pyramidHierarchy.js +38 -0
- package/src/AdvancedComponents/saasFeatureBlock.js +38 -0
- package/src/AdvancedComponents/swotMatrix.js +55 -0
- package/src/AdvancedComponents/teamMemberProfile.js +75 -0
- package/src/AdvancedComponents/trafficLight.js +35 -0
- package/src/AdvancedComponents/vennDiagram.js +35 -0
- package/src/AdvancedComponents/winLossChart.js +43 -0
- package/src/components/StatMetric.js +43 -0
- package/src/components/alertBox.js +46 -0
- package/src/components/avatarGroup.js +56 -0
- package/src/components/badge.js +40 -0
- package/src/components/breadcrumbNav.js +31 -0
- package/src/components/browserWindow.js +86 -0
- package/src/components/brushStroke.js +23 -0
- package/src/components/callToAction.js +27 -0
- package/src/components/card.js +64 -0
- package/src/components/chart.js +19 -0
- package/src/components/codeBlock.js +40 -0
- package/src/components/codeDiff.js +51 -0
- package/src/components/comparisonTable.js +43 -0
- package/src/components/cornerAccent.js +32 -0
- package/src/components/dotPattern.js +30 -0
- package/src/components/geometricConfetti.js +34 -0
- package/src/components/gradientMesh.js +32 -0
- package/src/components/iconList.js +43 -0
- package/src/components/image.js +11 -0
- package/src/components/kanbanColumn.js +38 -0
- package/src/components/link.js +23 -0
- package/src/components/organicBlob.js +45 -0
- package/src/components/pricingColumn.js +53 -0
- package/src/components/progressBar.js +55 -0
- package/src/components/ratingStars.js +25 -0
- package/src/components/shape.js +12 -0
- package/src/components/slide.js +5 -0
- package/src/components/socialBar.js +59 -0
- package/src/components/squiggleLine.js +26 -0
- package/src/components/stepProcess.js +39 -0
- package/src/components/table.js +23 -0
- package/src/components/tagCloud.js +39 -0
- package/src/components/testimonialCard.js +54 -0
- package/src/components/text.js +14 -0
- package/src/components/theme.js +7 -0
- package/src/components/timeline.js +73 -0
- package/src/components/waveDecoration.js +35 -0
- package/src/core/PPTManager.js +17 -0
- package/src/index.js +225 -0
- package/src/layout/bento.js +47 -0
- package/src/layout/checkerboard.js +36 -0
- package/src/layout/filmStrip.js +29 -0
- package/src/layout/gallery.js +50 -0
- package/src/layout/grid.js +37 -0
- package/src/layout/hero.js +30 -0
- package/src/layout/magazine.js +39 -0
- package/src/layout/radial.js +34 -0
- package/src/layout/sidebar.js +26 -0
- package/src/layout/splitScreen.js +36 -0
- package/src/layout/zPattern.js +29 -0
- package/src/system/animation.js +36 -0
- package/src/system/contrastChecker.js +35 -0
- package/src/system/dataAdapter.js +36 -0
- package/src/system/layoutDebugger.js +40 -0
- package/src/system/markdownEngine.js +45 -0
- package/src/system/masterOverlay.js +50 -0
- package/src/system/sectionDivider.js +41 -0
- package/src/system/smartIcon.js +33 -0
- package/src/system/smartText.js +44 -0
- package/src/system/speakerNotes.js +12 -0
- package/src/system/syntaxHighlighter.js +71 -0
- package/src/system/themeGenerator.js +25 -0
- package/src/system/tocGenerator.js +68 -0
- package/src/system/watermark.js +26 -0
- package/src/themes/index.js +93 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a row of social media icons.
|
|
3
|
+
* Supported types: linkedin, twitter, github, instagram, facebook, web
|
|
4
|
+
*/
|
|
5
|
+
function addSocialBar(slide, items = [], options = {}) {
|
|
6
|
+
const {
|
|
7
|
+
x = 1,
|
|
8
|
+
y = 5,
|
|
9
|
+
iconSize = 0.4,
|
|
10
|
+
gap = 0.2,
|
|
11
|
+
color = "555555" // Default icon color
|
|
12
|
+
} = options;
|
|
13
|
+
|
|
14
|
+
// Embedded SVG Paths for standard social icons
|
|
15
|
+
const ICONS = {
|
|
16
|
+
linkedin: "M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z",
|
|
17
|
+
twitter: "M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.609 1.798-1.574 2.165-2.724-.951.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.179 0-5.515 2.966-4.797 6.045-4.091-.205-7.719-2.165-10.148-5.144-1.29 2.213-.669 5.108 1.523 6.574-.806-.026-1.566-.247-2.229-.616-.054 2.281 1.581 4.415 3.949 4.89-.693.188-1.452.232-2.224.084.626 1.956 2.444 3.379 4.6 3.419-2.07 1.623-4.678 2.348-7.29 2.04 2.179 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.721 13.995-14.646.962-.695 1.797-1.562 2.457-2.549z",
|
|
18
|
+
github: "M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z",
|
|
19
|
+
web: "M12 0c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm1 16.057v-3.057h2.994c-.059 1.143-.212 2.183-.442 3.057h-2.552zm-2 0h-2.552c-.23-.874-.383-1.914-.442-3.057h2.994v3.057zm0-5.057v-3h2.994c.059 1.143.212 2.183.442 3h-3.436zm2-5.057v3.057h-2.994c.059-1.143.212-2.183.442-3.057h2.552zm-2 0h-2.552c-.23.874-.383 1.914-.442 3.057h2.994v-3.057zm-5.223 5.057h-2.613c.277-1.206.711-2.22 1.246-3h1.367v3zm2.684-5.057c.23-.874.524-1.66.863-2.348 1.12.564 2.062 1.353 2.766 2.348h-3.629zm5.352 5.057h2.613c-.277-1.206-.711-2.22-1.246-3h-1.367v3zm-5.029 8.057c-.23.874-.524 1.66-.863 2.348-1.12-.564-2.062-1.353-2.766-2.348h3.629zm2.345 2.348c-.339-.688-.633-1.474-.863-2.348h3.629c-.704.995-1.646 1.784-2.766 2.348zm5.297-2.348h2.613c-.277 1.206-.711 2.22-1.246 3h-1.367v-3zm-7.642 0h-2.613c.277 1.206.711 2.22 1.246 3h1.367v-3z",
|
|
20
|
+
instagram: "M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z",
|
|
21
|
+
facebook: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
items.forEach((item, index) => {
|
|
25
|
+
const curX = x + index * (iconSize + gap);
|
|
26
|
+
const pathData = ICONS[item.type.toLowerCase()];
|
|
27
|
+
|
|
28
|
+
// 1. Icon Container (Clickable Area)
|
|
29
|
+
// We add a transparent rect behind it for easier clicking if link is attached
|
|
30
|
+
if (item.url) {
|
|
31
|
+
slide.addShape("rect", {
|
|
32
|
+
x: curX, y, w: iconSize, h: iconSize,
|
|
33
|
+
fill: { color: "FFFFFF", transparency: 99 },
|
|
34
|
+
hyperlink: { url: item.url }
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 2. SVG Icon
|
|
39
|
+
if (pathData) {
|
|
40
|
+
// Construct minimal SVG
|
|
41
|
+
const svgXml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#${color}"><path d="${pathData}"/></svg>`;
|
|
42
|
+
const base64Data = Buffer.from(svgXml).toString("base64");
|
|
43
|
+
|
|
44
|
+
slide.addImage({
|
|
45
|
+
data: `data:image/svg+xml;base64,${base64Data}`,
|
|
46
|
+
x: curX, y, w: iconSize, h: iconSize,
|
|
47
|
+
hyperlink: item.url ? { url: item.url } : undefined
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
// Fallback: Colored Circle
|
|
51
|
+
slide.addShape("oval", {
|
|
52
|
+
x: curX, y, w: iconSize, h: iconSize,
|
|
53
|
+
fill: color
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = { addSocialBar };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function addSquiggleLine(slide, options = {}) {
|
|
2
|
+
const {
|
|
3
|
+
x = 1,
|
|
4
|
+
y = 1,
|
|
5
|
+
w = 3,
|
|
6
|
+
color = "FF5722",
|
|
7
|
+
thickness = 3
|
|
8
|
+
} = options;
|
|
9
|
+
|
|
10
|
+
// We simulate a squiggle by using the 'wave' shape but making it very thin vertically
|
|
11
|
+
// OR by drawing a specific line shape if the library allows path.
|
|
12
|
+
// The safest cross-compatible way is a "Wave" shape.
|
|
13
|
+
|
|
14
|
+
slide.addShape("wave", {
|
|
15
|
+
x: x,
|
|
16
|
+
y: y,
|
|
17
|
+
w: w,
|
|
18
|
+
h: 0.2, // Short height makes the wave look like a line
|
|
19
|
+
fill: { color: undefined }, // No fill
|
|
20
|
+
line: { color: color, width: thickness },
|
|
21
|
+
flipH: false,
|
|
22
|
+
flipV: false
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = { addSquiggleLine };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function addStepProcess(slide, steps = [], options = {}) {
|
|
2
|
+
const { x = 1, y = 1, w = 4, gap = 0.8, color = "007AFF" } = options;
|
|
3
|
+
|
|
4
|
+
// Draw Vertical Line
|
|
5
|
+
const totalH = (steps.length - 1) * gap;
|
|
6
|
+
if (steps.length > 1) {
|
|
7
|
+
slide.addShape("line", {
|
|
8
|
+
x: x + 0.15, y: y + 0.15, w: 0, h: totalH,
|
|
9
|
+
line: { color: "CCCCCC", width: 2 }
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
steps.forEach((step, i) => {
|
|
14
|
+
const curY = y + i * gap;
|
|
15
|
+
|
|
16
|
+
// Circle Number
|
|
17
|
+
slide.addShape("oval", {
|
|
18
|
+
x, y: curY, w: 0.3, h: 0.3, fill: color
|
|
19
|
+
});
|
|
20
|
+
slide.addText(String(i + 1), {
|
|
21
|
+
x, y: curY, w: 0.3, h: 0.3,
|
|
22
|
+
color: "FFFFFF", fontSize: 10, bold: true, align: "center", valign: "middle"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Content
|
|
26
|
+
slide.addText(step.title, {
|
|
27
|
+
x: x + 0.5, y: curY - 0.1, w: w - 0.5, h: 0.3,
|
|
28
|
+
bold: true, fontSize: 12
|
|
29
|
+
});
|
|
30
|
+
if (step.desc) {
|
|
31
|
+
slide.addText(step.desc, {
|
|
32
|
+
x: x + 0.5, y: curY + 0.15, w: w - 0.5, h: 0.4,
|
|
33
|
+
fontSize: 10, color: "666666"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = { addStepProcess };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function addTable(slide, data, options = {}) {
|
|
2
|
+
const rows = data.map((row, rowIndex) =>
|
|
3
|
+
row.map((cell) => ({
|
|
4
|
+
text: String(cell),
|
|
5
|
+
options: {
|
|
6
|
+
fontSize: options.fontSize || 14,
|
|
7
|
+
bold: rowIndex === 0 && options.header !== false,
|
|
8
|
+
fill: rowIndex === 0 ? options.headerFill : undefined,
|
|
9
|
+
color: options.color || "000000",
|
|
10
|
+
},
|
|
11
|
+
}))
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
slide.addTable(rows, {
|
|
15
|
+
x: options.x ?? 1,
|
|
16
|
+
y: options.y ?? 1,
|
|
17
|
+
w: options.w ?? 8,
|
|
18
|
+
border: options.border ?? { type: "solid", color: "CCCCCC" },
|
|
19
|
+
colW: options.colW,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { addTable };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function addTagCloud(slide, tags = [], options = {}) {
|
|
2
|
+
const {
|
|
3
|
+
x = 1, y = 1, w = 5,
|
|
4
|
+
bgColors = ["E3F2FD", "E8F5E9", "FFF3E0", "F3E5F5"],
|
|
5
|
+
fontSize = 10
|
|
6
|
+
} = options;
|
|
7
|
+
|
|
8
|
+
let curX = x;
|
|
9
|
+
let curY = y;
|
|
10
|
+
const rowHeight = 0.4;
|
|
11
|
+
const padding = 0.2;
|
|
12
|
+
|
|
13
|
+
tags.forEach((tag, i) => {
|
|
14
|
+
// Crude width estimation
|
|
15
|
+
const tagW = (tag.length * 0.1) + 0.4;
|
|
16
|
+
|
|
17
|
+
// Wrap to next line if exceeds width
|
|
18
|
+
if (curX + tagW > x + w) {
|
|
19
|
+
curX = x;
|
|
20
|
+
curY += rowHeight + 0.1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const color = bgColors[i % bgColors.length];
|
|
24
|
+
|
|
25
|
+
slide.addShape("roundRect", {
|
|
26
|
+
x: curX, y: curY, w: tagW, h: rowHeight,
|
|
27
|
+
fill: color, line: { color: color }, rounding: 0.5
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
slide.addText(tag, {
|
|
31
|
+
x: curX, y: curY, w: tagW, h: rowHeight,
|
|
32
|
+
fontSize, color: "333333", align: "center", valign: "middle"
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
curX += tagW + 0.1;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = { addTagCloud };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function addTestimonialCard(slide, quote, author, options = {}) {
|
|
2
|
+
const {
|
|
3
|
+
x = 1,
|
|
4
|
+
y = 1,
|
|
5
|
+
w = 6,
|
|
6
|
+
h = 2.5,
|
|
7
|
+
bg = "F9F9F9",
|
|
8
|
+
accent = "007AFF",
|
|
9
|
+
} = options;
|
|
10
|
+
|
|
11
|
+
// Background
|
|
12
|
+
slide.addShape("roundRect", {
|
|
13
|
+
x, y, w, h,
|
|
14
|
+
fill: bg,
|
|
15
|
+
line: { color: "EFEFEF" },
|
|
16
|
+
rounding: 0.2
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Quote Mark Graphic (Large text representation)
|
|
20
|
+
slide.addText("“", {
|
|
21
|
+
x: x + 0.2,
|
|
22
|
+
y: y + 0.2,
|
|
23
|
+
w: 1, h: 1,
|
|
24
|
+
fontSize: 60,
|
|
25
|
+
color: accent,
|
|
26
|
+
fontFace: "Georgia"
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Quote Text
|
|
30
|
+
slide.addText(quote, {
|
|
31
|
+
x: x + 0.8,
|
|
32
|
+
y: y + 0.4,
|
|
33
|
+
w: w - 1,
|
|
34
|
+
h: h - 1,
|
|
35
|
+
fontSize: 14,
|
|
36
|
+
color: "333333",
|
|
37
|
+
italic: true,
|
|
38
|
+
valign: "top"
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Author
|
|
42
|
+
slide.addText(`— ${author}`, {
|
|
43
|
+
x: x + 0.8,
|
|
44
|
+
y: y + h - 0.6,
|
|
45
|
+
w: w - 1,
|
|
46
|
+
h: 0.4,
|
|
47
|
+
fontSize: 12,
|
|
48
|
+
bold: true,
|
|
49
|
+
color: "555555",
|
|
50
|
+
align: "right"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = { addTestimonialCard };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function addText(slide, text, options = {}) {
|
|
2
|
+
slide.addText(text, {
|
|
3
|
+
x: options.x ?? 1,
|
|
4
|
+
y: options.y ?? 1,
|
|
5
|
+
w: options.w ?? 5,
|
|
6
|
+
h: options.h ?? 1,
|
|
7
|
+
fontSize: options.fontSize ?? 18,
|
|
8
|
+
color: options.color ?? "000000",
|
|
9
|
+
bold: options.bold ?? false,
|
|
10
|
+
align: options.align ?? "left",
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = { addText };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a horizontal timeline with connected circles and labels.
|
|
3
|
+
*/
|
|
4
|
+
function addTimeline(slide, items = [], options = {}) {
|
|
5
|
+
const {
|
|
6
|
+
x = 1,
|
|
7
|
+
y = 3,
|
|
8
|
+
w = 8,
|
|
9
|
+
color = "007AFF", // Color of dots and line
|
|
10
|
+
textColor = "333333",
|
|
11
|
+
} = options;
|
|
12
|
+
|
|
13
|
+
if (items.length === 0) return;
|
|
14
|
+
|
|
15
|
+
// Calculate spacing
|
|
16
|
+
const stepWidth = w / (items.length - 1 || 1);
|
|
17
|
+
const lineY = y + 0.15; // Vertical center of the dots
|
|
18
|
+
|
|
19
|
+
// 1. Draw connecting line
|
|
20
|
+
if (items.length > 1) {
|
|
21
|
+
slide.addShape("line", {
|
|
22
|
+
x: x,
|
|
23
|
+
y: lineY,
|
|
24
|
+
w: w,
|
|
25
|
+
h: 0,
|
|
26
|
+
line: { color: color, width: 2 },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 2. Draw dots and text for each item
|
|
31
|
+
items.forEach((item, index) => {
|
|
32
|
+
const curX = x + index * stepWidth;
|
|
33
|
+
|
|
34
|
+
// Dot
|
|
35
|
+
slide.addShape("oval", {
|
|
36
|
+
x: curX - 0.15, // center the 0.3 width circle
|
|
37
|
+
y: y,
|
|
38
|
+
w: 0.3,
|
|
39
|
+
h: 0.3,
|
|
40
|
+
fill: "FFFFFF",
|
|
41
|
+
line: { color: color, width: 3 },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Title
|
|
45
|
+
slide.addText(item.title, {
|
|
46
|
+
x: curX - 0.75, // center text relative to dot
|
|
47
|
+
y: y + 0.4,
|
|
48
|
+
w: 1.5,
|
|
49
|
+
h: 0.5,
|
|
50
|
+
fontSize: 12,
|
|
51
|
+
bold: true,
|
|
52
|
+
color: textColor,
|
|
53
|
+
align: "center",
|
|
54
|
+
valign: "top",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Description (optional)
|
|
58
|
+
if (item.desc) {
|
|
59
|
+
slide.addText(item.desc, {
|
|
60
|
+
x: curX - 0.75,
|
|
61
|
+
y: y + 0.8,
|
|
62
|
+
w: 1.5,
|
|
63
|
+
h: 1,
|
|
64
|
+
fontSize: 10,
|
|
65
|
+
color: "666666",
|
|
66
|
+
align: "center",
|
|
67
|
+
valign: "top",
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = { addTimeline };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function addWaveDecoration(slide, position = "bottom", options = {}) {
|
|
2
|
+
const {
|
|
3
|
+
color = "007AFF",
|
|
4
|
+
opacity = 100,
|
|
5
|
+
slideWidth = 10,
|
|
6
|
+
slideHeight = 5.63,
|
|
7
|
+
amplitude = 1.5 // How "deep" the wave is
|
|
8
|
+
} = options;
|
|
9
|
+
|
|
10
|
+
const isTop = position === "top";
|
|
11
|
+
|
|
12
|
+
// We simulate a wave by placing a massive oval partially off-screen.
|
|
13
|
+
// This is a standard PPT trick for curves.
|
|
14
|
+
|
|
15
|
+
const width = slideWidth * 1.5; // Wider than slide to hide oval edges
|
|
16
|
+
const height = amplitude * 4; // Tall oval
|
|
17
|
+
|
|
18
|
+
const x = (slideWidth - width) / 2; // Center horizontally
|
|
19
|
+
|
|
20
|
+
// Calculate Y based on position
|
|
21
|
+
// If Top: move mostly up, leaving bottom exposed
|
|
22
|
+
// If Bottom: move mostly down, leaving top exposed
|
|
23
|
+
const y = isTop ? - (height - amplitude) : slideHeight - amplitude;
|
|
24
|
+
|
|
25
|
+
slide.addShape("oval", {
|
|
26
|
+
x: x,
|
|
27
|
+
y: y,
|
|
28
|
+
w: width,
|
|
29
|
+
h: height,
|
|
30
|
+
fill: { color: color, transparency: 100 - opacity },
|
|
31
|
+
line: { color: undefined }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = { addWaveDecoration };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const PptxGenJS = require("pptxgenjs");
|
|
2
|
+
|
|
3
|
+
class PPTManager {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.pptx = new PptxGenJS();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
getPptx() {
|
|
9
|
+
return this.pptx;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async save(filename = "presentation.pptx") {
|
|
13
|
+
await this.pptx.writeFile({ fileName: filename });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = PPTManager;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* canva-pptx – Public API
|
|
3
|
+
* This file MUST ONLY aggregate exports and register built-ins.
|
|
4
|
+
* No business logic here.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* --------------------------------
|
|
8
|
+
Core
|
|
9
|
+
--------------------------------- */
|
|
10
|
+
const PPTManager = require("./core/PPTManager");
|
|
11
|
+
|
|
12
|
+
/* --------------------------------
|
|
13
|
+
Components
|
|
14
|
+
--------------------------------- */
|
|
15
|
+
const { addSlide } = require("./components/slide");
|
|
16
|
+
const { addText } = require("./components/text");
|
|
17
|
+
const { addShape } = require("./components/shape");
|
|
18
|
+
const { addImage } = require("./components/image");
|
|
19
|
+
const { addLink } = require("./components/link");
|
|
20
|
+
const { addCard } = require("./components/card");
|
|
21
|
+
const { addTable } = require("./components/table");
|
|
22
|
+
const { addChart } = require("./components/chart");
|
|
23
|
+
const { applyTheme } = require("./components/theme");
|
|
24
|
+
|
|
25
|
+
/* --------------------------------
|
|
26
|
+
Themes
|
|
27
|
+
--------------------------------- */
|
|
28
|
+
const { getTheme, registerTheme } = require("./themes");
|
|
29
|
+
|
|
30
|
+
const { addProgressBar } = require("./components/progressBar");
|
|
31
|
+
const { addStatMetric } = require("./components/StatMetric");
|
|
32
|
+
const { addBadge } = require("./components/badge");
|
|
33
|
+
const { addCodeBlock } = require("./components/codeBlock");
|
|
34
|
+
const { addTimeline } = require("./components/timeline");
|
|
35
|
+
const { addAvatarGroup } = require("./components/avatarGroup");
|
|
36
|
+
const { addTestimonialCard } = require("./components/testimonialCard");
|
|
37
|
+
const { addAlertBox } = require("./components/alertBox");
|
|
38
|
+
const { addIconList } = require("./components/iconList");
|
|
39
|
+
const { addPricingColumn } = require("./components/pricingColumn");
|
|
40
|
+
const { addStepProcess } = require("./components/stepProcess");
|
|
41
|
+
const { addComparisonTable } = require("./components/comparisonTable");
|
|
42
|
+
const { addRatingStars } = require("./components/ratingStars");
|
|
43
|
+
const { addBreadcrumbNav } = require("./components/breadcrumbNav");
|
|
44
|
+
const { addTagCloud } = require("./components/tagCloud");
|
|
45
|
+
const { addKanbanColumn } = require("./components/kanbanColumn");
|
|
46
|
+
const { addCallToAction } = require("./components/callToAction");
|
|
47
|
+
const { addOrganicBlob } = require("./components/organicBlob");
|
|
48
|
+
const { addWaveDecoration } = require("./components/waveDecoration");
|
|
49
|
+
const { addDotPattern } = require("./components/dotPattern");
|
|
50
|
+
const { addBrushStroke } = require("./components/brushStroke");
|
|
51
|
+
const { addGeometricConfetti } = require("./components/geometricConfetti");
|
|
52
|
+
const { addGradientMesh } = require("./components/gradientMesh");
|
|
53
|
+
const { addSquiggleLine } = require("./components/squiggleLine");
|
|
54
|
+
const { addCornerAccent } = require("./components/cornerAccent");
|
|
55
|
+
/* --------------------------------
|
|
56
|
+
New Utility Components
|
|
57
|
+
--------------------------------- */
|
|
58
|
+
const { addBrowserWindow } = require("./components/browserWindow");
|
|
59
|
+
const { addSocialBar } = require("./components/socialBar");
|
|
60
|
+
|
|
61
|
+
/* --------------------------------
|
|
62
|
+
Layout Engines
|
|
63
|
+
--------------------------------- */
|
|
64
|
+
const { createGrid } = require("./layout/grid");
|
|
65
|
+
const { getSplitScreen } = require("./layout/splitScreen");
|
|
66
|
+
const { getZPattern } = require("./layout/zPattern");
|
|
67
|
+
const { getSidebarLayout } = require("./layout/sidebar");
|
|
68
|
+
const { getHeroLayout } = require("./layout/hero");
|
|
69
|
+
const { getGalleryLayout } = require("./layout/gallery");
|
|
70
|
+
const { getBentoLayout } = require("./layout/bento");
|
|
71
|
+
const { getRadialLayout } = require("./layout/radial");
|
|
72
|
+
const { getCheckerboardLayout } = require("./layout/checkerboard");
|
|
73
|
+
const { getMagazineLayout } = require("./layout/magazine");
|
|
74
|
+
const { getFilmStripLayout } = require("./layout/filmStrip");
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/* --------------------------------
|
|
78
|
+
Advanced Components
|
|
79
|
+
--------------------------------- */
|
|
80
|
+
const { addFeatureGrid } = require("./AdvancedComponents/featureGrid");
|
|
81
|
+
const { addTeamMemberProfile } = require("./AdvancedComponents/teamMemberProfile");
|
|
82
|
+
const { addSWOTMatrix } = require("./AdvancedComponents/swotMatrix");
|
|
83
|
+
const { addProcessCycle } = require("./AdvancedComponents/processCycle");
|
|
84
|
+
const { addFunnelDiagram } = require("./AdvancedComponents/funnelDiagram");
|
|
85
|
+
const { addPyramidHierarchy } = require("./AdvancedComponents/pyramidHierarchy");
|
|
86
|
+
const { addDeviceMockup } = require("./AdvancedComponents/deviceMockup");
|
|
87
|
+
const { addAccordionList } = require("./AdvancedComponents/accordionList");
|
|
88
|
+
const { addTrafficLight } = require("./AdvancedComponents/trafficLight");
|
|
89
|
+
const { addVennDiagram } = require("./AdvancedComponents/vennDiagram");
|
|
90
|
+
const { addOrgChart } = require("./AdvancedComponents/orgChart");
|
|
91
|
+
const { addCalendarGrid } = require("./AdvancedComponents/calendarGrid");
|
|
92
|
+
const { addGanttChart } = require("./AdvancedComponents/ganttChart");
|
|
93
|
+
const { addPersonaCard } = require("./AdvancedComponents/personaCard");
|
|
94
|
+
const { addMatrixGrid } = require("./AdvancedComponents/matrixGrid");
|
|
95
|
+
const { addMindMap } = require("./AdvancedComponents/mindMap");
|
|
96
|
+
const { addInvoiceTable } = require("./AdvancedComponents/invoiceTable");
|
|
97
|
+
const { addCertificateFrame } = require("./AdvancedComponents/certificateFrame");
|
|
98
|
+
const { addSaaSFeatureBlock } = require("./AdvancedComponents/saasFeatureBlock");
|
|
99
|
+
const { addWinLossChart } = require("./AdvancedComponents/winLossChart");
|
|
100
|
+
|
|
101
|
+
/* --------------------------------
|
|
102
|
+
System Features
|
|
103
|
+
--------------------------------- */
|
|
104
|
+
const { renderMarkdown } = require("./system/markdownEngine");
|
|
105
|
+
const { addSyntaxBlock } = require("./system/syntaxHighlighter");
|
|
106
|
+
const { addToTOC, addTableOfContents } = require("./system/tocGenerator");
|
|
107
|
+
const { applyMaster } = require("./system/masterOverlay");
|
|
108
|
+
const { addSmartIcon } = require("./system/smartIcon");
|
|
109
|
+
const { addSmartText } = require("./system/smartText");
|
|
110
|
+
const { jsonToTableData, csvToTableData, jsonToChartData } = require("./system/dataAdapter");
|
|
111
|
+
const { animate } = require("./system/animation");
|
|
112
|
+
const { debugSlide } = require("./system/layoutDebugger");
|
|
113
|
+
const { addSpeakerNotes } = require("./system/speakerNotes");
|
|
114
|
+
const { generateTheme } = require("./system/themeGenerator");
|
|
115
|
+
const { addWatermark } = require("./system/watermark");
|
|
116
|
+
const { addCodeDiff } = require("./components/codeDiff"); // Note: Placed in components as it renders content
|
|
117
|
+
const { addSectionDivider } = require("./system/sectionDivider");
|
|
118
|
+
const { checkContrast } = require("./system/contrastChecker");
|
|
119
|
+
|
|
120
|
+
/* --------------------------------
|
|
121
|
+
Public API
|
|
122
|
+
--------------------------------- */
|
|
123
|
+
module.exports = {
|
|
124
|
+
/* Core */
|
|
125
|
+
PPTManager,
|
|
126
|
+
|
|
127
|
+
/* Components */
|
|
128
|
+
addSlide,
|
|
129
|
+
addText,
|
|
130
|
+
addShape,
|
|
131
|
+
addImage,
|
|
132
|
+
addLink,
|
|
133
|
+
addCard,
|
|
134
|
+
addTable,
|
|
135
|
+
addChart,
|
|
136
|
+
applyTheme,
|
|
137
|
+
addBrowserWindow,
|
|
138
|
+
addSocialBar,
|
|
139
|
+
addProgressBar,
|
|
140
|
+
addStatMetric,
|
|
141
|
+
addBadge,
|
|
142
|
+
addCodeBlock,
|
|
143
|
+
addTimeline,
|
|
144
|
+
addAvatarGroup,
|
|
145
|
+
addTestimonialCard,
|
|
146
|
+
addAlertBox,
|
|
147
|
+
addIconList,
|
|
148
|
+
addPricingColumn,
|
|
149
|
+
addStepProcess,
|
|
150
|
+
addComparisonTable,
|
|
151
|
+
addRatingStars,
|
|
152
|
+
addBreadcrumbNav,
|
|
153
|
+
addTagCloud,
|
|
154
|
+
addKanbanColumn,
|
|
155
|
+
addCallToAction,
|
|
156
|
+
addOrganicBlob,
|
|
157
|
+
addWaveDecoration,
|
|
158
|
+
addDotPattern,
|
|
159
|
+
addBrushStroke,
|
|
160
|
+
addGeometricConfetti,
|
|
161
|
+
addGradientMesh,
|
|
162
|
+
addSquiggleLine,
|
|
163
|
+
addCornerAccent,
|
|
164
|
+
|
|
165
|
+
/* Themes */
|
|
166
|
+
getTheme,
|
|
167
|
+
registerTheme,
|
|
168
|
+
|
|
169
|
+
/* Layouts */
|
|
170
|
+
createGrid,
|
|
171
|
+
getSplitScreen,
|
|
172
|
+
getZPattern,
|
|
173
|
+
getSidebarLayout,
|
|
174
|
+
getHeroLayout,
|
|
175
|
+
getGalleryLayout,
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
/* Advanced Components */
|
|
179
|
+
addFeatureGrid,
|
|
180
|
+
addTeamMemberProfile,
|
|
181
|
+
addSWOTMatrix,
|
|
182
|
+
addProcessCycle,
|
|
183
|
+
addFunnelDiagram,
|
|
184
|
+
addPyramidHierarchy,
|
|
185
|
+
addDeviceMockup,
|
|
186
|
+
addAccordionList,
|
|
187
|
+
addTrafficLight,
|
|
188
|
+
addVennDiagram,
|
|
189
|
+
getBentoLayout,
|
|
190
|
+
getRadialLayout,
|
|
191
|
+
getCheckerboardLayout,
|
|
192
|
+
getMagazineLayout,
|
|
193
|
+
getFilmStripLayout,
|
|
194
|
+
addOrgChart,
|
|
195
|
+
addCalendarGrid,
|
|
196
|
+
addGanttChart,
|
|
197
|
+
addPersonaCard,
|
|
198
|
+
addMatrixGrid,
|
|
199
|
+
addMindMap,
|
|
200
|
+
addInvoiceTable,
|
|
201
|
+
addCertificateFrame,
|
|
202
|
+
addSaaSFeatureBlock,
|
|
203
|
+
addWinLossChart,
|
|
204
|
+
|
|
205
|
+
/* System */
|
|
206
|
+
renderMarkdown,
|
|
207
|
+
addSyntaxBlock,
|
|
208
|
+
addToTOC, // Exported function
|
|
209
|
+
addTableOfContents, // Exported function
|
|
210
|
+
applyMaster,
|
|
211
|
+
addSmartIcon,
|
|
212
|
+
addSmartText,
|
|
213
|
+
jsonToTableData,
|
|
214
|
+
csvToTableData,
|
|
215
|
+
jsonToChartData,
|
|
216
|
+
animate,
|
|
217
|
+
/* Standout Features */
|
|
218
|
+
debugSlide,
|
|
219
|
+
addSpeakerNotes,
|
|
220
|
+
generateTheme,
|
|
221
|
+
addWatermark,
|
|
222
|
+
addCodeDiff,
|
|
223
|
+
addSectionDivider,
|
|
224
|
+
checkContrast
|
|
225
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a Bento Box layout with preset slot configurations.
|
|
3
|
+
* @param {string} variation - 'balanced' | 'feature-left' | 'feature-top'
|
|
4
|
+
*/
|
|
5
|
+
function getBentoLayout(variation = "balanced", options = {}) {
|
|
6
|
+
const { x = 0.5, y = 0.5, w = 9, h = 4.63, gap = 0.2 } = options;
|
|
7
|
+
|
|
8
|
+
// Helper to calculate cell rects
|
|
9
|
+
const thirdW = (w - 2 * gap) / 3;
|
|
10
|
+
const halfW = (w - gap) / 2;
|
|
11
|
+
const halfH = (h - gap) / 2;
|
|
12
|
+
const fullH = h;
|
|
13
|
+
|
|
14
|
+
const layouts = {
|
|
15
|
+
// 3 columns, equal height logic but varied spans
|
|
16
|
+
// [ Large ] [ Small ]
|
|
17
|
+
// [ Large ] [ Small ]
|
|
18
|
+
'feature-left': [
|
|
19
|
+
{ x: x, y: y, w: halfW + thirdW/2, h: fullH }, // Big Left
|
|
20
|
+
{ x: x + halfW + thirdW/2 + gap, y: y, w: thirdW * 0.8, h: halfH }, // Top Right
|
|
21
|
+
{ x: x + halfW + thirdW/2 + gap, y: y + halfH + gap, w: thirdW * 0.8, h: halfH } // Bottom Right
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
// [ Wide Top ]
|
|
25
|
+
// [ S ] [ S ] [ S ]
|
|
26
|
+
'feature-top': [
|
|
27
|
+
{ x: x, y: y, w: w, h: halfH }, // Top Wide
|
|
28
|
+
{ x: x, y: y + halfH + gap, w: thirdW, h: halfH }, // Bot Left
|
|
29
|
+
{ x: x + thirdW + gap, y: y + halfH + gap, w: thirdW, h: halfH }, // Bot Mid
|
|
30
|
+
{ x: x + 2*(thirdW + gap), y: y + halfH + gap, w: thirdW, h: halfH } // Bot Right
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
// 2x2 grid but asymmetrical
|
|
34
|
+
// [ Square ] [ Rect ]
|
|
35
|
+
// [ Rect ] [ Square ]
|
|
36
|
+
'balanced': [
|
|
37
|
+
{ x: x, y: y, w: thirdW, h: halfH },
|
|
38
|
+
{ x: x + thirdW + gap, y: y, w: 2*thirdW + gap, h: halfH },
|
|
39
|
+
{ x: x, y: y + halfH + gap, w: 2*thirdW + gap, h: halfH },
|
|
40
|
+
{ x: x + 2*thirdW + 2*gap, y: y + halfH + gap, w: thirdW, h: halfH }
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return layouts[variation] || layouts['balanced'];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = { getBentoLayout };
|