import { computed, watch } from "vue";
import { getUid } from "@veno-ui/utils";
import { ROOT_ZINDEX, useLayout } from "./layout";
const OFFSET_ZINDEX = 400;
function useOverlay(isActive) {
  const layout = useLayout();
  const id = getUid();
  watch(isActive, (value) => {
    if (value) {
      layout.overlays.value.push(id);
    } else {
      layout.overlays.value = layout.overlays.value.filter((x) => x !== id);
    }
  }, {
    immediate: true
  });
  const overlayZIndex = computed(() => ROOT_ZINDEX + OFFSET_ZINDEX + layout.overlays.value.indexOf(id) + 1);
  return {
    overlayZIndex,
    layoutRect: layout.layoutRect
  };
}
export {
  useOverlay
};
//# sourceMappingURL=overlay.mjs.map
