Comparing version 11.2.0 to 11.3.0
@@ -28,3 +28,3 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
// special combination of our special _className key | ||
if (style._className) { | ||
if (resolvedRule && style._className) { | ||
resolvedRule._className = style._className + (resolvedRule._className ? ' ' + resolvedRule._className : ''); | ||
@@ -31,0 +31,0 @@ } |
@@ -13,2 +13,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import cssifyKeyframe from './cssifyKeyframe'; | ||
import cssifyKeyframeRule from './cssifyKeyframeRule'; | ||
import cssifyStaticStyle from './cssifyStaticStyle'; | ||
@@ -83,3 +84,3 @@ import _generateAnimationName from './generateAnimationName'; | ||
var keyframeReference = JSON.stringify(processedKeyframe); | ||
var keyframeReference = cssifyKeyframeRule(processedKeyframe); | ||
@@ -90,3 +91,3 @@ if (!renderer.cache.hasOwnProperty(keyframeReference)) { | ||
var cssKeyframe = cssifyKeyframe(processedKeyframe, animationName, renderer.keyframePrefixes); | ||
var cssKeyframe = cssifyKeyframe(processedKeyframe, animationName, renderer.keyframePrefixes, keyframeReference); | ||
@@ -93,0 +94,0 @@ var change = { |
import arrayReduce from 'fast-loops/lib/arrayReduce'; | ||
import objectReduce from 'fast-loops/lib/objectReduce'; | ||
import cssifyObject from 'css-in-js-utils/lib/cssifyObject'; | ||
import cssifyKeyframeRule from './cssifyKeyframeRule'; | ||
export default function cssifyKeyframe(frames, animationName) { | ||
var prefixes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['']; | ||
var prerendered = arguments[3]; | ||
var keyframe = objectReduce(frames, function (css, frame, percentage) { | ||
return '' + css + percentage + '{' + cssifyObject(frame) + '}'; | ||
}, ''); | ||
var keyframe = prerendered || cssifyKeyframeRule(frames); | ||
@@ -12,0 +11,0 @@ return arrayReduce(prefixes, function (cssKeyframe, prefix) { |
@@ -42,3 +42,3 @@ 'use strict'; | ||
// special combination of our special _className key | ||
if (style._className) { | ||
if (resolvedRule && style._className) { | ||
resolvedRule._className = style._className + (resolvedRule._className ? ' ' + resolvedRule._className : ''); | ||
@@ -45,0 +45,0 @@ } |
@@ -33,2 +33,6 @@ 'use strict'; | ||
var _cssifyKeyframeRule = require('./cssifyKeyframeRule'); | ||
var _cssifyKeyframeRule2 = _interopRequireDefault(_cssifyKeyframeRule); | ||
var _cssifyStaticStyle = require('./cssifyStaticStyle'); | ||
@@ -133,3 +137,3 @@ | ||
var keyframeReference = JSON.stringify(processedKeyframe); | ||
var keyframeReference = (0, _cssifyKeyframeRule2.default)(processedKeyframe); | ||
@@ -140,3 +144,3 @@ if (!renderer.cache.hasOwnProperty(keyframeReference)) { | ||
var cssKeyframe = (0, _cssifyKeyframe2.default)(processedKeyframe, animationName, renderer.keyframePrefixes); | ||
var cssKeyframe = (0, _cssifyKeyframe2.default)(processedKeyframe, animationName, renderer.keyframePrefixes, keyframeReference); | ||
@@ -143,0 +147,0 @@ var change = { |
@@ -12,10 +12,6 @@ 'use strict'; | ||
var _objectReduce = require('fast-loops/lib/objectReduce'); | ||
var _cssifyKeyframeRule = require('./cssifyKeyframeRule'); | ||
var _objectReduce2 = _interopRequireDefault(_objectReduce); | ||
var _cssifyKeyframeRule2 = _interopRequireDefault(_cssifyKeyframeRule); | ||
var _cssifyObject = require('css-in-js-utils/lib/cssifyObject'); | ||
var _cssifyObject2 = _interopRequireDefault(_cssifyObject); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -25,6 +21,5 @@ | ||
var prefixes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['']; | ||
var prerendered = arguments[3]; | ||
var keyframe = (0, _objectReduce2.default)(frames, function (css, frame, percentage) { | ||
return '' + css + percentage + '{' + (0, _cssifyObject2.default)(frame) + '}'; | ||
}, ''); | ||
var keyframe = prerendered || (0, _cssifyKeyframeRule2.default)(frames); | ||
@@ -31,0 +26,0 @@ return (0, _arrayReduce2.default)(prefixes, function (cssKeyframe, prefix) { |
{ | ||
"name": "fela", | ||
"version": "11.2.0", | ||
"version": "11.3.0", | ||
"description": "State-Driven Styling in JavaScript", | ||
@@ -42,6 +42,6 @@ "typings": "index.d.ts", | ||
"fast-loops": "^1.0.0", | ||
"fela-utils": "^11.2.0", | ||
"fela-utils": "^11.3.0", | ||
"isobject": "^3.0.1" | ||
}, | ||
"gitHead": "180a1819c65d52f8f83d70fa717deeb6bb52389e" | ||
"gitHead": "97148419e7941dbd5867b35df6ac4de6c5ed3e55" | ||
} |
@@ -84,3 +84,3 @@ <h1><img alt="Fela" src="docs/res/logo.png" width="203"/></h1> | ||
import React from 'react' | ||
import { FelaProvider, useFela } from 'react-fela' | ||
import { RendererProvider, useFela } from 'react-fela' | ||
import { createRenderer } from 'fela'; | ||
@@ -105,5 +105,3 @@ import { render } from 'react-dom' | ||
<button className={css(rule)}> | ||
{children} | ||
</button> | ||
return <button className={css(rule)}>{children}</button>; | ||
} | ||
@@ -114,3 +112,3 @@ | ||
render( | ||
<Provider renderer={renderer}> | ||
<RendererProvider renderer={renderer}> | ||
<> | ||
@@ -120,3 +118,3 @@ <Button>Basic Button</Button> | ||
</> | ||
</Provider>, | ||
</RendererProvider>, | ||
document.body | ||
@@ -126,2 +124,4 @@ ) | ||
> Check this example on [CodeSandbox](https://codesandbox.io/s/fela-demo-7tsj5) | ||
## Examples | ||
@@ -128,0 +128,0 @@ * [Fela + React](http://fela.js.org/docs/introduction/Examples.html#react) ([source](examples/example-react)) |
@@ -7,2 +7,2 @@ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Fela",[],t):"object"==typeof exports?exports.Fela=t():e.Fela=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){for(var r=0,o=e.length;r<o;++r)n=t(n,e[r],r,o,e);return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t="";for(var n in e){var r=e[n];"string"!=typeof r&&"number"!=typeof r||(t&&(t+=";"),t+=(0,i.default)(n,r))}return t};var r,o=n(2),i=(r=o)&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,i.default)(e)+":"+t};var r,o=n(9),i=(r=o)&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var n=0,r=e.length;n<r;++n)t(e[n],n,r,e)}},function(e,t,n){"use strict"; | ||
* Released under the MIT License. | ||
*/e.exports=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){for(var r in e)n=t(n,e[r],r,e);return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.replace(r,(function(e){return e[1].toUpperCase()})).replace(o,"ms")};var r=/-([a-z])/g,o=/^Ms/g;e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e){return e.filter((function(t,n){return e.lastIndexOf(t)===n}))}t.default=function e(t){for(var n=arguments.length,a=Array(n>1?n-1:0),u=1;u<n;u++)a[u-1]=arguments[u];for(var f=0,s=a.length;f<s;++f){var c=a[f];for(var l in c){var d=c[l],p=t[l];if(p&&d){if(Array.isArray(p)){t[l]=i(p.concat(d));continue}if(Array.isArray(d)){t[l]=i([p].concat(o(d)));continue}if("object"===(void 0===d?"undefined":r(d))){t[l]=e({},p,d);continue}}t[l]=d}}return t},e.exports=t.default},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e)};var r,o=n(10),i=(r=o)&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,n){"use strict";var r=/[A-Z]/g,o=/^ms-/,i={};e.exports=function(e){return e in i?i[e]:i[e]=e.replace(r,"-$&").toLowerCase().replace(o,"-ms-")}},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),i=n(3),a=n.n(i),u=n(4),f=n.n(u),s=n(0),c=n.n(s);function l(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return e.plugins.length>0?c()(e.plugins,(function(t,o){return o(t,n,e,r)}),t):t}var d=/^(:|\[|>|&)/;function p(e){return d.test(e)}function y(e){return"@media"===e.substr(0,6)}function m(e,t){return 0===e.length?t:e+" and "+t}function v(e){return"@supports"===e.substr(0,9)}var g=n(6),h=n.n(g);function b(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return o+r+n+h()(e)+t}function _(e){return null==e||"string"==typeof e&&null!==e.match(/(undefined|null)/)}function x(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"."+e+t}var O=n(1),w=n.n(O);var A=n(5),N=n.n(A);const j="abcdefghijklmnopqrstuvwxyz",$=j.length;function P(e,t=(()=>!0)){const n=function e(t,n=""){return t<=$?j[t-1]+n:e(t/$|0,j[t%$]+n)}(e());return t(n)?n:P(e,t)}function S(e){return"data:"===e.substr(0,5)}function C(e){return S(e)?e:`'${e}'`}const M={".woff":"woff",".woff2":"woff2",".eot":"embedded-opentype",".ttf":"truetype",".otf":"opentype",".svg":"svg",".svgz":"svg"},k={"image/svg+xml":"svg","application/x-font-woff":"woff","application/font-woff":"woff","application/x-font-woff2":"woff2","application/font-woff2":"woff2","font/woff2":"woff2","application/octet-stream":"truetype","application/x-font-ttf":"truetype","application/x-font-truetype":"truetype","application/x-font-opentype":"opentype","application/vnd.ms-fontobject":"embedded-opentype","application/font-sfnt":"sfnt"};function I(e=[],t=[]){const n=c()(t,(e,t,n)=>`${e}${n>0?",":""}local(${C(t)})`,""),r=c()(e,(e,t,n)=>{const r=n>0?",":"",o=function(e){if(S(e)){let t="";for(let n=5;;n++){const r=e.charAt(n);if(";"===r||","===r)break;t+=r}const n=k[t];if(n)return n;console.warn(`A invalid base64 font was used. Please use one of the following mime type: ${Object.keys(k).join(", ")}.`)}else{let t="";for(let n=e.length-1;;n--){const r=e.charAt(n);if("."===r){t=r+t;break}t=r+t}const n=M[t];if(n)return n;console.warn(`A invalid font-format was used in "${e}". Use one of these: ${Object.keys(M).join(", ")}.`)}return""}(t);return`${e}${r}url(${C(t)}) format('${o}')`},"");return`${n}${n.length>0&&r.length>0?",":""}${r}`}function R(e){return-1===e.indexOf("ad")}const F=/^[a-z_][a-z0-9-_]*$/gi;function T(e=""){return e.length>0&&null===e.match(F)&&console.error(`An invalid selectorPrefix (${e}) has been used to create a new Fela renderer.\nIt must only contain a-Z, 0-9, - and _ while it must start with either _ or a-Z.\nSee http://fela.js.org/docs/advanced/RendererConfiguration.html`),e}const K=(e=[])=>function(t,n){return-1===e.indexOf(n)?-1===e.indexOf(t)?0:-1:-1===e.indexOf(t)?1:e.indexOf(t)-e.indexOf(n)};function q(e={}){let t={listeners:[],keyframePrefixes:e.keyframePrefixes||["-webkit-","-moz-"],plugins:e.plugins||[],sortMediaQuery:e.sortMediaQuery||K(e.mediaQueryOrder),supportQueryOrder:e.supportQueryOrder||[],styleNodeAttributes:e.styleNodeAttributes||{},ruleOrder:[/^:link/,/^:visited/,/^:hover/,/^:focus-within/,/^:focus/,/^:active/],selectorPrefix:T(e.selectorPrefix),filterClassName:e.filterClassName||R,devMode:e.devMode||!1,uniqueRuleIdentifier:0,uniqueKeyframeIdentifier:0,nodes:{},scoreIndex:{},cache:{},getNextRuleIdentifier:()=>++t.uniqueRuleIdentifier,getNextKeyframeIdentifier:()=>++t.uniqueKeyframeIdentifier,renderRule:(e,n={})=>t._renderStyle(e(n,t),n),renderKeyframe(e,n={}){const r=e(n,t),o=l(t,r,"KEYFRAME",n),i=JSON.stringify(o);if(!t.cache.hasOwnProperty(i)){const e=t.selectorPrefix+t.generateAnimationName(n),r={type:"KEYFRAME",keyframe:function(e,t,n=[""]){const r=N()(e,(e,t,n)=>`${e}${n}{${w()(t)}}`,"");return c()(n,(e,n)=>`${e}@${n}keyframes ${t}{${r}}`,"")}(o,e,t.keyframePrefixes),name:e};t.cache[i]=r,t._emitChange(r)}return t.cache[i].name},generateAnimationName:e=>"k"+t.getNextKeyframeIdentifier(),renderFont(e,n,r={}){const{localAlias:o,...i}=r,a=e+JSON.stringify(r),u=function(e){return"string"==typeof e?[e]:Array.isArray(e)?e.slice():[]}(o);if(!t.cache.hasOwnProperty(a)){const r='"'===(f=e).charAt(0)?f:`"${f}"`,o={type:"FONT",fontFace:function(e){return`@font-face{${w()(e)}}`}({...i,src:I(n,u),fontFamily:r}),fontFamily:r};t.cache[a]=o,t._emitChange(o)}var f;return t.cache[a].fontFamily},renderStatic(e,n){const r=function(e,t){return"string"==typeof e?e:t?t+JSON.stringify(e):""}(e,n);if(!t.cache.hasOwnProperty(r)){const o={type:"STATIC",css:function(e,t){if("string"==typeof e)return e.replace(/\s{2,}/g,"");const n=l(t,e,"STATIC");return w()(n)}(e,t),selector:n};t.cache[r]=o,t._emitChange(o)}},subscribe:e=>(t.listeners.push(e),{unsubscribe:()=>t.listeners.splice(t.listeners.indexOf(e),1)}),clear(){t.uniqueRuleIdentifier=0,t.uniqueKeyframeIdentifier=0,t.cache={},t._emitChange({type:"CLEAR"})},_renderStyle(e={},n={}){const r=l(t,e,"RULE",n);return t._renderStyleToClassNames(r).slice(1)},_renderStyleToClassNames({_className:e,...n},r="",i="",a=""){let u=e?` ${e}`:"";for(const e in n){const c=n[e];if(f()(c))if(p(e))u+=t._renderStyleToClassNames(c,r+("&"===(s=e).charAt(0)?s.slice(1):s),i,a);else if(y(e)){const n=m(i,e.slice(6).trim());u+=t._renderStyleToClassNames(c,r,n,a)}else if(v(e)){const n=m(a,e.slice(9).trim());u+=t._renderStyleToClassNames(c,r,i,n)}else console.warn(`The object key "${e}" is not a valid nested key in Fela.\nMaybe you forgot to add a plugin to resolve it?\nCheck http://fela.js.org/docs/basics/Rules.html#styleobject for more information.`);else{const n=b(e,c,r,i,a);if(!t.cache.hasOwnProperty(n)){if(_(c)){t.cache[n]={className:""};continue}const u=t.selectorPrefix+t.generateClassName(e,c,r,i,a),f=o()(e,c),s={type:"RULE",className:u,selector:x(u,r),declaration:f,pseudo:r,media:i,support:a};t.cache[n]=s,t._emitChange(s)}const f=t.cache[n].className;f&&(u+=` ${f}`)}}var s;return u},generateClassName:(e,n,r,o,i)=>P(t.getNextRuleIdentifier,t.filterClassName),_emitChange(e){a()(t.listeners,t=>t(e))}};return t.keyframePrefixes.push(""),e.enhancers&&a()(e.enhancers,e=>{t=e(t)}),t}var E=n(7),z=n.n(E);function Q(...e){return(t,n)=>c()(e,(e,r)=>{const o=function e(t,n,r){return Array.isArray(t)?e(Q(...t),n,r):"function"==typeof t?t(n,r):t}(r,t,n);return e._className&&(o._className=e._className+(o._className?" "+o._className:"")),z()(e,o)},{})}function L(...e){return t=>n=>c()(e,(e,t)=>e=t(e),t(n))}n.d(t,"createRenderer",(function(){return q})),n.d(t,"combineRules",(function(){return Q})),n.d(t,"enhance",(function(){return L}))}])})); | ||
*/e.exports=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){for(var r in e)n=t(n,e[r],r,e);return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.replace(r,(function(e){return e[1].toUpperCase()})).replace(o,"ms")};var r=/-([a-z])/g,o=/^Ms/g;e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e){return e.filter((function(t,n){return e.lastIndexOf(t)===n}))}t.default=function e(t){for(var n=arguments.length,u=Array(n>1?n-1:0),a=1;a<n;a++)u[a-1]=arguments[a];for(var f=0,s=u.length;f<s;++f){var c=u[f];for(var l in c){var d=c[l],p=t[l];if(p&&d){if(Array.isArray(p)){t[l]=i(p.concat(d));continue}if(Array.isArray(d)){t[l]=i([p].concat(o(d)));continue}if("object"===(void 0===d?"undefined":r(d))){t[l]=e({},p,d);continue}}t[l]=d}}return t},e.exports=t.default},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)(e)};var r,o=n(10),i=(r=o)&&r.__esModule?r:{default:r};e.exports=t.default},function(e,t,n){"use strict";var r=/[A-Z]/g,o=/^ms-/,i={};e.exports=function(e){return e in i?i[e]:i[e]=e.replace(r,"-$&").toLowerCase().replace(o,"-ms-")}},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),i=n(3),u=n.n(i),a=n(4),f=n.n(a),s=n(0),c=n.n(s);function l(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return e.plugins.length>0?c()(e.plugins,(function(t,o){return o(t,n,e,r)}),t):t}var d=/^(:|\[|>|&)/;function p(e){return d.test(e)}function y(e){return"@media"===e.substr(0,6)}function m(e,t){return 0===e.length?t:e+" and "+t}function h(e){return"@supports"===e.substr(0,9)}var v=n(6),g=n.n(v);function b(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return o+r+n+g()(e)+t}function _(e){return null==e||"string"==typeof e&&null!==e.match(/(undefined|null)/)&&null===e.match(/url/)}function x(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"."+e+t}var O=n(1),w=n.n(O);var A=n(5),j=n.n(A);function N(e){return j()(e,(e,t,n)=>`${e}${n}{${w()(t)}}`,"")}const $="abcdefghijklmnopqrstuvwxyz",P=$.length;function C(e,t=(()=>!0)){const n=function e(t,n=""){return t<=P?$[t-1]+n:e(t/P|0,$[t%P]+n)}(e());return t(n)?n:C(e,t)}function M(e){return"data:"===e.substr(0,5)}function S(e){return M(e)?e:`'${e}'`}const k={".woff":"woff",".woff2":"woff2",".eot":"embedded-opentype",".ttf":"truetype",".otf":"opentype",".svg":"svg",".svgz":"svg"},I={"image/svg+xml":"svg","application/x-font-woff":"woff","application/font-woff":"woff","application/x-font-woff2":"woff2","application/font-woff2":"woff2","font/woff2":"woff2","application/octet-stream":"truetype","application/x-font-ttf":"truetype","application/x-font-truetype":"truetype","application/x-font-opentype":"opentype","application/vnd.ms-fontobject":"embedded-opentype","application/font-sfnt":"sfnt"};function R(e=[],t=[]){const n=c()(t,(e,t,n)=>`${e}${n>0?",":""}local(${S(t)})`,""),r=c()(e,(e,t,n)=>{const r=n>0?",":"",o=function(e){if(M(e)){let t="";for(let n=5;;n++){const r=e.charAt(n);if(";"===r||","===r)break;t+=r}const n=I[t];if(n)return n;console.warn(`A invalid base64 font was used. Please use one of the following mime type: ${Object.keys(I).join(", ")}.`)}else{let t="";for(let n=e.length-1;;n--){const r=e.charAt(n);if("."===r){t=r+t;break}t=r+t}const n=k[t];if(n)return n;console.warn(`A invalid font-format was used in "${e}". Use one of these: ${Object.keys(k).join(", ")}.`)}return""}(t);return`${e}${r}url(${S(t)}) format('${o}')`},"");return`${n}${n.length>0&&r.length>0?",":""}${r}`}function F(e){return-1===e.indexOf("ad")}const T=/^[a-z_][a-z0-9-_]*$/gi;function K(e=""){return e.length>0&&null===e.match(T)&&console.error(`An invalid selectorPrefix (${e}) has been used to create a new Fela renderer.\nIt must only contain a-Z, 0-9, - and _ while it must start with either _ or a-Z.\nSee http://fela.js.org/docs/advanced/RendererConfiguration.html`),e}const q=(e=[])=>function(t,n){return-1===e.indexOf(n)?-1===e.indexOf(t)?0:-1:-1===e.indexOf(t)?1:e.indexOf(t)-e.indexOf(n)};function E(e={}){let t={listeners:[],keyframePrefixes:e.keyframePrefixes||["-webkit-","-moz-"],plugins:e.plugins||[],sortMediaQuery:e.sortMediaQuery||q(e.mediaQueryOrder),supportQueryOrder:e.supportQueryOrder||[],styleNodeAttributes:e.styleNodeAttributes||{},ruleOrder:[/^:link/,/^:visited/,/^:hover/,/^:focus-within/,/^:focus/,/^:active/],selectorPrefix:K(e.selectorPrefix),filterClassName:e.filterClassName||F,devMode:e.devMode||!1,uniqueRuleIdentifier:0,uniqueKeyframeIdentifier:0,nodes:{},scoreIndex:{},cache:{},getNextRuleIdentifier:()=>++t.uniqueRuleIdentifier,getNextKeyframeIdentifier:()=>++t.uniqueKeyframeIdentifier,renderRule:(e,n={})=>t._renderStyle(e(n,t),n),renderKeyframe(e,n={}){const r=e(n,t),o=l(t,r,"KEYFRAME",n),i=N(o);if(!t.cache.hasOwnProperty(i)){const e=t.selectorPrefix+t.generateAnimationName(n),r={type:"KEYFRAME",keyframe:function(e,t,n=[""],r){const o=r||N(e);return c()(n,(e,n)=>`${e}@${n}keyframes ${t}{${o}}`,"")}(o,e,t.keyframePrefixes,i),name:e};t.cache[i]=r,t._emitChange(r)}return t.cache[i].name},generateAnimationName:e=>"k"+t.getNextKeyframeIdentifier(),renderFont(e,n,r={}){const{localAlias:o,...i}=r,u=e+JSON.stringify(r),a=function(e){return"string"==typeof e?[e]:Array.isArray(e)?e.slice():[]}(o);if(!t.cache.hasOwnProperty(u)){const r='"'===(f=e).charAt(0)?f:`"${f}"`,o={type:"FONT",fontFace:function(e){return`@font-face{${w()(e)}}`}({...i,src:R(n,a),fontFamily:r}),fontFamily:r};t.cache[u]=o,t._emitChange(o)}var f;return t.cache[u].fontFamily},renderStatic(e,n){const r=function(e,t){return"string"==typeof e?e:t?t+JSON.stringify(e):""}(e,n);if(!t.cache.hasOwnProperty(r)){const o={type:"STATIC",css:function(e,t){if("string"==typeof e)return e.replace(/\s{2,}/g,"");const n=l(t,e,"STATIC");return w()(n)}(e,t),selector:n};t.cache[r]=o,t._emitChange(o)}},subscribe:e=>(t.listeners.push(e),{unsubscribe:()=>t.listeners.splice(t.listeners.indexOf(e),1)}),clear(){t.uniqueRuleIdentifier=0,t.uniqueKeyframeIdentifier=0,t.cache={},t._emitChange({type:"CLEAR"})},_renderStyle(e={},n={}){const r=l(t,e,"RULE",n);return t._renderStyleToClassNames(r).slice(1)},_renderStyleToClassNames({_className:e,...n},r="",i="",u=""){let a=e?` ${e}`:"";for(const e in n){const c=n[e];if(f()(c))if(p(e))a+=t._renderStyleToClassNames(c,r+("&"===(s=e).charAt(0)?s.slice(1):s),i,u);else if(y(e)){const n=m(i,e.slice(6).trim());a+=t._renderStyleToClassNames(c,r,n,u)}else if(h(e)){const n=m(u,e.slice(9).trim());a+=t._renderStyleToClassNames(c,r,i,n)}else console.warn(`The object key "${e}" is not a valid nested key in Fela.\nMaybe you forgot to add a plugin to resolve it?\nCheck http://fela.js.org/docs/basics/Rules.html#styleobject for more information.`);else{const n=b(e,c,r,i,u);if(!t.cache.hasOwnProperty(n)){if(_(c)){t.cache[n]={className:""};continue}const a=t.selectorPrefix+t.generateClassName(e,c,r,i,u),f=o()(e,c),s={type:"RULE",className:a,selector:x(a,r),declaration:f,pseudo:r,media:i,support:u};t.cache[n]=s,t._emitChange(s)}const f=t.cache[n].className;f&&(a+=` ${f}`)}}var s;return a},generateClassName:(e,n,r,o,i)=>C(t.getNextRuleIdentifier,t.filterClassName),_emitChange(e){u()(t.listeners,t=>t(e))}};return t.keyframePrefixes.push(""),e.enhancers&&u()(e.enhancers,e=>{t=e(t)}),t}var z=n(7),Q=n.n(z);function L(...e){return(t,n)=>c()(e,(e,r)=>{const o=function e(t,n,r){return Array.isArray(t)?e(L(...t),n,r):"function"==typeof t?t(n,r):t}(r,t,n);return o&&e._className&&(o._className=e._className+(o._className?" "+o._className:"")),Q()(e,o)},{})}function U(...e){return t=>n=>c()(e,(e,t)=>e=t(e),t(n))}n.d(t,"createRenderer",(function(){return E})),n.d(t,"combineRules",(function(){return L})),n.d(t,"enhance",(function(){return U}))}])})); |
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
81020
45
1286
Updatedfela-utils@^11.3.0