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

@fower/parser

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fower/parser - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

67

dist/parser.cjs.development.js

@@ -102,3 +102,3 @@ 'use strict';

var reactProps = ['children', 'onClick', 'onChange', 'onBlur', 'className'];
var reactProps = ['children', 'onClick', 'onChange', 'onBlur', 'className', 'placeholder'];
/**

@@ -200,2 +200,21 @@ * An Abstract tool to handle atomic props

var composition = store.store.compositions.get(propKey);
if (composition) {
this.parseCSSObject(composition, {});
var _atom = new atom.Atom({
propKey: propKey,
propValue: propValue
});
_atom.handled = true;
_atom.style = {};
_atom.createClassName(store.store.config.prefix);
this.addAtom(_atom);
continue;
}
var atom$1 = new atom.Atom({

@@ -304,5 +323,9 @@ propKey: propKey,

if (!atom.style) continue;
var _Object$entries$ = Object.entries(atom.style)[0],
styleKey = _Object$entries$[0],
styleValue = _Object$entries$[1];
var _entries3 = Object.entries(atom.style);
if (!_entries3.length) continue;
var _entries3$ = _entries3[0],
styleKey = _entries3$[0],
styleValue = _entries3$[1];
var colorValue = colors[styleValue];

@@ -396,5 +419,7 @@

style = _step4$value.style;
var _Object$entries$2 = Object.entries(style)[0],
propKey = _Object$entries$2[0],
_propValue = _Object$entries$2[1];
var entries = Object.entries(style);
if (!entries.length) continue;
var _entries$ = entries[0],
propKey = _entries$[0],
_propValue = _entries$[1];
var option = {

@@ -507,2 +532,4 @@ propKey: propKey,

_proto.toRules = function toRules(enableInserted) {
var _this3 = this;
if (enableInserted === void 0) {

@@ -520,3 +547,3 @@ enableInserted = false;

for (var _iterator5 = _createForOfIteratorHelperLoose(this.atoms), _step5; !(_step5 = _iterator5()).done;) {
var _loop = function _loop() {
var atom = _step5.value;

@@ -529,8 +556,8 @@ var rule = '';

if (!isValid) continue; // empty style
if (!isValid) return "continue"; // empty style
if (utils.isEmptyObj(style)) continue;
if (utils.isEmptyObj(style)) return "continue";
if (!enableInserted) {
if (atom.inserted) continue;
if (atom.inserted) return "continue";
}

@@ -544,4 +571,8 @@

breakpoint = _atom$meta$breakpoint === void 0 ? '' : _atom$meta$breakpoint,
childSelector = _atom$meta.childSelector;
var uniqueSelector = this.hasResponsive ? '.' + this.uniqueClassName : '';
childSelector = _atom$meta.childSelector; // TODO: need refactor
var shouldUseUniqueClassName = !!_this3.atoms.find(function (i) {
return i.styleKeys === atom.styleKeys && (atom.meta.breakpoint || i.meta.breakpoint);
});
var uniqueSelector = shouldUseUniqueClassName || atom.meta.breakpoint ? '.' + _this3.uniqueClassName : '';
var selector = uniqueSelector + "." + className;

@@ -551,5 +582,11 @@ if (pseudo) selector = selector + pseudo;

if (childSelector) selector = selector + " " + childSelector;
rule = selector + " { " + this.styleToString(style, atom.meta) + " }";
if (breakpoint) rule = this.makeResponsiveStyle(breakpoint, rule);
rule = selector + " { " + _this3.styleToString(style, atom.meta) + " }";
if (breakpoint) rule = _this3.makeResponsiveStyle(breakpoint, rule);
rules.push(rule);
};
for (var _iterator5 = _createForOfIteratorHelperLoose(this.atoms), _step5; !(_step5 = _iterator5()).done;) {
var _ret = _loop();
if (_ret === "continue") continue;
}

@@ -556,0 +593,0 @@

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@fower/atom"),t=require("@fower/store"),r=require("@fower/color-helper"),s=require("@fower/sheet"),n=require("@fower/css-object-processor"),o=require("@fower/utils");function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e}).apply(this,arguments)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=e[r];return s}function u(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var s=0;return function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}var c=new Map,l=/(-columns|(^|[^e]-)padding|[^t]-spacing|l-align|rows|(^|(^border|[dkmnptx]|le|ne)-)width|^border|tom|[ek]-start|(o|[^e]-du)ration|us|(^|[^tv]-)left|(^|-)top|tance|rgin|e-offset|(er|g|n|t)-block|(^|[^tv]-)right|basis|[gnt]-inline|gap|(^|[^e]-)height|ness|(^|[^p]-)inset|[ek]-end|elay|tline|ve|dent|-rotate|n-rule|(c|ck|d|ne|t)-size)$/,d=["children","onClick","onChange","onBlur","className"];exports.Parser=function(){function a(e){void 0===e&&(e={}),this.props=e,this.atoms=[],this.traverseProps(e)}var f,m=a.prototype;return m.traverseProps=function(t){if(!o.isEmptyObj(t)){var r=this.config,s=r.pseudos,n=void 0===s?[]:s,a=r.theme||{},c=a.breakpoints,l=a.modes,f=Object.keys(c),m=l||[],p=n,h=t.excludedProps,v=void 0===h?[]:h,y=Object.entries(t);if(t.className)for(var b,g=u(t.className.split(/\s+/));!(b=g()).done;)y.push([b.value,!0]);for(var S=0,j=y;S<j.length;S++){var C=j[S],k=C[0],A=C[1];if(!v.includes(k)&&!d.includes(k)&&this.isValidProp(k,A))if("css"!==k){if(k.startsWith("_")){var O=k.replace(/^_/,""),N=Array.isArray(A)?A.reduce((function(e,t){var r;return i({},e,((r={})[t]=!0,r))}),{}):A;if(m.includes(O)){this.parseCSSObject(N,{mode:O});continue}if(f.includes(O)){this.parseCSSObject(N,{breakpoint:c[O]});continue}if(p.includes(O)){this.parseCSSObject(N,{pseudo:":"+O});continue}}var w=new e.Atom({propKey:k,propValue:A});try{this.mutateAtom(w),w.handled&&this.addAtom(w)}catch(e){continue}}else this.parseCSSObject(A)}for(var P,x=u(this.plugins);!(P=x()).done;){var T=P.value;T.afterAtomStyleCreate&&T.afterAtomStyleCreate(this)}}},m.formatCssValue=function(e,r){if(!l.test(e))return r;var s;if(o.isPercentNumber(String(r)))return String(r).replace("p","%");if(!o.isNumber(r))return r;if((s=Number(r))<1&&s>0)return 100*s+"%";var n=t.store.config;return"none"!==n.unit?n.transformUnit?n.transformUnit(s):r+t.store.config.unit:s},m.styleToString=function(e,s){var n=this,i=s.important,a=s.colorPostfix;return Object.entries(e).reduce((function(e,s){var u=s[1],c=o.jsKeyToCssKey(s[0]),l=i?" !important":"",d=t.store.theme.colors;return e+(c+": ")+(u=a?r.formatColor(d[u]||u,a):n.formatCssValue(c,d[u]||u))+l+";"}),"")},m.addAtom=function(e){c.get(e.id)||c.set(e.id,e);for(var t=this.config.theme.colors.modes,r=0,s=Object.entries(void 0===t?{}:t);r<s.length;r++){var n=s[r],o=n[0],a=n[1];if(e.style){var u=Object.entries(e.style)[0],l=u[0],d=a[u[1]];if(d){var f="--"+o,m=JSON.parse(JSON.stringify(e));m.className=e.className+f,m.key=e.key+f,m.id=e.id+f,m.meta=i({mode:o},e.meta),m.style[l]=d,this.atoms.push(m)}}}this.atoms.push(e)},m.isValidProp=function(e,t){return"css"===e||!!e.startsWith("_")||!!["string","boolean","number","undefined"].includes(typeof t)},m.mutateAtom=function(e){var r=c.get(e.id);if(r)throw this.addAtom(r),new Error("atom is cached, add to this.atoms derectly, no need to mutate");if((e=e.preprocessAtom(t.store.config)).handled)throw this.addAtom(e),new Error("atom is handled, add to this.atoms derectly ,no need to mutate");for(var s,n=u(this.plugins);!(s=n()).done;){var o=s.value;if(null!=o.isMatch&&o.isMatch(e.key)){o.beforeAtomStyleCreate&&(e=o.beforeAtomStyleCreate(e,this)),o.handleAtom&&(e=null==o.handleAtom?void 0:o.handleAtom(e,this)),e.createClassName(t.store.config.prefix),e.handled=!0;break}}},m.parseCSSObject=function(t,r){void 0===r&&(r={});for(var s,i=n.parse(t),a=o.objectToClassName(t),c=u(i);!(s=c()).done;){var l=s.value,d=l.selector,f=l.selectorType,m=l.style,p=Object.entries(m)[0],h={propKey:p[0],propValue:p[1],meta:r};"pseudo"===f&&h.meta&&(h.meta.pseudo=d),"child"===f&&h.meta&&(h.meta.childSelector=d);var v=new e.Atom(h),y="void"===f;try{this.mutateAtom(v)}catch(e){continue}v.style||(v.style=m,v.id=o.objectToClassName({style:m}),v.className=y?o.objectToClassName(m):a,v.handled=!0),this.addAtom(v)}},m.makeResponsiveStyle=function(e,t){return"@media (min-width: "+e+") {"+t+"}"},m.getClassNames=function(){var e=[];this.atoms.reduce((function(t,r){var s=t.findIndex((function(e){return e.styleKeysHash===r.styleKeysHash}));return r.isValid?(-1===s?(e.push(r.className),t=[].concat(t,[r])):(t.splice(s,1,r),e.splice(s,1,r.className)),t):t}),[]);var t=this.props.className,r=(void 0===t?"":t).split(/\s+/).filter((function(t){return!e.includes(t)&&!!t}));return e=e.concat(r),this.hasResponsive&&e.unshift(this.uniqueClassName),e},m.toStyle=function(){var e=this;return this.atoms.reduce((function(t,r){if(!r.isValid)return t;var s=Object.entries(r.style).reduce((function(t,r){var s,n=r[0],a=r[1];return i({},t,((s={})[n]=e.formatCssValue(o.jsKeyToCssKey(n),a),s))}),{});return i({},t,s)}),{})},m.toRules=function(e){void 0===e&&(e=!1);var t=this.config.theme.modePrefix,r=void 0===t?"":t,s=[];this.atoms=this.atoms.sort((function(e,t){return parseInt(t.meta.breakpoint||"0")-parseInt(e.meta.breakpoint||"0")}));for(var n,i=u(this.atoms);!(n=i()).done;){var a=n.value,c="",l=a.className,d=a.style,f=void 0===d?{}:d;if(a.isValid&&!o.isEmptyObj(f)&&(e||!a.inserted)){a.inserted=!0;var m=a.meta,p=m.pseudo,h=m.mode,v=m.breakpoint,y=void 0===v?"":v,b=m.childSelector,g=(this.hasResponsive?"."+this.uniqueClassName:"")+"."+l;p&&(g+=p),h&&(g="."+r+h+" "+g),b&&(g=g+" "+b),c=g+" { "+this.styleToString(f,a.meta)+" }",y&&(c=this.makeResponsiveStyle(y,c)),s.push(c)}}return s},m.getParsedProps=function(){var e=this.props,t=this.atoms;return o.isEmptyObj(e)?{}:Object.entries(e).reduce((function(e,r){var s=r[0],n=r[1];return t.find((function(e){return[e.propKey,e.key,e.id,"css"].includes(s)}))||(e[s]=n),e}),{})},m.insertRule=function(){var e=this.toRules();s.styleSheet.insertStyles(e)},(f=[{key:"uniqueClassName",get:function(){return o.objectToClassName(Object.keys(this.props))}},{key:"hasResponsive",get:function(){return!!this.atoms.find((function(e){return!!e.meta.breakpoint}))}},{key:"config",get:function(){return t.store.config}},{key:"plugins",get:function(){return t.store.config.plugins}}])&&function(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(a.prototype,f),a}(),exports.atomCache=c;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@fower/atom"),t=require("@fower/store"),r=require("@fower/color-helper"),n=require("@fower/sheet"),o=require("@fower/css-object-processor"),s=require("@fower/utils");function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}var c=new Map,l=/(-columns|(^|[^e]-)padding|[^t]-spacing|l-align|rows|(^|(^border|[dkmnptx]|le|ne)-)width|^border|tom|[ek]-start|(o|[^e]-du)ration|us|(^|[^tv]-)left|(^|-)top|tance|rgin|e-offset|(er|g|n|t)-block|(^|[^tv]-)right|basis|[gnt]-inline|gap|(^|[^e]-)height|ness|(^|[^p]-)inset|[ek]-end|elay|tline|ve|dent|-rotate|n-rule|(c|ck|d|ne|t)-size)$/,d=["children","onClick","onChange","onBlur","className","placeholder"];exports.Parser=function(){function a(e){void 0===e&&(e={}),this.props=e,this.atoms=[],this.traverseProps(e)}var f,m=a.prototype;return m.traverseProps=function(r){if(!s.isEmptyObj(r)){var n=this.config,o=n.pseudos,a=void 0===o?[]:o,c=n.theme||{},l=c.breakpoints,f=c.modes,m=Object.keys(l),p=f||[],h=a,v=r.excludedProps,y=void 0===v?[]:v,b=Object.entries(r);if(r.className)for(var g,S=u(r.className.split(/\s+/));!(g=S()).done;)b.push([g.value,!0]);for(var j=0,C=b;j<C.length;j++){var k=C[j],A=k[0],O=k[1];if(!y.includes(A)&&!d.includes(A)&&this.isValidProp(A,O))if("css"!==A){if(A.startsWith("_")){var N=A.replace(/^_/,""),w=Array.isArray(O)?O.reduce((function(e,t){var r;return i({},e,((r={})[t]=!0,r))}),{}):O;if(p.includes(N)){this.parseCSSObject(w,{mode:N});continue}if(m.includes(N)){this.parseCSSObject(w,{breakpoint:l[N]});continue}if(h.includes(N)){this.parseCSSObject(w,{pseudo:":"+N});continue}}var P=t.store.compositions.get(A);if(P){this.parseCSSObject(P,{});var K=new e.Atom({propKey:A,propValue:O});K.handled=!0,K.style={},K.createClassName(t.store.config.prefix),this.addAtom(K)}else{var x=new e.Atom({propKey:A,propValue:O});try{this.mutateAtom(x),x.handled&&this.addAtom(x)}catch(e){continue}}}else this.parseCSSObject(O)}for(var V,T=u(this.plugins);!(V=T()).done;){var q=V.value;q.afterAtomStyleCreate&&q.afterAtomStyleCreate(this)}}},m.formatCssValue=function(e,r){if(!l.test(e))return r;var n;if(s.isPercentNumber(String(r)))return String(r).replace("p","%");if(!s.isNumber(r))return r;if((n=Number(r))<1&&n>0)return 100*n+"%";var o=t.store.config;return"none"!==o.unit?o.transformUnit?o.transformUnit(n):r+t.store.config.unit:n},m.styleToString=function(e,n){var o=this,i=n.important,a=n.colorPostfix;return Object.entries(e).reduce((function(e,n){var u=n[1],c=s.jsKeyToCssKey(n[0]),l=i?" !important":"",d=t.store.theme.colors;return e+(c+": ")+(u=a?r.formatColor(d[u]||u,a):o.formatCssValue(c,d[u]||u))+l+";"}),"")},m.addAtom=function(e){c.get(e.id)||c.set(e.id,e);for(var t=this.config.theme.colors.modes,r=0,n=Object.entries(void 0===t?{}:t);r<n.length;r++){var o=n[r],s=o[0],a=o[1];if(e.style){var u=Object.entries(e.style);if(u.length){var l=u[0],d=l[0],f=a[l[1]];if(f){var m="--"+s,p=JSON.parse(JSON.stringify(e));p.className=e.className+m,p.key=e.key+m,p.id=e.id+m,p.meta=i({mode:s},e.meta),p.style[d]=f,this.atoms.push(p)}}}}this.atoms.push(e)},m.isValidProp=function(e,t){return"css"===e||!!e.startsWith("_")||!!["string","boolean","number","undefined"].includes(typeof t)},m.mutateAtom=function(e){var r=c.get(e.id);if(r)throw this.addAtom(r),new Error("atom is cached, add to this.atoms derectly, no need to mutate");if((e=e.preprocessAtom(t.store.config)).handled)throw this.addAtom(e),new Error("atom is handled, add to this.atoms derectly ,no need to mutate");for(var n,o=u(this.plugins);!(n=o()).done;){var s=n.value;if(null!=s.isMatch&&s.isMatch(e.key)){s.beforeAtomStyleCreate&&(e=s.beforeAtomStyleCreate(e,this)),s.handleAtom&&(e=null==s.handleAtom?void 0:s.handleAtom(e,this)),e.createClassName(t.store.config.prefix),e.handled=!0;break}}},m.parseCSSObject=function(t,r){void 0===r&&(r={});for(var n,i=o.parse(t),a=s.objectToClassName(t),c=u(i);!(n=c()).done;){var l=n.value,d=l.selector,f=l.selectorType,m=l.style,p=Object.entries(m);if(p.length){var h=p[0],v={propKey:h[0],propValue:h[1],meta:r};"pseudo"===f&&v.meta&&(v.meta.pseudo=d),"child"===f&&v.meta&&(v.meta.childSelector=d);var y=new e.Atom(v),b="void"===f;try{this.mutateAtom(y)}catch(e){continue}y.style||(y.style=m,y.id=s.objectToClassName({style:m}),y.className=b?s.objectToClassName(m):a,y.handled=!0),this.addAtom(y)}}},m.makeResponsiveStyle=function(e,t){return"@media (min-width: "+e+") {"+t+"}"},m.getClassNames=function(){var e=[];this.atoms.reduce((function(t,r){var n=t.findIndex((function(e){return e.styleKeysHash===r.styleKeysHash}));return r.isValid?(-1===n?(e.push(r.className),t=[].concat(t,[r])):(t.splice(n,1,r),e.splice(n,1,r.className)),t):t}),[]);var t=this.props.className,r=(void 0===t?"":t).split(/\s+/).filter((function(t){return!e.includes(t)&&!!t}));return e=e.concat(r),this.hasResponsive&&e.unshift(this.uniqueClassName),e},m.toStyle=function(){var e=this;return this.atoms.reduce((function(t,r){if(!r.isValid)return t;var n=Object.entries(r.style).reduce((function(t,r){var n,o=r[0],a=r[1];return i({},t,((n={})[o]=e.formatCssValue(s.jsKeyToCssKey(o),a),n))}),{});return i({},t,n)}),{})},m.toRules=function(e){var t=this;void 0===e&&(e=!1);var r=this.config.theme.modePrefix,n=void 0===r?"":r,o=[];this.atoms=this.atoms.sort((function(e,t){return parseInt(t.meta.breakpoint||"0")-parseInt(e.meta.breakpoint||"0")}));for(var i,a=function(){var r=i.value,a="",u=r.className,c=r.style,l=void 0===c?{}:c;if(!r.isValid)return"continue";if(s.isEmptyObj(l))return"continue";if(!e&&r.inserted)return"continue";r.inserted=!0;var d=r.meta,f=d.pseudo,m=d.mode,p=d.breakpoint,h=void 0===p?"":p,v=d.childSelector,y=(t.atoms.find((function(e){return e.styleKeys===r.styleKeys&&(r.meta.breakpoint||e.meta.breakpoint)}))||r.meta.breakpoint?"."+t.uniqueClassName:"")+"."+u;f&&(y+=f),m&&(y="."+n+m+" "+y),v&&(y=y+" "+v),a=y+" { "+t.styleToString(l,r.meta)+" }",h&&(a=t.makeResponsiveStyle(h,a)),o.push(a)},c=u(this.atoms);!(i=c()).done;)a();return o},m.getParsedProps=function(){var e=this.props,t=this.atoms;return s.isEmptyObj(e)?{}:Object.entries(e).reduce((function(e,r){var n=r[0],o=r[1];return t.find((function(e){return[e.propKey,e.key,e.id,"css"].includes(n)}))||(e[n]=o),e}),{})},m.insertRule=function(){var e=this.toRules();n.styleSheet.insertStyles(e)},(f=[{key:"uniqueClassName",get:function(){return s.objectToClassName(Object.keys(this.props))}},{key:"hasResponsive",get:function(){return!!this.atoms.find((function(e){return!!e.meta.breakpoint}))}},{key:"config",get:function(){return t.store.config}},{key:"plugins",get:function(){return t.store.config.plugins}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(a.prototype,f),a}(),exports.atomCache=c;
//# sourceMappingURL=parser.cjs.production.min.js.map

@@ -98,3 +98,3 @@ import { Atom } from '@fower/atom';

var reactProps = ['children', 'onClick', 'onChange', 'onBlur', 'className'];
var reactProps = ['children', 'onClick', 'onChange', 'onBlur', 'className', 'placeholder'];
/**

@@ -196,2 +196,21 @@ * An Abstract tool to handle atomic props

var composition = store.compositions.get(propKey);
if (composition) {
this.parseCSSObject(composition, {});
var _atom = new Atom({
propKey: propKey,
propValue: propValue
});
_atom.handled = true;
_atom.style = {};
_atom.createClassName(store.config.prefix);
this.addAtom(_atom);
continue;
}
var atom = new Atom({

@@ -300,5 +319,9 @@ propKey: propKey,

if (!atom.style) continue;
var _Object$entries$ = Object.entries(atom.style)[0],
styleKey = _Object$entries$[0],
styleValue = _Object$entries$[1];
var _entries3 = Object.entries(atom.style);
if (!_entries3.length) continue;
var _entries3$ = _entries3[0],
styleKey = _entries3$[0],
styleValue = _entries3$[1];
var colorValue = colors[styleValue];

@@ -392,5 +415,7 @@

style = _step4$value.style;
var _Object$entries$2 = Object.entries(style)[0],
propKey = _Object$entries$2[0],
_propValue = _Object$entries$2[1];
var entries = Object.entries(style);
if (!entries.length) continue;
var _entries$ = entries[0],
propKey = _entries$[0],
_propValue = _entries$[1];
var option = {

@@ -503,2 +528,4 @@ propKey: propKey,

_proto.toRules = function toRules(enableInserted) {
var _this3 = this;
if (enableInserted === void 0) {

@@ -516,3 +543,3 @@ enableInserted = false;

for (var _iterator5 = _createForOfIteratorHelperLoose(this.atoms), _step5; !(_step5 = _iterator5()).done;) {
var _loop = function _loop() {
var atom = _step5.value;

@@ -525,8 +552,8 @@ var rule = '';

if (!isValid) continue; // empty style
if (!isValid) return "continue"; // empty style
if (isEmptyObj(style)) continue;
if (isEmptyObj(style)) return "continue";
if (!enableInserted) {
if (atom.inserted) continue;
if (atom.inserted) return "continue";
}

@@ -540,4 +567,8 @@

breakpoint = _atom$meta$breakpoint === void 0 ? '' : _atom$meta$breakpoint,
childSelector = _atom$meta.childSelector;
var uniqueSelector = this.hasResponsive ? '.' + this.uniqueClassName : '';
childSelector = _atom$meta.childSelector; // TODO: need refactor
var shouldUseUniqueClassName = !!_this3.atoms.find(function (i) {
return i.styleKeys === atom.styleKeys && (atom.meta.breakpoint || i.meta.breakpoint);
});
var uniqueSelector = shouldUseUniqueClassName || atom.meta.breakpoint ? '.' + _this3.uniqueClassName : '';
var selector = uniqueSelector + "." + className;

@@ -547,5 +578,11 @@ if (pseudo) selector = selector + pseudo;

if (childSelector) selector = selector + " " + childSelector;
rule = selector + " { " + this.styleToString(style, atom.meta) + " }";
if (breakpoint) rule = this.makeResponsiveStyle(breakpoint, rule);
rule = selector + " { " + _this3.styleToString(style, atom.meta) + " }";
if (breakpoint) rule = _this3.makeResponsiveStyle(breakpoint, rule);
rules.push(rule);
};
for (var _iterator5 = _createForOfIteratorHelperLoose(this.atoms), _step5; !(_step5 = _iterator5()).done;) {
var _ret = _loop();
if (_ret === "continue") continue;
}

@@ -552,0 +589,0 @@

{
"name": "@fower/parser",
"version": "1.0.0",
"version": "1.1.0",
"license": "MIT",

@@ -24,9 +24,9 @@ "main": "dist/index.js",

"dependencies": {
"@fower/atom": "^1.0.0",
"@fower/css-object-processor": "^1.0.0",
"@fower/sheet": "^1.0.0",
"@fower/store": "^1.0.0",
"@fower/utils": "^1.0.0"
"@fower/atom": "^1.1.0",
"@fower/css-object-processor": "^1.1.0",
"@fower/sheet": "^1.1.0",
"@fower/store": "^1.1.0",
"@fower/utils": "^1.1.0"
},
"gitHead": "a6e2ed5de05a2ccb731b07bfef3cc0025e8ff837"
"gitHead": "b9bdec67e9b200ac680d99351574e897dfcf9e6f"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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