cms-renderer 0.7.0 → 0.8.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 +31 -0
- package/dist/lib/ai-preview.d.ts +62 -0
- package/dist/lib/ai-preview.js +114 -0
- package/dist/lib/ai-preview.js.map +1 -0
- package/dist/lib/block-renderer.js +14 -2
- package/dist/lib/block-renderer.js.map +1 -1
- package/dist/lib/custom-schemas.js +126 -42
- package/dist/lib/custom-schemas.js.map +1 -1
- package/dist/lib/docs-markdown.js +49 -1
- package/dist/lib/docs-markdown.js.map +1 -1
- package/dist/lib/markdown-utils.js +46 -1
- package/dist/lib/markdown-utils.js.map +1 -1
- package/dist/lib/parametric-route.js +17 -5
- package/dist/lib/parametric-route.js.map +1 -1
- package/dist/lib/renderer.js +17 -5
- package/dist/lib/renderer.js.map +1 -1
- package/dist/lib/types.d.ts +2 -0
- package/dist/lib/types.js.map +1 -1
- package/package.json +5 -1
|
@@ -32,12 +32,12 @@ function isArticlePublished(article) {
|
|
|
32
32
|
var BLOCK_METADATA = {
|
|
33
33
|
"hero-block": {
|
|
34
34
|
name: "Hero",
|
|
35
|
-
description: "Full-width hero section with headline,
|
|
35
|
+
description: "Full-width hero section with headline, description, and CTA",
|
|
36
36
|
category: "Marketing",
|
|
37
37
|
icon: "image",
|
|
38
38
|
fields: [
|
|
39
39
|
{ name: "headline", label: "Headline", type: "Text" },
|
|
40
|
-
{ name: "subheadline", label: "
|
|
40
|
+
{ name: "subheadline", label: "Description", type: "Text" },
|
|
41
41
|
{ name: "ctaText", label: "CTA Label", type: "Text" },
|
|
42
42
|
{ name: "ctaUrl", label: "CTA URL", type: "URL" },
|
|
43
43
|
{ name: "backgroundImage", label: "Background Image", type: "Image" }
|
|
@@ -248,7 +248,7 @@ var fileSchema = z5.object({
|
|
|
248
248
|
var HeroAlignment = ["left", "center", "right"];
|
|
249
249
|
var HeroBlockContentSchema = z6.object({
|
|
250
250
|
headline: z6.string().min(1, "Headline is required").max(100, "Headline too long"),
|
|
251
|
-
subheadline: z6.string().max(200, "
|
|
251
|
+
subheadline: z6.string().max(200, "Description too long").optional(),
|
|
252
252
|
ctaText: z6.string().max(50, "CTA text too long").optional(),
|
|
253
253
|
ctaUrl: z6.string().refine(
|
|
254
254
|
(val) => {
|
|
@@ -687,7 +687,11 @@ function generateCmsOverlayScript(cmsParentOrigin) {
|
|
|
687
687
|
setTimeout(sendReadySignal, 1500);
|
|
688
688
|
|
|
689
689
|
function getBlockElement(blockId) {
|
|
690
|
-
|
|
690
|
+
// Match the real block element, not the hidden sentinel <span> that shares
|
|
691
|
+
// the same data-block-id and precedes it in the DOM. The sentinel is
|
|
692
|
+
// display:none (a 0x0 rect), so selecting it would paint the outline at the
|
|
693
|
+
// top-left corner. Only the stamped block carries data-cms-block.
|
|
694
|
+
return document.querySelector('[data-cms-block][data-block-id="' + blockId + '"]');
|
|
691
695
|
}
|
|
692
696
|
|
|
693
697
|
function getAllBlocks() {
|
|
@@ -717,6 +721,14 @@ function generateCmsOverlayScript(cmsParentOrigin) {
|
|
|
717
721
|
return;
|
|
718
722
|
}
|
|
719
723
|
var rect = el.getBoundingClientRect();
|
|
724
|
+
// A 0x0 rect means the element isn't laid out yet (or is hidden). Hide the
|
|
725
|
+
// outline instead of drawing a zero-size box with a floating label at the
|
|
726
|
+
// top-left corner.
|
|
727
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
728
|
+
outlineEl.style.display = 'none';
|
|
729
|
+
if (label) label.classList.remove('cms-label-visible');
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
720
732
|
outlineEl.style.display = 'block';
|
|
721
733
|
outlineEl.style.top = rect.top + 'px';
|
|
722
734
|
outlineEl.style.left = rect.left + 'px';
|
|
@@ -1026,7 +1038,7 @@ function BlockRenderer({
|
|
|
1026
1038
|
return null;
|
|
1027
1039
|
}
|
|
1028
1040
|
const language = routeParams ? Object.values(routeParams).find((p) => p.schemaName === "language")?.value : void 0;
|
|
1029
|
-
const component = /* @__PURE__ */ jsx(Component, { content: block.content, routeParams, language });
|
|
1041
|
+
const component = /* @__PURE__ */ jsx(Component, { content: block.content, routeParams, language, path });
|
|
1030
1042
|
if (disableEditable) {
|
|
1031
1043
|
return component;
|
|
1032
1044
|
}
|