tailwind-to-style 2.7.5 → 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.5
2
+ * tailwind-to-style v2.7.7
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -1532,10 +1532,12 @@ var tailwindToStyle = (function (exports) {
1532
1532
  const themeKeys = Object.keys(configOptions.theme);
1533
1533
  themeKeys.forEach(key => {
1534
1534
  newTheme[key] = theme[key] || configOptions.theme[key];
1535
- });
1536
- themeKeys.forEach(key => {
1537
- if (themeExtend[key] && newTheme[key]) {
1538
- newTheme[key] = Object.assign({}, newTheme[key], themeExtend[key]);
1535
+ if (isFunction(newTheme[key])) {
1536
+ newTheme[key] = newTheme[key]({
1537
+ theme: keyRef => {
1538
+ return configOptions.theme[keyRef];
1539
+ }
1540
+ });
1539
1541
  }
1540
1542
  });
1541
1543
  themeKeys.forEach(key => {
@@ -1546,6 +1548,9 @@ var tailwindToStyle = (function (exports) {
1546
1548
  }
1547
1549
  });
1548
1550
  }
1551
+ if (themeExtend[key]) {
1552
+ newTheme[key] = Object.assign({}, newTheme[key], themeExtend[key]);
1553
+ }
1549
1554
  });
1550
1555
  return {
1551
1556
  prefix: "",
@@ -1893,10 +1898,10 @@ var tailwindToStyle = (function (exports) {
1893
1898
  }
1894
1899
  if (value === "custom_value") {
1895
1900
  return `
1896
- ${prefix}-${key} {
1897
- ${isValidCssColor(value) ? "background-color" : "background"}: ${value};
1898
- }
1899
- `;
1901
+ ${prefix}-${key} {
1902
+ ${isValidCssColor(value) ? "background-color" : "background"}: ${value};
1903
+ }
1904
+ `;
1900
1905
  }
1901
1906
  return `
1902
1907
  ${prefix}-${key} {
@@ -1918,6 +1923,7 @@ var tailwindToStyle = (function (exports) {
1918
1923
  theme = {}
1919
1924
  } = configOptions;
1920
1925
  const prefix = `${globalPrefix}bg`;
1926
+ const customPrefix = `${globalPrefix}bg-image`;
1921
1927
  const {
1922
1928
  backgroundImage = {}
1923
1929
  } = theme;
@@ -1925,11 +1931,20 @@ var tailwindToStyle = (function (exports) {
1925
1931
  let {
1926
1932
  getCssByOptions
1927
1933
  } = _ref;
1928
- 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 `
1929
1943
  ${prefix}-${key} {
1930
1944
  background-image: ${value};
1931
1945
  }
1932
- `);
1946
+ `;
1947
+ });
1933
1948
  return cssString;
1934
1949
  }, configOptions);
1935
1950
  return responsiveCssString;
@@ -1992,6 +2007,7 @@ var tailwindToStyle = (function (exports) {
1992
2007
  theme = {}
1993
2008
  } = configOptions;
1994
2009
  const prefix = `${globalPrefix}bg`;
2010
+ const customPrefix = `${globalPrefix}bg-position`;
1995
2011
  const {
1996
2012
  backgroundPosition = {}
1997
2013
  } = theme;
@@ -1999,11 +2015,20 @@ var tailwindToStyle = (function (exports) {
1999
2015
  let {
2000
2016
  getCssByOptions
2001
2017
  } = _ref;
2002
- 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 `
2003
2027
  ${prefix}-${key} {
2004
2028
  background-position: ${value};
2005
2029
  }
2006
- `);
2030
+ `;
2031
+ });
2007
2032
  return cssString;
2008
2033
  }, configOptions);
2009
2034
  return responsiveCssString;
@@ -2044,6 +2069,7 @@ var tailwindToStyle = (function (exports) {
2044
2069
  theme = {}
2045
2070
  } = configOptions;
2046
2071
  const prefix = `${globalPrefix}bg`;
2072
+ const customPrefix = `${globalPrefix}bg-size`;
2047
2073
  const {
2048
2074
  backgroundSize = {}
2049
2075
  } = theme;
@@ -2051,11 +2077,20 @@ var tailwindToStyle = (function (exports) {
2051
2077
  let {
2052
2078
  getCssByOptions
2053
2079
  } = _ref;
2054
- 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 `
2055
2089
  ${prefix}-${key} {
2056
2090
  background-size: ${value};
2057
2091
  }
2058
- `);
2092
+ `;
2093
+ });
2059
2094
  return cssString;
2060
2095
  }, configOptions);
2061
2096
  return responsiveCssString;
@@ -2123,6 +2158,7 @@ var tailwindToStyle = (function (exports) {
2123
2158
  theme = {}
2124
2159
  } = configOptions;
2125
2160
  const prefix = `${globalPrefix}border`;
2161
+ const customPrefix = `${globalPrefix}border-color`;
2126
2162
  const {
2127
2163
  borderColor = {}
2128
2164
  } = theme;
@@ -2139,57 +2175,64 @@ var tailwindToStyle = (function (exports) {
2139
2175
  if (rgbValue) {
2140
2176
  rgbPropertyValue = `border-color: rgba(${rgbValue}, var(--border-opacity));`;
2141
2177
  }
2178
+ if (value === "custom_value") {
2179
+ return `
2180
+ ${customPrefix}${key} {
2181
+ border-color: ${value};
2182
+ }
2183
+ `;
2184
+ }
2142
2185
  return `
2143
- ${prefix}${key} {
2144
- --border-opacity: 1;
2145
- border-color: ${value};
2146
- ${rgbPropertyValue}
2147
- }
2148
- ${prefix}-x${key} {
2149
- --border-opacity: 1;
2150
- border-left-color: ${value};
2151
- ${rgbPropertyValue}
2152
- border-right-color: ${value};
2153
- ${rgbPropertyValue}
2154
- }
2155
- ${prefix}-y${key} {
2156
- --border-opacity: 1;
2157
- border-top-color: ${value};
2158
- ${rgbPropertyValue}
2159
- border-bottom-color: ${value};
2160
- ${rgbPropertyValue}
2161
- }
2162
- ${prefix}-s${key} {
2163
- --border-opacity: 1;
2164
- border-inline-start-color: ${value};
2165
- ${rgbPropertyValue}
2166
- }
2167
- ${prefix}-e${key} {
2168
- --border-opacity: 1;
2169
- border-inline-end-color: ${value};
2170
- ${rgbPropertyValue}
2171
- }
2172
- ${prefix}-t${key} {
2173
- --border-opacity: 1;
2174
- border-top-color: ${value};
2175
- ${rgbPropertyValue}
2176
- }
2177
- ${prefix}-r${key} {
2178
- --border-opacity: 1;
2179
- border-right-color: ${value};
2180
- ${rgbPropertyValue}
2181
- }
2182
- ${prefix}-b${key} {
2183
- --border-opacity: 1;
2184
- border-bottom-color: ${value};
2185
- ${rgbPropertyValue}
2186
- }
2187
- ${prefix}-l${key} {
2188
- --border-opacity: 1;
2189
- border-left-color: ${value};
2190
- ${rgbPropertyValue}
2191
- }
2192
- `;
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
+ `;
2193
2236
  });
2194
2237
  return cssString;
2195
2238
  }, configOptions);
@@ -2358,6 +2401,7 @@ var tailwindToStyle = (function (exports) {
2358
2401
  theme = {}
2359
2402
  } = configOptions;
2360
2403
  const prefix = `${globalPrefix}border`;
2404
+ const customPrefix = `${globalPrefix}border-width`;
2361
2405
  const {
2362
2406
  borderWidth = {}
2363
2407
  } = theme;
@@ -2367,41 +2411,48 @@ var tailwindToStyle = (function (exports) {
2367
2411
  } = _ref;
2368
2412
  const cssString = getCssByOptions(borderWidth, (keyTmp, value) => {
2369
2413
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
2370
- return `
2371
- ${prefix}${key} {
2372
- border-style: solid;
2373
- border-top-width: ${value};
2374
- border-bottom-width: ${value};
2375
- border-left-width: ${value};
2376
- border-right-width: ${value};
2377
- }
2378
- ${prefix}-x${key} {
2379
- border-left-width: ${value};
2380
- border-right-width: ${value};
2381
- }
2382
- ${prefix}-y${key} {
2383
- border-top-width: ${value};
2384
- border-bottom-width: ${value};
2385
- }
2386
- ${prefix}-s${key} {
2387
- border-inline-start-width: ${value};
2388
- }
2389
- ${prefix}-e${key} {
2390
- border-inline-end-width: ${value};
2391
- }
2392
- ${prefix}-t${key} {
2393
- border-top-width: ${value};
2394
- }
2395
- ${prefix}-r${key} {
2396
- border-right-width: ${value};
2397
- }
2398
- ${prefix}-b${key} {
2399
- border-bottom-width: ${value};
2400
- }
2401
- ${prefix}-l${key} {
2402
- border-left-width: ${value};
2414
+ if (value === "custom_value") {
2415
+ return `
2416
+ ${customPrefix}-${key} {
2417
+ border-width: ${value};
2403
2418
  }
2404
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
+ `;
2405
2456
  });
2406
2457
  return cssString;
2407
2458
  }, configOptions);
@@ -2437,6 +2488,7 @@ var tailwindToStyle = (function (exports) {
2437
2488
  theme = {}
2438
2489
  } = configOptions;
2439
2490
  const prefix = `${globalPrefix}shadow`;
2491
+ const customPrefix = `${globalPrefix}box-shadow`;
2440
2492
  const {
2441
2493
  boxShadowColor,
2442
2494
  boxShadow = {}
@@ -2449,6 +2501,13 @@ var tailwindToStyle = (function (exports) {
2449
2501
  let cssString = getCssByOptions(boxShadow, (keyTmp, value) => {
2450
2502
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
2451
2503
  const valueSplit = value.split(" ");
2504
+ if (value === "custom_value") {
2505
+ return `
2506
+ ${customPrefix}${key} {
2507
+ box-shadow: ${value};
2508
+ }
2509
+ `;
2510
+ }
2452
2511
  return `
2453
2512
  ${prefix}${key} {
2454
2513
  --shadow: ${value};
@@ -3081,6 +3140,7 @@ var tailwindToStyle = (function (exports) {
3081
3140
  theme = {}
3082
3141
  } = configOptions;
3083
3142
  const prefix = `${globalPrefix}text`;
3143
+ const customPrefix = `${globalPrefix}text-size`;
3084
3144
  const {
3085
3145
  fontSize = {}
3086
3146
  } = theme;
@@ -3088,11 +3148,20 @@ var tailwindToStyle = (function (exports) {
3088
3148
  let {
3089
3149
  getCssByOptions
3090
3150
  } = _ref;
3091
- 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 `
3092
3160
  ${prefix}-${key} {
3093
3161
  font-size: ${value};
3094
3162
  }
3095
- `);
3163
+ `;
3164
+ });
3096
3165
  return cssString;
3097
3166
  }, configOptions);
3098
3167
  return responsiveCssString;
@@ -4241,6 +4310,7 @@ var tailwindToStyle = (function (exports) {
4241
4310
  theme = {}
4242
4311
  } = configOptions;
4243
4312
  const prefix = `${globalPrefix}outline`;
4313
+ const customPrefix = `${globalPrefix}outline-color`;
4244
4314
  const {
4245
4315
  outlineColor = {}
4246
4316
  } = theme;
@@ -4257,6 +4327,13 @@ var tailwindToStyle = (function (exports) {
4257
4327
  if (rgbValue) {
4258
4328
  rgbPropertyValue = `outline-color: rgba(${rgbValue}, var(--outline-opacity));`;
4259
4329
  }
4330
+ if (value === "custom_value") {
4331
+ return `
4332
+ ${customPrefix}${key} {
4333
+ outline-color: ${value};
4334
+ }
4335
+ `;
4336
+ }
4260
4337
  return `
4261
4338
  ${prefix}${key} {
4262
4339
  --outline-opacity: 1;
@@ -4362,6 +4439,7 @@ var tailwindToStyle = (function (exports) {
4362
4439
  theme = {}
4363
4440
  } = configOptions;
4364
4441
  const prefix = `${globalPrefix}outline`;
4442
+ const customPrefix = `${globalPrefix}outline-width`;
4365
4443
  const {
4366
4444
  outlineWidth = {}
4367
4445
  } = theme;
@@ -4370,11 +4448,18 @@ var tailwindToStyle = (function (exports) {
4370
4448
  getCssByOptions
4371
4449
  } = _ref;
4372
4450
  const cssString = getCssByOptions(outlineWidth, (key, value) => {
4373
- return `
4374
- ${prefix}-${key} {
4451
+ if (value === "custom_value") {
4452
+ return `
4453
+ ${customPrefix}-${key} {
4375
4454
  outline-width: ${value};
4376
4455
  }
4377
4456
  `;
4457
+ }
4458
+ return `
4459
+ ${prefix}-${key} {
4460
+ outline-width: ${value};
4461
+ }
4462
+ `;
4378
4463
  });
4379
4464
  return cssString;
4380
4465
  }, configOptions);
@@ -5355,6 +5440,7 @@ var tailwindToStyle = (function (exports) {
5355
5440
  theme = {}
5356
5441
  } = configOptions;
5357
5442
  const prefix = `${globalPrefix}text`;
5443
+ const customPrefix = `${globalPrefix}text-color`;
5358
5444
  const {
5359
5445
  textColor
5360
5446
  } = theme;
@@ -5367,13 +5453,20 @@ var tailwindToStyle = (function (exports) {
5367
5453
  if (rgbValue) {
5368
5454
  rgbPropertyValue = `color: rgba(${rgbValue}, var(--text-opacity));`;
5369
5455
  }
5456
+ if (value === "custom_value") {
5457
+ return `
5458
+ ${customPrefix}-${key} {
5459
+ color: ${value};
5460
+ }
5461
+ `;
5462
+ }
5370
5463
  return `
5371
- ${prefix}-${key} {
5372
- --text-opacity: 1;
5373
- color: ${value};
5374
- ${rgbPropertyValue}
5375
- }
5376
- `;
5464
+ ${prefix}-${key} {
5465
+ --text-opacity: 1;
5466
+ color: ${value};
5467
+ ${rgbPropertyValue}
5468
+ }
5469
+ `;
5377
5470
  });
5378
5471
  return cssString;
5379
5472
  }, configOptions);
@@ -6377,179 +6470,19 @@ var tailwindToStyle = (function (exports) {
6377
6470
  }
6378
6471
  let twString = null;
6379
6472
  let cssObject = null;
6380
-
6381
- // Global config storage key
6382
- const CONFIG_STORAGE_KEY = "__tailwind_to_style_global_config__";
6383
-
6384
- // Default configuration
6385
- const defaultConfig = {
6386
- theme: {
6387
- extend: {
6388
- colors: {}
6389
- },
6390
- screens: {
6391
- sm: "640px",
6392
- md: "768px",
6393
- lg: "1024px",
6394
- xl: "1280px",
6395
- "2xl": "1536px"
6396
- }
6397
- },
6398
- inject: true
6399
- };
6400
- class ConfigManager {
6401
- constructor() {
6402
- this.storage = null;
6403
- this.initialized = false;
6404
- }
6405
- initialize() {
6406
- if (this.initialized) return this.storage;
6407
- if (typeof window !== "undefined") {
6408
- if (!window[CONFIG_STORAGE_KEY]) {
6409
- window[CONFIG_STORAGE_KEY] = JSON.parse(JSON.stringify(defaultConfig));
6410
- }
6411
- this.storage = window[CONFIG_STORAGE_KEY];
6412
- } else if (typeof global !== "undefined") {
6413
- // Node.js environment
6414
- if (!global[CONFIG_STORAGE_KEY]) {
6415
- global[CONFIG_STORAGE_KEY] = JSON.parse(JSON.stringify(defaultConfig));
6416
- }
6417
- this.storage = global[CONFIG_STORAGE_KEY];
6418
- } else {
6419
- // Fallback
6420
- console.warn("tailwind-to-style: Unable to create global config storage. Config will only work within the same module.");
6421
- this.storage = JSON.parse(JSON.stringify(defaultConfig));
6422
- }
6423
- this.initialized = true;
6424
- return this.storage;
6425
- }
6426
- get() {
6427
- return this.initialize();
6428
- }
6429
- set(config) {
6430
- const storage = this.initialize();
6431
- this.deepMerge(storage, config);
6432
- return storage;
6433
- }
6434
- reset() {
6435
- const storage = this.initialize();
6436
- Object.keys(storage).forEach(key => delete storage[key]);
6437
- Object.assign(storage, JSON.parse(JSON.stringify(defaultConfig)));
6438
- return storage;
6439
- }
6440
- deepMerge(target, source) {
6441
- for (const key in source) {
6442
- if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
6443
- if (!target[key] || typeof target[key] !== "object") {
6444
- target[key] = {};
6445
- }
6446
- this.deepMerge(target[key], source[key]);
6447
- } else {
6448
- target[key] = source[key];
6449
- }
6450
- }
6451
- }
6452
- }
6453
- const configManager = new ConfigManager();
6454
- function getGlobalStorage() {
6455
- return configManager.get();
6456
- }
6457
- let globalConfig = null;
6458
- function initializeCss() {
6459
- if (!twString) {
6460
- // Always get fresh config from global storage
6461
- const currentConfig = getGlobalStorage();
6462
- const configForGeneration = {
6463
- ...currentConfig,
6464
- theme: {
6465
- ...currentConfig.theme
6466
- }
6467
- };
6468
- twString = generateTailwindCssString(configForGeneration).replace(/\s\s+/g, " ");
6469
- }
6470
- if (!cssObject) {
6471
- cssObject = convertCssToObject(twString);
6472
- }
6473
- }
6474
- initializeCss();
6475
- function convertScreensToBreakpoints(screens) {
6476
- const breakpoints = {};
6477
- for (const [key, value] of Object.entries(screens)) {
6478
- breakpoints[key] = `@media (min-width: ${value})`;
6479
- }
6480
- return breakpoints;
6473
+ if (!twString) {
6474
+ twString = generateTailwindCssString().replace(/\s\s+/g, " ");
6481
6475
  }
6482
-
6483
- /**
6484
- * Set global configuration for both tws and twsx functions
6485
- * @param {Object} config - Global configuration object
6486
- * @returns {Object} Current global configuration
6487
- */
6488
- function setConfig(config) {
6489
- // Reset CSS object cache when config changes
6490
- twString = null;
6491
- cssObject = null;
6492
- configOptionsCache.clear();
6493
-
6494
- // Use ConfigManager to set config
6495
- const globalStorage = configManager.set(config);
6496
-
6497
- // Handle legacy breakpoints with deprecation warning
6498
- if (config.breakpoints) {
6499
- console.warn("Warning: config.breakpoints is deprecated. Use config.theme.screens instead.");
6500
-
6501
- // Convert legacy breakpoints to screens format
6502
- const screens = {};
6503
- for (const [key, value] of Object.entries(config.breakpoints)) {
6504
- // Extract min-width value from media query
6505
- const match = value.match(/min-width:\s*([^)]+)/);
6506
- if (match) {
6507
- screens[key] = match[1].trim();
6508
- }
6509
- }
6510
- if (!globalStorage.theme.screens) {
6511
- globalStorage.theme.screens = {};
6512
- }
6513
- Object.assign(globalStorage.theme.screens, screens);
6514
- }
6515
-
6516
- // Update local reference
6517
- globalConfig = globalStorage;
6518
- initializeCss();
6519
- return {
6520
- ...globalStorage
6521
- };
6522
- }
6523
-
6524
- /**
6525
- * Get current global configuration
6526
- * @returns {Object} Current global configuration
6527
- */
6528
- function getConfig() {
6529
- globalConfig = configManager.get();
6530
- return {
6531
- ...globalConfig
6532
- };
6533
- }
6534
-
6535
- /**
6536
- * Reset global configuration to default
6537
- * @returns {Object} Default configuration
6538
- */
6539
- function resetConfig() {
6540
- twString = null;
6541
- cssObject = null;
6542
- configOptionsCache.clear();
6543
- const globalStorage = configManager.reset();
6544
-
6545
- // Update local reference
6546
- globalConfig = globalStorage;
6547
- twString = generateTailwindCssString(globalConfig).replace(/\s\s+/g, " ");
6476
+ if (!cssObject) {
6548
6477
  cssObject = convertCssToObject(twString);
6549
- return {
6550
- ...globalConfig
6551
- };
6552
6478
  }
6479
+ const breakpoints = {
6480
+ sm: "@media (min-width: 640px)",
6481
+ md: "@media (min-width: 768px)",
6482
+ lg: "@media (min-width: 1024px)",
6483
+ xl: "@media (min-width: 1280px)",
6484
+ "2xl": "@media (min-width: 1536px)"
6485
+ };
6553
6486
  const pseudoVariants = new Set(["hover", "focus", "focus-within", "active", "visited", "disabled", "first", "last", "checked", "invalid", "required"]);
6554
6487
  const specialVariants = {
6555
6488
  group: (state, sel) => `.group:${state} ${sel}`,
@@ -6599,9 +6532,6 @@ var tailwindToStyle = (function (exports) {
6599
6532
  let media = null;
6600
6533
  let finalSelector = selector;
6601
6534
  for (const v of variants) {
6602
- // Always get fresh config from global storage
6603
- const currentConfig = getGlobalStorage();
6604
- const breakpoints = convertScreensToBreakpoints(currentConfig.theme.screens || {});
6605
6535
  if (breakpoints[v]) {
6606
6536
  media = breakpoints[v];
6607
6537
  } else if (pseudoVariants.has(v)) {
@@ -6797,7 +6727,7 @@ var tailwindToStyle = (function (exports) {
6797
6727
 
6798
6728
  // Handle hex colors
6799
6729
  const hexRegex = new RegExp(`(${prop}\\s*:\\s*)(#[0-9a-fA-F]{3,6})`, "gi");
6800
- modifiedDeclaration = modifiedDeclaration.replace(hexRegex, (_, propPart, hexColor) => {
6730
+ modifiedDeclaration = modifiedDeclaration.replace(hexRegex, (match, propPart, hexColor) => {
6801
6731
  // Convert hex to rgba
6802
6732
  const hex = hexColor.replace("#", "");
6803
6733
  let r, g, b;
@@ -6825,8 +6755,6 @@ var tailwindToStyle = (function (exports) {
6825
6755
  function tws(classNames, convertToJson) {
6826
6756
  const totalMarker = performanceMonitor.start("tws:total");
6827
6757
  try {
6828
- // Ensure CSS is initialized with current global config
6829
- initializeCss();
6830
6758
  if ([!classNames, typeof classNames !== "string", classNames.trim() === ""].includes(true)) {
6831
6759
  performanceMonitor.end(totalMarker);
6832
6760
  return convertToJson ? {} : "";
@@ -7205,7 +7133,7 @@ var tailwindToStyle = (function (exports) {
7205
7133
  * Generate CSS string from style object with SCSS-like syntax
7206
7134
  * Supports nested selectors, state variants, responsive variants, and @css directives
7207
7135
  * @param {Object} obj - Object with SCSS-like style format
7208
- * @param {Object} [options] - Additional options, merges with global config
7136
+ * @param {Object} [options] - Additional options, e.g. { inject: true/false }
7209
7137
  * @returns {string} Generated CSS string
7210
7138
  */
7211
7139
  function twsx(obj) {
@@ -7216,13 +7144,9 @@ var tailwindToStyle = (function (exports) {
7216
7144
  console.warn("twsx: Expected an object but received:", obj);
7217
7145
  return "";
7218
7146
  }
7219
- const mergedOptions = {
7220
- ...getGlobalStorage(),
7221
- ...options
7222
- };
7223
7147
  const {
7224
7148
  inject = true
7225
- } = mergedOptions;
7149
+ } = options;
7226
7150
  const styles = {};
7227
7151
 
7228
7152
  // Create walk function with closure over styles
@@ -7367,10 +7291,7 @@ var tailwindToStyle = (function (exports) {
7367
7291
 
7368
7292
  exports.debouncedTws = debouncedTws;
7369
7293
  exports.debouncedTwsx = debouncedTwsx;
7370
- exports.getConfig = getConfig;
7371
7294
  exports.performanceUtils = performanceUtils;
7372
- exports.resetConfig = resetConfig;
7373
- exports.setConfig = setConfig;
7374
7295
  exports.tws = tws;
7375
7296
  exports.twsx = twsx;
7376
7297