Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fela-dom

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-dom - npm Package Compare versions

Comparing version 11.5.2 to 11.6.0

4

es/dom/rehydration/rehydrateRules.js

@@ -47,3 +47,5 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var declarationReference = generateDeclarationReference(camelCaseProperty(property), value, pseudo, media, support);
var declarationReference = generateDeclarationReference(
// keep css custom properties as lower-cased props
property.indexOf('--') === 0 ? property : camelCaseProperty(property), value, pseudo, media, support);

@@ -50,0 +52,0 @@ cache[declarationReference] = generateCacheEntry(RULE_TYPE, className, property, value, pseudo, media, support, specificityPrefix);

@@ -60,3 +60,5 @@ 'use strict';

var declarationReference = (0, _felaUtils.generateDeclarationReference)((0, _cssInJsUtils.camelCaseProperty)(property), value, pseudo, media, support);
var declarationReference = (0, _felaUtils.generateDeclarationReference)(
// keep css custom properties as lower-cased props
property.indexOf('--') === 0 ? property : (0, _cssInJsUtils.camelCaseProperty)(property), value, pseudo, media, support);

@@ -63,0 +65,0 @@ cache[declarationReference] = (0, _generateCacheEntry2.default)(_felaUtils.RULE_TYPE, className, property, value, pseudo, media, support, specificityPrefix);

