@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.cjs +14 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +14 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/registry/defaultRegistry.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1911,7 +1911,7 @@ const ButtonBlock = ({ block }) => {
|
|
|
1911
1911
|
// Handle internal vs external links
|
|
1912
1912
|
const isExternal = url && (url.startsWith('http://') || url.startsWith('https://'));
|
|
1913
1913
|
const linkProps = isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {};
|
|
1914
|
-
return (jsxRuntimeExports.jsx("a", { href: url || '#', className: "inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 text-
|
|
1914
|
+
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 }));
|
|
1915
1915
|
};
|
|
1916
1916
|
const Cover = ({ block, children }) => {
|
|
1917
1917
|
const attrs = block.attributes || {};
|
|
@@ -1987,32 +1987,27 @@ const MediaText = ({ block, children, context }) => {
|
|
|
1987
1987
|
// Content is all other children
|
|
1988
1988
|
const contentElements = childrenArray.filter((_, index) => index !== mediaBlockIndex);
|
|
1989
1989
|
// Build alignment classes - ensure proper container width
|
|
1990
|
-
// For 'wide',
|
|
1991
|
-
//
|
|
1992
|
-
//
|
|
1993
|
-
// Otherwise, use max-w-7xl for standalone wide blocks
|
|
1990
|
+
// For 'wide', media-text blocks are typically inside constrained groups (which use 'container' class)
|
|
1991
|
+
// So we should use 'w-full' to fill the parent container, not apply another max-width
|
|
1992
|
+
// Only use 'max-w-7xl' for truly standalone wide blocks (rare case)
|
|
1994
1993
|
let alignClass;
|
|
1994
|
+
let spacingClass;
|
|
1995
1995
|
if (align === 'full') {
|
|
1996
1996
|
alignClass = 'w-full';
|
|
1997
|
+
// Full-width blocks are typically top-level sections, so add section spacing
|
|
1998
|
+
spacingClass = getSectionSpacingClasses();
|
|
1997
1999
|
}
|
|
1998
2000
|
else if (align === 'wide') {
|
|
1999
|
-
//
|
|
2000
|
-
//
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
if (b.name === 'core/group') {
|
|
2004
|
-
const groupLayout = b.attributes?.layout;
|
|
2005
|
-
return groupLayout?.type === 'constrained';
|
|
2006
|
-
}
|
|
2007
|
-
return false;
|
|
2008
|
-
});
|
|
2009
|
-
// If we have a constrained group in innerBlocks, use w-full to fill parent container
|
|
2010
|
-
// Otherwise, use max-w-7xl for standalone wide blocks
|
|
2011
|
-
alignClass = hasConstrainedGroup ? 'w-full' : 'max-w-7xl mx-auto';
|
|
2001
|
+
// Wide blocks are usually inside constrained groups (which already have container and spacing)
|
|
2002
|
+
// So just fill the parent container without adding section spacing
|
|
2003
|
+
alignClass = 'w-full';
|
|
2004
|
+
spacingClass = ''; // No section spacing - parent group handles it
|
|
2012
2005
|
}
|
|
2013
2006
|
else {
|
|
2014
2007
|
// Default to contained width (not full width)
|
|
2015
2008
|
alignClass = 'container mx-auto';
|
|
2009
|
+
// Contained blocks might be standalone, so add section spacing
|
|
2010
|
+
spacingClass = getSectionSpacingClasses();
|
|
2016
2011
|
}
|
|
2017
2012
|
// Vertical alignment classes
|
|
2018
2013
|
const verticalAlignClass = verticalAlignment === 'top' ? 'items-start' :
|
|
@@ -2022,9 +2017,7 @@ const MediaText = ({ block, children, context }) => {
|
|
|
2022
2017
|
const stackClass = 'flex-col md:flex-row';
|
|
2023
2018
|
// Media position determines order
|
|
2024
2019
|
const isMediaRight = mediaPosition === 'right';
|
|
2025
|
-
|
|
2026
|
-
const spacingClass = getSectionSpacingClasses();
|
|
2027
|
-
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 })] }) }));
|
|
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 })] }) }));
|
|
2028
2021
|
};
|
|
2029
2022
|
const Fallback = ({ block, children }) => {
|
|
2030
2023
|
// Minimal fallback; do not render innerHTML directly in v1 for safety
|