UNPKG

@revenuecat/purchases-ui-js

Version:

Web components for Paywalls. Powered by RevenueCat

26 lines (25 loc) 1.13 kB
export function rcVideoBackgroundHostClass(variant) { return `rc-${variant}-video-bg`; } /** * Inline-style snippet for any host that mounts `BackgroundVideoSurface`. Always sets * `isolation: isolate` when there's a video background so the per-kind z-index ladder * (`.rc-bg-video` = 1, `::before` overlay = 2, content = 3) sorts inside the host only * and can't collide with z-layers outside it. Returns an empty object when inactive so * it's safe to spread unconditionally. * * `positionRelative` and `clipOverflow` stay opt-in because surfaces differ: * - Sheet positions itself via stylesheet (`position: absolute`); skip `positionRelative`. * - Carousel clips via the child `.carousel-clip` wrapper; skip `clipOverflow`. * - Stack/Tabs clip only when corners are rounded; pass `borderRadiusCss !== "0"`. */ export function videoBackgroundHostStyles(options) { if (!options.hasVideoBg) return {}; const styles = { isolation: "isolate" }; if (options.positionRelative) styles.position = "relative"; if (options.clipOverflow) styles.overflow = "hidden"; return styles; }