tailwind-to-style 2.5.1 → 2.5.3

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.5.0
2
+ * tailwind-to-style v2.5.3
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
@@ -1351,8 +1351,15 @@ const theme = {
1351
1351
  }
1352
1352
  };
1353
1353
 
1354
+ const vars = {
1355
+ transform: `transform: translateX(var(--transform-translate-x, 0)) translateY(var(--transform-translate-y, 0)) rotate(var(--transform-rotate, 0)) skewX(var(--transform-skew-x, 0)) skewY(var(--transform-skew-y, 0)) scaleX(var(--transform-scale-x, 1)) scaleY(var(--transform-scale-y, 1));`,
1356
+ filter: `filter: blur(var(--blur, 0)) brightness(var(--brightness, 1)) contrast(var(--contrast, 1)) grayscale(var(--grayscale, 0)) hue-rotate(var(--hue-rotate, 0deg)) invert(var(--invert, 0)) saturate(var(--saturate, 1)) sepia(var(--sepia, 0)) drop-shadow(var(--drop-shadow, 0 0 #0000));`,
1357
+ backdropFilter: `-webkit-backdrop-filter: blur(var(--backdrop-blur, 0)) brightness(var(--backdrop-brightness, 1)) contrast(var(--backdrop-contrast, 1)) grayscale(var(--backdrop-grayscale, 0)) hue-rotate(var(--backdrop-hue-rotate, 0deg)) invert(var(--backdrop-invert, 0)) opacity(var(--backdrop-opacity, 1)) saturate(var(--backdrop-saturate, 1)) sepia(var(--backdrop-sepia, 0)); backdrop-filter: blur(var(--backdrop-blur, 0)) brightness(var(--backdrop-brightness, 1)) contrast(var(--backdrop-contrast, 1)) grayscale(var(--backdrop-grayscale, 0)) hue-rotate(var(--backdrop-hue-rotate, 0deg)) invert(var(--backdrop-invert, 0)) opacity(var(--backdrop-opacity, 1)) saturate(var(--backdrop-saturate, 1)) sepia(var(--backdrop-sepia, 0));`
1358
+ };
1359
+
1354
1360
  const configOptions = {
1355
- theme
1361
+ theme,
1362
+ vars
1356
1363
  };
1357
1364
 
1358
1365
  function isFunction(functionToCheck) {
@@ -1391,6 +1398,7 @@ function getConfigOptions(options = {}) {
1391
1398
  });
1392
1399
  return {
1393
1400
  prefix: "",
1401
+ ...configOptions,
1394
1402
  ...options,
1395
1403
  theme: newTheme
1396
1404
  };
