Skip to content

Feat rn atomic css#1788

Open
CommanderXL wants to merge 190 commits into
masterfrom
feat-rn-atomic-css
Open

Feat rn atomic css#1788
CommanderXL wants to merge 190 commits into
masterfrom
feat-rn-atomic-css

Conversation

@CommanderXL

Copy link
Copy Markdown
Member

No description provided.

@@ -0,0 +1,345 @@
# 跨端输出基础

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这个文档的变更是为啥?


return {
mergeToLayer,
layerMap,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

是不是没有导出的必要

if (Object.keys(classMapValue).length) {
const layerObj = layer ? { _layer: layer } : {}
if (key.endsWith('!')) {
layerObj._layer = '"important"'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

普通的!important也可以支持一下

// set css layer
if (layer) {
if (key.endsWith('!')) layer = '"important"'
classMap[key]._layer = layer

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这个important的实现有点割裂

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

统一成_important或者_layers额外属性进行处理吧,并且可以覆盖到内联style

mergeToLayer(l, v._inlineLayer[l])
})
}
isNativeStyle ? layer.push(v) : Object.assign(layer, v)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

最终得到的样式对象中会包含_inlineLayer属性么?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

有的话进行移除

const transformed = {}
Object.keys(styleObj).forEach((prop) => {
transformed[prop] = formatValue(styleObj[prop])
const v = formatValue(styleObj[prop])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这会有问题吧

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

应该先切important再format

//
// 真正承载样式的 entry(如 `border-color: rgba(...) !important`)的 `!important`
// 后缀我们保持原样:mpx PostCSS pipeline 会基于 `decl.important` 读取并搬到
// `_inlineLayer.important` 里,再由 `transformStyleObj` 通过 `endsWith('!important')`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这是两条链路吧,注释生成的有问题?

}
}

const mergeToLayer = (name, ...classObjs) => {

@hiyuki hiyuki Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

改成固定单参数吧,我记得动态解析参数的耗时不低


const createLayer = (isNativeStyle) => {
const layerMap = {
preflight: isNativeStyle ? [] : {},

Copy link
Copy Markdown
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