Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 638f500

Browse files
committed
revert: Remoevd isNumeric
1 parent e6e3d0f commit 638f500

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/_internal/utils/css-codegen-sheet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { pseudo, camelToKebabCase, isClassesObjectType, isNumeric } from '..';
1+
import { pseudo, camelToKebabCase, isClassesObjectType } from '..';
22
import type { PropertyType, SerializeType, ClassesObjectType, CustomCSSProperties, CustomHTMLType } from '../types';
33

44
export function cssCodeGenSheet(object: ClassesObjectType | CustomHTMLType, base62Hash?: string, core?: string) {
@@ -46,7 +46,7 @@ export function cssCodeGenSheet(object: ClassesObjectType | CustomHTMLType, base
4646
: typeof value === 'number'
4747
? value + 'px'
4848
: value;
49-
if (!isNumeric(property) && property.length >= 2) cssRule += `${bigIndent ? ' ' : ' '}${CSSProp}: ${applyValue};\n`;
49+
cssRule += `${bigIndent ? ' ' : ' '}${CSSProp}: ${applyValue};\n`;
5050
} else if (isPseudoOrMediaClass) {
5151
if (isClassInc) colon = ':';
5252
if (isElementInc) colon = '::';

src/_internal/utils/helper.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ function isHasCCCType(property: string): property is HasCCC {
4343
return isHasCCCTypeKey(property);
4444
}
4545

46-
// Block the bug selector if the property is only numbers.
47-
export const isNumeric = (value: string): boolean => {
48-
return /^\d+$/.test(value);
49-
};
50-
5146
const dir = (direname: string, relativePath: string) => {
5247
return path.join(direname, relativePath);
5348
};
@@ -98,7 +93,9 @@ export const camelToKebabCase = (property: string) => {
9893
const matches = property.match(regex);
9994
if (matches) {
10095
const [, class1, class2] = matches;
101-
return `:has(.${class1.replace(/_/g, '-').toLowerCase()} > ${pascalCaseHtmlTags.includes(class2) ? class2.toLowerCase() : '.' + class2.replace(/_/g, '-').toLowerCase()})`;
96+
return `:has(.${class1.replace(/_/g, '-').toLowerCase()} > ${
97+
pascalCaseHtmlTags.includes(class2) ? class2.toLowerCase() : '.' + class2.replace(/_/g, '-').toLowerCase()
98+
})`;
10299
}
103100
}
104101

@@ -107,7 +104,9 @@ export const camelToKebabCase = (property: string) => {
107104
const matches = property.match(regex);
108105
if (matches) {
109106
const [, class1, class2] = matches;
110-
return `:has(.${class1.replace(/_/g, '-').toLowerCase()} + ${pascalCaseHtmlTags.includes(class2) ? class2.toLowerCase() : '.' + class2.replace(/_/g, '-').toLowerCase()})`;
107+
return `:has(.${class1.replace(/_/g, '-').toLowerCase()} + ${
108+
pascalCaseHtmlTags.includes(class2) ? class2.toLowerCase() : '.' + class2.replace(/_/g, '-').toLowerCase()
109+
})`;
111110
}
112111
}
113112

0 commit comments

Comments
 (0)