tailwind-to-style 2.7.4 → 2.7.5
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 +64 -81
- package/dist/index.cjs +64 -81
- package/dist/index.esm.js +64 -81
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tailwind-to-style v2.7.
|
|
2
|
+
* tailwind-to-style v2.7.5
|
|
3
3
|
* Convert tailwind classes to inline style
|
|
4
4
|
*
|
|
5
5
|
* @author Bigetion
|
|
@@ -6397,34 +6397,64 @@ var tailwindToStyle = (function (exports) {
|
|
|
6397
6397
|
},
|
|
6398
6398
|
inject: true
|
|
6399
6399
|
};
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
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));
|
|
6409
6422
|
}
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
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
|
+
}
|
|
6417
6450
|
}
|
|
6418
|
-
return global[CONFIG_STORAGE_KEY];
|
|
6419
|
-
} else {
|
|
6420
|
-
// Fallback - use module-level variable (will work only within same file)
|
|
6421
|
-
console.warn("tailwind-to-style: Unable to create global config storage. Config will only work within the same module.");
|
|
6422
|
-
return defaultConfig;
|
|
6423
6451
|
}
|
|
6424
6452
|
}
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6453
|
+
const configManager = new ConfigManager();
|
|
6454
|
+
function getGlobalStorage() {
|
|
6455
|
+
return configManager.get();
|
|
6456
|
+
}
|
|
6457
|
+
let globalConfig = null;
|
|
6428
6458
|
function initializeCss() {
|
|
6429
6459
|
if (!twString) {
|
|
6430
6460
|
// Always get fresh config from global storage
|
|
@@ -6456,40 +6486,13 @@ var tailwindToStyle = (function (exports) {
|
|
|
6456
6486
|
* @returns {Object} Current global configuration
|
|
6457
6487
|
*/
|
|
6458
6488
|
function setConfig(config) {
|
|
6459
|
-
var _config$theme, _config$theme2, _config$theme2$extend, _config$theme3;
|
|
6460
6489
|
// Reset CSS object cache when config changes
|
|
6461
6490
|
twString = null;
|
|
6462
6491
|
cssObject = null;
|
|
6463
6492
|
configOptionsCache.clear();
|
|
6464
6493
|
|
|
6465
|
-
//
|
|
6466
|
-
const globalStorage =
|
|
6467
|
-
|
|
6468
|
-
// Update global storage directly
|
|
6469
|
-
Object.assign(globalStorage, {
|
|
6470
|
-
...globalStorage,
|
|
6471
|
-
...config,
|
|
6472
|
-
theme: {
|
|
6473
|
-
...globalStorage.theme,
|
|
6474
|
-
...(config.theme || {}),
|
|
6475
|
-
extend: {
|
|
6476
|
-
...globalStorage.theme.extend,
|
|
6477
|
-
...(((_config$theme = config.theme) === null || _config$theme === void 0 ? void 0 : _config$theme.extend) || {}),
|
|
6478
|
-
colors: {
|
|
6479
|
-
...globalStorage.theme.extend.colors,
|
|
6480
|
-
...(((_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) || {})
|
|
6481
|
-
}
|
|
6482
|
-
}
|
|
6483
|
-
}
|
|
6484
|
-
});
|
|
6485
|
-
|
|
6486
|
-
// Handle screens configuration
|
|
6487
|
-
if ((_config$theme3 = config.theme) !== null && _config$theme3 !== void 0 && _config$theme3.screens) {
|
|
6488
|
-
globalStorage.theme.screens = {
|
|
6489
|
-
...globalStorage.theme.screens,
|
|
6490
|
-
...config.theme.screens
|
|
6491
|
-
};
|
|
6492
|
-
}
|
|
6494
|
+
// Use ConfigManager to set config
|
|
6495
|
+
const globalStorage = configManager.set(config);
|
|
6493
6496
|
|
|
6494
6497
|
// Handle legacy breakpoints with deprecation warning
|
|
6495
6498
|
if (config.breakpoints) {
|
|
@@ -6504,17 +6507,17 @@ var tailwindToStyle = (function (exports) {
|
|
|
6504
6507
|
screens[key] = match[1].trim();
|
|
6505
6508
|
}
|
|
6506
6509
|
}
|
|
6507
|
-
globalStorage.theme.screens
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6510
|
+
if (!globalStorage.theme.screens) {
|
|
6511
|
+
globalStorage.theme.screens = {};
|
|
6512
|
+
}
|
|
6513
|
+
Object.assign(globalStorage.theme.screens, screens);
|
|
6511
6514
|
}
|
|
6512
6515
|
|
|
6513
6516
|
// Update local reference
|
|
6514
6517
|
globalConfig = globalStorage;
|
|
6515
6518
|
initializeCss();
|
|
6516
6519
|
return {
|
|
6517
|
-
...
|
|
6520
|
+
...globalStorage
|
|
6518
6521
|
};
|
|
6519
6522
|
}
|
|
6520
6523
|
|
|
@@ -6523,8 +6526,7 @@ var tailwindToStyle = (function (exports) {
|
|
|
6523
6526
|
* @returns {Object} Current global configuration
|
|
6524
6527
|
*/
|
|
6525
6528
|
function getConfig() {
|
|
6526
|
-
|
|
6527
|
-
globalConfig = getGlobalStorage();
|
|
6529
|
+
globalConfig = configManager.get();
|
|
6528
6530
|
return {
|
|
6529
6531
|
...globalConfig
|
|
6530
6532
|
};
|
|
@@ -6538,26 +6540,7 @@ var tailwindToStyle = (function (exports) {
|
|
|
6538
6540
|
twString = null;
|
|
6539
6541
|
cssObject = null;
|
|
6540
6542
|
configOptionsCache.clear();
|
|
6541
|
-
|
|
6542
|
-
// Get global storage reference and reset it
|
|
6543
|
-
const globalStorage = getGlobalStorage();
|
|
6544
|
-
|
|
6545
|
-
// Reset to default config
|
|
6546
|
-
Object.assign(globalStorage, {
|
|
6547
|
-
theme: {
|
|
6548
|
-
extend: {
|
|
6549
|
-
colors: {}
|
|
6550
|
-
},
|
|
6551
|
-
screens: {
|
|
6552
|
-
sm: "640px",
|
|
6553
|
-
md: "768px",
|
|
6554
|
-
lg: "1024px",
|
|
6555
|
-
xl: "1280px",
|
|
6556
|
-
"2xl": "1536px"
|
|
6557
|
-
}
|
|
6558
|
-
},
|
|
6559
|
-
inject: true
|
|
6560
|
-
});
|
|
6543
|
+
const globalStorage = configManager.reset();
|
|
6561
6544
|
|
|
6562
6545
|
// Update local reference
|
|
6563
6546
|
globalConfig = globalStorage;
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tailwind-to-style v2.7.
|
|
2
|
+
* tailwind-to-style v2.7.5
|
|
3
3
|
* Convert tailwind classes to inline style
|
|
4
4
|
*
|
|
5
5
|
* @author Bigetion
|
|
@@ -6398,34 +6398,64 @@ const defaultConfig = {
|
|
|
6398
6398
|
},
|
|
6399
6399
|
inject: true
|
|
6400
6400
|
};
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6401
|
+
class ConfigManager {
|
|
6402
|
+
constructor() {
|
|
6403
|
+
this.storage = null;
|
|
6404
|
+
this.initialized = false;
|
|
6405
|
+
}
|
|
6406
|
+
initialize() {
|
|
6407
|
+
if (this.initialized) return this.storage;
|
|
6408
|
+
if (typeof window !== "undefined") {
|
|
6409
|
+
if (!window[CONFIG_STORAGE_KEY]) {
|
|
6410
|
+
window[CONFIG_STORAGE_KEY] = JSON.parse(JSON.stringify(defaultConfig));
|
|
6411
|
+
}
|
|
6412
|
+
this.storage = window[CONFIG_STORAGE_KEY];
|
|
6413
|
+
} else if (typeof global !== "undefined") {
|
|
6414
|
+
// Node.js environment
|
|
6415
|
+
if (!global[CONFIG_STORAGE_KEY]) {
|
|
6416
|
+
global[CONFIG_STORAGE_KEY] = JSON.parse(JSON.stringify(defaultConfig));
|
|
6417
|
+
}
|
|
6418
|
+
this.storage = global[CONFIG_STORAGE_KEY];
|
|
6419
|
+
} else {
|
|
6420
|
+
// Fallback
|
|
6421
|
+
console.warn("tailwind-to-style: Unable to create global config storage. Config will only work within the same module.");
|
|
6422
|
+
this.storage = JSON.parse(JSON.stringify(defaultConfig));
|
|
6410
6423
|
}
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6424
|
+
this.initialized = true;
|
|
6425
|
+
return this.storage;
|
|
6426
|
+
}
|
|
6427
|
+
get() {
|
|
6428
|
+
return this.initialize();
|
|
6429
|
+
}
|
|
6430
|
+
set(config) {
|
|
6431
|
+
const storage = this.initialize();
|
|
6432
|
+
this.deepMerge(storage, config);
|
|
6433
|
+
return storage;
|
|
6434
|
+
}
|
|
6435
|
+
reset() {
|
|
6436
|
+
const storage = this.initialize();
|
|
6437
|
+
Object.keys(storage).forEach(key => delete storage[key]);
|
|
6438
|
+
Object.assign(storage, JSON.parse(JSON.stringify(defaultConfig)));
|
|
6439
|
+
return storage;
|
|
6440
|
+
}
|
|
6441
|
+
deepMerge(target, source) {
|
|
6442
|
+
for (const key in source) {
|
|
6443
|
+
if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
|
|
6444
|
+
if (!target[key] || typeof target[key] !== "object") {
|
|
6445
|
+
target[key] = {};
|
|
6446
|
+
}
|
|
6447
|
+
this.deepMerge(target[key], source[key]);
|
|
6448
|
+
} else {
|
|
6449
|
+
target[key] = source[key];
|
|
6450
|
+
}
|
|
6418
6451
|
}
|
|
6419
|
-
return global[CONFIG_STORAGE_KEY];
|
|
6420
|
-
} else {
|
|
6421
|
-
// Fallback - use module-level variable (will work only within same file)
|
|
6422
|
-
console.warn("tailwind-to-style: Unable to create global config storage. Config will only work within the same module.");
|
|
6423
|
-
return defaultConfig;
|
|
6424
6452
|
}
|
|
6425
6453
|
}
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6454
|
+
const configManager = new ConfigManager();
|
|
6455
|
+
function getGlobalStorage() {
|
|
6456
|
+
return configManager.get();
|
|
6457
|
+
}
|
|
6458
|
+
let globalConfig = null;
|
|
6429
6459
|
function initializeCss() {
|
|
6430
6460
|
if (!twString) {
|
|
6431
6461
|
// Always get fresh config from global storage
|
|
@@ -6457,40 +6487,13 @@ function convertScreensToBreakpoints(screens) {
|
|
|
6457
6487
|
* @returns {Object} Current global configuration
|
|
6458
6488
|
*/
|
|
6459
6489
|
function setConfig(config) {
|
|
6460
|
-
var _config$theme, _config$theme2, _config$theme2$extend, _config$theme3;
|
|
6461
6490
|
// Reset CSS object cache when config changes
|
|
6462
6491
|
twString = null;
|
|
6463
6492
|
cssObject = null;
|
|
6464
6493
|
configOptionsCache.clear();
|
|
6465
6494
|
|
|
6466
|
-
//
|
|
6467
|
-
const globalStorage =
|
|
6468
|
-
|
|
6469
|
-
// Update global storage directly
|
|
6470
|
-
Object.assign(globalStorage, {
|
|
6471
|
-
...globalStorage,
|
|
6472
|
-
...config,
|
|
6473
|
-
theme: {
|
|
6474
|
-
...globalStorage.theme,
|
|
6475
|
-
...(config.theme || {}),
|
|
6476
|
-
extend: {
|
|
6477
|
-
...globalStorage.theme.extend,
|
|
6478
|
-
...(((_config$theme = config.theme) === null || _config$theme === void 0 ? void 0 : _config$theme.extend) || {}),
|
|
6479
|
-
colors: {
|
|
6480
|
-
...globalStorage.theme.extend.colors,
|
|
6481
|
-
...(((_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) || {})
|
|
6482
|
-
}
|
|
6483
|
-
}
|
|
6484
|
-
}
|
|
6485
|
-
});
|
|
6486
|
-
|
|
6487
|
-
// Handle screens configuration
|
|
6488
|
-
if ((_config$theme3 = config.theme) !== null && _config$theme3 !== void 0 && _config$theme3.screens) {
|
|
6489
|
-
globalStorage.theme.screens = {
|
|
6490
|
-
...globalStorage.theme.screens,
|
|
6491
|
-
...config.theme.screens
|
|
6492
|
-
};
|
|
6493
|
-
}
|
|
6495
|
+
// Use ConfigManager to set config
|
|
6496
|
+
const globalStorage = configManager.set(config);
|
|
6494
6497
|
|
|
6495
6498
|
// Handle legacy breakpoints with deprecation warning
|
|
6496
6499
|
if (config.breakpoints) {
|
|
@@ -6505,17 +6508,17 @@ function setConfig(config) {
|
|
|
6505
6508
|
screens[key] = match[1].trim();
|
|
6506
6509
|
}
|
|
6507
6510
|
}
|
|
6508
|
-
globalStorage.theme.screens
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6511
|
+
if (!globalStorage.theme.screens) {
|
|
6512
|
+
globalStorage.theme.screens = {};
|
|
6513
|
+
}
|
|
6514
|
+
Object.assign(globalStorage.theme.screens, screens);
|
|
6512
6515
|
}
|
|
6513
6516
|
|
|
6514
6517
|
// Update local reference
|
|
6515
6518
|
globalConfig = globalStorage;
|
|
6516
6519
|
initializeCss();
|
|
6517
6520
|
return {
|
|
6518
|
-
...
|
|
6521
|
+
...globalStorage
|
|
6519
6522
|
};
|
|
6520
6523
|
}
|
|
6521
6524
|
|
|
@@ -6524,8 +6527,7 @@ function setConfig(config) {
|
|
|
6524
6527
|
* @returns {Object} Current global configuration
|
|
6525
6528
|
*/
|
|
6526
6529
|
function getConfig() {
|
|
6527
|
-
|
|
6528
|
-
globalConfig = getGlobalStorage();
|
|
6530
|
+
globalConfig = configManager.get();
|
|
6529
6531
|
return {
|
|
6530
6532
|
...globalConfig
|
|
6531
6533
|
};
|
|
@@ -6539,26 +6541,7 @@ function resetConfig() {
|
|
|
6539
6541
|
twString = null;
|
|
6540
6542
|
cssObject = null;
|
|
6541
6543
|
configOptionsCache.clear();
|
|
6542
|
-
|
|
6543
|
-
// Get global storage reference and reset it
|
|
6544
|
-
const globalStorage = getGlobalStorage();
|
|
6545
|
-
|
|
6546
|
-
// Reset to default config
|
|
6547
|
-
Object.assign(globalStorage, {
|
|
6548
|
-
theme: {
|
|
6549
|
-
extend: {
|
|
6550
|
-
colors: {}
|
|
6551
|
-
},
|
|
6552
|
-
screens: {
|
|
6553
|
-
sm: "640px",
|
|
6554
|
-
md: "768px",
|
|
6555
|
-
lg: "1024px",
|
|
6556
|
-
xl: "1280px",
|
|
6557
|
-
"2xl": "1536px"
|
|
6558
|
-
}
|
|
6559
|
-
},
|
|
6560
|
-
inject: true
|
|
6561
|
-
});
|
|
6544
|
+
const globalStorage = configManager.reset();
|
|
6562
6545
|
|
|
6563
6546
|
// Update local reference
|
|
6564
6547
|
globalConfig = globalStorage;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tailwind-to-style v2.7.
|
|
2
|
+
* tailwind-to-style v2.7.5
|
|
3
3
|
* Convert tailwind classes to inline style
|
|
4
4
|
*
|
|
5
5
|
* @author Bigetion
|
|
@@ -6394,34 +6394,64 @@ const defaultConfig = {
|
|
|
6394
6394
|
},
|
|
6395
6395
|
inject: true
|
|
6396
6396
|
};
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6397
|
+
class ConfigManager {
|
|
6398
|
+
constructor() {
|
|
6399
|
+
this.storage = null;
|
|
6400
|
+
this.initialized = false;
|
|
6401
|
+
}
|
|
6402
|
+
initialize() {
|
|
6403
|
+
if (this.initialized) return this.storage;
|
|
6404
|
+
if (typeof window !== "undefined") {
|
|
6405
|
+
if (!window[CONFIG_STORAGE_KEY]) {
|
|
6406
|
+
window[CONFIG_STORAGE_KEY] = JSON.parse(JSON.stringify(defaultConfig));
|
|
6407
|
+
}
|
|
6408
|
+
this.storage = window[CONFIG_STORAGE_KEY];
|
|
6409
|
+
} else if (typeof global !== "undefined") {
|
|
6410
|
+
// Node.js environment
|
|
6411
|
+
if (!global[CONFIG_STORAGE_KEY]) {
|
|
6412
|
+
global[CONFIG_STORAGE_KEY] = JSON.parse(JSON.stringify(defaultConfig));
|
|
6413
|
+
}
|
|
6414
|
+
this.storage = global[CONFIG_STORAGE_KEY];
|
|
6415
|
+
} else {
|
|
6416
|
+
// Fallback
|
|
6417
|
+
console.warn("tailwind-to-style: Unable to create global config storage. Config will only work within the same module.");
|
|
6418
|
+
this.storage = JSON.parse(JSON.stringify(defaultConfig));
|
|
6406
6419
|
}
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6420
|
+
this.initialized = true;
|
|
6421
|
+
return this.storage;
|
|
6422
|
+
}
|
|
6423
|
+
get() {
|
|
6424
|
+
return this.initialize();
|
|
6425
|
+
}
|
|
6426
|
+
set(config) {
|
|
6427
|
+
const storage = this.initialize();
|
|
6428
|
+
this.deepMerge(storage, config);
|
|
6429
|
+
return storage;
|
|
6430
|
+
}
|
|
6431
|
+
reset() {
|
|
6432
|
+
const storage = this.initialize();
|
|
6433
|
+
Object.keys(storage).forEach(key => delete storage[key]);
|
|
6434
|
+
Object.assign(storage, JSON.parse(JSON.stringify(defaultConfig)));
|
|
6435
|
+
return storage;
|
|
6436
|
+
}
|
|
6437
|
+
deepMerge(target, source) {
|
|
6438
|
+
for (const key in source) {
|
|
6439
|
+
if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
|
|
6440
|
+
if (!target[key] || typeof target[key] !== "object") {
|
|
6441
|
+
target[key] = {};
|
|
6442
|
+
}
|
|
6443
|
+
this.deepMerge(target[key], source[key]);
|
|
6444
|
+
} else {
|
|
6445
|
+
target[key] = source[key];
|
|
6446
|
+
}
|
|
6414
6447
|
}
|
|
6415
|
-
return global[CONFIG_STORAGE_KEY];
|
|
6416
|
-
} else {
|
|
6417
|
-
// Fallback - use module-level variable (will work only within same file)
|
|
6418
|
-
console.warn("tailwind-to-style: Unable to create global config storage. Config will only work within the same module.");
|
|
6419
|
-
return defaultConfig;
|
|
6420
6448
|
}
|
|
6421
6449
|
}
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6450
|
+
const configManager = new ConfigManager();
|
|
6451
|
+
function getGlobalStorage() {
|
|
6452
|
+
return configManager.get();
|
|
6453
|
+
}
|
|
6454
|
+
let globalConfig = null;
|
|
6425
6455
|
function initializeCss() {
|
|
6426
6456
|
if (!twString) {
|
|
6427
6457
|
// Always get fresh config from global storage
|
|
@@ -6453,40 +6483,13 @@ function convertScreensToBreakpoints(screens) {
|
|
|
6453
6483
|
* @returns {Object} Current global configuration
|
|
6454
6484
|
*/
|
|
6455
6485
|
function setConfig(config) {
|
|
6456
|
-
var _config$theme, _config$theme2, _config$theme2$extend, _config$theme3;
|
|
6457
6486
|
// Reset CSS object cache when config changes
|
|
6458
6487
|
twString = null;
|
|
6459
6488
|
cssObject = null;
|
|
6460
6489
|
configOptionsCache.clear();
|
|
6461
6490
|
|
|
6462
|
-
//
|
|
6463
|
-
const globalStorage =
|
|
6464
|
-
|
|
6465
|
-
// Update global storage directly
|
|
6466
|
-
Object.assign(globalStorage, {
|
|
6467
|
-
...globalStorage,
|
|
6468
|
-
...config,
|
|
6469
|
-
theme: {
|
|
6470
|
-
...globalStorage.theme,
|
|
6471
|
-
...(config.theme || {}),
|
|
6472
|
-
extend: {
|
|
6473
|
-
...globalStorage.theme.extend,
|
|
6474
|
-
...(((_config$theme = config.theme) === null || _config$theme === void 0 ? void 0 : _config$theme.extend) || {}),
|
|
6475
|
-
colors: {
|
|
6476
|
-
...globalStorage.theme.extend.colors,
|
|
6477
|
-
...(((_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) || {})
|
|
6478
|
-
}
|
|
6479
|
-
}
|
|
6480
|
-
}
|
|
6481
|
-
});
|
|
6482
|
-
|
|
6483
|
-
// Handle screens configuration
|
|
6484
|
-
if ((_config$theme3 = config.theme) !== null && _config$theme3 !== void 0 && _config$theme3.screens) {
|
|
6485
|
-
globalStorage.theme.screens = {
|
|
6486
|
-
...globalStorage.theme.screens,
|
|
6487
|
-
...config.theme.screens
|
|
6488
|
-
};
|
|
6489
|
-
}
|
|
6491
|
+
// Use ConfigManager to set config
|
|
6492
|
+
const globalStorage = configManager.set(config);
|
|
6490
6493
|
|
|
6491
6494
|
// Handle legacy breakpoints with deprecation warning
|
|
6492
6495
|
if (config.breakpoints) {
|
|
@@ -6501,17 +6504,17 @@ function setConfig(config) {
|
|
|
6501
6504
|
screens[key] = match[1].trim();
|
|
6502
6505
|
}
|
|
6503
6506
|
}
|
|
6504
|
-
globalStorage.theme.screens
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6507
|
+
if (!globalStorage.theme.screens) {
|
|
6508
|
+
globalStorage.theme.screens = {};
|
|
6509
|
+
}
|
|
6510
|
+
Object.assign(globalStorage.theme.screens, screens);
|
|
6508
6511
|
}
|
|
6509
6512
|
|
|
6510
6513
|
// Update local reference
|
|
6511
6514
|
globalConfig = globalStorage;
|
|
6512
6515
|
initializeCss();
|
|
6513
6516
|
return {
|
|
6514
|
-
...
|
|
6517
|
+
...globalStorage
|
|
6515
6518
|
};
|
|
6516
6519
|
}
|
|
6517
6520
|
|
|
@@ -6520,8 +6523,7 @@ function setConfig(config) {
|
|
|
6520
6523
|
* @returns {Object} Current global configuration
|
|
6521
6524
|
*/
|
|
6522
6525
|
function getConfig() {
|
|
6523
|
-
|
|
6524
|
-
globalConfig = getGlobalStorage();
|
|
6526
|
+
globalConfig = configManager.get();
|
|
6525
6527
|
return {
|
|
6526
6528
|
...globalConfig
|
|
6527
6529
|
};
|
|
@@ -6535,26 +6537,7 @@ function resetConfig() {
|
|
|
6535
6537
|
twString = null;
|
|
6536
6538
|
cssObject = null;
|
|
6537
6539
|
configOptionsCache.clear();
|
|
6538
|
-
|
|
6539
|
-
// Get global storage reference and reset it
|
|
6540
|
-
const globalStorage = getGlobalStorage();
|
|
6541
|
-
|
|
6542
|
-
// Reset to default config
|
|
6543
|
-
Object.assign(globalStorage, {
|
|
6544
|
-
theme: {
|
|
6545
|
-
extend: {
|
|
6546
|
-
colors: {}
|
|
6547
|
-
},
|
|
6548
|
-
screens: {
|
|
6549
|
-
sm: "640px",
|
|
6550
|
-
md: "768px",
|
|
6551
|
-
lg: "1024px",
|
|
6552
|
-
xl: "1280px",
|
|
6553
|
-
"2xl": "1536px"
|
|
6554
|
-
}
|
|
6555
|
-
},
|
|
6556
|
-
inject: true
|
|
6557
|
-
});
|
|
6540
|
+
const globalStorage = configManager.reset();
|
|
6558
6541
|
|
|
6559
6542
|
// Update local reference
|
|
6560
6543
|
globalConfig = globalStorage;
|