@react-hive/honey-style 2.1.0 → 2.2.0
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/css/types.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +15 -9
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.dev.cjs
CHANGED
|
@@ -1879,6 +1879,9 @@ const CSS_SPACING_PROPERTIES = [
|
|
|
1879
1879
|
'paddingRight',
|
|
1880
1880
|
'paddingBottom',
|
|
1881
1881
|
'paddingLeft',
|
|
1882
|
+
'paddingBlock',
|
|
1883
|
+
'paddingBlockStart',
|
|
1884
|
+
'paddingBlockEnd',
|
|
1882
1885
|
'top',
|
|
1883
1886
|
'right',
|
|
1884
1887
|
'bottom',
|
|
@@ -1998,15 +2001,18 @@ const createSpacingMiddleware = ({ spacingMultiplier }) => element => {
|
|
|
1998
2001
|
if (typeof element.props === 'string' &&
|
|
1999
2002
|
KEBAB_CASE_SPACING_PROPERTIES.includes(element.props) &&
|
|
2000
2003
|
typeof element.children === 'string') {
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2004
|
+
// If the whole value contains parentheses, skip entirely (likely calc or var)
|
|
2005
|
+
if (/[()]/.test(element.children)) {
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
const transformedParts = [];
|
|
2009
|
+
const parts = element.children.trim().split(/\s+/);
|
|
2010
|
+
for (const value of parts) {
|
|
2011
|
+
transformedParts.push(
|
|
2012
|
+
// Accept only numeric strings (integers or floats), no units or symbols
|
|
2013
|
+
/^(\d+|\d*\.\d+)$/.test(value) ? `${parseFloat(value) * spacingMultiplier}px` : value);
|
|
2014
|
+
}
|
|
2015
|
+
const transformed = transformedParts.join(' ');
|
|
2010
2016
|
element.return = `${element.props}:${transformed};`;
|
|
2011
2017
|
}
|
|
2012
2018
|
};
|