import { reactive, ref } from 'vue'

export interface DrawerStackItem {
	id: number
	visible: boolean
	width: number
	zIndex: number
	right: number
	order: number
	stackGap: number
}

// 模块级共享状态 —— 所有 useDrawerStack 调用方共享同一份数据
let drawerIdSeed = 0
const drawerStack = reactive<DrawerStackItem[]>([])
const isAnyResizing = ref(false)

export function useDrawerStack() {
	const allocateId = () => drawerIdSeed++

	return {
		drawerStack,
		isAnyResizing,
		allocateId
	}
}
