@dcloudio/uni-nvue-styler
Advanced tools
Comparing version 3.0.0-4020920240930001 to 3.0.0-4030620241128001
@@ -135,12 +135,42 @@ 'use strict'; | ||
const backgroundImage = 'background-image' ; | ||
const transformBackground = (decl) => { | ||
const { value, important, raws, source } = decl; | ||
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) { | ||
return [createDecl(backgroundColor, value, important, raws, source)]; | ||
} | ||
else if (/^linear-gradient(.+)$/.test(value)) { | ||
return [createDecl(backgroundImage, value, important, raws, source)]; | ||
} | ||
return [decl]; | ||
}; | ||
function createTransformBackground(options) { | ||
return (decl) => { | ||
const { value, important, raws, source } = decl; | ||
// nvue 平台维持原有逻辑不变 | ||
const isUvuePlatform = options.type === 'uvue'; | ||
if (isUvuePlatform) { | ||
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) { | ||
return [ | ||
createDecl(backgroundImage, 'none', important, raws, source), | ||
createDecl(backgroundColor, value, important, raws, source), | ||
]; | ||
} | ||
else if (/^linear-gradient(.+)$/.test(value)) { | ||
return [ | ||
createDecl(backgroundImage, value, important, raws, source), | ||
createDecl(backgroundColor, 'transparent', important, raws, source), | ||
]; | ||
} | ||
else if (value == '') { | ||
return [ | ||
createDecl(backgroundImage, 'none', important, raws, source), | ||
createDecl(backgroundColor, 'transparent', important, raws, source), | ||
]; | ||
} | ||
return [decl]; | ||
} | ||
else { | ||
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) { | ||
return [createDecl(backgroundColor, value, important, raws, source)]; | ||
} | ||
else if (/^linear-gradient(.+)$/.test(value)) { | ||
return [createDecl(backgroundImage, value, important, raws, source)]; | ||
} | ||
else if (value == '') { | ||
return [decl]; | ||
} | ||
return [decl]; | ||
} | ||
}; | ||
} | ||
@@ -162,5 +192,14 @@ const borderWidth = '-width' ; | ||
}); | ||
if (splitResult.length) { | ||
return [decl]; | ||
const isUvuePlatform = options.type === 'uvue'; | ||
if (isUvuePlatform) { | ||
if (splitResult.length > 0 && value !== '') { | ||
return [decl]; | ||
} | ||
} | ||
else { | ||
// nvue 维持不变 | ||
if (splitResult.length > 0) { | ||
return [decl]; | ||
} | ||
} | ||
return [ | ||
@@ -386,3 +425,3 @@ createDecl(prop + borderWidth, (result[0] || (options.type === 'uvue' ? 'medium' : '0')).trim(), important, raws, source), | ||
border: transformBorder, | ||
background: transformBackground, | ||
background: createTransformBackground(options), | ||
borderTop: transformBorder, | ||
@@ -420,3 +459,3 @@ borderRight: transformBorder, | ||
const plugin = { | ||
postcssPlugin: 'nvue:expand', | ||
postcssPlugin: `${options.type || 'nvue'}:expand`, | ||
Declaration(decl) { | ||
@@ -423,0 +462,0 @@ if (decl[expanded]) { |
@@ -19,12 +19,42 @@ import { hyphenate, capitalize } from '@vue/shared'; | ||
const backgroundImage = 'backgroundImage'; | ||
const transformBackground = (decl) => { | ||
const { value, important, raws, source } = decl; | ||
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) { | ||
return [createDecl(backgroundColor, value, important, raws, source)]; | ||
} | ||
else if (/^linear-gradient(.+)$/.test(value)) { | ||
return [createDecl(backgroundImage, value, important, raws, source)]; | ||
} | ||
return [decl]; | ||
}; | ||
function createTransformBackground(options) { | ||
return (decl) => { | ||
const { value, important, raws, source } = decl; | ||
// nvue 平台维持原有逻辑不变 | ||
const isUvuePlatform = options.type === 'uvue'; | ||
if (isUvuePlatform) { | ||
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) { | ||
return [ | ||
createDecl(backgroundImage, 'none', important, raws, source), | ||
createDecl(backgroundColor, value, important, raws, source), | ||
]; | ||
} | ||
else if (/^linear-gradient(.+)$/.test(value)) { | ||
return [ | ||
createDecl(backgroundImage, value, important, raws, source), | ||
createDecl(backgroundColor, 'transparent', important, raws, source), | ||
]; | ||
} | ||
else if (value == '') { | ||
return [ | ||
createDecl(backgroundImage, 'none', important, raws, source), | ||
createDecl(backgroundColor, 'transparent', important, raws, source), | ||
]; | ||
} | ||
return [decl]; | ||
} | ||
else { | ||
if (/^#?\S+$/.test(value) || /^rgba?(.+)$/.test(value)) { | ||
return [createDecl(backgroundColor, value, important, raws, source)]; | ||
} | ||
else if (/^linear-gradient(.+)$/.test(value)) { | ||
return [createDecl(backgroundImage, value, important, raws, source)]; | ||
} | ||
else if (value == '') { | ||
return [decl]; | ||
} | ||
return [decl]; | ||
} | ||
}; | ||
} | ||
@@ -46,5 +76,14 @@ const borderWidth = 'Width'; | ||
}); | ||
if (splitResult.length) { | ||
return [decl]; | ||
const isUvuePlatform = options.type === 'uvue'; | ||
if (isUvuePlatform) { | ||
if (splitResult.length > 0 && value !== '') { | ||
return [decl]; | ||
} | ||
} | ||
else { | ||
// nvue 维持不变 | ||
if (splitResult.length > 0) { | ||
return [decl]; | ||
} | ||
} | ||
return [ | ||
@@ -208,3 +247,3 @@ createDecl(prop + borderWidth, (result[0] || (options.type === 'uvue' ? 'medium' : '0')).trim(), important, raws, source), | ||
border: transformBorder, | ||
background: transformBackground, | ||
background: createTransformBackground(options), | ||
borderTop: transformBorder, | ||
@@ -239,3 +278,3 @@ borderRight: transformBorder, | ||
const plugin = { | ||
postcssPlugin: 'nvue:expand', | ||
postcssPlugin: `${options.type || 'nvue'}:expand`, | ||
Declaration(decl) { | ||
@@ -242,0 +281,0 @@ if (decl[expanded]) { |
@@ -1,1 +0,1 @@ | ||
[https://uniapp.dcloud.net.cn/license.html ](https://uniapp.dcloud.net.cn/license.html ) | ||
[https://dcloud.io/license/uni-app.html](https://dcloud.io/license/uni-app.html) |
{ | ||
"name": "@dcloudio/uni-nvue-styler", | ||
"version": "3.0.0-4020920240930001", | ||
"version": "3.0.0-4030620241128001", | ||
"description": "uni-nvue-styler", | ||
"main": "./dist/uni-nvue-styler.cjs.js", | ||
"types": "./dist/uni-nvue-styler.d.ts", | ||
"module": "./dist/uni-nvue-styler.es.js", | ||
"files": [ | ||
@@ -8,0 +9,0 @@ "dist", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252018
9633