@marvalt/wparser 0.1.32 → 0.1.33

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
@@ -2071,6 +2071,16 @@ function extractTextColor(block, context) {
2071
2071
  if (!wpColorName || typeof wpColorName !== 'string') {
2072
2072
  return null;
2073
2073
  }
2074
+ // Special handling for common WordPress color names when used as text color
2075
+ // These mappings take precedence because text color semantics differ from background color
2076
+ const textColorMap = {
2077
+ 'contrast': 'text-gray-900', // Contrast text is typically dark/black (opposite of contrast background)
2078
+ 'base': 'text-white', // Base text on dark backgrounds
2079
+ };
2080
+ // Check special text color mappings first
2081
+ if (textColorMap[wpColorName]) {
2082
+ return textColorMap[wpColorName];
2083
+ }
2074
2084
  // Use colorMapper from context if available
2075
2085
  // Note: colorMapper might return combined classes like "bg-gray-900 text-white"
2076
2086
  // We'll extract just the text color part
@@ -2085,13 +2095,7 @@ function extractTextColor(block, context) {
2085
2095
  }
2086
2096
  }
2087
2097
  }
2088
- // Special handling for common WordPress color names when used as text color
2089
- // These are common text color mappings that might not be in the colorMapper
2090
- const textColorMap = {
2091
- 'contrast': 'text-gray-900', // Contrast text is typically dark/black
2092
- 'base': 'text-white', // Base text on dark backgrounds
2093
- };
2094
- return textColorMap[wpColorName] || null;
2098
+ return null;
2095
2099
  }
2096
2100
  /**
2097
2101
  * Extract spacer height from block attributes or innerHTML