🔧 build(svg): 升级taro-iconfont-svg依赖

This commit is contained in:
xuan 2022-12-27 15:15:32 +08:00
parent 53d6d49d6d
commit 5560b3b903
4 changed files with 112 additions and 69 deletions

View File

@ -1,5 +1,5 @@
{ {
"symbol_url": "//at.alicdn.com/t/c/font_3786318_8mk04nkdxlg.js", "symbol_url": "//at.alicdn.com/t/c/font_3786318_dbfm4mvm98c.js",
"save_dir": "./src/components/iconfont", "save_dir": "./src/components/iconfont",
"use_typescript": false, "use_typescript": false,
"use_rpx": true, "use_rpx": true,

View File

@ -78,7 +78,7 @@
"prettier": "^2.8.0", "prettier": "^2.8.0",
"react-refresh": "0.14.0", "react-refresh": "0.14.0",
"stylelint": "14.16.0", "stylelint": "14.16.0",
"taro-iconfont-svg": "^1.0.19", "taro-iconfont-svg": "^1.1.1",
"typescript": "^4.9.3", "typescript": "^4.9.3",
"webpack": "^5.75.0" "webpack": "^5.75.0"
} }

View File

@ -24,7 +24,7 @@ function hex2rgb(hex) {
return "rgb(" + rgb.join(",") + ")"; return "rgb(" + rgb.join(",") + ")";
} }
export type IconNames = 'icon-dianhua' | 'icon-rukou' | 'icon-renzhengchenggong' | 'icon-paixu' | 'icon-shaixuan' | 'icon-bodakehujingli' | 'icon-guanfangweixinkefu' | 'icon-tuijianbiaoqian' | 'icon-rukou' | 'icon-renzhengchenggong' | 'icon-wodekefu' | 'icon-yanseduibi' | 'icon-dizhiguanli' | 'icon-weixin' | 'icon-riqi' | 'icon-shuru' | 'icon-a-0tianzhangqi' | 'icon-huodaofukuan' | 'icon-huozhuziti' | 'icon-saomazhifu' | 'icon-xianxiahuikuan' | 'icon-yufukuan' | 'icon-xinzengshoucangjia' | 'icon-qingchusousuo' | 'icon-xuanzechenggong' | 'icon-gongnengtubiao-saomiao' | 'icon-bianjizidingyimadan' | 'icon-zidingyimadanyulan' | 'icon-yuanshimadanyulan' | 'icon-xiala' | 'icon-shangla' | 'icon-qingchuxinxi' | 'icon-sousuo' | 'icon-guanli' | 'icon-bianji' | 'icon-shoucangjia' | 'icon-shezhi' | 'icon-tishi' | 'icon-erweima' | 'icon-dianjishoucang' | 'icon-gouwuche' | 'icon-shoucangchenggong' | 'icon-fenxiangshangpin' | 'icon-kefu' | 'icon-xinzenganniu' | 'icon-jianshaoanniu' | 'icon-daifahuo2' | 'icon-daishouhuo2' | 'icon-tuikuan-shouhou' | 'icon-daipeibu2' | 'icon-daifukuan2'; export type IconNames = 'icon-tips' | 'icon-dianhua' | 'icon-paixu' | 'icon-shaixuan' | 'icon-bodakehujingli' | 'icon-guanfangweixinkefu' | 'icon-tuijianbiaoqian' | 'icon-rukou' | 'icon-renzhengchenggong' | 'icon-wodekefu' | 'icon-yanseduibi' | 'icon-dizhiguanli' | 'icon-weixin' | 'icon-riqi' | 'icon-shuru' | 'icon-a-0tianzhangqi' | 'icon-huodaofukuan' | 'icon-huozhuziti' | 'icon-saomazhifu' | 'icon-xianxiahuikuan' | 'icon-yufukuan' | 'icon-xinzengshoucangjia' | 'icon-qingchusousuo' | 'icon-xuanzechenggong' | 'icon-gongnengtubiao-saomiao' | 'icon-bianjizidingyimadan' | 'icon-zidingyimadanyulan' | 'icon-yuanshimadanyulan' | 'icon-xiala' | 'icon-shangla' | 'icon-qingchuxinxi' | 'icon-sousuo' | 'icon-guanli' | 'icon-bianji' | 'icon-shoucangjia' | 'icon-shezhi' | 'icon-tishi' | 'icon-erweima' | 'icon-dianjishoucang' | 'icon-gouwuche' | 'icon-shoucangchenggong' | 'icon-fenxiangshangpin' | 'icon-kefu' | 'icon-xinzenganniu' | 'icon-jianshaoanniu' | 'icon-daifahuo2' | 'icon-daishouhuo2' | 'icon-tuikuan-shouhou' | 'icon-daipeibu2' | 'icon-daifukuan2';
type PropsType = { type PropsType = {
name: IconNames; name: IconNames;
@ -36,7 +36,7 @@ type PropsType = {
const IconFont:FC<PropsType> = ({ const IconFont:FC<PropsType> = ({
name, name,
size = 18, size = 36,
color, color,
customStyle = {}, customStyle = {},
customClassName = "" customClassName = ""
@ -66,6 +66,8 @@ const IconFont:FC<PropsType> = ({
// 也可以使用 if (name === 'xxx') { return <view> } 来渲染但是测试发现在ios下会有问题报错 Maximum call stack啥的。下面这个写法没问题 // 也可以使用 if (name === 'xxx') { return <view> } 来渲染但是测试发现在ios下会有问题报错 Maximum call stack啥的。下面这个写法没问题
return ( return (
<Block> <Block>
{/* icon-colorCard 本地svg */ }
{/* { name === 'icon-colorCard' && (<View style={{backgroundImage: `url(${quot}data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='${svgSize}px' height='${svgSize}px' viewBox='0 0 72 72'><defs><linearGradient id='a' x1='56.049%' x2='45.965%' y1='85.384%' y2='36.243%'><stop offset='0%' stop-color='${(isStr ? colors : colors?.[0]) || '%233667EF'}' stop-opacity='.572'/><stop offset='100%' stop-color='${(isStr ? colors : colors?.[1]) || '%233591FD'}' stop-opacity='.551'/></linearGradient><linearGradient id='b' x1='100%' x2='16.645%' y1='85.384%' y2='36.243%'><stop offset='0%' stop-color='${(isStr ? colors : colors?.[2]) || '%233667EF'}' stop-opacity='.572'/><stop offset='100%' stop-color='${(isStr ? colors : colors?.[3]) || '%233591FD'}' stop-opacity='.551'/></linearGradient><linearGradient id='c' x1='18.906%' x2='80.404%' y1='44.444%' y2='55.556%'><stop offset='0%' stop-color='${(isStr ? colors : colors?.[4]) || '%233591FD'}'/><stop offset='100%' stop-color='${(isStr ? colors : colors?.[5]) || '%233667EF'}'/></linearGradient></defs><g fill='none' fill-rule='nonzero'><path fill='url(%23a)' d='M24.75 11.25A2.25 2.25 0 0 1 27 13.5v47.25A2.25 2.25 0 0 1 24.75 63h-13.5A2.25 2.25 0 0 1 9 60.75V13.5a2.25 2.25 0 0 1 2.25-2.25h13.5ZM18 50.625a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75Z'/><path fill='url(%23b)' d='m45.593 16.216 9.546 9.546a2.25 2.25 0 0 1 0 3.182l-31.82 31.82a2.25 2.25 0 0 1-3.182 0L16.273 56.9a3.375 3.375 0 1 0-1.174-1.174l-4.508-4.508a2.25 2.25 0 0 1 0-3.182l31.82-31.82a2.25 2.25 0 0 1 3.182 0Z'/><path fill='url(%23c)' d='M60.75 45A2.25 2.25 0 0 1 63 47.25v13.5A2.25 2.25 0 0 1 60.75 63h-49.5A2.25 2.25 0 0 1 9 60.75v-13.5A2.25 2.25 0 0 1 11.25 45h49.5ZM18 50.625a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75Z' opacity='.95'/></g></svg%3E${quot})`, width: `${svgSize}px`, height: `${svgSize}px`, ...customStyle}} className={classnames("icon", customClassName)} />) } */}
{/* icon-alipay */} {/* icon-alipay */}
{/* {name === "icon-alipay" && ( {/* {name === "icon-alipay" && (
<View <View
@ -82,6 +84,9 @@ const IconFont:FC<PropsType> = ({
className={classnames(icon, customClassName)} className={classnames(icon, customClassName)}
/> />
)} */} )} */}
{/* icon-tips */}
{ name === 'icon-tips' && (<View style={{backgroundImage: `url(${quot}data:image/svg+xml, %3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='${svgSize}px' height='${svgSize}px'%3E%3Cpath d='M512 96c229.76 0 416 186.24 416 416s-186.24 416-416 416S96 741.76 96 512 282.24 96 512 96z m0 576a32 32 0 1 0 0 64 32 32 0 0 0 0-64z m0-384a32 32 0 0 0-32 32v256a32 32 0 0 0 64 0v-256a32 32 0 0 0-32-32z' fill='${(isStr ? colors : colors?.[0]) || 'rgb(51,51,51)'}'/%3E%3C/svg%3E${quot})`, width: `${svgSize}px`, height: `${svgSize}px`, ...customStyle}} className={classnames("icon", customClassName)} />) }
{/* icon-dianhua */} {/* icon-dianhua */}
{ name === 'icon-dianhua' && (<View style={{backgroundImage: `url(${quot}data:image/svg+xml, %3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='${svgSize}px' height='${svgSize}px'%3E%3Cpath d='M880.384 820.768c31.552-54.72 14.08-96.736-41.792-138.784-65.664-49.44-129.856-82.688-176-29.44 0 0-48.992 58.112-193.152-77.856-167.584-159.232-97.28-215.68-97.28-215.68 58.336-58.432 21.28-101.984-27.616-168-48.896-65.952-98.272-86.848-169.184-30.08C38.72 270.272 231.36 527.04 328.8 626.88c0 0 148.096 152.672 241.28 203.52l49.888 27.776c71.52 36.576 151.84 53.312 208.384 19.36 0 0 27.264-13.984 52.032-56.8z' fill='${(isStr ? colors : colors?.[0]) || 'rgb(51,127,255)'}'/%3E%3C/svg%3E${quot})`, width: `${svgSize}px`, height: `${svgSize}px`, ...customStyle}} className={classnames("icon", customClassName)} />) } { name === 'icon-dianhua' && (<View style={{backgroundImage: `url(${quot}data:image/svg+xml, %3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='${svgSize}px' height='${svgSize}px'%3E%3Cpath d='M880.384 820.768c31.552-54.72 14.08-96.736-41.792-138.784-65.664-49.44-129.856-82.688-176-29.44 0 0-48.992 58.112-193.152-77.856-167.584-159.232-97.28-215.68-97.28-215.68 58.336-58.432 21.28-101.984-27.616-168-48.896-65.952-98.272-86.848-169.184-30.08C38.72 270.272 231.36 527.04 328.8 626.88c0 0 148.096 152.672 241.28 203.52l49.888 27.776c71.52 36.576 151.84 53.312 208.384 19.36 0 0 27.264-13.984 52.032-56.8z' fill='${(isStr ? colors : colors?.[0]) || 'rgb(51,127,255)'}'/%3E%3C/svg%3E${quot})`, width: `${svgSize}px`, height: `${svgSize}px`, ...customStyle}} className={classnames("icon", customClassName)} />) }

View File

@ -2424,9 +2424,9 @@
"@tarojs/api" "3.5.8" "@tarojs/api" "3.5.8"
"@tarojs/runtime" "3.5.8" "@tarojs/runtime" "3.5.8"
"@tarojs/taro@^3.5.7": "@tarojs/taro@^3.5.10":
version "3.5.10" version "3.5.10"
resolved "https://registry.npmmirror.com/@tarojs/taro/-/taro-3.5.10.tgz#004b161099b89e0ca29311394694784445934a40" resolved "https://registry.npmjs.org/@tarojs/taro/-/taro-3.5.10.tgz#004b161099b89e0ca29311394694784445934a40"
integrity sha512-WU+y8AAdbSZS9Oexz34irKkVxRkGkTpu70mDxYenfrrkgY6tOuQ/EmHavuxmQ7aEoFIjgm6s6pW91jd2AyOh+w== integrity sha512-WU+y8AAdbSZS9Oexz34irKkVxRkGkTpu70mDxYenfrrkgY6tOuQ/EmHavuxmQ7aEoFIjgm6s6pW91jd2AyOh+w==
dependencies: dependencies:
"@tarojs/api" "3.5.10" "@tarojs/api" "3.5.10"
@ -5752,6 +5752,17 @@ css-select@^4.1.3:
domutils "^2.8.0" domutils "^2.8.0"
nth-check "^2.0.1" nth-check "^2.0.1"
css-select@^5.1.0:
version "5.1.0"
resolved "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz#b8ebd6554c3637ccc76688804ad3f6a6fdaea8a6"
integrity sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==
dependencies:
boolbase "^1.0.0"
css-what "^6.1.0"
domhandler "^5.0.2"
domutils "^3.0.1"
nth-check "^2.0.1"
css-tree@1.0.0-alpha.29: css-tree@1.0.0-alpha.29:
version "1.0.0-alpha.29" version "1.0.0-alpha.29"
resolved "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.29.tgz" resolved "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.29.tgz"
@ -5768,6 +5779,14 @@ css-tree@^1.1.2, css-tree@^1.1.3:
mdn-data "2.0.14" mdn-data "2.0.14"
source-map "^0.6.1" source-map "^0.6.1"
css-tree@^2.2.1:
version "2.3.1"
resolved "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz#10264ce1e5442e8572fc82fbe490644ff54b5c20"
integrity sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==
dependencies:
mdn-data "2.0.30"
source-map-js "^1.0.1"
css-tree@~2.2.0: css-tree@~2.2.0:
version "2.2.1" version "2.2.1"
resolved "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz" resolved "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz"
@ -5776,7 +5795,7 @@ css-tree@~2.2.0:
mdn-data "2.0.28" mdn-data "2.0.28"
source-map-js "^1.0.1" source-map-js "^1.0.1"
css-what@^6.0.1: css-what@^6.0.1, css-what@^6.1.0:
version "6.1.0" version "6.1.0"
resolved "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz" resolved "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz"
integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw== integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==
@ -5867,7 +5886,7 @@ csso@^4.0.2, csso@^4.2.0:
dependencies: dependencies:
css-tree "^1.1.2" css-tree "^1.1.2"
csso@^5.0.2: csso@^5.0.2, csso@^5.0.5:
version "5.0.5" version "5.0.5"
resolved "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz" resolved "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz"
integrity sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ== integrity sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==
@ -7468,10 +7487,10 @@ fs-extra@8.1.0, fs-extra@^8.0.1, fs-extra@^8.1.0:
jsonfile "^4.0.0" jsonfile "^4.0.0"
universalify "^0.1.0" universalify "^0.1.0"
fs-extra@^10.1.0: fs-extra@^11.1.0:
version "10.1.0" version "11.1.0"
resolved "https://registry.npmmirror.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.0.tgz#5784b102104433bb0e090f48bfc4a30742c357ed"
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== integrity sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==
dependencies: dependencies:
graceful-fs "^4.2.0" graceful-fs "^4.2.0"
jsonfile "^6.0.1" jsonfile "^6.0.1"
@ -9531,6 +9550,11 @@ mdn-data@2.0.28:
resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz" resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz"
integrity sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g== integrity sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==
mdn-data@2.0.30:
version "2.0.30"
resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc"
integrity sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==
mdn-data@~1.1.0: mdn-data@~1.1.0:
version "1.1.4" version "1.1.4"
resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-1.1.4.tgz" resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-1.1.4.tgz"
@ -13047,6 +13071,18 @@ svgo@^2.7.0:
picocolors "^1.0.0" picocolors "^1.0.0"
stable "^0.1.8" stable "^0.1.8"
svgo@^3.0.2:
version "3.0.2"
resolved "https://registry.npmjs.org/svgo/-/svgo-3.0.2.tgz#5e99eeea42c68ee0dc46aa16da093838c262fe0a"
integrity sha512-Z706C1U2pb1+JGP48fbazf3KxHrWOsLme6Rv7imFBn5EnuanDW1GPaA/P1/dvObE670JDePC3mnj0k0B7P0jjQ==
dependencies:
"@trysound/sax" "0.2.0"
commander "^7.2.0"
css-select "^5.1.0"
css-tree "^2.2.1"
csso "^5.0.5"
picocolors "^1.0.0"
swiper@6.8.0: swiper@6.8.0:
version "6.8.0" version "6.8.0"
resolved "https://registry.npmjs.org/swiper/-/swiper-6.8.0.tgz" resolved "https://registry.npmjs.org/swiper/-/swiper-6.8.0.tgz"
@ -13104,20 +13140,22 @@ taro-css-to-react-native@3.5.8:
css-mediaquery "^0.1.2" css-mediaquery "^0.1.2"
postcss-value-parser "^3.3.0" postcss-value-parser "^3.3.0"
taro-iconfont-svg@^1.0.19: taro-iconfont-svg@^1.1.1:
version "1.0.19" version "1.1.1"
resolved "https://registry.npmmirror.com/taro-iconfont-svg/-/taro-iconfont-svg-1.0.19.tgz#92c5f264af37dc5a9e5ba59cdc1b5594ff60431b" resolved "https://registry.npmjs.org/taro-iconfont-svg/-/taro-iconfont-svg-1.1.1.tgz#9bf97717bb312e9ab766fb0f4dca30dcf244ff50"
integrity sha512-A5B5pe6gYjYcvuMAOgz5mJ3pA+syDP8lx2F2o12r1ddcccQljsU9k4KYp73wfouCCLSNi5CCy+UCcC6Ts51f4A== integrity sha512-rOfrubDg3hGky6b7sb+rygleq97LW1dnd23MVIJ+0h9xsMxFwEv1t4+R/ZMpWhxrWV4CQPgIJJ0YKb1BIqLs5A==
dependencies: dependencies:
"@tarojs/taro" "^3.5.7" "@tarojs/taro" "^3.5.10"
classnames "^2.3.2" classnames "^2.3.2"
colors "^1.4.0" colors "^1.4.0"
fs-extra "^10.1.0" fs-extra "^11.1.0"
glob "^8.0.3" glob "^8.0.3"
iconfont-parser "^1.0.0" iconfont-parser "^1.0.0"
minimist "^1.2.7" minimist "^1.2.7"
mkdirp "^1.0.4" mkdirp "^1.0.4"
svgo "^3.0.2"
ts-node "^10.9.1" ts-node "^10.9.1"
xml2js "^0.4.23"
tarojs@^2.1.1: tarojs@^2.1.1:
version "2.1.1" version "2.1.1"
@ -14248,7 +14286,7 @@ xml-parse-from-string@^1.0.0:
resolved "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz" resolved "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz"
integrity sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g== integrity sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==
xml2js@^0.4.19, xml2js@^0.4.22, xml2js@^0.4.5: xml2js@^0.4.19, xml2js@^0.4.22, xml2js@^0.4.23, xml2js@^0.4.5:
version "0.4.23" version "0.4.23"
resolved "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz" resolved "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz"
integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug== integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==