cms-renderer 0.7.0 → 0.8.1

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.
@@ -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, subheadline, and CTA",
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: "Subheadline", type: "Text" },
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, "Subheadline too long").optional(),
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
- return document.querySelector('[data-block-id="' + blockId + '"]');
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
  }
@@ -1204,7 +1216,7 @@ async function renderParametricRoute({
1204
1216
  const blocks = [];
1205
1217
  for (const block of blockResults) {
1206
1218
  if (!block) continue;
1207
- const blockContent = previewMode ? block.draft_content : block.published_content;
1219
+ const blockContent = previewMode ? block.draft_content ?? block.published_content : block.published_content;
1208
1220
  if (blockContent == null) continue;
1209
1221
  let content = null;
1210
1222
  if (aiPreviewIndex !== null) {