Skip to content

Commit

Permalink
refactor: Small lib refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
DimChtz committed Mar 14, 2024
1 parent 86468ef commit 4c18377
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 63 deletions.
2 changes: 1 addition & 1 deletion dist/index.cjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"use strict";var e={matchAlignValues:/^(_|(!?(center|start|end|between|around)))(\/(_|(!?(center|start|end|between|around))))?$/,matchWrapValues:/^!?(wrap|nowrap)$/,matchDirValues:/^!?-?(row|col)$/,matchGapValues:/^(_|(!?(\d+[a-z]+)))(\/(_|(!?(\d+[a-z]+))))?$/,valuesMapper:{start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",wrap:"wrap",nowrap:"nowrap",row:"row",col:"col","-row":"row-reverse","-col":"column-reverse"},baseStyles:["display: flex;"]};function t(t,a,r,n=!0){const[s,c]=function(e){return e.startsWith("!")?[!0,e.slice(1)]:[!1,e]}(t),l=s?" !important":"",o=n?e.valuesMapper[c]:c;return r.push(`${a}: ${o}${l};`),r}function a(e,a,r,n=!0){return 1==e.length?(r=t(e[0],a[0],r,n),r=t(e[0],a[1],r,n)):("_"!==e[0]&&(r=t(e[0],a[0],r,n)),"_"!==e[1]&&(r=t(e[1],a[1],r,n)),r)}function r(){return{postcssPlugin:"postcss-flexup",Declaration:{flexup:r=>{r.parent.append(function(r){let n=[...e.baseStyles];return r.split(" ").forEach((r=>{"_"==r||(r.match(e.matchAlignValues)?n=a(r.split("/"),["justify-content","align-items"],n,!0):r.match(e.matchWrapValues)?n=t(r,"flex-wrap",n):r.match(e.matchDirValues)?n=t(r,"flex-direction",n):r.match(e.matchGapValues)&&(n=a(r.split("/"),["column-gap","row-gap"],n,!1)))})),"\n"+n.join("\n")}(r.toString())),r.remove()}}}}r.postcss=!0,module.exports=r;
"use strict";var e={matchAlignValues:/^(_|(!?(center|start|end|between|around)))(\/(_|(!?(center|start|end|between|around))))?$/,matchWrapValues:/^!?(wrap|nowrap)$/,matchDirValues:/^!?-?(row|col)$/,matchGapValues:/^(_|(!?(\d+[a-z]+)))(\/(_|(!?(\d+[a-z]+))))?$/,valuesMapper:{start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",wrap:"wrap",nowrap:"nowrap",row:"row",col:"col","-row":"row-reverse","-col":"column-reverse"},baseStyles:["display: flex;"]};const a=(a,t,r,s=!0)=>{const[n,l]=(e=>e.startsWith("!")?[!0,e.slice(1)]:[!1,e])(a),c=n?" !important":"",o=s?e.valuesMapper[l]:l;return r.push(`${t}: ${o}${c};`),r},t=(e,t,r,s=!0)=>1==e.length?(r=a(e[0],t[0],r,s),r=a(e[0],t[1],r,s)):("_"!==e[0]&&(r=a(e[0],t[0],r,s)),"_"!==e[1]&&(r=a(e[1],t[1],r,s)),r);function r(){return{postcssPlugin:"postcss-flexup",Declaration:{flexup:r=>{r.parent.append((r=>{let s=[...e.baseStyles];return r.split(" ").forEach((r=>{"_"==r||(r.match(e.matchAlignValues)?s=t(r.split("/"),["justify-content","align-items"],s,!0):r.match(e.matchWrapValues)?s=a(r,"flex-wrap",s):r.match(e.matchDirValues)?s=a(r,"flex-direction",s):r.match(e.matchGapValues)&&(s=t(r.split("/"),["column-gap","row-gap"],s,!1)))})),"\n"+s.join("\n")})(r.toString())),r.remove()}}}}r.postcss=!0,module.exports=r;
//# sourceMappingURL=index.cjs.map
2 changes: 1 addition & 1 deletion dist/index.cjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.mjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
var e={matchAlignValues:/^(_|(!?(center|start|end|between|around)))(\/(_|(!?(center|start|end|between|around))))?$/,matchWrapValues:/^!?(wrap|nowrap)$/,matchDirValues:/^!?-?(row|col)$/,matchGapValues:/^(_|(!?(\d+[a-z]+)))(\/(_|(!?(\d+[a-z]+))))?$/,valuesMapper:{start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",wrap:"wrap",nowrap:"nowrap",row:"row",col:"col","-row":"row-reverse","-col":"column-reverse"},baseStyles:["display: flex;"]};function t(t,a,r,n=!0){const[s,c]=function(e){return e.startsWith("!")?[!0,e.slice(1)]:[!1,e]}(t),l=s?" !important":"",o=n?e.valuesMapper[c]:c;return r.push(`${a}: ${o}${l};`),r}function a(e,a,r,n=!0){return 1==e.length?(r=t(e[0],a[0],r,n),r=t(e[0],a[1],r,n)):("_"!==e[0]&&(r=t(e[0],a[0],r,n)),"_"!==e[1]&&(r=t(e[1],a[1],r,n)),r)}function r(){return{postcssPlugin:"postcss-flexup",Declaration:{flexup:r=>{r.parent.append(function(r){let n=[...e.baseStyles];return r.split(" ").forEach((r=>{"_"==r||(r.match(e.matchAlignValues)?n=a(r.split("/"),["justify-content","align-items"],n,!0):r.match(e.matchWrapValues)?n=t(r,"flex-wrap",n):r.match(e.matchDirValues)?n=t(r,"flex-direction",n):r.match(e.matchGapValues)&&(n=a(r.split("/"),["column-gap","row-gap"],n,!1)))})),"\n"+n.join("\n")}(r.toString())),r.remove()}}}}r.postcss=!0;export{r as default};
var e={matchAlignValues:/^(_|(!?(center|start|end|between|around)))(\/(_|(!?(center|start|end|between|around))))?$/,matchWrapValues:/^!?(wrap|nowrap)$/,matchDirValues:/^!?-?(row|col)$/,matchGapValues:/^(_|(!?(\d+[a-z]+)))(\/(_|(!?(\d+[a-z]+))))?$/,valuesMapper:{start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",wrap:"wrap",nowrap:"nowrap",row:"row",col:"col","-row":"row-reverse","-col":"column-reverse"},baseStyles:["display: flex;"]};const a=(a,t,r,n=!0)=>{const[s,l]=(e=>e.startsWith("!")?[!0,e.slice(1)]:[!1,e])(a),c=s?" !important":"",o=n?e.valuesMapper[l]:l;return r.push(`${t}: ${o}${c};`),r},t=(e,t,r,n=!0)=>1==e.length?(r=a(e[0],t[0],r,n),r=a(e[0],t[1],r,n)):("_"!==e[0]&&(r=a(e[0],t[0],r,n)),"_"!==e[1]&&(r=a(e[1],t[1],r,n)),r);function r(){return{postcssPlugin:"postcss-flexup",Declaration:{flexup:r=>{r.parent.append((r=>{let n=[...e.baseStyles];return r.split(" ").forEach((r=>{"_"==r||(r.match(e.matchAlignValues)?n=t(r.split("/"),["justify-content","align-items"],n,!0):r.match(e.matchWrapValues)?n=a(r,"flex-wrap",n):r.match(e.matchDirValues)?n=a(r,"flex-direction",n):r.match(e.matchGapValues)&&(n=t(r.split("/"),["column-gap","row-gap"],n,!1)))})),"\n"+n.join("\n")})(r.toString())),r.remove()}}}}r.postcss=!0;export{r as default};
//# sourceMappingURL=index.mjs.map
Loading

0 comments on commit 4c18377

Please sign in to comment.