@marvalt/wparser 0.1.21 → 0.1.23

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.esm.js CHANGED
@@ -1851,7 +1851,7 @@ const Image = ({ block }) => {
1851
1851
  const height = imageAttrs.height;
1852
1852
  imageUrl = getCloudflareVariantUrl(imageUrl, { width, height });
1853
1853
  }
1854
- 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" }));
1854
+ return (jsxRuntimeExports.jsx("img", { src: imageUrl, alt: imageAttrs.alt, width: imageAttrs.width, height: imageAttrs.height, className: "w-full h-auto rounded-lg object-cover", style: { maxWidth: '100%', height: 'auto' }, loading: "lazy" }));
1855
1855
  };
1856
1856
  const List = ({ block, children }) => {
1857
1857
  const attrs = block.attributes || {};
@@ -1865,12 +1865,17 @@ const ListItem = ({ children }) => {
1865
1865
  const Group = ({ block, children }) => {
1866
1866
  const attrs = block.attributes || {};
1867
1867
  const align = attrs['align'];
1868
+ // Layout can be an object with type property, or nested structure
1868
1869
  const layout = attrs['layout'];
1869
1870
  // Determine if this is a section-level group (has alignment) or content-level
1870
1871
  const isSection = align === 'full' || align === 'wide';
1871
1872
  const containerClass = getContainerClasses(align, layout);
1872
1873
  const spacingClass = isSection ? getSectionSpacingClasses() : getContentSpacingClasses();
1873
- return (jsxRuntimeExports.jsx("div", { className: buildClassName(containerClass, spacingClass), children: children }));
1874
+ // Ensure container class is always applied for constrained groups
1875
+ const finalContainerClass = layout?.type === 'constrained' && align === 'wide'
1876
+ ? 'container'
1877
+ : containerClass;
1878
+ return (jsxRuntimeExports.jsx("div", { className: buildClassName(finalContainerClass, spacingClass), children: children }));
1874
1879
  };
1875
1880
  const Columns = ({ block, children }) => {
1876
1881
  const attrs = block.attributes || {};
@@ -1976,10 +1981,11 @@ const MediaText = ({ block, children, context }) => {
1976
1981
  const imageUrl = extractImageUrlWithFallback(block);
1977
1982
  if (imageUrl) {
1978
1983
  // Convert to Cloudflare variant if it's a Cloudflare URL
1984
+ // extractImageUrlWithFallback already handles incomplete cloudflareUrl by falling back to innerHTML
1979
1985
  const finalImageUrl = isCloudflareImageUrl(imageUrl)
1980
1986
  ? getCloudflareVariantUrl(imageUrl, { width: 1024 })
1981
1987
  : imageUrl;
1982
- mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto rounded-lg shadow-lg object-cover", loading: "lazy" }));
1988
+ mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto rounded-lg shadow-lg object-cover", style: { maxWidth: '100%', height: 'auto' }, loading: "lazy" }));
1983
1989
  }
1984
1990
  }
1985
1991
  // Content is all other children
@@ -2015,7 +2021,11 @@ const MediaText = ({ block, children, context }) => {
2015
2021
  const stackClass = 'flex-col md:flex-row';
2016
2022
  // Media position determines order
2017
2023
  const isMediaRight = mediaPosition === 'right';
2018
- 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 })] }) }));
2024
+ return (jsxRuntimeExports.jsx("div", { className: buildClassName(alignClass, spacingClass), children: jsxRuntimeExports.jsxs("div", { className: buildClassName('flex', stackClass, verticalAlignClass, 'gap-6 lg:gap-12', 'w-full'), children: [jsxRuntimeExports.jsx("div", { className: buildClassName(isMediaRight ? 'order-2' : 'order-1', imageFill ? 'w-full md:w-1/2' : 'w-full md:w-1/2', 'min-w-0', // Allow flex item to shrink below content size
2025
+ 'overflow-hidden' // Ensure images don't overflow
2026
+ ), 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
2027
+ 'min-w-0', // Allow flex item to shrink below content size
2028
+ getContentSpacingClasses()), children: contentElements.length > 0 ? contentElements : children })] }) }));
2019
2029
  };
2020
2030
  const Fallback = ({ block, children }) => {
2021
2031
  // Minimal fallback; do not render innerHTML directly in v1 for safety