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