@@ -1865,7 +1873,8 @@ function generator$2c(configOptions = {}) {
1865
1873
  function generator$2b(configOptions = {}) {
1866
1874
  const {
1867
1875
  prefix: globalPrefix,
1868
- theme = {}
1876
+ theme = {},
1877
+ vars = {}
1869
1878
  } = configOptions;
1870
1879
  const prefix = `${globalPrefix}blur`;
1871
1880
  const basePrefix = prefix.replace(globalPrefix, "");
@@ -1879,10 +1888,12 @@ function generator$2b(configOptions = {}) {
1879
1888
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
1880
1889
  return `
1881
1890
  ${prefix}${key} {
1882
- --blur: blur(${value}) !important;
1891
+ --blur: ${value};
1892
+ ${vars.filter}
1883
1893
  }
1884
1894
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}${key} {
1885
- --backdrop-blur: blur(${value}) !important;
1895
+ --backdrop-blur: ${value};
1896
+ ${vars.backdropFilter}
1886
1897
  }
1887
1898
  `;
1888
1899
  });
@@ -2279,7 +2290,8 @@ function generator$21(configOptions = {}) {
2279
2290
  function generator$20(configOptions = {}) {
2280
2291
  const {
2281
2292
  prefix: globalPrefix,
2282
- theme = {}
2293
+ theme = {},
2294
+ vars = {}
2283
2295
  } = configOptions;
2284
2296
  const prefix = `${globalPrefix}brightness`;
2285
2297
  const basePrefix = prefix.replace(globalPrefix, "");
@@ -2293,10 +2305,12 @@ function generator$20(configOptions = {}) {
2293
2305
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
2294
2306
  return `
2295
2307
  ${prefix}${key} {
2296
- --brightness: brightness(${value}) !important;
2308
+ --brightness: ${value};
2309
+ ${vars.filter}
2297
2310
  }
2298
2311
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}${key} {
2299
- --backdrop-brightness: brightness(${value}) !important;
2312
+ --backdrop-brightness: ${value};
2313
+ ${vars.backdropFilter}
2300
2314
  }
2301
2315
  `;
2302
2316
  });
@@ -2405,7 +2419,8 @@ function generator$1Y(configOptions = {}) {
2405
2419
  function generator$1X(configOptions = {}) {
2406
2420
  const {
2407
2421
  prefix: globalPrefix,
2408
- theme = {}
2422
+ theme = {},
2423
+ vars = {}
2409
2424
  } = configOptions;
2410
2425
  const prefix = `${globalPrefix}contrast`;
2411
2426
  const basePrefix = prefix.replace(globalPrefix, "");
@@ -2419,10 +2434,12 @@ function generator$1X(configOptions = {}) {
2419
2434
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
2420
2435
  return `
2421
2436
  ${prefix}${key} {
2422
- --contrast: contrast(${value}) !important;
2437
+ --contrast: ${value};
2438
+ ${vars.filter}
2423
2439
  }
2424
2440
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}${key} {
2425
- --backdrop-contrast: contrast(${value}) !important;
2441
+ --backdrop-contrast: ${value};
2442
+ ${vars.backdropFilter}
2426
2443
  }
2427
2444
  `;
2428
2445
  });
@@ -2637,34 +2654,11 @@ function generator$1P(configOptions = {}) {
2637
2654
  function generator$1O({
2638
2655
  prefix
2639
2656
  }) {
2640
- return `
2641
- ${prefix}filter {
2642
- --blur: ;
2643
- --brightness: ;
2644
- --contrast: ;
2645
- --grayscale: ;
2646
- --hue-rotate: ;
2647
- --invert: ;
2648
- --saturate: ;
2649
- --sepia: ;
2650
- --drop-shadow: ;
2651
- filter: var(--blur) var(--brightness) var(--contrast) var(--grayscale) var(--hue-rotate) var(--invert) var(--saturate) var(--sepia) var(--drop-shadow);
2652
-
2653
- --backdrop-blur: ;
2654
- --backdrop-brightness: ;
2655
- --backdrop-contrast: ;
2656
- --backdrop-grayscale: ;
2657
- --backdrop-hue-rotate: ;
2658
- --backdrop-invert: ;
2659
- --backdrop-opacity: ;
2660
- --backdrop-saturate: ;
2661
- --backdrop-sepia: ;
2662
- -webkit-backdrop-filter: var(--backdrop-blur) var(--backdrop-brightness) var(--backdrop-contrast) var(--backdrop-grayscale) var(--backdrop-hue-rotate) var(--backdrop-invert) var(--backdrop-opacity) var(--backdrop-saturate) var(--backdrop-sepia);
2663
- backdrop-filter: var(--backdrop-blur) var(--backdrop-brightness) var(--backdrop-contrast) var(--backdrop-grayscale) var(--backdrop-hue-rotate) var(--backdrop-invert) var(--backdrop-opacity) var(--backdrop-saturate) var(--backdrop-sepia);
2664
- }
2657
+ return `
2665
2658
  ${prefix}filter-none {
2666
- filter: none;
2667
- backdrop-filter: none;
2659
+ filter: none !important;
2660
+ -webkit-backdrop-filter: none !important;
2661
+ backdrop-filter: none !important;
2668
2662
  }
2669
2663
  `;
2670
2664
  }
@@ -3004,7 +2998,8 @@ function generator$1A(configOptions = {}) {
3004
2998
  function generator$1z(configOptions = {}) {
3005
2999
  const {
3006
3000
  prefix: globalPrefix,
3007
- theme = {}
3001
+ theme = {},
3002
+ vars = {}
3008
3003
  } = configOptions;
3009
3004
  const prefix = `${globalPrefix}grayscale`;
3010
3005
  const basePrefix = prefix.replace(globalPrefix, "");
@@ -3018,10 +3013,12 @@ function generator$1z(configOptions = {}) {
3018
3013
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
3019
3014
  return `
3020
3015
  ${prefix}${key} {
3021
- --grayscale: grayscale(${value}) !important;
3016
+ --grayscale: ${value};
3017
+ ${vars.filter}
3022
3018
  }
3023
3019
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}${key} {
3024
- --backdrop-grayscale: grayscale(${value}) !important;
3020
+ --backdrop-grayscale: ${value};
3021
+ ${vars.backdropFilter}
3025
3022
  }
3026
3023
  `;
3027
3024
  });
@@ -3299,7 +3296,8 @@ function generator$1n(configOptions = {}) {
3299
3296
  function generator$1m(configOptions = {}) {
3300
3297
  const {
3301
3298
  prefix: globalPrefix,
3302
- theme = {}
3299
+ theme = {},
3300
+ vars = {}
3303
3301
  } = configOptions;
3304
3302
  const {
3305
3303
  hueRotate = {}
@@ -3317,10 +3315,12 @@ function generator$1m(configOptions = {}) {
3317
3315
  }
3318
3316
  return `
3319
3317
  ${prefix}-${key} {
3320
- --hue-rotate: hue-rotate(${value}) !important;
3318
+ --hue-rotate: ${value};
3319
+ ${vars.filter}
3321
3320
  }
3322
3321
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}-${key} {
3323
- --backdrop-hue-rotate: hue-rotate(${value}) !important;
3322
+ --backdrop-hue-rotate: ${value};
3323
+ ${vars.backdropFilter}
3324
3324
  }
3325
3325
  `;
3326
3326
  });
@@ -3407,7 +3407,8 @@ function generator$1k(configOptions = {}) {
3407
3407
  function generator$1j(configOptions = {}) {
3408
3408
  const {
3409
3409
  prefix: globalPrefix,
3410
- theme = {}
3410
+ theme = {},
3411
+ vars = {}
3411
3412
  } = configOptions;
3412
3413
  const prefix = `${globalPrefix}invert`;
3413
3414
  const basePrefix = prefix.replace(globalPrefix, "");
@@ -3421,10 +3422,12 @@ function generator$1j(configOptions = {}) {
3421
3422
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
3422
3423
  return `
3423
3424
  ${prefix}${key} {
3424
- --invert: invert(${value}) !important;
3425
+ --invert: ${value};
3426
+ ${vars.filter}
3425
3427
  }
3426
3428
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}${key} {
3427
- --backdrop-invert: invert(${value}) !important;
3429
+ --backdrop-invert: ${value};
3430
+ ${vars.backdropFilter}
3428
3431
  }
3429
3432
  `;
3430
3433
  });
@@ -3840,7 +3843,8 @@ function generator$12(configOptions = {}) {
3840
3843
  function generator$11(configOptions = {}) {
3841
3844
  const {
3842
3845
  prefix: globalPrefix,
3843
- theme = {}
3846
+ theme = {},
3847
+ vars = {}
3844
3848
  } = configOptions;
3845
3849
  const prefix = `${globalPrefix}opacity`;
3846
3850
  const basePrefix = prefix.replace(globalPrefix, "");
@@ -3853,9 +3857,11 @@ function generator$11(configOptions = {}) {
3853
3857
  const cssString = getCssByOptions(opacity, (key, value) => `
3854
3858
  ${prefix}-${key} {
3855
3859
  opacity: ${value};
3860
+ ${vars.filter}
3856
3861
  }
3857
3862
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}-${key} {
3858
- --backdrop-opacity: opacity(${value});
3863
+ --backdrop-opacity: ${value};
3864
+ ${vars.backdropFilter}
3859
3865
  }
3860
3866
  `);
3861
3867
  return cssString;
@@ -4394,7 +4400,8 @@ function generator$J(configOptions = {}) {
4394
4400
  function generator$I(configOptions = {}) {
4395
4401
  const {
4396
4402
  prefix: globalPrefix,
4397
- theme = {}
4403
+ theme = {},
4404
+ vars = {}
4398
4405
  } = configOptions;
4399
4406
  const prefix = `${globalPrefix}saturate`;
4400
4407
  const basePrefix = prefix.replace(globalPrefix, "");
@@ -4408,10 +4415,12 @@ function generator$I(configOptions = {}) {
4408
4415
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
4409
4416
  return `
4410
4417
  ${prefix}${key} {
4411
- --saturate: saturate(${value}) !important;
4418
+ --saturate: ${value};
4419
+ ${vars.filter}
4412
4420
  }
4413
4421
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}${key} {
4414
- --backdrop-saturate: saturate(${value}) !important;
4422
+ --backdrop-saturate: ${value};
4423
+ ${vars.backdropFilter}
4415
4424
  }
