@marvalt/wparser 0.1.60 → 0.1.61
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 +19 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +19 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/registry/defaultRegistry.d.ts.map +1 -1
- package/dist/utils/blockExtractors.d.ts +1 -1
- package/dist/utils/blockExtractors.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2149,6 +2149,10 @@ function extractSpacerHeight(block) {
|
|
|
2149
2149
|
return height;
|
|
2150
2150
|
}
|
|
2151
2151
|
if (typeof height === 'string') {
|
|
2152
|
+
// If it's a CSS var or clamp, return as-is
|
|
2153
|
+
if (height.startsWith('var(') || height.includes('clamp(')) {
|
|
2154
|
+
return height;
|
|
2155
|
+
}
|
|
2152
2156
|
// Parse "100px" or "100" to number
|
|
2153
2157
|
const match = height.match(/^(\d+)/);
|
|
2154
2158
|
if (match) {
|
|
@@ -2159,9 +2163,17 @@ function extractSpacerHeight(block) {
|
|
|
2159
2163
|
if (block.innerHTML) {
|
|
2160
2164
|
const styleMatch = block.innerHTML.match(/style=["']([^"']+)["']/i);
|
|
2161
2165
|
if (styleMatch) {
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2166
|
+
// First look for CSS var or clamp
|
|
2167
|
+
const cssVarMatch = styleMatch[1].match(/height:\s*([^;]+);?/i);
|
|
2168
|
+
if (cssVarMatch) {
|
|
2169
|
+
const cssHeight = cssVarMatch[1].trim();
|
|
2170
|
+
if (cssHeight.startsWith('var(') || cssHeight.includes('clamp(')) {
|
|
2171
|
+
return cssHeight;
|
|
2172
|
+
}
|
|
2173
|
+
const numericMatch = cssHeight.match(/^(\d+)/);
|
|
2174
|
+
if (numericMatch) {
|
|
2175
|
+
return parseInt(numericMatch[1], 10);
|
|
2176
|
+
}
|
|
2165
2177
|
}
|
|
2166
2178
|
}
|
|
2167
2179
|
}
|
|
@@ -2656,7 +2668,10 @@ function createDefaultRegistry(colorMapper, spacingConfig) {
|
|
|
2656
2668
|
// Spacer block - adds vertical spacing
|
|
2657
2669
|
'core/spacer': ({ block }) => {
|
|
2658
2670
|
const height = extractSpacerHeight(block);
|
|
2659
|
-
if (
|
|
2671
|
+
if (typeof height === 'string') {
|
|
2672
|
+
return jsxRuntimeExports.jsx("div", { style: { height }, "aria-hidden": "true" });
|
|
2673
|
+
}
|
|
2674
|
+
if (typeof height === 'number' && height > 0) {
|
|
2660
2675
|
return jsxRuntimeExports.jsx("div", { style: { height: `${height}px` }, "aria-hidden": "true" });
|
|
2661
2676
|
}
|
|
2662
2677
|
// Default fallback if height not found
|