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
package/dist/lib/renderer.js
CHANGED
|
@@ -104,12 +104,12 @@ function isArticlePublished(article) {
|
|
|
104
104
|
var BLOCK_METADATA = {
|
|
105
105
|
"hero-block": {
|
|
106
106
|
name: "Hero",
|
|
107
|
-
description: "Full-width hero section with headline,
|
|
107
|
+
description: "Full-width hero section with headline, description, and CTA",
|
|
108
108
|
category: "Marketing",
|
|
109
109
|
icon: "image",
|
|
110
110
|
fields: [
|
|
111
111
|
{ name: "headline", label: "Headline", type: "Text" },
|
|
112
|
-
{ name: "subheadline", label: "
|
|
112
|
+
{ name: "subheadline", label: "Description", type: "Text" },
|
|
113
113
|
{ name: "ctaText", label: "CTA Label", type: "Text" },
|
|
114
114
|
{ name: "ctaUrl", label: "CTA URL", type: "URL" },
|
|
115
115
|
{ name: "backgroundImage", label: "Background Image", type: "Image" }
|
|
@@ -320,7 +320,7 @@ var fileSchema = z5.object({
|
|
|
320
320
|
var HeroAlignment = ["left", "center", "right"];
|
|
321
321
|
var HeroBlockContentSchema = z6.object({
|
|
322
322
|
headline: z6.string().min(1, "Headline is required").max(100, "Headline too long"),
|
|
323
|
-
subheadline: z6.string().max(200, "
|
|
323
|
+
subheadline: z6.string().max(200, "Description too long").optional(),
|
|
324
324
|
ctaText: z6.string().max(50, "CTA text too long").optional(),
|
|
325
325
|
ctaUrl: z6.string().refine(
|
|
326
326
|
(val) => {
|
|
@@ -759,7 +759,11 @@ function generateCmsOverlayScript(cmsParentOrigin) {
|
|
|
759
759
|
setTimeout(sendReadySignal, 1500);
|
|
760
760
|
|
|
761
761
|
function getBlockElement(blockId) {
|
|
762
|
-
|
|
762
|
+
// Match the real block element, not the hidden sentinel <span> that shares
|
|
763
|
+
// the same data-block-id and precedes it in the DOM. The sentinel is
|
|
764
|
+
// display:none (a 0x0 rect), so selecting it would paint the outline at the
|
|
765
|
+
// top-left corner. Only the stamped block carries data-cms-block.
|
|
766
|
+
return document.querySelector('[data-cms-block][data-block-id="' + blockId + '"]');
|
|
763
767
|
}
|
|
764
768
|
|
|
765
769
|
function getAllBlocks() {
|
|
@@ -789,6 +793,14 @@ function generateCmsOverlayScript(cmsParentOrigin) {
|
|
|
789
793
|
return;
|
|
790
794
|
}
|
|
791
795
|
var rect = el.getBoundingClientRect();
|
|
796
|
+
// A 0x0 rect means the element isn't laid out yet (or is hidden). Hide the
|
|
797
|
+
// outline instead of drawing a zero-size box with a floating label at the
|
|
798
|
+
// top-left corner.
|
|
799
|
+
if (rect.width === 0 && rect.height === 0) {
|
|
800
|
+
outlineEl.style.display = 'none';
|
|
801
|
+
if (label) label.classList.remove('cms-label-visible');
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
792
804
|
outlineEl.style.display = 'block';
|
|
793
805
|
outlineEl.style.top = rect.top + 'px';
|
|
794
806
|
outlineEl.style.left = rect.left + 'px';
|
|
@@ -1098,7 +1110,7 @@ function BlockRenderer({
|
|
|
1098
1110
|
return null;
|
|
1099
1111
|
}
|
|
1100
1112
|
const language = routeParams ? Object.values(routeParams).find((p) => p.schemaName === "language")?.value : void 0;
|
|
1101
|
-
const component = /* @__PURE__ */ jsx(Component, { content: block.content, routeParams, language });
|
|
1113
|
+
const component = /* @__PURE__ */ jsx(Component, { content: block.content, routeParams, language, path });
|
|
1102
1114
|
if (disableEditable) {
|
|
1103
1115
|
return component;
|
|
1104
1116
|
}
|