Comparing version 1.1.9 to 1.2.0
@@ -5,7 +5,8 @@ # Changelog | ||
## [1.1.9] 2018-02-04 | ||
## [1.2.0] 2018-02-21 | ||
### Fixed | ||
### Added | ||
- Returning `scrollTop` correctly [PR #8](https://github.com/Popmotion/stylefire/pull/8) | ||
- `styler` maintains an internal cache of stylers. If a node is passed for the second time, it will return the previously-create styler. | ||
- `translate-origin-x` and `translate-origin-y` default prop types now `percent`. | ||
@@ -12,0 +13,0 @@ ## [1.1.8] 2018-01-03 |
@@ -42,5 +42,5 @@ "use strict"; | ||
}); | ||
exports.default = (function (element, props) { | ||
exports.default = function (element, props) { | ||
return cssStyler(__assign({ element: element, enableHardwareAcceleration: true }, props)); | ||
}); | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -21,3 +21,3 @@ "use strict"; | ||
}; | ||
exports.default = (function (key, asDashCase) { | ||
exports.default = function (key, asDashCase) { | ||
if (asDashCase === void 0) { asDashCase = false; } | ||
@@ -28,3 +28,3 @@ var cache = asDashCase ? dashCache : camelCache; | ||
return cache[key]; | ||
}); | ||
}; | ||
//# sourceMappingURL=prefixer.js.map |
@@ -39,5 +39,7 @@ "use strict"; | ||
perspective: style_value_types_1.px, | ||
opacity: style_value_types_1.alpha | ||
opacity: style_value_types_1.alpha, | ||
'transform-origin-x': style_value_types_1.percent, | ||
'transform-origin-y': style_value_types_1.percent | ||
}; | ||
exports.default = (function (key) { return valueTypes[key]; }); | ||
exports.default = function (key) { return valueTypes[key]; }; | ||
//# sourceMappingURL=value-types.js.map |
@@ -1,1 +0,1 @@ | ||
!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9),a=function(e){var t=e.onRead,r=e.onRender,a=e.aliasMap,o=void 0===a?{}:a,u=e.useCache,s=void 0===u||u;return function(e){var a={},u=[],i=!1,c=function(e,t){var r=o[e]||e,s=a[r];a[r]=t,a[r]!==s&&(i=!0,-1===u.indexOf(r)&&u.push(r)),i&&n.onFrameRender(l)},l=function(){r(a,e,u),i=!1,u.length=0};return{get:function(r){var n=o[r]||r;return n?s&&void 0!==a[n]?a[n]:t(n,e):a},set:function(e,t){if("string"==typeof e){if(void 0===t)return function(t){return c(e,t)};c(e,t)}else for(var r in e)e.hasOwnProperty(r)&&c(r,e[r]);return this},render:function(e){return void 0===e&&(e=!1),(e||i)&&l(),this}}}};t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=["","X","Y","Z"],a=["translate","scale","rotate","skew","transformPerspective"],o=a.reduce(function(e,t){return n.reduce(function(e,r){return e.push(t+r),e},e)},["x","y","z"]),u=o.reduce(function(e,t){return e[t]=!0,e},{});t.isTransformProp=function(e){return!0===u[e]},t.sortTransformProps=function(e,t){return o.indexOf(e)-o.indexOf(t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=/([a-z])([A-Z])/g;t.camelToDash=function(e){return e.replace(n,"$1-$2").toLowerCase()},t.setDomAttrs=function(e,t){for(var r in t)t.hasOwnProperty(r)&&e.setAttribute(r,t[r])}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,a=r(2),o={},u={},s=["Webkit","Moz","O","ms",""],i=s.length,c=function(e){n=n||document.createElement("div");for(var t=0;t<i;t++){var r=s[t],c=""===r,l=c?e:r+e.charAt(0).toUpperCase()+e.slice(1);l in n.style&&(o[e]=l,u[e]=(c?"":"-")+a.camelToDash(l))}};t.default=function(e,t){void 0===t&&(t=!1);var r=t?u:o;return r[e]||c(e),r[e]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),a={color:n.color,backgroundColor:n.color,outlineColor:n.color,fill:n.color,stroke:n.color,borderColor:n.color,borderTopColor:n.color,borderRightColor:n.color,borderBottomColor:n.color,borderLeftColor:n.color,borderRadius:n.px,width:n.px,maxWidth:n.px,height:n.px,maxHeight:n.px,top:n.px,left:n.px,bottom:n.px,right:n.px,rotate:n.degrees,rotateX:n.degrees,rotateY:n.degrees,rotateZ:n.degrees,scale:n.scale,scaleX:n.scale,scaleY:n.scale,scaleZ:n.scale,skewX:n.degrees,skewY:n.degrees,distance:n.px,translateX:n.px,translateY:n.px,translateZ:n.px,perspective:n.px,opacity:n.alpha};t.default=function(e){return a[e]}},function(e,t,r){"use strict";function n(e){var r=e.length;return function(n){for(var a={},o=t.splitCommaDelimited(t.getValueFromFunctionString(n)),u=0;u<r;u++)a[e[u]]=void 0!==o[u]?parseFloat(o[u]):1;return a}}var a=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e};Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t){return function(r){return Math.max(Math.min(r,t),e)}},u=function(e){return function(t){return"string"==typeof e&&-1!==t.indexOf(e)}},s=function(e){return{test:u(e),parse:parseFloat,transform:function(t){return""+t+e}}},i=function(e){return function(t){return"string"==typeof e&&0===t.indexOf(e)}};t.getValueFromFunctionString=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))},t.splitCommaDelimited=function(e){return"string"==typeof e?e.split(/,\s*/):[e]},t.splitColorValues=n,t.number={test:function(e){return"number"==typeof e},parse:parseFloat,transform:function(e){return e}},t.alpha=a({},t.number,{transform:o(0,1)}),t.degrees=s("deg"),t.percent=s("%"),t.px=s("px"),t.scale=a({},t.number,{default:1});var c=/(-)?(\d[\d\.]*)/g,l=function(e){return"${"+e+"}"};t.complex={test:function(e){var t=e.match&&e.match(c);return void 0!==t&&t.constructor===Array&&t.length>1},parse:function(e){var t={};return e.match(c).forEach(function(e,r){return t[r]=parseFloat(e)}),t},createTransformer:function(e){var t=0,r=e.replace(c,function(){return l(""+t++)});return function(e){var t=r;for(var n in e)e.hasOwnProperty(n)&&(t=t.replace(l(n),e[n].toString()));return t}}};var f=o(0,255);t.rgbUnit=a({},t.number,{transform:function(e){return Math.round(f(e))}});var d=function(e){var t=e.red,r=e.green,n=e.blue,a=e.alpha;return"rgba("+t+", "+r+", "+n+", "+(void 0===a?1:a)+")"};t.rgba={test:i("rgb"),parse:n(["red","green","blue","alpha"]),transform:function(e){var r=e.red,n=e.green,a=e.blue,o=e.alpha;return d({red:t.rgbUnit.transform(r),green:t.rgbUnit.transform(n),blue:t.rgbUnit.transform(a),alpha:o})}};var p=function(e){var t=e.hue,r=e.saturation,n=e.lightness,a=e.alpha;return"hsla("+t+", "+r+", "+n+", "+(void 0===a?1:a)+")"};t.hsla={test:i("hsl"),parse:n(["hue","saturation","lightness","alpha"]),transform:function(e){var r=e.hue,n=e.saturation,a=e.lightness,o=e.alpha;return p({hue:Math.round(r),saturation:t.percent.transform(n),lightness:t.percent.transform(a),alpha:o})}},t.hex=a({},t.rgba,{test:i("#"),parse:function(e){var t,r,n;return e.length>4?(t=e.substr(1,2),r=e.substr(3,2),n=e.substr(5,2)):(t=e.substr(1,1),r=e.substr(2,1),n=e.substr(3,1),t+=t,r+=r,n+=n),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:1}}});var h=function(e){return void 0!==e.red},v=function(e){return void 0!==e.hue};t.color={test:function(e){return t.rgba.test(e)||t.hsla.test(e)||t.hex.test(e)},parse:function(e){return t.rgba.test(e)?t.rgba.parse(e):t.hsla.test(e)?t.hsla.parse(e):t.hex.test(e)?t.hex.parse(e):e},transform:function(e){return h(e)?t.rgba.transform(e):v(e)?t.hsla.transform(e):e}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7),a=r(16);window.styler=n.default,window.createStyler=n.createStyler,window.scrollStyler=a.default},function(e,t,r){"use strict";function n(e){var t="string"==typeof e?document.querySelector(e):e;return t instanceof SVGElement?u.default(t):a.default(t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(8),o=r(0);t.createStyler=o.default;var u=r(13);t.default=n},function(e,t,r){"use strict";var n=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e};Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),o=r(3),u=r(12),s=r(1),i=r(4),c=a.default({onRead:function(e,t){var r=t.element,n=i.default(e);if(s.isTransformProp(e))return n?n.default||0:0;var a=window.getComputedStyle(r,null).getPropertyValue(o.default(e))||0;return n&&n.parse?n.parse(a):a},onRender:function(e,t,r){var n=t.element,a=t.enableHardwareAcceleration;u.default(n,e,r,a)},aliasMap:{x:"translateX",y:"translateY",z:"translateZ",originX:"transform-origin-x",originY:"transform-origin-y"}});t.default=function(e,t){return c(n({element:e,enableHardwareAcceleration:!0},t))}},function(e,t,r){"use strict";function n(){i||(i=!0,o.default(a))}function a(e){i=!1,f=Math.max(Math.min(e-l,c),1)*d,l=e,p.process(),h.process(),v.process(),m.process()}Object.defineProperty(t,"__esModule",{value:!0});var o=r(10),u=r(11),s="undefined"!=typeof performance&&performance.now;t.currentTime=s?function(){return performance.now()}:function(){return(new Date).getTime()};var i=!1,c=20,l=t.currentTime(),f=0,d=1,p=u.default(n),h=u.default(n),v=u.default(n),m=u.default(n);t.onFrameStart=p.schedule,t.onFrameUpdate=h.schedule,t.onFrameRender=v.schedule,t.onFrameEnd=m.schedule,t.cancelOnFrameStart=p.cancel,t.cancelOnFrameUpdate=h.cancel,t.cancelOnFrameRender=v.cancel,t.cancelOnFrameEnd=m.cancel,t.timeSinceLastFrame=function(){return f},t.currentFrameTime=function(){return l}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,a=!("undefined"==typeof window||!window.requestAnimationFrame);if(a)n=function(e){return window.requestAnimationFrame(e)};else{var o=0;n=function(e){var t=(new Date).getTime(),r=Math.max(0,16.7-(t-o));o=t+r,setTimeout(function(){return e(o)},r)}}t.default=n},function(e,t,r){"use strict";function n(e){var t=[],r=[];return{schedule:function(t){e(),-1===r.indexOf(t)&&r.push(t)},cancel:function(e){var t=r.indexOf(e);-1!==t&&r.splice(t,1)},process:function(){a=[r,t],t=a[0],r=a[1],r.length=0;for(var e=t.length,n=0;n<e;n++)t[n]();var a}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";function n(e,t,r,n){for(var s="",i="",c=!1,l=!1,f=r.length,d=0;d<f;d++){var p=r[d];if(a.isTransformProp(p)){c=!0;for(var h in t)a.isTransformProp(h)&&-1===r.indexOf(h)&&r.push(h);break}}r.sort(a.sortTransformProps);for(var v=r.length,d=0;d<v;d++){var p=r[d],m=t[p],g=u.default(p);g&&("number"==typeof m||"object"==typeof m)&&g.transform&&(m=g.transform(m)),a.isTransformProp(p)?(i+=p+"("+m+") ",l="translateZ"===p||l):s+=";"+o.default(p,!0)+":"+m}c&&(!l&&n&&(i+="translateZ(0)"),s+=";"+o.default("transform",!0)+":"+i),e.style.cssText+=s}Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),o=r(3),u=r(4);t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),a=r(0),o=r(2),u=r(14),s=r(15),i=a.default({onRead:function(e,t){var r=t.element;if(n.isTransformProp(e)){var a=s.default(e);return a?a.default:0}return r.getAttribute(e)},onRender:function(e,t,r){var n=t.dimensions,a=t.element,s=t.isPath,i=t.pathLength;o.setDomAttrs(a,u.default(e,n,s,i))},aliasMap:{x:"translateX",y:"translateY",background:"fill"}});t.default=function(e){var t=e.getBBox(),r=t.x,n=t.y,a=t.width,o=t.height,u={element:e,dimensions:{x:r,y:n,width:a,height:o},isPath:!1};return"path"===e.tagName&&(u.isPath=!0,u.pathLength=e.getTotalLength()),i(u)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),a=r(1),o=function(e,t){return e/100*t+"px"},u=function(e,t,r,u){var s=!1,i=!1,c={},l=r?{pathLength:"0",pathSpacing:""+u}:void 0,f=void 0!==e.scale?e.scale||1e-7:e.scaleX||1,d=void 0!==e.scaleY?e.scaleY||1e-7:f||1,p=t.width*((e.originX||50)/100)+t.x,h=t.height*((e.originY||50)/100)+t.y,v=1*f*-p,m=1*d*-h,g=p/f,b=h/d,y={translate:"translate("+e.translateX+", "+e.translateY+") ",scale:"translate("+v+", "+m+") scale("+f+", "+d+") translate("+g+", "+b+") ",rotate:"rotate("+e.rotate+", "+p+", "+h+") ",skewX:"skewX("+e.skewX+") ",skewY:"skewY("+e.skewY+") "};for(var x in e)if(e.hasOwnProperty(x)){var w=e[x];a.isTransformProp(x)?s=!0:!r||"pathLength"!==x&&"pathSpacing"!==x||"number"!=typeof w?r&&"pathOffset"===x?c["stroke-dashoffset"]=o(-w,u):c[n.camelToDash(x)]=w:(i=!0,l[x]=o(w,u))}if(i&&(c["stroke-dasharray"]=l.pathLength+" "+l.pathSpacing),s){c.transform="";for(var x in y)if(y.hasOwnProperty(x)){var O="scale"===x?"1":"0";c.transform+=y[x].replace(/undefined/g,O)}}return c};t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),a={fill:n.color,stroke:n.color,scale:n.scale,scaleX:n.scale,scaleY:n.scale,opacity:n.alpha,fillOpacity:n.alpha,strokeOpacity:n.alpha};t.default=function(e){return a[e]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),a=n.default({useCache:!1,onRead:function(e,t){var r=t.element;return"top"===e?r.scrollTop:r.scrollLeft},onRender:function(e,t){var r=e.top,n=e.left,a=t.element;a.scrollLeft=n,a.scrollTop=r}}),o=n.default({useCache:!1,onRead:function(e){return"undefined"==typeof window?0:window.pageXOffset},onRender:function(e){var t=e.top,r=void 0===t?0:t,n=e.left,a=void 0===n?0:n;"undefined"!=typeof window&&"number"==typeof r&&"number"==typeof a&&window.scrollTo(a,r)}});t.default=function(e){return e?a({element:e}):o()}}]); | ||
!function(e){function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}var t={};r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=6)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=["","X","Y","Z"],a=["translate","scale","rotate","skew","transformPerspective"],o=a.reduce(function(e,r){return n.reduce(function(e,t){return e.push(r+t),e},e)},["x","y","z"]),u=o.reduce(function(e,r){return e[r]=!0,e},{});r.isTransformProp=function(e){return!0===u[e]},r.sortTransformProps=function(e,r){return o.indexOf(e)-o.indexOf(r)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(9),a=function(e){var r=e.onRead,t=e.onRender,a=e.aliasMap,o=void 0===a?{}:a,u=e.useCache,s=void 0===u||u;return function(e){var a={},u=[],i=!1,c=function(e,r){var t=o[e]||e,s=a[t];a[t]=r,a[t]!==s&&(-1===u.indexOf(t)&&u.push(t),i||(i=!0,n.onFrameRender(l)))},l=function(){t(a,e,u),i=!1,u.length=0};return{get:function(t){var n=o[t]||t;return n?s&&void 0!==a[n]?a[n]:r(n,e):a},set:function(e,r){if("string"==typeof e){if(void 0===r)return function(r){return c(e,r)};c(e,r)}else for(var t in e)e.hasOwnProperty(t)&&c(t,e[t]);return this},render:function(e){return void 0===e&&(e=!1),(e||i)&&l(),this}}}};r.default=a},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=/([a-z])([A-Z])/g;r.camelToDash=function(e){return e.replace(n,"$1-$2").toLowerCase()},r.setDomAttrs=function(e,r){for(var t in r)r.hasOwnProperty(t)&&e.setAttribute(t,r[t])}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,a=t(2),o={},u={},s=["Webkit","Moz","O","ms",""],i=s.length,c=function(e){n=n||document.createElement("div");for(var r=0;r<i;r++){var t=s[r],c=""===t,l=c?e:t+e.charAt(0).toUpperCase()+e.slice(1);l in n.style&&(o[e]=l,u[e]=(c?"":"-")+a.camelToDash(l))}};r.default=function(e,r){void 0===r&&(r=!1);var t=r?u:o;return t[e]||c(e),t[e]}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(5),a={color:n.color,backgroundColor:n.color,outlineColor:n.color,fill:n.color,stroke:n.color,borderColor:n.color,borderTopColor:n.color,borderRightColor:n.color,borderBottomColor:n.color,borderLeftColor:n.color,borderRadius:n.px,width:n.px,maxWidth:n.px,height:n.px,maxHeight:n.px,top:n.px,left:n.px,bottom:n.px,right:n.px,rotate:n.degrees,rotateX:n.degrees,rotateY:n.degrees,rotateZ:n.degrees,scale:n.scale,scaleX:n.scale,scaleY:n.scale,scaleZ:n.scale,skewX:n.degrees,skewY:n.degrees,distance:n.px,translateX:n.px,translateY:n.px,translateZ:n.px,perspective:n.px,opacity:n.alpha,"transform-origin-x":n.percent,"transform-origin-y":n.percent};r.default=function(e){return a[e]}},function(e,r,t){"use strict";function n(e){var t=e.length;return function(n){for(var a={},o=r.splitCommaDelimited(r.getValueFromFunctionString(n)),u=0;u<t;u++)a[e[u]]=void 0!==o[u]?parseFloat(o[u]):1;return a}}var a=this&&this.__assign||Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e};Object.defineProperty(r,"__esModule",{value:!0});var o=function(e,r){return function(t){return Math.max(Math.min(t,r),e)}},u=function(e){return function(r){return"string"==typeof e&&-1!==r.indexOf(e)}},s=function(e){return{test:u(e),parse:parseFloat,transform:function(r){return""+r+e}}},i=function(e){return function(r){return"string"==typeof e&&0===r.indexOf(e)}};r.getValueFromFunctionString=function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))},r.splitCommaDelimited=function(e){return"string"==typeof e?e.split(/,\s*/):[e]},r.splitColorValues=n,r.number={test:function(e){return"number"==typeof e},parse:parseFloat,transform:function(e){return e}},r.alpha=a({},r.number,{transform:o(0,1)}),r.degrees=s("deg"),r.percent=s("%"),r.px=s("px"),r.scale=a({},r.number,{default:1});var c=/(-)?(\d[\d\.]*)/g,l=function(e){return"${"+e+"}"};r.complex={test:function(e){var r=e.match&&e.match(c);return void 0!==r&&r.constructor===Array&&r.length>1},parse:function(e){var r={};return e.match(c).forEach(function(e,t){return r[t]=parseFloat(e)}),r},createTransformer:function(e){var r=0,t=e.replace(c,function(){return l(""+r++)});return function(e){var r=t;for(var n in e)e.hasOwnProperty(n)&&(r=r.replace(l(n),e[n].toString()));return r}}};var f=o(0,255);r.rgbUnit=a({},r.number,{transform:function(e){return Math.round(f(e))}});var d=function(e){var r=e.red,t=e.green,n=e.blue,a=e.alpha;return"rgba("+r+", "+t+", "+n+", "+(void 0===a?1:a)+")"};r.rgba={test:i("rgb"),parse:n(["red","green","blue","alpha"]),transform:function(e){var t=e.red,n=e.green,a=e.blue,o=e.alpha;return d({red:r.rgbUnit.transform(t),green:r.rgbUnit.transform(n),blue:r.rgbUnit.transform(a),alpha:o})}};var p=function(e){var r=e.hue,t=e.saturation,n=e.lightness,a=e.alpha;return"hsla("+r+", "+t+", "+n+", "+(void 0===a?1:a)+")"};r.hsla={test:i("hsl"),parse:n(["hue","saturation","lightness","alpha"]),transform:function(e){var t=e.hue,n=e.saturation,a=e.lightness,o=e.alpha;return p({hue:Math.round(t),saturation:r.percent.transform(n),lightness:r.percent.transform(a),alpha:o})}},r.hex=a({},r.rgba,{test:i("#"),parse:function(e){var r,t,n;return e.length>4?(r=e.substr(1,2),t=e.substr(3,2),n=e.substr(5,2)):(r=e.substr(1,1),t=e.substr(2,1),n=e.substr(3,1),r+=r,t+=t,n+=n),{red:parseInt(r,16),green:parseInt(t,16),blue:parseInt(n,16),alpha:1}}});var h=function(e){return void 0!==e.red},v=function(e){return void 0!==e.hue};r.color={test:function(e){return r.rgba.test(e)||r.hsla.test(e)||r.hex.test(e)},parse:function(e){return r.rgba.test(e)?r.rgba.parse(e):r.hsla.test(e)?r.hsla.parse(e):r.hex.test(e)?r.hex.parse(e):e},transform:function(e){return h(e)?r.rgba.transform(e):v(e)?r.hsla.transform(e):e}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(7),a=t(16);window.styler=n.default,window.createStyler=n.createStyler,window.scrollStyler=a.default},function(e,r,t){"use strict";function n(e){var r="string"==typeof e?document.querySelector(e):e;return i(r)}Object.defineProperty(r,"__esModule",{value:!0});var a=t(8),o=t(13),u=new WeakMap,s=function(e){var r=e instanceof SVGElement?o.default(e):a.default(e);return u.set(e,r),r};r.createStyler=s;var i=function(e){return u.has(e)?u.get(e):s(e)};r.default=n},function(e,r,t){"use strict";var n=this&&this.__assign||Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e};Object.defineProperty(r,"__esModule",{value:!0});var a=t(1),o=t(3),u=t(12),s=t(0),i=t(4),c=a.default({onRead:function(e,r){var t=r.element,n=i.default(e);if(s.isTransformProp(e))return n?n.default||0:0;var a=window.getComputedStyle(t,null).getPropertyValue(o.default(e))||0;return n&&n.parse?n.parse(a):a},onRender:function(e,r,t){var n=r.element,a=r.enableHardwareAcceleration;u.default(n,e,t,a)},aliasMap:{x:"translateX",y:"translateY",z:"translateZ",originX:"transform-origin-x",originY:"transform-origin-y"}});r.default=function(e,r){return c(n({element:e,enableHardwareAcceleration:!0},r))}},function(e,r,t){"use strict";function n(){i||(i=!0,o.default(a))}function a(e){i=!1,f=Math.max(Math.min(e-l,c),1)*d,l=e,p.process(),h.process(),v.process(),m.process()}Object.defineProperty(r,"__esModule",{value:!0});var o=t(10),u=t(11),s="undefined"!=typeof performance&&performance.now;r.currentTime=s?function(){return performance.now()}:function(){return(new Date).getTime()};var i=!1,c=20,l=r.currentTime(),f=0,d=1,p=u.default(n),h=u.default(n),v=u.default(n),m=u.default(n);r.onFrameStart=p.schedule,r.onFrameUpdate=h.schedule,r.onFrameRender=v.schedule,r.onFrameEnd=m.schedule,r.cancelOnFrameStart=p.cancel,r.cancelOnFrameUpdate=h.cancel,r.cancelOnFrameRender=v.cancel,r.cancelOnFrameEnd=m.cancel,r.timeSinceLastFrame=function(){return f},r.currentFrameTime=function(){return l}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,a=!("undefined"==typeof window||!window.requestAnimationFrame);if(a)n=function(e){return window.requestAnimationFrame(e)};else{var o=0;n=function(e){var r=(new Date).getTime(),t=Math.max(0,16.7-(r-o));o=r+t,setTimeout(function(){return e(o)},t)}}r.default=n},function(e,r,t){"use strict";function n(e){var r=[],t=[];return{schedule:function(r){e(),-1===t.indexOf(r)&&t.push(r)},cancel:function(e){var r=t.indexOf(e);-1!==r&&t.splice(r,1)},process:function(){a=[t,r],r=a[0],t=a[1],t.length=0;for(var e=r.length,n=0;n<e;n++)r[n]();var a}}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n},function(e,r,t){"use strict";function n(e,r,t,n){for(var s="",i="",c=!1,l=!1,f=t.length,d=0;d<f;d++){var p=t[d];if(a.isTransformProp(p)){c=!0;for(var h in r)a.isTransformProp(h)&&-1===t.indexOf(h)&&t.push(h);break}}t.sort(a.sortTransformProps);for(var v=t.length,d=0;d<v;d++){var p=t[d],m=r[p],g=u.default(p);g&&("number"==typeof m||"object"==typeof m)&&g.transform&&(m=g.transform(m)),a.isTransformProp(p)?(i+=p+"("+m+") ",l="translateZ"===p||l):s+=";"+o.default(p,!0)+":"+m}c&&(!l&&n&&(i+="translateZ(0)"),s+=";"+o.default("transform",!0)+":"+i),e.style.cssText+=s}Object.defineProperty(r,"__esModule",{value:!0});var a=t(0),o=t(3),u=t(4);r.default=n},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(0),a=t(1),o=t(2),u=t(14),s=t(15),i=a.default({onRead:function(e,r){var t=r.element;if(n.isTransformProp(e)){var a=s.default(e);return a?a.default:0}return t.getAttribute(e)},onRender:function(e,r,t){var n=r.dimensions,a=r.element,s=r.isPath,i=r.pathLength;o.setDomAttrs(a,u.default(e,n,s,i))},aliasMap:{x:"translateX",y:"translateY",background:"fill"}});r.default=function(e){var r=e.getBBox(),t=r.x,n=r.y,a=r.width,o=r.height,u={element:e,dimensions:{x:t,y:n,width:a,height:o},isPath:!1};return"path"===e.tagName&&(u.isPath=!0,u.pathLength=e.getTotalLength()),i(u)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(2),a=t(0),o=function(e,r){return e/100*r+"px"},u=function(e,r,t,u){var s=!1,i=!1,c={},l=t?{pathLength:"0",pathSpacing:""+u}:void 0,f=void 0!==e.scale?e.scale||1e-7:e.scaleX||1,d=void 0!==e.scaleY?e.scaleY||1e-7:f||1,p=r.width*((e.originX||50)/100)+r.x,h=r.height*((e.originY||50)/100)+r.y,v=1*f*-p,m=1*d*-h,g=p/f,b=h/d,y={translate:"translate("+e.translateX+", "+e.translateY+") ",scale:"translate("+v+", "+m+") scale("+f+", "+d+") translate("+g+", "+b+") ",rotate:"rotate("+e.rotate+", "+p+", "+h+") ",skewX:"skewX("+e.skewX+") ",skewY:"skewY("+e.skewY+") "};for(var w in e)if(e.hasOwnProperty(w)){var x=e[w];a.isTransformProp(w)?s=!0:!t||"pathLength"!==w&&"pathSpacing"!==w||"number"!=typeof x?t&&"pathOffset"===w?c["stroke-dashoffset"]=o(-x,u):c[n.camelToDash(w)]=x:(i=!0,l[w]=o(x,u))}if(i&&(c["stroke-dasharray"]=l.pathLength+" "+l.pathSpacing),s){c.transform="";for(var w in y)if(y.hasOwnProperty(w)){var O="scale"===w?"1":"0";c.transform+=y[w].replace(/undefined/g,O)}}return c};r.default=u},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(5),a={fill:n.color,stroke:n.color,scale:n.scale,scaleX:n.scale,scaleY:n.scale,opacity:n.alpha,fillOpacity:n.alpha,strokeOpacity:n.alpha};r.default=function(e){return a[e]}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(1),a=n.default({useCache:!1,onRead:function(e,r){var t=r.element;return"top"===e?t.scrollTop:t.scrollLeft},onRender:function(e,r){var t=e.top,n=e.left,a=r.element;a.scrollLeft=n,a.scrollTop=t}}),o=n.default({useCache:!1,onRead:function(e){return"undefined"==typeof window?0:"top"===e?window.pageYOffset:window.pageXOffset},onRender:function(e){var r=e.top,t=void 0===r?0:r,n=e.left,a=void 0===n?0:n;"undefined"!=typeof window&&"number"==typeof t&&"number"==typeof a&&window.scrollTo(a,t)}});r.default=function(e){return e?a({element:e}):o()}}]); |
@@ -1,4 +0,4 @@ | ||
import createStyler from './styler'; | ||
import { Styler } from './styler/types'; | ||
declare const createStyler: (node: Element) => Styler; | ||
export default function (nodeOrSelector: Element | string): Styler; | ||
export { createStyler, Styler }; |
12
index.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var css_1 = require("./css"); | ||
var styler_1 = require("./styler"); | ||
exports.createStyler = styler_1.default; | ||
var svg_1 = require("./svg"); | ||
var cache = new WeakMap(); | ||
var createStyler = function (node) { | ||
var styler = (node instanceof SVGElement) ? svg_1.default(node) : css_1.default(node); | ||
cache.set(node, styler); | ||
return styler; | ||
}; | ||
exports.createStyler = createStyler; | ||
var getStyler = function (node) { return cache.has(node) ? cache.get(node) : createStyler(node); }; | ||
function default_1(nodeOrSelector) { | ||
@@ -11,5 +17,5 @@ var node = (typeof nodeOrSelector === 'string') | ||
: nodeOrSelector; | ||
return (node instanceof SVGElement) ? svg_1.default(node) : css_1.default(node); | ||
return getStyler(node); | ||
} | ||
exports.default = default_1; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "stylefire", | ||
"version": "1.1.9", | ||
"version": "1.2.0", | ||
"description": "Performant, simplified stylers for CSS, SVG, path and DOM scroll.", | ||
@@ -61,4 +61,4 @@ "main": "index.js", | ||
"framesync": "^3.0.2", | ||
"style-value-types": "^1.0.3" | ||
"style-value-types": "^1.0.0" | ||
} | ||
} |
@@ -104,3 +104,1 @@ # Stylefire | ||
## Supported by | ||
<img src="https://user-images.githubusercontent.com/7850794/31086561-107648a4-a792-11e7-88bf-a0c0cfcafb79.png" width="300" alt="DriveTribe Open Source"> |
@@ -31,5 +31,5 @@ "use strict"; | ||
}); | ||
exports.default = (function (element) { return element | ||
exports.default = function (element) { return element | ||
? domScrollStyler({ element: element }) | ||
: viewportScrollStyler(); }); | ||
: viewportScrollStyler(); }; | ||
//# sourceMappingURL=index.js.map |
import { Config, Props, Styler } from './types'; | ||
declare const createStyler: ({ onRead, onRender, aliasMap, useCache }: Config) => (props?: Props) => Styler; | ||
declare const createStyler: ({onRead, onRender, aliasMap, useCache}: Config) => (props?: Props) => Styler; | ||
export default createStyler; |
@@ -29,3 +29,3 @@ "use strict"; | ||
}); | ||
exports.default = (function (element) { | ||
exports.default = function (element) { | ||
var _a = element.getBBox(), x = _a.x, y = _a.y, width = _a.width, height = _a.height; | ||
@@ -42,3 +42,3 @@ var props = { | ||
return svgStyler(props); | ||
}); | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -14,3 +14,3 @@ "use strict"; | ||
}; | ||
exports.default = (function (key) { return valueTypes[key]; }); | ||
exports.default = function (key) { return valueTypes[key]; }; | ||
//# sourceMappingURL=value-types.js.map |
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
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
54750
519
104
Updatedstyle-value-types@^1.0.0