UNPKG

@dolphinweex/dof-weex-vue-precompiler

Version:

a precompiler for weex-vue-render.

184 lines (179 loc) 3.47 kB
const util = require('./util') const vendorReg = /webkit|moz/i function hyphen (key) { return util.hyphenate(key.replace(vendorReg, function ($0) { return `-${$0.toLowerCase()}-` })) } function getAllStyles (scaleStyles) { return Object.keys(scaleStyles.reduce(function (pre, key) { pre[key] = 1 pre[hyphen(key)] = 1 return pre }, {})) } const config = { eventMap: { click: 'weex$tap', scroll: 'weex$scroll' }, // these components should auto bind events with .native. weexRegisteredComponents: [ 'input', 'switch', 'list', 'scroller', 'waterfall', 'header', 'loading', 'refresh', 'loading-indicator', 'slider', 'cycleslider', 'slider-neighbor', 'indicator', 'textarea', 'video' // 'web' ], aliweexComponents: [ // aliweex 'tabheader', 'mask', 'richtext', 'appbar', 'parallax' ], // these components should not bind events with .native. weexBuiltInComponents: [ 'div', 'container', 'text', 'image', 'gif', 'img', 'cell', 'a' ], // add .stop to stop propagation for weex native events only. // user defined events may not have the stopPropagation method. weexEvents: [ 'click', 'tap', 'scroll', // gesture 'touchstart', 'touchend', 'touchmove', 'swipe', 'panstart', 'panmove', 'panend', 'longpress', 'long', // input & switch & slider 'input', 'key', 'keyup', 'keydown', 'return', 'change', 'focus', 'blur', 'active', // appear series. 'appear', 'disappear', 'offsetAppear', 'offsetDisappear', // refresh & loading 'refresh', 'pullingdown', 'loading', // video 'start', 'pause', 'finish', 'fail' ], autoprefixer: { browsers: ['> 0.1%', 'ios >= 8', 'not ie < 12'] }, px2rem: { rootValue: 75, minPixelValue: 1.01 }, bindingStyleNamesForPx2Rem: getAllStyles([ 'width', 'height', 'left', 'right', 'top', 'bottom', 'border', 'borderRadius', 'border-radius', 'borderWidth', 'border-width', 'borderLeft', 'border-left', 'borderRight', 'border-right', 'borderTop', 'border-top', 'borderBottom', 'border-bottom', 'borderLeftWidth', 'border-left-width', 'borderRightWidth', 'border-right-width', 'borderTopWidth', 'border-top-width', 'borderBottomWidth', 'border-bottom-width', 'margin', 'marginLeft', 'margin-left', 'marginRight', 'margin-right', 'marginTop', 'margin-top', 'marginBottom', 'margin-bottom', 'padding', 'paddingLeft', 'padding-left', 'paddingRight', 'padding-right', 'paddingTop', 'padding-top', 'paddingBottom', 'padding-bottom', 'fontSize', 'font-size', 'lineHeight', 'line-height', 'transform', 'webkitTransform', 'webkit-transform', 'WebkitTransform', 'mozTransform', 'moz-transform', 'MozTransform', 'itemSize', 'item-size', 'min-height', 'minHeight', 'max-height', 'maxHeight', 'borderTopLeftRadius', 'border-top-left-radius', 'borderTopRightRadius', 'border-top-right-radius', 'borderBottomLeftRadius', 'border-bottom-left-radius' , 'borderBottomRightRadius', 'border-bottom-right-radius' ]) } module.exports = config