tailwind-to-style 2.7.6 → 2.7.7

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.7.6
2
+ * tailwind-to-style v2.7.7
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -1898,10 +1898,10 @@ var tailwindToStyle = (function (exports) {
1898
1898
  }
1899
1899
  if (value === "custom_value") {
1900
1900
  return `
1901
- ${prefix}-${key} {
1902
- ${isValidCssColor(value) ? "background-color" : "background"}: ${value};
1903
- }
1904
- `;
1901
+ ${prefix}-${key} {
1902
+ ${isValidCssColor(value) ? "background-color" : "background"}: ${value};
1903
+ }
1904
+ `;
1905
1905
  }
1906
1906
  return `
1907
1907
  ${prefix}-${key} {
@@ -1923,6 +1923,7 @@ var tailwindToStyle = (function (exports) {
1923
1923
  theme = {}
1924
1924
  } = configOptions;
1925
1925
  const prefix = `${globalPrefix}bg`;
1926
+ const customPrefix = `${globalPrefix}bg-image`;
1926
1927
  const {
1927
1928
  backgroundImage = {}
1928
1929
  } = theme;
@@ -1930,11 +1931,20 @@ var tailwindToStyle = (function (exports) {
1930
1931
  let {
1931
1932
  getCssByOptions
1932
1933
  } = _ref;
1933
- const cssString = getCssByOptions(backgroundImage, (key, value) => `
1934
+ const cssString = getCssByOptions(backgroundImage, (key, value) => {
1935
+ if (value === "custom_value") {
1936
+ return `
1937
+ ${customPrefix}-${key} {
1938
+ background-image: ${value};
1939
+ }
1940
+ `;
1941
+ }
1942
+ return `
1934
1943
  ${prefix}-${key} {
1935
1944
  background-image: ${value};
1936
1945
  }
1937
- `);
1946
+ `;
1947
+ });
1938
1948
  return cssString;
1939
1949
  }, configOptions);
1940
1950
  return responsiveCssString;
@@ -1997,6 +2007,7 @@ var tailwindToStyle = (function (exports) {
1997
2007
  theme = {}
1998
2008
  } = configOptions;
1999
2009
  const prefix = `${globalPrefix}bg`;
2010
+ const customPrefix = `${globalPrefix}bg-position`;
2000
2011
  const {
2001
2012
  backgroundPosition = {}
2002
2013
  } = theme;
@@ -2004,11 +2015,20 @@ var tailwindToStyle = (function (exports) {
2004
2015
  let {
2005
2016
  getCssByOptions
2006
2017
  } = _ref;
2007
- const cssString = getCssByOptions(backgroundPosition, (key, value) => `
2018
+ const cssString = getCssByOptions(backgroundPosition, (key, value) => {
2019
+ if (value === "custom_value") {
2020
+ return `
2021
+ ${customPrefix}-${key} {
2022
+ background-position: ${value};
2023
+ }
2024
+ `;
2025
+ }
2026
+ return `
2008
2027
  ${prefix}-${key} {
2009
2028
  background-position: ${value};
2010
2029
  }
2011
- `);
2030
+ `;
2031
+ });
2012
2032
  return cssString;
2013
2033
  }, configOptions);
2014
2034
  return responsiveCssString;
@@ -2049,6 +2069,7 @@ var tailwindToStyle = (function (exports) {
2049
2069
  theme = {}
2050
2070
  } = configOptions;
2051
2071
  const prefix = `${globalPrefix}bg`;
2072
+ const customPrefix = `${globalPrefix}bg-size`;
2052
2073
  const {
2053
2074
  backgroundSize = {}
2054
2075
  } = theme;
@@ -2056,11 +2077,20 @@ var tailwindToStyle = (function (exports) {
2056
2077
  let {
2057
2078
  getCssByOptions
2058
2079
  } = _ref;
2059
- const cssString = getCssByOptions(backgroundSize, (key, value) => `
2080
+ const cssString = getCssByOptions(backgroundSize, (key, value) => {
2081
+ if (value === "custom_value") {
2082
+ return `
2083
+ ${customPrefix}-${key} {
2084
+ background-size: ${value};
2085
+ }
2086
+ `;
2087
+ }
2088
+ return `
2060
2089
  ${prefix}-${key} {
2061
2090
  background-size: ${value};
2062
2091
  }
2063
- `);
2092
+ `;
2093
+ });
2064
2094
  return cssString;
2065
2095
  }, configOptions);
2066
2096
  return responsiveCssString;
@@ -2128,6 +2158,7 @@ var tailwindToStyle = (function (exports) {
2128
2158
  theme = {}
2129
2159
  } = configOptions;
2130
2160
  const prefix = `${globalPrefix}border`;
2161
+ const customPrefix = `${globalPrefix}border-color`;
2131
2162
  const {
2132
2163
  borderColor = {}
2133
2164
  } = theme;
@@ -2144,57 +2175,64 @@ var tailwindToStyle = (function (exports) {
2144
2175
  if (rgbValue) {
2145
2176
  rgbPropertyValue = `border-color: rgba(${rgbValue}, var(--border-opacity));`;
2146
2177
  }
2178
+ if (value === "custom_value") {
2179
+ return `
2180
+ ${customPrefix}${key} {
2181
+ border-color: ${value};
2182
+ }
2183
+ `;
2184
+ }
2147
2185
  return `
2148
- ${prefix}${key} {
2149
- --border-opacity: 1;
2150
- border-color: ${value};
2151
- ${rgbPropertyValue}
2152
- }
2153
- ${prefix}-x${key} {
2154
- --border-opacity: 1;
2155
- border-left-color: ${value};
2156
- ${rgbPropertyValue}
2157
- border-right-color: ${value};
2158
- ${rgbPropertyValue}
2159
- }
2160
- ${prefix}-y${key} {
2161
- --border-opacity: 1;
2162
- border-top-color: ${value};
2163
- ${rgbPropertyValue}
2164
- border-bottom-color: ${value};
2165
- ${rgbPropertyValue}
2166
- }
2167
- ${prefix}-s${key} {
2168
- --border-opacity: 1;
2169
- border-inline-start-color: ${value};
2170
- ${rgbPropertyValue}
2171
- }
2172
- ${prefix}-e${key} {
2173
- --border-opacity: 1;
2174
- border-inline-end-color: ${value};
2175
- ${rgbPropertyValue}
2176
- }
2177
- ${prefix}-t${key} {
2178
- --border-opacity: 1;
2179
- border-top-color: ${value};
2180
- ${rgbPropertyValue}
2181
- }
2182
- ${prefix}-r${key} {
2183
- --border-opacity: 1;
2184
- border-right-color: ${value};
2185
- ${rgbPropertyValue}
2186
- }
2187
- ${prefix}-b${key} {
2188
- --border-opacity: 1;
2189
- border-bottom-color: ${value};
2190
- ${rgbPropertyValue}
2191
- }
2192
- ${prefix}-l${key} {
2193
- --border-opacity: 1;
2194
- border-left-color: ${value};
2195
- ${rgbPropertyValue}
2196
- }
2197
- `;
2186
+ ${prefix}${key} {
2187
+ --border-opacity: 1;
2188
+ border-color: ${value};
2189
+ ${rgbPropertyValue}
2190
+ }
2191
+ ${prefix}-x${key} {
2192
+ --border-opacity: 1;
2193
+ border-left-color: ${value};
2194
+ ${rgbPropertyValue}
2195
+ border-right-color: ${value};
2196
+ ${rgbPropertyValue}
2197
+ }
2198
+ ${prefix}-y${key} {
2199
+ --border-opacity: 1;
2200
+ border-top-color: ${value};
2201
+ ${rgbPropertyValue}
2202
+ border-bottom-color: ${value};
2203
+ ${rgbPropertyValue}
2204
+ }
2205
+ ${prefix}-s${key} {
2206
+ --border-opacity: 1;
2207
+ border-inline-start-color: ${value};
2208
+ ${rgbPropertyValue}
2209
+ }
2210
+ ${prefix}-e${key} {
2211
+ --border-opacity: 1;
2212
+ border-inline-end-color: ${value};
2213
+ ${rgbPropertyValue}
2214
+ }
2215
+ ${prefix}-t${key} {
2216
+ --border-opacity: 1;
2217
+ border-top-color: ${value};
2218
+ ${rgbPropertyValue}
2219
+ }
2220
+ ${prefix}-r${key} {
2221
+ --border-opacity: 1;
2222
+ border-right-color: ${value};
2223
+ ${rgbPropertyValue}
2224
+ }
2225
+ ${prefix}-b${key} {
2226
+ --border-opacity: 1;
2227
+ border-bottom-color: ${value};
2228
+ ${rgbPropertyValue}
2229
+ }
2230
+ ${prefix}-l${key} {
2231
+ --border-opacity: 1;
2232
+ border-left-color: ${value};
2233
+ ${rgbPropertyValue}
2234
+ }
2235
+ `;
2198
2236
  });
2199
2237
  return cssString;
2200
2238
  }, configOptions);
@@ -2363,6 +2401,7 @@ var tailwindToStyle = (function (exports) {
2363
2401
  theme = {}
2364
2402
  } = configOptions;
2365
2403
  const prefix = `${globalPrefix}border`;
2404
+ const customPrefix = `${globalPrefix}border-width`;
2366
2405
  const {
2367
2406
  borderWidth = {}
2368
2407
  } = theme;
@@ -2372,41 +2411,48 @@ var tailwindToStyle = (function (exports) {
2372
2411
  } = _ref;
2373
2412
  const cssString = getCssByOptions(borderWidth, (keyTmp, value) => {
2374
2413
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
2375
- return `
2376
- ${prefix}${key} {
2377
- border-style: solid;
2378
- border-top-width: ${value};
2379
- border-bottom-width: ${value};
2380
- border-left-width: ${value};
2381
- border-right-width: ${value};
2382
- }
2383
- ${prefix}-x${key} {
2384
- border-left-width: ${value};
2385
- border-right-width: ${value};
2386
- }
2387
- ${prefix}-y${key} {
2388
- border-top-width: ${value};
2389
- border-bottom-width: ${value};
2390
- }
2391
- ${prefix}-s${key} {
2392
- border-inline-start-width: ${value};
2393
- }
2394
- ${prefix}-e${key} {
2395
- border-inline-end-width: ${value};
2396
- }
2397
- ${prefix}-t${key} {
2398
- border-top-width: ${value};
2399
- }
2400
- ${prefix}-r${key} {
2401
- border-right-width: ${value};
2402
- }
2403
- ${prefix}-b${key} {
2404
- border-bottom-width: ${value};
2405
- }
2406
- ${prefix}-l${key} {
2407
- border-left-width: ${value};
2414
+ if (value === "custom_value") {
2415
+ return `
2416
+ ${customPrefix}-${key} {
2417
+ border-width: ${value};
2408
2418
  }
2409
2419
  `;
2420
+ }
2421
+ return `
2422
+ ${prefix}${key} {
2423
+ border-style: solid;
2424
+ border-top-width: ${value};
2425
+ border-bottom-width: ${value};
2426
+ border-left-width: ${value};
2427
+ border-right-width: ${value};
2428
+ }
2429
+ ${prefix}-x${key} {
2430
+ border-left-width: ${value};
2431
+ border-right-width: ${value};
2432
+ }
2433
+ ${prefix}-y${key} {
2434
+ border-top-width: ${value};
2435
+ border-bottom-width: ${value};
2436
+ }
2437
+ ${prefix}-s${key} {
2438
+ border-inline-start-width: ${value};
2439
+ }
2440
+ ${prefix}-e${key} {
2441
+ border-inline-end-width: ${value};
2442
+ }
2443
+ ${prefix}-t${key} {
2444
+ border-top-width: ${value};
2445
+ }
2446
+ ${prefix}-r${key} {
2447
+ border-right-width: ${value};
2448
+ }
2449
+ ${prefix}-b${key} {
2450
+ border-bottom-width: ${value};
2451
+ }
2452
+ ${prefix}-l${key} {
2453
+ border-left-width: ${value};
2454
+ }
2455
+ `;
2410
2456
  });
2411
2457
  return cssString;
2412
2458
  }, configOptions);
@@ -2442,6 +2488,7 @@ var tailwindToStyle = (function (exports) {
2442
2488
  theme = {}
2443
2489
  } = configOptions;
2444
2490
  const prefix = `${globalPrefix}shadow`;
2491
+ const customPrefix = `${globalPrefix}box-shadow`;
2445
2492
  const {
2446
2493
  boxShadowColor,
2447
2494
  boxShadow = {}
@@ -2454,6 +2501,13 @@ var tailwindToStyle = (function (exports) {
2454
2501
  let cssString = getCssByOptions(boxShadow, (keyTmp, value) => {
2455
2502
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
2456
2503
  const valueSplit = value.split(" ");
2504
+ if (value === "custom_value") {
2505
+ return `
2506
+ ${customPrefix}${key} {
2507
+ box-shadow: ${value};
2508
+ }
2509
+ `;
2510
+ }
2457
2511
  return `
2458
2512
  ${prefix}${key} {
2459
2513
  --shadow: ${value};
@@ -3086,6 +3140,7 @@ var tailwindToStyle = (function (exports) {
3086
3140
  theme = {}
3087
3141
  } = configOptions;
3088
3142
  const prefix = `${globalPrefix}text`;
3143
+ const customPrefix = `${globalPrefix}text-size`;
3089
3144
  const {
3090
3145
  fontSize = {}
3091
3146
  } = theme;
@@ -3093,11 +3148,20 @@ var tailwindToStyle = (function (exports) {
3093
3148
  let {
3094
3149
  getCssByOptions
3095
3150
  } = _ref;
3096
- const cssString = getCssByOptions(fontSize, (key, value) => `
3151
+ const cssString = getCssByOptions(fontSize, (key, value) => {
3152
+ if (value === "custom_value") {
3153
+ return `
3154
+ ${customPrefix}${key} {
3155
+ font-size: ${value};
3156
+ }
3157
+ `;
3158
+ }
3159
+ return `
3097
3160
  ${prefix}-${key} {
3098
3161
  font-size: ${value};
3099
3162
  }
3100
- `);
3163
+ `;
3164
+ });
3101
3165
  return cssString;
3102
3166
  }, configOptions);
3103
3167
  return responsiveCssString;
@@ -4246,6 +4310,7 @@ var tailwindToStyle = (function (exports) {
4246
4310
  theme = {}
4247
4311
  } = configOptions;
4248
4312
  const prefix = `${globalPrefix}outline`;
4313
+ const customPrefix = `${globalPrefix}outline-color`;
4249
4314
  const {
4250
4315
  outlineColor = {}
4251
4316
  } = theme;
@@ -4262,6 +4327,13 @@ var tailwindToStyle = (function (exports) {
4262
4327
  if (rgbValue) {
4263
4328
  rgbPropertyValue = `outline-color: rgba(${rgbValue}, var(--outline-opacity));`;
4264
4329
  }
4330
+ if (value === "custom_value") {
4331
+ return `
4332
+ ${customPrefix}${key} {
4333
+ outline-color: ${value};
4334
+ }
4335
+ `;
4336
+ }
4265
4337
  return `
4266
4338
  ${prefix}${key} {
4267
4339
  --outline-opacity: 1;
@@ -4367,6 +4439,7 @@ var tailwindToStyle = (function (exports) {
4367
4439
  theme = {}
4368
4440
  } = configOptions;
4369
4441
  const prefix = `${globalPrefix}outline`;
4442
+ const customPrefix = `${globalPrefix}outline-width`;
4370
4443
  const {
4371
4444
  outlineWidth = {}
4372
4445
  } = theme;
@@ -4375,11 +4448,18 @@ var tailwindToStyle = (function (exports) {
4375
4448
  getCssByOptions
4376
4449
  } = _ref;
4377
4450
  const cssString = getCssByOptions(outlineWidth, (key, value) => {
4378
- return `
4379
- ${prefix}-${key} {
4451
+ if (value === "custom_value") {
4452
+ return `
4453
+ ${customPrefix}-${key} {
4380
4454
  outline-width: ${value};
4381
4455
  }
4382
4456
  `;
4457
+ }
4458
+ return `
4459
+ ${prefix}-${key} {
4460
+ outline-width: ${value};
4461
+ }
4462
+ `;
4383
4463
  });
4384
4464
  return cssString;
4385
4465
  }, configOptions);
@@ -5360,6 +5440,7 @@ var tailwindToStyle = (function (exports) {
5360
5440
  theme = {}
5361
5441
  } = configOptions;
5362
5442
  const prefix = `${globalPrefix}text`;
5443
+ const customPrefix = `${globalPrefix}text-color`;
5363
5444
  const {
5364
5445
  textColor
5365
5446
  } = theme;
@@ -5372,13 +5453,20 @@ var tailwindToStyle = (function (exports) {
5372
5453
  if (rgbValue) {
5373
5454
  rgbPropertyValue = `color: rgba(${rgbValue}, var(--text-opacity));`;
5374
5455
  }
5456
+ if (value === "custom_value") {
5457
+ return `
5458
+ ${customPrefix}-${key} {
5459
+ color: ${value};
5460
+ }
5461
+ `;
5462
+ }
5375
5463
  return `
5376
- ${prefix}-${key} {
5377
- --text-opacity: 1;
5378
- color: ${value};
5379
- ${rgbPropertyValue}
5380
- }
5381
- `;
5464
+ ${prefix}-${key} {
5465
+ --text-opacity: 1;
5466
+ color: ${value};
5467
+ ${rgbPropertyValue}
5468
+ }
5469
+ `;
5382
5470
  });
5383
5471
  return cssString;
5384
5472
  }, configOptions);
@@ -6312,10 +6400,10 @@ var tailwindToStyle = (function (exports) {
6312
6400
  return null;
6313
6401
  }
6314
6402
 
6315
- /**
6316
- * Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
6317
- * @param {string} cssString
6318
- * @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
6403
+ /**
6404
+ * Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
6405
+ * @param {string} cssString
6406
+ * @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
6319
6407
  */
6320
6408
  function resolveCssToClearCss(cssString) {
6321
6409
  const customVars = {};
@@ -6593,11 +6681,11 @@ var tailwindToStyle = (function (exports) {
6593
6681
  }
6594
6682
  }
6595
6683
 
6596
- /**
6597
- * Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
6598
- * @param {string} className - Class name with potential opacity modifier
6599
- * @param {string} cssDeclaration - CSS declaration to modify
6600
- * @returns {string} Modified CSS declaration with opacity applied
6684
+ /**
6685
+ * Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
6686
+ * @param {string} className - Class name with potential opacity modifier
6687
+ * @param {string} cssDeclaration - CSS declaration to modify
6688
+ * @returns {string} Modified CSS declaration with opacity applied
6601
6689
  */
6602
6690
  function processOpacityModifier(className, cssDeclaration) {
6603
6691
  const opacityMatch = className.match(/\/(\d+)$/);
@@ -6658,11 +6746,11 @@ var tailwindToStyle = (function (exports) {
6658
6746
  return modifiedDeclaration;
6659
6747
  }
6660
6748
 
6661
- /**
6662
- * Convert Tailwind class string to inline CSS styles or JSON object
6663
- * @param {string} classNames - String containing Tailwind classes to convert
6664
- * @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
6665
- * @returns {string|Object} Inline CSS string or style JSON object
6749
+ /**
6750
+ * Convert Tailwind class string to inline CSS styles or JSON object
6751
+ * @param {string} classNames - String containing Tailwind classes to convert
6752
+ * @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
6753
+ * @returns {string|Object} Inline CSS string or style JSON object
6666
6754
  */
6667
6755
  function tws(classNames, convertToJson) {
6668
6756
  const totalMarker = performanceMonitor.start("tws:total");
@@ -7041,12 +7129,12 @@ var tailwindToStyle = (function (exports) {
7041
7129
  return cssString.trim();
7042
7130
  }
7043
7131
 
7044
- /**
7045
- * Generate CSS string from style object with SCSS-like syntax
7046
- * Supports nested selectors, state variants, responsive variants, and @css directives
7047
- * @param {Object} obj - Object with SCSS-like style format
7048
- * @param {Object} [options] - Additional options, e.g. { inject: true/false }
7049
- * @returns {string} Generated CSS string
7132
+ /**
7133
+ * Generate CSS string from style object with SCSS-like syntax
7134
+ * Supports nested selectors, state variants, responsive variants, and @css directives
7135
+ * @param {Object} obj - Object with SCSS-like style format
7136
+ * @param {Object} [options] - Additional options, e.g. { inject: true/false }
7137
+ * @returns {string} Generated CSS string
7050
7138
  */
7051
7139
  function twsx(obj) {
7052
7140
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -7153,19 +7241,19 @@ var tailwindToStyle = (function (exports) {
7153
7241
  }
7154
7242
 
7155
7243
  // Enhanced debounced functions with performance monitoring configuration
7156
- /**
7157
- * Debounced version of tws function with performance monitoring
7158
- * @param {string} classNames - String containing Tailwind classes to convert
7159
- * @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
7160
- * @returns {string|Object} Inline CSS string or style JSON object
7244
+ /**
7245
+ * Debounced version of tws function with performance monitoring
7246
+ * @param {string} classNames - String containing Tailwind classes to convert
7247
+ * @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
7248
+ * @returns {string|Object} Inline CSS string or style JSON object
7161
7249
  */
7162
7250
  const debouncedTws = debounce(tws, 50); // Faster debounce for tws
7163
7251
 
7164
- /**
7165
- * Debounced version of twsx function with performance monitoring
7166
- * @param {Object} obj - Object with SCSS-like style format
7167
- * @param {Object} [options] - Additional options
7168
- * @returns {string} Generated CSS string
7252
+ /**
7253
+ * Debounced version of twsx function with performance monitoring
7254
+ * @param {Object} obj - Object with SCSS-like style format
7255
+ * @param {Object} [options] - Additional options
7256
+ * @returns {string} Generated CSS string
7169
7257
  */
7170
7258
  const debouncedTwsx = debounce(twsx, 100); // Standard debounce for twsx
7171
7259