react-box-tools
Version:
Box tools react components, utils and hooks
37 lines (36 loc) • 1.31 kB
JavaScript
var a = Object.defineProperty;
var i = (s, e, t) => e in s ? a(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
var h = (s, e, t) => i(s, typeof e != "symbol" ? e + "" : e, t);
import { c } from "./clsx-DG-5vF7T.js";
import { c as p, i as n, p as u, q as g, s as f } from "./json-B_vrZjDX.js";
import { c as C } from "./ripple-BF_AQpJC.js";
import { a as O, d as S, g as y } from "./object-CQtn__eR.js";
class m {
constructor(e, t) {
h(this, "defaultTheme");
h(this, "htmlClassList");
h(this, "theme");
h(this, "current");
this.defaultTheme = e, this.theme = e, this.current = this.theme, typeof window < "u" && (this.theme = localStorage.theme ?? this.defaultTheme, this.htmlClassList = t || document.documentElement.classList);
}
toggle() {
this.theme = this.theme === "light" ? "dark" : "light", this.set();
}
set() {
var e, t;
(e = this.htmlClassList) == null || e.remove("dark", "light"), this.theme && ((t = this.htmlClassList) == null || t.add(this.theme)), localStorage.theme = this.theme, this.current = this.theme;
}
}
export {
m as ThemeManager,
c as clsx,
C as createRipple,
p as csr,
O as deepClear,
S as deepCopy,
y as getObjPropertyValue,
n as isDOM,
u as parseJSON,
g as quotelessJSON,
f as ssr
};