mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	perf(projects): perf code
This commit is contained in:
		@@ -25,7 +25,6 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
 | 
			
		||||
    if (settings.value.themeScheme === 'auto') {
 | 
			
		||||
      return osTheme.value === 'dark';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return settings.value.themeScheme === 'dark';
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,6 @@ const DARK_CLASS = 'dark';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * init theme settings
 | 
			
		||||
 * @param darkMode is dark mode
 | 
			
		||||
 */
 | 
			
		||||
export function initThemeSettings() {
 | 
			
		||||
  const isProd = import.meta.env.PROD;
 | 
			
		||||
@@ -34,7 +33,7 @@ export function initThemeSettings() {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * create theme token
 | 
			
		||||
 * @param darkMode is dark mode
 | 
			
		||||
 * @param colors theme colors
 | 
			
		||||
 */
 | 
			
		||||
export function createThemeToken(colors: App.Theme.ThemeColor) {
 | 
			
		||||
  const paletteColors = createThemePaletteColors(colors);
 | 
			
		||||
@@ -146,7 +145,8 @@ export function addThemeVarsToHtml(tokens: App.Theme.BaseToken, darkTokens: App.
 | 
			
		||||
  const darkCss = `
 | 
			
		||||
    html.${DARK_CLASS} {
 | 
			
		||||
      ${darkCssVarStr}
 | 
			
		||||
    `;
 | 
			
		||||
    }
 | 
			
		||||
  `;
 | 
			
		||||
 | 
			
		||||
  const style = document.createElement('style');
 | 
			
		||||
 | 
			
		||||
@@ -157,7 +157,7 @@ export function addThemeVarsToHtml(tokens: App.Theme.BaseToken, darkTokens: App.
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * toggle css dark mode
 | 
			
		||||
 * @param darkMode
 | 
			
		||||
 * @param darkMode is dark mode
 | 
			
		||||
 */
 | 
			
		||||
export function toggleCssDarkMode(darkMode = false) {
 | 
			
		||||
  function addDarkClass() {
 | 
			
		||||
@@ -185,7 +185,7 @@ interface NaiveColorAction {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * get naive theme colors
 | 
			
		||||
 * @param colors
 | 
			
		||||
 * @param colors theme colors
 | 
			
		||||
 */
 | 
			
		||||
function getNaiveThemeColors(colors: App.Theme.ThemeColor) {
 | 
			
		||||
  const colorActions: NaiveColorAction[] = [
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user