UNPKG

hexo-theme-redefine

Version:

Redefine your writing with Hexo Theme Redefine.

2 lines 880 B
const t="REDEFINE-THEME-STATUS",e={isExpandPageWidth:!1,isDark:theme.colors.default_mode&&"dark"===theme.colors.default_mode,fontSizeLevel:0,isOpenPageAside:!0};export const styleStatus={...e};export const getStyleStatus=()=>{const e=(()=>{try{const e=localStorage.getItem(t);if(!e)return null;const s=JSON.parse(e);return s&&"object"==typeof s?s:null}catch(t){return console.error("Failed to read style status:",t),null}})();return e?(Object.keys(styleStatus).forEach((t=>{void 0!==e[t]&&(styleStatus[t]=e[t])})),e):null};export const setStyleStatus=()=>{try{localStorage.setItem(t,JSON.stringify(styleStatus))}catch(t){console.error("Failed to save style status:",t)}};export const updateStyleStatus=(t={})=>{Object.assign(styleStatus,t),setStyleStatus()};export const resetStyleStatus=()=>{Object.assign(styleStatus,e),setStyleStatus()}; //# sourceMappingURL=styleStatus.js.map