tailwind-to-style 2.7.2 → 2.7.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.
- package/dist/index.browser.js +174 -68
- package/dist/{index.cjs.js → index.cjs} +174 -68
- package/dist/index.d.ts +32 -7
- package/dist/index.esm.js +172 -69
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tailwind-to-style v2.7.
|
|
2
|
+
* tailwind-to-style v2.7.3
|
|
3
3
|
* Convert tailwind classes to inline style
|
|
4
4
|
*
|
|
5
5
|
* @author Bigetion
|
|
@@ -1529,12 +1529,10 @@ function getConfigOptions() {
|
|
|
1529
1529
|
const themeKeys = Object.keys(configOptions.theme);
|
|
1530
1530
|
themeKeys.forEach(key => {
|
|
1531
1531
|
newTheme[key] = theme[key] || configOptions.theme[key];
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
}
|
|
1537
|
-
});
|
|
1532
|
+
});
|
|
1533
|
+
themeKeys.forEach(key => {
|
|
1534
|
+
if (themeExtend[key] && newTheme[key]) {
|
|
1535
|
+
newTheme[key] = Object.assign({}, newTheme[key], themeExtend[key]);
|
|
1538
1536
|
}
|
|
1539
1537
|
});
|
|
1540
1538
|
themeKeys.forEach(key => {
|
|
@@ -1545,9 +1543,6 @@ function getConfigOptions() {
|
|
|
1545
1543
|
}
|
|
1546
1544
|
});
|
|
1547
1545
|
}
|
|
1548
|
-
if (themeExtend[key]) {
|
|
1549
|
-
newTheme[key] = Object.assign({}, newTheme[key], themeExtend[key]);
|
|
1550
|
-
}
|
|
1551
1546
|
});
|
|
1552
1547
|
return {
|
|
1553
1548
|
prefix: "",
|
|
@@ -6309,10 +6304,10 @@ function parseCustomClassWithPatterns(className) {
|
|
|
6309
6304
|
return null;
|
|
6310
6305
|
}
|
|
6311
6306
|
|
|
6312
|
-
/**
|
|
6313
|
-
* Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
|
|
6314
|
-
* @param {string} cssString
|
|
6315
|
-
* @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
|
|
6307
|
+
/**
|
|
6308
|
+
* Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
|
|
6309
|
+
* @param {string} cssString
|
|
6310
|
+
* @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
|
|
6316
6311
|
*/
|
|
6317
6312
|
function resolveCssToClearCss(cssString) {
|
|
6318
6313
|
const customVars = {};
|
|
@@ -6379,19 +6374,120 @@ function convertCssToObject(cssString) {
|
|
|
6379
6374
|
}
|
|
6380
6375
|
let twString = null;
|
|
6381
6376
|
let cssObject = null;
|
|
6382
|
-
|
|
6383
|
-
|
|
6377
|
+
let globalConfig = {
|
|
6378
|
+
theme: {
|
|
6379
|
+
extend: {
|
|
6380
|
+
colors: {}
|
|
6381
|
+
},
|
|
6382
|
+
screens: {
|
|
6383
|
+
sm: "640px",
|
|
6384
|
+
md: "768px",
|
|
6385
|
+
lg: "1024px",
|
|
6386
|
+
xl: "1280px",
|
|
6387
|
+
"2xl": "1536px"
|
|
6388
|
+
}
|
|
6389
|
+
},
|
|
6390
|
+
inject: true
|
|
6391
|
+
};
|
|
6392
|
+
function initializeCss() {
|
|
6393
|
+
if (!twString) {
|
|
6394
|
+
const configForGeneration = {
|
|
6395
|
+
...globalConfig,
|
|
6396
|
+
theme: {
|
|
6397
|
+
...globalConfig.theme
|
|
6398
|
+
}
|
|
6399
|
+
};
|
|
6400
|
+
twString = generateTailwindCssString(configForGeneration).replace(/\s\s+/g, " ");
|
|
6401
|
+
}
|
|
6402
|
+
if (!cssObject) {
|
|
6403
|
+
cssObject = convertCssToObject(twString);
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
initializeCss();
|
|
6407
|
+
function convertScreensToBreakpoints(screens) {
|
|
6408
|
+
const breakpoints = {};
|
|
6409
|
+
for (const [key, value] of Object.entries(screens)) {
|
|
6410
|
+
breakpoints[key] = `@media (min-width: ${value})`;
|
|
6411
|
+
}
|
|
6412
|
+
return breakpoints;
|
|
6413
|
+
}
|
|
6414
|
+
|
|
6415
|
+
/**
|
|
6416
|
+
* Set global configuration for both tws and twsx functions
|
|
6417
|
+
* @param {Object} config - Global configuration object
|
|
6418
|
+
* @returns {Object} Current global configuration
|
|
6419
|
+
*/
|
|
6420
|
+
function setConfig(config) {
|
|
6421
|
+
var _config$theme, _config$theme2, _config$theme2$extend, _config$theme3;
|
|
6422
|
+
// Reset CSS object cache when config changes
|
|
6423
|
+
twString = null;
|
|
6424
|
+
cssObject = null;
|
|
6425
|
+
configOptionsCache.clear();
|
|
6426
|
+
globalConfig = {
|
|
6427
|
+
...globalConfig,
|
|
6428
|
+
...config,
|
|
6429
|
+
theme: {
|
|
6430
|
+
...globalConfig.theme,
|
|
6431
|
+
...(config.theme || {}),
|
|
6432
|
+
extend: {
|
|
6433
|
+
...globalConfig.theme.extend,
|
|
6434
|
+
...(((_config$theme = config.theme) === null || _config$theme === void 0 ? void 0 : _config$theme.extend) || {}),
|
|
6435
|
+
colors: {
|
|
6436
|
+
...globalConfig.theme.extend.colors,
|
|
6437
|
+
...(((_config$theme2 = config.theme) === null || _config$theme2 === void 0 ? void 0 : (_config$theme2$extend = _config$theme2.extend) === null || _config$theme2$extend === void 0 ? void 0 : _config$theme2$extend.colors) || {})
|
|
6438
|
+
}
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
};
|
|
6442
|
+
|
|
6443
|
+
// Handle screens configuration
|
|
6444
|
+
if ((_config$theme3 = config.theme) !== null && _config$theme3 !== void 0 && _config$theme3.screens) {
|
|
6445
|
+
globalConfig.theme.screens = {
|
|
6446
|
+
...globalConfig.theme.screens,
|
|
6447
|
+
...config.theme.screens
|
|
6448
|
+
};
|
|
6449
|
+
}
|
|
6450
|
+
initializeCss();
|
|
6451
|
+
return globalConfig;
|
|
6384
6452
|
}
|
|
6385
|
-
|
|
6453
|
+
|
|
6454
|
+
/**
|
|
6455
|
+
* Get current global configuration
|
|
6456
|
+
* @returns {Object} Current global configuration
|
|
6457
|
+
*/
|
|
6458
|
+
function getConfig() {
|
|
6459
|
+
return {
|
|
6460
|
+
...globalConfig
|
|
6461
|
+
};
|
|
6462
|
+
}
|
|
6463
|
+
|
|
6464
|
+
/**
|
|
6465
|
+
* Reset global configuration to default
|
|
6466
|
+
* @returns {Object} Default configuration
|
|
6467
|
+
*/
|
|
6468
|
+
function resetConfig() {
|
|
6469
|
+
twString = null;
|
|
6470
|
+
cssObject = null;
|
|
6471
|
+
configOptionsCache.clear();
|
|
6472
|
+
globalConfig = {
|
|
6473
|
+
theme: {
|
|
6474
|
+
extend: {
|
|
6475
|
+
colors: {}
|
|
6476
|
+
},
|
|
6477
|
+
screens: {
|
|
6478
|
+
sm: "640px",
|
|
6479
|
+
md: "768px",
|
|
6480
|
+
lg: "1024px",
|
|
6481
|
+
xl: "1280px",
|
|
6482
|
+
"2xl": "1536px"
|
|
6483
|
+
}
|
|
6484
|
+
},
|
|
6485
|
+
inject: true
|
|
6486
|
+
};
|
|
6487
|
+
twString = generateTailwindCssString(globalConfig).replace(/\s\s+/g, " ");
|
|
6386
6488
|
cssObject = convertCssToObject(twString);
|
|
6489
|
+
return globalConfig;
|
|
6387
6490
|
}
|
|
6388
|
-
const breakpoints = {
|
|
6389
|
-
sm: "@media (min-width: 640px)",
|
|
6390
|
-
md: "@media (min-width: 768px)",
|
|
6391
|
-
lg: "@media (min-width: 1024px)",
|
|
6392
|
-
xl: "@media (min-width: 1280px)",
|
|
6393
|
-
"2xl": "@media (min-width: 1536px)"
|
|
6394
|
-
};
|
|
6395
6491
|
const pseudoVariants = new Set(["hover", "focus", "focus-within", "active", "visited", "disabled", "first", "last", "checked", "invalid", "required"]);
|
|
6396
6492
|
const specialVariants = {
|
|
6397
6493
|
group: (state, sel) => `.group:${state} ${sel}`,
|
|
@@ -6441,6 +6537,7 @@ function resolveVariants(selector, variants) {
|
|
|
6441
6537
|
let media = null;
|
|
6442
6538
|
let finalSelector = selector;
|
|
6443
6539
|
for (const v of variants) {
|
|
6540
|
+
const breakpoints = convertScreensToBreakpoints(globalConfig.theme.screens || {});
|
|
6444
6541
|
if (breakpoints[v]) {
|
|
6445
6542
|
media = breakpoints[v];
|
|
6446
6543
|
} else if (pseudoVariants.has(v)) {
|
|
@@ -6502,7 +6599,7 @@ function debounce(func) {
|
|
|
6502
6599
|
callCount++;
|
|
6503
6600
|
clearTimeout(timeout);
|
|
6504
6601
|
timeout = setTimeout(() => {
|
|
6505
|
-
const marker = performanceMonitor.start(`debounced:${func.name ||
|
|
6602
|
+
const marker = performanceMonitor.start(`debounced:${func.name || "anonymous"}`);
|
|
6506
6603
|
try {
|
|
6507
6604
|
const result = func.apply(context, args);
|
|
6508
6605
|
performanceMonitor.end(marker);
|
|
@@ -6590,11 +6687,11 @@ function separateAndResolveCSS(arr) {
|
|
|
6590
6687
|
}
|
|
6591
6688
|
}
|
|
6592
6689
|
|
|
6593
|
-
/**
|
|
6594
|
-
* Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
|
|
6595
|
-
* @param {string} className - Class name with potential opacity modifier
|
|
6596
|
-
* @param {string} cssDeclaration - CSS declaration to modify
|
|
6597
|
-
* @returns {string} Modified CSS declaration with opacity applied
|
|
6690
|
+
/**
|
|
6691
|
+
* Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
|
|
6692
|
+
* @param {string} className - Class name with potential opacity modifier
|
|
6693
|
+
* @param {string} cssDeclaration - CSS declaration to modify
|
|
6694
|
+
* @returns {string} Modified CSS declaration with opacity applied
|
|
6598
6695
|
*/
|
|
6599
6696
|
function processOpacityModifier(className, cssDeclaration) {
|
|
6600
6697
|
const opacityMatch = className.match(/\/(\d+)$/);
|
|
@@ -6607,20 +6704,20 @@ function processOpacityModifier(className, cssDeclaration) {
|
|
|
6607
6704
|
let modifiedDeclaration = cssDeclaration;
|
|
6608
6705
|
|
|
6609
6706
|
// Replace opacity custom properties
|
|
6610
|
-
const opacityProperties = [
|
|
6707
|
+
const opacityProperties = ["--text-opacity", "--bg-opacity", "--border-opacity", "--ring-opacity", "--divide-opacity", "--placeholder-opacity", "--text-decoration-opacity", "--outline-opacity", "--accent-opacity", "--caret-opacity"];
|
|
6611
6708
|
opacityProperties.forEach(prop => {
|
|
6612
|
-
const propRegex = new RegExp(`${prop}\\s*:\\s*[\\d.]+`,
|
|
6709
|
+
const propRegex = new RegExp(`${prop}\\s*:\\s*[\\d.]+`, "gi");
|
|
6613
6710
|
modifiedDeclaration = modifiedDeclaration.replace(propRegex, `${prop}: ${alphaValue}`);
|
|
6614
6711
|
});
|
|
6615
6712
|
|
|
6616
6713
|
// Also handle direct color values that might not use CSS variables
|
|
6617
|
-
const colorProperties = [
|
|
6714
|
+
const colorProperties = ["color", "background-color", "border-color", "text-decoration-color", "outline-color", "fill", "stroke", "caret-color", "accent-color"];
|
|
6618
6715
|
colorProperties.forEach(prop => {
|
|
6619
6716
|
// Match rgb(), rgba(), hsl(), hsla() functions
|
|
6620
|
-
const rgbRegex = new RegExp(`(${prop}\\s*:\\s*)rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)`,
|
|
6621
|
-
const rgbaRegex = new RegExp(`(${prop}\\s*:\\s*)rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*[\\d.]+\\)`,
|
|
6622
|
-
const hslRegex = new RegExp(`(${prop}\\s*:\\s*)hsl\\((\\d+),\\s*([\\d.]+%),\\s*([\\d.]+%)\\)`,
|
|
6623
|
-
const hslaRegex = new RegExp(`(${prop}\\s*:\\s*)hsla\\((\\d+),\\s*([\\d.]+%),\\s*([\\d.]+%),\\s*[\\d.]+\\)`,
|
|
6717
|
+
const rgbRegex = new RegExp(`(${prop}\\s*:\\s*)rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)`, "gi");
|
|
6718
|
+
const rgbaRegex = new RegExp(`(${prop}\\s*:\\s*)rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*[\\d.]+\\)`, "gi");
|
|
6719
|
+
const hslRegex = new RegExp(`(${prop}\\s*:\\s*)hsl\\((\\d+),\\s*([\\d.]+%),\\s*([\\d.]+%)\\)`, "gi");
|
|
6720
|
+
const hslaRegex = new RegExp(`(${prop}\\s*:\\s*)hsla\\((\\d+),\\s*([\\d.]+%),\\s*([\\d.]+%),\\s*[\\d.]+\\)`, "gi");
|
|
6624
6721
|
|
|
6625
6722
|
// Convert rgb to rgba with opacity
|
|
6626
6723
|
modifiedDeclaration = modifiedDeclaration.replace(rgbRegex, `$1rgba($2, $3, $4, ${alphaValue})`);
|
|
@@ -6635,10 +6732,10 @@ function processOpacityModifier(className, cssDeclaration) {
|
|
|
6635
6732
|
modifiedDeclaration = modifiedDeclaration.replace(hslaRegex, `$1hsla($2, $3, $4, ${alphaValue})`);
|
|
6636
6733
|
|
|
6637
6734
|
// Handle hex colors
|
|
6638
|
-
const hexRegex = new RegExp(`(${prop}\\s*:\\s*)(#[0-9a-fA-F]{3,6})`,
|
|
6639
|
-
modifiedDeclaration = modifiedDeclaration.replace(hexRegex, (
|
|
6735
|
+
const hexRegex = new RegExp(`(${prop}\\s*:\\s*)(#[0-9a-fA-F]{3,6})`, "gi");
|
|
6736
|
+
modifiedDeclaration = modifiedDeclaration.replace(hexRegex, (_, propPart, hexColor) => {
|
|
6640
6737
|
// Convert hex to rgba
|
|
6641
|
-
const hex = hexColor.replace(
|
|
6738
|
+
const hex = hexColor.replace("#", "");
|
|
6642
6739
|
let r, g, b;
|
|
6643
6740
|
if (hex.length === 3) {
|
|
6644
6741
|
r = parseInt(hex[0] + hex[0], 16);
|
|
@@ -6655,15 +6752,17 @@ function processOpacityModifier(className, cssDeclaration) {
|
|
|
6655
6752
|
return modifiedDeclaration;
|
|
6656
6753
|
}
|
|
6657
6754
|
|
|
6658
|
-
/**
|
|
6659
|
-
* Convert Tailwind class string to inline CSS styles or JSON object
|
|
6660
|
-
* @param {string} classNames - String containing Tailwind classes to convert
|
|
6661
|
-
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
6662
|
-
* @returns {string|Object} Inline CSS string or style JSON object
|
|
6755
|
+
/**
|
|
6756
|
+
* Convert Tailwind class string to inline CSS styles or JSON object
|
|
6757
|
+
* @param {string} classNames - String containing Tailwind classes to convert
|
|
6758
|
+
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
6759
|
+
* @returns {string|Object} Inline CSS string or style JSON object
|
|
6663
6760
|
*/
|
|
6664
6761
|
function tws(classNames, convertToJson) {
|
|
6665
6762
|
const totalMarker = performanceMonitor.start("tws:total");
|
|
6666
6763
|
try {
|
|
6764
|
+
// Ensure CSS is initialized with current global config
|
|
6765
|
+
initializeCss();
|
|
6667
6766
|
if ([!classNames, typeof classNames !== "string", classNames.trim() === ""].includes(true)) {
|
|
6668
6767
|
performanceMonitor.end(totalMarker);
|
|
6669
6768
|
return convertToJson ? {} : "";
|
|
@@ -6690,11 +6789,11 @@ function tws(classNames, convertToJson) {
|
|
|
6690
6789
|
const processMarker = performanceMonitor.start("tws:process");
|
|
6691
6790
|
let cssResult = classes.map(className => {
|
|
6692
6791
|
// Extract base class name without opacity modifier
|
|
6693
|
-
const baseClassName = className.replace(/\/\d+$/,
|
|
6792
|
+
const baseClassName = className.replace(/\/\d+$/, "");
|
|
6694
6793
|
let result = cssObject[baseClassName] || cssObject[baseClassName.replace(/(\/)/g, "\\$1")] || cssObject[baseClassName.replace(/\./g, "\\.")];
|
|
6695
6794
|
if (result) {
|
|
6696
6795
|
// Apply opacity modifier if present
|
|
6697
|
-
if (className.includes(
|
|
6796
|
+
if (className.includes("/") && /\/\d+$/.test(className)) {
|
|
6698
6797
|
result = processOpacityModifier(className, result);
|
|
6699
6798
|
}
|
|
6700
6799
|
return resolveCssToClearCss(result);
|
|
@@ -6706,7 +6805,7 @@ function tws(classNames, convertToJson) {
|
|
|
6706
6805
|
if (cssObject[`${baseKey}custom`]) {
|
|
6707
6806
|
let customResult = cssObject[`${baseKey}custom`].replace(/custom_value/g, customValue);
|
|
6708
6807
|
// Apply opacity modifier to custom values too
|
|
6709
|
-
if (className.includes(
|
|
6808
|
+
if (className.includes("/") && /\/\d+$/.test(className)) {
|
|
6710
6809
|
customResult = processOpacityModifier(className, customResult);
|
|
6711
6810
|
}
|
|
6712
6811
|
return customResult;
|
|
@@ -6842,7 +6941,7 @@ function processClass(cls, selector, styles) {
|
|
|
6842
6941
|
} = resolveVariants(selector, rawVariants);
|
|
6843
6942
|
|
|
6844
6943
|
// Extract base class name without opacity modifier for CSS lookup
|
|
6845
|
-
const baseClassName = pureClassName.replace(/\/\d+$/,
|
|
6944
|
+
const baseClassName = pureClassName.replace(/\/\d+$/, "");
|
|
6846
6945
|
let declarations = cssObject[baseClassName] || cssObject[baseClassName.replace(/(\/)/g, "\\$1")] || cssObject[baseClassName.replace(/\./g, "\\.")];
|
|
6847
6946
|
if (!declarations && baseClassName.includes("[")) {
|
|
6848
6947
|
const match = baseClassName.match(/^(.+?)\[(.+)\]$/);
|
|
@@ -6863,7 +6962,7 @@ function processClass(cls, selector, styles) {
|
|
|
6863
6962
|
}
|
|
6864
6963
|
|
|
6865
6964
|
// Apply opacity modifier if present
|
|
6866
|
-
if (pureClassName.includes(
|
|
6965
|
+
if (pureClassName.includes("/") && /\/\d+$/.test(pureClassName)) {
|
|
6867
6966
|
declarations = processOpacityModifier(pureClassName, declarations);
|
|
6868
6967
|
}
|
|
6869
6968
|
if (isImportant) {
|
|
@@ -7038,12 +7137,12 @@ function generateCssString(styles) {
|
|
|
7038
7137
|
return cssString.trim();
|
|
7039
7138
|
}
|
|
7040
7139
|
|
|
7041
|
-
/**
|
|
7042
|
-
* Generate CSS string from style object with SCSS-like syntax
|
|
7043
|
-
* Supports nested selectors, state variants, responsive variants, and @css directives
|
|
7044
|
-
* @param {Object} obj - Object with SCSS-like style format
|
|
7045
|
-
* @param {Object} [options] - Additional options,
|
|
7046
|
-
* @returns {string} Generated CSS string
|
|
7140
|
+
/**
|
|
7141
|
+
* Generate CSS string from style object with SCSS-like syntax
|
|
7142
|
+
* Supports nested selectors, state variants, responsive variants, and @css directives
|
|
7143
|
+
* @param {Object} obj - Object with SCSS-like style format
|
|
7144
|
+
* @param {Object} [options] - Additional options, merges with global config
|
|
7145
|
+
* @returns {string} Generated CSS string
|
|
7047
7146
|
*/
|
|
7048
7147
|
function twsx(obj) {
|
|
7049
7148
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -7053,9 +7152,13 @@ function twsx(obj) {
|
|
|
7053
7152
|
console.warn("twsx: Expected an object but received:", obj);
|
|
7054
7153
|
return "";
|
|
7055
7154
|
}
|
|
7155
|
+
const mergedOptions = {
|
|
7156
|
+
...globalConfig,
|
|
7157
|
+
...options
|
|
7158
|
+
};
|
|
7056
7159
|
const {
|
|
7057
7160
|
inject = true
|
|
7058
|
-
} =
|
|
7161
|
+
} = mergedOptions;
|
|
7059
7162
|
const styles = {};
|
|
7060
7163
|
|
|
7061
7164
|
// Create walk function with closure over styles
|
|
@@ -7150,19 +7253,19 @@ function autoInjectCss(cssString) {
|
|
|
7150
7253
|
}
|
|
7151
7254
|
|
|
7152
7255
|
// Enhanced debounced functions with performance monitoring configuration
|
|
7153
|
-
/**
|
|
7154
|
-
* Debounced version of tws function with performance monitoring
|
|
7155
|
-
* @param {string} classNames - String containing Tailwind classes to convert
|
|
7156
|
-
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
7157
|
-
* @returns {string|Object} Inline CSS string or style JSON object
|
|
7256
|
+
/**
|
|
7257
|
+
* Debounced version of tws function with performance monitoring
|
|
7258
|
+
* @param {string} classNames - String containing Tailwind classes to convert
|
|
7259
|
+
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
7260
|
+
* @returns {string|Object} Inline CSS string or style JSON object
|
|
7158
7261
|
*/
|
|
7159
7262
|
const debouncedTws = debounce(tws, 50); // Faster debounce for tws
|
|
7160
7263
|
|
|
7161
|
-
/**
|
|
7162
|
-
* Debounced version of twsx function with performance monitoring
|
|
7163
|
-
* @param {Object} obj - Object with SCSS-like style format
|
|
7164
|
-
* @param {Object} [options] - Additional options
|
|
7165
|
-
* @returns {string} Generated CSS string
|
|
7264
|
+
/**
|
|
7265
|
+
* Debounced version of twsx function with performance monitoring
|
|
7266
|
+
* @param {Object} obj - Object with SCSS-like style format
|
|
7267
|
+
* @param {Object} [options] - Additional options
|
|
7268
|
+
* @returns {string} Generated CSS string
|
|
7166
7269
|
*/
|
|
7167
7270
|
const debouncedTwsx = debounce(twsx, 100); // Standard debounce for twsx
|
|
7168
7271
|
|
|
@@ -7194,8 +7297,8 @@ const performanceUtils = {
|
|
|
7194
7297
|
enablePerformanceLogging() {
|
|
7195
7298
|
let enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
7196
7299
|
performanceMonitor.enabled = enabled && typeof performance !== "undefined";
|
|
7197
|
-
console.log(`Performance monitoring ${enabled ?
|
|
7300
|
+
console.log(`Performance monitoring ${enabled ? "enabled" : "disabled"}`);
|
|
7198
7301
|
}
|
|
7199
7302
|
};
|
|
7200
7303
|
|
|
7201
|
-
export { debouncedTws, debouncedTwsx, performanceUtils, tws, twsx };
|
|
7304
|
+
export { debouncedTws, debouncedTwsx, getConfig, performanceUtils, resetConfig, setConfig, tws, twsx };
|