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.

1 line
1.0 KiB

{"version":3,"file":"element.js","sources":["../../../../../packages/utils/dom/element.ts"],"sourcesContent":["import { isString } from '../types'\nimport { isClient } from '../browser'\n\ntype GetElement = <T extends string | HTMLElement | Window | null | undefined>(\n target: T\n) => T extends string ? HTMLElement | null : T\n\nexport const getElement = ((\n target: string | HTMLElement | Window | null | undefined\n) => {\n if (!isClient || target === '') return null\n if (isString(target)) {\n try {\n return document.querySelector<HTMLElement>(target)\n } catch {\n return null\n }\n }\n return target\n}) as GetElement\n"],"names":["isClient","isString"],"mappings":";;;;;;;;;AAEY,MAAC,UAAU,GAAG,CAAC,MAAM,KAAK;AACtC,EAAE,IAAI,CAACA,aAAQ,IAAI,MAAM,KAAK,EAAE;AAChC,IAAI,OAAO,IAAI,CAAC;AAChB,EAAE,IAAIC,eAAQ,CAAC,MAAM,CAAC,EAAE;AACxB,IAAI,IAAI;AACR,MAAM,OAAO,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AAC5C,KAAK,CAAC,OAAO,CAAC,EAAE;AAChB,MAAM,OAAO,IAAI,CAAC;AAClB,KAAK;AACL,GAAG;AACH,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}