{"version":3,"file":"color.mjs","sources":["../../../../../packages/utils/vue/color.ts"],"sourcesContent":["import { debugWarn } from '@vuesax-plus/utils'\nimport { useAttrs } from '@vuesax-plus/hooks'\nimport { computed, getCurrentInstance } from 'vue'\nimport { componentColors } from '@vuesax-plus/constants'\nimport { getVsColor } from '@vuesax-plus/utils'\n\nexport const getComponentColor = () => {\n  const instance = getCurrentInstance()\n  if (!instance) {\n    debugWarn(\n      'use-attrs',\n      'getCurrentInstance() returned null. getComponentColor() must be called at the top of a setup function'\n    )\n    return computed(() => null)\n  }\n\n  const attrs = useAttrs({ excludeListeners: true })\n\n  return computed(() => {\n    let propColor = componentColors.find((color) => attrs.value[color] === true)\n    if (propColor) return propColor\n\n    const hasColorString = attrs.value['color'] as string | undefined\n    if (!hasColorString) return null\n\n    return getVsColor(hasColorString)\n  })\n}\n"],"names":[],"mappings":";;;;;;;;;AAMO,MAAM,oBAAoB,MAAM;AACrC,EAAA,MAAM,WAAW,kBAAmB,EAAA,CAAA;AACpC,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAA,SAAA;AAAA,MACE,WAAA;AAAA,MACA,uGAAA;AAAA,KACF,CAAA;AACA,IAAO,OAAA,QAAA,CAAS,MAAM,IAAI,CAAA,CAAA;AAAA,GAC5B;AAEA,EAAA,MAAM,KAAQ,GAAA,QAAA,CAAS,EAAE,gBAAA,EAAkB,MAAM,CAAA,CAAA;AAEjD,EAAA,OAAO,SAAS,MAAM;AACpB,IAAI,IAAA,SAAA,GAAY,gBAAgB,IAAK,CAAA,CAAC,UAAU,KAAM,CAAA,KAAA,CAAM,WAAW,IAAI,CAAA,CAAA;AAC3E,IAAI,IAAA,SAAA;AAAW,MAAO,OAAA,SAAA,CAAA;AAEtB,IAAM,MAAA,cAAA,GAAiB,MAAM,KAAM,CAAA,OAAA,CAAA,CAAA;AACnC,IAAA,IAAI,CAAC,cAAA;AAAgB,MAAO,OAAA,IAAA,CAAA;AAE5B,IAAA,OAAO,WAAW,cAAc,CAAA,CAAA;AAAA,GACjC,CAAA,CAAA;AACH;;;;"}