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 4.1.2 to 4.1.3

6

CHANGELOG.md

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

## [4.1.3] 2019-05-01
### Upgrade
- Dependencies.
## [4.1.2] 2019-04-30

@@ -7,0 +13,0 @@

37

dist/stylefire.js

@@ -340,12 +340,4 @@ (function (global, factory) {

}; };
var isFirstChars = function (term) { return function (v) {
return typeof v === 'string' && v.indexOf(term) === 0;
}; };
var getValueFromFunctionString = function (value) {
return value.substring(value.indexOf('(') + 1, value.lastIndexOf(')'));
};
var splitCommaDelimited = function (value) {
return typeof value === 'string' ? value.split(/,\s*/) : [value];
};
var sanitize = function (v) { return (v % 1 ? Number(v.toFixed(5)) : v); };
var singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i;

@@ -372,8 +364,9 @@ var number = {

var getValueFromFunctionString = function (value) {
return value.substring(value.indexOf('(') + 1, value.lastIndexOf(')'));
};
var clampRgbUnit = clamp(0, 255);
var onlyColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i;
var isRgba = function (v) { return v.red !== undefined; };
var isHsla = function (v) { return v.hue !== undefined; };
var splitColorValues = function (terms) {
var numTerms = terms.length;
return function (v) {

@@ -383,4 +376,4 @@ if (typeof v !== 'string')

var values = {};
var valuesArray = splitCommaDelimited(getValueFromFunctionString(v));
for (var i = 0; i < numTerms; i++) {
var valuesArray = getValueFromFunctionString(v).split(/,\s*/);
for (var i = 0; i < 4; i++) {
values[terms[i]] =

@@ -401,5 +394,7 @@ valuesArray[i] !== undefined ? parseFloat(valuesArray[i]) : 1;

var rgbUnit = __assign$1({}, number, { transform: function (v) { return Math.round(clampRgbUnit(v)); } });
var testRgbaString = isFirstChars('rgb');
function isColorString(color, colorType) {
return color.startsWith(colorType) && singleColorRegex.test(color);
}
var rgba = {
test: function (v) { return (typeof v === 'string' ? testRgbaString(v) : isRgba(v)); },
test: function (v) { return (typeof v === 'string' ? isColorString(v, 'rgb') : isRgba(v)); },
parse: splitColorValues(['red', 'green', 'blue', 'alpha']),

@@ -416,5 +411,4 @@ transform: function (_a) {

};
var testHslaString = isFirstChars('hsl');
var hsla = {
test: function (v) { return (typeof v === 'string' ? testHslaString(v) : isHsla(v)); },
test: function (v) { return (typeof v === 'string' ? isColorString(v, 'hsl') : isHsla(v)); },
parse: splitColorValues(['hue', 'saturation', 'lightness', 'alpha']),

@@ -431,3 +425,3 @@ transform: function (_a) {

};
var hex = __assign$1({}, rgba, { test: isFirstChars('#'), parse: function (v) {
var hex = __assign$1({}, rgba, { test: function (v) { return typeof v === 'string' && isColorString(v, '#'); }, parse: function (v) {
var r = '';

@@ -458,6 +452,5 @@ var g = '';

test: function (v) {
return (typeof v === 'string' && onlyColorRegex.test(v)) ||
rgba.test(v) ||
hsla.test(v) ||
hex.test(v);
return (typeof v === 'string' && singleColorRegex.test(v)) ||
isRgba(v) ||
isHsla(v);
},

@@ -464,0 +457,0 @@ parse: function (v) {

@@ -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,a=0,i="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-a));a=e+r,setTimeout(function(){return t(a)},r)};!function(t){t.Read="read",t.Update="update",t.Render="render",t.PostRender="postRender",t.FixedUpdate="fixedUpdate"}(o||(o={}));var s,u=1/60*1e3,f=!0,c=!1,d=!1,l={delta:0,timestamp:0},p=[o.Read,o.Update,o.Render,o.PostRender],h=function(t){return c=t},g=p.reduce(function(t,e){var r,o,a,i,s,u,f,d,l,p=(r=h,o=[],a=[],i=0,s=!1,u=0,f=new WeakSet,d=new WeakSet,l={cancel:function(t){var e=a.indexOf(t);f.add(t),-1!==e&&a.splice(e,1)},process:function(t){var e,n;if(s=!0,o=(e=[a,o])[0],(a=e[1]).length=0,i=o.length)for(u=0;u<i;u++)(n=o[u])(t),!0!==d.has(n)||f.has(n)||(l.schedule(n),r(!0));s=!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 u=r&&s,c=u?o:a;f.delete(t),e&&d.add(t),-1===c.indexOf(t)&&(c.push(t),u&&(i=o.length))}});return t.sync[e]=function(t,e,r){return void 0===e&&(e=!1),void 0===r&&(r=!1),c||w(),p.schedule(t,e,r),t},t.cancelSync[e]=function(t){return p.cancel(t)},t.steps[e]=p,t},{steps:{},sync:{},cancelSync:{}}),v=g.steps,m=g.sync,y=(g.cancelSync,function(t){return v[t].process(l)}),b=function(t){c=!1,l.delta=f?u:Math.max(Math.min(t-l.timestamp,40),1),f||(u=l.delta),l.timestamp=t,d=!0,p.forEach(y),d=!1,c&&(f=!1,i(b))},w=function(){c=!0,f=!0,d||i(b)},O=function(t){var e=t.onRead,n=t.onRender,o=t.uncachedValues,a=void 0===o?new Set:o,i=t.useCache,s=void 0===i||i;return function(t){void 0===t&&(t={});var o=r(t,[]),i={},u=[],f=!1;function c(t,e){t.startsWith("--")&&(o.hasCSSVariable=!0);var r=i[t];i[t]=e,i[t]!==r&&(-1===u.indexOf(t)&&u.push(t),f||(f=!0,m.render(d.render)))}var d={get:function(t,r){return void 0===r&&(r=!1),!r&&s&&!a.has(t)&&void 0!==i[t]?i[t]:e(t,o)},set:function(t,e){if("string"==typeof t)c(t,e);else for(var r in t)c(r,t[r]);return this},render:function(t){return void 0===t&&(t=!1),(f||!0===t)&&(n(i,o,u),f=!1,u.length=0),this}};return d}},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",""],P=C.length,L="undefined"!=typeof document,Y=function(t,e){return k.set(t,S(e))},M=function(t,e){void 0===e&&(e=!1);var r=e?k:R;return r.has(t)||(L?function(t){s=s||document.createElement("div");for(var e=0;e<P;e++){var r=C[e],n=""===r,o=n?t:r+t.charAt(0).toUpperCase()+t.slice(1);(o in s.style||n)&&(R.set(t,o),Y(t,(n?"":"-")+S(o)))}}(t):function(t){Y(t,t)}(t)),r.get(t)||t},T=["","X","Y","Z"],X=["scale","rotate","skew","transformPerspective"].reduce(function(t,e){return T.reduce(function(t,r){return t.push(e+r),t},t)},["x","y","z"]),W=X.reduce(function(t,e){return t[e]=!0,t},{});function E(t){return!0===W[t]}function B(t,e){return X.indexOf(t)-X.indexOf(e)}var j=new Set(["originX","originY","originZ"]);function A(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)},F=function(t,e){return function(r){return Math.max(Math.min(r,e),t)}},Z=function(t){return function(e){return"string"==typeof e&&0===e.indexOf(t)}},N=function(t){return t%1?Number(t.toFixed(5)):t},z={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},H=V({},z,{transform:F(0,1)}),U=V({},z,{default:1}),q=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}}},D=q("deg"),I=q("%"),_=q("px"),$=V({},I,{parse:function(t){return I.parse(t)/100},transform:function(t){return I.transform(100*t)}}),G=F(0,255),J=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,K=function(t){return void 0!==t.red},Q=function(t){return void 0!==t.hue},tt=function(t){var e=t.length;return function(r){if("string"!=typeof r)return r;for(var n,o={},a=function(t){return"string"==typeof t?t.split(/,\s*/):[t]}((n=r).substring(n.indexOf("(")+1,n.lastIndexOf(")"))),i=0;i<e;i++)o[t[i]]=void 0!==a[i]?parseFloat(a[i]):1;return o}},et=V({},z,{transform:function(t){return Math.round(G(t))}}),rt=Z("rgb"),nt={test:function(t){return"string"==typeof t?rt(t):K(t)},parse:tt(["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:et.transform(e),green:et.transform(r),blue:et.transform(n),alpha:N(o)})}},ot=Z("hsl"),at={test:function(t){return"string"==typeof t?ot(t):Q(t)},parse:tt(["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:I.transform(N(r)),lightness:I.transform(N(n)),alpha:N(o)})}},it=V({},nt,{test:Z("#"),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}}}),st={test:function(t){return"string"==typeof t&&J.test(t)||nt.test(t)||at.test(t)||it.test(t)},parse:function(t){return nt.test(t)?nt.parse(t):at.test(t)?at.parse(t):it.test(t)?it.parse(t):t},transform:function(t){return K(t)?nt.transform(t):Q(t)?at.transform(t):t}},ut={color:st,backgroundColor:st,outlineColor:st,fill:st,stroke:st,borderColor:st,borderTopColor:st,borderRightColor:st,borderBottomColor:st,borderLeftColor:st,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:D,rotateX:D,rotateY:D,rotateZ:D,scale:U,scaleX:U,scaleY:U,scaleZ:U,skew:D,skewX:D,skewY:D,distance:_,x:_,y:_,z:_,perspective:_,opacity:H,originX:$,originY:$,originZ:_},ft=function(t){return ut[t]},ct=function(t,e){return e&&"number"==typeof t?e.transform(t):t},dt="scrollLeft",lt="scrollTop",pt=new Set([dt,lt]),ht=new Set([dt,lt,"transform"]),gt={x:"translateX",y:"translateY",z:"translateZ"};function vt(t){return"function"==typeof t}function mt(t,e,r,n,o,a,i){void 0===e&&(e=!0),void 0===r&&(r={}),void 0===n&&(n={}),void 0===o&&(o={}),void 0===a&&(a=[]),void 0===i&&(i=!1);var s=!0,u=!1,f=!1;for(var c in t){var d=t[c],l=ft(c),p=ct(d,l);E(c)?(u=!0,n[c]=p,a.push(c),s&&(l.default&&d!==l.default||!l.default&&0!==d)&&(s=!1)):A(c)?(o[c]=p,f=!0):ht.has(c)&&vt(p)||(r[M(c,i)]=p)}return(u||"function"==typeof t.transform)&&(r.transform=function(t,e,r,n,o){var a="",i=!1;r.sort(B);for(var s=r.length,u=0;u<s;u++){var f=r[u];a+=(gt[f]||f)+"("+e[f]+") ",i="z"===f||i}return!i&&o?a+="translateZ(0)":a=a.trim(),vt(t.transform)?a=t.transform(e,a):n&&(a="none"),a}(t,n,a,s,e)),f&&(r.transformOrigin=(o.originX||0)+" "+(o.originY||0)+" "+(o.originZ||0)),r}var yt=O({onRead:function(t,e){var r=e.element,n=e.preparseOutput,o=ft(t);if(E(t))return o&&o.default||0;if(pt.has(t))return r[t];var a=window.getComputedStyle(r,null).getPropertyValue(M(t,!0))||0;return n&&o&&o.test(a)&&o.parse?o.parse(a):a},onRender:function(t,e,r){var n=e.element,o=e.buildStyles,a=e.hasCSSVariable;if(Object.assign(n.style,o(t)),a)for(var i=r.length,s=0;s<i;s++){var u=r[s];u.startsWith("--")&&n.style.setProperty(u,t[u])}-1!==r.indexOf(dt)&&(n[dt]=t[dt]),-1!==r.indexOf(lt)&&(n[lt]=t[lt])},uncachedValues:pt});function bt(t,n){void 0===n&&(n={});var o=n.enableHardwareAcceleration,a=r(n,["enableHardwareAcceleration"]);return yt(e({element:t,buildStyles:function(t){void 0===t&&(t=!0);var e={},r={},n={},o=[];return function(a){return o.length=0,mt(a,t,e,r,n,o,!0),e}}(o),preparseOutput:!0},a))}var wt=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),Ot=function(t,e){return t*e+"px"},xt={fill:st,stroke:st,scale:U,scaleX:U,scaleY:U,opacity:H,fillOpacity:H,strokeOpacity:H,numOctaves:e({},z,{transform:Math.round})},St=O({onRead:function(t,e){var r=e.element;if(E(t)){var n=function(t){return xt[t]}(t);return n?n.default:0}return r.getAttribute(t)},onRender:function(t,e){var r=e.dimensions;!function(t,e){for(var r in e)e.hasOwnProperty(r)&&t.setAttribute(r,e[r])}(e.element,function(t,e,r,n){var o=!1,a=!1,i={},s=r?{pathLength:"0",pathSpacing:""+n}:void 0,u=void 0!==t.scale?t.scale||1e-7:t.scaleX||1,f=void 0!==t.scaleY?t.scaleY||1e-7:u||1,c=e.width*(t.originX||50)+e.x,d=e.height*(t.originY||50)+e.y,l=1*u*-c,p=1*f*-d,h=c/u,g=d/f,v={translate:"translate("+t.x+", "+t.y+") ",scale:"translate("+l+", "+p+") scale("+u+", "+f+") translate("+h+", "+g+") ",rotate:"rotate("+t.rotate+", "+c+", "+d+") ",skewX:"skewX("+t.skewX+") ",skewY:"skewY("+t.skewY+") "};for(var m in t)if(t.hasOwnProperty(m)){var y=t[m];E(m)?o=!0:!r||"pathLength"!==m&&"pathSpacing"!==m||"number"!=typeof y?r&&"pathOffset"===m?i["stroke-dashoffset"]=Ot(-y,n):i[wt.has(m)?m:S(m)]=y:(a=!0,s[m]=Ot(y,n))}if(a&&(i["stroke-dasharray"]=s.pathLength+" "+s.pathSpacing),o)for(var m in i.transform="",v)if(v.hasOwnProperty(m)){var b="scale"===m?"1":"0";i.transform+=v[m].replace(/undefined/g,b)}return i}(t,r,e.isPath,e.pathLength))}}),Rt=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)}}),kt=function(){};"production"!==process.env.NODE_ENV&&(kt=function(t,e){if(!t)throw new Error(e)});var Ct=new WeakMap,Pt=function(t,e){var r;return t instanceof HTMLElement?r=bt(t,e):t instanceof SVGElement?r=function(t){var e={element:t,dimensions: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),isPath:!1};return"path"===t.tagName&&(e.isPath=!0,e.pathLength=t.getTotalLength()),St(e)}(t):t===window&&(r=Rt(t)),kt(void 0!==r,"No valid node provided. Node must be HTMLElement, SVGElement or window."),Ct.set(t,r),r},Lt=function(t,e){return Ct.has(t)?Ct.get(t):Pt(t,e)};t.default=function(t,e){var r="string"==typeof t?document.querySelector(t):t;return Lt(r,e)},t.createStylerFactory=O,t.buildStyleProperty=mt,t.isTransformProp=E,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,a=0,i="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-a));a=e+r,setTimeout(function(){return t(a)},r)};!function(t){t.Read="read",t.Update="update",t.Render="render",t.PostRender="postRender",t.FixedUpdate="fixedUpdate"}(o||(o={}));var s,u=1/60*1e3,f=!0,c=!1,d=!1,l={delta:0,timestamp:0},p=[o.Read,o.Update,o.Render,o.PostRender],h=function(t){return c=t},g=p.reduce(function(t,e){var r,o,a,i,s,u,f,d,l,p=(r=h,o=[],a=[],i=0,s=!1,u=0,f=new WeakSet,d=new WeakSet,l={cancel:function(t){var e=a.indexOf(t);f.add(t),-1!==e&&a.splice(e,1)},process:function(t){var e,n;if(s=!0,o=(e=[a,o])[0],(a=e[1]).length=0,i=o.length)for(u=0;u<i;u++)(n=o[u])(t),!0!==d.has(n)||f.has(n)||(l.schedule(n),r(!0));s=!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 u=r&&s,c=u?o:a;f.delete(t),e&&d.add(t),-1===c.indexOf(t)&&(c.push(t),u&&(i=o.length))}});return t.sync[e]=function(t,e,r){return void 0===e&&(e=!1),void 0===r&&(r=!1),c||w(),p.schedule(t,e,r),t},t.cancelSync[e]=function(t){return p.cancel(t)},t.steps[e]=p,t},{steps:{},sync:{},cancelSync:{}}),v=g.steps,m=g.sync,y=(g.cancelSync,function(t){return v[t].process(l)}),b=function(t){c=!1,l.delta=f?u:Math.max(Math.min(t-l.timestamp,40),1),f||(u=l.delta),l.timestamp=t,d=!0,p.forEach(y),d=!1,c&&(f=!1,i(b))},w=function(){c=!0,f=!0,d||i(b)},O=function(t){var e=t.onRead,n=t.onRender,o=t.uncachedValues,a=void 0===o?new Set:o,i=t.useCache,s=void 0===i||i;return function(t){void 0===t&&(t={});var o=r(t,[]),i={},u=[],f=!1;function c(t,e){t.startsWith("--")&&(o.hasCSSVariable=!0);var r=i[t];i[t]=e,i[t]!==r&&(-1===u.indexOf(t)&&u.push(t),f||(f=!0,m.render(d.render)))}var d={get:function(t,r){return void 0===r&&(r=!1),!r&&s&&!a.has(t)&&void 0!==i[t]?i[t]:e(t,o)},set:function(t,e){if("string"==typeof t)c(t,e);else for(var r in t)c(r,t[r]);return this},render:function(t){return void 0===t&&(t=!1),(f||!0===t)&&(n(i,o,u),f=!1,u.length=0),this}};return d}},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",""],P=C.length,L="undefined"!=typeof document,Y=function(t,e){return k.set(t,S(e))},M=function(t,e){void 0===e&&(e=!1);var r=e?k:R;return r.has(t)||(L?function(t){s=s||document.createElement("div");for(var e=0;e<P;e++){var r=C[e],n=""===r,o=n?t:r+t.charAt(0).toUpperCase()+t.slice(1);(o in s.style||n)&&(R.set(t,o),Y(t,(n?"":"-")+S(o)))}}(t):function(t){Y(t,t)}(t)),r.get(t)||t},T=["","X","Y","Z"],X=["scale","rotate","skew","transformPerspective"].reduce(function(t,e){return T.reduce(function(t,r){return t.push(e+r),t},t)},["x","y","z"]),W=X.reduce(function(t,e){return t[e]=!0,t},{});function E(t){return!0===W[t]}function B(t,e){return X.indexOf(t)-X.indexOf(e)}var j=new Set(["originX","originY","originZ"]);function A(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)},F=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},N=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,z={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},H=V({},z,{transform:F(0,1)}),U=V({},z,{default:1}),q=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}}},D=q("deg"),I=q("%"),_=q("px"),$=V({},I,{parse:function(t){return I.parse(t)/100},transform:function(t){return I.transform(100*t)}}),G=F(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*/),a=0;a<4;a++)n[t[a]]=void 0!==o[a]?parseFloat(o[a]):1;return n}},tt=V({},z,{transform:function(t){return Math.round(G(t))}});function et(t,e){return t.startsWith(e)&&N.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:I.transform(Z(r)),lightness:I.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}}}),at={test:function(t){return"string"==typeof t&&N.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}},it={color:at,backgroundColor:at,outlineColor:at,fill:at,stroke:at,borderColor:at,borderTopColor:at,borderRightColor:at,borderBottomColor:at,borderLeftColor:at,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:D,rotateX:D,rotateY:D,rotateZ:D,scale:U,scaleX:U,scaleY:U,scaleZ:U,skew:D,skewX:D,skewY:D,distance:_,x:_,y:_,z:_,perspective:_,opacity:H,originX:$,originY:$,originZ:_},st=function(t){return it[t]},ut=function(t,e){return e&&"number"==typeof t?e.transform(t):t},ft="scrollLeft",ct="scrollTop",dt=new Set([ft,ct]),lt=new Set([ft,ct,"transform"]),pt={x:"translateX",y:"translateY",z:"translateZ"};function ht(t){return"function"==typeof t}function gt(t,e,r,n,o,a,i){void 0===e&&(e=!0),void 0===r&&(r={}),void 0===n&&(n={}),void 0===o&&(o={}),void 0===a&&(a=[]),void 0===i&&(i=!1);var s=!0,u=!1,f=!1;for(var c in t){var d=t[c],l=st(c),p=ut(d,l);E(c)?(u=!0,n[c]=p,a.push(c),s&&(l.default&&d!==l.default||!l.default&&0!==d)&&(s=!1)):A(c)?(o[c]=p,f=!0):lt.has(c)&&ht(p)||(r[M(c,i)]=p)}return(u||"function"==typeof t.transform)&&(r.transform=function(t,e,r,n,o){var a="",i=!1;r.sort(B);for(var s=r.length,u=0;u<s;u++){var f=r[u];a+=(pt[f]||f)+"("+e[f]+") ",i="z"===f||i}return!i&&o?a+="translateZ(0)":a=a.trim(),ht(t.transform)?a=t.transform(e,a):n&&(a="none"),a}(t,n,a,s,e)),f&&(r.transformOrigin=(o.originX||0)+" "+(o.originY||0)+" "+(o.originZ||0)),r}var vt=O({onRead:function(t,e){var r=e.element,n=e.preparseOutput,o=st(t);if(E(t))return o&&o.default||0;if(dt.has(t))return r[t];var a=window.getComputedStyle(r,null).getPropertyValue(M(t,!0))||0;return n&&o&&o.test(a)&&o.parse?o.parse(a):a},onRender:function(t,e,r){var n=e.element,o=e.buildStyles,a=e.hasCSSVariable;if(Object.assign(n.style,o(t)),a)for(var i=r.length,s=0;s<i;s++){var u=r[s];u.startsWith("--")&&n.style.setProperty(u,t[u])}-1!==r.indexOf(ft)&&(n[ft]=t[ft]),-1!==r.indexOf(ct)&&(n[ct]=t[ct])},uncachedValues:dt});function mt(t,n){void 0===n&&(n={});var o=n.enableHardwareAcceleration,a=r(n,["enableHardwareAcceleration"]);return vt(e({element:t,buildStyles:function(t){void 0===t&&(t=!0);var e={},r={},n={},o=[];return function(a){return o.length=0,gt(a,t,e,r,n,o,!0),e}}(o),preparseOutput:!0},a))}var yt=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),bt=function(t,e){return t*e+"px"},wt={fill:at,stroke:at,scale:U,scaleX:U,scaleY:U,opacity:H,fillOpacity:H,strokeOpacity:H,numOctaves:e({},z,{transform:Math.round})},Ot=O({onRead:function(t,e){var r=e.element;if(E(t)){var n=function(t){return wt[t]}(t);return n?n.default:0}return r.getAttribute(t)},onRender:function(t,e){var r=e.dimensions;!function(t,e){for(var r in e)e.hasOwnProperty(r)&&t.setAttribute(r,e[r])}(e.element,function(t,e,r,n){var o=!1,a=!1,i={},s=r?{pathLength:"0",pathSpacing:""+n}:void 0,u=void 0!==t.scale?t.scale||1e-7:t.scaleX||1,f=void 0!==t.scaleY?t.scaleY||1e-7:u||1,c=e.width*(t.originX||50)+e.x,d=e.height*(t.originY||50)+e.y,l=1*u*-c,p=1*f*-d,h=c/u,g=d/f,v={translate:"translate("+t.x+", "+t.y+") ",scale:"translate("+l+", "+p+") scale("+u+", "+f+") translate("+h+", "+g+") ",rotate:"rotate("+t.rotate+", "+c+", "+d+") ",skewX:"skewX("+t.skewX+") ",skewY:"skewY("+t.skewY+") "};for(var m in t)if(t.hasOwnProperty(m)){var y=t[m];E(m)?o=!0:!r||"pathLength"!==m&&"pathSpacing"!==m||"number"!=typeof y?r&&"pathOffset"===m?i["stroke-dashoffset"]=bt(-y,n):i[yt.has(m)?m:S(m)]=y:(a=!0,s[m]=bt(y,n))}if(a&&(i["stroke-dasharray"]=s.pathLength+" "+s.pathSpacing),o)for(var m in i.transform="",v)if(v.hasOwnProperty(m)){var b="scale"===m?"1":"0";i.transform+=v[m].replace(/undefined/g,b)}return i}(t,r,e.isPath,e.pathLength))}}),xt=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)}}),St=function(){};"production"!==process.env.NODE_ENV&&(St=function(t,e){if(!t)throw new Error(e)});var Rt=new WeakMap,kt=function(t,e){var r;return t instanceof HTMLElement?r=mt(t,e):t instanceof SVGElement?r=function(t){var e={element:t,dimensions: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),isPath:!1};return"path"===t.tagName&&(e.isPath=!0,e.pathLength=t.getTotalLength()),Ot(e)}(t):t===window&&(r=xt(t)),St(void 0!==r,"No valid node provided. Node must be HTMLElement, SVGElement or window."),Rt.set(t,r),r},Ct=function(t,e){return Rt.has(t)?Rt.get(t):kt(t,e)};t.default=function(t,e){var r="string"==typeof t?document.querySelector(t):t;return Ct(r,e)},t.createStylerFactory=O,t.buildStyleProperty=gt,t.isTransformProp=E,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "stylefire",
"version": "4.1.2",
"version": "4.1.3",
"description": "Performant, simplified stylers for CSS, SVG, path and DOM scroll.",

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

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

@@ -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