{
"name": "fela-dom",
"version": "11.5.2",
"version": "11.6.0",
"description": "Fela package for working with the DOM",

@@ -33,11 +33,11 @@ "main": "lib/index.js",

"fast-loops": "^1.0.1",
"fela-utils": "^11.5.2",
"fela-utils": "^11.6.0",
"sort-css-media-queries": "^1.4.3"
},
"devDependencies": {
"fela": "^11.5.2",
"fela-preset-web": "^11.5.2",
"fela-tools": "^11.5.2"
"fela": "^11.6.0",
"fela-preset-web": "^11.6.0",
"fela-tools": "^11.6.0"
},
"gitHead": "b73826bbc7e77289bec55f344e0e9a22f5700bfd"
"gitHead": "0ad294fd638114ee6b5ca5f2b3a2b7112a6b6f7b"
}

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("FelaDOM",[],t):"object"==typeof exports?exports.FelaDOM=t():e.FelaDOM=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){for(var n in e)r=t(r,e[n],n,e);return r}},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){for(var n=0,o=e.length;n<o;++n)r=t(r,e[n],n,o,e);return r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var r in e)t(e[r],r,e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var r=0,n=e.length;r<n;++r)t(e[r],r,n,e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"render",(function(){return l})),r.d(t,"rehydrate",(function(){return _})),r.d(t,"renderToMarkup",(function(){return Y})),r.d(t,"renderToSheetList",(function(){return D}));var n=r(3),o=r.n(n);function u(e,t){return e+"{"+t+"}"}function s(e,t,r=document){const n=function({type:e,media:t="",support:r=""}){return e+t+r}(e);if(!t.nodes[n]){const o=function({type:e,media:t,support:r},n=document){const o=t?`[media="${t}"]`:":not([media])",u=r?'[data-fela-support="true"]':':not([data-fela-support="true"])';return n.querySelector(`[data-fela-type="${e}"]${u}${o}`)}(e,r)||function(e,t=document,r,n){const o=t.head||{},{type:u,media:s,support:i}=e,a=t.createElement("style");a.setAttribute("data-fela-type",u),a.type="text/css",i&&a.setAttribute("data-fela-support","true"),s&&(a.media=s);for(let e in n)a.setAttribute(e,n[e]);if(void 0!==typeof window&&window.FelaConfig)for(let e in window.FelaConfig.styleNodeAttributes)a.setAttribute(e,window.FelaConfig.styleNodeAttributes[e]);const c=function(e,{type:t,media:r,support:n},o){switch(t){case"FONT":case"STATIC":case"KEYFRAME":return e[0];case"RULE":const t=e.map(e=>e.media).filter(e=>0!==e.length);if(r){const u=[...t,r].sort(o),s=u.indexOf(r)+1,i=u[s];if(i)return i===r&&n?e.find(e=>e.media===u[u.indexOf(r)+2]):e.find(e=>e.media===i)}else{const r=t.sort(o)[0];if(!n){const t=e.find(e=>void 0!==e.getAttribute("data-fela-support")&&""===e.media&&"RULE"===e.getAttribute("data-fela-type"));if(t)return t}if(r)return e.find(e=>e.media===r)}}}([...o.querySelectorAll("[data-fela-type]")],e,r);return c?o.insertBefore(a,c):o.appendChild(a),a}(e,r,t.sortMediaQuery,t.styleNodeAttributes);t.nodes[n]=o}return t.nodes[n]}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return 0===e.length||0===t.length?0:e.indexOf(e.find((function(e){return null!==t.match(e)})))+1}function a(e,t){return"@supports "+e+"{"+t+"}"}function c(e,t=document){return r=>{if("CLEAR"===r.type)return o()(e.nodes,e=>e.parentNode.removeChild(e)),e.nodes={},void(e.scoreIndex={});const n=s(r,e,t);switch(r.type){case"KEYFRAME":-1===n.textContent.indexOf(r.keyframe)&&(n.textContent+=r.keyframe);break;case"FONT":-1===n.textContent.indexOf(r.fontFace)&&(n.textContent+=r.fontFace);break;case"STATIC":let t=r.selector?u(r.selector,r.css):r.css;-1===n.textContent.indexOf(t)&&(n.textContent+=t);break;case"RULE":!function({selector:e,declaration:t,support:r,media:n,pseudo:o},s,c){const l=n+r;try{const n=i(s.ruleOrder,o),{cssRules:f}=c.sheet;let d=f.length;if(0===n)d=void 0===s.scoreIndex[l]?0:s.scoreIndex[l]+1;else{for(let e=s.scoreIndex[l]||0,t=f.length;e<t;++e)if(f[e].score>n){d=e;break}}const p=u(e,t);if(r.length>0){const e=a(r,p);c.sheet.insertRule(e,d)}else c.sheet.insertRule(p,d);0===n&&(s.scoreIndex[l]=d),f[d].score=n}catch(e){}}(r,e,n)}}}function l(e,t){e.updateSubscription||(e.scoreIndex={},e.nodes={},e.updateSubscription=c(e,t),e.subscribe(e.updateSubscription),o()(e.cache,e._emitChange))}var f=r(4),d=r.n(f);function p(e){return e.split("{")[0].slice(9).trim()}function y(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return o+n+r+e+t}var m=/-([a-z])/g,h=/^Ms/g,b={};function R(e){return e[1].toUpperCase()}function g(e){if(b.hasOwnProperty(e))return b[e];var t=e.replace(m,R).replace(h,"ms");return b[e]=t,t}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=("."+e).repeat(n);return""+r+o+t}function x(e,t,r,n,o="",u="",s="",i=""){return{type:e,className:t,selector:v(t,o,i),declaration:r+":"+n,pseudo:o,media:u,support:s}}const A={};function M(e,t="",r="",n={},o=""){let u;const s=function(e){return A[e]||(A[e]=new RegExp(e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")+"[.]([0-9a-z_-]+)([.][0-9a-z_-]+){0,}([^{]+)?{([^:]+):([^}]+)}","gi")),A[e]}(o);for(;u=s.exec(e);){const[e,s,i,a,c,l]=u;n[y(g(c),l,a,t,r)]=x("RULE",s,c,l,a,t,r,o)}return n}const O=/@supports[^{]+\{([\s\S]+?})\s*}/gi;const E=/@(-webkit-|-moz-)?keyframes ([a-z_][a-z0-9-_]*)(\{.*?(?=}})}})/gi;const F=/[.][a-z0-9_-]*/gi;function _(e,t=document){l(e,t),d()(t.querySelectorAll("[data-fela-type]"),t=>{const r=t.getAttribute("data-fela-rehydration")||-1,n=e.uniqueRuleIdentifier||parseInt(r,10);if(-1!==n){const r=t.getAttribute("data-fela-type")||"",o=t.getAttribute("media")||"",u=t.getAttribute("data-fela-support")||"",s=t.textContent;e.uniqueRuleIdentifier=n;const a=r+o+u;if(e.nodes[a]=t,"RULE"===r){if(u?function(e,t="",r={},n=""){let o;for(;o=O.exec(e);){const[e,u]=o;M(u,t,p(e),r,n)}}(s,o,e.cache,e.specificityPrefix):M(s,o,"",e.cache,e.specificityPrefix),t.sheet&&t.sheet.cssRules){const r=o+u;d()(t.sheet.cssRules,(t,n)=>{const o=t.conditionText?t.cssRules[0].selectorText:t.selectorText,u=i(e.ruleOrder,o.split(F)[1]);0===u&&(e.scoreIndex[r]=n),t.score=u})}}else"KEYFRAME"===r&&function(e,t={}){let r;for(;r=E.exec(e);){const[e,n,o,u]=r;t[u]?t[u].keyframe+=e:t[u]={type:"KEYFRAME",keyframe:e,name:o}}}(s,e.cache)}})}var C,T=r(2),k=r.n(T),j=r(0),w=r.n(j);function N(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function S(e,t){var r=w()(e,(function(r,n,o){var u=function(e,t){for(var r=-1,n=0;n<e.length;n++)if(t(e[n])){r=n;break}return r}(r,(function(r){return t(e[r],r)>t(n,o)}));return-1!==u?function(e,t,r){return[].concat(N(e.slice(0,r)),[t],N(e.slice(r,e.length)))}(r,o,u):[].concat(function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(r),[o])}),[]);return k()(r,(function(t,r){return t[r]=e[r],t}),{})}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L=(I(C={},"RULE",(function(e,t){var r=t.selector,n=t.declaration,o=t.support,s=t.media,i=u(r,n);o?s?(e.supportMediaRules[s]||(e.supportMediaRules[s]={}),e.supportMediaRules[s][o]||(e.supportMediaRules[s][o]=""),e.supportMediaRules[s][o]+=i):(e.supportRules[o]||(e.supportRules[o]=""),e.supportRules[o]+=i):s?(e.mediaRules[s]||(e.mediaRules[s]=""),e.mediaRules[s]+=i):e.rules+=i})),I(C,"FONT",(function(e,t){var r=t.fontFace;e.fontFaces+=r})),I(C,"KEYFRAME",(function(e,t){var r=t.keyframe;e.keyframes+=r})),I(C,"STATIC",(function(e,t){var r=t.css,n=t.selector;e.statics+=n?u(n,r):r})),C);function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=S(e,(function(e){return i(t,e.pseudo)}));return w()(r,(function(e,t){var r=L[t.type];return r&&r(e,t),e}),{mediaRules:{},supportRules:{},supportMediaRules:{},fontFaces:"",statics:"",keyframes:"",rules:""})}var U={fontFaces:"FONT",statics:"STATIC",keyframes:"KEYFRAME",rules:"RULE"};function $(e){return w()(e,(function(e,t,r){return t.length>0&&(e+=a(r,t)),e}),"")}function z(e,t,r="",n=-1,o=!1,u={}){return`<style type="text/css" data-fela-rehydration="${n}" data-fela-type="${t}"${o?' data-fela-support="true"':""}${r.length>0?` media="${r}"`:""}${w()(u,(e,t,r)=>e+" "+r+'="'+t+'"',"")}>${e}</style>`}const q=/^[a-z0-9_-]*$/gi;function K(e){return 0===e.selectorPrefix.length||null!==e.selectorPrefix.match(q)?e.uniqueRuleIdentifier:-1}function Y(e){const t=P(e.cache,e.ruleOrder),r=K(e);let n=w()(U,(n,o,u)=>(t[u].length>0&&(n+=z(t[u],o,"",r,!1,e.styleNodeAttributes)),n),"");const o=$(t.supportRules);o&&(n+=z(o,"RULE","",r,!0,e.styleNodeAttributes));const u=Object.keys({...t.supportMediaRules,...t.mediaRules}).sort(e.sortMediaQuery);return k()(u,(n,o)=>{if(t.mediaRules[o]&&t.mediaRules[o].length>0&&(n+=z(t.mediaRules[o],"RULE",o,r,!1,e.styleNodeAttributes)),t.supportMediaRules[o]){const u=$(t.supportMediaRules[o]);u.length>0&&(n+=z(u,"RULE",o,r,!0,e.styleNodeAttributes))}return n},n)}function D(e){const t=P(e.cache,e.ruleOrder),r=K(e),n=w()(U,(n,o,u)=>(t[u].length>0&&n.push({css:t[u],rehydration:r,attributes:e.styleNodeAttributes,type:o}),n),[]),o=$(t.supportRules);o&&n.push({css:o,type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,support:!0});const u=Object.keys({...t.supportMediaRules,...t.mediaRules}).sort(e.sortMediaQuery);return k()(u,(n,o)=>{if(t.mediaRules[o]&&t.mediaRules[o].length>0&&n.push({css:t.mediaRules[o],type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,media:o}),t.supportMediaRules[o]){const u=$(t.supportMediaRules[o]);u.length>0&&n.push({css:u,type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,support:!0,media:o})}return n},n)}}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("FelaDOM",[],t):"object"==typeof exports?exports.FelaDOM=t():e.FelaDOM=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){for(var n in e)r=t(r,e[n],n,e);return r}},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){for(var n=0,o=e.length;n<o;++n)r=t(r,e[n],n,o,e);return r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var r in e)t(e[r],r,e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var r=0,n=e.length;r<n;++r)t(e[r],r,n,e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"render",(function(){return l})),r.d(t,"rehydrate",(function(){return _})),r.d(t,"renderToMarkup",(function(){return Y})),r.d(t,"renderToSheetList",(function(){return D}));var n=r(3),o=r.n(n);function u(e,t){return e+"{"+t+"}"}function s(e,t,r=document){const n=function({type:e,media:t="",support:r=""}){return e+t+r}(e);if(!t.nodes[n]){const o=function({type:e,media:t,support:r},n=document){const o=t?`[media="${t}"]`:":not([media])",u=r?'[data-fela-support="true"]':':not([data-fela-support="true"])';return n.querySelector(`[data-fela-type="${e}"]${u}${o}`)}(e,r)||function(e,t=document,r,n){const o=t.head||{},{type:u,media:s,support:i}=e,a=t.createElement("style");a.setAttribute("data-fela-type",u),a.type="text/css",i&&a.setAttribute("data-fela-support","true"),s&&(a.media=s);for(let e in n)a.setAttribute(e,n[e]);if(void 0!==typeof window&&window.FelaConfig)for(let e in window.FelaConfig.styleNodeAttributes)a.setAttribute(e,window.FelaConfig.styleNodeAttributes[e]);const c=function(e,{type:t,media:r,support:n},o){switch(t){case"FONT":case"STATIC":case"KEYFRAME":return e[0];case"RULE":const t=e.map(e=>e.media).filter(e=>0!==e.length);if(r){const u=[...t,r].sort(o),s=u.indexOf(r)+1,i=u[s];if(i)return i===r&&n?e.find(e=>e.media===u[u.indexOf(r)+2]):e.find(e=>e.media===i)}else{const r=t.sort(o)[0];if(!n){const t=e.find(e=>void 0!==e.getAttribute("data-fela-support")&&""===e.media&&"RULE"===e.getAttribute("data-fela-type"));if(t)return t}if(r)return e.find(e=>e.media===r)}}}([...o.querySelectorAll("[data-fela-type]")],e,r);return c?o.insertBefore(a,c):o.appendChild(a),a}(e,r,t.sortMediaQuery,t.styleNodeAttributes);t.nodes[n]=o}return t.nodes[n]}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return 0===e.length||0===t.length?0:e.indexOf(e.find((function(e){return null!==t.match(e)})))+1}function a(e,t){return"@supports "+e+"{"+t+"}"}function c(e,t=document){return r=>{if("CLEAR"===r.type)return o()(e.nodes,e=>e.parentNode.removeChild(e)),e.nodes={},void(e.scoreIndex={});const n=s(r,e,t);switch(r.type){case"KEYFRAME":-1===n.textContent.indexOf(r.keyframe)&&(n.textContent+=r.keyframe);break;case"FONT":-1===n.textContent.indexOf(r.fontFace)&&(n.textContent+=r.fontFace);break;case"STATIC":let t=r.selector?u(r.selector,r.css):r.css;-1===n.textContent.indexOf(t)&&(n.textContent+=t);break;case"RULE":!function({selector:e,declaration:t,support:r,media:n,pseudo:o},s,c){const l=n+r;try{const n=i(s.ruleOrder,o),{cssRules:f}=c.sheet;let d=f.length;if(0===n)d=void 0===s.scoreIndex[l]?0:s.scoreIndex[l]+1;else{for(let e=s.scoreIndex[l]||0,t=f.length;e<t;++e)if(f[e].score>n){d=e;break}}const p=u(e,t);if(r.length>0){const e=a(r,p);c.sheet.insertRule(e,d)}else c.sheet.insertRule(p,d);0===n&&(s.scoreIndex[l]=d),f[d].score=n}catch(e){}}(r,e,n)}}}function l(e,t){e.updateSubscription||(e.scoreIndex={},e.nodes={},e.updateSubscription=c(e,t),e.subscribe(e.updateSubscription),o()(e.cache,e._emitChange))}var f=r(4),d=r.n(f);function p(e){return e.split("{")[0].slice(9).trim()}function y(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return o+n+r+e+t}var m=/-([a-z])/g,h=/^Ms/g,b={};function R(e){return e[1].toUpperCase()}function g(e){if(b.hasOwnProperty(e))return b[e];var t=e.replace(m,R).replace(h,"ms");return b[e]=t,t}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=("."+e).repeat(n);return""+r+o+t}function x(e,t,r,n,o="",u="",s="",i=""){return{type:e,className:t,selector:v(t,o,i),declaration:r+":"+n,pseudo:o,media:u,support:s}}const A={};function M(e,t="",r="",n={},o=""){let u;const s=function(e){return A[e]||(A[e]=new RegExp(e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")+"[.]([0-9a-z_-]+)([.][0-9a-z_-]+){0,}([^{]+)?{([^:]+):([^}]+)}","gi")),A[e]}(o);for(;u=s.exec(e);){const[e,s,i,a,c,l]=u;n[y(0===c.indexOf("--")?c:g(c),l,a,t,r)]=x("RULE",s,c,l,a,t,r,o)}return n}const O=/@supports[^{]+\{([\s\S]+?})\s*}/gi;const E=/@(-webkit-|-moz-)?keyframes ([a-z_][a-z0-9-_]*)(\{.*?(?=}})}})/gi;const F=/[.][a-z0-9_-]*/gi;function _(e,t=document){l(e,t),d()(t.querySelectorAll("[data-fela-type]"),t=>{const r=t.getAttribute("data-fela-rehydration")||-1,n=e.uniqueRuleIdentifier||parseInt(r,10);if(-1!==n){const r=t.getAttribute("data-fela-type")||"",o=t.getAttribute("media")||"",u=t.getAttribute("data-fela-support")||"",s=t.textContent;e.uniqueRuleIdentifier=n;const a=r+o+u;if(e.nodes[a]=t,"RULE"===r){if(u?function(e,t="",r={},n=""){let o;for(;o=O.exec(e);){const[e,u]=o;M(u,t,p(e),r,n)}}(s,o,e.cache,e.specificityPrefix):M(s,o,"",e.cache,e.specificityPrefix),t.sheet&&t.sheet.cssRules){const r=o+u;d()(t.sheet.cssRules,(t,n)=>{const o=t.conditionText?t.cssRules[0].selectorText:t.selectorText,u=i(e.ruleOrder,o.split(F)[1]);0===u&&(e.scoreIndex[r]=n),t.score=u})}}else"KEYFRAME"===r&&function(e,t={}){let r;for(;r=E.exec(e);){const[e,n,o,u]=r;t[u]?t[u].keyframe+=e:t[u]={type:"KEYFRAME",keyframe:e,name:o}}}(s,e.cache)}})}var C,T=r(2),k=r.n(T),j=r(0),w=r.n(j);function N(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function S(e,t){var r=w()(e,(function(r,n,o){var u=function(e,t){for(var r=-1,n=0;n<e.length;n++)if(t(e[n])){r=n;break}return r}(r,(function(r){return t(e[r],r)>t(n,o)}));return-1!==u?function(e,t,r){return[].concat(N(e.slice(0,r)),[t],N(e.slice(r,e.length)))}(r,o,u):[].concat(function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(r),[o])}),[]);return k()(r,(function(t,r){return t[r]=e[r],t}),{})}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L=(I(C={},"RULE",(function(e,t){var r=t.selector,n=t.declaration,o=t.support,s=t.media,i=u(r,n);o?s?(e.supportMediaRules[s]||(e.supportMediaRules[s]={}),e.supportMediaRules[s][o]||(e.supportMediaRules[s][o]=""),e.supportMediaRules[s][o]+=i):(e.supportRules[o]||(e.supportRules[o]=""),e.supportRules[o]+=i):s?(e.mediaRules[s]||(e.mediaRules[s]=""),e.mediaRules[s]+=i):e.rules+=i})),I(C,"FONT",(function(e,t){var r=t.fontFace;e.fontFaces+=r})),I(C,"KEYFRAME",(function(e,t){var r=t.keyframe;e.keyframes+=r})),I(C,"STATIC",(function(e,t){var r=t.css,n=t.selector;e.statics+=n?u(n,r):r})),C);function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=S(e,(function(e){return i(t,e.pseudo)}));return w()(r,(function(e,t){var r=L[t.type];return r&&r(e,t),e}),{mediaRules:{},supportRules:{},supportMediaRules:{},fontFaces:"",statics:"",keyframes:"",rules:""})}var U={fontFaces:"FONT",statics:"STATIC",keyframes:"KEYFRAME",rules:"RULE"};function $(e){return w()(e,(function(e,t,r){return t.length>0&&(e+=a(r,t)),e}),"")}function z(e,t,r="",n=-1,o=!1,u={}){return`<style type="text/css" data-fela-rehydration="${n}" data-fela-type="${t}"${o?' data-fela-support="true"':""}${r.length>0?` media="${r}"`:""}${w()(u,(e,t,r)=>e+" "+r+'="'+t+'"',"")}>${e}</style>`}const q=/^[a-z0-9_-]*$/gi;function K(e){return 0===e.selectorPrefix.length||null!==e.selectorPrefix.match(q)?e.uniqueRuleIdentifier:-1}function Y(e){const t=P(e.cache,e.ruleOrder),r=K(e);let n=w()(U,(n,o,u)=>(t[u].length>0&&(n+=z(t[u],o,"",r,!1,e.styleNodeAttributes)),n),"");const o=$(t.supportRules);o&&(n+=z(o,"RULE","",r,!0,e.styleNodeAttributes));const u=Object.keys({...t.supportMediaRules,...t.mediaRules}).sort(e.sortMediaQuery);return k()(u,(n,o)=>{if(t.mediaRules[o]&&t.mediaRules[o].length>0&&(n+=z(t.mediaRules[o],"RULE",o,r,!1,e.styleNodeAttributes)),t.supportMediaRules[o]){const u=$(t.supportMediaRules[o]);u.length>0&&(n+=z(u,"RULE",o,r,!0,e.styleNodeAttributes))}return n},n)}function D(e){const t=P(e.cache,e.ruleOrder),r=K(e),n=w()(U,(n,o,u)=>(t[u].length>0&&n.push({css:t[u],rehydration:r,attributes:e.styleNodeAttributes,type:o}),n),[]),o=$(t.supportRules);o&&n.push({css:o,type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,support:!0});const u=Object.keys({...t.supportMediaRules,...t.mediaRules}).sort(e.sortMediaQuery);return k()(u,(n,o)=>{if(t.mediaRules[o]&&t.mediaRules[o].length>0&&n.push({css:t.mediaRules[o],type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,media:o}),t.supportMediaRules[o]){const u=$(t.supportMediaRules[o]);u.length>0&&n.push({css:u,type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,support:!0,media:o})}return n},n)}}])}));
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