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.
27 lines
941 B
27 lines
941 B
import { ref, getCurrentInstance, 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 || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : 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
|
|
|