4416
4425
  `;
4417
4426
  });
@@ -4423,7 +4432,8 @@ function generator$I(configOptions = {}) {
4423
4432
  function generator$H(configOptions = {}) {
4424
4433
  const {
4425
4434
  prefix: globalPrefix,
4426
- theme = {}
4435
+ theme = {},
4436
+ vars = {}
4427
4437
  } = configOptions;
4428
4438
  const {
4429
4439
  rotate = {}
@@ -4444,6 +4454,7 @@ function generator$H(configOptions = {}) {
4444
4454
  return `
4445
4455
  ${prefix}-${key} {
4446
4456
  --transform-rotate: ${value};
4457
+ ${vars.transform}
4447
4458
  }
4448
4459
  `;
4449
4460
  });
@@ -4455,7 +4466,8 @@ function generator$H(configOptions = {}) {
4455
4466
  function generator$G(configOptions = {}) {
4456
4467
  const {
4457
4468
  prefix: globalPrefix,
4458
- theme = {}
4469
+ theme = {},
4470
+ vars = {}
4459
4471
  } = configOptions;
4460
4472
  const prefix = `${globalPrefix}scale`;
4461
4473
  const {
@@ -4468,12 +4480,15 @@ function generator$G(configOptions = {}) {
4468
4480
  ${prefix}-${key} {
4469
4481
  --transform-scale-x: ${value};
4470
4482
  --transform-scale-y: ${value};
4483
+ ${vars.transform}
4471
4484
  }
4472
4485
  ${prefix}-x-${key} {
4473
4486
  --transform-scale-x: ${value};
4487
+ ${vars.transform}
4474
4488
  }
4475
4489
  ${prefix}-y-${key} {
4476
4490
  --transform-scale-y: ${value};
4491
+ ${vars.transform}
4477
4492
  }
4478
4493
  `);
