Added docs to z-index generator.

This commit is contained in:
Mizah 2024-11-17 14:23:44 +02:00
parent 8457fa9b3b
commit 1613dafc39

View file

@ -153,12 +153,23 @@ export const popups = ref<{
events: Record<string, any>;
}[]>([]);
/**
* An object containing z-index values for different priority levels.
*/
const zIndexes = {
veryLow: 500000,
low: 1000000,
middle: 2000000,
high: 3000000,
};
/**
* Claims a z-index value for a given priority level.
* Increments the z-index value for the specified priority by 100 and returns the new value.
*
* @param {keyof typeof zIndexes} [priority='low'] - The priority level for which to claim a z-index.
* @returns {number} The new z-index value for the specified priority.
*/
export function claimZIndex(priority: keyof typeof zIndexes = 'low'): number {
zIndexes[priority] += 100;
return zIndexes[priority];