@mangomagic/cli 0.1.16 → 0.1.17
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/package.json +1 -1
- package/src/export/cards.mjs +18 -4
package/package.json
CHANGED
package/src/export/cards.mjs
CHANGED
|
@@ -49,6 +49,16 @@ function slideLines(slide) {
|
|
|
49
49
|
return Array.isArray(slide?.lines) ? slide.lines.map(lineText).filter(Boolean) : [];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
function lineClasses(line, idx) {
|
|
53
|
+
const rawSize = typeof line === "object" && line ? line.size : "";
|
|
54
|
+
const size = ["hook", "punch", "body", "small"].includes(rawSize) ? rawSize : "";
|
|
55
|
+
return [
|
|
56
|
+
idx === 0 ? "primary" : "",
|
|
57
|
+
size ? `size-${size}` : "",
|
|
58
|
+
line?.gold ? "gold" : "",
|
|
59
|
+
].filter(Boolean).join(" ");
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
function cardUrl(card) {
|
|
53
63
|
return card?.id ? `https://mangomagic.live/carousels/${card.id}` : "";
|
|
54
64
|
}
|
|
@@ -180,12 +190,12 @@ function slideHtml(card, slide, idx, total) {
|
|
|
180
190
|
const bg = card?.spec?.bg || "#111111";
|
|
181
191
|
const ink = card?.spec?.ink || "#f8f4ec";
|
|
182
192
|
const accent = card?.spec?.accent || "#f1ab1c";
|
|
183
|
-
const lines =
|
|
193
|
+
const lines = Array.isArray(slide?.lines) ? slide.lines : [];
|
|
184
194
|
return `
|
|
185
195
|
<section class="slide" style="--bg:${escapeHtml(bg)};--ink:${escapeHtml(ink)};--accent:${escapeHtml(accent)}">
|
|
186
196
|
<div class="slide-kicker">${idx + 1}/${total}${slide.type ? ` · ${escapeHtml(slide.type)}` : ""}</div>
|
|
187
197
|
<div class="slide-lines">
|
|
188
|
-
${lines.map((line, lineIdx) => `<p class="${lineIdx
|
|
198
|
+
${lines.map((line, lineIdx) => `<p class="${lineClasses(line, lineIdx)}">${escapeHtml(lineText(line))}</p>`).join("")}
|
|
189
199
|
</div>
|
|
190
200
|
${slide.swipe_label ? `<div class="swipe">${escapeHtml(slide.swipe_label)}</div>` : ""}
|
|
191
201
|
${card?.spec?.footer ? `<div class="footer">${escapeHtml(card.spec.footer)}</div>` : ""}
|
|
@@ -233,8 +243,12 @@ function htmlFor(cards) {
|
|
|
233
243
|
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
|
|
234
244
|
.slide { aspect-ratio: 1 / 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; position: relative; background: var(--bg); color: var(--ink); border-radius: 10px; overflow: hidden; box-shadow: 0 16px 36px rgba(20, 16, 8, .16); }
|
|
235
245
|
.slide-kicker { position: absolute; top: 14px; left: 16px; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; }
|
|
236
|
-
.slide-lines p { margin: 10px 0; font-size:
|
|
237
|
-
.slide-lines .primary { color: var(--accent);
|
|
246
|
+
.slide-lines p { margin: 10px 0; font-size: 20px; line-height: 1.08; font-weight: 800; overflow-wrap: anywhere; }
|
|
247
|
+
.slide-lines .gold, .slide-lines .primary { color: var(--accent); }
|
|
248
|
+
.slide-lines .size-hook { font-size: 30px; line-height: 1; }
|
|
249
|
+
.slide-lines .size-punch { font-size: 26px; line-height: 1.02; }
|
|
250
|
+
.slide-lines .size-body { font-size: 18px; line-height: 1.12; }
|
|
251
|
+
.slide-lines .size-small { font-size: 13px; line-height: 1.25; font-weight: 700; }
|
|
238
252
|
.swipe { position: absolute; right: 16px; bottom: 40px; color: var(--accent); font-weight: 800; }
|
|
239
253
|
.footer { position: absolute; left: 16px; right: 16px; bottom: 14px; font-size: 11px; color: color-mix(in srgb, var(--ink), transparent 36%); }
|
|
240
254
|
.caption { margin-top: 20px; max-width: 760px; background: #fff; border: 1px solid #e3dccf; border-radius: 10px; padding: 18px; }
|