refactor(project): simplified part of the package, code optimization

This commit is contained in:
vben
2024-07-13 16:35:47 +08:00
parent 5784d718c0
commit daa31f7156
92 changed files with 318 additions and 546 deletions

View File

@@ -29,8 +29,6 @@
}
},
"dependencies": {
"@vben-core/cache": "workspace:*",
"@vben-core/colorful": "workspace:*",
"@vben-core/toolkit": "workspace:*",
"@vben-core/typings": "workspace:*",
"@vueuse/core": "^10.11.0",

View File

@@ -1,6 +1,7 @@
import type { BuiltinThemeType } from '@vben-core/typings';
import type { SupportedLanguagesType } from './types';
import type {
BuiltinThemeType,
SupportedLanguagesType,
} from '@vben-core/typings';
interface Language {
key: SupportedLanguagesType;

View File

@@ -5,17 +5,6 @@ import { PreferenceManager, isDarkTheme } from './preferences';
describe('preferences', () => {
let preferenceManager: PreferenceManager;
vi.mock('@vben-core/cache', () => {
return {
StorageManager: vi.fn().mockImplementation(() => {
return {
getItem: vi.fn(),
removeItem: vi.fn(),
setItem: vi.fn(),
};
}),
};
});
// 模拟 window.matchMedia 方法
vi.stubGlobal(

View File

@@ -4,9 +4,12 @@ import type { Preferences } from './types';
import { markRaw, reactive, readonly, watch } from 'vue';
import { StorageManager } from '@vben-core/cache';
import { generatorColorVariables } from '@vben-core/colorful';
import { merge, updateCSSVariables } from '@vben-core/toolkit';
import {
StorageManager,
generatorColorVariables,
merge,
updateCSSVariables,
} from '@vben-core/toolkit';
import {
breakpointsTailwind,

View File

@@ -1,28 +1,18 @@
import type {
AccessModeType,
AuthPageLayoutType,
BreadcrumbStyleType,
BuiltinThemeType,
ContentCompactType,
LayoutHeaderModeType,
LayoutType,
LoginExpiredModeType,
NavigationStyleType,
PageTransitionType,
SupportedLanguagesType,
ThemeModeType,
} from '@vben-core/typings';
/**
* 登录过期模式
* 'modal' 弹窗模式 | 'page' 页面模式
*/
type LoginExpiredModeType = 'modal' | 'page';
type BreadcrumbStyleType = 'background' | 'normal';
type AccessModeType = 'allow-all' | 'backend' | 'frontend';
type NavigationStyleType = 'plain' | 'rounded';
type PageTransitionType = 'fade' | 'fade-down' | 'fade-slide' | 'fade-up';
type AuthPageLayoutType = 'panel-center' | 'panel-left' | 'panel-right';
interface AppPreferences {
/** 权限模式 */
accessMode: AccessModeType;
@@ -236,28 +226,17 @@ interface Preferences {
type PreferencesKeys = keyof Preferences;
export type {
AccessModeType,
AppPreferences,
AuthPageLayoutType,
BreadcrumbPreferences,
BreadcrumbStyleType,
ContentCompactType,
FooterPreferences,
HeaderPreferences,
LayoutHeaderModeType,
LayoutType,
LoginExpiredModeType,
LogoPreferences,
NavigationPreferences,
NavigationStyleType,
PageTransitionType,
Preferences,
PreferencesKeys,
ShortcutKeyPreferences,
SidebarPreferences,
SupportedLanguagesType,
TabbarPreferences,
ThemeModeType,
ThemePreferences,
TransitionPreferences,
WidgetPreferences,