@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.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 rounded-lg object-cover", style: { maxWidth: '100%', height: 'auto' }, 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 || {};
@@ -1978,10 +1983,11 @@ const MediaText = ({ block, children, context }) => {
1978
1983
  const imageUrl = extractImageUrlWithFallback(block);
1979
1984
  if (imageUrl) {
1980
1985
  // Convert to Cloudflare variant if it's a Cloudflare URL
1986
+ // extractImageUrlWithFallback already handles incomplete cloudflareUrl by falling back to innerHTML
1981
1987
  const finalImageUrl = isCloudflareImageUrl(imageUrl)
1982
1988
  ? getCloudflareVariantUrl(imageUrl, { width: 1024 })
1983
1989
  : imageUrl;
1984
- mediaElement = (jsxRuntimeExports.jsx("img", { src: finalImageUrl, alt: "", className: "w-full h-auto rounded-lg shadow-lg object-cover", loading: "lazy" }));
1990
+ 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" }));
1985
1991
  }
1986
1992
  }
1987
1993
  // Content is all other children
@@ -2017,7 +2023,11 @@ const MediaText = ({ block, children, context }) => {
2017
2023
  const stackClass = 'flex-col md:flex-row';
2018
2024
  // Media position determines order
2019
2025
  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 })] }) }));
2026
+ 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
2027
+ 'overflow-hidden' // Ensure images don't overflow
2028
+ ), 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
2029
+ 'min-w-0', // Allow flex item to shrink below content size
2030
+ getContentSpacingClasses()), children: contentElements.length > 0 ? contentElements : children })] }) }));
2021
2031
  };
2022
2032
  const Fallback = ({ block, children }) => {
2023
2033
  // Minimal fallback; do not render innerHTML directly in v1 for safety