mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
37 lines
929 B
JavaScript
37 lines
929 B
JavaScript
import { applyDynamicStyles, removeDynamicStyles } from "../../js/ui/styleSystem.js";
|
|
|
|
const FALLBACK_CLASSES = {
|
|
hiddenDownload: "torrent-download-anchor",
|
|
clipboard: "torrent-clipboard-textarea",
|
|
};
|
|
|
|
export function applyBeaconDynamicStyles(element, styleObject = {}, slotKey) {
|
|
if (!element) {
|
|
return null;
|
|
}
|
|
|
|
const slot = slotKey ? String(slotKey) : undefined;
|
|
|
|
if (slot && FALLBACK_CLASSES[slot]) {
|
|
element.classList.add(FALLBACK_CLASSES[slot]);
|
|
}
|
|
|
|
return applyDynamicStyles(element, styleObject, slot ? { slot } : {});
|
|
}
|
|
|
|
export function removeBeaconDynamicStyles(element, slotKey) {
|
|
if (!element) {
|
|
return;
|
|
}
|
|
|
|
const slot = slotKey ? String(slotKey) : undefined;
|
|
|
|
if (slot && FALLBACK_CLASSES[slot]) {
|
|
element.classList.remove(FALLBACK_CLASSES[slot]);
|
|
}
|
|
|
|
removeDynamicStyles(element, slot ? { slot } : {});
|
|
}
|
|
|
|
export const beaconDynamicFallbackClasses = { ...FALLBACK_CLASSES };
|