Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stylefire

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylefire - npm Package Compare versions

Comparing version 6.0.7 to 6.0.8

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Changelog

## [6.0.8] 2019-07-25
### Upgraded
- `popcorn` and `style-value-types`.
## [6.0.7] 2019-07-22
### Fixed
- Adding `0` fallback for default value for SVG transforms.
## [6.0.6] 2019-07-18

@@ -7,0 +19,0 @@

16

dist/stylefire.js

@@ -378,8 +378,8 @@ (function (global, factory) {

var rgbaTemplate = function (_a) {
var red = _a.red, green = _a.green, blue = _a.blue, _b = _a.alpha, alpha = _b === void 0 ? 1 : _b;
return "rgba(" + red + ", " + green + ", " + blue + ", " + alpha + ")";
var red = _a.red, green = _a.green, blue = _a.blue, _b = _a.alpha, alpha$$1 = _b === void 0 ? 1 : _b;
return "rgba(" + red + ", " + green + ", " + blue + ", " + alpha$$1 + ")";
};
var hslaTemplate = function (_a) {
var hue = _a.hue, saturation = _a.saturation, lightness = _a.lightness, _b = _a.alpha, alpha = _b === void 0 ? 1 : _b;
return "hsla(" + hue + ", " + saturation + ", " + lightness + ", " + alpha + ")";
var hue = _a.hue, saturation = _a.saturation, lightness = _a.lightness, _b = _a.alpha, alpha$$1 = _b === void 0 ? 1 : _b;
return "hsla(" + hue + ", " + saturation + ", " + lightness + ", " + alpha$$1 + ")";
};

@@ -394,3 +394,3 @@ var rgbUnit = __assign$1({}, number, { transform: function (v) { return Math.round(clampRgbUnit(v)); } });

transform: function (_a) {
var red = _a.red, green = _a.green, blue = _a.blue, alpha = _a.alpha;
var red = _a.red, green = _a.green, blue = _a.blue, _b = _a.alpha, alpha$$1 = _b === void 0 ? 1 : _b;
return rgbaTemplate({

@@ -400,3 +400,3 @@ red: rgbUnit.transform(red),

blue: rgbUnit.transform(blue),
alpha: sanitize(alpha)
alpha: sanitize(alpha.transform(alpha$$1))
});

@@ -409,3 +409,3 @@ }

transform: function (_a) {
var hue = _a.hue, saturation = _a.saturation, lightness = _a.lightness, alpha = _a.alpha;
var hue = _a.hue, saturation = _a.saturation, lightness = _a.lightness, _b = _a.alpha, alpha$$1 = _b === void 0 ? 1 : _b;
return hslaTemplate({

@@ -415,3 +415,3 @@ hue: Math.round(hue),

lightness: percent.transform(sanitize(lightness)),
alpha: sanitize(alpha)
alpha: sanitize(alpha.transform(alpha$$1))
});

@@ -418,0 +418,0 @@ }

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.stylefire={})}(this,function(t){"use strict";var e=function(){return(e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function r(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r}var n=function(){};"production"!==process.env.NODE_ENV&&(n=function(t,e){if(!t)throw new Error("Hey, listen! ".toUpperCase()+e)});var o,i=0,a="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),r=Math.max(0,16.7-(e-i));i=e+r,setTimeout(function(){return t(i)},r)};!function(t){t.Read="read",t.Update="update",t.Render="render",t.PostRender="postRender",t.FixedUpdate="fixedUpdate"}(o||(o={}));var u,s=1/60*1e3,f=!0,d=!1,c=!1,l={delta:0,timestamp:0},p=[o.Read,o.Update,o.Render,o.PostRender],h=function(t){return d=t},v=p.reduce(function(t,e){var r,o,i,a,u,s,f,c,l,p=(r=h,o=[],i=[],a=0,u=!1,s=0,f=new WeakSet,c=new WeakSet,l={cancel:function(t){var e=i.indexOf(t);f.add(t),-1!==e&&i.splice(e,1)},process:function(t){var e,n;if(u=!0,o=(e=[i,o])[0],(i=e[1]).length=0,a=o.length)for(s=0;s<a;s++)(n=o[s])(t),!0!==c.has(n)||f.has(n)||(l.schedule(n),r(!0));u=!1},schedule:function(t,e,r){void 0===e&&(e=!1),void 0===r&&(r=!1),n("function"==typeof t,"Argument must be a function");var s=r&&u,d=s?o:i;f.delete(t),e&&c.add(t),-1===d.indexOf(t)&&(d.push(t),s&&(a=o.length))}});return t.sync[e]=function(t,e,r){return void 0===e&&(e=!1),void 0===r&&(r=!1),d||w(),p.schedule(t,e,r),t},t.cancelSync[e]=function(t){return p.cancel(t)},t.steps[e]=p,t},{steps:{},sync:{},cancelSync:{}}),g=v.steps,m=v.sync,y=(v.cancelSync,function(t){return g[t].process(l)}),b=function(t){d=!1,l.delta=f?s:Math.max(Math.min(t-l.timestamp,40),1),f||(s=l.delta),l.timestamp=t,c=!0,p.forEach(y),c=!1,d&&(f=!1,a(b))},w=function(){d=!0,f=!0,c||a(b)},O=function(t){var e=t.onRead,n=t.onRender,o=t.uncachedValues,i=void 0===o?new Set:o,a=t.useCache,u=void 0===a||a;return function(t){void 0===t&&(t={});var o=r(t,[]),a={},s=[],f=!1;function d(t,e){t.startsWith("--")&&(o.hasCSSVariable=!0);var r=a[t];a[t]=e,a[t]!==r&&(-1===s.indexOf(t)&&s.push(t),f||(f=!0,m.render(c.render)))}var c={get:function(t,r){return void 0===r&&(r=!1),!r&&u&&!i.has(t)&&void 0!==a[t]?a[t]:e(t,o)},set:function(t,e){if("string"==typeof t)d(t,e);else for(var r in t)d(r,t[r]);return this},render:function(t){return void 0===t&&(t=!1),(f||!0===t)&&(n(a,o,s),f=!1,s.length=0),this}};return c}},x=/([a-z])([A-Z])/g,S=function(t){return t.replace(x,"$1-$2").toLowerCase()},R=new Map,k=new Map,C=["Webkit","Moz","O","ms",""],T=C.length,L="undefined"!=typeof document,M=function(t,e){return k.set(t,S(e))},W=function(t,e){void 0===e&&(e=!1);var r=e?k:R;return r.has(t)||(L?function(t){u=u||document.createElement("div");for(var e=0;e<T;e++){var r=C[e],n=""===r,o=n?t:r+t.charAt(0).toUpperCase()+t.slice(1);(o in u.style||n)&&(R.set(t,o),M(t,(n?"":"-")+S(o)))}}(t):function(t){M(t,t)}(t)),r.get(t)||t},P=["","X","Y","Z"],A=["translate","scale","rotate","skew","transformPerspective"].reduce(function(t,e){return P.reduce(function(t,r){return t.push(e+r),t},t)},["x","y","z"]),E=A.reduce(function(t,e){return t[e]=!0,t},{});function X(t){return!0===E[t]}function Y(t,e){return A.indexOf(t)-A.indexOf(e)}var j=new Set(["originX","originY","originZ"]);function B(t){return j.has(t)}var V=function(){return(V=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},z=function(t,e){return function(r){return Math.max(Math.min(r,e),t)}},Z=function(t){return t%1?Number(t.toFixed(5)):t},F=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,N={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},H=V({},N,{transform:z(0,1)}),U=V({},N,{default:1}),I=function(t){return{test:function(e){return"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length},parse:parseFloat,transform:function(e){return""+e+t}}},q=I("deg"),D=I("%"),_=I("px"),G=V({},D,{parse:function(t){return D.parse(t)/100},transform:function(t){return D.transform(100*t)}}),$=z(0,255),J=function(t){return void 0!==t.red},K=function(t){return void 0!==t.hue},Q=function(t){return function(e){if("string"!=typeof e)return e;for(var r,n={},o=(r=e,r.substring(r.indexOf("(")+1,r.lastIndexOf(")"))).split(/,\s*/),i=0;i<4;i++)n[t[i]]=void 0!==o[i]?parseFloat(o[i]):1;return n}},tt=V({},N,{transform:function(t){return Math.round($(t))}});function et(t,e){return t.startsWith(e)&&F.test(t)}var rt={test:function(t){return"string"==typeof t?et(t,"rgb"):J(t)},parse:Q(["red","green","blue","alpha"]),transform:function(t){var e=t.red,r=t.green,n=t.blue,o=t.alpha;return function(t){var e=t.red,r=t.green,n=t.blue,o=t.alpha;return"rgba("+e+", "+r+", "+n+", "+(void 0===o?1:o)+")"}({red:tt.transform(e),green:tt.transform(r),blue:tt.transform(n),alpha:Z(o)})}},nt={test:function(t){return"string"==typeof t?et(t,"hsl"):K(t)},parse:Q(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,r=t.saturation,n=t.lightness,o=t.alpha;return function(t){var e=t.hue,r=t.saturation,n=t.lightness,o=t.alpha;return"hsla("+e+", "+r+", "+n+", "+(void 0===o?1:o)+")"}({hue:Math.round(e),saturation:D.transform(Z(r)),lightness:D.transform(Z(n)),alpha:Z(o)})}},ot=V({},rt,{test:function(t){return"string"==typeof t&&et(t,"#")},parse:function(t){var e="",r="",n="";return t.length>4?(e=t.substr(1,2),r=t.substr(3,2),n=t.substr(5,2)):(e=t.substr(1,1),r=t.substr(2,1),n=t.substr(3,1),e+=e,r+=r,n+=n),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:1}}}),it={test:function(t){return"string"==typeof t&&F.test(t)||J(t)||K(t)},parse:function(t){return rt.test(t)?rt.parse(t):nt.test(t)?nt.parse(t):ot.test(t)?ot.parse(t):t},transform:function(t){return J(t)?rt.transform(t):K(t)?nt.transform(t):t}},at=e({},N,{transform:Math.round}),ut={color:it,backgroundColor:it,outlineColor:it,fill:it,stroke:it,borderColor:it,borderTopColor:it,borderRightColor:it,borderBottomColor:it,borderLeftColor:it,borderWidth:_,borderTopWidth:_,borderRightWidth:_,borderBottomWidth:_,borderLeftWidth:_,borderRadius:_,radius:_,borderTopLeftRadius:_,borderTopRightRadius:_,borderBottomRightRadius:_,borderBottomLeftRadius:_,width:_,maxWidth:_,height:_,maxHeight:_,size:_,top:_,right:_,bottom:_,left:_,padding:_,paddingTop:_,paddingRight:_,paddingBottom:_,paddingLeft:_,margin:_,marginTop:_,marginRight:_,marginBottom:_,marginLeft:_,rotate:q,rotateX:q,rotateY:q,rotateZ:q,scale:U,scaleX:U,scaleY:U,scaleZ:U,skew:q,skewX:q,skewY:q,distance:_,translateX:_,translateY:_,translateZ:_,x:_,y:_,z:_,perspective:_,opacity:H,originX:G,originY:G,originZ:_,zIndex:at,fillOpacity:H,strokeOpacity:H,numOctaves:at},st=function(t){return ut[t]},ft=function(t,e){return e&&"number"==typeof t?e.transform(t):t},dt="scrollLeft",ct="scrollTop",lt=new Set([dt,ct]),pt=new Set([dt,ct,"transform"]),ht={x:"translateX",y:"translateY",z:"translateZ"};function vt(t){return"function"==typeof t}function gt(t,e,r,n,o,i,a){void 0===e&&(e=!0),void 0===r&&(r={}),void 0===n&&(n={}),void 0===o&&(o={}),void 0===i&&(i=[]),void 0===a&&(a=!1);var u=!0,s=!1,f=!1;for(var d in t){var c=t[d],l=st(d),p=ft(c,l);X(d)?(s=!0,n[d]=p,i.push(d),u&&(l.default&&c!==l.default||!l.default&&0!==c)&&(u=!1)):B(d)?(o[d]=p,f=!0):pt.has(d)&&vt(p)||(r[W(d,a)]=p)}return(s||"function"==typeof t.transform)&&(r.transform=function(t,e,r,n,o){var i="",a=!1;r.sort(Y);for(var u=r.length,s=0;s<u;s++){var f=r[s];i+=(ht[f]||f)+"("+e[f]+") ",a="z"===f||a}return!a&&o?i+="translateZ(0)":i=i.trim(),vt(t.transform)?i=t.transform(e,i):n&&(i="none"),i}(t,n,i,u,e)),f&&(r.transformOrigin=(o.originX||"50%")+" "+(o.originY||"50%")+" "+(o.originZ||0)),r}function mt(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0);var r={},n={},o={},i=[];return function(a){return i.length=0,gt(a,t,r,n,o,i,e),r}}var yt=O({onRead:function(t,e){var r=e.element,n=e.preparseOutput,o=st(t);if(X(t))return o&&o.default||0;if(lt.has(t))return r[t];var i=window.getComputedStyle(r,null).getPropertyValue(W(t,!0))||0;return n&&o&&o.test(i)&&o.parse?o.parse(i):i},onRender:function(t,e,r){var n=e.element,o=e.buildStyles,i=e.hasCSSVariable;if(Object.assign(n.style,o(t)),i)for(var a=r.length,u=0;u<a;u++){var s=r[u];s.startsWith("--")&&n.style.setProperty(s,t[s])}-1!==r.indexOf(dt)&&(n[dt]=t[dt]),-1!==r.indexOf(ct)&&(n[ct]=t[ct])},uncachedValues:lt});var bt=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),wt=function(){return{style:{}}},Ot=function(t,e){return _.transform(t*e)},xt={x:0,y:0,width:0,height:0};function St(t,e,r){return"string"==typeof t?t:_.transform(e+r*t)}function Rt(t,e,n,o,i){void 0===e&&(e=xt),void 0===o&&(o=mt(!1,!1)),void 0===i&&(i=wt());var a=t.x,u=t.y,s=(t.z,t.originX),f=void 0===s?.5:s,d=t.originY,c=void 0===d?.5:d,l=t.pathLength,p=t.pathSpacing,h=void 0===p?1:p,v=t.pathOffset,g=void 0===v?0:v,m=o(r(t,["x","y","z","originX","originY","pathLength","pathSpacing","pathOffset"]));for(var y in m){if("transform"===y)i.style.transform=m[y];else i[bt.has(y)?y:S(y)]=m[y]}return void 0===f&&void 0===c||(i.style.transformOrigin=function(t,e,r){return St(e,t.x,t.width)+" "+St(r,t.y,t.height)}(e,f,c)),void 0!==a&&(i.x=a),void 0!==u&&(i.y=u),void 0!==n&&void 0!==l&&(i["stroke-dashoffset"]=Ot(-g,n),i["stroke-dasharray"]=Ot(l,n)+" "+Ot(h,n)),i}var kt=O({onRead:function(t,e){var r=e.element;if(X(t=bt.has(t)?t:S(t))){var n=st(t);return n&&n.default||0}return r.getAttribute(t)},onRender:function(t,e){var r=e.element,n=(0,e.buildAttrs)(t);for(var o in n)"style"===o?Object.assign(r.style,n.style):r.setAttribute(o,n[o])}}),Ct=function(t){var e=function(t){try{return function(t){return"function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}(t)}catch(t){return{x:0,y:0,width:0,height:0}}}(t),r=function(t){return"path"===t.tagName}(t)&&t.getTotalLength?t.getTotalLength():void 0;return kt({element:t,buildAttrs:function(t,e){var r=wt(),n=mt(!1,!1);return function(o){return Rt(o,t,e,n,r)}}(e,r)})},Tt=O({useCache:!1,onRead:function(t){return"scrollTop"===t?window.pageYOffset:window.pageXOffset},onRender:function(t){var e=t.scrollTop,r=void 0===e?0:e,n=t.scrollLeft,o=void 0===n?0:n;return window.scrollTo(o,r)}}),Lt=function(){};"production"!==process.env.NODE_ENV&&(Lt=function(t,e){if(!t)throw new Error(e)});var Mt=new WeakMap,Wt=function(t,n){var o;return t instanceof HTMLElement?o=function(t,n){void 0===n&&(n={});var o=n.enableHardwareAcceleration,i=r(n,["enableHardwareAcceleration"]);return yt(e({element:t,buildStyles:mt(o),preparseOutput:!0},i))}(t,n):t instanceof SVGElement?o=Ct(t):t===window&&(o=Tt(t)),Lt(void 0!==o,"No valid node provided. Node must be HTMLElement, SVGElement or window."),Mt.set(t,o),o},Pt=function(t,e){return Mt.has(t)?Mt.get(t):Wt(t,e)};t.default=function(t,e){var r="string"==typeof t?document.querySelector(t):t;return Pt(r,e)},t.createStylerFactory=O,t.buildStyleProperty=gt,t.buildSVGAttrs=Rt,t.transformProps=A,t.isTransformProp=X,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.stylefire={})}(this,function(t){"use strict";var e=function(){return(e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function r(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&(r[n[o]]=t[n[o]])}return r}var n=function(){};"production"!==process.env.NODE_ENV&&(n=function(t,e){if(!t)throw new Error("Hey, listen! ".toUpperCase()+e)});var o,i=0,a="undefined"!=typeof window&&void 0!==window.requestAnimationFrame?function(t){return window.requestAnimationFrame(t)}:function(t){var e=Date.now(),r=Math.max(0,16.7-(e-i));i=e+r,setTimeout(function(){return t(i)},r)};!function(t){t.Read="read",t.Update="update",t.Render="render",t.PostRender="postRender",t.FixedUpdate="fixedUpdate"}(o||(o={}));var u,s=1/60*1e3,f=!0,d=!1,c=!1,l={delta:0,timestamp:0},p=[o.Read,o.Update,o.Render,o.PostRender],h=function(t){return d=t},v=p.reduce(function(t,e){var r,o,i,a,u,s,f,c,l,p=(r=h,o=[],i=[],a=0,u=!1,s=0,f=new WeakSet,c=new WeakSet,l={cancel:function(t){var e=i.indexOf(t);f.add(t),-1!==e&&i.splice(e,1)},process:function(t){var e,n;if(u=!0,o=(e=[i,o])[0],(i=e[1]).length=0,a=o.length)for(s=0;s<a;s++)(n=o[s])(t),!0!==c.has(n)||f.has(n)||(l.schedule(n),r(!0));u=!1},schedule:function(t,e,r){void 0===e&&(e=!1),void 0===r&&(r=!1),n("function"==typeof t,"Argument must be a function");var s=r&&u,d=s?o:i;f.delete(t),e&&c.add(t),-1===d.indexOf(t)&&(d.push(t),s&&(a=o.length))}});return t.sync[e]=function(t,e,r){return void 0===e&&(e=!1),void 0===r&&(r=!1),d||w(),p.schedule(t,e,r),t},t.cancelSync[e]=function(t){return p.cancel(t)},t.steps[e]=p,t},{steps:{},sync:{},cancelSync:{}}),g=v.steps,m=v.sync,y=(v.cancelSync,function(t){return g[t].process(l)}),b=function(t){d=!1,l.delta=f?s:Math.max(Math.min(t-l.timestamp,40),1),f||(s=l.delta),l.timestamp=t,c=!0,p.forEach(y),c=!1,d&&(f=!1,a(b))},w=function(){d=!0,f=!0,c||a(b)},O=function(t){var e=t.onRead,n=t.onRender,o=t.uncachedValues,i=void 0===o?new Set:o,a=t.useCache,u=void 0===a||a;return function(t){void 0===t&&(t={});var o=r(t,[]),a={},s=[],f=!1;function d(t,e){t.startsWith("--")&&(o.hasCSSVariable=!0);var r=a[t];a[t]=e,a[t]!==r&&(-1===s.indexOf(t)&&s.push(t),f||(f=!0,m.render(c.render)))}var c={get:function(t,r){return void 0===r&&(r=!1),!r&&u&&!i.has(t)&&void 0!==a[t]?a[t]:e(t,o)},set:function(t,e){if("string"==typeof t)d(t,e);else for(var r in t)d(r,t[r]);return this},render:function(t){return void 0===t&&(t=!1),(f||!0===t)&&(n(a,o,s),f=!1,s.length=0),this}};return c}},x=/([a-z])([A-Z])/g,S=function(t){return t.replace(x,"$1-$2").toLowerCase()},R=new Map,k=new Map,C=["Webkit","Moz","O","ms",""],T=C.length,L="undefined"!=typeof document,M=function(t,e){return k.set(t,S(e))},W=function(t,e){void 0===e&&(e=!1);var r=e?k:R;return r.has(t)||(L?function(t){u=u||document.createElement("div");for(var e=0;e<T;e++){var r=C[e],n=""===r,o=n?t:r+t.charAt(0).toUpperCase()+t.slice(1);(o in u.style||n)&&(R.set(t,o),M(t,(n?"":"-")+S(o)))}}(t):function(t){M(t,t)}(t)),r.get(t)||t},P=["","X","Y","Z"],A=["translate","scale","rotate","skew","transformPerspective"].reduce(function(t,e){return P.reduce(function(t,r){return t.push(e+r),t},t)},["x","y","z"]),E=A.reduce(function(t,e){return t[e]=!0,t},{});function X(t){return!0===E[t]}function Y(t,e){return A.indexOf(t)-A.indexOf(e)}var j=new Set(["originX","originY","originZ"]);function B(t){return j.has(t)}var V=function(){return(V=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},z=function(t,e){return function(r){return Math.max(Math.min(r,e),t)}},Z=function(t){return t%1?Number(t.toFixed(5)):t},F=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,N={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},H=V({},N,{transform:z(0,1)}),U=V({},N,{default:1}),I=function(t){return{test:function(e){return"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length},parse:parseFloat,transform:function(e){return""+e+t}}},q=I("deg"),D=I("%"),_=I("px"),G=V({},D,{parse:function(t){return D.parse(t)/100},transform:function(t){return D.transform(100*t)}}),$=z(0,255),J=function(t){return void 0!==t.red},K=function(t){return void 0!==t.hue},Q=function(t){return function(e){if("string"!=typeof e)return e;for(var r,n={},o=(r=e,r.substring(r.indexOf("(")+1,r.lastIndexOf(")"))).split(/,\s*/),i=0;i<4;i++)n[t[i]]=void 0!==o[i]?parseFloat(o[i]):1;return n}},tt=V({},N,{transform:function(t){return Math.round($(t))}});function et(t,e){return t.startsWith(e)&&F.test(t)}var rt={test:function(t){return"string"==typeof t?et(t,"rgb"):J(t)},parse:Q(["red","green","blue","alpha"]),transform:function(t){var e=t.red,r=t.green,n=t.blue,o=t.alpha,i=void 0===o?1:o;return function(t){var e=t.red,r=t.green,n=t.blue,o=t.alpha;return"rgba("+e+", "+r+", "+n+", "+(void 0===o?1:o)+")"}({red:tt.transform(e),green:tt.transform(r),blue:tt.transform(n),alpha:Z(H.transform(i))})}},nt={test:function(t){return"string"==typeof t?et(t,"hsl"):K(t)},parse:Q(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,r=t.saturation,n=t.lightness,o=t.alpha,i=void 0===o?1:o;return function(t){var e=t.hue,r=t.saturation,n=t.lightness,o=t.alpha;return"hsla("+e+", "+r+", "+n+", "+(void 0===o?1:o)+")"}({hue:Math.round(e),saturation:D.transform(Z(r)),lightness:D.transform(Z(n)),alpha:Z(H.transform(i))})}},ot=V({},rt,{test:function(t){return"string"==typeof t&&et(t,"#")},parse:function(t){var e="",r="",n="";return t.length>4?(e=t.substr(1,2),r=t.substr(3,2),n=t.substr(5,2)):(e=t.substr(1,1),r=t.substr(2,1),n=t.substr(3,1),e+=e,r+=r,n+=n),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:1}}}),it={test:function(t){return"string"==typeof t&&F.test(t)||J(t)||K(t)},parse:function(t){return rt.test(t)?rt.parse(t):nt.test(t)?nt.parse(t):ot.test(t)?ot.parse(t):t},transform:function(t){return J(t)?rt.transform(t):K(t)?nt.transform(t):t}},at=e({},N,{transform:Math.round}),ut={color:it,backgroundColor:it,outlineColor:it,fill:it,stroke:it,borderColor:it,borderTopColor:it,borderRightColor:it,borderBottomColor:it,borderLeftColor:it,borderWidth:_,borderTopWidth:_,borderRightWidth:_,borderBottomWidth:_,borderLeftWidth:_,borderRadius:_,radius:_,borderTopLeftRadius:_,borderTopRightRadius:_,borderBottomRightRadius:_,borderBottomLeftRadius:_,width:_,maxWidth:_,height:_,maxHeight:_,size:_,top:_,right:_,bottom:_,left:_,padding:_,paddingTop:_,paddingRight:_,paddingBottom:_,paddingLeft:_,margin:_,marginTop:_,marginRight:_,marginBottom:_,marginLeft:_,rotate:q,rotateX:q,rotateY:q,rotateZ:q,scale:U,scaleX:U,scaleY:U,scaleZ:U,skew:q,skewX:q,skewY:q,distance:_,translateX:_,translateY:_,translateZ:_,x:_,y:_,z:_,perspective:_,opacity:H,originX:G,originY:G,originZ:_,zIndex:at,fillOpacity:H,strokeOpacity:H,numOctaves:at},st=function(t){return ut[t]},ft=function(t,e){return e&&"number"==typeof t?e.transform(t):t},dt="scrollLeft",ct="scrollTop",lt=new Set([dt,ct]),pt=new Set([dt,ct,"transform"]),ht={x:"translateX",y:"translateY",z:"translateZ"};function vt(t){return"function"==typeof t}function gt(t,e,r,n,o,i,a){void 0===e&&(e=!0),void 0===r&&(r={}),void 0===n&&(n={}),void 0===o&&(o={}),void 0===i&&(i=[]),void 0===a&&(a=!1);var u=!0,s=!1,f=!1;for(var d in t){var c=t[d],l=st(d),p=ft(c,l);X(d)?(s=!0,n[d]=p,i.push(d),u&&(l.default&&c!==l.default||!l.default&&0!==c)&&(u=!1)):B(d)?(o[d]=p,f=!0):pt.has(d)&&vt(p)||(r[W(d,a)]=p)}return(s||"function"==typeof t.transform)&&(r.transform=function(t,e,r,n,o){var i="",a=!1;r.sort(Y);for(var u=r.length,s=0;s<u;s++){var f=r[s];i+=(ht[f]||f)+"("+e[f]+") ",a="z"===f||a}return!a&&o?i+="translateZ(0)":i=i.trim(),vt(t.transform)?i=t.transform(e,i):n&&(i="none"),i}(t,n,i,u,e)),f&&(r.transformOrigin=(o.originX||"50%")+" "+(o.originY||"50%")+" "+(o.originZ||0)),r}function mt(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0);var r={},n={},o={},i=[];return function(a){return i.length=0,gt(a,t,r,n,o,i,e),r}}var yt=O({onRead:function(t,e){var r=e.element,n=e.preparseOutput,o=st(t);if(X(t))return o&&o.default||0;if(lt.has(t))return r[t];var i=window.getComputedStyle(r,null).getPropertyValue(W(t,!0))||0;return n&&o&&o.test(i)&&o.parse?o.parse(i):i},onRender:function(t,e,r){var n=e.element,o=e.buildStyles,i=e.hasCSSVariable;if(Object.assign(n.style,o(t)),i)for(var a=r.length,u=0;u<a;u++){var s=r[u];s.startsWith("--")&&n.style.setProperty(s,t[s])}-1!==r.indexOf(dt)&&(n[dt]=t[dt]),-1!==r.indexOf(ct)&&(n[ct]=t[ct])},uncachedValues:lt});var bt=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),wt=function(){return{style:{}}},Ot=function(t,e){return _.transform(t*e)},xt={x:0,y:0,width:0,height:0};function St(t,e,r){return"string"==typeof t?t:_.transform(e+r*t)}function Rt(t,e,n,o,i){void 0===e&&(e=xt),void 0===o&&(o=mt(!1,!1)),void 0===i&&(i=wt());var a=t.x,u=t.y,s=(t.z,t.originX),f=void 0===s?.5:s,d=t.originY,c=void 0===d?.5:d,l=t.pathLength,p=t.pathSpacing,h=void 0===p?1:p,v=t.pathOffset,g=void 0===v?0:v,m=o(r(t,["x","y","z","originX","originY","pathLength","pathSpacing","pathOffset"]));for(var y in m){if("transform"===y)i.style.transform=m[y];else i[bt.has(y)?y:S(y)]=m[y]}return void 0===f&&void 0===c||(i.style.transformOrigin=function(t,e,r){return St(e,t.x,t.width)+" "+St(r,t.y,t.height)}(e,f,c)),void 0!==a&&(i.x=a),void 0!==u&&(i.y=u),void 0!==n&&void 0!==l&&(i["stroke-dashoffset"]=Ot(-g,n),i["stroke-dasharray"]=Ot(l,n)+" "+Ot(h,n)),i}var kt=O({onRead:function(t,e){var r=e.element;if(X(t=bt.has(t)?t:S(t))){var n=st(t);return n&&n.default||0}return r.getAttribute(t)},onRender:function(t,e){var r=e.element,n=(0,e.buildAttrs)(t);for(var o in n)"style"===o?Object.assign(r.style,n.style):r.setAttribute(o,n[o])}}),Ct=function(t){var e=function(t){try{return function(t){return"function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}(t)}catch(t){return{x:0,y:0,width:0,height:0}}}(t),r=function(t){return"path"===t.tagName}(t)&&t.getTotalLength?t.getTotalLength():void 0;return kt({element:t,buildAttrs:function(t,e){var r=wt(),n=mt(!1,!1);return function(o){return Rt(o,t,e,n,r)}}(e,r)})},Tt=O({useCache:!1,onRead:function(t){return"scrollTop"===t?window.pageYOffset:window.pageXOffset},onRender:function(t){var e=t.scrollTop,r=void 0===e?0:e,n=t.scrollLeft,o=void 0===n?0:n;return window.scrollTo(o,r)}}),Lt=function(){};"production"!==process.env.NODE_ENV&&(Lt=function(t,e){if(!t)throw new Error(e)});var Mt=new WeakMap,Wt=function(t,n){var o;return t instanceof HTMLElement?o=function(t,n){void 0===n&&(n={});var o=n.enableHardwareAcceleration,i=r(n,["enableHardwareAcceleration"]);return yt(e({element:t,buildStyles:mt(o),preparseOutput:!0},i))}(t,n):t instanceof SVGElement?o=Ct(t):t===window&&(o=Tt(t)),Lt(void 0!==o,"No valid node provided. Node must be HTMLElement, SVGElement or window."),Mt.set(t,o),o},Pt=function(t,e){return Mt.has(t)?Mt.get(t):Wt(t,e)};t.default=function(t,e){var r="string"==typeof t?document.querySelector(t):t;return Pt(r,e)},t.createStylerFactory=O,t.buildStyleProperty=gt,t.buildSVGAttrs=Rt,t.transformProps=A,t.isTransformProp=X,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "stylefire",
"version": "6.0.7",
"version": "6.0.8",
"description": "Performant, simplified stylers for CSS, SVG, path and DOM scroll.",

@@ -58,6 +58,6 @@ "main": "lib/index.js",

"dependencies": {
"@popmotion/popcorn": "^0.4.0",
"@popmotion/popcorn": "^0.4.2",
"framesync": "^4.0.0",
"hey-listen": "^1.0.8",
"style-value-types": "^3.1.4"
"style-value-types": "^3.1.6"
},

@@ -64,0 +64,0 @@ "unpkg": "./dist/stylefire.min.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc