tailwind-to-style 2.8.8 → 2.8.10

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * tailwind-to-style v2.8.8
2
+ * tailwind-to-style v2.8.10
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -6476,6 +6476,8 @@ var tailwindToStyle = (function (exports) {
6476
6476
  if (!cssObject) {
6477
6477
  cssObject = convertCssToObject(twString);
6478
6478
  }
6479
+ const fractionDenominators = [2, 3, 4, 5, 6, 12];
6480
+ const fractionPrefixes = ["w-", "h-", "max-w-", "max-h-", "min-w-", "min-h-", "top-", "bottom-", "left-", "right-", "inset-", "inset-x-", "inset-y-", "translate-x-", "translate-y-", "rounded-t-", "rounded-b-", "rounded-l-", "rounded-r-", "rounded-bl-", "rounded-br-", "rounded-tl-", "rounded-tr-", "flex-basis-", "z-"];
6479
6481
  const breakpoints = {
6480
6482
  sm: "@media (min-width: 640px)",
6481
6483
  md: "@media (min-width: 768px)",
@@ -6792,8 +6794,7 @@ var tailwindToStyle = (function (exports) {
6792
6794
  if (opacityValue >= 0 && opacityValue <= 100) {
6793
6795
  // Check if this could be a fraction (e.g., w-2/3, h-1/2)
6794
6796
  // Fractions typically have denominators of 2, 3, 4, 5, 6, 12
6795
- const fractionDenominators = [2, 3, 4, 5, 6, 12];
6796
- const couldBeFraction = fractionDenominators.includes(opacityValue) && (className.startsWith('w-') || className.startsWith('h-') || className.startsWith('max-w-') || className.startsWith('max-h-') || className.startsWith('min-w-') || className.startsWith('min-h-'));
6797
+ const couldBeFraction = fractionDenominators.includes(opacityValue) && fractionPrefixes.some(prefix => className.startsWith(prefix) || className.startsWith(`-${prefix}`));
6797
6798
  if (!couldBeFraction) {
6798
6799
  baseClassName = className.replace(/\/\d+$/, "");
6799
6800
  hasOpacityModifier = true;
@@ -6959,9 +6960,8 @@ var tailwindToStyle = (function (exports) {
6959
6960
  const opacityValue = parseInt(opacityMatch[1], 10);
6960
6961
  // If it's a valid opacity value (0-100), treat it as opacity modifier
6961
6962
  if (opacityValue >= 0 && opacityValue <= 100) {
6962
- // Check if this could be a fraction (e.g., w-2/3, h-1/2)
6963
- const fractionDenominators = [2, 3, 4, 5, 6, 12];
6964
- const couldBeFraction = fractionDenominators.includes(opacityValue) && (pureClassName.startsWith('w-') || pureClassName.startsWith('h-') || pureClassName.startsWith('max-w-') || pureClassName.startsWith('max-h-') || pureClassName.startsWith('min-w-') || pureClassName.startsWith('min-h-'));
6963
+ // Check if this could be a fraction (e.g., w-2/3, h-1/2, top-1/2, etc.)
6964
+ const couldBeFraction = fractionDenominators.includes(opacityValue) && fractionPrefixes.some(prefix => pureClassName.startsWith(prefix) || pureClassName.startsWith(`-${prefix}`));
6965
6965
  if (!couldBeFraction) {
6966
6966
  baseClassName = pureClassName.replace(/\/\d+$/, "");
6967
6967
  hasOpacityModifier = true;
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * tailwind-to-style v2.8.8
2
+ * tailwind-to-style v2.8.10
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -6477,6 +6477,8 @@ if (!twString) {
6477
6477
  if (!cssObject) {
6478
6478
  cssObject = convertCssToObject(twString);
6479
6479
  }
6480
+ const fractionDenominators = [2, 3, 4, 5, 6, 12];
6481
+ const fractionPrefixes = ["w-", "h-", "max-w-", "max-h-", "min-w-", "min-h-", "top-", "bottom-", "left-", "right-", "inset-", "inset-x-", "inset-y-", "translate-x-", "translate-y-", "rounded-t-", "rounded-b-", "rounded-l-", "rounded-r-", "rounded-bl-", "rounded-br-", "rounded-tl-", "rounded-tr-", "flex-basis-", "z-"];
6480
6482
  const breakpoints = {
6481
6483
  sm: "@media (min-width: 640px)",
6482
6484
  md: "@media (min-width: 768px)",
@@ -6793,8 +6795,7 @@ function tws(classNames, convertToJson) {
6793
6795
  if (opacityValue >= 0 && opacityValue <= 100) {
6794
6796
  // Check if this could be a fraction (e.g., w-2/3, h-1/2)
6795
6797
  // Fractions typically have denominators of 2, 3, 4, 5, 6, 12
6796
- const fractionDenominators = [2, 3, 4, 5, 6, 12];
6797
- const couldBeFraction = fractionDenominators.includes(opacityValue) && (className.startsWith('w-') || className.startsWith('h-') || className.startsWith('max-w-') || className.startsWith('max-h-') || className.startsWith('min-w-') || className.startsWith('min-h-'));
6798
+ const couldBeFraction = fractionDenominators.includes(opacityValue) && fractionPrefixes.some(prefix => className.startsWith(prefix) || className.startsWith(`-${prefix}`));
6798
6799
  if (!couldBeFraction) {
6799
6800
  baseClassName = className.replace(/\/\d+$/, "");
6800
6801
  hasOpacityModifier = true;
@@ -6960,9 +6961,8 @@ function processClass(cls, selector, styles) {
6960
6961
  const opacityValue = parseInt(opacityMatch[1], 10);
6961
6962
  // If it's a valid opacity value (0-100), treat it as opacity modifier
6962
6963
  if (opacityValue >= 0 && opacityValue <= 100) {
6963
- // Check if this could be a fraction (e.g., w-2/3, h-1/2)
6964
- const fractionDenominators = [2, 3, 4, 5, 6, 12];
6965
- const couldBeFraction = fractionDenominators.includes(opacityValue) && (pureClassName.startsWith('w-') || pureClassName.startsWith('h-') || pureClassName.startsWith('max-w-') || pureClassName.startsWith('max-h-') || pureClassName.startsWith('min-w-') || pureClassName.startsWith('min-h-'));
6964
+ // Check if this could be a fraction (e.g., w-2/3, h-1/2, top-1/2, etc.)
6965
+ const couldBeFraction = fractionDenominators.includes(opacityValue) && fractionPrefixes.some(prefix => pureClassName.startsWith(prefix) || pureClassName.startsWith(`-${prefix}`));
6966
6966
  if (!couldBeFraction) {
6967
6967
  baseClassName = pureClassName.replace(/\/\d+$/, "");
6968
6968
  hasOpacityModifier = true;
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * tailwind-to-style v2.8.8
2
+ * tailwind-to-style v2.8.10
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -6473,6 +6473,8 @@ if (!twString) {
6473
6473
  if (!cssObject) {
6474
6474
  cssObject = convertCssToObject(twString);
6475
6475
  }
6476
+ const fractionDenominators = [2, 3, 4, 5, 6, 12];
6477
+ const fractionPrefixes = ["w-", "h-", "max-w-", "max-h-", "min-w-", "min-h-", "top-", "bottom-", "left-", "right-", "inset-", "inset-x-", "inset-y-", "translate-x-", "translate-y-", "rounded-t-", "rounded-b-", "rounded-l-", "rounded-r-", "rounded-bl-", "rounded-br-", "rounded-tl-", "rounded-tr-", "flex-basis-", "z-"];
6476
6478
  const breakpoints = {
6477
6479
  sm: "@media (min-width: 640px)",
6478
6480
  md: "@media (min-width: 768px)",
@@ -6789,8 +6791,7 @@ function tws(classNames, convertToJson) {
6789
6791
  if (opacityValue >= 0 && opacityValue <= 100) {
6790
6792
  // Check if this could be a fraction (e.g., w-2/3, h-1/2)
6791
6793
  // Fractions typically have denominators of 2, 3, 4, 5, 6, 12
6792
- const fractionDenominators = [2, 3, 4, 5, 6, 12];
6793
- const couldBeFraction = fractionDenominators.includes(opacityValue) && (className.startsWith('w-') || className.startsWith('h-') || className.startsWith('max-w-') || className.startsWith('max-h-') || className.startsWith('min-w-') || className.startsWith('min-h-'));
6794
+ const couldBeFraction = fractionDenominators.includes(opacityValue) && fractionPrefixes.some(prefix => className.startsWith(prefix) || className.startsWith(`-${prefix}`));
6794
6795
  if (!couldBeFraction) {
6795
6796
  baseClassName = className.replace(/\/\d+$/, "");
6796
6797
  hasOpacityModifier = true;
@@ -6956,9 +6957,8 @@ function processClass(cls, selector, styles) {
6956
6957
  const opacityValue = parseInt(opacityMatch[1], 10);
6957
6958
  // If it's a valid opacity value (0-100), treat it as opacity modifier
6958
6959
  if (opacityValue >= 0 && opacityValue <= 100) {
6959
- // Check if this could be a fraction (e.g., w-2/3, h-1/2)
6960
- const fractionDenominators = [2, 3, 4, 5, 6, 12];
6961
- const couldBeFraction = fractionDenominators.includes(opacityValue) && (pureClassName.startsWith('w-') || pureClassName.startsWith('h-') || pureClassName.startsWith('max-w-') || pureClassName.startsWith('max-h-') || pureClassName.startsWith('min-w-') || pureClassName.startsWith('min-h-'));
6960
+ // Check if this could be a fraction (e.g., w-2/3, h-1/2, top-1/2, etc.)
6961
+ const couldBeFraction = fractionDenominators.includes(opacityValue) && fractionPrefixes.some(prefix => pureClassName.startsWith(prefix) || pureClassName.startsWith(`-${prefix}`));
6962
6962
  if (!couldBeFraction) {
6963
6963
  baseClassName = pureClassName.replace(/\/\d+$/, "");
6964
6964
  hasOpacityModifier = true;