@presentation-md/export 1.20.2 → 1.20.3
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/dist/layouts.js +85 -42
- package/dist/layouts.js.map +1 -1
- package/package.json +2 -2
package/dist/layouts.js
CHANGED
|
@@ -68,10 +68,6 @@ function cardStroke(ctx, opts = {}) {
|
|
|
68
68
|
if (ctx.themeName === "mat") {
|
|
69
69
|
return { color: "1E2820", width: opts.hero || opts.highlighted ? 1.5 : 1.25 };
|
|
70
70
|
}
|
|
71
|
-
// biennale-yellow-sun cards: indigo hairline
|
|
72
|
-
if (ctx.themeName === "biennale-yellow") {
|
|
73
|
-
return { color: ctx.colors.text, width: opts.hero || opts.highlighted ? 1.35 : 1.1 };
|
|
74
|
-
}
|
|
75
71
|
// hard-bento (genz-bento) cards: 2.5px ink
|
|
76
72
|
if (ctx.themeName === "genz-bento") {
|
|
77
73
|
return { color: ctx.colors.text, width: opts.hero || opts.highlighted ? 2.75 : 2.5 };
|
|
@@ -178,11 +174,83 @@ function cardStroke(ctx, opts = {}) {
|
|
|
178
174
|
: ctx.colors.text;
|
|
179
175
|
return { color, width: opts.hero || opts.highlighted ? 1.35 : 1.15 };
|
|
180
176
|
}
|
|
177
|
+
// long-table-supper cards: dashed rust rim (HTML 1.5px dashed)
|
|
178
|
+
if (ctx.themeName === "long-table") {
|
|
179
|
+
return {
|
|
180
|
+
color: ctx.colors.accent,
|
|
181
|
+
width: opts.hero || opts.highlighted ? 1.5 : 1.35,
|
|
182
|
+
dashType: "dash",
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
// quiet-luxe / biennale-yellow-sun: top-rule cards (no full box stroke)
|
|
186
|
+
if (ctx.themeName === "luxury-minimalist" || ctx.themeName === "biennale-yellow") {
|
|
187
|
+
return {
|
|
188
|
+
color: ctx.themeName === "luxury-minimalist" ? ctx.colors.accent : ctx.colors.text,
|
|
189
|
+
width: opts.hero || opts.highlighted ? 1.5 : 1.25,
|
|
190
|
+
topRule: true,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
// signal-briefing cards: quiet border hairline (theme geometry radius)
|
|
194
|
+
if (ctx.themeName === "signal") {
|
|
195
|
+
return { color: ctx.colors.border, width: opts.hero || opts.highlighted ? 1.25 : 1.1 };
|
|
196
|
+
}
|
|
197
|
+
// blue-professional-clean / pastel-geometry-pills / ft broadsheet-rule peers
|
|
198
|
+
if (ctx.themeName === "blue-professional") {
|
|
199
|
+
return { color: ctx.colors.accent, width: opts.hero || opts.highlighted ? 1.35 : 1.15 };
|
|
200
|
+
}
|
|
201
|
+
if (ctx.themeName === "pastel-geometry") {
|
|
202
|
+
return { color: ctx.colors.text, width: opts.hero || opts.highlighted ? 1.15 : 1 };
|
|
203
|
+
}
|
|
204
|
+
if (ctx.themeName === "ft-editorial") {
|
|
205
|
+
return { color: ctx.colors.text, width: opts.hero || opts.highlighted ? 1.35 : 1.15 };
|
|
206
|
+
}
|
|
181
207
|
if (opts.hero || opts.highlighted) {
|
|
182
208
|
return { color: ctx.colors.accent, width: opts.highlighted ? 1.75 : 1.5 };
|
|
183
209
|
}
|
|
184
210
|
return { color: ctx.colors.border, width: 1 };
|
|
185
211
|
}
|
|
212
|
+
/** Draw a filled card shell with theme-native stroke (incl. dashed / top-rule). */
|
|
213
|
+
function drawCardFace(slide, ctx, x, y, w, h, fill, opts = {}) {
|
|
214
|
+
const stroke = cardStroke(ctx, opts);
|
|
215
|
+
const radius = cardRadius(ctx);
|
|
216
|
+
if (stroke.topRule) {
|
|
217
|
+
slide.addShape(ctx.shapeRoundRect, {
|
|
218
|
+
x,
|
|
219
|
+
y,
|
|
220
|
+
w,
|
|
221
|
+
h,
|
|
222
|
+
fill: { color: fill },
|
|
223
|
+
line: { color: fill, width: 0 },
|
|
224
|
+
rectRadius: radius,
|
|
225
|
+
});
|
|
226
|
+
const ruleH = opts.hero || opts.highlighted ? 0.028 : 0.02;
|
|
227
|
+
slide.addShape(ctx.shapeRoundRect, {
|
|
228
|
+
x: x + 0.04,
|
|
229
|
+
y,
|
|
230
|
+
w: Math.max(0.2, w - 0.08),
|
|
231
|
+
h: ruleH,
|
|
232
|
+
fill: { color: stroke.color },
|
|
233
|
+
line: { color: stroke.color, width: 0 },
|
|
234
|
+
rectRadius: 0,
|
|
235
|
+
});
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const line = {
|
|
239
|
+
color: stroke.color,
|
|
240
|
+
width: stroke.width,
|
|
241
|
+
};
|
|
242
|
+
if (stroke.dashType)
|
|
243
|
+
line.dashType = stroke.dashType;
|
|
244
|
+
slide.addShape(ctx.shapeRoundRect, {
|
|
245
|
+
x,
|
|
246
|
+
y,
|
|
247
|
+
w,
|
|
248
|
+
h,
|
|
249
|
+
fill: { color: fill },
|
|
250
|
+
line,
|
|
251
|
+
rectRadius: radius,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
186
254
|
function cardRadius(ctx) {
|
|
187
255
|
// candy-blob cards: border-radius 22px ≈ 0.23"
|
|
188
256
|
if (ctx.themeName === "candy-pop")
|
|
@@ -242,9 +310,17 @@ function cardRadius(ctx) {
|
|
|
242
310
|
ctx.themeName === "broadsheet" ||
|
|
243
311
|
ctx.themeName === "editorial-forest" ||
|
|
244
312
|
ctx.themeName === "monochrome" ||
|
|
245
|
-
ctx.themeName === "paper-ink"
|
|
313
|
+
ctx.themeName === "paper-ink" ||
|
|
314
|
+
ctx.themeName === "luxury-minimalist" ||
|
|
315
|
+
ctx.themeName === "ft-editorial") {
|
|
246
316
|
return 0;
|
|
247
317
|
}
|
|
318
|
+
// signal-briefing cards: theme geometry 2px ≈ 0.02"
|
|
319
|
+
if (ctx.themeName === "signal")
|
|
320
|
+
return 0.02;
|
|
321
|
+
// blue-professional-clean cards: border-radius 12px ≈ 0.125"
|
|
322
|
+
if (ctx.themeName === "blue-professional")
|
|
323
|
+
return 0.125;
|
|
248
324
|
// hard-bento (genz-bento) cards: border-radius 14px ≈ 0.15"
|
|
249
325
|
if (ctx.themeName === "genz-bento")
|
|
250
326
|
return 0.15;
|
|
@@ -583,15 +659,7 @@ function renderTwoColumn(slide, ctx, data) {
|
|
|
583
659
|
addImageOrPlaceholder(slide, ctx, data, mediaX, imgY, mediaW, imgH);
|
|
584
660
|
}
|
|
585
661
|
else if (data.aside) {
|
|
586
|
-
slide
|
|
587
|
-
x: mediaX,
|
|
588
|
-
y: imgY,
|
|
589
|
-
w: mediaW,
|
|
590
|
-
h: imgH,
|
|
591
|
-
fill: { color: ctx.colors.cardBg },
|
|
592
|
-
line: cardStroke(ctx, { hero: true }),
|
|
593
|
-
rectRadius: cardRadius(ctx),
|
|
594
|
-
});
|
|
662
|
+
drawCardFace(slide, ctx, mediaX, imgY, mediaW, imgH, ctx.colors.cardBg, { hero: true });
|
|
595
663
|
slide.addText(data.aside, {
|
|
596
664
|
x: mediaX + 0.3,
|
|
597
665
|
y: imgY + 0.4,
|
|
@@ -748,16 +816,7 @@ function drawFeatureCard(slide, ctx, card, x, y, w, h, opts = {}) {
|
|
|
748
816
|
const fill = hero ? ctx.colors.emphasisFill : ctx.colors.cardBg;
|
|
749
817
|
const ink = hero ? ctx.colors.emphasisText : ctx.colors.cardText;
|
|
750
818
|
const bodyInk = hero ? ctx.colors.emphasisText : ctx.colors.cardMuted;
|
|
751
|
-
|
|
752
|
-
slide.addShape(ctx.shapeRoundRect, {
|
|
753
|
-
x,
|
|
754
|
-
y,
|
|
755
|
-
w,
|
|
756
|
-
h,
|
|
757
|
-
fill: { color: fill },
|
|
758
|
-
line: stroke,
|
|
759
|
-
rectRadius: cardRadius(ctx),
|
|
760
|
-
});
|
|
819
|
+
drawCardFace(slide, ctx, x, y, w, h, fill, { hero });
|
|
761
820
|
drawIconMarker(slide, ctx, card.icon, x + 0.2, y + 0.2, hero ? 0.42 : 0.34);
|
|
762
821
|
const pad = 0.2;
|
|
763
822
|
const titleY = y + (hero ? 0.75 : 0.6);
|
|
@@ -1283,15 +1342,7 @@ function renderComparison(slide, ctx, data) {
|
|
|
1283
1342
|
const fill = highlighted ? ctx.colors.emphasisFill : ctx.colors.cardBg;
|
|
1284
1343
|
const ink = highlighted ? ctx.colors.emphasisText : ctx.colors.cardText;
|
|
1285
1344
|
const bodyInk = highlighted ? ctx.colors.emphasisText : ctx.colors.cardMuted;
|
|
1286
|
-
slide
|
|
1287
|
-
x,
|
|
1288
|
-
y: boxY,
|
|
1289
|
-
w: colW,
|
|
1290
|
-
h: boxH,
|
|
1291
|
-
fill: { color: fill },
|
|
1292
|
-
line: cardStroke(ctx, { highlighted }),
|
|
1293
|
-
rectRadius: cardRadius(ctx),
|
|
1294
|
-
});
|
|
1345
|
+
drawCardFace(slide, ctx, x, boxY, colW, boxH, fill, { highlighted });
|
|
1295
1346
|
let innerY = boxY + 0.25;
|
|
1296
1347
|
if (label) {
|
|
1297
1348
|
slide.addText(label.toUpperCase(), {
|
|
@@ -1709,15 +1760,7 @@ function renderLogoWall(slide, ctx, data) {
|
|
|
1709
1760
|
const row = Math.floor(i / cols);
|
|
1710
1761
|
const x = ctx.margin + col * (cellW + gap);
|
|
1711
1762
|
const y = top + 0.1 + row * (cellH + gap);
|
|
1712
|
-
slide
|
|
1713
|
-
x,
|
|
1714
|
-
y,
|
|
1715
|
-
w: cellW,
|
|
1716
|
-
h: cellH,
|
|
1717
|
-
fill: { color: ctx.colors.cardBg },
|
|
1718
|
-
line: cardStroke(ctx),
|
|
1719
|
-
rectRadius: cardRadius(ctx),
|
|
1720
|
-
});
|
|
1763
|
+
drawCardFace(slide, ctx, x, y, cellW, cellH, ctx.colors.cardBg);
|
|
1721
1764
|
const img = typeof card.image === "string" ? card.image.trim() : "";
|
|
1722
1765
|
if (img && (/^data:image\//i.test(img) || /^https?:\/\//i.test(img))) {
|
|
1723
1766
|
try {
|