{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-z-index/index.ts"],"sourcesContent":["import { computed, inject, ref, unref } from 'vue'\nimport { isNumber } from '@element-plus/utils'\n\nimport type { InjectionKey, Ref } from 'vue'\n\nconst zIndex = ref(0)\nexport const defaultInitialZIndex = 2000\n\nexport const zIndexContextKey: InjectionKey<Ref<number | undefined>> =\n Symbol('zIndexContextKey')\n\nexport const useZIndex = (zIndexOverrides?: Ref<number>) => {\n const zIndexInjection = zIndexOverrides || inject(zIndexContextKey, undefined)\n const initialZIndex = computed(() => {\n const zIndexFromInjection = unref(zIndexInjection)\n return isNumber(zIndexFromInjection)\n ? zIndexFromInjection\n : defaultInitialZIndex\n })\n const currentZIndex = computed(() => initialZIndex.value + zIndex.value)\n\n const nextZIndex = () => {\n zIndex.value++\n return currentZIndex.value\n }\n\n return {\n initialZIndex,\n currentZIndex,\n nextZIndex,\n }\n}\n\nexport type UseZIndexReturn = ReturnType<typeof useZIndex>\n"],"names":[],"mappings":";;;;AAEA,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACV,MAAC,oBAAoB,GAAG,IAAI;AAC5B,MAAC,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,EAAE;AAC/C,MAAC,SAAS,GAAG,CAAC,eAAe,KAAK;AAC9C,EAAE,MAAM,eAAe,GAAG,eAAe,IAAI,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9E,EAAE,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM;AACvC,IAAI,MAAM,mBAAmB,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AACvD,IAAI,OAAO,QAAQ,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AACtF,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3E,EAAE,MAAM,UAAU,GAAG,MAAM;AAC3B,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;AACnB,IAAI,OAAO,aAAa,CAAC,KAAK,CAAC;AAC/B,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,aAAa;AACjB,IAAI,aAAa;AACjB,IAAI,UAAU;AACd,GAAG,CAAC;AACJ;;;;"}
|