@marvalt/wparser 0.1.19 → 0.1.21

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
@@ -1909,7 +1909,7 @@ const ButtonBlock = ({ block }) => {
1909
1909
  // Handle internal vs external links
1910
1910
  const isExternal = url && (url.startsWith('http://') || url.startsWith('https://'));
1911
1911
  const linkProps = isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {};
1912
- return (jsxRuntimeExports.jsx("a", { href: url || '#', className: "inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 text-white font-medium hover:bg-primary/90 transition-colors", ...linkProps, children: buttonText }));
1912
+ return (jsxRuntimeExports.jsx("a", { href: url || '#', className: "inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 text-primary-foreground font-medium hover:bg-primary/90 transition-colors", ...linkProps, children: buttonText }));
1913
1913
  };
1914
1914
  const Cover = ({ block, children }) => {
1915
1915
  const attrs = block.attributes || {};
@@ -1985,32 +1985,27 @@ const MediaText = ({ block, children, context }) => {
1985
1985
  // Content is all other children
1986
1986
  const contentElements = childrenArray.filter((_, index) => index !== mediaBlockIndex);
1987
1987
  // Build alignment classes - ensure proper container width
1988
- // For 'wide', check if we're inside a constrained group context
1989
- // If innerBlocks contain a group with constrained layout, the parent likely has constrained layout too
1990
- // In that case, use w-full to fill the parent container (which is already boxed)
1991
- // Otherwise, use max-w-7xl for standalone wide blocks
1988
+ // For 'wide', media-text blocks are typically inside constrained groups (which use 'container' class)
1989
+ // So we should use 'w-full' to fill the parent container, not apply another max-width
1990
+ // Only use 'max-w-7xl' for truly standalone wide blocks (rare case)
1992
1991
  let alignClass;
1992
+ let spacingClass;
1993
1993
  if (align === 'full') {
1994
1994
  alignClass = 'w-full';
1995
+ // Full-width blocks are typically top-level sections, so add section spacing
1996
+ spacingClass = getSectionSpacingClasses();
1995
1997
  }
1996
1998
  else if (align === 'wide') {
1997
- // Check if media-text content is wrapped in a constrained group
1998
- // This indicates the block is in a constrained layout context
1999
- // In that case, fill the parent container (which is already boxed) rather than applying another container
2000
- const hasConstrainedGroup = innerBlocks.some((b) => {
2001
- if (b.name === 'core/group') {
2002
- const groupLayout = b.attributes?.layout;
2003
- return groupLayout?.type === 'constrained';
2004
- }
2005
- return false;
2006
- });
2007
- // If we have a constrained group in innerBlocks, use w-full to fill parent container
2008
- // Otherwise, use max-w-7xl for standalone wide blocks
2009
- alignClass = hasConstrainedGroup ? 'w-full' : 'max-w-7xl mx-auto';
1999
+ // Wide blocks are usually inside constrained groups (which already have container and spacing)
2000
+ // So just fill the parent container without adding section spacing
2001
+ alignClass = 'w-full';
2002
+ spacingClass = ''; // No section spacing - parent group handles it
2010
2003
  }
2011
2004
  else {
2012
2005
  // Default to contained width (not full width)
2013
2006
  alignClass = 'container mx-auto';
2007
+ // Contained blocks might be standalone, so add section spacing
2008
+ spacingClass = getSectionSpacingClasses();
2014
2009
  }
2015
2010
  // Vertical alignment classes
2016
2011
  const verticalAlignClass = verticalAlignment === 'top' ? 'items-start' :
@@ -2020,9 +2015,7 @@ const MediaText = ({ block, children, context }) => {
2020
2015
  const stackClass = 'flex-col md:flex-row';
2021
2016
  // Media position determines order
2022
2017
  const isMediaRight = mediaPosition === 'right';
2023
- // Add section spacing for consistent vertical rhythm
2024
- const spacingClass = getSectionSpacingClasses();
2025
- return (jsxRuntimeExports.jsx("div", { className: buildClassName(alignClass, spacingClass, 'px-4'), 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 })] }) }));
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 })] }) }));
2026
2019
  };
2027
2020
  const Fallback = ({ block, children }) => {
2028
2021
  // Minimal fallback; do not render innerHTML directly in v1 for safety