Skip to content

Conversation

@wenwenhua
Copy link
Collaborator

@wenwenhua wenwenhua commented Dec 10, 2025

1.z-index auto 报错
2.样式编译优化:es6语法+__formatValue简化
3.去掉 translate & border-radius 的百分比计算 & 保留 translateY calc(100% - 20px)的百分比计算
4.支持transform 分开定义 css var 且包含未定义值的var变量,如 --un-translate-x: -50%;transform translateX(var(--un-translate-x)) translateY(var(--un-translate-y));
5.去掉非媒体查询场景下的_default&_media字段

@wenwenhua wenwenhua changed the title 1.z-index auto 报错;2.样式编译优化:es6语法+__formatValue简化 【开发中】样式相关优化 Dec 10, 2025
@wenwenhua wenwenhua changed the title 【开发中】样式相关优化 样式相关优化 Dec 11, 2025
@wenwenhua wenwenhua changed the title 样式相关优化 【开发中】样式相关优化 Dec 11, 2025
@wenwenhua wenwenhua changed the title 【开发中】样式相关优化 样式相关优化 Dec 24, 2025
needStringify = false
} else {
value = `global.__formatValue(${+matched[1]}, '${matched[2]}')`
value = `${formatValueName || 'global.__formatValue'}(${+matched[1]}, '${matched[2]}')`
Copy link
Collaborator

@hiyuki hiyuki Dec 31, 2025

Choose a reason for hiding this comment

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

|| 'global.__formatValue' 不用加这个兜底了

const classMapCode = Object.entries(classMap).reduce((result, [key, value]) => {
result !== '' && (result += ',')
result += `${isValidIdentifierStr(key) ? `${key}` : `['${key}']`}: () => (${shallowStringify(value)})`
result += `${isValidIdentifierStr(key) ? `${key}` : `['${key}']`}: function(_f){return ${shallowStringify(value)};}`
Copy link
Collaborator

Choose a reason for hiding this comment

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

定义一个常量formatValueName,这个地方也读取这个常量:function(${formatValueName})

global.__GCC = function (className, classMap, classMapValueCache) {
if (!classMapValueCache.has(className)) {
const styleObj = classMap[className]?.()
const _f = global.__formatValue
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里行没有意义

global.__mpxSizeCount = 0
global.__mpxPageSizeCountMap = reactive({})

global.__GCC = function (className, classMap, classMapValueCache) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个global.__GCC也可以考虑改成参数传递的形式,而不是走全局对象访问

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