{"version":3,"file":"icon.mjs","sources":["../../../../../../packages/components/icon/src/icon.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent, computed, h } from 'vue'\nimport { generateId } from '@hongluan-ui/utils'\nimport { useNamespace } from '@hongluan-ui/hooks'\nimport { iconProps } from './icon'\n\nimport type { CSSProperties } from 'vue'\n\nexport default defineComponent({\n  name: 'Icon',\n  props: iconProps,\n  setup(props) {\n    const { namespace } = useNamespace('icon')\n    const iconStyle = computed(() => {\n      const style = {} as CSSProperties\n      if (props.width) {\n        style.width = !Number.isNaN(+props.width) ? props.width + 'px' : props.width\n      }\n      if (props.height) {\n        style.height = !Number.isNaN(+props.height) ? props.height + 'px' : props.height\n      }\n      if (props.color) {\n        style.color = props.color\n      }\n      return style\n    })\n    return {\n      namespace,\n      iconStyle,\n      iconId: 'icon_' + generateId(),\n    }\n  },\n  render() {\n    const {\n      $slots,\n      namespace,\n      iconStyle,\n      iconId,\n      type,\n      size,\n      effect,\n      fill,\n      round,\n      color,\n      radius,\n      opacity,\n      startColor,\n      gradient,\n      transition,\n      border,\n    } = this\n    const handleSlotsChildren = internalSlots => {\n      const children = internalSlots.default?.() || []\n      children.forEach(c => {\n        // STATEFUL_COMPONENT / FUNCTIONAL_COMPONENT\n        if (c.shapeFlag & 4 || c.shapeFlag & 2) {\n          c.props = Object.assign(c.props || {}, {\n            borderWidth: border,\n            opacity,\n            startColor,\n            gradient,\n            iconId,\n            color,\n          })\n        }\n      })\n      return children\n    }\n    return h('i',\n      {\n        class: [\n          namespace,\n          type ? type : '',\n          size,\n          effect,\n          {\n            'fill': fill,\n            'round': round,\n            'radius': radius,\n            'transition': transition,\n          },\n        ],\n        style: iconStyle,\n      },\n      handleSlotsChildren($slots),\n    )\n  },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;MAQK,YAAa,gBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM,OAAO;AACX,UAAM,EAAE,cAAc,aAAa,MAAM;AACzC,UAAM,YAAY,SAAS,MAAM;AAC/B,YAAM,QAAQ;AACd,UAAI,MAAM,OAAO;AACf,cAAM,QAAQ,CAAC,OAAO,MAAM,CAAC,MAAM,KAAK,IAAI,MAAM,QAAQ,OAAO,MAAM;AAAA;AAEzE,UAAI,MAAM,QAAQ;AAChB,cAAM,SAAS,CAAC,OAAO,MAAM,CAAC,MAAM,MAAM,IAAI,MAAM,SAAS,OAAO,MAAM;AAAA;AAE5E,UAAI,MAAM,OAAO;AACf,cAAM,QAAQ,MAAM;AAAA;AAEtB,aAAO;AAAA,KACR;AACD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,QAAQ,UAAU;AAAW;AAC/B;AACF,EACA,SAAS;AACP,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE;AACJ,UAAM,sBAAsB,mBAAiB;AAC3C,YAAM;AACN,uBAAiB,OAAK;AAEpB,cAAM;AACJ,YAAE,eAAe,kBAAkB,CAAC;AAAG,YACrC;AAAa,YACb;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA;AACD;AACH;AAEF;AAAO;AAET;AACE,aACS;AAAA;AACL,QACA;AAAc,QACd;AAAA,QACA;AAAA,QACA;AAAA;AACU,UACR;AAAS,UACT;AAAU,UACV;AAAc;AAChB;AACF;AACO;AAGX;AAEJ;;;;;"}