driver-dom
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -5,2 +5,6 @@ ## Changelog | ||
- Fix hydrate style with webkit prefix in iOS 10 | ||
### v2.2.1 | ||
- Bump version | ||
@@ -7,0 +11,0 @@ |
var DriverDOM = (function (exports) { | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function createCommonjsModule(fn, basedir, module) { | ||
@@ -15,2 +13,17 @@ return module = { | ||
function getAugmentedNamespace(n) { | ||
if (n.__esModule) return n; | ||
var a = Object.defineProperty({}, '__esModule', {value: true}); | ||
Object.keys(n).forEach(function (k) { | ||
var d = Object.getOwnPropertyDescriptor(n, k); | ||
Object.defineProperty(a, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return n[k]; | ||
} | ||
}); | ||
}); | ||
return a; | ||
} | ||
function commonjsRequire () { | ||
@@ -20,31 +33,48 @@ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); | ||
var lib$1 = createCommonjsModule(function (module, exports) { | ||
function isUndef(type) { | ||
return type === 'undefined'; | ||
} | ||
exports.__esModule = true; | ||
exports.isQuickApp = exports.isWeChatMiniProgram = exports.isByteDanceMicroApp = exports.isMiniApp = exports.isKraken = exports.isWeex = exports.isNode = exports.isWeb = void 0; | ||
var isWeb = !isUndef(typeof window) && 'onload' in window; | ||
var isNode = !isUndef(typeof process) && !!(process.versions && process.versions.node); | ||
var isWeex = !isUndef(typeof WXEnvironment) && WXEnvironment.platform !== 'Web'; | ||
var isKraken = !isUndef(typeof __kraken__); | ||
var isMiniApp = !isUndef(typeof my) && my !== null && !isUndef(typeof my.alert); | ||
var isByteDanceMicroApp = !isUndef(typeof tt) && tt !== null && !isUndef(typeof tt) && !isUndef(tt.showToast); | ||
var isBaiduSmartProgram = !isUndef(typeof swan) && swan !== null && !isUndef(typeof swan) && !isUndef(swan.showToast); | ||
var isKuaiShouMiniProgram = !isUndef(typeof ks) && ks !== null && !isUndef(typeof ks) && !isUndef(ks.showToast); // In wechat mini program, wx.login is a function | ||
// In wechat mini propgram webview, there is no wx.login, but exist wx.miniProgram | ||
// In bytedance maicro app, there is wx variable. | ||
function isUndef(type) { | ||
return type === 'undefined'; | ||
} | ||
var isWeChatMiniProgram = !isByteDanceMicroApp && !isUndef(typeof wx) && wx !== null && (!isUndef(typeof wx.login) || !isUndef(typeof wx.miniProgram)); | ||
var isQuickApp = !isUndef(typeof global) && global !== null && !isUndef(typeof global.callNative) && !isWeex; | ||
var index = { | ||
isWeb: isWeb, | ||
isNode: isNode, | ||
isWeex: isWeex, | ||
isKraken: isKraken, | ||
isMiniApp: isMiniApp, | ||
isByteDanceMicroApp: isByteDanceMicroApp, | ||
isBaiduSmartProgram: isBaiduSmartProgram, | ||
isKuaiShouMiniProgram: isKuaiShouMiniProgram, | ||
isWeChatMiniProgram: isWeChatMiniProgram, | ||
isQuickApp: isQuickApp | ||
}; | ||
var isWeb = !isUndef(typeof window) && 'onload' in window; | ||
exports.isWeb = isWeb; | ||
var isNode = !isUndef(typeof process) && !!(process.versions && process.versions.node); | ||
exports.isNode = isNode; | ||
var isWeex = !isUndef(typeof WXEnvironment) && WXEnvironment.platform !== 'Web'; | ||
exports.isWeex = isWeex; | ||
var isKraken = !isUndef(typeof __kraken__); | ||
exports.isKraken = isKraken; | ||
var isMiniApp = !isUndef(typeof my) && my !== null && !isUndef(typeof my.alert); | ||
exports.isMiniApp = isMiniApp; | ||
var isByteDanceMicroApp = !isUndef(typeof tt) && tt !== null && !isUndef(typeof tt) && !isUndef(tt.showToast); // In wechat mini program, wx.login is a function | ||
// In wechat mini propgram webview, there is no wx.login, but exist wx.miniProgram | ||
// In bytedance maicro app, there is wx variable. | ||
var es = { | ||
__proto__: null, | ||
isWeb: isWeb, | ||
isNode: isNode, | ||
isWeex: isWeex, | ||
isKraken: isKraken, | ||
isMiniApp: isMiniApp, | ||
isByteDanceMicroApp: isByteDanceMicroApp, | ||
isBaiduSmartProgram: isBaiduSmartProgram, | ||
isKuaiShouMiniProgram: isKuaiShouMiniProgram, | ||
isWeChatMiniProgram: isWeChatMiniProgram, | ||
isQuickApp: isQuickApp, | ||
'default': index | ||
}; | ||
exports.isByteDanceMicroApp = isByteDanceMicroApp; | ||
var isWeChatMiniProgram = !isByteDanceMicroApp && !isUndef(typeof wx) && wx !== null && (!isUndef(typeof wx.login) || !isUndef(typeof wx.miniProgram)); | ||
exports.isWeChatMiniProgram = isWeChatMiniProgram; | ||
var isQuickApp = !isUndef(typeof commonjsGlobal) && commonjsGlobal !== null && !isUndef(typeof commonjsGlobal.callNative) && !isWeex; | ||
exports.isQuickApp = isQuickApp; | ||
}); | ||
var _env = /*@__PURE__*/getAugmentedNamespace(es); | ||
@@ -54,152 +84,163 @@ var lib = createCommonjsModule(function (module, exports) { | ||
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.setUnitPrecision = setUnitPrecision; | ||
exports.cached = cached; | ||
exports.setTargetPlatform = setTargetPlatform; | ||
exports.convertUnit = void 0; | ||
var RPX_REG = /"[^"]+"|'[^']+'|url\([^\)]+\)|(\d*\.?\d+)rpx/g; | ||
Object.keys(_env).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _env[key]) return; | ||
exports[key] = _env[key]; | ||
}); | ||
}); | ||
var __rpx_coefficient__; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
var __viewport_width__; // convertUnit method targetPlatform | ||
return obj; | ||
} | ||
var RPX_REG = /"[^"]+"|'[^']+'|url\([^\)]+\)|(\d*\.?\d+)rpx/g; | ||
var __rpx_coefficient__; | ||
var targetPlatform = lib$1.isWeb ? 'web' : lib$1.isWeex ? 'weex' : ''; // Init toFixed method | ||
var __viewport_width__; // convertUnit method targetPlatform | ||
var unitPrecision = 4; | ||
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. | ||
var targetPlatform = lib.isWeb ? 'web' : lib.isWeex ? 'weex' : ''; // Init toFixed method | ||
var unitPrecision = 4; | ||
var decimalPixelTransformer = function decimalPixelTransformer(rpx, $1) { | ||
return $1 ? parseFloat(rpx) * getRpx() + 'px' : rpx; | ||
}; // Default decimal vw transformer. | ||
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. | ||
var decimalVWTransformer = function decimalVWTransformer(rpx, $1) { | ||
return $1 ? toFixed(parseFloat(rpx) / (getViewportWidth() / 100), unitPrecision) + 'vw' : rpx; | ||
}; // Default 1 rpx to 1 px | ||
var decimalPixelTransformer = function decimalPixelTransformer(rpx, $1) { | ||
return $1 ? parseFloat(rpx) * getRpx() + 'px' : rpx; | ||
}; // Default decimal vw transformer. | ||
if (getRpx() === undefined) { | ||
setRpx(1); | ||
} // Viewport width, default to 750. | ||
var decimalVWTransformer = function decimalVWTransformer(rpx, $1) { | ||
return $1 ? toFixed(parseFloat(rpx) / (getViewportWidth() / 100), unitPrecision) + 'vw' : rpx; | ||
}; // Default 1 rpx to 1 px | ||
if (getViewportWidth() === undefined) { | ||
setViewportWidth(750); | ||
} | ||
/** | ||
* Is string contains rpx | ||
* note: rpx is an alias to rpx | ||
* @param {String} str | ||
* @returns {Boolean} | ||
*/ | ||
if (getRpx() === undefined) { | ||
setRpx(1); | ||
} // Viewport width, default to 750. | ||
function isRpx(str) { | ||
return typeof str === 'string' && RPX_REG.test(str); | ||
} | ||
/** | ||
* Calculate rpx | ||
* @param {String} str | ||
* @returns {String} | ||
*/ | ||
if (getViewportWidth() === undefined) { | ||
setViewportWidth(750); | ||
} | ||
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; | ||
} | ||
var CustomMap = /*#__PURE__*/function () { | ||
function CustomMap() { | ||
_defineProperty(this, "__store", {}); | ||
} | ||
function getRpx() { | ||
return __rpx_coefficient__; | ||
} | ||
var _proto = CustomMap.prototype; | ||
function setRpx(rpx) { | ||
__rpx_coefficient__ = rpx; | ||
} | ||
_proto.set = function set(key, value) { | ||
this.__store[key + "_" + typeof key] = value; | ||
}; | ||
function getViewportWidth() { | ||
return __viewport_width__; | ||
} | ||
_proto.get = function get(key) { | ||
return this.__store[key + "_" + typeof key]; | ||
}; | ||
function setViewportWidth(viewport) { | ||
__viewport_width__ = viewport; | ||
} | ||
/** | ||
* Set a function to transform unit of pixel, | ||
* default to passthrough. | ||
* @param {Function} transformer function | ||
*/ | ||
_proto.has = function has(key) { | ||
return Object.prototype.hasOwnProperty.call(this.__store, key + "_" + typeof key); | ||
}; | ||
return CustomMap; | ||
}(); | ||
/** | ||
* Is string contains rpx | ||
* note: rpx is an alias to rpx | ||
* @param {String} str | ||
* @returns {Boolean} | ||
*/ | ||
function setDecimalPixelTransformer(transformer) { | ||
decimalPixelTransformer = transformer; | ||
} | ||
/** | ||
* Set unit precision. | ||
* @param n {Number} Unit precision, default to 4. | ||
*/ | ||
function isRpx(str) { | ||
return typeof str === 'string' && RPX_REG.test(str); | ||
} | ||
/** | ||
* Calculate rpx | ||
* @param {String} str | ||
* @returns {String} | ||
*/ | ||
function setUnitPrecision(n) { | ||
unitPrecision = n; | ||
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; | ||
} | ||
/** | ||
* Create a cached version of a pure function. | ||
* Use the first params as cache key. | ||
*/ | ||
} | ||
function getRpx() { | ||
return __rpx_coefficient__; | ||
} | ||
function setRpx(rpx) { | ||
__rpx_coefficient__ = rpx; | ||
} | ||
function getViewportWidth() { | ||
return __viewport_width__; | ||
} | ||
function setViewportWidth(viewport) { | ||
__viewport_width__ = viewport; | ||
} | ||
/** | ||
* Set unit precision. | ||
* @param n {Number} Unit precision, default to 4. | ||
*/ | ||
function setUnitPrecision(n) { | ||
unitPrecision = n; | ||
} | ||
/** | ||
* Create a cached version of a pure function. | ||
* Use the first params as cache key. | ||
*/ | ||
function cached(fn) { | ||
var cache = new Map(); | ||
return function cachedFn() { | ||
var key = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (!cache.has(key)) cache.set(key, fn.apply(void 0, arguments)); | ||
return cache.get(key); | ||
}; | ||
} | ||
function cached(fn) { | ||
var cache = new CustomMap(); | ||
return function cachedFn() { | ||
var key = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (!cache.has(key)) cache.set(key, fn.apply(void 0, arguments)); | ||
return cache.get(key); | ||
}; | ||
} | ||
function setTargetPlatform(platform) { | ||
targetPlatform = platform; | ||
} | ||
/** | ||
* Convert rpx. | ||
* @param value | ||
* @param prop | ||
* @param platform | ||
* @return {String} Transformed value. | ||
*/ | ||
function setTargetPlatform(platform) { | ||
targetPlatform = platform; | ||
var convertUnit = cached(function (value, prop, platform) { | ||
if (platform) { | ||
setTargetPlatform(platform); | ||
} | ||
/** | ||
* Convert rpx. | ||
* @param value | ||
* @param prop | ||
* @param platform | ||
* @return {String} Transformed value. | ||
*/ | ||
var convertUnit = cached(function (value, prop, platform) { | ||
if (platform) { | ||
setTargetPlatform(platform); | ||
} | ||
return isRpx(value) ? calcRpx(value) : value; | ||
}); | ||
exports.convertUnit = convertUnit; | ||
return isRpx(value) ? calcRpx(value) : value; | ||
}); | ||
@@ -346,3 +387,3 @@ | ||
var camelizeStyleName = lib.cached(function (name) { | ||
var camelizeStyleName = cached(function (name) { | ||
return name.replace(/-([a-z])/gi, function (s, g) { | ||
@@ -352,6 +393,6 @@ return g.toUpperCase(); | ||
}); | ||
var isDimensionalProp = lib.cached(function (prop) { | ||
var isDimensionalProp = cached(function (prop) { | ||
return !NON_DIMENSIONAL_REG.test(prop); | ||
}); | ||
var isEventProp = lib.cached(function (prop) { | ||
var isEventProp = cached(function (prop) { | ||
return EVENT_PREFIX_REG.test(prop); | ||
@@ -485,7 +526,11 @@ }); | ||
// Prop name get from node style is hyphenated, eg: background-color | ||
var stylePropName = hydrationChild.style[l - 1]; | ||
var camelizedStyleName = camelizeStyleName(stylePropName); | ||
var stylePropName = hydrationChild.style[l - 1]; // Style with webkit prefix, will cause stylePropName be undefined in iOS 10.1 and 10.2. | ||
// Eg. when set transition-timing-function to be empty, it will also delete -webkit-transition-timing-function. | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
if (stylePropName) { | ||
var camelizedStyleName = camelizeStyleName(stylePropName); | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
} | ||
} | ||
@@ -628,3 +673,3 @@ } | ||
convertedValue = lib.convertUnit(convertedValue); | ||
convertedValue = convertUnit(convertedValue); | ||
} else { | ||
@@ -634,3 +679,3 @@ convertedValue = value + 'px'; | ||
} else { | ||
convertedValue = lib.convertUnit(value); | ||
convertedValue = convertUnit(value); | ||
} // Support CSS custom properties (variables) like { --main-color: "black" } | ||
@@ -721,4 +766,4 @@ | ||
exports.setTagNamePrefix = setTagNamePrefix; | ||
exports.setUnitPrecision = lib.setUnitPrecision; | ||
exports.setViewportWidth = lib.setViewportWidth; | ||
exports.setUnitPrecision = setUnitPrecision; | ||
exports.setViewportWidth = setViewportWidth; | ||
exports.updateText = updateText; | ||
@@ -725,0 +770,0 @@ |
@@ -1,2 +0,2 @@ | ||
var DriverDOM=function(n){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(n,r,t){return n(t={path:r,exports:{},require:function(){return function(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},t.exports),t.exports}var e=t((function(n,t){function e(n){return"undefined"===n}t.t=!0,t.isQuickApp=t.isWeChatMiniProgram=t.isByteDanceMicroApp=t.isMiniApp=t.isKraken=t.isWeex=t.isNode=t.isWeb=void 0;var o=!e(typeof window)&&"onload"in window;t.isWeb=o;var u=!e(typeof process)&&!(!process.versions||!process.versions.node);t.isNode=u;var i=!e(typeof WXEnvironment)&&"Web"!==WXEnvironment.platform;t.isWeex=i;var f=!e(typeof __kraken__);t.isKraken=f;var c=!e(typeof my)&&null!==my&&!e(typeof my.alert);t.isMiniApp=c;var l=!e(typeof tt)&&null!==tt&&!e(typeof tt)&&!e(tt.showToast);t.isByteDanceMicroApp=l;var a=!(l||e(typeof wx)||null===wx||e(typeof wx.login)&&e(typeof wx.miniProgram));t.isWeChatMiniProgram=a;var v=!e(typeof r)&&null!==r&&!e(typeof r.callNative)&&!i;t.isQuickApp=v})),o=t((function(n,r){r.t=!0,r.isRpx=a,r.calcRpx=v,r.getRpx=d,r.setRpx=s,r.getViewportWidth=p,r.setViewportWidth=y,r.setDecimalPixelTransformer=function(n){c=n},r.setUnitPrecision=function(n){f=n},r.cached=w,r.setTargetPlatform=m,r.convertUnit=void 0;var t,o,u=/"[^"]+"|'[^']+'|url\([^\)]+\)|(\d*\.?\d+)rpx/g,i=e.isWeb?"web":e.isWeex?"weex":"",f=4,c=function(n,r){return r?parseFloat(n)*d()+"px":n},l=function(n,r){return r?(t=parseFloat(n)/(p()/100),10*Math.round(Math.floor(t*(e=Math.pow(10,f+1)))/10)/e+"vw"):n;var t,e};function a(n){return"string"==typeof n&&u.test(n)}function v(n){return"web"===i?n.replace(u,l):"weex"===i?n.replace(u,c):n}function d(){return t}function s(n){t=n}function p(){return o}function y(n){o=n}function w(n){var r=new Map;return function(){var t=arguments.length<=0?void 0:arguments[0];return r.has(t)||r.set(t,n.apply(void 0,arguments)),r.get(t)}}function m(n){i=n}void 0===d()&&s(1),void 0===p()&&y(750);var g=w((function(n,r,t){return t&&m(t),a(n)?v(n):n}));r.convertUnit=g})),u=/opa|ntw|ne[ch]|ex(?:s|g|n|p|$)|^ord|zoo|grid|orp|ows|mnc|^columns$|bs|erim|onit/i,i=/^on[A-Z]/,f="dangerouslySetInnerHTML",c="__html",l="className",a="class",v="style",d="http://www.w3.org/2000/svg",s="",p=s,y=!1,w=!1,m=o.cached((function(n){return n.replace(/-([a-z])/gi,(function(n,r){return r.toUpperCase()}))})),g=o.cached((function(n){return!u.test(n)})),h=o.cached((function(n){return i.test(n)}));function b(n){var r=n.childNodes;null==n.o&&(n.o=0);var t=r[n.o++];return t&&8===t.nodeType&&"|"===t.data?r[n.o++]:t}function x(n,r){if(!w||n.u)return r.appendChild(n)}function _(n,r,t){(t=t||r.parentNode).replaceChild(n,r)}function M(n,r,t){(t=t||r.parentNode).insertBefore(n,r)}function E(n,r,t){return n.addEventListener(r,t)}function j(n,r,t,e){if(r===f)return n.innerHTML!==t[c]&&(n.innerHTML=t[c]),void(n.i=!0);if(r===l&&(r=a),!e&&r in n)try{n[r]=t}catch(e){n.setAttribute(r,t)}else n.setAttribute(r,t)}function D(n,r,t){for(var e in r){var u=r[e],i=void 0;i="number"==typeof u&&g(e)?t?o.convertUnit(i=u+"rpx"):u+"px":o.convertUnit(u),"-"===e[0]&&"-"===e[1]?n.style.setProperty(e,i):n.style[e]=i}}function O(n){if(!n.i){var r=n.childNodes.length,t=n.o||0;if(r-t>0)for(var e=r-1;e>=t;e--)n.removeChild(n.childNodes[e]);for(var o=n.childNodes.length-1;o>=0;o--)O(n.childNodes[o])}}return n.addEventListener=E,n.afterRender=function(n){w&&(O(n.container),w=!1)},n.appendChild=x,n.beforeRender=function(n){var r=n.hydrate;if(w&&!r)throw Error("Nested render found.");w=r},n.createBody=function(){return document.body},n.createElement=function(n,r,t,e){var o,u=t._parent;y="svg"===n||u&&u.namespaceURI===d;var i=null;function f(){if(y)o=document.createElementNS(d,n);else if(p){var r="function"==typeof r?r(n):r;o=document.createElement(r+n)}else o=document.createElement(n)}if(w)if(i=b(u))if(n===i.nodeName.toLowerCase()){for(var c=i.attributes,l=c.length;l--;){var g=c[l].name,x=r[g];if(g===a&&null==r.className&&null==x||g===v&&(null==x||0===Object.keys(x).length)||g!==a&&g!==v&&null==x)i.removeAttribute(g);else if(g===v)for(var M=i.style.length;0<M;M--){var O=m(i.style[M-1]);null==x[O]&&(i.style[O]=s)}}o=i}else f(),_(o,i,u);else f(),o.u=!0;else f();for(var T in r){var W=r[T];"children"!==T&&(null!=W&&(T===v?D(o,W,e):h(T)?E(o,T.slice(2).toLowerCase(),W):j(o,T,W,y)))}return o},n.createEmpty=function(n){var r,t=n._parent;if(w){var e=b(t);if(e){if(8===e.nodeType)return e;_(r=document.createComment(s),e,t)}else(r=document.createComment(s)).u=!0}else r=document.createComment(s);return r},n.createText=function(n,r){var t,e=r._parent;if(w){var o=b(e);if(o){if(3===o.nodeType)return n!==o.textContent&&(o.textContent=n),o;_(t=document.createTextNode(n),o,e)}else(t=document.createTextNode(n)).u=!0}else t=document.createTextNode(n);return t},n.insertAfter=function(n,r,t){t=t||r.parentNode;var e=r.nextSibling;e?e!==n&&M(n,e,t):x(n,t)},n.insertBefore=M,n.removeAttribute=function(n,r){if(r===f)return n.innerHTML=null;if(r===l&&(r=a),r in n)try{n[r]=null}catch(n){}n.removeAttribute(r)},n.removeChild=function(n,r){(r=r||n.parentNode)&&r.removeChild(n)},n.removeChildren=function(n){n.textContent=s},n.removeEventListener=function(n,r,t){return n.removeEventListener(r,t)},n.replaceChild=_,n.setAttribute=j,n.setStyle=D,n.setTagNamePrefix=function(n){p=n},n.setUnitPrecision=o.setUnitPrecision,n.setViewportWidth=o.setViewportWidth,n.updateText=function(n,r){n.textContent=r},Object.defineProperty(n,"t",{value:!0}),n}({}); | ||
var DriverDOM=function(n){function t(n){if(n.t)return n;var t=Object.defineProperty({},"t",{value:!0});return Object.keys(n).forEach((function(r){var e=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,e.get?e:{enumerable:!0,get:function(){return n[r]}})})),t}function r(n){return"undefined"===n}var e,o,i=!r(typeof window)&&"onload"in window,u=!r(typeof process)&&!(!process.versions||!process.versions.node),f=!r(typeof WXEnvironment)&&"Web"!==WXEnvironment.platform,c=!r(typeof __kraken__),a=!r(typeof my)&&null!==my&&!r(typeof my.alert),l=!r(typeof tt)&&null!==tt&&!r(typeof tt)&&!r(tt.showToast),s=!r(typeof swan)&&null!==swan&&!r(typeof swan)&&!r(swan.showToast),p=!r(typeof ks)&&null!==ks&&!r(typeof ks)&&!r(ks.showToast),v=!(l||r(typeof wx)||null===wx||r(typeof wx.login)&&r(typeof wx.miniProgram)),d=!r(typeof global)&&null!==global&&!r(typeof global.callNative)&&!f,y=t({__proto__:null,isWeb:i,isNode:u,isWeex:f,isKraken:c,isMiniApp:a,isByteDanceMicroApp:l,isBaiduSmartProgram:s,isKuaiShouMiniProgram:p,isWeChatMiniProgram:v,isQuickApp:d,default:{isWeb:i,isNode:u,isWeex:f,isKraken:c,isMiniApp:a,isByteDanceMicroApp:l,isBaiduSmartProgram:s,isKuaiShouMiniProgram:p,isWeChatMiniProgram:v,isQuickApp:d}}),m=(function(n,t){t.t=!0,Object.keys(y).forEach((function(n){"default"!==n&&"__esModule"!==n&&(n in t&&t[n]===y[n]||(t[n]=y[n]))}))}(o={path:e,exports:{},require:function(){return function(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},o.exports),o.exports);var w,b,g=/"[^"]+"|'[^']+'|url\([^\)]+\)|(\d*\.?\d+)rpx/g,_=m.isWeb?"web":m.isWeex?"weex":"",h=4,M=function(n,t){return t?parseFloat(n)*k()+"px":n},x=function(n,t){return t?(r=parseFloat(n)/(O()/100),10*Math.round(Math.floor(r*(e=Math.pow(10,h+1)))/10)/e+"vw"):n;var r,e};void 0===k()&&(w=1),void 0===O()&&W(750);var j=function(){function n(){var n,t,r;r={},(t="__store")in(n=this)?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r}var t=n.prototype;return t.set=function(n,t){this.o[n+"_"+typeof n]=t},t.get=function(n){return this.o[n+"_"+typeof n]},t.has=function(n){return Object.prototype.hasOwnProperty.call(this.o,n+"_"+typeof n)},n}();function k(){return w}function O(){return b}function W(n){b=n}function A(n){var t=new j;return function(){var r=arguments.length<=0?void 0:arguments[0];return t.has(r)||t.set(r,n.apply(void 0,arguments)),t.get(r)}}var P=A((function(n,t,r){return r&&function(n){_=n}(r),"string"==typeof(e=n)&&g.test(e)?function(n){return"web"===_?n.replace(g,x):"weex"===_?n.replace(g,M):n}(n):n;var e})),D=/opa|ntw|ne[ch]|ex(?:s|g|n|p|$)|^ord|zoo|grid|orp|ows|mnc|^columns$|bs|erim|onit/i,S=/^on[A-Z]/,B="dangerouslySetInnerHTML",E="__html",K="className",N="class",q="style",z="http://www.w3.org/2000/svg",C="",F=C,Q=!1,X=!1,$=A((function(n){return n.replace(/-([a-z])/gi,(function(n,t){return t.toUpperCase()}))})),H=A((function(n){return!D.test(n)})),I=A((function(n){return S.test(n)}));function L(n){var t=n.childNodes;null==n.i&&(n.i=0);var r=t[n.i++];return r&&8===r.nodeType&&"|"===r.data?t[n.i++]:r}function T(n,t){if(!X||n.u)return t.appendChild(n)}function Z(n,t,r){(r=r||t.parentNode).replaceChild(n,t)}function G(n,t,r){(r=r||t.parentNode).insertBefore(n,t)}function J(n,t,r){return n.addEventListener(t,r)}function R(n,t,r,e){if(t===B)return n.innerHTML!==r[E]&&(n.innerHTML=r[E]),void(n.l=!0);if(t===K&&(t=N),!e&&t in n)try{n[t]=r}catch(e){n.setAttribute(t,r)}else n.setAttribute(t,r)}function U(n,t,r){for(var e in t){var o=t[e],i=void 0;i="number"==typeof o&&H(e)?r?P(i=o+"rpx"):o+"px":P(o),"-"===e[0]&&"-"===e[1]?n.style.setProperty(e,i):n.style[e]=i}}function V(n){if(!n.l){var t=n.childNodes.length,r=n.i||0;if(t-r>0)for(var e=t-1;e>=r;e--)n.removeChild(n.childNodes[e]);for(var o=n.childNodes.length-1;o>=0;o--)V(n.childNodes[o])}}return n.addEventListener=J,n.afterRender=function(n){X&&(V(n.container),X=!1)},n.appendChild=T,n.beforeRender=function(n){var t=n.hydrate;if(X&&!t)throw Error("Nested render found.");X=t},n.createBody=function(){return document.body},n.createElement=function(n,t,r,e){var o,i=r._parent;Q="svg"===n||i&&i.namespaceURI===z;var u=null;function f(){if(Q)o=document.createElementNS(z,n);else if(F){var t="function"==typeof t?t(n):t;o=document.createElement(t+n)}else o=document.createElement(n)}if(X)if(u=L(i))if(n===u.nodeName.toLowerCase()){for(var c=u.attributes,a=c.length;a--;){var l=c[a].name,s=t[l];if(l===N&&null==t.className&&null==s||l===q&&(null==s||0===Object.keys(s).length)||l!==N&&l!==q&&null==s)u.removeAttribute(l);else if(l===q)for(var p=u.style.length;0<p;p--){var v=u.style[p-1];if(v){var d=$(v);null==s[d]&&(u.style[d]=C)}}}o=u}else f(),Z(o,u,i);else f(),o.u=!0;else f();for(var y in t){var m=t[y];"children"!==y&&(null!=m&&(y===q?U(o,m,e):I(y)?J(o,y.slice(2).toLowerCase(),m):R(o,y,m,Q)))}return o},n.createEmpty=function(n){var t,r=n._parent;if(X){var e=L(r);if(e){if(8===e.nodeType)return e;Z(t=document.createComment(C),e,r)}else(t=document.createComment(C)).u=!0}else t=document.createComment(C);return t},n.createText=function(n,t){var r,e=t._parent;if(X){var o=L(e);if(o){if(3===o.nodeType)return n!==o.textContent&&(o.textContent=n),o;Z(r=document.createTextNode(n),o,e)}else(r=document.createTextNode(n)).u=!0}else r=document.createTextNode(n);return r},n.insertAfter=function(n,t,r){r=r||t.parentNode;var e=t.nextSibling;e?e!==n&&G(n,e,r):T(n,r)},n.insertBefore=G,n.removeAttribute=function(n,t){if(t===B)return n.innerHTML=null;if(t===K&&(t=N),t in n)try{n[t]=null}catch(n){}n.removeAttribute(t)},n.removeChild=function(n,t){(t=t||n.parentNode)&&t.removeChild(n)},n.removeChildren=function(n){n.textContent=C},n.removeEventListener=function(n,t,r){return n.removeEventListener(t,r)},n.replaceChild=Z,n.setAttribute=R,n.setStyle=U,n.setTagNamePrefix=function(n){F=n},n.setUnitPrecision=function(n){h=n},n.setViewportWidth=W,n.updateText=function(n,t){n.textContent=t},Object.defineProperty(n,"t",{value:!0}),n}({}); | ||
//# sourceMappingURL=driver-dom.min.js.map |
@@ -6,4 +6,2 @@ (function (global, factory) { | ||
}(this, (function (exports) { | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function createCommonjsModule(fn, basedir, module) { | ||
@@ -19,2 +17,17 @@ return module = { | ||
function getAugmentedNamespace(n) { | ||
if (n.__esModule) return n; | ||
var a = Object.defineProperty({}, '__esModule', {value: true}); | ||
Object.keys(n).forEach(function (k) { | ||
var d = Object.getOwnPropertyDescriptor(n, k); | ||
Object.defineProperty(a, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return n[k]; | ||
} | ||
}); | ||
}); | ||
return a; | ||
} | ||
function commonjsRequire () { | ||
@@ -24,31 +37,48 @@ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); | ||
var lib$1 = createCommonjsModule(function (module, exports) { | ||
function isUndef(type) { | ||
return type === 'undefined'; | ||
} | ||
exports.__esModule = true; | ||
exports.isQuickApp = exports.isWeChatMiniProgram = exports.isByteDanceMicroApp = exports.isMiniApp = exports.isKraken = exports.isWeex = exports.isNode = exports.isWeb = void 0; | ||
var isWeb = !isUndef(typeof window) && 'onload' in window; | ||
var isNode = !isUndef(typeof process) && !!(process.versions && process.versions.node); | ||
var isWeex = !isUndef(typeof WXEnvironment) && WXEnvironment.platform !== 'Web'; | ||
var isKraken = !isUndef(typeof __kraken__); | ||
var isMiniApp = !isUndef(typeof my) && my !== null && !isUndef(typeof my.alert); | ||
var isByteDanceMicroApp = !isUndef(typeof tt) && tt !== null && !isUndef(typeof tt) && !isUndef(tt.showToast); | ||
var isBaiduSmartProgram = !isUndef(typeof swan) && swan !== null && !isUndef(typeof swan) && !isUndef(swan.showToast); | ||
var isKuaiShouMiniProgram = !isUndef(typeof ks) && ks !== null && !isUndef(typeof ks) && !isUndef(ks.showToast); // In wechat mini program, wx.login is a function | ||
// In wechat mini propgram webview, there is no wx.login, but exist wx.miniProgram | ||
// In bytedance maicro app, there is wx variable. | ||
function isUndef(type) { | ||
return type === 'undefined'; | ||
} | ||
var isWeChatMiniProgram = !isByteDanceMicroApp && !isUndef(typeof wx) && wx !== null && (!isUndef(typeof wx.login) || !isUndef(typeof wx.miniProgram)); | ||
var isQuickApp = !isUndef(typeof global) && global !== null && !isUndef(typeof global.callNative) && !isWeex; | ||
var index = { | ||
isWeb: isWeb, | ||
isNode: isNode, | ||
isWeex: isWeex, | ||
isKraken: isKraken, | ||
isMiniApp: isMiniApp, | ||
isByteDanceMicroApp: isByteDanceMicroApp, | ||
isBaiduSmartProgram: isBaiduSmartProgram, | ||
isKuaiShouMiniProgram: isKuaiShouMiniProgram, | ||
isWeChatMiniProgram: isWeChatMiniProgram, | ||
isQuickApp: isQuickApp | ||
}; | ||
var isWeb = !isUndef(typeof window) && 'onload' in window; | ||
exports.isWeb = isWeb; | ||
var isNode = !isUndef(typeof process) && !!(process.versions && process.versions.node); | ||
exports.isNode = isNode; | ||
var isWeex = !isUndef(typeof WXEnvironment) && WXEnvironment.platform !== 'Web'; | ||
exports.isWeex = isWeex; | ||
var isKraken = !isUndef(typeof __kraken__); | ||
exports.isKraken = isKraken; | ||
var isMiniApp = !isUndef(typeof my) && my !== null && !isUndef(typeof my.alert); | ||
exports.isMiniApp = isMiniApp; | ||
var isByteDanceMicroApp = !isUndef(typeof tt) && tt !== null && !isUndef(typeof tt) && !isUndef(tt.showToast); // In wechat mini program, wx.login is a function | ||
// In wechat mini propgram webview, there is no wx.login, but exist wx.miniProgram | ||
// In bytedance maicro app, there is wx variable. | ||
var es = { | ||
__proto__: null, | ||
isWeb: isWeb, | ||
isNode: isNode, | ||
isWeex: isWeex, | ||
isKraken: isKraken, | ||
isMiniApp: isMiniApp, | ||
isByteDanceMicroApp: isByteDanceMicroApp, | ||
isBaiduSmartProgram: isBaiduSmartProgram, | ||
isKuaiShouMiniProgram: isKuaiShouMiniProgram, | ||
isWeChatMiniProgram: isWeChatMiniProgram, | ||
isQuickApp: isQuickApp, | ||
'default': index | ||
}; | ||
exports.isByteDanceMicroApp = isByteDanceMicroApp; | ||
var isWeChatMiniProgram = !isByteDanceMicroApp && !isUndef(typeof wx) && wx !== null && (!isUndef(typeof wx.login) || !isUndef(typeof wx.miniProgram)); | ||
exports.isWeChatMiniProgram = isWeChatMiniProgram; | ||
var isQuickApp = !isUndef(typeof commonjsGlobal) && commonjsGlobal !== null && !isUndef(typeof commonjsGlobal.callNative) && !isWeex; | ||
exports.isQuickApp = isQuickApp; | ||
}); | ||
var _env = /*@__PURE__*/getAugmentedNamespace(es); | ||
@@ -58,152 +88,163 @@ var lib = createCommonjsModule(function (module, exports) { | ||
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.setUnitPrecision = setUnitPrecision; | ||
exports.cached = cached; | ||
exports.setTargetPlatform = setTargetPlatform; | ||
exports.convertUnit = void 0; | ||
var RPX_REG = /"[^"]+"|'[^']+'|url\([^\)]+\)|(\d*\.?\d+)rpx/g; | ||
Object.keys(_env).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _env[key]) return; | ||
exports[key] = _env[key]; | ||
}); | ||
}); | ||
var __rpx_coefficient__; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
var __viewport_width__; // convertUnit method targetPlatform | ||
return obj; | ||
} | ||
var RPX_REG = /"[^"]+"|'[^']+'|url\([^\)]+\)|(\d*\.?\d+)rpx/g; | ||
var __rpx_coefficient__; | ||
var targetPlatform = lib$1.isWeb ? 'web' : lib$1.isWeex ? 'weex' : ''; // Init toFixed method | ||
var __viewport_width__; // convertUnit method targetPlatform | ||
var unitPrecision = 4; | ||
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. | ||
var targetPlatform = lib.isWeb ? 'web' : lib.isWeex ? 'weex' : ''; // Init toFixed method | ||
var unitPrecision = 4; | ||
var decimalPixelTransformer = function decimalPixelTransformer(rpx, $1) { | ||
return $1 ? parseFloat(rpx) * getRpx() + 'px' : rpx; | ||
}; // Default decimal vw transformer. | ||
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. | ||
var decimalVWTransformer = function decimalVWTransformer(rpx, $1) { | ||
return $1 ? toFixed(parseFloat(rpx) / (getViewportWidth() / 100), unitPrecision) + 'vw' : rpx; | ||
}; // Default 1 rpx to 1 px | ||
var decimalPixelTransformer = function decimalPixelTransformer(rpx, $1) { | ||
return $1 ? parseFloat(rpx) * getRpx() + 'px' : rpx; | ||
}; // Default decimal vw transformer. | ||
if (getRpx() === undefined) { | ||
setRpx(1); | ||
} // Viewport width, default to 750. | ||
var decimalVWTransformer = function decimalVWTransformer(rpx, $1) { | ||
return $1 ? toFixed(parseFloat(rpx) / (getViewportWidth() / 100), unitPrecision) + 'vw' : rpx; | ||
}; // Default 1 rpx to 1 px | ||
if (getViewportWidth() === undefined) { | ||
setViewportWidth(750); | ||
} | ||
/** | ||
* Is string contains rpx | ||
* note: rpx is an alias to rpx | ||
* @param {String} str | ||
* @returns {Boolean} | ||
*/ | ||
if (getRpx() === undefined) { | ||
setRpx(1); | ||
} // Viewport width, default to 750. | ||
function isRpx(str) { | ||
return typeof str === 'string' && RPX_REG.test(str); | ||
} | ||
/** | ||
* Calculate rpx | ||
* @param {String} str | ||
* @returns {String} | ||
*/ | ||
if (getViewportWidth() === undefined) { | ||
setViewportWidth(750); | ||
} | ||
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; | ||
} | ||
var CustomMap = /*#__PURE__*/function () { | ||
function CustomMap() { | ||
_defineProperty(this, "__store", {}); | ||
} | ||
function getRpx() { | ||
return __rpx_coefficient__; | ||
} | ||
var _proto = CustomMap.prototype; | ||
function setRpx(rpx) { | ||
__rpx_coefficient__ = rpx; | ||
} | ||
_proto.set = function set(key, value) { | ||
this.__store[key + "_" + typeof key] = value; | ||
}; | ||
function getViewportWidth() { | ||
return __viewport_width__; | ||
} | ||
_proto.get = function get(key) { | ||
return this.__store[key + "_" + typeof key]; | ||
}; | ||
function setViewportWidth(viewport) { | ||
__viewport_width__ = viewport; | ||
} | ||
/** | ||
* Set a function to transform unit of pixel, | ||
* default to passthrough. | ||
* @param {Function} transformer function | ||
*/ | ||
_proto.has = function has(key) { | ||
return Object.prototype.hasOwnProperty.call(this.__store, key + "_" + typeof key); | ||
}; | ||
return CustomMap; | ||
}(); | ||
/** | ||
* Is string contains rpx | ||
* note: rpx is an alias to rpx | ||
* @param {String} str | ||
* @returns {Boolean} | ||
*/ | ||
function setDecimalPixelTransformer(transformer) { | ||
decimalPixelTransformer = transformer; | ||
} | ||
/** | ||
* Set unit precision. | ||
* @param n {Number} Unit precision, default to 4. | ||
*/ | ||
function isRpx(str) { | ||
return typeof str === 'string' && RPX_REG.test(str); | ||
} | ||
/** | ||
* Calculate rpx | ||
* @param {String} str | ||
* @returns {String} | ||
*/ | ||
function setUnitPrecision(n) { | ||
unitPrecision = n; | ||
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; | ||
} | ||
/** | ||
* Create a cached version of a pure function. | ||
* Use the first params as cache key. | ||
*/ | ||
} | ||
function getRpx() { | ||
return __rpx_coefficient__; | ||
} | ||
function setRpx(rpx) { | ||
__rpx_coefficient__ = rpx; | ||
} | ||
function getViewportWidth() { | ||
return __viewport_width__; | ||
} | ||
function setViewportWidth(viewport) { | ||
__viewport_width__ = viewport; | ||
} | ||
/** | ||
* Set unit precision. | ||
* @param n {Number} Unit precision, default to 4. | ||
*/ | ||
function setUnitPrecision(n) { | ||
unitPrecision = n; | ||
} | ||
/** | ||
* Create a cached version of a pure function. | ||
* Use the first params as cache key. | ||
*/ | ||
function cached(fn) { | ||
var cache = new Map(); | ||
return function cachedFn() { | ||
var key = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (!cache.has(key)) cache.set(key, fn.apply(void 0, arguments)); | ||
return cache.get(key); | ||
}; | ||
} | ||
function cached(fn) { | ||
var cache = new CustomMap(); | ||
return function cachedFn() { | ||
var key = arguments.length <= 0 ? undefined : arguments[0]; | ||
if (!cache.has(key)) cache.set(key, fn.apply(void 0, arguments)); | ||
return cache.get(key); | ||
}; | ||
} | ||
function setTargetPlatform(platform) { | ||
targetPlatform = platform; | ||
} | ||
/** | ||
* Convert rpx. | ||
* @param value | ||
* @param prop | ||
* @param platform | ||
* @return {String} Transformed value. | ||
*/ | ||
function setTargetPlatform(platform) { | ||
targetPlatform = platform; | ||
var convertUnit = cached(function (value, prop, platform) { | ||
if (platform) { | ||
setTargetPlatform(platform); | ||
} | ||
/** | ||
* Convert rpx. | ||
* @param value | ||
* @param prop | ||
* @param platform | ||
* @return {String} Transformed value. | ||
*/ | ||
var convertUnit = cached(function (value, prop, platform) { | ||
if (platform) { | ||
setTargetPlatform(platform); | ||
} | ||
return isRpx(value) ? calcRpx(value) : value; | ||
}); | ||
exports.convertUnit = convertUnit; | ||
return isRpx(value) ? calcRpx(value) : value; | ||
}); | ||
@@ -350,3 +391,3 @@ | ||
var camelizeStyleName = lib.cached(function (name) { | ||
var camelizeStyleName = cached(function (name) { | ||
return name.replace(/-([a-z])/gi, function (s, g) { | ||
@@ -356,6 +397,6 @@ return g.toUpperCase(); | ||
}); | ||
var isDimensionalProp = lib.cached(function (prop) { | ||
var isDimensionalProp = cached(function (prop) { | ||
return !NON_DIMENSIONAL_REG.test(prop); | ||
}); | ||
var isEventProp = lib.cached(function (prop) { | ||
var isEventProp = cached(function (prop) { | ||
return EVENT_PREFIX_REG.test(prop); | ||
@@ -489,7 +530,11 @@ }); | ||
// Prop name get from node style is hyphenated, eg: background-color | ||
var stylePropName = hydrationChild.style[l - 1]; | ||
var camelizedStyleName = camelizeStyleName(stylePropName); | ||
var stylePropName = hydrationChild.style[l - 1]; // Style with webkit prefix, will cause stylePropName be undefined in iOS 10.1 and 10.2. | ||
// Eg. when set transition-timing-function to be empty, it will also delete -webkit-transition-timing-function. | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
if (stylePropName) { | ||
var camelizedStyleName = camelizeStyleName(stylePropName); | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
} | ||
} | ||
@@ -632,3 +677,3 @@ } | ||
convertedValue = lib.convertUnit(convertedValue); | ||
convertedValue = convertUnit(convertedValue); | ||
} else { | ||
@@ -638,3 +683,3 @@ convertedValue = value + 'px'; | ||
} else { | ||
convertedValue = lib.convertUnit(value); | ||
convertedValue = convertUnit(value); | ||
} // Support CSS custom properties (variables) like { --main-color: "black" } | ||
@@ -725,4 +770,4 @@ | ||
exports.setTagNamePrefix = setTagNamePrefix; | ||
exports.setUnitPrecision = lib.setUnitPrecision; | ||
exports.setViewportWidth = lib.setViewportWidth; | ||
exports.setUnitPrecision = setUnitPrecision; | ||
exports.setViewportWidth = setViewportWidth; | ||
exports.updateText = updateText; | ||
@@ -729,0 +774,0 @@ |
@@ -194,7 +194,11 @@ /** | ||
// Prop name get from node style is hyphenated, eg: background-color | ||
var stylePropName = hydrationChild.style[l - 1]; | ||
var camelizedStyleName = camelizeStyleName(stylePropName); | ||
var stylePropName = hydrationChild.style[l - 1]; // Style with webkit prefix, will cause stylePropName be undefined in iOS 10.1 and 10.2. | ||
// Eg. when set transition-timing-function to be empty, it will also delete -webkit-transition-timing-function. | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
if (stylePropName) { | ||
var camelizedStyleName = camelizeStyleName(stylePropName); | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
} | ||
} | ||
@@ -201,0 +205,0 @@ } |
@@ -227,7 +227,11 @@ "use strict"; | ||
// Prop name get from node style is hyphenated, eg: background-color | ||
var stylePropName = hydrationChild.style[l - 1]; | ||
var camelizedStyleName = camelizeStyleName(stylePropName); | ||
var stylePropName = hydrationChild.style[l - 1]; // Style with webkit prefix, will cause stylePropName be undefined in iOS 10.1 and 10.2. | ||
// Eg. when set transition-timing-function to be empty, it will also delete -webkit-transition-timing-function. | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
if (stylePropName) { | ||
var camelizedStyleName = camelizeStyleName(stylePropName); | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
} | ||
} | ||
@@ -234,0 +238,0 @@ } |
{ | ||
"name": "driver-dom", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "DOM driver for Rax", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
@@ -203,6 +203,10 @@ /** | ||
// Prop name get from node style is hyphenated, eg: background-color | ||
let stylePropName = hydrationChild.style[l - 1]; | ||
let camelizedStyleName = camelizeStyleName(stylePropName); | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
const stylePropName = hydrationChild.style[l - 1]; | ||
// Style with webkit prefix, will cause stylePropName be undefined in iOS 10.1 and 10.2. | ||
// Eg. when set transition-timing-function to be empty, it will also delete -webkit-transition-timing-function. | ||
if (stylePropName) { | ||
const camelizedStyleName = camelizeStyleName(stylePropName); | ||
if (propValue[camelizedStyleName] == null) { | ||
hydrationChild.style[camelizedStyleName] = EMPTY; | ||
} | ||
} | ||
@@ -209,0 +213,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
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
298947
3846