driver-weex
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,220 +0,426 @@ | ||
(function (styleUnit) { | ||
var STYLE = 'style'; | ||
var ID = 'id'; | ||
var TEXT = 'text'; | ||
var CHILDREN = 'children'; | ||
var EVENT_PREFIX_REGEXP = /^on[A-Z]/; | ||
var ARIA_PREFIX_REGEXP = /^aria-/; | ||
var HYPHEN_REGEXP = /\-(\w)/; | ||
var EMPTY = ''; | ||
(function () { | ||
function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
function updateWeexTextValue(node) { | ||
var value = node.children.map(function (child) { | ||
// Comment node type | ||
return child.nodeType === 8 ? child.value : EMPTY; | ||
}).join(EMPTY); | ||
node.setAttr('value', value); | ||
} | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var nodeMaps = {}; | ||
/* global __weex_document__ */ | ||
var index_min = createCommonjsModule(function (module, exports) { | ||
var document = typeof __weex_document__ === 'object' ? __weex_document__ : typeof document === 'object' ? document : null; | ||
function getElementById(id) { | ||
return nodeMaps[id]; | ||
} | ||
function createBody(type, props) { | ||
if (document.body) { | ||
return document.body; | ||
} | ||
function isUndef(e) { | ||
return "undefined" === e; | ||
} | ||
var documentElement = document.documentElement; | ||
var body = document.createBody(type, props); | ||
documentElement.appendChild(body); | ||
return body; | ||
} | ||
function createComment(content) { | ||
return document.createComment(content); | ||
} | ||
function createEmpty() { | ||
return createComment(EMPTY); | ||
} | ||
function createText(text) { | ||
// Use comment node type mock text node | ||
return createComment(text); | ||
} | ||
function updateText(node, text) { | ||
node.value = text; | ||
updateWeexTextValue(node.parentNode); | ||
} | ||
function createElement(type, props) { | ||
if (props === void 0) { | ||
props = {}; | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var isWeb = !isUndef(typeof window) && "onload" in window, | ||
isNode = !isUndef(typeof process) && !(!process.versions || !process.versions.node), | ||
isWeex = !isUndef(typeof callNative) || !isUndef(typeof WXEnvironment) && "Web" !== WXEnvironment.platform, | ||
isMiniApp = !isUndef(typeof my) && !isUndef(my.navigateTo), | ||
isWeChatMiniprogram = !isUndef(typeof wx) && !isUndef(wx.navigateTo); | ||
exports.isMiniApp = isMiniApp, exports.isNode = isNode, exports.isWeChatMiniprogram = isWeChatMiniprogram, exports.isWeb = isWeb, exports.isWeex = isWeex; | ||
}); | ||
unwrapExports(index_min); | ||
var index_min_1 = index_min.isMiniApp; | ||
var index_min_2 = index_min.isNode; | ||
var index_min_3 = index_min.isWeChatMiniprogram; | ||
var index_min_4 = index_min.isWeb; | ||
var index_min_5 = index_min.isWeex; | ||
var style = {}; | ||
var originStyle = props.style; | ||
var lib = createCommonjsModule(function (module, exports) { | ||
if (originStyle) { | ||
for (var prop in originStyle) { | ||
style[prop] = styleUnit.convertUnit(originStyle[prop], prop); | ||
} | ||
} | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var node = document.createElement(type, { | ||
style: style | ||
}); | ||
function isUndef(type) { | ||
return type === 'undefined'; | ||
} | ||
for (var _prop in props) { | ||
var value = props[_prop]; | ||
var isWeb = !isUndef(typeof window) && 'onload' in window; | ||
var isNode = !isUndef(typeof process) && !!(process.versions && process.versions.node); | ||
var isWeex = !isUndef(typeof callNative) || !isUndef(typeof WXEnvironment) && WXEnvironment.platform !== 'Web'; | ||
var isMiniApp = !isUndef(typeof my) && !isUndef(my.navigateTo); | ||
var isWeChatMiniprogram = !isUndef(typeof wx) && !isUndef(wx.navigateTo); | ||
exports.isMiniApp = isMiniApp; | ||
exports.isNode = isNode; | ||
exports.isWeChatMiniprogram = isWeChatMiniprogram; | ||
exports.isWeb = isWeb; | ||
exports.isWeex = isWeex; | ||
}); | ||
unwrapExports(lib); | ||
var lib_1 = lib.isMiniApp; | ||
var lib_2 = lib.isNode; | ||
var lib_3 = lib.isWeChatMiniprogram; | ||
var lib_4 = lib.isWeb; | ||
var lib_5 = lib.isWeex; | ||
if (_prop === CHILDREN) { | ||
continue; | ||
} | ||
var universalEnv = createCommonjsModule(function (module) { | ||
{ | ||
module.exports = lib; | ||
} | ||
}); | ||
if (value != null) { | ||
if (_prop === STYLE) { | ||
continue; | ||
} else if (EVENT_PREFIX_REGEXP.test(_prop)) { | ||
var eventName = _prop.slice(2).toLowerCase(); | ||
var lib$1 = createCommonjsModule(function (module, exports) { | ||
addEventListener(node, eventName, value, props); | ||
} else { | ||
setAttribute(node, _prop, value); | ||
} | ||
} | ||
} | ||
exports.__esModule = true; | ||
exports.isRpx = isRpx; | ||
exports.calcRpx = calcRpx; | ||
exports.getRpx = getRpx; | ||
exports.setRpx = setRpx; | ||
exports.getViewportWidth = getViewportWidth; | ||
exports.setViewportWidth = setViewportWidth; | ||
exports.setDecimalPixelTransformer = setDecimalPixelTransformer; | ||
exports.convertUnit = convertUnit; | ||
var RPX_REG = /[-+]?\d*\.?\d+rpx/g; | ||
var GLOBAL_RPX_COEFFICIENT = '__rpx_coefficient__'; | ||
var GLOBAL_VIEWPORT_WIDTH = '__viewport_width__'; | ||
var global = typeof window === 'object' ? window : typeof global === 'object' ? global : {}; // convertUnit method targetPlatform | ||
return node; | ||
} | ||
function appendChild(node, parent) { | ||
parent.appendChild(node); | ||
var targetPlatform = universalEnv.isWeb ? 'web' : universalEnv.isWeex ? 'weex' : ''; // Init toFixed method | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function removeChild(node, parent) { | ||
parent = parent || node.parentNode; | ||
var id = node.attr && node.attr[ID]; | ||
var unitPrecision = 4; | ||
if (id != null) { | ||
nodeMaps[id] = null; | ||
} | ||
var toFixed = function toFixed(number, precision) { | ||
var multiplier = Math.pow(10, precision + 1); | ||
var wholeNumber = Math.floor(number * multiplier); | ||
return Math.round(wholeNumber / 10) * 10 / multiplier; | ||
}; // Dedault decimal px transformer. | ||
parent.removeChild(node); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function replaceChild(newChild, oldChild, parent) { | ||
parent = parent || oldChild.parentNode; | ||
var previousSibling = oldChild.previousSibling; | ||
var nextSibling = oldChild.nextSibling; | ||
removeChild(oldChild, parent); | ||
var decimalPixelTransformer = function decimalPixelTransformer(rpx) { | ||
return parseFloat(rpx) * getRpx() + 'px'; | ||
}; // Default decimal vw transformer. | ||
if (previousSibling) { | ||
insertAfter(newChild, previousSibling, parent); | ||
} else if (nextSibling) { | ||
insertBefore(newChild, nextSibling, parent); | ||
} else { | ||
appendChild(newChild, parent); | ||
} | ||
} | ||
function insertAfter(node, after, parent) { | ||
parent = parent || after.parentNode; | ||
parent.insertAfter(node, after); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function insertBefore(node, before, parent) { | ||
parent = parent || before.parentNode; | ||
parent.insertBefore(node, before); | ||
var decimalVWTransformer = function decimalVWTransformer(rpx) { | ||
return toFixed(parseFloat(rpx) / (getViewportWidth() / 100), unitPrecision) + 'vw'; | ||
}; // Default 1 rpx to 1 px | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function addEventListener(node, eventName, eventHandler, props) { | ||
// https://github.com/apache/incubator-weex/blob/master/runtime/vdom/Element.js#L421 | ||
var params = props[eventName + 'EventParams']; | ||
return node.addEvent(eventName, eventHandler, params); | ||
} | ||
function removeEventListener(node, eventName, eventHandler) { | ||
return node.removeEvent(eventName, eventHandler); | ||
} | ||
function removeAttribute(node, propKey, propValue) { | ||
if (propKey == ID) { | ||
nodeMaps[propValue] = null; | ||
} // Weex native will crash when pass null value | ||
if (getRpx() === undefined) { | ||
setRpx(1); | ||
} // Viewport width, default to 750. | ||
return node.setAttr(propKey, undefined, false); | ||
} | ||
function setAttribute(node, propKey, propValue) { | ||
if (propKey == ID) { | ||
nodeMaps[propValue] = node; | ||
} // Weex only support `ariaLabel` format, convert `aria-label` format to camelcase | ||
if (getViewportWidth() === undefined) { | ||
setViewportWidth(750); | ||
} | ||
/** | ||
* Is string contains rpx | ||
* note: rpx is an alias to rpx | ||
* @param {String} str | ||
* @returns {Boolean} | ||
*/ | ||
if (ARIA_PREFIX_REGEXP.test(propKey)) { | ||
propKey = propKey.replace(HYPHEN_REGEXP, function (m, p) { | ||
return p.toUpperCase(); | ||
}); | ||
} | ||
return node.setAttr(propKey, propValue, false); | ||
} | ||
function setStyle(node, style) { | ||
for (var prop in style) { | ||
// Translate `rpx` to weex `px` | ||
style[prop] = styleUnit.convertUnit(style[prop], prop); | ||
} | ||
function isRpx(str) { | ||
return typeof str === 'string' && RPX_REG.test(str); | ||
} | ||
/** | ||
* Calculate rpx | ||
* @param {String} str | ||
* @returns {String} | ||
*/ | ||
node.setStyles(style); | ||
} | ||
function beforeRender() { | ||
// Turn off batched updates | ||
document.open(); // Set `rpx` unit converter | ||
styleUnit.setRpx(1); | ||
} | ||
function afterRender() { | ||
if (document.listener && document.listener.createFinish) { | ||
document.listener.createFinish(); | ||
} // Turn on batched updates | ||
function calcRpx(str) { | ||
if (targetPlatform === 'web') { | ||
// In Web convert rpx to 'vw', same as driver-dom and driver-universal | ||
// '375rpx' => '50vw' | ||
return str.replace(RPX_REG, decimalVWTransformer); | ||
} else if (targetPlatform === 'weex') { | ||
// In Weex convert rpx to 'px' | ||
// '375rpx' => 375 * px | ||
return str.replace(RPX_REG, decimalPixelTransformer); | ||
} else { | ||
// Other platform return original value, like Mini-App and WX Mini-Program ... | ||
// '375rpx' => '375rpx' | ||
return str; | ||
} | ||
} | ||
function getRpx() { | ||
return global[GLOBAL_RPX_COEFFICIENT]; | ||
} | ||
document.close(); | ||
} | ||
function setRpx(rpx) { | ||
global[GLOBAL_RPX_COEFFICIENT] = rpx; | ||
} | ||
var DriverWeex = ({ | ||
__proto__: null, | ||
getElementById: getElementById, | ||
createBody: createBody, | ||
createComment: createComment, | ||
createEmpty: createEmpty, | ||
createText: createText, | ||
updateText: updateText, | ||
createElement: createElement, | ||
appendChild: appendChild, | ||
removeChild: removeChild, | ||
replaceChild: replaceChild, | ||
insertAfter: insertAfter, | ||
insertBefore: insertBefore, | ||
addEventListener: addEventListener, | ||
removeEventListener: removeEventListener, | ||
removeAttribute: removeAttribute, | ||
setAttribute: setAttribute, | ||
setStyle: setStyle, | ||
beforeRender: beforeRender, | ||
afterRender: afterRender | ||
}); | ||
function getViewportWidth() { | ||
return global[GLOBAL_VIEWPORT_WIDTH]; | ||
} | ||
if (typeof module !== 'undefined') module.exports = DriverWeex;else self.DriverWeex = DriverWeex; | ||
function setViewportWidth(viewport) { | ||
global[GLOBAL_VIEWPORT_WIDTH] = viewport; | ||
} | ||
/** | ||
* Set a function to transform unit of pixel, | ||
* default to passthrough. | ||
* @param {Function} transformer function | ||
*/ | ||
}(styleUnit)); | ||
function setDecimalPixelTransformer(transformer) { | ||
decimalPixelTransformer = transformer; | ||
} | ||
var cache = Object.create(null); | ||
/** | ||
* Convert rpx. | ||
* @param value | ||
* @param prop | ||
* @param platform | ||
* @return {String} Transformed value. | ||
*/ | ||
function convertUnit(value, prop, platform) { | ||
var cacheKey = prop + "-" + value; | ||
var hit = cache[cacheKey]; | ||
if (platform) { | ||
cacheKey += "-" + platform; | ||
targetPlatform = platform; | ||
} | ||
if (hit) { | ||
return hit; | ||
} else { | ||
value = value + ''; | ||
return cache[cacheKey] = isRpx(value) ? calcRpx(value) : value; | ||
} | ||
} | ||
}); | ||
unwrapExports(lib$1); | ||
var lib_1$1 = lib$1.isRpx; | ||
var lib_2$1 = lib$1.calcRpx; | ||
var lib_3$1 = lib$1.getRpx; | ||
var lib_4$1 = lib$1.setRpx; | ||
var lib_5$1 = lib$1.getViewportWidth; | ||
var lib_6 = lib$1.setViewportWidth; | ||
var lib_7 = lib$1.setDecimalPixelTransformer; | ||
var lib_8 = lib$1.convertUnit; | ||
var STYLE = 'style'; | ||
var ID = 'id'; | ||
var TEXT = 'text'; | ||
var CHILDREN = 'children'; | ||
var EVENT_PREFIX_REGEXP = /^on[A-Z]/; | ||
var ARIA_PREFIX_REGEXP = /^aria-/; | ||
var HYPHEN_REGEXP = /\-(\w)/; | ||
var EMPTY = ''; | ||
function updateWeexTextValue(node) { | ||
var value = node.children.map(function (child) { | ||
// Comment node type | ||
return child.nodeType === 8 ? child.value : EMPTY; | ||
}).join(EMPTY); | ||
node.setAttr('value', value); | ||
} | ||
var nodeMaps = {}; | ||
/* global __weex_document__ */ | ||
var document = typeof __weex_document__ === 'object' ? __weex_document__ : typeof document === 'object' ? document : null; | ||
function getElementById(id) { | ||
return nodeMaps[id]; | ||
} | ||
function createBody(type, props) { | ||
if (document.body) { | ||
return document.body; | ||
} | ||
var documentElement = document.documentElement; | ||
var body = document.createBody(type, props); | ||
documentElement.appendChild(body); | ||
return body; | ||
} | ||
function createComment(content) { | ||
return document.createComment(content); | ||
} | ||
function createEmpty() { | ||
return createComment(EMPTY); | ||
} | ||
function createText(text) { | ||
// Use comment node type mock text node | ||
return createComment(text); | ||
} | ||
function updateText(node, text) { | ||
node.value = text; | ||
updateWeexTextValue(node.parentNode); | ||
} | ||
function createElement(type, props) { | ||
if (props === void 0) { | ||
props = {}; | ||
} | ||
var style = {}; | ||
var originStyle = props.style; | ||
if (originStyle) { | ||
for (var prop in originStyle) { | ||
style[prop] = lib_8(originStyle[prop], prop); | ||
} | ||
} | ||
var node = document.createElement(type, { | ||
style: style | ||
}); | ||
for (var _prop in props) { | ||
var value = props[_prop]; | ||
if (_prop === CHILDREN) { | ||
continue; | ||
} | ||
if (value != null) { | ||
if (_prop === STYLE) { | ||
continue; | ||
} else if (EVENT_PREFIX_REGEXP.test(_prop)) { | ||
var eventName = _prop.slice(2).toLowerCase(); | ||
addEventListener(node, eventName, value, props); | ||
} else { | ||
setAttribute(node, _prop, value); | ||
} | ||
} | ||
} | ||
return node; | ||
} | ||
function appendChild(node, parent) { | ||
parent.appendChild(node); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function removeChild(node, parent) { | ||
parent = parent || node.parentNode; | ||
var id = node.attr && node.attr[ID]; | ||
if (id != null) { | ||
nodeMaps[id] = null; | ||
} | ||
parent.removeChild(node); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function replaceChild(newChild, oldChild, parent) { | ||
parent = parent || oldChild.parentNode; | ||
var previousSibling = oldChild.previousSibling; | ||
var nextSibling = oldChild.nextSibling; | ||
removeChild(oldChild, parent); | ||
if (previousSibling) { | ||
insertAfter(newChild, previousSibling, parent); | ||
} else if (nextSibling) { | ||
insertBefore(newChild, nextSibling, parent); | ||
} else { | ||
appendChild(newChild, parent); | ||
} | ||
} | ||
function insertAfter(node, after, parent) { | ||
parent = parent || after.parentNode; | ||
parent.insertAfter(node, after); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function insertBefore(node, before, parent) { | ||
parent = parent || before.parentNode; | ||
parent.insertBefore(node, before); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function addEventListener(node, eventName, eventHandler, props) { | ||
// https://github.com/apache/incubator-weex/blob/master/runtime/vdom/Element.js#L421 | ||
var params = props[eventName + 'EventParams']; | ||
return node.addEvent(eventName, eventHandler, params); | ||
} | ||
function removeEventListener(node, eventName, eventHandler) { | ||
return node.removeEvent(eventName, eventHandler); | ||
} | ||
function removeAttribute(node, propKey, propValue) { | ||
if (propKey == ID) { | ||
nodeMaps[propValue] = null; | ||
} // Weex native will crash when pass null value | ||
return node.setAttr(propKey, undefined, false); | ||
} | ||
function setAttribute(node, propKey, propValue) { | ||
if (propKey == ID) { | ||
nodeMaps[propValue] = node; | ||
} // Weex only support `ariaLabel` format, convert `aria-label` format to camelcase | ||
if (ARIA_PREFIX_REGEXP.test(propKey)) { | ||
propKey = propKey.replace(HYPHEN_REGEXP, function (m, p) { | ||
return p.toUpperCase(); | ||
}); | ||
} | ||
return node.setAttr(propKey, propValue, false); | ||
} | ||
function setStyle(node, style) { | ||
for (var prop in style) { | ||
// Translate `rpx` to weex `px` | ||
style[prop] = lib_8(style[prop], prop); | ||
} | ||
node.setStyles(style); | ||
} | ||
function beforeRender() { | ||
// Turn off batched updates | ||
document.open(); // Set `rpx` unit converter | ||
lib_4$1(1); | ||
} | ||
function afterRender() { | ||
if (document.listener && document.listener.createFinish) { | ||
document.listener.createFinish(); | ||
} // Turn on batched updates | ||
document.close(); | ||
} | ||
var DriverWeex = { | ||
__proto__: null, | ||
getElementById: getElementById, | ||
createBody: createBody, | ||
createComment: createComment, | ||
createEmpty: createEmpty, | ||
createText: createText, | ||
updateText: updateText, | ||
createElement: createElement, | ||
appendChild: appendChild, | ||
removeChild: removeChild, | ||
replaceChild: replaceChild, | ||
insertAfter: insertAfter, | ||
insertBefore: insertBefore, | ||
addEventListener: addEventListener, | ||
removeEventListener: removeEventListener, | ||
removeAttribute: removeAttribute, | ||
setAttribute: setAttribute, | ||
setStyle: setStyle, | ||
beforeRender: beforeRender, | ||
afterRender: afterRender | ||
}; | ||
if (typeof module !== 'undefined') module.exports = DriverWeex;else self.DriverWeex = DriverWeex; | ||
}()); | ||
//# sourceMappingURL=driver-weex.js.map |
@@ -1,2 +0,2 @@ | ||
!function(c){var r="id",u="text",a=/^on[A-Z]/,o=/^aria-/,i=/\-(\w)/,t="";function f(n){var e=n.children.map(function(n){return 8===n.nodeType?n.value:t}).join(t);n.setAttr("value",e)}var l={},v="object"==typeof __weex_document__?__weex_document__:"object"==typeof v?v:null;function e(n){return v.createComment(n)}function d(n,e){e.appendChild(n),e.type===u&&f(e)}function _(n,e){e=e||n.parentNode;var t=n.attr&&n.attr[r];null!=t&&(l[t]=null),e.removeChild(n),e.type===u&&f(e)}function m(n,e,t){(t=t||e.parentNode).insertAfter(n,e),t.type===u&&f(t)}function s(n,e,t){(t=t||e.parentNode).insertBefore(n,e),t.type===u&&f(t)}function y(n,e,t,r){return n.addEvent(e,t,r[e+"EventParams"])}function p(n,e,t){return e==r&&(l[t]=n),o.test(e)&&(e=e.replace(i,function(n,e){return e.toUpperCase()})),n.setAttr(e,t,!1)}var n={__proto__:null,getElementById:function(n){return l[n]},createBody:function(n,e){if(v.body)return v.body;var t=v.documentElement,r=v.createBody(n,e);return t.appendChild(r),r},createComment:e,createEmpty:function(){return e(t)},createText:function(n){return e(n)},updateText:function(n,e){n.value=e,f(n.parentNode)},createElement:function(n,e){void 0===e&&(e={});var t={},r=e.style;if(r)for(var u in r)t[u]=c.convertUnit(r[u],u);var o=v.createElement(n,{style:t});for(var i in e){var f=e[i];if("children"!==i&&null!=f){if("style"===i)continue;a.test(i)?y(o,i.slice(2).toLowerCase(),f,e):p(o,i,f)}}return o},appendChild:d,removeChild:_,replaceChild:function(n,e,t){var r=e.previousSibling,u=e.nextSibling;_(e,t=t||e.parentNode),r?m(n,r,t):u?s(n,u,t):d(n,t)},insertAfter:m,insertBefore:s,addEventListener:y,removeEventListener:function(n,e,t){return n.removeEvent(e,t)},removeAttribute:function(n,e,t){return e==r&&(l[t]=null),n.setAttr(e,void 0,!1)},setAttribute:p,setStyle:function(n,e){for(var t in e)e[t]=c.convertUnit(e[t],t);n.setStyles(e)},beforeRender:function(){v.open(),c.setRpx(1)},afterRender:function(){v.listener&&v.listener.createFinish&&v.listener.createFinish(),v.close()}};"undefined"!=typeof module?module.exports=n:self.DriverWeex=n}(styleUnit); | ||
!function(){function n(n){return n&&n.n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function e(n,e){return n(e={exports:{}},e.exports),e.exports}var t=e(function(n,e){function t(n){return"undefined"===n}Object.defineProperty(e,"n",{value:!0});var r=!t(typeof window)&&"onload"in window,o=!t(typeof process)&&!(!process.versions||!process.versions.node),u=!t(typeof callNative)||!t(typeof WXEnvironment)&&"Web"!==WXEnvironment.platform,i=!t(typeof my)&&!t(my.navigateTo),f=!t(typeof wx)&&!t(wx.navigateTo);e.isMiniApp=i,e.isNode=o,e.isWeChatMiniprogram=f,e.isWeb=r,e.isWeex=u});n(t);var r=e(function(n,e){function t(n){return"undefined"===n}Object.defineProperty(e,"n",{value:!0});var r=!t(typeof window)&&"onload"in window,o=!t(typeof process)&&!(!process.versions||!process.versions.node),u=!t(typeof callNative)||!t(typeof WXEnvironment)&&"Web"!==WXEnvironment.platform,i=!t(typeof my)&&!t(my.navigateTo),f=!t(typeof wx)&&!t(wx.navigateTo);e.isMiniApp=i,e.isNode=o,e.isWeChatMiniprogram=f,e.isWeb=r,e.isWeex=u});n(r);var _=e(function(n){n.exports=t}),r=e(function(n,e){e.n=!0,e.isRpx=a,e.calcRpx=d,e.getRpx=l,e.setRpx=v,e.getViewportWidth=p,e.setViewportWidth=s,e.setDecimalPixelTransformer=function(n){f=n},e.convertUnit=function(n,e,t){var r=e+"-"+n,e=y[r];t&&(r+="-"+t,i=t);return e||(y[r]=a(n+="")?d(n):n)};var t=/[-+]?\d*\.?\d+rpx/g,r="__rpx_coefficient__",o="__viewport_width__",u="object"==typeof window?window:"object"==typeof u?u:{},i=_.isWeb?"web":_.isWeex?"weex":"",f=function(n){return parseFloat(n)*l()+"px"},c=function(n){return function(n,e){e=Math.pow(10,e+1);return 10*Math.round(Math.floor(n*e)/10)/e}(parseFloat(n)/(p()/100),4)+"vw"};function a(n){return"string"==typeof n&&t.test(n)}function d(n){return"web"===i?n.replace(t,c):"weex"===i?n.replace(t,f):n}function l(){return u[r]}function v(n){u[r]=n}function p(){return u[o]}function s(n){u[o]=n}void 0===l()&&v(1),void 0===p()&&s(750);var y=Object.create(null)});n(r);var o=r.setRpx,c=r.convertUnit,u="id",i="text",a=/^on[A-Z]/,f=/^aria-/,d=/\-(\w)/,l="";function v(n){var e=n.children.map(function(n){return 8===n.nodeType?n.value:l}).join(l);n.setAttr("value",e)}var p={},s="object"==typeof __weex_document__?__weex_document__:"object"==typeof s?s:null;function y(n){return s.createComment(n)}function w(n,e){e.appendChild(n),e.type===i&&v(e)}function m(n,e){e=e||n.parentNode;var t=n.attr&&n.attr[u];null!=t&&(p[t]=null),e.removeChild(n),e.type===i&&v(e)}function b(n,e,t){(t=t||e.parentNode).insertAfter(n,e),t.type===i&&v(t)}function x(n,e,t){(t=t||e.parentNode).insertBefore(n,e),t.type===i&&v(t)}function E(n,e,t,r){return n.addEvent(e,t,r[e+"EventParams"])}function h(n,e,t){return e==u&&(p[t]=n),f.test(e)&&(e=e.replace(d,function(n,e){return e.toUpperCase()})),n.setAttr(e,t,!1)}r={__proto__:null,getElementById:function(n){return p[n]},createBody:function(n,e){if(s.body)return s.body;var t=s.documentElement,e=s.createBody(n,e);return t.appendChild(e),e},createComment:y,createEmpty:function(){return y(l)},createText:y,updateText:function(n,e){n.value=e,v(n.parentNode)},createElement:function(n,e){void 0===e&&(e={});var t={},r=e.style;if(r)for(var o in r)t[o]=c(r[o],o);var u,i=s.createElement(n,{style:t});for(u in e){var f=e[u];"children"!==u&&null!=f&&"style"!==u&&(a.test(u)?E(i,u.slice(2).toLowerCase(),f,e):h(i,u,f))}return i},appendChild:w,removeChild:m,replaceChild:function(n,e,t){var r=e.previousSibling,o=e.nextSibling;m(e,t=t||e.parentNode),r?b(n,r,t):o?x(n,o,t):w(n,t)},insertAfter:b,insertBefore:x,addEventListener:E,removeEventListener:function(n,e,t){return n.removeEvent(e,t)},removeAttribute:function(n,e,t){return e==u&&(p[t]=null),n.setAttr(e,void 0,!1)},setAttribute:h,setStyle:function(n,e){for(var t in e)e[t]=c(e[t],t);n.setStyles(e)},beforeRender:function(){s.open(),o(1)},afterRender:function(){s.listener&&s.listener.createFinish&&s.listener.createFinish(),s.close()}};"undefined"!=typeof module?module.exports=r:self.DriverWeex=r}(); | ||
//# sourceMappingURL=driver-weex.min.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('style-unit')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'style-unit'], factory) : | ||
(global = global || self, factory(global.DriverWeex = {}, global.styleUnit)); | ||
}(this, (function (exports, styleUnit) { | ||
var STYLE = 'style'; | ||
var ID = 'id'; | ||
var TEXT = 'text'; | ||
var CHILDREN = 'children'; | ||
var EVENT_PREFIX_REGEXP = /^on[A-Z]/; | ||
var ARIA_PREFIX_REGEXP = /^aria-/; | ||
var HYPHEN_REGEXP = /\-(\w)/; | ||
var EMPTY = ''; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.DriverWeex = {})); | ||
}(this, (function (exports) { | ||
function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
function updateWeexTextValue(node) { | ||
var value = node.children.map(function (child) { | ||
// Comment node type | ||
return child.nodeType === 8 ? child.value : EMPTY; | ||
}).join(EMPTY); | ||
node.setAttr('value', value); | ||
} | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var nodeMaps = {}; | ||
/* global __weex_document__ */ | ||
var index_min = createCommonjsModule(function (module, exports) { | ||
var document = typeof __weex_document__ === 'object' ? __weex_document__ : typeof document === 'object' ? document : null; | ||
function getElementById(id) { | ||
return nodeMaps[id]; | ||
} | ||
function createBody(type, props) { | ||
if (document.body) { | ||
return document.body; | ||
} | ||
function isUndef(e) { | ||
return "undefined" === e; | ||
} | ||
var documentElement = document.documentElement; | ||
var body = document.createBody(type, props); | ||
documentElement.appendChild(body); | ||
return body; | ||
} | ||
function createComment(content) { | ||
return document.createComment(content); | ||
} | ||
function createEmpty() { | ||
return createComment(EMPTY); | ||
} | ||
function createText(text) { | ||
// Use comment node type mock text node | ||
return createComment(text); | ||
} | ||
function updateText(node, text) { | ||
node.value = text; | ||
updateWeexTextValue(node.parentNode); | ||
} | ||
function createElement(type, props) { | ||
if (props === void 0) { | ||
props = {}; | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: !0 | ||
}); | ||
var isWeb = !isUndef(typeof window) && "onload" in window, | ||
isNode = !isUndef(typeof process) && !(!process.versions || !process.versions.node), | ||
isWeex = !isUndef(typeof callNative) || !isUndef(typeof WXEnvironment) && "Web" !== WXEnvironment.platform, | ||
isMiniApp = !isUndef(typeof my) && !isUndef(my.navigateTo), | ||
isWeChatMiniprogram = !isUndef(typeof wx) && !isUndef(wx.navigateTo); | ||
exports.isMiniApp = isMiniApp, exports.isNode = isNode, exports.isWeChatMiniprogram = isWeChatMiniprogram, exports.isWeb = isWeb, exports.isWeex = isWeex; | ||
}); | ||
unwrapExports(index_min); | ||
var index_min_1 = index_min.isMiniApp; | ||
var index_min_2 = index_min.isNode; | ||
var index_min_3 = index_min.isWeChatMiniprogram; | ||
var index_min_4 = index_min.isWeb; | ||
var index_min_5 = index_min.isWeex; | ||
var style = {}; | ||
var originStyle = props.style; | ||
var lib = createCommonjsModule(function (module, exports) { | ||
if (originStyle) { | ||
for (var prop in originStyle) { | ||
style[prop] = styleUnit.convertUnit(originStyle[prop], prop); | ||
} | ||
} | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var node = document.createElement(type, { | ||
style: style | ||
}); | ||
function isUndef(type) { | ||
return type === 'undefined'; | ||
} | ||
for (var _prop in props) { | ||
var value = props[_prop]; | ||
var isWeb = !isUndef(typeof window) && 'onload' in window; | ||
var isNode = !isUndef(typeof process) && !!(process.versions && process.versions.node); | ||
var isWeex = !isUndef(typeof callNative) || !isUndef(typeof WXEnvironment) && WXEnvironment.platform !== 'Web'; | ||
var isMiniApp = !isUndef(typeof my) && !isUndef(my.navigateTo); | ||
var isWeChatMiniprogram = !isUndef(typeof wx) && !isUndef(wx.navigateTo); | ||
exports.isMiniApp = isMiniApp; | ||
exports.isNode = isNode; | ||
exports.isWeChatMiniprogram = isWeChatMiniprogram; | ||
exports.isWeb = isWeb; | ||
exports.isWeex = isWeex; | ||
}); | ||
unwrapExports(lib); | ||
var lib_1 = lib.isMiniApp; | ||
var lib_2 = lib.isNode; | ||
var lib_3 = lib.isWeChatMiniprogram; | ||
var lib_4 = lib.isWeb; | ||
var lib_5 = lib.isWeex; | ||
if (_prop === CHILDREN) { | ||
continue; | ||
} | ||
var universalEnv = createCommonjsModule(function (module) { | ||
{ | ||
module.exports = lib; | ||
} | ||
}); | ||
if (value != null) { | ||
if (_prop === STYLE) { | ||
continue; | ||
} else if (EVENT_PREFIX_REGEXP.test(_prop)) { | ||
var eventName = _prop.slice(2).toLowerCase(); | ||
var lib$1 = createCommonjsModule(function (module, exports) { | ||
addEventListener(node, eventName, value, props); | ||
} else { | ||
setAttribute(node, _prop, value); | ||
} | ||
} | ||
} | ||
exports.__esModule = true; | ||
exports.isRpx = isRpx; | ||
exports.calcRpx = calcRpx; | ||
exports.getRpx = getRpx; | ||
exports.setRpx = setRpx; | ||
exports.getViewportWidth = getViewportWidth; | ||
exports.setViewportWidth = setViewportWidth; | ||
exports.setDecimalPixelTransformer = setDecimalPixelTransformer; | ||
exports.convertUnit = convertUnit; | ||
var RPX_REG = /[-+]?\d*\.?\d+rpx/g; | ||
var GLOBAL_RPX_COEFFICIENT = '__rpx_coefficient__'; | ||
var GLOBAL_VIEWPORT_WIDTH = '__viewport_width__'; | ||
var global = typeof window === 'object' ? window : typeof global === 'object' ? global : {}; // convertUnit method targetPlatform | ||
return node; | ||
} | ||
function appendChild(node, parent) { | ||
parent.appendChild(node); | ||
var targetPlatform = universalEnv.isWeb ? 'web' : universalEnv.isWeex ? 'weex' : ''; // Init toFixed method | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function removeChild(node, parent) { | ||
parent = parent || node.parentNode; | ||
var id = node.attr && node.attr[ID]; | ||
var unitPrecision = 4; | ||
if (id != null) { | ||
nodeMaps[id] = null; | ||
} | ||
var toFixed = function toFixed(number, precision) { | ||
var multiplier = Math.pow(10, precision + 1); | ||
var wholeNumber = Math.floor(number * multiplier); | ||
return Math.round(wholeNumber / 10) * 10 / multiplier; | ||
}; // Dedault decimal px transformer. | ||
parent.removeChild(node); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function replaceChild(newChild, oldChild, parent) { | ||
parent = parent || oldChild.parentNode; | ||
var previousSibling = oldChild.previousSibling; | ||
var nextSibling = oldChild.nextSibling; | ||
removeChild(oldChild, parent); | ||
var decimalPixelTransformer = function decimalPixelTransformer(rpx) { | ||
return parseFloat(rpx) * getRpx() + 'px'; | ||
}; // Default decimal vw transformer. | ||
if (previousSibling) { | ||
insertAfter(newChild, previousSibling, parent); | ||
} else if (nextSibling) { | ||
insertBefore(newChild, nextSibling, parent); | ||
} else { | ||
appendChild(newChild, parent); | ||
} | ||
} | ||
function insertAfter(node, after, parent) { | ||
parent = parent || after.parentNode; | ||
parent.insertAfter(node, after); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function insertBefore(node, before, parent) { | ||
parent = parent || before.parentNode; | ||
parent.insertBefore(node, before); | ||
var decimalVWTransformer = function decimalVWTransformer(rpx) { | ||
return toFixed(parseFloat(rpx) / (getViewportWidth() / 100), unitPrecision) + 'vw'; | ||
}; // Default 1 rpx to 1 px | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function addEventListener(node, eventName, eventHandler, props) { | ||
// https://github.com/apache/incubator-weex/blob/master/runtime/vdom/Element.js#L421 | ||
var params = props[eventName + 'EventParams']; | ||
return node.addEvent(eventName, eventHandler, params); | ||
} | ||
function removeEventListener(node, eventName, eventHandler) { | ||
return node.removeEvent(eventName, eventHandler); | ||
} | ||
function removeAttribute(node, propKey, propValue) { | ||
if (propKey == ID) { | ||
nodeMaps[propValue] = null; | ||
} // Weex native will crash when pass null value | ||
if (getRpx() === undefined) { | ||
setRpx(1); | ||
} // Viewport width, default to 750. | ||
return node.setAttr(propKey, undefined, false); | ||
} | ||
function setAttribute(node, propKey, propValue) { | ||
if (propKey == ID) { | ||
nodeMaps[propValue] = node; | ||
} // Weex only support `ariaLabel` format, convert `aria-label` format to camelcase | ||
if (getViewportWidth() === undefined) { | ||
setViewportWidth(750); | ||
} | ||
/** | ||
* Is string contains rpx | ||
* note: rpx is an alias to rpx | ||
* @param {String} str | ||
* @returns {Boolean} | ||
*/ | ||
if (ARIA_PREFIX_REGEXP.test(propKey)) { | ||
propKey = propKey.replace(HYPHEN_REGEXP, function (m, p) { | ||
return p.toUpperCase(); | ||
}); | ||
} | ||
return node.setAttr(propKey, propValue, false); | ||
} | ||
function setStyle(node, style) { | ||
for (var prop in style) { | ||
// Translate `rpx` to weex `px` | ||
style[prop] = styleUnit.convertUnit(style[prop], prop); | ||
} | ||
function isRpx(str) { | ||
return typeof str === 'string' && RPX_REG.test(str); | ||
} | ||
/** | ||
* Calculate rpx | ||
* @param {String} str | ||
* @returns {String} | ||
*/ | ||
node.setStyles(style); | ||
} | ||
function beforeRender() { | ||
// Turn off batched updates | ||
document.open(); // Set `rpx` unit converter | ||
styleUnit.setRpx(1); | ||
} | ||
function afterRender() { | ||
if (document.listener && document.listener.createFinish) { | ||
document.listener.createFinish(); | ||
} // Turn on batched updates | ||
function calcRpx(str) { | ||
if (targetPlatform === 'web') { | ||
// In Web convert rpx to 'vw', same as driver-dom and driver-universal | ||
// '375rpx' => '50vw' | ||
return str.replace(RPX_REG, decimalVWTransformer); | ||
} else if (targetPlatform === 'weex') { | ||
// In Weex convert rpx to 'px' | ||
// '375rpx' => 375 * px | ||
return str.replace(RPX_REG, decimalPixelTransformer); | ||
} else { | ||
// Other platform return original value, like Mini-App and WX Mini-Program ... | ||
// '375rpx' => '375rpx' | ||
return str; | ||
} | ||
} | ||
function getRpx() { | ||
return global[GLOBAL_RPX_COEFFICIENT]; | ||
} | ||
document.close(); | ||
} | ||
function setRpx(rpx) { | ||
global[GLOBAL_RPX_COEFFICIENT] = rpx; | ||
} | ||
exports.addEventListener = addEventListener; | ||
exports.afterRender = afterRender; | ||
exports.appendChild = appendChild; | ||
exports.beforeRender = beforeRender; | ||
exports.createBody = createBody; | ||
exports.createComment = createComment; | ||
exports.createElement = createElement; | ||
exports.createEmpty = createEmpty; | ||
exports.createText = createText; | ||
exports.getElementById = getElementById; | ||
exports.insertAfter = insertAfter; | ||
exports.insertBefore = insertBefore; | ||
exports.removeAttribute = removeAttribute; | ||
exports.removeChild = removeChild; | ||
exports.removeEventListener = removeEventListener; | ||
exports.replaceChild = replaceChild; | ||
exports.setAttribute = setAttribute; | ||
exports.setStyle = setStyle; | ||
exports.updateText = updateText; | ||
function getViewportWidth() { | ||
return global[GLOBAL_VIEWPORT_WIDTH]; | ||
} | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function setViewportWidth(viewport) { | ||
global[GLOBAL_VIEWPORT_WIDTH] = viewport; | ||
} | ||
/** | ||
* Set a function to transform unit of pixel, | ||
* default to passthrough. | ||
* @param {Function} transformer function | ||
*/ | ||
function setDecimalPixelTransformer(transformer) { | ||
decimalPixelTransformer = transformer; | ||
} | ||
var cache = Object.create(null); | ||
/** | ||
* Convert rpx. | ||
* @param value | ||
* @param prop | ||
* @param platform | ||
* @return {String} Transformed value. | ||
*/ | ||
function convertUnit(value, prop, platform) { | ||
var cacheKey = prop + "-" + value; | ||
var hit = cache[cacheKey]; | ||
if (platform) { | ||
cacheKey += "-" + platform; | ||
targetPlatform = platform; | ||
} | ||
if (hit) { | ||
return hit; | ||
} else { | ||
value = value + ''; | ||
return cache[cacheKey] = isRpx(value) ? calcRpx(value) : value; | ||
} | ||
} | ||
}); | ||
unwrapExports(lib$1); | ||
var lib_1$1 = lib$1.isRpx; | ||
var lib_2$1 = lib$1.calcRpx; | ||
var lib_3$1 = lib$1.getRpx; | ||
var lib_4$1 = lib$1.setRpx; | ||
var lib_5$1 = lib$1.getViewportWidth; | ||
var lib_6 = lib$1.setViewportWidth; | ||
var lib_7 = lib$1.setDecimalPixelTransformer; | ||
var lib_8 = lib$1.convertUnit; | ||
var STYLE = 'style'; | ||
var ID = 'id'; | ||
var TEXT = 'text'; | ||
var CHILDREN = 'children'; | ||
var EVENT_PREFIX_REGEXP = /^on[A-Z]/; | ||
var ARIA_PREFIX_REGEXP = /^aria-/; | ||
var HYPHEN_REGEXP = /\-(\w)/; | ||
var EMPTY = ''; | ||
function updateWeexTextValue(node) { | ||
var value = node.children.map(function (child) { | ||
// Comment node type | ||
return child.nodeType === 8 ? child.value : EMPTY; | ||
}).join(EMPTY); | ||
node.setAttr('value', value); | ||
} | ||
var nodeMaps = {}; | ||
/* global __weex_document__ */ | ||
var document = typeof __weex_document__ === 'object' ? __weex_document__ : typeof document === 'object' ? document : null; | ||
function getElementById(id) { | ||
return nodeMaps[id]; | ||
} | ||
function createBody(type, props) { | ||
if (document.body) { | ||
return document.body; | ||
} | ||
var documentElement = document.documentElement; | ||
var body = document.createBody(type, props); | ||
documentElement.appendChild(body); | ||
return body; | ||
} | ||
function createComment(content) { | ||
return document.createComment(content); | ||
} | ||
function createEmpty() { | ||
return createComment(EMPTY); | ||
} | ||
function createText(text) { | ||
// Use comment node type mock text node | ||
return createComment(text); | ||
} | ||
function updateText(node, text) { | ||
node.value = text; | ||
updateWeexTextValue(node.parentNode); | ||
} | ||
function createElement(type, props) { | ||
if (props === void 0) { | ||
props = {}; | ||
} | ||
var style = {}; | ||
var originStyle = props.style; | ||
if (originStyle) { | ||
for (var prop in originStyle) { | ||
style[prop] = lib_8(originStyle[prop], prop); | ||
} | ||
} | ||
var node = document.createElement(type, { | ||
style: style | ||
}); | ||
for (var _prop in props) { | ||
var value = props[_prop]; | ||
if (_prop === CHILDREN) { | ||
continue; | ||
} | ||
if (value != null) { | ||
if (_prop === STYLE) { | ||
continue; | ||
} else if (EVENT_PREFIX_REGEXP.test(_prop)) { | ||
var eventName = _prop.slice(2).toLowerCase(); | ||
addEventListener(node, eventName, value, props); | ||
} else { | ||
setAttribute(node, _prop, value); | ||
} | ||
} | ||
} | ||
return node; | ||
} | ||
function appendChild(node, parent) { | ||
parent.appendChild(node); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function removeChild(node, parent) { | ||
parent = parent || node.parentNode; | ||
var id = node.attr && node.attr[ID]; | ||
if (id != null) { | ||
nodeMaps[id] = null; | ||
} | ||
parent.removeChild(node); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function replaceChild(newChild, oldChild, parent) { | ||
parent = parent || oldChild.parentNode; | ||
var previousSibling = oldChild.previousSibling; | ||
var nextSibling = oldChild.nextSibling; | ||
removeChild(oldChild, parent); | ||
if (previousSibling) { | ||
insertAfter(newChild, previousSibling, parent); | ||
} else if (nextSibling) { | ||
insertBefore(newChild, nextSibling, parent); | ||
} else { | ||
appendChild(newChild, parent); | ||
} | ||
} | ||
function insertAfter(node, after, parent) { | ||
parent = parent || after.parentNode; | ||
parent.insertAfter(node, after); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function insertBefore(node, before, parent) { | ||
parent = parent || before.parentNode; | ||
parent.insertBefore(node, before); | ||
if (parent.type === TEXT) { | ||
updateWeexTextValue(parent); | ||
} | ||
} | ||
function addEventListener(node, eventName, eventHandler, props) { | ||
// https://github.com/apache/incubator-weex/blob/master/runtime/vdom/Element.js#L421 | ||
var params = props[eventName + 'EventParams']; | ||
return node.addEvent(eventName, eventHandler, params); | ||
} | ||
function removeEventListener(node, eventName, eventHandler) { | ||
return node.removeEvent(eventName, eventHandler); | ||
} | ||
function removeAttribute(node, propKey, propValue) { | ||
if (propKey == ID) { | ||
nodeMaps[propValue] = null; | ||
} // Weex native will crash when pass null value | ||
return node.setAttr(propKey, undefined, false); | ||
} | ||
function setAttribute(node, propKey, propValue) { | ||
if (propKey == ID) { | ||
nodeMaps[propValue] = node; | ||
} // Weex only support `ariaLabel` format, convert `aria-label` format to camelcase | ||
if (ARIA_PREFIX_REGEXP.test(propKey)) { | ||
propKey = propKey.replace(HYPHEN_REGEXP, function (m, p) { | ||
return p.toUpperCase(); | ||
}); | ||
} | ||
return node.setAttr(propKey, propValue, false); | ||
} | ||
function setStyle(node, style) { | ||
for (var prop in style) { | ||
// Translate `rpx` to weex `px` | ||
style[prop] = lib_8(style[prop], prop); | ||
} | ||
node.setStyles(style); | ||
} | ||
function beforeRender() { | ||
// Turn off batched updates | ||
document.open(); // Set `rpx` unit converter | ||
lib_4$1(1); | ||
} | ||
function afterRender() { | ||
if (document.listener && document.listener.createFinish) { | ||
document.listener.createFinish(); | ||
} // Turn on batched updates | ||
document.close(); | ||
} | ||
exports.addEventListener = addEventListener; | ||
exports.afterRender = afterRender; | ||
exports.appendChild = appendChild; | ||
exports.beforeRender = beforeRender; | ||
exports.createBody = createBody; | ||
exports.createComment = createComment; | ||
exports.createElement = createElement; | ||
exports.createEmpty = createEmpty; | ||
exports.createText = createText; | ||
exports.getElementById = getElementById; | ||
exports.insertAfter = insertAfter; | ||
exports.insertBefore = insertBefore; | ||
exports.removeAttribute = removeAttribute; | ||
exports.removeChild = removeChild; | ||
exports.removeEventListener = removeEventListener; | ||
exports.replaceChild = replaceChild; | ||
exports.setAttribute = setAttribute; | ||
exports.setStyle = setStyle; | ||
exports.updateText = updateText; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=driver-weex.umd.js.map |
{ | ||
"name": "driver-weex", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Weex driver for Rax", | ||
@@ -17,4 +17,4 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"style-unit": "^2.0.0" | ||
"style-unit": "^3.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
140451
1640
1
+ Added@babel/runtime@7.25.7(transitive)
+ Added@uni/env@1.1.1(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedstyle-unit@3.0.5(transitive)
+ Addeduniversal-env@3.3.3(transitive)
- Removedstyle-unit@2.0.1(transitive)
- Removeduniversal-env@2.0.0(transitive)
Updatedstyle-unit@^3.0.0