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