@marvalt/wparser 0.1.21 → 0.1.22

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/index.cjs CHANGED
@@ -1853,7 +1853,7 @@ const Image = ({ block }) => {
1853
1853
  const height = imageAttrs.height;
1854
1854
  imageUrl = getCloudflareVariantUrl(imageUrl, { width, height });
1855
1855
  }
1856
- return (jsxRuntimeExports.jsx("img", { src: imageUrl, alt: imageAttrs.alt, width: imageAttrs.width, height: imageAttrs.height, className: "w-full h-auto object-cover rounded-lg", loading: "lazy" }));
1856
+ return (jsxRuntimeExports.jsx("img", { src: imageUrl, alt: imageAttrs.alt, width: imageAttrs.width, height: imageAttrs.height, className: "w-full h-auto max-w-full object-contain rounded-lg", loading: "lazy" }));
1857
1857
  };
1858
1858
  const List = ({ block, children }) => {
1859
1859
  const attrs = block.attributes || {};
@@ -1867,12 +1867,17 @@ const ListItem = ({ children }) => {
1867
1867
  const Group = ({ block, children }) => {
1868
1868
  const attrs = block.attributes || {};
1869
1869
  const align = attrs['align'];
1870
+ // Layout can be an object with type property, or nested structure
1870
1871
  const layout = attrs['layout'];
1871
1872
  // Determine if this is a section-level group (has alignment) or content-level
1872
1873
  const isSection = align === 'full' || align === 'wide';
1873
1874
  const containerClass = getContainerClasses(align, layout);
1874
1875
  const spacingClass = isSection ? getSectionSpacingClasses() : getContentSpacingClasses();
1875
- return (jsxRuntimeExports.jsx("div", { className: buildClassName(containerClass, spacingClass), children: children }));
1876
+ // Ensure container class is always applied for constrained groups
1877
+ const finalContainerClass = layout?.type === 'constrained' && align === 'wide'
1878
+ ? 'container'
1879
+ : containerClass;
1880
+ return (jsxRuntimeExports.jsx("div", { className: buildClassName(finalContainerClass, spacingClass), children: children }));
1876
1881
  };
1877
1882
  const Columns = ({ block, children }) => {
1878
1883
  const attrs = block.attributes || {};
@@ -1981,7 +1986,7 @@ const MediaText = ({ block, children, context }) => {
1981
1986
  const finalImageUrl = isCloudflareImageUrl(imageUrl)
1982
1987
  ? getCloudflareVariantUrl(imageUrl, { width: 1024 })
1983
1988
  : imageUrl;
1984
- mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto rounded-lg shadow-lg object-cover", loading: "lazy" }));
1989
+ mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto max-w-full rounded-lg shadow-lg object-contain", loading: "lazy" }));
1985
1990
  }
1986
1991
  }
1987
1992
  // Content is all other children
@@ -2017,7 +2022,11 @@ const MediaText = ({ block, children, context }) => {
2017
2022
  const stackClass = 'flex-col md:flex-row';
2018
2023
  // Media position determines order
2019
2024
  const isMediaRight = mediaPosition === 'right';
2020
- return (jsxRuntimeExports.jsx("div", { className: buildClassName(alignClass, spacingClass), children: jsxRuntimeExports.jsxs("div", { className: buildClassName('flex', stackClass, verticalAlignClass, 'gap-6 lg:gap-12'), children: [jsxRuntimeExports.jsx("div", { className: buildClassName(isMediaRight ? 'order-2' : 'order-1', imageFill ? 'w-full md:w-1/2' : 'flex-shrink-0 md:w-1/2'), children: mediaElement || jsxRuntimeExports.jsx("div", { className: "bg-gray-200 h-64 rounded-lg" }) }), jsxRuntimeExports.jsx("div", { className: buildClassName(isMediaRight ? 'order-1' : 'order-2', 'md:w-1/2', getContentSpacingClasses()), children: contentElements.length > 0 ? contentElements : children })] }) }));
2025
+ return (jsxRuntimeExports.jsx("div", { className: buildClassName(alignClass, spacingClass), children: jsxRuntimeExports.jsxs("div", { className: buildClassName('flex', stackClass, verticalAlignClass, 'gap-6 lg:gap-12'), children: [jsxRuntimeExports.jsx("div", { className: buildClassName(isMediaRight ? 'order-2' : 'order-1', imageFill ? 'w-full md:w-1/2' : 'flex-shrink-0 md:w-1/2', 'overflow-hidden', // Ensure images don't overflow
2026
+ 'max-w-full' // Ensure section doesn't exceed container
2027
+ ), children: mediaElement || jsxRuntimeExports.jsx("div", { className: "bg-gray-200 h-64 rounded-lg" }) }), jsxRuntimeExports.jsx("div", { className: buildClassName(isMediaRight ? 'order-1' : 'order-2', 'w-full md:w-1/2', // Explicit width to ensure proper sizing
2028
+ 'flex-shrink-0', // Prevent content from shrinking
2029
+ getContentSpacingClasses()), children: contentElements.length > 0 ? contentElements : children })] }) }));
2021
2030
  };
2022
2031
  const Fallback = ({ block, children }) => {
2023
2032
  // Minimal fallback; do not render innerHTML directly in v1 for safety