Skip to content

Conversation

@CommanderXL
Copy link
Member

No description provided.


function formatValue (value) {
function createFormatValue (formatValueFn) {
formatValueFn = formatValueFn || '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是否可以访问,以及当前这个formatValueFn是在哪挂的?

let staticClass = el.attrsMap[className + '-class'] || ''
let staticStyle = getAndRemoveAttr(el, className + '-style').val || ''
staticClass = staticClass.replace(/\s+/g, ' ')
if (unoStaticHoverClass) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里需要判断hover才加

let checkApplyReg
if (this.options.transformCSS) {
const checkApplyList = this.options.transformCSS.applyVariable || ['--at-apply', '--uno-apply', '--uno']
checkApplyReg = new RegExp(`(${checkApplyList.join('|')})(\s)?\:`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

为啥不把这个放到cssRequiresTransform中

let result = isNativeStaticStyle ? [] : {}
const mergeResult = isNativeStaticStyle ? (...args) => result.push(...args) : (...args) => Object.assign(result, ...args)
// 使用一下 __getSizeCount 触发其 get
this.__getSizeCount()
Copy link
Collaborator

Choose a reason for hiding this comment

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

这段逻辑得保留,触发后续屏幕变化刷新样式

mergeResult(localStyle._default)
mergeToLayer('normal', localStyle._default)
}
} else if (unoClassMap[className]) {
Copy link
Collaborator

@hiyuki hiyuki Dec 9, 2025

Choose a reason for hiding this comment

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

unoClassMap整体需要参考local/appclassmap的按需执行设计,并且需要支持rpx,vw等样式刷新

Copy link
Collaborator

@hiyuki hiyuki Dec 9, 2025

Choose a reason for hiding this comment

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

unoClassMap能合到AppClassMap中吗,包括preflightMap

// 使用一下 __getSizeCount 触发其 get
this.__getSizeCount()

const { mergeToLayer, genResult } = createLayer(isNativeStaticStyle)
Copy link
Collaborator

Choose a reason for hiding this comment

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

需要进行一个测速,添加了unocss逻辑之后getStyle的耗时增加了多少,

mergeToLayer(importantClass ? 'important' : 'uno', unoClass)
if (unoClass.transform || unoClass.filter) needAddUnoPreflight = true
} else if (unoVarClassMap[className]) {
mergeToLayer('important', unoVarClassMap[className]._default)
Copy link
Collaborator

Choose a reason for hiding this comment

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

为啥var需要单独拿出来啊

})

compiler.hooks.beforeCompile.tapPromise(PLUGIN_NAME, async (compilation) => {
const ctx = await createContext(configOrPath, defaults)
Copy link
Collaborator

Choose a reason for hiding this comment

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

这块初始化的方式可以和Web拉齐一下

function processUnoPseudo (staticClass, unoCtx) {
const { config } = unoCtx
const separators = config.separators.join('|')
const pseudoClassReg = new RegExp(`(hover)(?:${separators})`) // 目前仅处理了 hover 状态
Copy link
Collaborator

@hiyuki hiyuki Dec 9, 2025

Choose a reason for hiding this comment

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

感觉不需要处理这个,应该让用户在hover-class当中写原子类,不过小程序和web需要支持一下

}, '')
if (ctorType === 'app') {
if (hasUnoCSS) {
output += `
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.

5 participants