mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
swipe components
This commit is contained in:
83
packages/zanui-css/scripts/build.sh
Normal file
83
packages/zanui-css/scripts/build.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
basepath=$(dirname $0)
|
||||
server_prefix=/zanui/icon
|
||||
|
||||
# convert relative path to absolute path
|
||||
function abspath() {
|
||||
pushd . > /dev/null; if [ -d "$1" ]; then cd "$1"; dirs -l +0; else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`; if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`"; else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null;
|
||||
}
|
||||
|
||||
command_exists () {
|
||||
type "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
fontname() {
|
||||
if command_exists superman ; then
|
||||
echo "//b.yzcdn.cn$server_prefix/$(basename $basepath/../build/font/zanui-icon-*.$1)"
|
||||
else
|
||||
echo "$(abspath $basepath/../build/font/zanui-icon-*.$1)"
|
||||
fi
|
||||
}
|
||||
|
||||
# generate font files from sketch file
|
||||
$basepath/extract-icons.sh
|
||||
$basepath/generate-font.sh
|
||||
|
||||
if command_exists superman ; then
|
||||
# upload to cdn
|
||||
superman cdn $server_prefix $basepath/../build/font/zanui-icon-*
|
||||
fi
|
||||
|
||||
# generate fontface style
|
||||
eot=$(fontname eot)
|
||||
cat > $basepath/../src/icon.css <<EOF
|
||||
/* DO NOT EDIT! Generated by fount */
|
||||
|
||||
@font-face {
|
||||
font-family: 'zan-icon';
|
||||
src: url('$eot');
|
||||
src: url('$eot?#iefix') format('embedded-opentype'),
|
||||
url('$(fontname woff2)') format('woff2'),
|
||||
url('$(fontname woff)') format('woff'),
|
||||
url('$(fontname ttf)') format('truetype')
|
||||
}
|
||||
|
||||
.zan-icon {
|
||||
display: inline-block;
|
||||
}
|
||||
.zan-icon::before {
|
||||
font-family: "zan-icon" !important;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: none;
|
||||
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
width: 1em;
|
||||
text-align: center;
|
||||
|
||||
/* For safety - reset parent styles, that can break glyph codes*/
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
|
||||
/* fix buttons height, for twitter bootstrap */
|
||||
line-height: 1em;
|
||||
|
||||
/* Animation center compensation - margins should be symmetric */
|
||||
/* remove if not needed */
|
||||
/* margin-left: .2em; */
|
||||
|
||||
/* you can be more comfortable with increased icons size */
|
||||
/* font-size: 120%; */
|
||||
|
||||
/* Font smoothing. That was taken from TWBS */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
/* Uncomment for 3D effect */
|
||||
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
||||
}
|
||||
EOF
|
||||
|
||||
cat $basepath/../build/css/zanui-icon-codes.css >> $basepath/../src/icon.css
|
6
packages/zanui-css/scripts/extract-icons.sh
Executable file
6
packages/zanui-css/scripts/extract-icons.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
basepath=$(dirname $0)
|
||||
|
||||
rm -rf $basepath/../icons
|
||||
sketchtool export slices --formats=svg --overwriting=YES --save-for-web=YES --output=$basepath/../icons $basepath/../assets/icons.sketch
|
162
packages/zanui-css/scripts/fount-config.js
Normal file
162
packages/zanui-css/scripts/fount-config.js
Normal file
@@ -0,0 +1,162 @@
|
||||
module.exports = {
|
||||
name: 'zanui-icon',
|
||||
output: '../build',
|
||||
meta: {
|
||||
author: 'houzi, zhangmin',
|
||||
license: 'MIT',
|
||||
license_url: 'https://opensource.org/licenses/MIT',
|
||||
homepage: 'http://github.com/youzan',
|
||||
css_prefix_text: 'zan-icon-',
|
||||
filename_hash: true
|
||||
},
|
||||
hinting: true,
|
||||
glyphs_dir: '../icons',
|
||||
glyphs: [
|
||||
{
|
||||
keywords: ['qr', 'invalid'],
|
||||
src: '二维码失效.svg',
|
||||
css: 'qr-invalid'
|
||||
},
|
||||
{
|
||||
keywords: ['qr'],
|
||||
src: '二维码.svg',
|
||||
css: 'qr'
|
||||
},
|
||||
{
|
||||
keywords: ['pay', 'fail'],
|
||||
src: '交易失败.svg',
|
||||
css: 'pay-fail'
|
||||
},
|
||||
{
|
||||
keywords: ['exchange'],
|
||||
src: '兑换.svg',
|
||||
css: 'exchange',
|
||||
'correct_contour_direction': true
|
||||
},
|
||||
{
|
||||
keywords: ['close'],
|
||||
src: '关闭.svg',
|
||||
css: 'close'
|
||||
},
|
||||
{
|
||||
keywords: ['location'],
|
||||
src: '其他分店.svg',
|
||||
css: 'location'
|
||||
},
|
||||
{
|
||||
keywords: ['upgrade'],
|
||||
src: '升级地址.svg',
|
||||
css: 'upgrade'
|
||||
},
|
||||
{
|
||||
keywords: ['check'],
|
||||
src: '单选.svg',
|
||||
css: 'check'
|
||||
},
|
||||
{
|
||||
keywords: ['checked'],
|
||||
src: '选中.svg',
|
||||
css: 'checked'
|
||||
},
|
||||
{
|
||||
keywords: ['like', 'outline'],
|
||||
src: '喜欢.svg',
|
||||
css: 'like-o'
|
||||
},
|
||||
{
|
||||
keywords: ['like', 'filled'],
|
||||
src: '喜欢.svg',
|
||||
css: 'like'
|
||||
},
|
||||
{
|
||||
keywords: ['chat'],
|
||||
src: '客服.svg',
|
||||
css: 'chat'
|
||||
},
|
||||
{
|
||||
keywords: ['account', 'paid'],
|
||||
src: '已付款.svg',
|
||||
css: 'paid'
|
||||
},
|
||||
{
|
||||
keywords: ['delivered'],
|
||||
src: '已发货.svg',
|
||||
css: 'delivered'
|
||||
},
|
||||
{
|
||||
keywords: ['finished'],
|
||||
src: '已完成.svg',
|
||||
css: 'finished'
|
||||
},
|
||||
{
|
||||
keywords: ['shop'],
|
||||
src: '店铺.svg',
|
||||
css: 'shop'
|
||||
},
|
||||
{
|
||||
keywords: ['deliver'],
|
||||
src: '待发货.svg',
|
||||
css: 'deliver'
|
||||
},
|
||||
{
|
||||
keywords: ['success'],
|
||||
src: '成功开团.svg',
|
||||
css: 'success'
|
||||
},
|
||||
{
|
||||
keywords: ['photograph'],
|
||||
src: '拍照.svg',
|
||||
css: 'photograph'
|
||||
},
|
||||
{
|
||||
keywords: ['add'],
|
||||
src: '新增地址.svg',
|
||||
css: 'add'
|
||||
},
|
||||
{
|
||||
keywords: ['not', 'payed'],
|
||||
src: '未付款.svg',
|
||||
css: 'not-payed'
|
||||
},
|
||||
{
|
||||
keywords: ['add2'],
|
||||
src: '添加.svg',
|
||||
css: 'add2'
|
||||
},
|
||||
{
|
||||
keywords: ['photo'],
|
||||
src: '照片.svg',
|
||||
css: 'photo'
|
||||
},
|
||||
{
|
||||
keywords: ['logistics'],
|
||||
src: '物流.svg',
|
||||
css: 'logistics'
|
||||
},
|
||||
{
|
||||
keywords: ['edit'],
|
||||
src: '编辑地址.svg',
|
||||
css: 'edit'
|
||||
},
|
||||
{
|
||||
keywords: ['passed'],
|
||||
src: '认证通过.svg',
|
||||
css: 'passed'
|
||||
},
|
||||
{
|
||||
keywords: ['cart'],
|
||||
src: '购物车.svg',
|
||||
css: 'cart'
|
||||
},
|
||||
{
|
||||
keywords: ['arrow'],
|
||||
src: '进入箭头.svg',
|
||||
css: 'arrow'
|
||||
},
|
||||
{
|
||||
keywords: ['gift'],
|
||||
src: '送礼.svg',
|
||||
css: 'gift'
|
||||
}
|
||||
]
|
||||
};
|
5
packages/zanui-css/scripts/generate-font.sh
Executable file
5
packages/zanui-css/scripts/generate-font.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
basepath=$(dirname $0)
|
||||
|
||||
iconfount --config $basepath/fount-config.js
|
Reference in New Issue
Block a user