vuestic-ui
Version:
Vue 3 UI Framework
1 lines • 846 B
Source Map (JSON)
{"version":3,"file":"useHTMLElementSelector.mjs","sources":["../../../../src/composables/useHTMLElementSelector.ts"],"sourcesContent":["import { computed, DefineComponent, Ref, unref } from 'vue'\nimport { unwrapEl } from '../utils/unwrapEl'\n\nexport type MaybeHTMLElementOrSelector = string | HTMLElement | DefineComponent | undefined\n\nexport const useHTMLElementSelector = (key: Ref<MaybeHTMLElementOrSelector | undefined>): Ref<HTMLElement | undefined> => {\n return computed(() => {\n if (typeof key?.value === 'string') {\n return document?.querySelector(key.value) as HTMLElement\n }\n\n return unwrapEl(key?.value)\n })\n}\n"],"names":[],"mappings":";;AAKa,MAAA,yBAAyB,CAAC,QAAmF;AACxH,SAAO,SAAS,MAAM;AAChB,QAAA,QAAO,2BAAK,WAAU,UAAU;AAC3B,aAAA,qCAAU,cAAc,IAAI;AAAA,IACrC;AAEO,WAAA,SAAS,2BAAK,KAAK;AAAA,EAAA,CAC3B;AACH;"}