@classic-homes/slides 0.5.6 → 0.5.8
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/{chunk-36736WP4.js → chunk-AOOBBLKE.js} +56 -26
- package/dist/{chunk-36736WP4.js.map → chunk-AOOBBLKE.js.map} +1 -1
- package/dist/{chunk-73QTNWG4.js → chunk-O4HEBEJ5.js} +31 -5
- package/dist/chunk-O4HEBEJ5.js.map +1 -0
- package/dist/{chunk-BNRC4EI3.js → chunk-XARJP3G2.js} +2 -2
- package/dist/cli.js +4 -4
- package/dist/index.js +2 -2
- package/dist/{mcp-C65N7OUL.js → mcp-JE3DHERM.js} +4 -4
- package/dist/node.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-73QTNWG4.js.map +0 -1
- /package/dist/{chunk-BNRC4EI3.js.map → chunk-XARJP3G2.js.map} +0 -0
- /package/dist/{mcp-C65N7OUL.js.map → mcp-JE3DHERM.js.map} +0 -0
|
@@ -3719,39 +3719,52 @@ function fromZod(issue) {
|
|
|
3719
3719
|
}
|
|
3720
3720
|
return { level: "error", path: issue.path, message };
|
|
3721
3721
|
}
|
|
3722
|
+
function slideIssues(slide, i) {
|
|
3723
|
+
const issues = [];
|
|
3724
|
+
const layout = getLayout(slide.layout);
|
|
3725
|
+
for (const url of layout.prepare?.(slide)?.qr ?? []) {
|
|
3726
|
+
try {
|
|
3727
|
+
if (url.length > 1e4) throw new Error("URL too long");
|
|
3728
|
+
QRCode2.create(url, { errorCorrectionLevel: "M" });
|
|
3729
|
+
} catch {
|
|
3730
|
+
issues.push({
|
|
3731
|
+
level: "error",
|
|
3732
|
+
path: ["slides", i, "url"],
|
|
3733
|
+
message: "This URL is too long for a QR code. Use a shorter URL."
|
|
3734
|
+
});
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
for (const issue of layout.lint?.(slide) ?? []) {
|
|
3738
|
+
issues.push({ ...issue, path: ["slides", i, ...issue.path] });
|
|
3739
|
+
}
|
|
3740
|
+
if (collectImageSources(slide).has(PLACEHOLDER_IMAGE)) {
|
|
3741
|
+
issues.push({
|
|
3742
|
+
level: "warning",
|
|
3743
|
+
path: ["slides", i],
|
|
3744
|
+
message: "Replace the placeholder photo before presenting."
|
|
3745
|
+
});
|
|
3746
|
+
}
|
|
3747
|
+
return issues;
|
|
3748
|
+
}
|
|
3722
3749
|
function validateDeck(input, options = {}) {
|
|
3723
3750
|
const parsed = DeckSchema.safeParse(input);
|
|
3724
3751
|
if (!parsed.success) {
|
|
3725
|
-
|
|
3752
|
+
const issues2 = parsed.error.issues.map(fromZod);
|
|
3753
|
+
const raw = input?.slides;
|
|
3754
|
+
if (Array.isArray(raw)) {
|
|
3755
|
+
raw.forEach((candidate, i) => {
|
|
3756
|
+
const slide = SlideSchema.safeParse(candidate);
|
|
3757
|
+
if (slide.success) issues2.push(...slideIssues(slide.data, i));
|
|
3758
|
+
});
|
|
3759
|
+
}
|
|
3760
|
+
return { ok: false, issues: byPath(issues2) };
|
|
3726
3761
|
}
|
|
3727
3762
|
const deck = parsed.data;
|
|
3728
3763
|
const issues = [];
|
|
3729
3764
|
const steps = deck.journey?.steps.length ?? 0;
|
|
3730
3765
|
const seen = /* @__PURE__ */ new Set();
|
|
3731
3766
|
deck.slides.forEach((slide, i) => {
|
|
3732
|
-
|
|
3733
|
-
for (const url of layout.prepare?.(slide)?.qr ?? []) {
|
|
3734
|
-
try {
|
|
3735
|
-
if (url.length > 1e4) throw new Error("URL too long");
|
|
3736
|
-
QRCode2.create(url, { errorCorrectionLevel: "M" });
|
|
3737
|
-
} catch {
|
|
3738
|
-
issues.push({
|
|
3739
|
-
level: "error",
|
|
3740
|
-
path: ["slides", i, "url"],
|
|
3741
|
-
message: "This URL is too long for a QR code. Use a shorter URL."
|
|
3742
|
-
});
|
|
3743
|
-
}
|
|
3744
|
-
}
|
|
3745
|
-
for (const issue of layout.lint?.(slide) ?? []) {
|
|
3746
|
-
issues.push({ ...issue, path: ["slides", i, ...issue.path] });
|
|
3747
|
-
}
|
|
3748
|
-
if (collectImageSources(slide).has(PLACEHOLDER_IMAGE)) {
|
|
3749
|
-
issues.push({
|
|
3750
|
-
level: "warning",
|
|
3751
|
-
path: ["slides", i],
|
|
3752
|
-
message: "Replace the placeholder photo before presenting."
|
|
3753
|
-
});
|
|
3754
|
-
}
|
|
3767
|
+
issues.push(...slideIssues(slide, i));
|
|
3755
3768
|
if (slide.id) {
|
|
3756
3769
|
if (seen.has(slide.id))
|
|
3757
3770
|
issues.push({
|
|
@@ -3799,7 +3812,22 @@ function validateDeck(input, options = {}) {
|
|
|
3799
3812
|
message: 'Decks usually open with a "title" slide.'
|
|
3800
3813
|
});
|
|
3801
3814
|
}
|
|
3802
|
-
return { ok: !issues.some((i) => i.level === "error"), deck, issues };
|
|
3815
|
+
return { ok: !issues.some((i) => i.level === "error"), deck, issues: byPath(issues) };
|
|
3816
|
+
}
|
|
3817
|
+
function comparePath(a, b) {
|
|
3818
|
+
for (let k = 0; k < Math.min(a.length, b.length); k++) {
|
|
3819
|
+
const x = a[k];
|
|
3820
|
+
const y = b[k];
|
|
3821
|
+
if (x === y) continue;
|
|
3822
|
+
if (typeof x === "number" && typeof y === "number") return x - y;
|
|
3823
|
+
if (typeof x === "number") return 1;
|
|
3824
|
+
if (typeof y === "number") return -1;
|
|
3825
|
+
return x < y ? -1 : 1;
|
|
3826
|
+
}
|
|
3827
|
+
return a.length - b.length;
|
|
3828
|
+
}
|
|
3829
|
+
function byPath(issues) {
|
|
3830
|
+
return [...issues].sort((a, b) => comparePath(a.path, b.path));
|
|
3803
3831
|
}
|
|
3804
3832
|
function formatPath(path) {
|
|
3805
3833
|
if (!path.length) return "deck";
|
|
@@ -3901,6 +3929,8 @@ function externalizeDeckImages(input, upload, options = {}) {
|
|
|
3901
3929
|
}
|
|
3902
3930
|
|
|
3903
3931
|
export {
|
|
3932
|
+
Image,
|
|
3933
|
+
Item,
|
|
3904
3934
|
baseSlide,
|
|
3905
3935
|
BrandPaletteSchema,
|
|
3906
3936
|
BrandProfileSchema,
|
|
@@ -3963,4 +3993,4 @@ export {
|
|
|
3963
3993
|
inlineDeckImages,
|
|
3964
3994
|
externalizeDeckImages
|
|
3965
3995
|
};
|
|
3966
|
-
//# sourceMappingURL=chunk-
|
|
3996
|
+
//# sourceMappingURL=chunk-AOOBBLKE.js.map
|