generate-atomic-css
Advanced tools
Comparing version 2.2.4 to 2.2.5
@@ -36,3 +36,3 @@ # Change Log | ||
- programs now are in ES Modules and won't work with Common JS require() | ||
- programs now are in ES Modules and won't work with Common JS `require()` | ||
@@ -55,3 +55,3 @@ ## 1.5.0 (2021-05-24) | ||
- add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29)) | ||
- add `testStats` to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29)) | ||
@@ -66,3 +66,3 @@ ## 1.4.0 (2021-01-23) | ||
Accidental version bump during migration to sourcehut. Sorry about that. | ||
Accidental version bump during migration to SourceHut. Sorry about that. | ||
@@ -69,0 +69,0 @@ ## 1.2.3 (2019-07-24) |
/** | ||
* @name generate-atomic-css | ||
* @fileoverview Generate Atomic CSS | ||
* @version 2.2.4 | ||
* @version 2.2.5 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -10,5 +10,5 @@ * @license MIT | ||
import{left as S,right as m}from"string-left-right";var J="2.2.4";import{left as O,right as b,leftSeq as w,rightSeq as L}from"string-left-right";function P(e){return typeof e=="string"}var F={CONFIGHEAD:"GENERATE-ATOMIC-CSS-CONFIG-STARTS",CONFIGTAIL:"GENERATE-ATOMIC-CSS-CONFIG-ENDS",CONTENTHEAD:"GENERATE-ATOMIC-CSS-CONTENT-STARTS",CONTENTTAIL:"GENERATE-ATOMIC-CSS-CONTENT-ENDS"},x=["px","em","%","rem","cm","mm","in","pt","pc","ex","ch","vw","vmin","vmax"],{CONFIGHEAD:T,CONFIGTAIL:A,CONTENTHEAD:E,CONTENTTAIL:h}=F,H=[":"];function W(e){let u=e,c="",d="";if(e.includes(T)&&e.includes(A)){if(e.indexOf(A)!==-1&&e.indexOf(E)!==-1&&e.indexOf(A)>e.indexOf(E))throw new Error("generate-atomic-css: [THROW_ID_02] Config heads are after config tails!");let s=e.indexOf(T)+T.length,l=e.indexOf(A);if(e[b(e,s)]==="*"&&e[b(e,b(e,s))]==="/"&&(s=b(e,b(e,s))+1),e[O(e,l)]==="*"&&e[O(e,O(e,l))]==="/"&&(l=O(e,O(e,l))),u=e.slice(s,l).trim(),!P(u)||!u.trim().length)return[u,c,d]}else if(e.includes(T)&&!e.includes(A)&&e.includes(E)){if(e.indexOf(T)>e.indexOf(E))throw new Error("generate-atomic-css: [THROW_ID_03] Config heads are after content heads!");u=e.slice(e.indexOf(T)+T.length,e.indexOf(E))}else if(!e.includes(T)&&!e.includes(A)&&(e.includes(E)||e.includes(h))){if(u=e,u.includes(E)){if(O(e,u.indexOf(E))){let o=u.indexOf(E);w(e,o,"/","*")&&(o=w(e,o,"/","*").leftmostChar),c=o===0?"":e.slice(0,o)}let s=u.indexOf(E)+E.length;L(u,s-1,"*","/")&&(s=L(u,s-1,"*","/").rightmostChar+1);let l=null;if(e.includes(h)){l=e.indexOf(h),e[O(e,l)]==="*"&&e[O(e,O(e,l))]==="/"&&(l=O(e,O(e,l)));let o=e.indexOf(h)+h.length;e[b(e,o-1)]==="*"&&e[b(e,b(e,o-1))]==="/"&&(o=b(e,b(e,o-1))+1),b(e,o)&&(d=e.slice(o))}l?u=u.slice(s,l).trim():u=u.slice(s).trim()}else if(u.includes(h)){let s=[],l=!1;u=u.split(` | ||
import{left as S,right as m}from"string-left-right";var J="2.2.5";import{left as O,right as b,leftSeq as x,rightSeq as L}from"string-left-right";function P(e){return typeof e=="string"}var F={CONFIGHEAD:"GENERATE-ATOMIC-CSS-CONFIG-STARTS",CONFIGTAIL:"GENERATE-ATOMIC-CSS-CONFIG-ENDS",CONTENTHEAD:"GENERATE-ATOMIC-CSS-CONTENT-STARTS",CONTENTTAIL:"GENERATE-ATOMIC-CSS-CONTENT-ENDS"},w=["px","em","%","rem","cm","mm","in","pt","pc","ex","ch","vw","vmin","vmax"],{CONFIGHEAD:T,CONFIGTAIL:A,CONTENTHEAD:E,CONTENTTAIL:h}=F,H=[":"];function W(e){let u=e,c="",d="";if(e.includes(T)&&e.includes(A)){if(e.indexOf(A)!==-1&&e.indexOf(E)!==-1&&e.indexOf(A)>e.indexOf(E))throw new Error("generate-atomic-css: [THROW_ID_02] Config heads are after config tails!");let s=e.indexOf(T)+T.length,l=e.indexOf(A);if(e[b(e,s)]==="*"&&e[b(e,b(e,s))]==="/"&&(s=b(e,b(e,s))+1),e[O(e,l)]==="*"&&e[O(e,O(e,l))]==="/"&&(l=O(e,O(e,l))),u=e.slice(s,l).trim(),!P(u)||!u.trim().length)return[u,c,d]}else if(e.includes(T)&&!e.includes(A)&&e.includes(E)){if(e.indexOf(T)>e.indexOf(E))throw new Error("generate-atomic-css: [THROW_ID_03] Config heads are after content heads!");u=e.slice(e.indexOf(T)+T.length,e.indexOf(E))}else if(!e.includes(T)&&!e.includes(A)&&(e.includes(E)||e.includes(h))){if(u=e,u.includes(E)){if(O(e,u.indexOf(E))){let o=u.indexOf(E);x(e,o,"/","*")&&(o=x(e,o,"/","*").leftmostChar),c=o===0?"":e.slice(0,o)}let s=u.indexOf(E)+E.length;L(u,s-1,"*","/")&&(s=L(u,s-1,"*","/").rightmostChar+1);let l=null;if(e.includes(h)){l=e.indexOf(h),e[O(e,l)]==="*"&&e[O(e,O(e,l))]==="/"&&(l=O(e,O(e,l)));let o=e.indexOf(h)+h.length;e[b(e,o-1)]==="*"&&e[b(e,b(e,o-1))]==="/"&&(o=b(e,b(e,o-1))+1),b(e,o)&&(d=e.slice(o))}l?u=u.slice(s,l).trim():u=u.slice(s).trim()}else if(u.includes(h)){let s=[],l=!1;u=u.split(` | ||
`).filter(i=>!i.includes("$$$")&&!l?(l||s.push(i),!1):(l||(l=!0),!0)).join(` | ||
`);let o=u.indexOf(h);w(u,o,"/","*")&&(o=w(u,o,"/","*").leftmostChar),u=u.slice(0,o).trim(),s.length&&(c=`${s.join(` | ||
`);let o=u.indexOf(h);x(u,o,"/","*")&&(o=x(u,o,"/","*").leftmostChar),u=u.slice(0,o).trim(),s.length&&(c=`${s.join(` | ||
`)} | ||
@@ -21,4 +21,4 @@ `);let r;b(e,e.indexOf(h)+h.length)&&(r=e.indexOf(h)+h.length,e[b(e,r)]==="*"&&e[b(e,b(e,r))]==="/"&&(r=b(e,b(e,r))+1,b(e,r)&&(d=e.slice(r))))}}else{let s=new RegExp(`(\\/\\s*\\*\\s*)*${E}(\\s*\\*\\s*\\/)*`),l=new RegExp(`(\\/\\s*\\*\\s*)*${h}(\\s*\\*\\s*\\/)*`),o=!1,r=[],i=[],a=e.split(` | ||
${i.join(` | ||
`)}`)}return[u,c,d]}function M(e,u=!0){if(!u)return e;let c=Array.from(e);if(c.length&&P(c[0])&&!c[0].trim().length)do c.shift();while(P(c[0])&&!c[0].trim().length);if(c.length&&P(c[c.length-1])&&!c[c.length-1].trim().length)do c.pop();while(c[c.length-1]&&!c[c.length-1].trim().length);return c}function B(e,u=0,c=500){let d=u,s=c,l=e,o;if(e.lastIndexOf("}")>0&&e.slice(e.lastIndexOf("}")+1).includes("|")?o=e.slice(e.lastIndexOf("}")+1).split("|").filter(r=>r.trim().length).map(r=>r.trim()).filter(r=>String(r).split("").every(i=>/\d/g.test(i))):e.includes("|")&&(o=e.split("|").filter(r=>r.trim().length).map(r=>r.trim()).filter(r=>String(r).split("").every(i=>/\d/g.test(i)))),Array.isArray(o)&&(o.length===1?s=Number.parseInt(o[0],10):o.length>1&&(d=Number.parseInt(o[0],10),s=Number.parseInt(o[1],10))),e.lastIndexOf("}")>0&&e.slice(e.lastIndexOf("}")+1).includes("|")){if(l=e.slice(0,e.indexOf("|",e.lastIndexOf("}")+1)).trimEnd(),l.trim().startsWith("|"))for(;l.trim().startsWith("|");)l=l.trim().slice(1)}else{let r=null,i=!1,a=0,t=e.length,p=null;for(let f=0,g=e.length;f<g;f++)if("0123456789".includes(e[f])?p===null&&e[f].trim().length&&(p=!0):e[f]!=="|"&&e[f].trim().length&&(p=!1),!e[f+1]&&p&&r&&(t=r),e[f]==="|"){if(p&&r){t=r;break}r=f,p=null}else!i&&e[f].trim().length&&(i=!0,r!==null&&(a=r+1));l=e.slice(a,t).trimEnd()}return[d,s,l]}function G(e,u,c,d,s,l){let o,r=0,[i,a,t]=B(e,0,500),p=d-c,f="";for(let g=i;g<=a;g++){let y=0,n=0;for(let $=0,v=t.length;$<v;$++){let _=t[$].charCodeAt(0);if(t[$]==="$"&&t[$-1]==="$"&&t[$-2]==="$"){let N=t.slice($+1),V="";if(g===0&&x.some(D=>{if(N.startsWith(D))return V=D,!0})&&(t[b(t,$+V.length)]==="{"||!t[$+V.length+1].trim().length))f+=`${t.slice(n,$-2)}${l?String(g).padStart(String(a).length-String(g).length+V.length+1):g}`,n=$+1+(V?V.length:0);else{let D="";if(x.some(C=>{if(t.startsWith(C,$+1))return D=C,!0}),!t[$-3].trim().length||H.some(C=>t.slice(n,$-2).trim().endsWith(C))){let C=0;g===0&&x.some(I=>(`${t.slice(n,$-2)}`.startsWith(I)&&(C=I.length),!0)),f+=`${t.slice(n+C,$-2)}${l?String(g).padStart(String(a).length+(g===0&&D?D.length:0)):g}`}else!t[$+1].trim().length||t[b(t,$)]==="{"?f+=`${t.slice(n,$-2)}${l?String(g).padEnd(String(a).length+(g===0&&D?+D.length:0)):g}`:(f+=`${t.slice(n,$-2)}${g}`,l&&(y=String(a).length-String(g).length));n=$+1}}if(t[$]==="{"&&l&&y&&(f+=`${t.slice(n,$)}${" ".repeat(y)}`,n=$,y=0),!t[$+1]){let N="",V=t.slice(n);g===0&&x.some(D=>{if(V.startsWith(D))return N=D,!0})?f+=`${t.slice(n+N.length)}`:f+=`${t.slice(n)}`,f+=`${g!==a?` | ||
`:""}`}}s.count+=1,typeof u=="function"&&(o=Math.floor(c+g/(a-i)*p),o!==r&&(r=o,u(o)))}return f}function k(e,u){return/\.\w/g.test(e)&&(u.count+=1),e}function j(e,u,c,d,s=!0,l,o){return M(e.split(/\r?\n/).map((r,i,a)=>r.includes("$$$")?G(r,u,c+(d-c)/a.length*i,c+(d-c)/a.length*(i+1),l,o):k(r,l)),s).join(` | ||
`)}`)}return[u,c,d]}function M(e,u=!0){if(!u)return e;let c=Array.from(e);if(c.length&&P(c[0])&&!c[0].trim().length)do c.shift();while(P(c[0])&&!c[0].trim().length);if(c.length&&P(c[c.length-1])&&!c[c.length-1].trim().length)do c.pop();while(c[c.length-1]&&!c[c.length-1].trim().length);return c}function j(e,u=0,c=500){let d=u,s=c,l=e,o;if(e.lastIndexOf("}")>0&&e.slice(e.lastIndexOf("}")+1).includes("|")?o=e.slice(e.lastIndexOf("}")+1).split("|").filter(r=>r.trim().length).map(r=>r.trim()).filter(r=>String(r).split("").every(i=>/\d/g.test(i))):e.includes("|")&&(o=e.split("|").filter(r=>r.trim().length).map(r=>r.trim()).filter(r=>String(r).split("").every(i=>/\d/g.test(i)))),Array.isArray(o)&&(o.length===1?s=Number.parseInt(o[0],10):o.length>1&&(d=Number.parseInt(o[0],10),s=Number.parseInt(o[1],10))),e.lastIndexOf("}")>0&&e.slice(e.lastIndexOf("}")+1).includes("|")){if(l=e.slice(0,e.indexOf("|",e.lastIndexOf("}")+1)).trimEnd(),l.trim().startsWith("|"))for(;l.trim().startsWith("|");)l=l.trim().slice(1)}else{let r=null,i=!1,a=0,t=e.length,p=null;for(let f=0,g=e.length;f<g;f++)if("0123456789".includes(e[f])?p===null&&e[f].trim().length&&(p=!0):e[f]!=="|"&&e[f].trim().length&&(p=!1),!e[f+1]&&p&&r&&(t=r),e[f]==="|"){if(p&&r){t=r;break}r=f,p=null}else!i&&e[f].trim().length&&(i=!0,r!==null&&(a=r+1));l=e.slice(a,t).trimEnd()}return[d,s,l]}function G(e,u,c,d,s,l){let o,r=0,[i,a,t]=j(e,0,500),p=d-c,f="";for(let g=i;g<=a;g++){let y=0,n=0;for(let $=0,v=t.length;$<v;$++){let _=t[$].charCodeAt(0);if(t[$]==="$"&&t[$-1]==="$"&&t[$-2]==="$"){let N=t.slice($+1),V="";if(g===0&&w.some(D=>{if(N.startsWith(D))return V=D,!0})&&(t[b(t,$+V.length)]==="{"||!t[$+V.length+1].trim().length))f+=`${t.slice(n,$-2)}${l?String(g).padStart(String(a).length-String(g).length+V.length+1):g}`,n=$+1+(V?V.length:0);else{let D="";if(w.some(C=>{if(t.startsWith(C,$+1))return D=C,!0}),!t[$-3].trim().length||H.some(C=>t.slice(n,$-2).trim().endsWith(C))){let C=0;g===0&&w.some(I=>(`${t.slice(n,$-2)}`.startsWith(I)&&(C=I.length),!0)),f+=`${t.slice(n+C,$-2)}${l?String(g).padStart(String(a).length+(g===0&&D?D.length:0)):g}`}else!t[$+1].trim().length||t[b(t,$)]==="{"?f+=`${t.slice(n,$-2)}${l?String(g).padEnd(String(a).length+(g===0&&D?+D.length:0)):g}`:(f+=`${t.slice(n,$-2)}${g}`,l&&(y=String(a).length-String(g).length));n=$+1}}if(t[$]==="{"&&l&&y&&(f+=`${t.slice(n,$)}${" ".repeat(y)}`,n=$,y=0),!t[$+1]){let N="",V=t.slice(n);g===0&&w.some(D=>{if(V.startsWith(D))return N=D,!0})?f+=`${t.slice(n+N.length)}`:f+=`${t.slice(n)}`,f+=`${g!==a?` | ||
`:""}`}}s.count+=1,typeof u=="function"&&(o=Math.floor(c+g/(a-i)*p),o!==r&&(r=o,u(o)))}return f}function k(e,u){return/\.\w/g.test(e)&&(u.count+=1),e}function B(e,u,c,d,s=!0,l,o){return M(e.split(/\r?\n/).map((r,i,a)=>r.includes("$$$")?G(r,u,c+(d-c)/a.length*i,c+(d-c)/a.length*(i+1),l,o):k(r,l)),s).join(` | ||
`)}var ee=J,U={includeConfig:!0,includeHeadsAndTails:!0,pad:!0,configOverride:null,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100};function ne(e,u){function c(n,$={}){return!$.includeConfig&&!$.includeHeadsAndTails?n:n.trim()}if(typeof e!="string")throw new Error(`generate-atomic-css: [THROW_ID_01] First input argument must be a string! It was given as "${JSON.stringify(e,null,4)}" (type ${typeof e})`);let{CONFIGHEAD:d,CONFIGTAIL:s,CONTENTHEAD:l,CONTENTTAIL:o}=F,r={count:0},i={...U,...u};if(i.includeConfig&&!i.includeHeadsAndTails&&(i.includeHeadsAndTails=!0),!i.configOverride&&!e.includes("$$$")&&!e.includes(d)&&!e.includes(s)&&!e.includes(l)&&!e.includes(o)||i?.configOverride&&typeof i.configOverride=="string"&&!i.configOverride.includes("$$$")&&!i.configOverride.includes(d)&&!i.configOverride.includes(s)&&!i.configOverride.includes(l)&&!i.configOverride.includes(o))return{log:{count:0},result:e};let a="",t="",[p,f,g]=W(i.configOverride?i.configOverride:e);if(typeof p!="string"||!p.trim())return{log:{count:0},result:""};if((i.includeConfig||i.includeHeadsAndTails)&&(a=`${l} */ | ||
@@ -29,3 +29,3 @@ `,i.includeConfig||(a=`/* ${a}`),t=` | ||
${s} | ||
${a}`),e.includes(d)&&S(e,e.indexOf(d))!=null){let n=e.indexOf(d);e[S(e,n)]==="*"&&e[S(e,S(e,n))]==="/"&&(n=S(e,S(e,n)));let $="/* ";(e[m(e,n-1)]==="/"&&e[m(e,m(e,n-1))]==="*"||a.trim().startsWith("/*"))&&($=""),a=`${e.slice(0,n)}${$}${a}`}if(e.includes(s)&&m(e,e.indexOf(s)+s.length)){let n=e.indexOf(s)+s.length;e[m(e,e.indexOf(s)+s.length)]==="*"&&e[m(e,m(e,e.indexOf(s)+s.length))]==="/"&&(n=m(e,m(e,e.indexOf(s)+s.length))+1),e.slice(m(e,n-1)).startsWith(l)&&(n=m(e,n)||0+l.length,e[m(e,n-1)]==="*"&&e[m(e,m(e,n-1))]==="/"&&(n=m(e,m(e,n-1))+1),e.includes(o)&&(n=e.indexOf(o)+o.length,e[m(e,n)]==="*"&&e[m(e,m(e,n))]==="/"&&(n=m(e,m(e,n))+1)));let $=e.slice(n);$.length&&$.includes(o)&&(n=e.indexOf(o)+o.length,e[m(e,n)]==="*"&&e[m(e,m(e,n))]==="/"&&(n=m(e,m(e,n))+1)),t=`${t}${e[n]&&m(e,n-1)?e.slice(n):""}`}if(typeof f=="string"&&(a=`${f}${a}`),typeof g=="string"){if(g.trim().endsWith("/*")&&!g.trim().startsWith("*/")){let n="";typeof g=="string"&&g[0]&&!g[0].trim()&&(n=g.slice(0,m(g,0)||0)),g=`${n}/* ${g.trim()}`}t=`${t}${g}`}let y=`${c(`${a}${j(p,i.reportProgressFunc,i.reportProgressFuncFrom,i.reportProgressFuncTo,!0,r,i.pad)}${t}`,i)} | ||
`;return{log:{count:r.count},result:y}}export{U as defaults,B as extractFromToSource,ne as genAtomic,F as headsAndTails,ee as version}; | ||
${a}`),e.includes(d)&&S(e,e.indexOf(d))!=null){let n=e.indexOf(d);e[S(e,n)]==="*"&&e[S(e,S(e,n))]==="/"&&(n=S(e,S(e,n)));let $="/* ";(e[m(e,n-1)]==="/"&&e[m(e,m(e,n-1))]==="*"||a.trim().startsWith("/*"))&&($=""),a=`${e.slice(0,n)}${$}${a}`}if(e.includes(s)&&m(e,e.indexOf(s)+s.length)){let n=e.indexOf(s)+s.length;e[m(e,e.indexOf(s)+s.length)]==="*"&&e[m(e,m(e,e.indexOf(s)+s.length))]==="/"&&(n=m(e,m(e,e.indexOf(s)+s.length))+1),e.slice(m(e,n-1)).startsWith(l)&&(n=m(e,n)||0+l.length,e[m(e,n-1)]==="*"&&e[m(e,m(e,n-1))]==="/"&&(n=m(e,m(e,n-1))+1),e.includes(o)&&(n=e.indexOf(o)+o.length,e[m(e,n)]==="*"&&e[m(e,m(e,n))]==="/"&&(n=m(e,m(e,n))+1)));let $=e.slice(n);$.length&&$.includes(o)&&(n=e.indexOf(o)+o.length,e[m(e,n)]==="*"&&e[m(e,m(e,n))]==="/"&&(n=m(e,m(e,n))+1)),t=`${t}${e[n]&&m(e,n-1)?e.slice(n):""}`}if(typeof f=="string"&&(a=`${f}${a}`),typeof g=="string"){if(g.trim().endsWith("/*")&&!g.trim().startsWith("*/")){let n="";typeof g=="string"&&g[0]&&!g[0].trim()&&(n=g.slice(0,m(g,0)||0)),g=`${n}/* ${g.trim()}`}t=`${t}${g}`}let y=`${c(`${a}${B(p,i.reportProgressFunc,i.reportProgressFuncFrom,i.reportProgressFuncTo,!0,r,i.pad)}${t}`,i)} | ||
`;return{log:{count:r.count},result:y}}export{U as defaults,j as extractFromToSource,ne as genAtomic,F as headsAndTails,ee as version}; |
/** | ||
* @name generate-atomic-css | ||
* @fileoverview Generate Atomic CSS | ||
* @version 2.2.4 | ||
* @version 2.2.5 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -16,3 +16,3 @@ * @license MIT | ||
\r`.includes(e[t-2])||r&&e[t-2]===L))return t-2;for(let o=t;o--;)if(e[o]&&(e[o].trim()||n&&` | ||
\r`.includes(e[o])||r&&e[o]===L))return o;return null}function y(e,t=0){return Er({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Et(e,t,n,r,o){if(typeof t!="string"||!t.length||(typeof n!="number"&&(n=0),e==="right"&&!t[n+1]||e==="left"&&!t[~-n]))return null;let i=n,l=[],s,c,g,u=0;for(;u<o.length;){if(!pr(o[u])||!o[u].length){u+=1;continue}let{value:p,optional:d,hungry:$}=hr(o[u]),b=e==="right"?f(t,i):y(t,i);if(r.i&&t[b].toLowerCase()===p.toLowerCase()||!r.i&&t[b]===p){let a=e==="right"?f(t,b):y(t,b);$&&(r.i&&t[a].toLowerCase()===p.toLowerCase()||!r.i&&t[a]===p)?g=!0:u+=1,typeof b=="number"&&e==="right"&&b>i+1?l.push([i+1,b]):e==="left"&&typeof b=="number"&&b<~-i&&l.unshift([b+1,i]),i=b,e==="right"?(s===void 0&&(s=b),c=b):(c===void 0&&(c=b),s=b)}else if(d){u+=1;continue}else if(g){u+=1,g=void 0;continue}else return null}return s===void 0||c===void 0?null:{gaps:l,leftmostChar:s,rightmostChar:c}}var z={i:!1};function M(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let r;return(0,he.default)(n[0])?r=S(S({},z),n.shift()):r=z,Et("left",e,t,r,Array.from(n).reverse())}function pe(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let r;return(0,he.default)(n[0])?r=S(S({},z),n.shift()):r=z,Et("right",e,t,r,n)}var Ot="2.2.4";function te(e){return typeof e=="string"}var ne={CONFIGHEAD:"GENERATE-ATOMIC-CSS-CONFIG-STARTS",CONFIGTAIL:"GENERATE-ATOMIC-CSS-CONFIG-ENDS",CONTENTHEAD:"GENERATE-ATOMIC-CSS-CONTENT-STARTS",CONTENTTAIL:"GENERATE-ATOMIC-CSS-CONTENT-ENDS"},ee=["px","em","%","rem","cm","mm","in","pt","pc","ex","ch","vw","vmin","vmax"],{CONFIGHEAD:V,CONFIGTAIL:R,CONTENTHEAD:E,CONTENTTAIL:O}=ne,wr=[":"];function wt(e){let t=e,n="",r="";if(e.includes(V)&&e.includes(R)){if(e.indexOf(R)!==-1&&e.indexOf(E)!==-1&&e.indexOf(R)>e.indexOf(E))throw new Error("generate-atomic-css: [THROW_ID_02] Config heads are after config tails!");let o=e.indexOf(V)+V.length,i=e.indexOf(R);if(e[f(e,o)]==="*"&&e[f(e,f(e,o))]==="/"&&(o=f(e,f(e,o))+1),e[y(e,i)]==="*"&&e[y(e,y(e,i))]==="/"&&(i=y(e,y(e,i))),t=e.slice(o,i).trim(),!te(t)||!t.trim().length)return[t,n,r]}else if(e.includes(V)&&!e.includes(R)&&e.includes(E)){if(e.indexOf(V)>e.indexOf(E))throw new Error("generate-atomic-css: [THROW_ID_03] Config heads are after content heads!");t=e.slice(e.indexOf(V)+V.length,e.indexOf(E))}else if(!e.includes(V)&&!e.includes(R)&&(e.includes(E)||e.includes(O))){if(t=e,t.includes(E)){if(y(e,t.indexOf(E))){let l=t.indexOf(E);M(e,l,"/","*")&&(l=M(e,l,"/","*").leftmostChar),n=l===0?"":e.slice(0,l)}let o=t.indexOf(E)+E.length;pe(t,o-1,"*","/")&&(o=pe(t,o-1,"*","/").rightmostChar+1);let i=null;if(e.includes(O)){i=e.indexOf(O),e[y(e,i)]==="*"&&e[y(e,y(e,i))]==="/"&&(i=y(e,y(e,i)));let l=e.indexOf(O)+O.length;e[f(e,l-1)]==="*"&&e[f(e,f(e,l-1))]==="/"&&(l=f(e,f(e,l-1))+1),f(e,l)&&(r=e.slice(l))}i?t=t.slice(o,i).trim():t=t.slice(o).trim()}else if(t.includes(O)){let o=[],i=!1;t=t.split(` | ||
\r`.includes(e[o])||r&&e[o]===L))return o;return null}function y(e,t=0){return Er({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Et(e,t,n,r,o){if(typeof t!="string"||!t.length||(typeof n!="number"&&(n=0),e==="right"&&!t[n+1]||e==="left"&&!t[~-n]))return null;let i=n,l=[],s,c,g,u=0;for(;u<o.length;){if(!pr(o[u])||!o[u].length){u+=1;continue}let{value:p,optional:d,hungry:$}=hr(o[u]),b=e==="right"?f(t,i):y(t,i);if(r.i&&t[b].toLowerCase()===p.toLowerCase()||!r.i&&t[b]===p){let a=e==="right"?f(t,b):y(t,b);$&&(r.i&&t[a].toLowerCase()===p.toLowerCase()||!r.i&&t[a]===p)?g=!0:u+=1,typeof b=="number"&&e==="right"&&b>i+1?l.push([i+1,b]):e==="left"&&typeof b=="number"&&b<~-i&&l.unshift([b+1,i]),i=b,e==="right"?(s===void 0&&(s=b),c=b):(c===void 0&&(c=b),s=b)}else if(d){u+=1;continue}else if(g){u+=1,g=void 0;continue}else return null}return s===void 0||c===void 0?null:{gaps:l,leftmostChar:s,rightmostChar:c}}var z={i:!1};function M(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/leftSeq(): only two input arguments were passed! Did you intend to use left() method instead?");let r;return(0,he.default)(n[0])?r=S(S({},z),n.shift()):r=z,Et("left",e,t,r,Array.from(n).reverse())}function pe(e,t,...n){if(!(n!=null&&n.length))throw new Error("string-left-right/rightSeq(): only two input arguments were passed! Did you intend to use right() method instead?");let r;return(0,he.default)(n[0])?r=S(S({},z),n.shift()):r=z,Et("right",e,t,r,n)}var Ot="2.2.5";function te(e){return typeof e=="string"}var ne={CONFIGHEAD:"GENERATE-ATOMIC-CSS-CONFIG-STARTS",CONFIGTAIL:"GENERATE-ATOMIC-CSS-CONFIG-ENDS",CONTENTHEAD:"GENERATE-ATOMIC-CSS-CONTENT-STARTS",CONTENTTAIL:"GENERATE-ATOMIC-CSS-CONTENT-ENDS"},ee=["px","em","%","rem","cm","mm","in","pt","pc","ex","ch","vw","vmin","vmax"],{CONFIGHEAD:V,CONFIGTAIL:R,CONTENTHEAD:E,CONTENTTAIL:O}=ne,wr=[":"];function wt(e){let t=e,n="",r="";if(e.includes(V)&&e.includes(R)){if(e.indexOf(R)!==-1&&e.indexOf(E)!==-1&&e.indexOf(R)>e.indexOf(E))throw new Error("generate-atomic-css: [THROW_ID_02] Config heads are after config tails!");let o=e.indexOf(V)+V.length,i=e.indexOf(R);if(e[f(e,o)]==="*"&&e[f(e,f(e,o))]==="/"&&(o=f(e,f(e,o))+1),e[y(e,i)]==="*"&&e[y(e,y(e,i))]==="/"&&(i=y(e,y(e,i))),t=e.slice(o,i).trim(),!te(t)||!t.trim().length)return[t,n,r]}else if(e.includes(V)&&!e.includes(R)&&e.includes(E)){if(e.indexOf(V)>e.indexOf(E))throw new Error("generate-atomic-css: [THROW_ID_03] Config heads are after content heads!");t=e.slice(e.indexOf(V)+V.length,e.indexOf(E))}else if(!e.includes(V)&&!e.includes(R)&&(e.includes(E)||e.includes(O))){if(t=e,t.includes(E)){if(y(e,t.indexOf(E))){let l=t.indexOf(E);M(e,l,"/","*")&&(l=M(e,l,"/","*").leftmostChar),n=l===0?"":e.slice(0,l)}let o=t.indexOf(E)+E.length;pe(t,o-1,"*","/")&&(o=pe(t,o-1,"*","/").rightmostChar+1);let i=null;if(e.includes(O)){i=e.indexOf(O),e[y(e,i)]==="*"&&e[y(e,y(e,i))]==="/"&&(i=y(e,y(e,i)));let l=e.indexOf(O)+O.length;e[f(e,l-1)]==="*"&&e[f(e,f(e,l-1))]==="/"&&(l=f(e,f(e,l-1))+1),f(e,l)&&(r=e.slice(l))}i?t=t.slice(o,i).trim():t=t.slice(o).trim()}else if(t.includes(O)){let o=[],i=!1;t=t.split(` | ||
`).filter(c=>!c.includes("$$$")&&!i?(i||o.push(c),!1):(i||(i=!0),!0)).join(` | ||
@@ -39,3 +39,3 @@ `);let l=t.indexOf(O);M(t,l,"/","*")&&(l=M(t,l,"/","*").leftmostChar),t=t.slice(0,l).trim(),o.length&&(n=`${o.join(` | ||
* @fileoverview Looks up the first non-whitespace character to the left/right of a given index | ||
* @version 5.1.4 | ||
* @version 5.1.5 | ||
* @author Roy Revelt, Codsen Ltd | ||
@@ -42,0 +42,0 @@ * @license MIT |
{ | ||
"name": "generate-atomic-css", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"description": "Generate Atomic CSS", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
"letspublish": "yarn publish || :", | ||
"lint": "eslint . --fix", | ||
"lint": "eslint . --ext .js --ext .ts --fix", | ||
"perf": "node perf/check.js", | ||
@@ -72,4 +72,4 @@ "prepare": "echo 'ready'", | ||
"dependencies": { | ||
"string-left-right": "^5.1.4" | ||
"string-left-right": "^5.1.5" | ||
} | ||
} |
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
41914
8
248
Updatedstring-left-right@^5.1.5