@dcloudio/uni-nvue-styler
Advanced tools
Comparing version 3.0.0-alpha-4020620240828001 to 3.0.0-alpha-4020720240904001
@@ -135,42 +135,12 @@ 'use strict'; | ||
const backgroundImage = 'background-image' ; | ||
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]; | ||
} | ||
}; | ||
} | ||
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]; | ||
}; | ||
@@ -192,14 +162,5 @@ const borderWidth = '-width' ; | ||
}); | ||
const isUvuePlatform = options.type === 'uvue'; | ||
if (isUvuePlatform) { | ||
if (splitResult.length > 0 && value !== '') { | ||
return [decl]; | ||
} | ||
if (splitResult.length) { | ||
return [decl]; | ||
} | ||
else { | ||
// nvue 维持不变 | ||
if (splitResult.length > 0) { | ||
return [decl]; | ||
} | ||
} | ||
return [ | ||
@@ -425,3 +386,3 @@ createDecl(prop + borderWidth, (result[0] || (options.type === 'uvue' ? 'medium' : '0')).trim(), important, raws, source), | ||
border: transformBorder, | ||
background: createTransformBackground(options), | ||
background: transformBackground, | ||
borderTop: transformBorder, | ||
@@ -459,3 +420,3 @@ borderRight: transformBorder, | ||
const plugin = { | ||
postcssPlugin: `${options.type || 'nvue'}:expand`, | ||
postcssPlugin: 'nvue:expand', | ||
Declaration(decl) { | ||
@@ -462,0 +423,0 @@ if (decl[expanded]) { |
@@ -19,42 +19,12 @@ import { hyphenate, capitalize } from '@vue/shared'; | ||
const backgroundImage = 'backgroundImage'; | ||
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]; | ||
} | ||
}; | ||
} | ||
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]; | ||
}; | ||
@@ -76,14 +46,5 @@ const borderWidth = 'Width'; | ||
}); | ||
const isUvuePlatform = options.type === 'uvue'; | ||
if (isUvuePlatform) { | ||
if (splitResult.length > 0 && value !== '') { | ||
return [decl]; | ||
} | ||
if (splitResult.length) { | ||
return [decl]; | ||
} | ||
else { | ||
// nvue 维持不变 | ||
if (splitResult.length > 0) { | ||
return [decl]; | ||
} | ||
} | ||
return [ | ||
@@ -247,3 +208,3 @@ createDecl(prop + borderWidth, (result[0] || (options.type === 'uvue' ? 'medium' : '0')).trim(), important, raws, source), | ||
border: transformBorder, | ||
background: createTransformBackground(options), | ||
background: transformBackground, | ||
borderTop: transformBorder, | ||
@@ -278,3 +239,3 @@ borderRight: transformBorder, | ||
const plugin = { | ||
postcssPlugin: `${options.type || 'nvue'}:expand`, | ||
postcssPlugin: 'nvue:expand', | ||
Declaration(decl) { | ||
@@ -281,0 +242,0 @@ if (decl[expanded]) { |
{ | ||
"name": "@dcloudio/uni-nvue-styler", | ||
"version": "3.0.0-alpha-4020620240828001", | ||
"version": "3.0.0-alpha-4020720240904001", | ||
"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": [ | ||
@@ -9,0 +8,0 @@ "dist", |
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
248340
9531