transform-to-unocss-core
Version:
A utility to transform CSS to UnoCSS syntax. Supports various CSS properties and custom parsing.
68 lines (63 loc) • 3.4 kB
text/typescript
//#region src/toUnocss.d.ts
declare function toUnocss(css: string, isRem?: boolean): any;
//#endregion
//#region src/toUnocssClass.d.ts
declare function toUnocssClass(css: string, isRem?: boolean, debug?: boolean): [string, string[]];
//#endregion
//#region src/transformer.d.ts
declare function transformStyleToUnocssPre(styles: string): {
transformedResult: string;
newStyle: string;
};
//#endregion
//#region src/transformStyleToUnocss.d.ts
declare function transformStyleToUnocss(styles: string, isRem?: boolean, debug?: boolean): [string, string[]];
//#endregion
//#region src/utils.d.ts
declare const flag = ".__unocss_transfer__";
declare const cssMathFnRE: RegExp;
declare const numberWithUnitRE: RegExp;
declare function isNot(s: string): boolean;
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 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 getVal(val: string, transform?: (v: string) => string, inClass?: boolean, prefix?: string, dynamicFlag?: boolean): string;
declare function getHundred(n: string | number): number;
declare function joinWithLine(s: string): string;
declare function joinWithUnderLine(s: string): string;
declare const positionMap: string[];
type TrimType = 'all' | 'pre' | 'around' | 'post';
/**
* 删除空格
* @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 diffTemplateStyle(before: string, after: string): boolean;
declare function isEmptyStyle(code: string): boolean;
declare function getStyleScoped(code: string): 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__";
declare function getGradient(s: string): "" | "linear" | "radial" | "conic";
//#endregion
export { TrimType, browserReg, commaReplacer, cssMathFnRE, diffTemplateStyle, flag, getFirstName, getGradient, getHundred, getLastName, getStyleScoped, getVal, isAttr, isCalc, isColor, isConstant, isCubicBezier, isEmptyStyle, isEnv, isHex, isHsl, isNot, isPercent, isRepeatingLinearGradient, isRepeatingRadialGradient, isRgb, isSize, isUrl, isVar, joinEmpty, joinWithLine, joinWithUnderLine, linearGradientReg, linearGradientReg1, numberWithUnitRE, otherGradientReg, positionMap, toUnocss, toUnocssClass, transformImportant, transformStyleToUnocss, transformStyleToUnocssPre, trim };