Files
defgov/packages/css/utils/prefix-list.ts
2026-05-07 02:15:20 +08:00

43 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export const defaultPrefixList = [
"align-content",
"items",
"align-self",
"animate",
"rounded",
"box-decoration",
"break-inside",
"box-sizing",
"brand",
"break-after",
"break-before",
"cursor",
"display",
"flex-direction",
"flex-wrap",
"font-family",
"font-weight",
"text",
"gap",
"h",
"justify",
"justify-items",
"justify-self",
"mx",
"my",
"px",
"py",
"overflow",
"overscroll",
"position",
"sr",
"theme",
"w",
"z",
];
// map 里面 key 是 prefixvalue 是完整 class。
// prefix 用正则来获取,先检测是否包含前缀,再检测这个前缀是否在开头,再检测前缀后面是否跟着“-”(就怕匹配到首字母)
// 用正则套壳花括号注入前缀。正则要求1在开头在尾部跟着“-”或者“没有其他字符”
// const reg = new RegExp(`^${prefix}(?:-|$)`);
// class如果一次匹配2个prefix那么就采用较长的那个prefix因为这种情况肯定是“较短子字符串”的副作用