transform-to-tailwindcss-core
Version:
🎨 A powerful, lightweight core library to transform CSS styles or style objects into Tailwind CSS utility classes. Perfect for migration projects and dynamic style generation.
64 lines (59 loc) • 3.08 kB
text/typescript
//#region src/toTailwindcss.d.ts
declare function toTailwindcss(css: string, isRem?: boolean): any;
//#endregion
//#region src/transformer.d.ts
declare function transformStyleToTailwindPre(styles: string): {
transformedResult: string;
newStyle: string;
};
//#endregion
//#region src/transformStyleToTailwindcss.d.ts
declare function transformStyleToTailwindcss(styles: string, isRem?: boolean, debug?: boolean): [string, string[]];
//#endregion
//#region src/type.d.ts
type TrimType = 'all' | 'pre' | 'around' | 'post';
//#endregion
//#region src/utils.d.ts
declare const cssMathFnRE: RegExp;
declare const numberWithUnitRE: RegExp;
declare const positionMap: string[];
declare function isCalc(s: string): boolean;
declare function getFirstName(s: string): string;
declare function getLastName(s: string): string;
declare function isUrl(s: string): boolean;
declare function isPercent(s: string): boolean;
declare function isHex(hex: string): boolean;
declare function isRgb(s: string): boolean;
declare function isHsl(s: string): boolean;
declare function isGradient(s: string): boolean;
declare function isCubicBezier(s: string): boolean;
declare function isAttr(s: string): boolean;
declare function isRepeatingLinearGradient(s: string): boolean;
declare function isRepeatingRadialGradient(s: string): boolean;
declare function isConstant(s: string): boolean;
declare function isEnv(s: string): boolean;
declare function isFraction(s: string): boolean;
declare function isDynamic(val: string): boolean;
declare function getVal(val: string | number, transform?: (v: string) => string, prefix?: string, isDynamicFlag?: boolean): string;
declare function getHundred(n: string): string | number;
declare function joinWithLine(s: string): string;
declare function joinWithUnderLine(s: string): string;
/**
* 删除空格
* @param { string } s 字符串
* @param { TrimType } type 所有 | 前置 | 前后 | 后置 'all' | 'pre' | 'around' | 'post'
* @returns { string } 删除空格后的字符串
*/
declare function trim(s: string, type?: TrimType): string;
declare function transformImportant(v: string, trimSpace?: boolean): string[];
declare function joinEmpty(str: string): string;
declare function isVar(s: string): boolean;
declare function isSize(s: string): boolean;
declare function isColor(s: string): boolean;
declare const browserReg: RegExp;
declare const linearGradientReg: RegExp;
declare const linearGradientReg1: RegExp;
declare const otherGradientReg: RegExp;
declare const commaReplacer = "__comma__";
//#endregion
export { browserReg, commaReplacer, cssMathFnRE, getFirstName, getHundred, getLastName, getVal, isAttr, isCalc, isColor, isConstant, isCubicBezier, isDynamic, isEnv, isFraction, isGradient, isHex, isHsl, isPercent, isRepeatingLinearGradient, isRepeatingRadialGradient, isRgb, isSize, isUrl, isVar, joinEmpty, joinWithLine, joinWithUnderLine, linearGradientReg, linearGradientReg1, numberWithUnitRE, otherGradientReg, positionMap, toTailwindcss, transformImportant, transformStyleToTailwindPre, transformStyleToTailwindcss, trim };