import { ref, inject, computed, unref } from 'vue';
|
import '../../utils/index.mjs';
|
import { isNumber } from '../../utils/types.mjs';
|
|
const zIndex = ref(0);
|
const defaultInitialZIndex = 2e3;
|
const zIndexContextKey = Symbol("zIndexContextKey");
|
const useZIndex = (zIndexOverrides) => {
|
const zIndexInjection = zIndexOverrides || inject(zIndexContextKey, void 0);
|
const initialZIndex = computed(() => {
|
const zIndexFromInjection = unref(zIndexInjection);
|
return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
|
});
|
const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
|
const nextZIndex = () => {
|
zIndex.value++;
|
return currentZIndex.value;
|
};
|
return {
|
initialZIndex,
|
currentZIndex,
|
nextZIndex
|
};
|
};
|
|
export { defaultInitialZIndex, useZIndex, zIndexContextKey };
|
//# sourceMappingURL=index.mjs.map
|