You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
2.1 KiB

import{k as g,e as y,f as l,c as m,b as p}from"./light-0dfdc1ad.js";import{u as v}from"./use-config-816d55a6.js";import{u as b}from"./use-css-vars-class-3ae3b4b3.js";import{f as C}from"./format-length-c9d165c6.js";import{w as $}from"./warn-77f3ea30.js";import{d as _,f as a,a8 as d,aP as z}from"./index-f4658ae7.js";const D=e=>{const{textColorBase:t,opacity1:i,opacity2:s,opacity3:r,opacity4:o,opacity5:n}=e;return{color:t,opacity1Depth:i,opacity2Depth:s,opacity3Depth:r,opacity4Depth:o,opacity5Depth:n}},x={name:"Icon",common:g,self:D},P=x,R=y("icon",`
height: 1em;
width: 1em;
line-height: 1em;
text-align: center;
display: inline-block;
position: relative;
fill: currentColor;
transform: translateZ(0);
`,[l("color-transition",{transition:"color .3s var(--n-bezier)"}),l("depth",{color:"var(--n-color)"},[m("svg",{opacity:"var(--n-opacity)",transition:"opacity .3s var(--n-bezier)"})]),m("svg",{height:"1em",width:"1em"})]),S=Object.assign(Object.assign({},p.props),{depth:[String,Number],size:[Number,String],color:String,component:Object}),B=_({_n_icon__:!0,name:"Icon",inheritAttrs:!1,props:S,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:i}=v(e),s=p("Icon","-icon",R,P,e,t),r=a(()=>{const{depth:n}=e,{common:{cubicBezierEaseInOut:c},self:h}=s.value;if(n!==void 0){const{color:f,[`opacity${n}Depth`]:u}=h;return{"--n-bezier":c,"--n-color":f,"--n-opacity":u}}return{"--n-bezier":c,"--n-color":"","--n-opacity":""}}),o=i?b("icon",a(()=>`${e.depth||"d"}`),r,e):void 0;return{mergedClsPrefix:t,mergedStyle:a(()=>{const{size:n,color:c}=e;return{fontSize:C(n),color:c}}),cssVars:i?void 0:r,themeClass:o==null?void 0:o.themeClass,onRender:o==null?void 0:o.onRender}},render(){var e;const{$parent:t,depth:i,mergedClsPrefix:s,component:r,onRender:o,themeClass:n}=this;return!((e=t==null?void 0:t.$options)===null||e===void 0)&&e._n_icon__&&$("icon","don't wrap `n-icon` inside `n-icon`"),o==null||o(),d("i",z(this.$attrs,{role:"img",class:[`${s}-icon`,n,{[`${s}-icon--depth`]:i,[`${s}-icon--color-transition`]:i!==void 0}],style:[this.cssVars,this.mergedStyle]}),r?d(r):this.$slots)}});export{B as N};