p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
1 lines • 1.51 kB
JavaScript
import{a as e,ht as t}from"./i18n.store-Bbsc3Bab.js";var n=[`dark`,`darkNeu`,`darkoBluo`,`matrix`],r=[`light`,`enterprise`,`dark`,`darkNeu`,`darkoBluo`,`matrix`,`redis`];function i(e){return n.includes(e)}var a=`p3xr-theme`,o=`auto`;function s(){return typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches}function c(e){if(e.startsWith(`p3xrTheme`)){let t=e.replace(`p3xrTheme`,``);return t.charAt(0).toLowerCase()+t.slice(1)}return e}function l(){try{let e=localStorage.getItem(a)||o;return e===o?o:c(e)}catch{return o}}function u(e){if(typeof document>`u`)return;let t=i(e),n=t?`dark`:`light`;document.documentElement.setAttribute(`data-color-scheme`,n),document.documentElement.style.colorScheme=n,document.body.style.colorScheme=n,document.body.classList.toggle(`p3xr-theme-dark`,t),document.body.classList.toggle(`p3xr-theme-light`,!t);let r=document.querySelector(`meta[name="color-scheme"]`);r&&(r.content=n)}function d(e){return e===o?s()?`dark`:`enterprise`:e}var f=e(`theme`,()=>{let e=l(),n=t(e===o),r=t(d(e)),c=t(e);u(r.value);function f(e){let t=e===o,s=t?d(o):e;try{localStorage.setItem(a,e)}catch{}u(s);try{window.parent?.postMessage({type:`p3x-theme-change`,dark:i(s)},`*`)}catch{}n.value=t,r.value=s,c.value=e}return typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,()=>{if(n.value){let e=s()?`dark`:`enterprise`;u(e),r.value=e}}),{isAuto:n,themeKey:r,storedValue:c,setTheme:f}});export{f as n,r as t};