mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 00:18:51 +08:00
2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
import{gd as w,p as L,gg as F,g6 as H,R as q,a as g,av as E,gh as A,au as G,f$ as M,gi as R,gj as z,gk as D,gl as N}from"./index-DMqaFtX4.js";import{u as W}from"./app-B_oSMJZp.js";import{u as b}from"./epTheme-cad4iSTI.js";function j(){const{$storage:l,$config:e}=w(),p=()=>{var n,v,y,h,c,d,S,k,C,T,t,o,s,u,r,i,f;F().multiTagsCache&&(!l.tags||l.tags.length===0)&&(l.tags=H),l.locale||(l.locale={locale:(n=e==null?void 0:e.Locale)!=null?n:"zh"},q().locale.value=(v=e==null?void 0:e.Locale)!=null?v:"zh"),l.layout||(l.layout={layout:(y=e==null?void 0:e.Layout)!=null?y:"vertical",theme:(h=e==null?void 0:e.Theme)!=null?h:"light",darkMode:(c=e==null?void 0:e.DarkMode)!=null?c:!1,sidebarStatus:(d=e==null?void 0:e.SidebarStatus)!=null?d:!0,epThemeColor:(S=e==null?void 0:e.EpThemeColor)!=null?S:"#409EFF",themeColor:(k=e==null?void 0:e.Theme)!=null?k:"light",overallStyle:(C=e==null?void 0:e.OverallStyle)!=null?C:"light"}),l.configure||(l.configure={grey:(T=e==null?void 0:e.Grey)!=null?T:!1,weak:(t=e==null?void 0:e.Weak)!=null?t:!1,hideTabs:(o=e==null?void 0:e.HideTabs)!=null?o:!1,hideFooter:(s=e.HideFooter)!=null?s:!0,showLogo:(u=e==null?void 0:e.ShowLogo)!=null?u:!0,showModel:(r=e==null?void 0:e.ShowModel)!=null?r:"smart",multiTagsCache:(i=e==null?void 0:e.MultiTagsCache)!=null?i:!1,stretch:(f=e==null?void 0:e.Stretch)!=null?f:!1})},a=L(()=>l==null?void 0:l.layout.layout),m=L(()=>l.layout);return{layout:a,layoutTheme:m,initStorage:p}}function O(){var C,T;const{layoutTheme:l,layout:e}=j(),p=g([{color:"#ffffff",themeColor:"light"},{color:"#1b2a47",themeColor:"default"},{color:"#722ed1",themeColor:"saucePurple"},{color:"#eb2f96",themeColor:"pink"},{color:"#f5222d",themeColor:"dusk"},{color:"#fa541c",themeColor:"volcano"},{color:"#13c2c2",themeColor:"mingQing"},{color:"#52c41a",themeColor:"auroraGreen"}]),{$storage:a}=w(),m=g((C=a==null?void 0:a.layout)==null?void 0:C.darkMode),n=g((T=a==null?void 0:a.layout)==null?void 0:T.overallStyle),v=document.documentElement;function y(t,o,s){const u=s||document.body;let{className:r}=u;r=r.replace(o,"").trim(),u.className=t?`${r} ${o}`:r}function h(t=(s=>(s=E().Theme)!=null?s:"light")(),o=!0){var r,i;l.value.theme=t,document.documentElement.setAttribute("data-theme",t);const u=a.layout.themeColor;if(a.layout={layout:e.value,theme:t,darkMode:m.value,sidebarStatus:(r=a.layout)==null?void 0:r.sidebarStatus,epThemeColor:(i=a.layout)==null?void 0:i.epThemeColor,themeColor:o?t:u,overallStyle:n.value},t==="default"||t==="light")d(E().EpThemeColor);else{const f=p.value.find(P=>P.themeColor===t);d(f.color)}}function c(t,o,s){document.documentElement.style.setProperty(`--el-color-primary-${t}-${o}`,m.value?D(s,o/10):N(s,o/10))}const d=t=>{b().setEpThemeColor(t),document.documentElement.style.setProperty("--el-color-primary",t);for(let o=1;o<=2;o++)c("dark",o,t);for(let o=1;o<=9;o++)c("light",o,t)};function S(t){n.value=t,b().epTheme==="light"&&m.value?h("default",!1):h(b().epTheme,!1),m.value?document.documentElement.classList.add("dark"):(a.layout.themeColor==="light"&&h("light",!1),document.documentElement.classList.remove("dark"))}function k(){A(),G().clear();const{Grey:t,Weak:o,MultiTagsCache:s,EpThemeColor:u,Layout:r}=E();W().setLayout(r),d(u),M().multiTagsCacheChange(s),y(t,"html-grey",document.querySelector("html")),y(o,"html-weakness",document.querySelector("html")),R.push("/login"),M().handleTags("equal",[...H]),z()}return{body:v,dataTheme:m,overallStyle:n,layoutTheme:l,themeColors:p,onReset:k,toggleClass:y,dataThemeChange:S,setEpThemeColor:d,setLayoutThemeColor:h}}export{j as a,O as u};
|