4479
4494
  return cssString;
@@ -4691,7 +4706,8 @@ function generator$A(configOptions = {}) {
4691
4706
  function generator$z(configOptions = {}) {
4692
4707
  const {
4693
4708
  prefix: globalPrefix,
4694
- theme = {}
4709
+ theme = {},
4710
+ vars = {}
4695
4711
  } = configOptions;
4696
4712
  const prefix = `${globalPrefix}sepia`;
4697
4713
  const basePrefix = prefix.replace(globalPrefix, "");
@@ -4705,10 +4721,12 @@ function generator$z(configOptions = {}) {
4705
4721
  const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
4706
4722
  return `
4707
4723
  ${prefix}${key} {
4708
- --sepia: sepia(${value}) !important;
4724
+ --sepia: ${value};
4725
+ ${vars.filter}
4709
4726
  }
4710
4727
  ${prefix.replace(basePrefix, `backdrop-${basePrefix}`)}${key} {
4711
- --backdrop-sepia: sepia(${value}) !important;
4728
+ --backdrop-sepia: ${value};
4729
+ ${vars.backdropFilter}
4712
4730
  }
4713
4731
  `;
4714
4732
  });
@@ -4743,7 +4761,8 @@ function generator$y(configOptions = {}) {
4743
4761
  function generator$x(configOptions = {}) {
4744
4762
  const {
4745
4763
  prefix: globalPrefix,
4746
- theme = {}
4764
+ theme = {},
4765
+ vars = {}
4747
4766
  } = configOptions;
4748
4767
  const {
4749
4768
  skew = {}
@@ -4764,9 +4783,11 @@ function generator$x(configOptions = {}) {
4764
4783
  return `
4765
4784
  ${prefix}-x-${key} {
4766
4785
  --transform-skew-x: ${value};
4786
+ ${vars.transform}
4767
4787
  }
4768
4788
  ${prefix}-y-${key} {
4769
4789
  --transform-skew-y: ${value};
4790
+ ${vars.transform}
4770
4791
  }
4771
4792
  `;
4772
4793
  });
@@ -5338,19 +5359,9 @@ function generator$b(configOptions = {}) {
5338
5359
  function generator$a({
5339
5360
  prefix
5340
5361
  }) {
5341
- return `
5342
- ${prefix}transform {
5343
- --transform-translate-x: 0;
5344
- --transform-translate-y: 0;
5345
- --transform-rotate: 0;
5346
- --transform-skew-x: 0;
5347
- --transform-skew-y: 0;
5348
- --transform-scale-x: 1;
5349
- --transform-scale-y: 1;
5350
- transform: translateX(var(--transform-translate-x)) translateY(var(--transform-translate-y)) rotate(var(--transform-rotate)) skewX(var(--transform-skew-x)) skewY(var(--transform-skew-y)) scaleX(var(--transform-scale-x)) scaleY(var(--transform-scale-y));
5351
- }
5362
+ return `
5352
5363
  ${prefix}transform-none {
5353
- transform: none;
5364
+ transform: none !important;
5354
5365
  }
5355
5366
  `;
5356
5367
  }
@@ -5366,7 +5377,7 @@ function generator$9(configOptions = {}) {
5366
5377
  }) => {
5367
5378
  const cssString = getCssByOptions(propertyOptions, (key, value) => `
5368
5379
  ${prefix}-${key} {
5369
- transform-origin: ${value.replace("-", " ")} !important;
5380
+ transform-origin: ${value.replace("-", " ")};
5370
5381
  }
5371
5382
  `);
5372
5383
  return cssString;
@@ -5377,7 +5388,8 @@ function generator$9(configOptions = {}) {
5377
5388
  function generator$8(configOptions = {}) {
5378
5389
  const {
5379
5390
  prefix: globalPrefix,
5380
- theme = {}
5391
+ theme = {},
5392
+ vars = {}
5381
5393
  } = configOptions;
5382
5394
  const {
5383
5395
  translate = {}
@@ -5398,9 +5410,11 @@ function generator$8(configOptions = {}) {
5398
5410
  return `
5399
5411
  ${prefix}-x-${key} {
5400
5412
  --transform-translate-x: ${value};
5413
+ ${vars.transform}
5401
5414
  }
5402
5415
  ${prefix}-y-${key} {
5403
5416
  --transform-translate-y: ${value};
5417
+ ${vars.transform}
5404
5418
  }
5405
5419
  `;
5406
5420
  });
@@ -5591,7 +5605,7 @@ function generator(configOptions = {}) {
5591
5605
  return responsiveCssString;
5592
5606
  }
5593
5607
 
5594
- const patterns$1 = {
5608
+ const transition = {
5595
5609
  transitionNone: {
5596
5610
  regex: /^transition-none$/,
5597
5611
  cssProp: "transition-property",
@@ -5642,7 +5656,7 @@ const patterns$1 = {
5642
5656
  };
5643
5657
 
5644
5658
  const patterns = {
5645
- ...patterns$1
5659
+ ...transition
5646
5660
  };
5647
5661
 
5648
5662
  const plugins = {
@@ -5819,6 +5833,33 @@ function parseCustomClassWithPatterns(className) {
5819
5833
  return null;
5820
5834
  }
5821
5835
 
5836
+ /**
5837
+ * Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
5838
+ * @param {string} cssString
5839
+ * @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
5840
+ */
5841
+ function resolveCssToClearCss(cssString) {
5842
+ const customVars = {};
5843
+ const props = {};
5844
+ cssString.split(";").forEach(decl => {
5845
+ const [key, value] = decl.split(":").map(s => s && s.trim());
5846
+ if (!key || !value) return;
5847
+ if (key.startsWith("--")) {
5848
+ customVars[key] = value;
5849
+ } else {
5850
+ props[key] = value;
5851
+ }
5852
+ });
5853
+ // Replace var(--foo) in all values
5854
+ Object.keys(props).forEach(key => {
5855
+ let val = props[key];
5856
+ val = val.replace(/var\((--[a-zA-Z0-9-_]+)\)/g, (m, v) => customVars[v] !== undefined ? customVars[v] : m);
5857
+ props[key] = val;
5858
+ });
5859
+ // Build CSS string
5860
+ return Object.entries(props).map(([k, v]) => `${k}: ${v};`).join(" ");
5861
+ }
5862
+
5822
5863
  // Cache untuk getConfigOptions
5823
5864
  const configOptionsCache = new Map();
5824
5865
  const cacheKey = options => JSON.stringify(options);
@@ -5954,7 +5995,8 @@ function inlineStyleToJson(styleString) {
5954
5995
  // Cache untuk CSS resolusi
5955
5996
  const cssResolutionCache = new Map();
5956
5997
  function separateAndResolveCSS(arr) {
5957
- // Membuat kunci cache const cacheKey = arr.join('|');
5998
+ // Perbaiki: cacheKey harus unik untuk setiap input array
5999
+ const cacheKey = Array.isArray(arr) ? arr.join("|") : String(arr);
5958
6000
  if (cssResolutionCache.has(cacheKey)) {
5959
6001
  return cssResolutionCache.get(cacheKey);
5960
6002
  }
@@ -5966,13 +6008,13 @@ function separateAndResolveCSS(arr) {
5966
6008
  if (!item) return;
5967
6009
  const declarations = item.split(";").map(decl => decl.trim()).filter(decl => decl);
5968
6010
  declarations.forEach(declaration => {
5969
- const colonIndex = declaration.indexOf(':');
6011
+ const colonIndex = declaration.indexOf(":");
5970
6012
  if (colonIndex === -1) return;
5971
6013
  const key = declaration.substring(0, colonIndex).trim();
5972
6014
  const value = declaration.substring(colonIndex + 1).trim();
5973
6015
  if (key && value) {
5974
6016
  // Prioritaskan nilai yang lebih spesifik (misalnya !important)
5975
- if (value.includes('!important') || !cssProperties[key]) {
6017
+ if (value.includes("!important") || !cssProperties[key]) {
5976
6018
  cssProperties[key] = value;
5977
6019
  }
5978
6020
  }
@@ -5982,7 +6024,7 @@ function separateAndResolveCSS(arr) {
5982
6024
  ...cssProperties
5983
6025
  };
5984
6026
  const resolveValue = (value, variables) => {
5985
- if (!value || !value.includes('var(')) return value;
6027
+ if (!value || !value.includes("var(")) return value;
5986
6028
  return value.replace(/var\((--[a-zA-Z0-9-]+)(?:,\s*([^)]+))?\)/g, (match, variable, fallback) => {
5987
6029
  return variables[variable] || fallback || match;
5988
6030
  });
@@ -6024,11 +6066,11 @@ function debounce(func, wait = 100) {
6024
6066
  };
6025
6067
  }
6026
6068
 
6027
- /**
6028
- * Mengkonversi string kelas Tailwind menjadi inline styles CSS atau objek JSON
6029
- * @param {string} classNames - String berisi kelas Tailwind yang akan dikonversi
6030
- * @param {boolean} convertToJson - Jika true, hasil akan menjadi objek JSON, jika false menjadi string CSS
6031
- * @returns {string|Object} String CSS inline atau objek style JSON
6069
+ /**
6070
+ * Mengkonversi string kelas Tailwind menjadi inline styles CSS atau objek JSON
6071
+ * @param {string} classNames - String berisi kelas Tailwind yang akan dikonversi
6072
+ * @param {boolean} convertToJson - Jika true, hasil akan menjadi objek JSON, jika false menjadi string CSS
6073
+ * @returns {string|Object} String CSS inline atau objek style JSON
6032
6074
  */
6033
6075
  function tws(classNames, convertToJson) {
6034
6076
  if ([!classNames, typeof classNames !== "string", classNames.trim() === ""].includes(true)) {
@@ -6036,7 +6078,7 @@ function tws(classNames, convertToJson) {
6036
6078
  }
6037
6079
  let classes;
6038
6080
  try {
6039
- classes = classNames.match(/[\w-]+\[[^\]]+\]|[\w-]+\.\d+|[\w-]+/g);
6081
+ classes = classNames.match(/[\w-\/]+(?:\[[^\]]+\])?/g);
6040
6082
 
6041
6083
  // Jika tidak ada class yang valid ditemukan
6042
6084
  if (!classes || classes.length === 0) {
@@ -6048,8 +6090,9 @@ function tws(classNames, convertToJson) {
6048
6090
  return convertToJson ? {} : "";
6049
6091
  }
6050
6092
  let cssResult = classes.map(className => {
6051
- if (cssObject[className]) {
6052
- return cssObject[className];
6093
+ let result = cssObject[className] || cssObject[className.replace(/(\/)/g, "\\$1")] || cssObject[className.replace(/\./g, "\\.")];
6094
+ if (result) {
6095
+ return resolveCssToClearCss(result);
6053
6096
  } else if (className.includes("[")) {
6054
6097
  const match = className.match(/\[([^\]]+)\]/);
6055
6098
  if (match) {
@@ -6069,16 +6112,16 @@ function tws(classNames, convertToJson) {
6069
6112
  return cssResult;
6070
6113
  }
6071
6114
 
6072
- /**
6073
- * Menghasilkan string CSS dari objek style dengan sintaks mirip SCSS
6074
- * Mendukung nested selectors, state variants, responsive variants, dan @css directives
6075
- * @param {Object} obj - Objek dengan format style mirip SCSS
6076
- * @returns {string} String CSS yang dihasilkan
6115
+ /**
6116
+ * Menghasilkan string CSS dari objek style dengan sintaks mirip SCSS
6117
+ * Mendukung nested selectors, state variants, responsive variants, dan @css directives
6118
+ * @param {Object} obj - Objek dengan format style mirip SCSS
6119
+ * @returns {string} String CSS yang dihasilkan
6077
6120
  */
6078
6121
  function twsx(obj) {
6079
- if (!obj || typeof obj !== 'object') {
6080
- console.warn('twsx: Expected an object but received:', obj);
6081
- return '';
6122
+ if (!obj || typeof obj !== "object") {
6123
+ console.warn("twsx: Expected an object but received:", obj);
6124
+ return "";
6082
6125
  }
6083
6126
  const styles = {};
6084
6127
  function expandGroupedClass(input) {
@@ -6117,8 +6160,8 @@ function twsx(obj) {
6117
6160
  return result;
6118
6161
  }
6119
6162
  function walk(selector, val) {
6120
- if (!selector || typeof selector !== 'string') {
6121
- console.warn('Invalid selector in walk function:', selector);
6163
+ if (!selector || typeof selector !== "string") {
6164
+ console.warn("Invalid selector in walk function:", selector);
6122
6165
  return;
6123
6166
  }
6124
6167
  const {
@@ -6230,8 +6273,8 @@ function twsx(obj) {
6230
6273
  return parseSelectorCache.get(selector);
6231
6274
  }
6232
6275
  let result;
6233
- if (selector.includes('@css')) {
6234
- const parts = selector.split('@css');
6276
+ if (selector.includes("@css")) {
6277
+ const parts = selector.split("@css");
6235
6278
  const baseSelector = parts[0].trim();
6236
6279
  const cssProperty = parts[1]?.trim();
6237
6280
  result = {
@@ -6338,20 +6381,20 @@ function twsx(obj) {
6338
6381
  }
6339
6382
 
6340
6383
  // Daftarkan versi debounced dari fungsi-fungsi export
6341
- /**
6342
- * Versi debounced dari fungsi tws
6343
- * Membantu mengoptimalkan performa ketika memanggil tws berulang kali
6344
- * @param {string} classNames - String berisi kelas Tailwind yang akan dikonversi
6345
- * @param {boolean} convertToJson - Jika true, hasil akan menjadi objek JSON, jika false menjadi string CSS
6346
- * @returns {string|Object} String CSS inline atau objek style JSON
6384
+ /**
6385
+ * Versi debounced dari fungsi tws
6386
+ * Membantu mengoptimalkan performa ketika memanggil tws berulang kali
6387
+ * @param {string} classNames - String berisi kelas Tailwind yang akan dikonversi
6388
+ * @param {boolean} convertToJson - Jika true, hasil akan menjadi objek JSON, jika false menjadi string CSS
6389
+ * @returns {string|Object} String CSS inline atau objek style JSON
6347
6390
  */
6348
6391
  const debouncedTws = debounce(tws);
6349
6392
 
6350
- /**
6351
- * Versi debounced dari fungsi twsx
6352
- * Membantu mengoptimalkan performa ketika memanggil twsx berulang kali
6353
- * @param {Object} obj - Objek dengan format style mirip SCSS
6354
- * @returns {string} String CSS yang dihasilkan
6393
+ /**
6394
+ * Versi debounced dari fungsi twsx
6395
+ * Membantu mengoptimalkan performa ketika memanggil twsx berulang kali
6396
+ * @param {Object} obj - Objek dengan format style mirip SCSS
6397
+ * @returns {string} String CSS yang dihasilkan
6355
6398
  */
6356
6399
  const debouncedTwsx = debounce(twsx);
6357
6400