tailwind-to-style 1.0.1 → 1.0.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/index.js +54 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2015,7 +2015,11 @@ function generator$1$(configOptions = {}) {
|
|
|
2015
2015
|
const key = keyTmp.toLowerCase() !== "default" ? `-${keyTmp}` : "";
|
|
2016
2016
|
return `
|
|
2017
2017
|
${prefix}${key} {
|
|
2018
|
-
border-
|
|
2018
|
+
border-style: solid;
|
|
2019
|
+
border-top-width: ${value};
|
|
2020
|
+
border-bottom-width: ${value};
|
|
2021
|
+
border-left-width: ${value};
|
|
2022
|
+
border-right-width: ${value};
|
|
2019
2023
|
}
|
|
2020
2024
|
${prefix}-x${key} {
|
|
2021
2025
|
border-left-width: ${value};
|
|
@@ -5679,7 +5683,15 @@ function replaceAndRemoveCSSVariables(styleString) {
|
|
|
5679
5683
|
return updatedStyleString;
|
|
5680
5684
|
}
|
|
5681
5685
|
|
|
5682
|
-
|
|
5686
|
+
const breakpoints = {
|
|
5687
|
+
sm: "@media (min-width: 640px)",
|
|
5688
|
+
md: "@media (min-width: 768px)",
|
|
5689
|
+
lg: "@media (min-width: 1024px)",
|
|
5690
|
+
xl: "@media (min-width: 1280px)",
|
|
5691
|
+
"2xl": "@media (min-width: 1536px)",
|
|
5692
|
+
};
|
|
5693
|
+
|
|
5694
|
+
function tws(classNames, convertToJson) {
|
|
5683
5695
|
const cssString = generateTailwindCssString().replace(/\s\s+/g, " ");
|
|
5684
5696
|
|
|
5685
5697
|
const cssClasses = generateCssClasses(cssString);
|
|
@@ -5701,4 +5713,43 @@ function twss(classNames, convertToJson) {
|
|
|
5701
5713
|
return cssResult;
|
|
5702
5714
|
}
|
|
5703
5715
|
|
|
5704
|
-
|
|
5716
|
+
function twsx(selectorsConfig) {
|
|
5717
|
+
return Object.entries(selectorsConfig)
|
|
5718
|
+
.map(([selector, [baseStyles, extensions = {}]]) => {
|
|
5719
|
+
let baseCSS = `${selector} { ${tws(baseStyles)} }`;
|
|
5720
|
+
let extendedCSS = "";
|
|
5721
|
+
|
|
5722
|
+
for (const [key, value] of Object.entries(extensions)) {
|
|
5723
|
+
if (breakpoints[key]) {
|
|
5724
|
+
const mediaQuery = breakpoints[key];
|
|
5725
|
+
extendedCSS += `
|
|
5726
|
+
${mediaQuery} {
|
|
5727
|
+
${selector} {
|
|
5728
|
+
${tws(value)}
|
|
5729
|
+
}
|
|
5730
|
+
}
|
|
5731
|
+
`;
|
|
5732
|
+
} else if (key.startsWith("@media")) {
|
|
5733
|
+
extendedCSS += `
|
|
5734
|
+
${key} {
|
|
5735
|
+
${selector} {
|
|
5736
|
+
${tws(value)}
|
|
5737
|
+
}
|
|
5738
|
+
}
|
|
5739
|
+
`;
|
|
5740
|
+
} else {
|
|
5741
|
+
extendedCSS += `
|
|
5742
|
+
${selector}${key} {
|
|
5743
|
+
${tws(value)}
|
|
5744
|
+
}
|
|
5745
|
+
`;
|
|
5746
|
+
}
|
|
5747
|
+
}
|
|
5748
|
+
|
|
5749
|
+
return `${baseCSS} ${extendedCSS}`;
|
|
5750
|
+
})
|
|
5751
|
+
.join(" ");
|
|
5752
|
+
}
|
|
5753
|
+
|
|
5754
|
+
exports.tws = tws;
|
|
5755
|
+
exports.twsx = twsx;
|