tailwind-to-style 2.12.4 → 2.12.6

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.12.4
2
+ * tailwind-to-style v2.12.6
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -1815,10 +1815,9 @@ function resetTailwindCache() {
1815
1815
  instance = null;
1816
1816
  }
1817
1817
 
1818
- var _process$env;
1819
- /**
1820
- * Logger class with configurable log levels
1821
- * Prevents console spam in production
1818
+ /**
1819
+ * Logger class with configurable log levels
1820
+ * Prevents console spam in production
1822
1821
  */
1823
1822
  class Logger {
1824
1823
  constructor() {
@@ -1833,9 +1832,9 @@ class Logger {
1833
1832
  };
1834
1833
  }
1835
1834
 
1836
- /**
1837
- * Set the log level
1838
- * @param {string} level - One of 'debug', 'info', 'warn', 'error', 'silent'
1835
+ /**
1836
+ * Set the log level
1837
+ * @param {string} level - One of 'debug', 'info', 'warn', 'error', 'silent'
1839
1838
  */
1840
1839
  setLevel(level) {
1841
1840
  if (this.levels[level] !== undefined) {
@@ -1843,22 +1842,22 @@ class Logger {
1843
1842
  }
1844
1843
  }
1845
1844
 
1846
- /**
1847
- * Get current log level
1845
+ /**
1846
+ * Get current log level
1848
1847
  */
1849
1848
  getLevel() {
1850
1849
  return this.level;
1851
1850
  }
1852
1851
 
1853
- /**
1854
- * Check if a message should be logged
1852
+ /**
1853
+ * Check if a message should be logged
1855
1854
  */
1856
1855
  shouldLog(level) {
1857
1856
  return this.levels[level] >= this.levels[this.level];
1858
1857
  }
1859
1858
 
1860
- /**
1861
- * Log debug message
1859
+ /**
1860
+ * Log debug message
1862
1861
  */
1863
1862
  debug(message) {
1864
1863
  if (this.shouldLog("debug")) {
@@ -1869,8 +1868,8 @@ class Logger {
1869
1868
  }
1870
1869
  }
1871
1870
 
1872
- /**
1873
- * Log info message
1871
+ /**
1872
+ * Log info message
1874
1873
  */
1875
1874
  info(message) {
1876
1875
  if (this.shouldLog("info")) {
@@ -1881,8 +1880,8 @@ class Logger {
1881
1880
  }
1882
1881
  }
1883
1882
 
1884
- /**
1885
- * Log warning message
1883
+ /**
1884
+ * Log warning message
1886
1885
  */
1887
1886
  warn(message) {
1888
1887
  if (this.shouldLog("warn")) {
@@ -1893,8 +1892,8 @@ class Logger {
1893
1892
  }
1894
1893
  }
1895
1894
 
1896
- /**
1897
- * Log error message
1895
+ /**
1896
+ * Log error message
1898
1897
  */
1899
1898
  error(message) {
1900
1899
  if (this.shouldLog("error")) {
@@ -1907,7 +1906,14 @@ class Logger {
1907
1906
  }
1908
1907
 
1909
1908
  // Create singleton instance with production-safe defaults
1910
- const isProduction = typeof process !== "undefined" && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === "production";
1909
+ // Use try-catch to safely check for Node.js environment
1910
+ let isProduction = false;
1911
+ try {
1912
+ isProduction = typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.NODE_ENV === "production";
1913
+ } catch (e) {
1914
+ // In browser environment, default to development mode
1915
+ isProduction = false;
1916
+ }
1911
1917
  const logger = new Logger(isProduction ? "error" : "warn");
1912
1918
 
1913
1919
  /**
@@ -9688,8 +9694,11 @@ function styled(component) {
9688
9694
  const variantPrefix = getVariantPrefix(namingOptions);
9689
9695
  const sep = namingOptions.separator || styledConfig.separator || "-";
9690
9696
  const variantSelector = `&.${variantPrefix}${variantKey}${sep}${variantValue}`;
9691
- if (variantClasses && variantClasses.trim()) {
9692
- nestedVariants[variantSelector] = variantClasses;
9697
+
9698
+ // Handle both string and array of classes
9699
+ const normalizedClasses = Array.isArray(variantClasses) ? variantClasses.join(" ") : variantClasses;
9700
+ if (normalizedClasses && normalizedClasses.trim()) {
9701
+ nestedVariants[variantSelector] = normalizedClasses;
9693
9702
  }
9694
9703
  });
9695
9704
  });
@@ -9709,16 +9718,22 @@ function styled(component) {
9709
9718
  return `${variantPrefix}${key}${sep}${value}`;
9710
9719
  }).join(".");
9711
9720
  const compoundSelector = `&.${conditionClasses}`;
9712
- if (compoundClass && compoundClass.trim()) {
9713
- nestedVariants[compoundSelector] = compoundClass;
9721
+
9722
+ // Handle both string and array of classes
9723
+ const normalizedClass = Array.isArray(compoundClass) ? compoundClass.join(" ") : compoundClass;
9724
+ if (normalizedClass && normalizedClass.trim()) {
9725
+ nestedVariants[compoundSelector] = normalizedClass;
9714
9726
  }
9715
9727
  });
9716
9728
 
9717
9729
  // 3. Build final structure: [base, { nested variants }]
9718
9730
  // This matches the twsx() format exactly
9719
9731
  const styleArray = [];
9720
- if (base.trim()) {
9721
- styleArray.push(base);
9732
+
9733
+ // Handle both string and array of classes for base
9734
+ const normalizedBase = Array.isArray(base) ? base.join(" ") : base;
9735
+ if (normalizedBase && normalizedBase.trim()) {
9736
+ styleArray.push(normalizedBase);
9722
9737
  }
9723
9738
  if (Object.keys(nestedVariants).length > 0) {
9724
9739
  styleArray.push(nestedVariants);
@@ -9821,8 +9836,11 @@ function styled(component) {
9821
9836
  const variantPrefix = getVariantPrefix(namingOptions);
9822
9837
  const sep = namingOptions.separator || styledConfig.separator || "-";
9823
9838
  const variantSelector = `&.${variantPrefix}${variantKey}${sep}${variantValue}`;
9824
- if (variantClasses && variantClasses.trim()) {
9825
- nestedVariants[variantSelector] = variantClasses;
9839
+
9840
+ // Handle both string and array of classes
9841
+ const normalizedClasses = Array.isArray(variantClasses) ? variantClasses.join(" ") : variantClasses;
9842
+ if (normalizedClasses && normalizedClasses.trim()) {
9843
+ nestedVariants[variantSelector] = normalizedClasses;
9826
9844
  }
9827
9845
  });
9828
9846
  });
@@ -9830,7 +9848,7 @@ function styled(component) {
9830
9848
  // Generate compound variant selectors
9831
9849
  compoundVariants.forEach(compound => {
9832
9850
  const {
9833
- className: compoundClass,
9851
+ class: compoundClass,
9834
9852
  ...conditions
9835
9853
  } = compound;
9836
9854
 
@@ -9858,15 +9876,21 @@ function styled(component) {
9858
9876
  compoundSelector += `:not(.${negClass})`;
9859
9877
  });
9860
9878
  }
9861
- if (compoundClass && compoundClass.trim()) {
9862
- nestedVariants[compoundSelector] = compoundClass;
9879
+
9880
+ // Handle both string and array of classes
9881
+ const normalizedClass = Array.isArray(compoundClass) ? compoundClass.join(" ") : compoundClass;
9882
+ if (normalizedClass && normalizedClass.trim()) {
9883
+ nestedVariants[compoundSelector] = normalizedClass;
9863
9884
  }
9864
9885
  });
9865
9886
 
9866
9887
  // Build final nested structure: [base, { nested variants }]
9867
9888
  const styleArray = [];
9868
- if (base.trim()) {
9869
- styleArray.push(base);
9889
+
9890
+ // Handle both string and array of classes for base
9891
+ const normalizedBase = Array.isArray(base) ? base.join(" ") : base;
9892
+ if (normalizedBase && normalizedBase.trim()) {
9893
+ styleArray.push(normalizedBase);
9870
9894
  }
9871
9895
 
9872
9896
  // Add pseudo-state classes to nested
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * tailwind-to-style v2.12.4
2
+ * tailwind-to-style v2.12.6
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -1727,10 +1727,9 @@ function resetTailwindCache() {
1727
1727
  instance = null;
1728
1728
  }
1729
1729
 
1730
- var _process$env;
1731
- /**
1732
- * Logger class with configurable log levels
1733
- * Prevents console spam in production
1730
+ /**
1731
+ * Logger class with configurable log levels
1732
+ * Prevents console spam in production
1734
1733
  */
1735
1734
  class Logger {
1736
1735
  constructor() {
@@ -1745,9 +1744,9 @@ class Logger {
1745
1744
  };
1746
1745
  }
1747
1746
 
1748
- /**
1749
- * Set the log level
1750
- * @param {string} level - One of 'debug', 'info', 'warn', 'error', 'silent'
1747
+ /**
1748
+ * Set the log level
1749
+ * @param {string} level - One of 'debug', 'info', 'warn', 'error', 'silent'
1751
1750
  */
1752
1751
  setLevel(level) {
1753
1752
  if (this.levels[level] !== undefined) {
@@ -1755,22 +1754,22 @@ class Logger {
1755
1754
  }
1756
1755
  }
1757
1756
 
1758
- /**
1759
- * Get current log level
1757
+ /**
1758
+ * Get current log level
1760
1759
  */
1761
1760
  getLevel() {
1762
1761
  return this.level;
1763
1762
  }
1764
1763
 
1765
- /**
1766
- * Check if a message should be logged
1764
+ /**
1765
+ * Check if a message should be logged
1767
1766
  */
1768
1767
  shouldLog(level) {
1769
1768
  return this.levels[level] >= this.levels[this.level];
1770
1769
  }
1771
1770
 
1772
- /**
1773
- * Log debug message
1771
+ /**
1772
+ * Log debug message
1774
1773
  */
1775
1774
  debug(message) {
1776
1775
  if (this.shouldLog("debug")) {
@@ -1781,8 +1780,8 @@ class Logger {
1781
1780
  }
1782
1781
  }
1783
1782
 
1784
- /**
1785
- * Log info message
1783
+ /**
1784
+ * Log info message
1786
1785
  */
1787
1786
  info(message) {
1788
1787
  if (this.shouldLog("info")) {
@@ -1793,8 +1792,8 @@ class Logger {
1793
1792
  }
1794
1793
  }
1795
1794
 
1796
- /**
1797
- * Log warning message
1795
+ /**
1796
+ * Log warning message
1798
1797
  */
1799
1798
  warn(message) {
1800
1799
  if (this.shouldLog("warn")) {
@@ -1805,8 +1804,8 @@ class Logger {
1805
1804
  }
1806
1805
  }
1807
1806
 
1808
- /**
1809
- * Log error message
1807
+ /**
1808
+ * Log error message
1810
1809
  */
1811
1810
  error(message) {
1812
1811
  if (this.shouldLog("error")) {
@@ -1819,7 +1818,14 @@ class Logger {
1819
1818
  }
1820
1819
 
1821
1820
  // Create singleton instance with production-safe defaults
1822
- const isProduction = typeof process !== "undefined" && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === "production";
1821
+ // Use try-catch to safely check for Node.js environment
1822
+ let isProduction = false;
1823
+ try {
1824
+ isProduction = typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.NODE_ENV === "production";
1825
+ } catch (e) {
1826
+ // In browser environment, default to development mode
1827
+ isProduction = false;
1828
+ }
1823
1829
  const logger = new Logger(isProduction ? "error" : "warn");
1824
1830
 
1825
1831
  /**
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * tailwind-to-style v2.12.4
2
+ * tailwind-to-style v2.12.6
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -1725,10 +1725,9 @@ function resetTailwindCache() {
1725
1725
  instance = null;
1726
1726
  }
1727
1727
 
1728
- var _process$env;
1729
- /**
1730
- * Logger class with configurable log levels
1731
- * Prevents console spam in production
1728
+ /**
1729
+ * Logger class with configurable log levels
1730
+ * Prevents console spam in production
1732
1731
  */
1733
1732
  class Logger {
1734
1733
  constructor() {
@@ -1743,9 +1742,9 @@ class Logger {
1743
1742
  };
1744
1743
  }
1745
1744
 
1746
- /**
1747
- * Set the log level
1748
- * @param {string} level - One of 'debug', 'info', 'warn', 'error', 'silent'
1745
+ /**
1746
+ * Set the log level
1747
+ * @param {string} level - One of 'debug', 'info', 'warn', 'error', 'silent'
1749
1748
  */
1750
1749
  setLevel(level) {
1751
1750
  if (this.levels[level] !== undefined) {
@@ -1753,22 +1752,22 @@ class Logger {
1753
1752
  }
1754
1753
  }
1755
1754
 
1756
- /**
1757
- * Get current log level
1755
+ /**
1756
+ * Get current log level
1758
1757
  */
1759
1758
  getLevel() {
1760
1759
  return this.level;
1761
1760
  }
1762
1761
 
1763
- /**
1764
- * Check if a message should be logged
1762
+ /**
1763
+ * Check if a message should be logged
1765
1764
  */
1766
1765
  shouldLog(level) {
1767
1766
  return this.levels[level] >= this.levels[this.level];
1768
1767
  }
1769
1768
 
1770
- /**
1771
- * Log debug message
1769
+ /**
1770
+ * Log debug message
1772
1771
  */
1773
1772
  debug(message) {
1774
1773
  if (this.shouldLog("debug")) {
@@ -1779,8 +1778,8 @@ class Logger {
1779
1778
  }
1780
1779
  }
1781
1780
 
1782
- /**
1783
- * Log info message
1781
+ /**
1782
+ * Log info message
1784
1783
  */
1785
1784
  info(message) {
1786
1785
  if (this.shouldLog("info")) {
@@ -1791,8 +1790,8 @@ class Logger {
1791
1790
  }
1792
1791
  }
1793
1792
 
1794
- /**
1795
- * Log warning message
1793
+ /**
1794
+ * Log warning message
1796
1795
  */
1797
1796
  warn(message) {
1798
1797
  if (this.shouldLog("warn")) {
@@ -1803,8 +1802,8 @@ class Logger {
1803
1802
  }
1804
1803
  }
1805
1804
 
1806
- /**
1807
- * Log error message
1805
+ /**
1806
+ * Log error message
1808
1807
  */
1809
1808
  error(message) {
1810
1809
  if (this.shouldLog("error")) {
@@ -1817,7 +1816,14 @@ class Logger {
1817
1816
  }
1818
1817
 
1819
1818
  // Create singleton instance with production-safe defaults
1820
- const isProduction = typeof process !== "undefined" && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === "production";
1819
+ // Use try-catch to safely check for Node.js environment
1820
+ let isProduction = false;
1821
+ try {
1822
+ isProduction = typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.NODE_ENV === "production";
1823
+ } catch (e) {
1824
+ // In browser environment, default to development mode
1825
+ isProduction = false;
1826
+ }
1821
1827
  const logger = new Logger(isProduction ? "error" : "warn");
1822
1828
 
1823
1829
  /**