tailwind-to-style 1.1.0 → 1.1.2

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.
Files changed (2) hide show
  1. package/index.js +17 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2004,10 +2004,12 @@ function generator$20(configOptions = {}) {
2004
2004
  border-spacing: ${value};
2005
2005
  }
2006
2006
  ${prefix}-x${key} {
2007
- border-spacing-x: ${value};
2007
+ --border-spacing-x: ${value};
2008
+ border-spacing: var(--border-spacing-x) var(--border-spacing-y, 0);
2008
2009
  }
2009
2010
  ${prefix}-y${key} {
2010
- border-spacing-y: ${value};
2011
+ --border-spacing-y: ${value};
2012
+ border-spacing: var(--border-spacing-x, 0) var(--border-spacing-y);
2011
2013
  }
2012
2014
  `;
2013
2015
  });
@@ -5712,22 +5714,27 @@ function tws(classNames, convertToJson) {
5712
5714
  const cssString = generateTailwindCssString().replace(/\s\s+/g, " ");
5713
5715
  const cssObject = convertCssToObject(cssString);
5714
5716
 
5715
- const classes = classNames.split(" ");
5717
+ const classes = classNames.match(/[\w-]+(?:\[[^\]]+\])?|\w+/g);
5718
+
5716
5719
  let cssResult = classes.map((className) => {
5717
5720
  if (cssObject[className]) {
5718
5721
  return cssObject[className];
5719
5722
  } else if (className.includes("[")) {
5720
- const customValue = className.match(/\[([^\]]+)\]/)[1];
5721
- const baseKey = className.split("[")[0];
5722
- if (cssObject[`${baseKey}custom`]) {
5723
- return cssObject[`${baseKey}custom`].replace(
5724
- /custom_value/g,
5725
- customValue
5726
- );
5723
+ const match = className.match(/\[([^\]]+)\]/);
5724
+ if (match) {
5725
+ const customValue = match[1];
5726
+ const baseKey = className.split("[")[0];
5727
+ if (cssObject[`${baseKey}custom`]) {
5728
+ return cssObject[`${baseKey}custom`].replace(
5729
+ /custom_value/g,
5730
+ customValue
5731
+ );
5732
+ }
5727
5733
  }
5728
5734
  }
5729
5735
  return "";
5730
5736
  });
5737
+
5731
5738
  cssResult = replaceAndRemoveCSSVariables(cssResult.join(""));
5732
5739
  cssResult = inlineStyleToJson(cssResult);
5733
5740
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-to-style",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Convert tailwind classes to inline style",
5
5
  "main": "index.js",
6
6
  "scripts": {