Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/didi/mpx
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyuki committed Aug 26, 2024
2 parents ed1aa38 + 0f9ac46 commit 69d0aa5
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions packages/webpack-plugin/lib/platform/style/wx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,26 @@ module.exports = function getSpec ({ warn, error }) {
borderStyle: ValueType.default,
borderColor: ValueType.color
},
'border-left': { // 仅支持 width | style | color 这种排序
borderLeftWidth: ValueType.number,
borderLeftStyle: ValueType.default,
borderLeftColor: ValueType.color
},
'border-right': { // 仅支持 width | style | color 这种排序
borderRightWidth: ValueType.number,
borderRightStyle: ValueType.default,
borderRightColor: ValueType.color
},
'border-top': { // 仅支持 width | style | color 这种排序
borderTopWidth: ValueType.number,
borderTopStyle: ValueType.default,
borderTopColor: ValueType.color
},
'border-bottom': { // 仅支持 width | style | color 这种排序
borderBottomWidth: ValueType.number,
borderBottomStyle: ValueType.default,
borderBottomColor: ValueType.color
},
'box-shadow': { // 仅支持 offset-x | offset-y | blur-radius | color 排序
'shadowOffset.width': ValueType.number,
'shadowOffset.height': ValueType.number,
Expand Down Expand Up @@ -339,7 +359,7 @@ module.exports = function getSpec ({ warn, error }) {
supportedModes: ['ios', 'android'],
rules: [
{ // 背景相关属性的处理
test: /.*background*./,
test: /^(background|background-image|background-color|background-size|background-repeat|background-position)$/,
ios: checkBackgroundImage,
android: checkBackgroundImage
},
Expand Down Expand Up @@ -372,7 +392,7 @@ module.exports = function getSpec ({ warn, error }) {
android: getAbbreviationAndroid
},
{
test: /.*font-variant.*/,
test: /^(font-variant|font-variant-caps|font-variant-numeric|font-variant-east-asian|font-variant-alternates|font-variant-ligatures)$/,
ios: getFontVariant,
android: getFontVariant
},
Expand All @@ -382,7 +402,7 @@ module.exports = function getSpec ({ warn, error }) {
android: getBorderRadius
},
{ // margin padding 内外边距的处理
test: /.*(margin|padding).*/,
test: /^(margin|padding)$/,
ios: formatMargins,
android: formatMargins
},
Expand All @@ -398,13 +418,13 @@ module.exports = function getSpec ({ warn, error }) {
android: formatLineHeight
},
// 值类型校验放到最后
{ // color 颜色值校验
test: /.*color.*/i,
{ // color 颜色值校验 color xx-color 等
test: /^(color|(.+-color))$/,
ios: checkCommonValue(ValueType.color),
android: checkCommonValue(ValueType.color)
},
{ // number 值校验
test: /.*width|height|left|right|top|bottom|radius|margin|padding|spacing|offset|size.*/i,
{ // number 值校验 // width height xx-left xx-top 等
test: /^((width|height)|(.+-(left|right|top|bottom|radius|spacing|size)))$/,
ios: checkCommonValue(ValueType.number),
android: checkCommonValue(ValueType.number)
}
Expand Down

0 comments on commit 69d0aa5

Please sign in to comment.