-
Notifications
You must be signed in to change notification settings - Fork 0
/
yss.min.js
2 lines (2 loc) · 3.52 KB
/
yss.min.js
1
2
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Yss=n()}(this,function(){"use strict";var s=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;function f(t,n){return t.split(n).map(function(t){return t.trim()}).filter(function(t){return t})}function a(t){return t.toString(36)}function t(t){return".y"+a(t)}var c=Object.keys;function l(n,e){return Object.keys(n).map(function(t){return e(n[t],t)})}function y(t){return":"!==t[0]&&" "!==t[0]&&"@"!==t[0]}function p(t){return":"===t[0]||" "===t[0]}function v(t){return"@"===t[0]}var g={},h=0;function n(n){var o={};function u(n,r){var t=c(r).filter(y).map(function(t){var n,e=r[t];return"animation"===t&&(n=l(r[t].frameStyles,function(t,n){return u(n,t.style)}).join(""),g[n]||(g[n]="a"+a(h++)),o[n]=g[n],e=(r[t].timing||"")+" "+g[n]),t.replace(s,function(t){return"-"+t.toLowerCase()})+":"+e}).join(";"),e=c(r).filter(p).map(function(t){return u(n+t,r[t].style)}).join(""),i=c(r).filter(v).map(function(t){return t+"{"+u(""+n,r[t].style)+"}"}).join("");return n+"{"+t+"}"+e+i}var t=c(n).map(function(t){return""+u(t,n[t])}).join("");return l(o,function(t,n){return"@keyframes "+t+"{"+n+"}"}).join("")+t}function e(t,n,e){t.style[" "+n]=t.yss(e)}function d(t,n,e){t.style["@media "+n]=t.yss(e)}function m(t,n,e){t.style.animation={frameStyles:e,timing:n}}function j(o,t,n){void 0===n&&(n=t);var u=":"+t;o.helper(n,function(t,n){for(var e,r=[],i=arguments.length-2;0<i--;)r[i]=arguments[i+2];t.style[u]&&t.style[u].style||(t.style[u]=o(t.style[u])),(e=t.style)[u].apply(e,[n].concat(r))})}var b=0;return function(r){void 0===r&&(r={});var i={};r=Object.assign({getClassName:t,render:n},r);var o={get class(){var t=JSON.stringify(this.style),n=i[t];if(n)return n;var e=r.getClassName(b++,this.style);return i[t]=e,s.style[e]=this.style,e},toString:function(){return this.class},toJSON:function(){return this.style},get className(){return this.class.slice(1)}};function u(u,t){for(var n,e=[],r=arguments.length-2;0<r--;)e[r]=arguments[r+2];return"string"!=typeof t||e[0]||(t=[t]),Array.isArray(t)?f(t.map(function(t,n){return t+(null==e[n]?"":e[n])}).join(""),/[;\n]/).reduce(function(t,n){var e=f(n,/[ :]/),r=e[0],i=e.slice(1),o=r.replace(/-([a-z])/g,function(t){return t[1].toUpperCase()});return u[o]?u[o].apply(u,i):t[o]=i.join(" "),t},{}):t&&t.style?t.style:e[0]?((n={})[t]=e[0],n):t}function s(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];function e(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return Object.assign(e.style,u.apply(void 0,[e].concat(t))),e}return e.style={},e.yss=s,Object.setPrototypeOf(e,o),e.apply(void 0,t)}return Object.setPrototypeOf(o,function(){}),s.style={},Object.defineProperty(s,"css",{get:function(){return r.render(s.style)}}),(s.helper=function(r){for(var n=[],t=arguments.length-1;0<t--;)n[t]=arguments[t+1];if("object"!=typeof r){var e=n[0];("string"==typeof n[0]||Array.isArray(n[0])||n[0].style)&&(e=function(t){return t.apply(void 0,n)}),1===e.length?(Object.defineProperty(o,r,{get:function(){return e(this),this}}),Object.defineProperty(s,r,{get:function(){return s({})[r]}})):(o[r]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e.apply(void 0,[this].concat(t)),this},s[r]=function(){for(var t,n=[],e=arguments.length;e--;)n[e]=arguments[e];return(t=s({}))[r].apply(t,n)})}else{var i=r;for(r in i)s.helper(r,i[r])}})("nest",e),s.helper("media",d),s.helper("animate",m),j(s,"hover"),j(s,"focus"),s}});
//# sourceMappingURL=yss.min.js.map