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 7.0.0 to 7.0.1

6

CHANGELOG.md

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

## [7.0.1] 2019-11-14
### Fixed
- Upgraded to Typescript 3.7.
## [7.0.0] 2019-10-08

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

36

dist/stylefire.es.js

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

import { __rest, __assign } from 'tslib';
import sync from 'framesync';

@@ -5,35 +6,2 @@ import { alpha, color, degrees, scale, px, progressPercentage, number } from 'style-value-types';

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var __assign = function () {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
return t;
}
var createStyler = function (_a) {

@@ -170,3 +138,3 @@ var onRead = _a.onRead,

var int = /*#__PURE__*/__assign({}, number, { transform: Math.round });
var int = /*#__PURE__*/__assign( /*#__PURE__*/__assign({}, number), { transform: Math.round });
var valueTypes = {

@@ -173,0 +141,0 @@ color: color,

@@ -347,4 +347,4 @@ (function (global, factory) {

};
var alpha = __assign$1({}, number, { transform: clamp(0, 1) });
var scale = __assign$1({}, number, { default: 1 });
var alpha = __assign$1(__assign$1({}, number), { transform: clamp(0, 1) });
var scale = __assign$1(__assign$1({}, number), { default: 1 });

@@ -361,3 +361,3 @@ var createUnitType = function (unit) { return ({

var px = createUnitType('px');
var progressPercentage = __assign$1({}, percent, { parse: function (v) { return percent.parse(v) / 100; }, transform: function (v) { return percent.transform(v * 100); } });
var progressPercentage = __assign$1(__assign$1({}, percent), { parse: function (v) { return percent.parse(v) / 100; }, transform: function (v) { return percent.transform(v * 100); } });

@@ -391,3 +391,3 @@ var getValueFromFunctionString = function (value) {

};
var rgbUnit = __assign$1({}, number, { transform: function (v) { return Math.round(clampRgbUnit(v)); } });
var rgbUnit = __assign$1(__assign$1({}, number), { transform: function (v) { return Math.round(clampRgbUnit(v)); } });
function isColorString(color, colorType) {

@@ -422,3 +422,3 @@ return color.startsWith(colorType) && singleColorRegex.test(color);

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

@@ -476,3 +476,3 @@ var g = '';

var int = __assign({}, number, { transform: Math.round });
var int = __assign(__assign({}, number), { transform: Math.round });
var valueTypes = {

@@ -479,0 +479,0 @@ color: color,

@@ -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,o=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-o));o=e+r,setTimeout(function(){return t(o)},r)};!function(t){t.Read="read",t.Update="update",t.Render="render",t.PostRender="postRender",t.FixedUpdate="fixedUpdate"}(n||(n={}));var i,s=1/60*1e3,u=!0,f=!1,d=!1,c={delta:0,timestamp:0},l=[n.Read,n.Update,n.Render,n.PostRender],p=function(t){return f=t},h=l.reduce(function(t,e){var r,n,o,a,i,s,u,d,c,l=(r=p,n=[],o=[],a=0,i=!1,s=0,u=new WeakSet,d=new WeakSet,c={cancel:function(t){var e=o.indexOf(t);u.add(t),-1!==e&&o.splice(e,1)},process:function(t){var e,f;if(i=!0,n=(e=[o,n])[0],(o=e[1]).length=0,a=n.length)for(s=0;s<a;s++)(f=n[s])(t),!0!==d.has(f)||u.has(f)||(c.schedule(f),r(!0));i=!1},schedule:function(t,e,r){void 0===e&&(e=!1),void 0===r&&(r=!1);var s=r&&i,f=s?n:o;u.delete(t),e&&d.add(t),-1===f.indexOf(t)&&(f.push(t),s&&(a=n.length))}});return t.sync[e]=function(t,e,r){return void 0===e&&(e=!1),void 0===r&&(r=!1),f||b(),l.schedule(t,e,r),t},t.cancelSync[e]=function(t){return l.cancel(t)},t.steps[e]=l,t},{steps:{},sync:{},cancelSync:{}}),v=h.steps,g=h.sync,m=(h.cancelSync,function(t){return v[t].process(c)}),y=function(t){f=!1,c.delta=u?s:Math.max(Math.min(t-c.timestamp,40),1),u||(s=c.delta),c.timestamp=t,d=!0,l.forEach(m),d=!1,f&&(u=!1,a(y))},b=function(){f=!0,u=!0,d||a(y)},w=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 d(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,g.render(c.render)))}var c={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)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(i,o,u),f=!1,u.length=0),this}};return c}},O=/([a-z])([A-Z])/g,x=function(t){return t.replace(O,"$1-$2").toLowerCase()},S=new Map,R=new Map,k=["Webkit","Moz","O","ms",""],C=k.length,T="undefined"!=typeof document,L=function(t,e){return R.set(t,x(e))},M=function(t,e){void 0===e&&(e=!1);var r=e?R:S;return r.has(t)||(T?function(t){i=i||document.createElement("div");for(var e=0;e<C;e++){var r=k[e],n=""===r,o=n?t:r+t.charAt(0).toUpperCase()+t.slice(1);if(o in i.style||n){if(n&&"clipPath"===t&&R.has(t))return;S.set(t,o),L(t,(n?"":"-")+x(o))}}}(t):function(t){L(t,t)}(t)),r.get(t)||t},P=["","X","Y","Z"],W=["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"]),X=W.reduce(function(t,e){return t[e]=!0,t},{});function Y(t){return!0===X[t]}function A(t,e){return W.indexOf(t)-W.indexOf(e)}var j=new Set(["originX","originY","originZ"]);function B(t){return j.has(t)}var Z=function(){return(Z=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},V=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,U={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},E=Z({},U,{transform:F(0,1)}),H=Z({},U,{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=Z({},D,{parse:function(t){return D.parse(t)/100},transform:function(t){return D.transform(100*t)}}),N=F(0,255),_=function(t){return void 0!==t.red},J=function(t){return void 0!==t.hue},K=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}},Q=Z({},U,{transform:function(t){return Math.round(N(t))}});function tt(t,e){return t.startsWith(e)&&V.test(t)}var et={test:function(t){return"string"==typeof t?tt(t,"rgb"):_(t)},parse:K(["red","green","blue","alpha"]),transform:function(t){var e=t.red,r=t.green,n=t.blue,o=t.alpha,a=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:Q.transform(e),green:Q.transform(r),blue:Q.transform(n),alpha:z(E.transform(a))})}},rt={test:function(t){return"string"==typeof t?tt(t,"hsl"):J(t)},parse:K(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,r=t.saturation,n=t.lightness,o=t.alpha,a=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(E.transform(a))})}},nt=Z({},et,{test:function(t){return"string"==typeof t&&tt(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}}}),ot={test:function(t){return"string"==typeof t&&V.test(t)||_(t)||J(t)},parse:function(t){return et.test(t)?et.parse(t):rt.test(t)?rt.parse(t):nt.test(t)?nt.parse(t):t},transform:function(t){return _(t)?et.transform(t):J(t)?rt.transform(t):t}},at=e({},U,{transform:Math.round}),it={color:ot,backgroundColor:ot,outlineColor:ot,fill:ot,stroke:ot,borderColor:ot,borderTopColor:ot,borderRightColor:ot,borderBottomColor:ot,borderLeftColor:ot,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:H,scaleX:H,scaleY:H,scaleZ:H,skew:q,skewX:q,skewY:q,distance:$,translateX:$,translateY:$,translateZ:$,x:$,y:$,z:$,perspective:$,opacity:E,originX:G,originY:G,originZ:$,zIndex:at,fillOpacity:E,strokeOpacity:E,numOctaves:at},st=function(t){return it[t]},ut=function(t,e){return e&&"number"==typeof t?e.transform(t):t},ft="scrollLeft",dt="scrollTop",ct=new Set([ft,dt]),lt=new Set([ft,dt,"transform"]),pt={x:"translateX",y:"translateY",z:"translateZ"};function ht(t){return"function"==typeof t}function vt(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 d in t){var c=t[d],l=st(d),p=ut(c,l);Y(d)?(u=!0,n[d]=p,a.push(d),s&&(l.default&&c!==l.default||!l.default&&0!==c)&&(s=!1)):B(d)?(o[d]=p,f=!0):lt.has(d)&&ht(p)||(r[M(d,i)]=p)}return(u||"function"==typeof t.transform)&&(r.transform=function(t,e,r,n,o){var a="",i=!1;r.sort(A);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||"50%")+" "+(o.originY||"50%")+" "+(o.originZ||0)),r}function gt(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0);var r={},n={},o={},a=[];return function(i){return a.length=0,vt(i,t,r,n,o,a,e),r}}var mt=w({onRead:function(t,e){var r=e.element,n=e.preparseOutput,o=st(t);if(Y(t))return o&&o.default||0;if(ct.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(dt)&&(n[dt]=t[dt])},uncachedValues:ct});var yt=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),bt=.5,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,a,i){void 0===e&&(e=xt),void 0===o&&(o=gt(!1,!1)),void 0===a&&(a=wt()),void 0===i&&(i=!0);var s=t.attrX,u=t.attrY,f=t.originX,d=t.originY,c=t.pathLength,l=t.pathSpacing,p=void 0===l?1:l,h=t.pathOffset,v=void 0===h?0:h,g=o(r(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]));for(var m in g){if("transform"===m)a.style.transform=g[m];else a[i&&!yt.has(m)?x(m):m]=g[m]}return(void 0!==f||void 0!==d||g.transform)&&(a.style.transformOrigin=function(t,e,r){return St(e,t.x,t.width)+" "+St(r,t.y,t.height)}(e,void 0!==f?f:bt,void 0!==d?d:bt)),void 0!==s&&(a.x=s),void 0!==u&&(a.y=u),void 0!==n&&void 0!==c&&(a[i?"stroke-dashoffset":"strokeDashoffset"]=Ot(-v,n),a[i?"stroke-dasharray":"strokeDasharray"]=Ot(c,n)+" "+Ot(p,n)),a}var kt=w({onRead:function(t,e){var r=e.element;if(Y(t=yt.has(t)?t:x(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,r){void 0===r&&(r=!0);var n=wt(),o=gt(!1,!1);return function(a){return Rt(a,t,e,o,n,r)}}(e,r)})},Tt=w({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=new WeakMap,Mt=function(t,n){var o;return t instanceof HTMLElement?o=function(t,n){void 0===n&&(n={});var o=n.enableHardwareAcceleration,a=r(n,["enableHardwareAcceleration"]);return mt(e({element:t,buildStyles:gt(o),preparseOutput:!0},a))}(t,n):t instanceof SVGElement?o=Ct(t):t===window&&(o=Tt(t)),Lt.set(t,o),o},Pt=function(t,e){return Lt.has(t)?Lt.get(t):Mt(t,e)};t.default=function(t,e){var r="string"==typeof t?document.querySelector(t):t;return Pt(r,e)},t.createStylerFactory=w,t.buildStyleProperty=vt,t.buildSVGAttrs=Rt,t.transformProps=W,t.isTransformProp=Y,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,o=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-o));o=e+r,setTimeout(function(){return t(o)},r)};!function(t){t.Read="read",t.Update="update",t.Render="render",t.PostRender="postRender",t.FixedUpdate="fixedUpdate"}(n||(n={}));var i,s=1/60*1e3,u=!0,f=!1,d=!1,c={delta:0,timestamp:0},l=[n.Read,n.Update,n.Render,n.PostRender],p=function(t){return f=t},h=l.reduce(function(t,e){var r,n,o,a,i,s,u,d,c,l=(r=p,n=[],o=[],a=0,i=!1,s=0,u=new WeakSet,d=new WeakSet,c={cancel:function(t){var e=o.indexOf(t);u.add(t),-1!==e&&o.splice(e,1)},process:function(t){var e,f;if(i=!0,n=(e=[o,n])[0],(o=e[1]).length=0,a=n.length)for(s=0;s<a;s++)(f=n[s])(t),!0!==d.has(f)||u.has(f)||(c.schedule(f),r(!0));i=!1},schedule:function(t,e,r){void 0===e&&(e=!1),void 0===r&&(r=!1);var s=r&&i,f=s?n:o;u.delete(t),e&&d.add(t),-1===f.indexOf(t)&&(f.push(t),s&&(a=n.length))}});return t.sync[e]=function(t,e,r){return void 0===e&&(e=!1),void 0===r&&(r=!1),f||b(),l.schedule(t,e,r),t},t.cancelSync[e]=function(t){return l.cancel(t)},t.steps[e]=l,t},{steps:{},sync:{},cancelSync:{}}),v=h.steps,g=h.sync,m=(h.cancelSync,function(t){return v[t].process(c)}),y=function(t){f=!1,c.delta=u?s:Math.max(Math.min(t-c.timestamp,40),1),u||(s=c.delta),c.timestamp=t,d=!0,l.forEach(m),d=!1,f&&(u=!1,a(y))},b=function(){f=!0,u=!0,d||a(y)},w=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 d(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,g.render(c.render)))}var c={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)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(i,o,u),f=!1,u.length=0),this}};return c}},O=/([a-z])([A-Z])/g,x=function(t){return t.replace(O,"$1-$2").toLowerCase()},S=new Map,R=new Map,k=["Webkit","Moz","O","ms",""],C=k.length,T="undefined"!=typeof document,L=function(t,e){return R.set(t,x(e))},M=function(t,e){void 0===e&&(e=!1);var r=e?R:S;return r.has(t)||(T?function(t){i=i||document.createElement("div");for(var e=0;e<C;e++){var r=k[e],n=""===r,o=n?t:r+t.charAt(0).toUpperCase()+t.slice(1);if(o in i.style||n){if(n&&"clipPath"===t&&R.has(t))return;S.set(t,o),L(t,(n?"":"-")+x(o))}}}(t):function(t){L(t,t)}(t)),r.get(t)||t},P=["","X","Y","Z"],W=["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"]),X=W.reduce(function(t,e){return t[e]=!0,t},{});function Y(t){return!0===X[t]}function A(t,e){return W.indexOf(t)-W.indexOf(e)}var j=new Set(["originX","originY","originZ"]);function B(t){return j.has(t)}var Z=function(){return(Z=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},V=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))$/i,U={test:function(t){return"number"==typeof t},parse:parseFloat,transform:function(t){return t}},E=Z(Z({},U),{transform:F(0,1)}),H=Z(Z({},U),{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=Z(Z({},D),{parse:function(t){return D.parse(t)/100},transform:function(t){return D.transform(100*t)}}),N=F(0,255),_=function(t){return void 0!==t.red},J=function(t){return void 0!==t.hue},K=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}},Q=Z(Z({},U),{transform:function(t){return Math.round(N(t))}});function tt(t,e){return t.startsWith(e)&&V.test(t)}var et={test:function(t){return"string"==typeof t?tt(t,"rgb"):_(t)},parse:K(["red","green","blue","alpha"]),transform:function(t){var e=t.red,r=t.green,n=t.blue,o=t.alpha,a=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:Q.transform(e),green:Q.transform(r),blue:Q.transform(n),alpha:z(E.transform(a))})}},rt={test:function(t){return"string"==typeof t?tt(t,"hsl"):J(t)},parse:K(["hue","saturation","lightness","alpha"]),transform:function(t){var e=t.hue,r=t.saturation,n=t.lightness,o=t.alpha,a=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(E.transform(a))})}},nt=Z(Z({},et),{test:function(t){return"string"==typeof t&&tt(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}}}),ot={test:function(t){return"string"==typeof t&&V.test(t)||_(t)||J(t)},parse:function(t){return et.test(t)?et.parse(t):rt.test(t)?rt.parse(t):nt.test(t)?nt.parse(t):t},transform:function(t){return _(t)?et.transform(t):J(t)?rt.transform(t):t}},at=e(e({},U),{transform:Math.round}),it={color:ot,backgroundColor:ot,outlineColor:ot,fill:ot,stroke:ot,borderColor:ot,borderTopColor:ot,borderRightColor:ot,borderBottomColor:ot,borderLeftColor:ot,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:H,scaleX:H,scaleY:H,scaleZ:H,skew:q,skewX:q,skewY:q,distance:$,translateX:$,translateY:$,translateZ:$,x:$,y:$,z:$,perspective:$,opacity:E,originX:G,originY:G,originZ:$,zIndex:at,fillOpacity:E,strokeOpacity:E,numOctaves:at},st=function(t){return it[t]},ut=function(t,e){return e&&"number"==typeof t?e.transform(t):t},ft="scrollLeft",dt="scrollTop",ct=new Set([ft,dt]),lt=new Set([ft,dt,"transform"]),pt={x:"translateX",y:"translateY",z:"translateZ"};function ht(t){return"function"==typeof t}function vt(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 d in t){var c=t[d],l=st(d),p=ut(c,l);Y(d)?(u=!0,n[d]=p,a.push(d),s&&(l.default&&c!==l.default||!l.default&&0!==c)&&(s=!1)):B(d)?(o[d]=p,f=!0):lt.has(d)&&ht(p)||(r[M(d,i)]=p)}return(u||"function"==typeof t.transform)&&(r.transform=function(t,e,r,n,o){var a="",i=!1;r.sort(A);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||"50%")+" "+(o.originY||"50%")+" "+(o.originZ||0)),r}function gt(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0);var r={},n={},o={},a=[];return function(i){return a.length=0,vt(i,t,r,n,o,a,e),r}}var mt=w({onRead:function(t,e){var r=e.element,n=e.preparseOutput,o=st(t);if(Y(t))return o&&o.default||0;if(ct.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(dt)&&(n[dt]=t[dt])},uncachedValues:ct});var yt=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues"]),bt=.5,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,a,i){void 0===e&&(e=xt),void 0===o&&(o=gt(!1,!1)),void 0===a&&(a=wt()),void 0===i&&(i=!0);var s=t.attrX,u=t.attrY,f=t.originX,d=t.originY,c=t.pathLength,l=t.pathSpacing,p=void 0===l?1:l,h=t.pathOffset,v=void 0===h?0:h,g=o(r(t,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]));for(var m in g){if("transform"===m)a.style.transform=g[m];else a[i&&!yt.has(m)?x(m):m]=g[m]}return(void 0!==f||void 0!==d||g.transform)&&(a.style.transformOrigin=function(t,e,r){return St(e,t.x,t.width)+" "+St(r,t.y,t.height)}(e,void 0!==f?f:bt,void 0!==d?d:bt)),void 0!==s&&(a.x=s),void 0!==u&&(a.y=u),void 0!==n&&void 0!==c&&(a[i?"stroke-dashoffset":"strokeDashoffset"]=Ot(-v,n),a[i?"stroke-dasharray":"strokeDasharray"]=Ot(c,n)+" "+Ot(p,n)),a}var kt=w({onRead:function(t,e){var r=e.element;if(Y(t=yt.has(t)?t:x(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,r){void 0===r&&(r=!0);var n=wt(),o=gt(!1,!1);return function(a){return Rt(a,t,e,o,n,r)}}(e,r)})},Tt=w({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=new WeakMap,Mt=function(t,n){var o;return t instanceof HTMLElement?o=function(t,n){void 0===n&&(n={});var o=n.enableHardwareAcceleration,a=r(n,["enableHardwareAcceleration"]);return mt(e({element:t,buildStyles:gt(o),preparseOutput:!0},a))}(t,n):t instanceof SVGElement?o=Ct(t):t===window&&(o=Tt(t)),Lt.set(t,o),o},Pt=function(t,e){return Lt.has(t)?Lt.get(t):Mt(t,e)};t.default=function(t,e){var r="string"==typeof t?document.querySelector(t):t;return Pt(r,e)},t.createStylerFactory=w,t.buildStyleProperty=vt,t.buildSVGAttrs=Rt,t.transformProps=W,t.isTransformProp=Y,Object.defineProperty(t,"__esModule",{value:!0})});

@@ -7,2 +7,3 @@ 'use strict';

var tslib = require('tslib');
var sync = _interopDefault(require('framesync'));

@@ -12,38 +13,2 @@ var styleValueTypes = require('style-value-types');

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
}
var createStyler = function (_a) {

@@ -53,3 +18,3 @@ var onRead = _a.onRead, onRender = _a.onRender, _b = _a.uncachedValues, uncachedValues = _b === void 0 ? new Set() : _b, _c = _a.useCache, useCache = _c === void 0 ? true : _c;

if (_a === void 0) { _a = {}; }
var props = __rest(_a, []);
var props = tslib.__rest(_a, []);
var state = {};

@@ -173,3 +138,3 @@ var changedValues = [];

var int = __assign({}, styleValueTypes.number, { transform: Math.round });
var int = tslib.__assign(tslib.__assign({}, styleValueTypes.number), { transform: Math.round });
var valueTypes = {

@@ -390,4 +355,4 @@ color: styleValueTypes.color,

if (_a === void 0) { _a = {}; }
var enableHardwareAcceleration = _a.enableHardwareAcceleration, props = __rest(_a, ["enableHardwareAcceleration"]);
return cssStyler(__assign({ element: element, buildStyles: createStyleBuilder(enableHardwareAcceleration), preparseOutput: true }, props));
var enableHardwareAcceleration = _a.enableHardwareAcceleration, props = tslib.__rest(_a, ["enableHardwareAcceleration"]);
return cssStyler(tslib.__assign({ element: element, buildStyles: createStyleBuilder(enableHardwareAcceleration), preparseOutput: true }, props));
}

@@ -436,3 +401,3 @@

if (isDashCase === void 0) { isDashCase = true; }
var attrX = _a.attrX, attrY = _a.attrY, originX = _a.originX, originY = _a.originY, pathLength = _a.pathLength, _b = _a.pathSpacing, pathSpacing = _b === void 0 ? 1 : _b, _c = _a.pathOffset, pathOffset = _c === void 0 ? 0 : _c, state = __rest(_a, ["attrX", "attrY", "originX", "originY", "pathLength", "pathSpacing", "pathOffset"]);
var attrX = _a.attrX, attrY = _a.attrY, originX = _a.originX, originY = _a.originY, pathLength = _a.pathLength, _b = _a.pathSpacing, pathSpacing = _b === void 0 ? 1 : _b, _c = _a.pathOffset, pathOffset = _c === void 0 ? 0 : _c, state = tslib.__rest(_a, ["attrX", "attrY", "originX", "originY", "pathLength", "pathSpacing", "pathOffset"]);
var style = cssBuilder(state);

@@ -439,0 +404,0 @@ for (var key in style) {

@@ -10,9 +10,3 @@ import { Dimensions, SVGState } from './types';

};
export declare type Dimensions = {
x: number;
y: number;
width: number;
height: number;
};
export declare function buildSVGAttrs({ attrX, attrY, originX, originY, pathLength, pathSpacing, pathOffset, ...state }: State & SVGState, dimensions?: Dimensions, totalPathLength?: number | undefined, cssBuilder?: (state: State) => ResolvedState, attrs?: SVGAttrs, isDashCase?: boolean): SVGAttrs;
export declare function createAttrBuilder(dimensions: Dimensions, totalPathLength?: number, isDashCase?: boolean): (state: State & SVGState) => SVGAttrs;
import { Styler } from '../styler/types';
export { Styler };
declare const _default: ({ ...props }?: import("stylefire/src/styler/types").Props) => Styler;
declare const _default: ({ ...props }?: import("../styler/types").Props) => Styler;
export default _default;
{
"name": "stylefire",
"version": "7.0.0",
"version": "7.0.1",
"description": "Performant, simplified stylers for CSS, SVG, path and DOM scroll.",

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

"dependencies": {
"@popmotion/popcorn": "^0.4.2",
"@popmotion/popcorn": "^0.4.4",
"framesync": "^4.0.0",
"hey-listen": "^1.0.8",
"style-value-types": "^3.1.6"
"style-value-types": "^3.1.7",
"tslib": "^1.10.0"
},

@@ -65,0 +66,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