Skip to content

Conversation

@wenwenhua
Copy link
Collaborator

@wenwenhua wenwenhua commented Jan 5, 2026

1.z-index auto 报错编译提示
2.样式编译优化:es6语法+__formatValue简化
3.去掉 translate & border-radius 的百分比计算 & 保留 translateY calc(100% - 20px)的百分比计算
4.去掉非媒体查询场景下的_default&_media字段
5.image 组件Android下保持计算border radius 百分比

回撤改动:
支持transform 分开定义 css var 且包含未定义值的var变量,如 --un-translate-x: -50%;transform translateX(var(--un-translate-x)) translateY(var(--un-translate-y));

@wenwenhua wenwenhua changed the title Feat style compile 251012 ms 样式相关优化 Jan 5, 2026
return { prop, value: values[0].trim() }
}

const formatZIndex = ({ prop, value, selector }, { mode }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥不走verifyValues来校验实现?

function calcVisitor ({ key, value, keyPath }: VisitorArg) {
if (calcUseRegExp.test(value)) {
// calc translate & border-radius 的百分比计算
if (hasOwn(selfPercentRule, key) && /%/.test(value)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

走正则校验严谨一点,声明个内含百分比的正则表达式

// transform z-index auto to 0
transformZIndex(normalStyle)
if (Array.isArray(normalStyle.transform)) {
normalStyle.transform = normalStyle.transform.filter(item => !isEmptyObject(item))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥要改这个

}, '')
}

function transformZIndex (styleObj: Record<string, any>) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没必要加这个吧,如果这玩意需要运行时校验那要加的可太多了。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants