Comparing version 1.0.1 to 1.0.2
@@ -302,3 +302,3 @@ (function (global, factory) { | ||
renderStatic: function renderStatic(style, selector) { | ||
var reference = typeof style === 'string' ? style : selector; | ||
var reference = typeof style === 'string' ? style : selector + sortedStringify(style); | ||
@@ -305,0 +305,0 @@ if (!renderer.rendered.hasOwnProperty(reference)) { |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.Fela=r()}(this,function(){"use strict";function e(e,r){return r={exports:{}},e(r,r.exports),r.exports}function r(e){var r=0,n=0,t=void 0,i=e.length;if(0===i)return"";for(;n<i;++n)t=e.charCodeAt(n),r=(r<<5)-r+t,r|=0;return"-"+r.toString(36)}function n(e){return Object.keys(e).sort().reduce(function(r,n){return r+n+e[n]},"")}function t(e){return Object.keys(l).reduce(function(r,n){return e.indexOf(n)>-1&&(r=l[n]),r},void 0)}function i(e){return Object.keys(e).reduce(function(r,n){return r.length>0&&(r+=";"),r+=p(n)+":"+e[n]},"")}function o(e,r){var n=arguments.length<=2||void 0===arguments[2]?[""]:arguments[2],t=Object.keys(e).reduce(function(r,n){return r+n+"{"+i(e[n])+"}"},"");return n.reduce(function(e,n){return e+"@"+n+"keyframes "+r+"{"+t+"}"},"")}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],u={listeners:[],keyframePrefixes:e.keyframePrefixes||["-webkit-","-moz-"],plugins:e.plugins||[],clear:function(){u.fontFaces="",u.keyframes="",u.statics="",u.rules="",u.mediaRules={},u.rendered={},u.base={},u.ids=[],u._emitChange()},renderRule:function(e){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];u.ids.indexOf(e)<0&&(u.ids.push(e),u.renderRule(e,{}));var n=u.ids.indexOf(e),t="c"+n+u._generatePropsReference(r);if(!u.rendered.hasOwnProperty(t)){var i=u._processStyle(e(r));u._renderStyle(t,i,u.base[n]),u.rendered[t]=u._didChange,u._didChange&&(u._didChange=!1,u._emitChange()),t==="c"+n&&(u.base[n]=i)}var o="c"+n;return u.rendered[t]?t!==o?o+" "+t:t:o},renderKeyframe:function(e){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];u.ids.indexOf(e)<0&&u.ids.push(e);var n=u._generatePropsReference(r),t="k"+u.ids.indexOf(e)+n;if(!u.rendered.hasOwnProperty(t)){var i=u._processStyle(e(r)),f=o(i,t,u.keyframePrefixes);u.rendered[t]=!0,u.keyframes+=f,u._emitChange()}return t},renderFont:function(e,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return u.rendered.hasOwnProperty(e)||!function(){var o={fontFamily:"'"+e+"'",src:r.map(function(e){return"url('"+e+"') format('"+t(e)+"')"}).join(",")},f=["fontVariant","fontWeight","fontStretch","fontStyle","unicodeRange"];Object.keys(n).filter(function(e){return f.indexOf(e)>-1}).forEach(function(e){return o[e]=n[e]});var s="@font-face{"+i(o)+"}";u.rendered[e]=!0,u.fontFaces+=s,u._emitChange()}(),e},renderStatic:function(e,r){var n="string"==typeof e?e:r;u.rendered.hasOwnProperty(n)||("string"==typeof e?u.statics+=e.replace(/\s{2,}/g,""):u.statics+=r+"{"+i(u._processStyle(e))+"}",u.rendered[n]=!0,u._emitChange())},renderToString:function(){var e=u.fontFaces+u.statics+u.rules;for(var r in u.mediaRules)e+="@media "+r+"{"+u.mediaRules[r]+"}";return e+u.keyframes},subscribe:function(e){return u.listeners.push(e),{unsubscribe:function(){return u.listeners.splice(u.listeners.indexOf(e),1)}}},_emitChange:function(){var e=u.renderToString();u.listeners.forEach(function(r){return r(e)})},_generatePropsReference:function(e){return r(n(e))},_processStyle:function(e){return u.plugins.reduce(function(e,r){return r(e)},e)},_renderStyle:function(e,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],t=arguments.length<=3||void 0===arguments[3]?"":arguments[3],o=arguments.length<=4||void 0===arguments[4]?"":arguments[4],f=Object.keys(r).reduce(function(i,f){var s=r[f];if(s instanceof Object&&!Array.isArray(s)){if(":"===f.charAt(0))u._renderStyle(e,s,n[f],t+f,o);else if("@media"===f.substr(0,6)){var c=f.slice(6).trim(),a=o.length>0?o+" and "+c:c;u._renderStyle(e,s,n[f],t,a)}}else if(void 0!==s&&!n.hasOwnProperty(f)||n[f]!==s){if("string"==typeof s&&s.indexOf("undefined")>-1)return i;i[f]=s}return i},{});if(Object.keys(f).length>0){var s="."+e+t+"{"+i(f)+"}";u._didChange=!0,o.length>0?(u.mediaRules.hasOwnProperty(o)||(u.mediaRules[o]=""),u.mediaRules[o]+=s):u.rules+=s}}};return u.keyframePrefixes.push(""),u.clear(),u}function f(e){for(var r=arguments.length,n=Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return n.reduce(function(e,r){for(var n in r){var t=r[n];e[n]instanceof Object&&t instanceof Object?e[n]=f({},e[n],t):e[n]=t}return e},e)}function s(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return function(e){return r.reduce(function(r,n){return f(r,n(e))},{})}}function c(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return function(e){return function(){return r.reduce(function(e,r){return r(e)},e.apply(void 0,arguments))}}}function a(e,r){if(!r||r.nodeType!==h)throw new Error("You need to specify a valid element node (nodeType = 1) to render into.");r.setAttribute("data-fela-stylesheet",""),e.subscribe(function(e){return r.textContent=e});var n=e.renderToString();r.textContent!==n&&(r.textContent=n)}var d={};d["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},d["extends"]=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e};var l={".woff":"woff",".eof":"eof",".ttf":"truetype",".svg":"svg"},y=e(function(e){function r(e){return e.replace(n,"-$&").toLowerCase().replace(t,"-ms-")}var n=/[A-Z]/g,t=/^ms-/;e.exports=r}),p=y&&"object"==typeof y&&"default"in y?y["default"]:y,h=1,v={createRenderer:u,combineRules:s,enhance:c,render:a};return v}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.Fela=r()}(this,function(){"use strict";function e(e,r){return r={exports:{}},e(r,r.exports),r.exports}function r(e){var r=0,n=0,t=void 0,i=e.length;if(0===i)return"";for(;n<i;++n)t=e.charCodeAt(n),r=(r<<5)-r+t,r|=0;return"-"+r.toString(36)}function n(e){return Object.keys(e).sort().reduce(function(r,n){return r+n+e[n]},"")}function t(e){return Object.keys(l).reduce(function(r,n){return e.indexOf(n)>-1&&(r=l[n]),r},void 0)}function i(e){return Object.keys(e).reduce(function(r,n){return r.length>0&&(r+=";"),r+=p(n)+":"+e[n]},"")}function o(e,r){var n=arguments.length<=2||void 0===arguments[2]?[""]:arguments[2],t=Object.keys(e).reduce(function(r,n){return r+n+"{"+i(e[n])+"}"},"");return n.reduce(function(e,n){return e+"@"+n+"keyframes "+r+"{"+t+"}"},"")}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],u={listeners:[],keyframePrefixes:e.keyframePrefixes||["-webkit-","-moz-"],plugins:e.plugins||[],clear:function(){u.fontFaces="",u.keyframes="",u.statics="",u.rules="",u.mediaRules={},u.rendered={},u.base={},u.ids=[],u._emitChange()},renderRule:function(e){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];u.ids.indexOf(e)<0&&(u.ids.push(e),u.renderRule(e,{}));var n=u.ids.indexOf(e),t="c"+n+u._generatePropsReference(r);if(!u.rendered.hasOwnProperty(t)){var i=u._processStyle(e(r));u._renderStyle(t,i,u.base[n]),u.rendered[t]=u._didChange,u._didChange&&(u._didChange=!1,u._emitChange()),t==="c"+n&&(u.base[n]=i)}var o="c"+n;return u.rendered[t]?t!==o?o+" "+t:t:o},renderKeyframe:function(e){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];u.ids.indexOf(e)<0&&u.ids.push(e);var n=u._generatePropsReference(r),t="k"+u.ids.indexOf(e)+n;if(!u.rendered.hasOwnProperty(t)){var i=u._processStyle(e(r)),f=o(i,t,u.keyframePrefixes);u.rendered[t]=!0,u.keyframes+=f,u._emitChange()}return t},renderFont:function(e,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return u.rendered.hasOwnProperty(e)||!function(){var o={fontFamily:"'"+e+"'",src:r.map(function(e){return"url('"+e+"') format('"+t(e)+"')"}).join(",")},f=["fontVariant","fontWeight","fontStretch","fontStyle","unicodeRange"];Object.keys(n).filter(function(e){return f.indexOf(e)>-1}).forEach(function(e){return o[e]=n[e]});var s="@font-face{"+i(o)+"}";u.rendered[e]=!0,u.fontFaces+=s,u._emitChange()}(),e},renderStatic:function(e,r){var t="string"==typeof e?e:r+n(e);u.rendered.hasOwnProperty(t)||("string"==typeof e?u.statics+=e.replace(/\s{2,}/g,""):u.statics+=r+"{"+i(u._processStyle(e))+"}",u.rendered[t]=!0,u._emitChange())},renderToString:function(){var e=u.fontFaces+u.statics+u.rules;for(var r in u.mediaRules)e+="@media "+r+"{"+u.mediaRules[r]+"}";return e+u.keyframes},subscribe:function(e){return u.listeners.push(e),{unsubscribe:function(){return u.listeners.splice(u.listeners.indexOf(e),1)}}},_emitChange:function(){var e=u.renderToString();u.listeners.forEach(function(r){return r(e)})},_generatePropsReference:function(e){return r(n(e))},_processStyle:function(e){return u.plugins.reduce(function(e,r){return r(e)},e)},_renderStyle:function(e,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],t=arguments.length<=3||void 0===arguments[3]?"":arguments[3],o=arguments.length<=4||void 0===arguments[4]?"":arguments[4],f=Object.keys(r).reduce(function(i,f){var s=r[f];if(s instanceof Object&&!Array.isArray(s)){if(":"===f.charAt(0))u._renderStyle(e,s,n[f],t+f,o);else if("@media"===f.substr(0,6)){var c=f.slice(6).trim(),a=o.length>0?o+" and "+c:c;u._renderStyle(e,s,n[f],t,a)}}else if(void 0!==s&&!n.hasOwnProperty(f)||n[f]!==s){if("string"==typeof s&&s.indexOf("undefined")>-1)return i;i[f]=s}return i},{});if(Object.keys(f).length>0){var s="."+e+t+"{"+i(f)+"}";u._didChange=!0,o.length>0?(u.mediaRules.hasOwnProperty(o)||(u.mediaRules[o]=""),u.mediaRules[o]+=s):u.rules+=s}}};return u.keyframePrefixes.push(""),u.clear(),u}function f(e){for(var r=arguments.length,n=Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return n.reduce(function(e,r){for(var n in r){var t=r[n];e[n]instanceof Object&&t instanceof Object?e[n]=f({},e[n],t):e[n]=t}return e},e)}function s(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return function(e){return r.reduce(function(r,n){return f(r,n(e))},{})}}function c(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return function(e){return function(){return r.reduce(function(e,r){return r(e)},e.apply(void 0,arguments))}}}function a(e,r){if(!r||r.nodeType!==h)throw new Error("You need to specify a valid element node (nodeType = 1) to render into.");r.setAttribute("data-fela-stylesheet",""),e.subscribe(function(e){return r.textContent=e});var n=e.renderToString();r.textContent!==n&&(r.textContent=n)}var d={};d["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},d["extends"]=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e};var l={".woff":"woff",".eof":"eof",".ttf":"truetype",".svg":"svg"},y=e(function(e){function r(e){return e.replace(n,"-$&").toLowerCase().replace(t,"-ms-")}var n=/[A-Z]/g,t=/^ms-/;e.exports=r}),p=y&&"object"==typeof y&&"default"in y?y["default"]:y,h=1,v={createRenderer:u,combineRules:s,enhance:c,render:a};return v}); |
@@ -186,3 +186,3 @@ 'use strict'; | ||
renderStatic: function renderStatic(style, selector) { | ||
var reference = typeof style === 'string' ? style : selector; | ||
var reference = typeof style === 'string' ? style : selector + (0, _sortedStringify2.default)(style); | ||
@@ -189,0 +189,0 @@ if (!renderer.rendered.hasOwnProperty(reference)) { |
{ | ||
"name": "fela", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Fast, tiny & dynamic low-level API to handle Styling in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
83413
30
1236