ZIndexManager

Primitive #64

🔍 Problem it solves

Dynamically created overlays (toasts, tooltips, dropdowns) need automatic z‑index values to appear above other content without hardcoding. If multiple overlays exist, the newest should be on top, and freed indices should be reused to avoid gaps.

✅ Solution

ZIndexManager allocates increasing z‑index values (starting from a base) and reuses released ones. It provides allocate() to get a new z‑index and release(zIndex) to free it. This demo creates coloured boxes with allocated z‑indexes; closing a box releases its index, which will be used for the next created box.

🧩 Used by components

ToastContainer, Portal, StackedOverlays, FloatingElements, NotificationCenter

🎮 Interactive demo