UNPKG

amotify

Version:

UI Component for React,NextJS,esbuild

2 lines (1 loc) 12.6 kB
import{b as a,c as Ne,d as ke}from"../chunk-C5N2D3ZX.js";import d from"jmini";import{Config as Fe}from".";const e={toConcreteBorderRadius:n=>{let H=Fe.get().roundness|0;return n=="1.tone.primary"?n=[0,2,3,4,5,5][H]:n=="2.tone.secondary"?n=[0,1,2,3,4,5][H]:n=="3.tone.tertiary"&&(n=[0,"1/3","2/3",1,2,3][H]),n},ev:n=>d.is.exist(n),ClassNames:(n,H)=>{var O,Re,Ce,F,Be,Te,_e,Le,we,We;let i=[],{gap:l,display:y,position:R,overflow:P,fontColor:G,fontSize:D,fontWeight:g,fontHeight:j,backgroundColor:q,textAlign:z,textDecoration:M,boxShadow:C,margin:h,marginTop:s,marginRight:r,marginBottom:c,marginLeft:b,padding:o,paddingTop:S,paddingRight:B,paddingBottom:T,paddingLeft:_,top:X,right:J,bottom:Q,left:Y,border:N,borderTop:f,borderRight:u,borderBottom:v,borderLeft:m,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:k,borderTopLeftRadius:L,borderTopRightRadius:w,borderBottomLeftRadius:W,borderBottomRightRadius:A,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce}=H;{if(e.ev(y)&&i.push("dsp"+y),P){let x=d.flatArray(P);i.push("ovfl-x-"+x[0]),i.push("ovfl-y-"+(x[1]||x[0]))}e.ev(R)&&i.push("ps"+R),e.ev(z)&&i.push("txtalg"+z),e.ev(z)&&i.push("txtdeco"+M),e.ev(G)&&i.push("ftcl"+((O=String(G))==null?void 0:O.replace(/\./g,"_"))),e.ev(D)&&i.push("ftsz"+((Re=String(D))==null?void 0:Re.replace(/\..*/,""))),e.ev(g)&&i.push("ftwgt"+((Ce=String(g))==null?void 0:Ce.replace(/\..*/,""))),e.ev(j)&&i.push("fthgt"+((F=String(j))==null?void 0:F.replace(/\./g,"_"))),e.ev(q)&&i.push("bgc"+((Be=String(q))==null?void 0:Be.replace(/\./g,"_"))),e.ev(C)&&i.push("bs"+C);let $,U,V,I;d.is.exist(h)&&(d.is.array(h)?h.length==2?[$,U,V,I]=[...h,...h]:h.length==4&&([$,U,V,I]=h):$=U=V=I=h,s=s!=null?s:$,r=r!=null?r:U,c=c!=null?c:V,b=b!=null?b:I),e.ev(s)&&i.push("mrgt"+s),e.ev(r)&&i.push("mrgr"+r),e.ev(c)&&i.push("mrgb"+c),e.ev(b)&&i.push("mrgl"+b);let K,t,Ae,ye;d.is.exist(o)&&(d.is.array(o)?o.length==2?[K,t,Ae,ye]=[...o,...o]:o.length==4&&([K,t,Ae,ye]=o):K=t=Ae=ye=o,S=S!=null?S:K,B=B!=null?B:t,T=T!=null?T:Ae,_=_!=null?_:ye),e.ev(S)&&i.push("pdt"+S),e.ev(B)&&i.push("pdr"+B),e.ev(T)&&i.push("pdb"+T),e.ev(_)&&i.push("pdl"+_),e.ev(X)&&i.push("pstt"+X),e.ev(J)&&i.push("pstr"+J),e.ev(Q)&&i.push("pstb"+Q),e.ev(Y)&&i.push("pstl"+Y);{d.is.exist(N)&&(f=f!=null?f:N,u=u!=null?u:N,v=v!=null?v:N,m=m!=null?m:N),d.is.boolean(f)&&(f=["unset","2.normal"][Number(f)]),d.is.boolean(u)&&(u=["unset","2.normal"][Number(u)]),d.is.boolean(v)&&(v=["unset","2.normal"][Number(v)]),d.is.boolean(m)&&(m=["unset","2.normal"][Number(m)]),e.ev(f)&&i.push("b_t_ss"+((Te=String(f))==null?void 0:Te.replace(/\./g,"_"))),e.ev(u)&&i.push("b_r_ss"+((_e=String(u))==null?void 0:_e.replace(/\./g,"_"))),e.ev(v)&&i.push("b_b_ss"+((Le=String(v))==null?void 0:Le.replace(/\./g,"_"))),e.ev(m)&&i.push("b_l_ss"+((we=String(m))==null?void 0:we.replace(/\./g,"_"))),d.is.exist(Z)&&i.push("b_wth"+String(Z)),d.is.exist(ee)&&i.push("b_cl"+((We=String(ee))==null?void 0:We.replace(/\./g,"_"))),d.is.exist(te)&&i.push("b_st"+String(te));{let x,p,E,He;d.is.exist(k)&&(d.is.array(k)?k.length==4&&([x,p,He,E]=k):x=p=E=He=k,L=L!=null?L:x,w=w!=null?w:p,W=W!=null?W:E,A=A!=null?A:He)}e.ev(L)&&i.push("br_tl"+e.toConcreteBorderRadius(L)),e.ev(w)&&i.push("br_tr"+e.toConcreteBorderRadius(w)),e.ev(W)&&i.push("br_bl"+e.toConcreteBorderRadius(W)),e.ev(A)&&i.push("br_br"+e.toConcreteBorderRadius(A))}if(e.ev(ce)&&i.push("op"+ce),d.is.exist(l)){let x,p;d.is.array(l)?(x=l[0],p=l[1]):x=p=l,i.push("gapRow"+x,"gapCol"+p)}e.ev(ie)&&i.push("flsz"+ie),e.ev(re)&&i.push("flwrp"+re),e.ev(oe)&&i.push("fltyp"+oe),e.ev(se)&&i.push("flchld"+se),e.ev(ae)&&i.push("flgrid"+ae),e.ev(ne)&&i.push("flvrt"+ne),e.ev(de)&&i.push("flhrz"+de),e.ev(ge)&&i.push("grcnt"+ge),e.ev(pe)&&i.push("grcol"+pe),e.ev(be)&&i.push("hgt"+be),e.ev(me)&&i.push("wdt"+me),e.ev(Se)&&i.push("unthgt"+Se),e.ev(xe)&&i.push("untwdt"+xe),e.ev(le)&&i.push("trnst"+le),e.ev(he)&&i.push("maxh"+he),e.ev(fe)&&i.push("minh"+fe),e.ev(ue)&&i.push("maxw"+ue),e.ev(ve)&&i.push("minw"+ve)}return i.length?n+i.join(" "+n):""}},Ge=n=>{let c=a({},n),{gradients:i,ssCardBox:l,ssSphere:y,ssSquare:R,ssPushable:P,ssAbsoluteCovered:G,ssTextEllipsis:D,flexCenter:g,flexNewLine:j,isLightFont:q,isBoldFont:z,isSemiBoldFont:M,isRounded:C,isSquare:h,freeCSS:b={}}=c,s=ke(b,[]),r=ke(c,["gradients","ssCardBox","ssSphere","ssSquare","ssPushable","ssAbsoluteCovered","ssTextEllipsis","flexCenter","flexNewLine","isLightFont","isBoldFont","isSemiBoldFont","isRounded","isSquare","freeCSS"]);if(s=s||{},r=r||{},i){let{deg:o,colors:S}=i;s=Ne(a({},s),{background:`linear-gradient(${o}deg,${S.join(",")})`})}if(l){l===!0&&(l="border");let o={backgroundColor:"layer.1",borderRadius:"1.tone.primary",boxShadow:"0.min"};l=="border"?o.border=!0:l=="plain"?(o.backgroundColor="layer.1",o.boxShadow="none"):l=="cloud"?o.backgroundColor="cloud":l=="shadow"&&(o.boxShadow="0.normal"),Fe.get().darkMode=="dim"&&(o.boxShadow="1.normal"),Fe.get().darkMode=="dark"&&(o.boxShadow="1.remark"),s=a(a({},o.freeCSS),s),r=a(a({},o),r)}return y&&(g=g!=null?g:!0,r=a({padding:0,unitWidth:y,unitHeight:y,borderRadius:"sphere",flexSizing:"none"},r)),R&&(g=g!=null?g:!0,r=a({padding:0,unitWidth:R,unitHeight:R,flexSizing:"none"},r)),P&&(r=a({transition:"middle"},r),r=Ne(a({},r),{className:[r.className,"ssPushable"].join(" ")})),G&&(r=a({position:"absolute",top:0,left:0,right:0,bottom:0},r)),D&&(r=a({overflow:"hidden"},r),s=a({whiteSpace:"nowrap",textOverflow:"ellipsis"},s)),j&&(r=a({width:1,flexSizing:"none"},r)),g&&(r=a({display:"flex",horizontalAlign:"center",verticalAlign:"center"},r)),q&&(r.fontWeight="1.light"),M&&(r.fontWeight="3.semiBold"),z&&(r.fontWeight="4.bold"),C&&(r.borderRadius="sphere",d.is.number(C)&&(s.borderRadius=C*12)),h&&(s.aspectRatio="1"),Ne(a({},r),{freeCSS:s})},$e=n=>{let He=Ge(n),{componentID:i,gap:l,display:y,position:R,overflow:P,fontColor:G,fontSize:D,fontWeight:g,fontHeight:j,backgroundColor:q,textAlign:z,textDecoration:M,boxShadow:C,margin:h,marginTop:s,marginRight:r,marginBottom:c,marginLeft:b,padding:o,paddingTop:S,paddingRight:B,paddingBottom:T,paddingLeft:_,top:X,right:J,bottom:Q,left:Y,border:N,borderTop:f,borderRight:u,borderBottom:v,borderLeft:m,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:k,borderTopLeftRadius:L,borderTopRightRadius:w,borderBottomLeftRadius:W,borderBottomRightRadius:A,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce,ssLastChildLossBorder:O,ssAbsoluteCovered:Re,ssCardBox:Ce,ssEffectsOnActive:F,ssPushable:Be,ssSphere:Te,ssSquare:_e,ssTextEllipsis:Le,isBoldFont:we,isLightFont:We,isSemiBoldFont:$,isRounded:U,flexCenter:V,flexNewLine:I,gradients:K,UnderBreakPointStyles:t={},className:Ae="",freeCSS:ye={}}=He,x=ke(He,["componentID","gap","display","position","overflow","fontColor","fontSize","fontWeight","fontHeight","backgroundColor","textAlign","textDecoration","boxShadow","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","top","right","bottom","left","border","borderTop","borderRight","borderBottom","borderLeft","borderWidth","borderColor","borderStyle","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","flexSizing","flexWrap","flexType","flexChilds","flexGrid","horizontalAlign","verticalAlign","transition","gridCenter","gridCols","maxHeight","minHeight","maxWidth","minWidth","width","height","unitHeight","unitWidth","opacity","ssLastChildLossBorder","ssAbsoluteCovered","ssCardBox","ssEffectsOnActive","ssPushable","ssSphere","ssSquare","ssTextEllipsis","isBoldFont","isLightFont","isSemiBoldFont","isRounded","flexCenter","flexNewLine","gradients","UnderBreakPointStyles","className","freeCSS"]),p=a({},x),E=[Ae];if(O&&E.push("ssLastChildLossBorder_"+O),F){F=d.flatArray(F);for(let ze of F){let[Pe,Ee]=ze.split(".");p["data-effect-"+Pe]="1",Ee&&(p["data-effect-tone"]=Ee)}}{let ze=e.ClassNames("amotf_",{gap:l,display:y,position:R,overflow:P,fontColor:G,fontSize:D,fontWeight:g,fontHeight:j,backgroundColor:q,textAlign:z,textDecoration:M,boxShadow:C,margin:h,marginTop:s,marginRight:r,marginBottom:c,marginLeft:b,padding:o,paddingTop:S,paddingRight:B,paddingBottom:T,paddingLeft:_,top:X,right:J,bottom:Q,left:Y,border:N,borderTop:f,borderRight:u,borderBottom:v,borderLeft:m,borderWidth:Z,borderColor:ee,borderStyle:te,borderRadius:k,borderTopLeftRadius:L,borderTopRightRadius:w,borderBottomLeftRadius:W,borderBottomRightRadius:A,flexSizing:ie,flexWrap:re,flexType:oe,flexChilds:se,flexGrid:ae,horizontalAlign:de,verticalAlign:ne,transition:le,gridCenter:ge,gridCols:pe,maxHeight:he,minHeight:fe,maxWidth:ue,minWidth:ve,width:me,height:be,unitHeight:Se,unitWidth:xe,opacity:ce});E.push(ze)}return t&&E.push(e.ClassNames("amotf_bp",t)),ye&&(p.style=a(a({},ye),p.style)),(i||p["data-component-id"])&&(p["data-component-id"]=p["data-component-id"]||i),E.length&&E.join("")&&(p.className=E.join(" ").trim().replace(/%/ig,"P").replace(/\d+px/ig,"PIX").replace(/\s+/ig," ").replace(/\//ig,"_").replace(/\./ig,"-")),p},Ue=n=>{let{gap:H,display:i,position:l,overflow:y,fontColor:R,fontSize:P,fontWeight:G,fontHeight:D,backgroundColor:g,textAlign:j,textDecoration:q,boxShadow:z,margin:M,marginTop:C,marginRight:h,marginBottom:s,marginLeft:r,padding:c,paddingTop:b,paddingRight:o,paddingBottom:S,paddingLeft:B,top:T,right:_,bottom:X,left:J,border:Q,borderTop:Y,borderRight:N,borderBottom:f,borderLeft:u,borderWidth:v,borderColor:m,borderStyle:Z,borderRadius:ee,borderTopLeftRadius:te,borderTopRightRadius:k,borderBottomLeftRadius:L,borderBottomRightRadius:w,flexSizing:W,flexWrap:A,flexType:ie,flexChilds:re,flexGrid:oe,horizontalAlign:se,verticalAlign:ae,transition:de,gridCenter:ne,gridCols:le,maxHeight:ge,minHeight:pe,maxWidth:he,minWidth:fe,width:ue,height:ve,unitHeight:me,unitWidth:be,opacity:Se,ssLastChildLossBorder:xe,ssAbsoluteCovered:ce,ssCardBox:O,ssEffectsOnActive:Re,ssPushable:Ce,ssSphere:F,ssSquare:Be,ssTextEllipsis:Te,isBoldFont:_e,isLightFont:Le,isSemiBoldFont:we,isRounded:We,flexCenter:$,flexNewLine:U,gradients:V,UnderBreakPointStyles:I={},freeCSS:K={}}=n,t={};return e.ev(H)&&(t.gap=H),e.ev(i)&&(t.display=i),e.ev(l)&&(t.position=l),e.ev(y)&&(t.overflow=y),e.ev(R)&&(t.fontColor=R),e.ev(P)&&(t.fontSize=P),e.ev(G)&&(t.fontWeight=G),e.ev(D)&&(t.fontHeight=D),e.ev(g)&&(t.backgroundColor=g),e.ev(j)&&(t.textAlign=j),e.ev(q)&&(t.textDecoration=q),e.ev(z)&&(t.boxShadow=z),e.ev(M)&&(t.margin=M),e.ev(C)&&(t.marginTop=C),e.ev(h)&&(t.marginRight=h),e.ev(s)&&(t.marginBottom=s),e.ev(r)&&(t.marginLeft=r),e.ev(c)&&(t.padding=c),e.ev(b)&&(t.paddingTop=b),e.ev(o)&&(t.paddingRight=o),e.ev(S)&&(t.paddingBottom=S),e.ev(B)&&(t.paddingLeft=B),e.ev(T)&&(t.top=T),e.ev(_)&&(t.right=_),e.ev(X)&&(t.bottom=X),e.ev(J)&&(t.left=J),e.ev(Q)&&(t.border=Q),e.ev(Y)&&(t.borderTop=Y),e.ev(N)&&(t.borderRight=N),e.ev(f)&&(t.borderBottom=f),e.ev(u)&&(t.borderLeft=u),e.ev(v)&&(t.borderWidth=v),e.ev(m)&&(t.borderColor=m),e.ev(Z)&&(t.borderStyle=Z),e.ev(ee)&&(t.borderRadius=ee),e.ev(te)&&(t.borderTopLeftRadius=te),e.ev(k)&&(t.borderTopRightRadius=k),e.ev(L)&&(t.borderBottomLeftRadius=L),e.ev(w)&&(t.borderBottomRightRadius=w),e.ev(W)&&(t.flexSizing=W),e.ev(A)&&(t.flexWrap=A),e.ev(ie)&&(t.flexType=ie),e.ev(re)&&(t.flexChilds=re),e.ev(oe)&&(t.flexGrid=oe),e.ev(se)&&(t.horizontalAlign=se),e.ev(ae)&&(t.verticalAlign=ae),e.ev(de)&&(t.transition=de),e.ev(ne)&&(t.gridCenter=ne),e.ev(le)&&(t.gridCols=le),e.ev(ge)&&(t.maxHeight=ge),e.ev(pe)&&(t.minHeight=pe),e.ev(he)&&(t.maxWidth=he),e.ev(fe)&&(t.minWidth=fe),e.ev(ue)&&(t.width=ue),e.ev(ve)&&(t.height=ve),e.ev(me)&&(t.unitHeight=me),e.ev(be)&&(t.unitWidth=be),e.ev(Se)&&(t.opacity=Se),e.ev(xe)&&(t.ssLastChildLossBorder=xe),e.ev(ce)&&(t.ssAbsoluteCovered=ce),e.ev(O)&&(t.ssCardBox=O),e.ev(Re)&&(t.ssEffectsOnActive=Re),e.ev(Ce)&&(t.ssPushable=Ce),e.ev(F)&&(t.ssSphere=F),e.ev(Be)&&(t.ssSquare=Be),e.ev(Te)&&(t.ssTextEllipsis=Te),e.ev(_e)&&(t.isBoldFont=_e),e.ev(Le)&&(t.isLightFont=Le),e.ev(we)&&(t.isSemiBoldFont=we),e.ev(We)&&(t.isRounded=We),e.ev($)&&(t.flexCenter=$),e.ev(U)&&(t.flexNewLine=U),e.ev(V)&&(t.gradients=V),e.ev(K)&&(t.freeCSS=K),e.ev(I)&&(t.UnderBreakPointStyles=I),t};export{Ue as ExtractStyles,$e as GenerateHTMLProps,Ge as ReadStyleSet};