diff --git a/CHANGELOG.md b/CHANGELOG.md index 671eda5b..4934214e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # CHANGE LOG +## 4.7.3 + +补全 `hooks` 包下的单测模块。 + +## Feats + +- 重命名 `store` 包下的 `type.ts` 为 `types.ts` +- `useElementFullscreen` + - 优化全屏尺寸逻辑,现在会监听浏览器 `width`, `height` 变化,自动调整全屏尺寸 + +## Fixes + +- 修复 `useElementFullscreen` 方法在退出全屏时,不能恢复原有 `transition` 样式问题 + ## 4.7.2 新增 `vitest` 测试框架。 diff --git a/__test__/hooks/useAppNavigation.spec.ts b/__test__/hooks/useAppNavigation.spec.ts new file mode 100644 index 00000000..151948d1 --- /dev/null +++ b/__test__/hooks/useAppNavigation.spec.ts @@ -0,0 +1,18 @@ +import { useAppNavigation } from '../../src/hooks/template/useAppNavigation' +import { useMenuGetters } from '../../src/store' +import setupMiniApp from '../utils/setupMiniApp' + +describe('useAppNavigation', async () => { + await setupMiniApp() + + const { navigationTo } = useAppNavigation() + const { getMenuOptions } = useMenuGetters() + + it('navigationTo', () => { + const [dashboard] = getMenuOptions.value + + expect(navigationTo(dashboard.fullPath)).toBeUndefined() + expect(navigationTo(dashboard)).toBeUndefined() + expect(navigationTo(0)).toBeUndefined() + }) +}) diff --git a/__test__/hooks/useAppRoot.spec.ts b/__test__/hooks/useAppRoot.spec.ts new file mode 100644 index 00000000..9346c750 --- /dev/null +++ b/__test__/hooks/useAppRoot.spec.ts @@ -0,0 +1,51 @@ +import setupMiniApp from '../utils/setupMiniApp' +import { useAppRoot } from '../../src/hooks/template/useAppRoot' + +describe('useAppRoot', async () => { + await setupMiniApp() + + const { setRootRoute } = useAppRoot() + + it(`should return '/test' and 'test'`, () => { + setRootRoute({ + path: '/test', + name: 'test', + }) + + const { getRootPath, getRootName } = useAppRoot() + + expect(getRootPath.value).toBe('/test') + expect(getRootName.value).toBe('test') + }) + + it(`should be returned a object like: {path: /test2, name: test2}`, () => { + const baseRootRoute = { + path: '/test2', + name: 'test2', + } + + setRootRoute(baseRootRoute) + + const { getRootRoute } = useAppRoot() + + expect(getRootRoute.value).toEqual(baseRootRoute) + }) + + it('should update root route when setRootRoute is called', () => { + const baseRootRoute = { + path: '/test3', + name: 'test3', + } + + setRootRoute({ + path: '/test3', + name: 'test3', + }) + + const { getRootPath, getRootName, getRootRoute } = useAppRoot() + + expect(getRootPath.value).toBe('/test3') + expect(getRootName.value).toBe('test3') + expect(getRootRoute.value).toEqual(baseRootRoute) + }) +}) diff --git a/__test__/hooks/useBadge.spec.ts b/__test__/hooks/useBadge.spec.ts new file mode 100644 index 00000000..5abc6940 --- /dev/null +++ b/__test__/hooks/useBadge.spec.ts @@ -0,0 +1,67 @@ +import setupMiniApp from '../utils/setupMiniApp' +import { useBadge } from '../../src/hooks/template/useBadge' +import { useMenuGetters } from '../../src/store' + +import type { AppMenuExtraOptions } from '../../src/router/types' + +describe('useBadge', async () => { + await setupMiniApp() + + const { show, hidden, update } = useBadge() + const { getMenuOptions } = useMenuGetters() + + const baseBadge = (extra: AppMenuExtraOptions) => + Object.assign( + {}, + { + label: 'new', + type: 'error', + } as AppMenuExtraOptions, + extra, + ) + + it('should hide badge', () => { + const [dashboard] = getMenuOptions.value + + update( + dashboard, + baseBadge({ + show: false, + label: 'new', + }), + ) + hidden(dashboard) + + expect(dashboard.meta.extra?.show).toBe(false) + }) + + it('should show badge', () => { + const [dashboard] = getMenuOptions.value + + update( + dashboard, + baseBadge({ + show: true, + label: 'new', + }), + ) + show(dashboard) + + expect(dashboard.meta.extra?.show).toBe(true) + }) + + it('should show badge with new label', () => { + const [dashboard] = getMenuOptions.value + const label = 'update new' + + update( + dashboard, + baseBadge({ + show: true, + label, + }), + ) + + expect(dashboard.meta.extra?.label).toBe(label) + }) +}) diff --git a/__test__/hooks/useElementFullscreen.spec.ts b/__test__/hooks/useElementFullscreen.spec.ts new file mode 100644 index 00000000..70ac8fbb --- /dev/null +++ b/__test__/hooks/useElementFullscreen.spec.ts @@ -0,0 +1,54 @@ +import { useElementFullscreen } from '../../src/hooks/web/useElementFullscreen' + +describe('useElementFullscreen', async () => { + const div = document.createElement('div') + const transition = 'all 0.3s var(--r-bezier)' + const __ID__ = '__ID__' + + div.setAttribute('id', __ID__) + document.body.appendChild(div) + + const resetDivStyle = () => { + const element = document.getElementById(__ID__) + + if (element) { + element.style.transition = '' + } + } + + const { enter, exit, toggleFullscreen } = useElementFullscreen(div) + + it('should enter fullscreen', async () => { + resetDivStyle() + enter() + + await nextTick() + + expect(div.style.transition).toBe(transition) + }) + + it('should exit fullscreen', async () => { + resetDivStyle() + exit() + + await nextTick() + + expect(div.style.transition).toBe('') + }) + + it('should toggle fullscreen', async () => { + resetDivStyle() + enter() + enter() // 为了兼容测试环境,故而调用两次 + + await nextTick() + + expect(div.style.transition).toBe(transition) + + toggleFullscreen() + + await nextTick() + + expect(div.style.transition).toBe('') + }) +}) diff --git a/__test__/hooks/useSiderBar.spec.ts b/__test__/hooks/useSiderBar.spec.ts new file mode 100644 index 00000000..6c3db302 --- /dev/null +++ b/__test__/hooks/useSiderBar.spec.ts @@ -0,0 +1,167 @@ +import setupMiniApp from '../utils/setupMiniApp' +import { useSiderBar } from '../../src/hooks/template/useSiderBar' +import { useMenuGetters, useMenuActions } from '../../src/store' +import { useVueRouter } from '../../src/hooks/web/useVueRouter' + +import type { AppMenuOption, MenuTagOptions } from '../../src/types/modules/app' + +describe('useSiderBar', async () => { + await setupMiniApp() + + const { setMenuTagOptions, resolveOption } = useMenuActions() + const { + close, + closeAll, + closeRight, + closeLeft, + closeOther, + getCurrentTagIndex, + checkCloseRight, + checkCloseLeft, + } = useSiderBar() + + const updateMenuTagOptions = () => { + const { router } = useVueRouter() + const routes = router.getRoutes() as unknown as AppMenuOption[] + + routes.forEach((curr) => + setMenuTagOptions( + resolveOption({ + ...curr, + fullPath: curr.path, + }), + true, + ), + ) + } + + it('should close target tag', async () => { + updateMenuTagOptions() + + const { getMenuOptions, getMenuTagOptions } = useMenuGetters() + const [dashboard] = getMenuOptions.value + const beforeIndex = getMenuTagOptions.value.findIndex( + (curr) => curr.fullPath === dashboard.fullPath, + ) + + close(dashboard.fullPath) + + await nextTick() + + const afterIndex = getMenuTagOptions.value.findIndex( + (curr) => curr.fullPath === dashboard.fullPath, + ) + + expect(beforeIndex).not.toBe(afterIndex) + }) + + it('should close all tags', async () => { + updateMenuTagOptions() + + const { getMenuTagOptions } = useMenuGetters() + + closeAll() + + await nextTick() + + const afterLength = getMenuTagOptions.value.length + + expect(afterLength).toBe(1) + }) + + it('should close right tags', async () => { + updateMenuTagOptions() + + const { getMenuOptions, getMenuTagOptions } = useMenuGetters() + const [dashboard] = getMenuOptions.value + const beforeIndex = getMenuTagOptions.value.findIndex( + (curr) => curr.fullPath === dashboard.fullPath, + ) + + expect(!!getMenuTagOptions.value[beforeIndex + 1]).toBe(true) + + closeRight(dashboard.fullPath) + + await nextTick() + + const afterIndex = getMenuTagOptions.value.findIndex( + (curr) => curr.fullPath === dashboard.fullPath, + ) + + expect(getMenuTagOptions.value[afterIndex + 1]).toBe(void 0) + }) + + it('should close left tags', async () => { + updateMenuTagOptions() + + const { getMenuOptions, getMenuTagOptions } = useMenuGetters() + const [dashboard] = getMenuOptions.value + + closeLeft(dashboard.fullPath) + + await nextTick() + + const afterIndex = getMenuTagOptions.value.findIndex( + (curr) => curr.fullPath === dashboard.fullPath, + ) + + expect(getMenuTagOptions.value[afterIndex - 1]).toBe(void 0) + }) + + it('should get current tag index', async () => { + updateMenuTagOptions() + + const { getMenuOptions, getMenuTagOptions } = useMenuGetters() + const [dashboard] = getMenuOptions.value + + const index = getMenuOptions.value.findIndex( + (curr) => curr.fullPath === dashboard.fullPath, + ) + + expect(getCurrentTagIndex()).toBe(index) + }) + + it('should close other tags', async () => { + updateMenuTagOptions() + + const { getMenuOptions, getMenuTagOptions } = useMenuGetters() + const [dashboard] = getMenuOptions.value + + closeOther(dashboard.fullPath) + + await nextTick() + + expect(getMenuTagOptions.value[0].fullPath).toBe(dashboard.fullPath) + expect(getMenuTagOptions.value.length).toBe(1) + }) + + it('check menuTagOptions left or right can close', async () => { + updateMenuTagOptions() + + const { getMenuOptions, getMenuTagOptions } = useMenuGetters() + const [f, s] = getMenuOptions.value + + closeRight(f.fullPath) + + await nextTick() + + const canClose = checkCloseRight(f.fullPath) + + expect(canClose).toBe(false) + + updateMenuTagOptions() + + closeLeft(f.fullPath) + + await nextTick() + + const canCloseLeft = checkCloseLeft(f.fullPath) + + expect(canCloseLeft).toBe(false) + + updateMenuTagOptions() + + expect(checkCloseRight(s.fullPath)).toBe(true) + expect(checkCloseLeft(s.fullPath)).toBe(true) + }) +}) diff --git a/__test__/hooks/useSpinning.spec.ts b/__test__/hooks/useSpinning.spec.ts new file mode 100644 index 00000000..be863f49 --- /dev/null +++ b/__test__/hooks/useSpinning.spec.ts @@ -0,0 +1,38 @@ +import setupMiniApp from '../utils/setupMiniApp' +import { useSpinning } from '../../src/hooks/template/useSpinning' +import { setVariable, getVariableToRefs } from '../../src/global-variable' + +describe('useSpinning', async () => { + await setupMiniApp() + + const { reload, openSpin, closeSpin } = useSpinning() + const globalMainLayoutLoad = getVariableToRefs('globalMainLayoutLoad') + + it('should open spinning', () => { + openSpin() + + expect(globalMainLayoutLoad.value).toBe(true) + }) + + it('should close spinning', () => { + openSpin() + + expect(globalMainLayoutLoad.value).toBe(true) + + closeSpin() + + expect(globalMainLayoutLoad.value).toBe(true) + }) + + it('should reload', () => { + const wait = 1000 + + reload(wait) + + expect(globalMainLayoutLoad.value).toBe(false) + + setTimeout(() => { + expect(globalMainLayoutLoad.value).toBe(true) + }, wait) + }) +}) diff --git a/__test__/hooks/useTheme.spec.ts b/__test__/hooks/useTheme.spec.ts new file mode 100644 index 00000000..c7d1eb3c --- /dev/null +++ b/__test__/hooks/useTheme.spec.ts @@ -0,0 +1,47 @@ +import setupMiniApp from '../utils/setupMiniApp' +import { useTheme } from '../../src/hooks/template/useTheme' + +describe('useTheme', async () => { + await setupMiniApp() + + const { changeDarkTheme, changeLightTheme, toggleTheme, getAppTheme } = + useTheme() + + it('should change to dark theme', () => { + changeDarkTheme() + + expect(getAppTheme().theme).toBe(true) + }) + + it('should change to light theme', () => { + changeLightTheme() + + expect(getAppTheme().theme).toBe(false) + }) + + it('should toggle theme', () => { + changeLightTheme() + + expect(getAppTheme().theme).toBe(false) + + toggleTheme() + + expect(getAppTheme().theme).toBe(true) + }) + + it('should return current theme', () => { + changeDarkTheme() + + const { theme: darkTheme, themeLabel: darkThemeLabel } = getAppTheme() + + expect(darkTheme).toBe(true) + expect(darkThemeLabel).toBe('暗色') + + changeLightTheme() + + const { theme: lightTheme, themeLabel: lightThemeLabel } = getAppTheme() + + expect(lightTheme).toBe(false) + expect(lightThemeLabel).toBe('明亮') + }) +}) diff --git a/__test__/hooks/useVueRouter.spec.ts b/__test__/hooks/useVueRouter.spec.ts new file mode 100644 index 00000000..e52c0a89 --- /dev/null +++ b/__test__/hooks/useVueRouter.spec.ts @@ -0,0 +1,15 @@ +import setupMiniApp from '../utils/setupMiniApp' +import { useVueRouter } from '../../src/hooks/web/useVueRouter' + +describe('useVueRouter', async () => { + await setupMiniApp() + + const { router } = useVueRouter() + + it('should get push and replace methods', () => { + const { push, replace } = router + + assert.isFunction(push) + assert.isFunction(replace) + }) +}) diff --git a/__test__/hooks/useWatermark.spec.ts b/__test__/hooks/useWatermark.spec.ts new file mode 100644 index 00000000..949d8fc3 --- /dev/null +++ b/__test__/hooks/useWatermark.spec.ts @@ -0,0 +1,33 @@ +import setupMiniApp from '../utils/setupMiniApp' +import { useWatermark } from '../../src/hooks/template/useWatermark' +import { useSettingGetters } from '../../src/store' + +describe('useWatermark', async () => { + await setupMiniApp() + + const { setWatermarkContent, showWatermark, hiddenWatermark } = useWatermark() + + it('should set watermark content', () => { + const { getWatermarkConfig } = useSettingGetters() + const watermarkConfig = getWatermarkConfig.value + const content = 'Ray Template Yes!' + + setWatermarkContent(content) + + expect(watermarkConfig.content).toBe(content) + }) + + it('should update watermark', () => { + showWatermark() + + const { getWatermarkSwitch: show } = useSettingGetters() + + expect(show.value).toBe(true) + + hiddenWatermark() + + const { getWatermarkSwitch: hidden } = useSettingGetters() + + expect(hidden.value).toBe(false) + }) +}) diff --git a/__test__/utils/createRefElement.tsx b/__test__/utils/createRefElement.tsx index 710bd7f9..f97f83c1 100644 --- a/__test__/utils/createRefElement.tsx +++ b/__test__/utils/createRefElement.tsx @@ -1,7 +1,18 @@ import { mount } from '@vue/test-utils' -import type { Slot } from 'vue' - +/** + * + * @param slots 需要传递的插槽 + * + * @description + * 创建一个包含 ref 为 domRef 的组件。 + * 并且允许传递插槽。 + * + * @example + * const wrapper = createRefElement({ default: () =>
hello
}) + * + * const text = wrapper.find('div').text() // hello + */ const createRefElement = (slots?: Record) => { const wrapper = mount( defineComponent({ diff --git a/__test__/utils/setupMiniApp.ts b/__test__/utils/setupMiniApp.ts new file mode 100644 index 00000000..8f84e566 --- /dev/null +++ b/__test__/utils/setupMiniApp.ts @@ -0,0 +1,27 @@ +import { setupStore } from '../../src/store' +import { setupRouter } from '../../src/router' +import { setupI18n } from '../../src/locales' +import renderHook from '../utils/renderHook' + +/** + * + * @description + * 初始化 mini ray template 应用环境。 + * 该方法会初始化 store、router、i18n 等环境。 + * + * @example + * const { app } = await setupMiniApp() + */ +const setupMiniApp = async () => { + const [_, app] = renderHook(() => {}) + + setupStore(app) + setupRouter(app) + await setupI18n(app) + + return { + app, + } +} + +export default setupMiniApp diff --git a/package.json b/package.json index 4720e992..fea9af27 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ray-template", "private": false, - "version": "4.7.2", + "version": "4.7.3", "type": "module", "engines": { "node": "^18.0.0 || >=20.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aaecf7b7..c5b36ceb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,7 +46,7 @@ dependencies: version: 2.38.1(vue@3.4.21) pinia: specifier: ^2.1.7 - version: 2.1.7(typescript@5.4.3)(vue@3.4.21) + version: 2.1.7(typescript@5.2.2)(vue@3.4.21) pinia-plugin-persistedstate: specifier: ^3.2.0 version: 3.2.1(pinia@2.1.7) @@ -55,7 +55,7 @@ dependencies: version: 1.6.0 vue: specifier: ^3.4.21 - version: 3.4.21(typescript@5.4.3) + version: 3.4.21(typescript@5.2.2) vue-demi: specifier: 0.14.6 version: 0.14.6(vue@3.4.21) @@ -102,10 +102,10 @@ devDependencies: version: 1.0.7 '@typescript-eslint/eslint-plugin': specifier: ^6.5.0 - version: 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.4.3) + version: 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.2.2) '@typescript-eslint/parser': specifier: ^6.5.0 - version: 6.21.0(eslint@8.57.0)(typescript@5.4.3) + version: 6.21.0(eslint@8.57.0)(typescript@5.2.2) '@vitejs/plugin-vue': specifier: ^5.0.4 version: 5.0.4(vite@5.2.2)(vue@3.4.21) @@ -123,7 +123,7 @@ devDependencies: version: 9.0.0(eslint@8.57.0)(prettier@3.2.5) '@vue/eslint-config-typescript': specifier: ^12.0.0 - version: 12.0.0(eslint-plugin-vue@9.19.2)(eslint@8.57.0)(typescript@5.4.3) + version: 12.0.0(eslint-plugin-vue@9.19.2)(eslint@8.57.0)(typescript@5.2.2) '@vue/test-utils': specifier: 2.4.3 version: 2.4.3(vue@3.4.21) @@ -141,7 +141,7 @@ devDependencies: version: 9.1.0(eslint@8.57.0) eslint-config-standard-with-typescript: specifier: ^43.0.0 - version: 43.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)(typescript@5.4.3) + version: 43.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)(typescript@5.2.2) eslint-plugin-import: specifier: ^2.29.0 version: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.57.0) @@ -183,7 +183,7 @@ devDependencies: version: 6.0.11 typescript: specifier: ^5.2.2 - version: 5.4.3 + version: 5.2.2 unplugin-auto-import: specifier: ^0.17.5 version: 0.17.5(@vueuse/core@10.9.0) @@ -225,13 +225,13 @@ devDependencies: version: 4.0.0 vite-tsconfig-paths: specifier: 4.3.2 - version: 4.3.2(typescript@5.4.3)(vite@5.2.2) + version: 4.3.2(typescript@5.2.2)(vite@5.2.2) vitest: specifier: 1.4.0 version: 1.4.0(@types/node@20.5.1)(@vitest/ui@1.4.0)(happy-dom@14.3.1)(sass@1.71.1) vue-tsc: specifier: ^1.8.27 - version: 1.8.27(typescript@5.4.3) + version: 1.8.27(typescript@5.2.2) packages: @@ -335,9 +335,6 @@ packages: engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - peerDependenciesMeta: - '@babel/core': - optional: true dependencies: '@babel/core': 7.24.1 '@babel/helper-annotate-as-pure': 7.22.5 @@ -423,9 +420,6 @@ packages: engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 - peerDependenciesMeta: - '@babel/core': - optional: true dependencies: '@babel/core': 7.24.1 '@babel/helper-environment-visitor': 7.22.20 @@ -658,14 +652,14 @@ packages: '@commitlint/types': 17.8.1 '@types/node': 20.5.1 chalk: 4.1.2 - cosmiconfig: 8.3.6(typescript@5.4.3) - cosmiconfig-typescript-loader: 4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6)(ts-node@10.9.2)(typescript@5.4.3) + cosmiconfig: 8.3.6(typescript@5.2.2) + cosmiconfig-typescript-loader: 4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6)(ts-node@10.9.2)(typescript@5.2.2) lodash.isplainobject: 4.0.6 lodash.merge: 4.6.2 lodash.uniq: 4.5.0 resolve-from: 5.0.0 - ts-node: 10.9.2(@types/node@20.5.1)(typescript@5.4.3) - typescript: 5.4.3 + ts-node: 10.9.2(@types/node@20.5.1)(typescript@5.2.2) + typescript: 5.2.2 transitivePeerDependencies: - '@swc/core' - '@swc/wasm' @@ -758,7 +752,7 @@ packages: peerDependencies: vue: ^3.0.11 dependencies: - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) dev: false /@emotion/hash@0.8.0: @@ -1686,7 +1680,7 @@ packages: /@types/web-bluetooth@0.0.20: resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} - /@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.4.3): + /@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.2.2): resolution: {integrity: sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1698,10 +1692,10 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2) '@typescript-eslint/scope-manager': 6.21.0 - '@typescript-eslint/type-utils': 6.21.0(eslint@8.57.0)(typescript@5.4.3) - '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/type-utils': 6.21.0(eslint@8.57.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.2.2) '@typescript-eslint/visitor-keys': 6.21.0 debug: 4.3.4 eslint: 8.57.0 @@ -1709,13 +1703,13 @@ packages: ignore: 5.3.1 natural-compare: 1.4.0 semver: 7.6.0 - ts-api-utils: 1.3.0(typescript@5.4.3) - typescript: 5.4.3 + ts-api-utils: 1.3.0(typescript@5.2.2) + typescript: 5.2.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.3): + /@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.2.2): resolution: {integrity: sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1727,11 +1721,11 @@ packages: dependencies: '@typescript-eslint/scope-manager': 6.21.0 '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.3) + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.2.2) '@typescript-eslint/visitor-keys': 6.21.0 debug: 4.3.4 eslint: 8.57.0 - typescript: 5.4.3 + typescript: 5.2.2 transitivePeerDependencies: - supports-color dev: true @@ -1744,7 +1738,7 @@ packages: '@typescript-eslint/visitor-keys': 6.21.0 dev: true - /@typescript-eslint/type-utils@6.21.0(eslint@8.57.0)(typescript@5.4.3): + /@typescript-eslint/type-utils@6.21.0(eslint@8.57.0)(typescript@5.2.2): resolution: {integrity: sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1754,12 +1748,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.3) - '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.2.2) + '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.2.2) debug: 4.3.4 eslint: 8.57.0 - ts-api-utils: 1.3.0(typescript@5.4.3) - typescript: 5.4.3 + ts-api-utils: 1.3.0(typescript@5.2.2) + typescript: 5.2.2 transitivePeerDependencies: - supports-color dev: true @@ -1769,7 +1763,7 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.3): + /@typescript-eslint/typescript-estree@6.21.0(typescript@5.2.2): resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1785,13 +1779,13 @@ packages: is-glob: 4.0.3 minimatch: 9.0.3 semver: 7.6.0 - ts-api-utils: 1.3.0(typescript@5.4.3) - typescript: 5.4.3 + ts-api-utils: 1.3.0(typescript@5.2.2) + typescript: 5.2.2 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@6.21.0(eslint@8.57.0)(typescript@5.4.3): + /@typescript-eslint/utils@6.21.0(eslint@8.57.0)(typescript@5.2.2): resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: @@ -1802,7 +1796,7 @@ packages: '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 6.21.0 '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.3) + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.2.2) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1833,7 +1827,7 @@ packages: '@babel/plugin-transform-typescript': 7.23.6(@babel/core@7.24.1) '@vue/babel-plugin-jsx': 1.2.2(@babel/core@7.24.1) vite: 5.2.2(@types/node@20.5.1)(sass@1.71.1) - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) transitivePeerDependencies: - supports-color dev: true @@ -1846,7 +1840,7 @@ packages: vue: ^3.2.25 dependencies: vite: 5.2.2(@types/node@20.5.1)(sass@1.71.1) - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) dev: true /@vitest/expect@1.4.0: @@ -2024,7 +2018,7 @@ packages: - '@types/eslint' dev: true - /@vue/eslint-config-typescript@12.0.0(eslint-plugin-vue@9.19.2)(eslint@8.57.0)(typescript@5.4.3): + /@vue/eslint-config-typescript@12.0.0(eslint-plugin-vue@9.19.2)(eslint@8.57.0)(typescript@5.2.2): resolution: {integrity: sha512-StxLFet2Qe97T8+7L8pGlhYBBr8Eg05LPuTDVopQV6il+SK6qqom59BA/rcFipUef2jD8P2X44Vd8tMFytfvlg==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: @@ -2035,17 +2029,17 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.4.3) - '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2) eslint: 8.57.0 eslint-plugin-vue: 9.19.2(eslint@8.57.0) - typescript: 5.4.3 + typescript: 5.2.2 vue-eslint-parser: 9.3.2(eslint@8.57.0) transitivePeerDependencies: - supports-color dev: true - /@vue/language-core@1.8.27(typescript@5.4.3): + /@vue/language-core@1.8.27(typescript@5.2.2): resolution: {integrity: sha512-L8Kc27VdQserNaCUNiSFdDl9LWT24ly8Hpwf1ECy3aFb9m6bDhBGQYOujDm21N7EW3moKIOKEanQwe1q5BK+mA==} peerDependencies: typescript: '*' @@ -2061,7 +2055,7 @@ packages: minimatch: 9.0.3 muggle-string: 0.3.1 path-browserify: 1.0.1 - typescript: 5.4.3 + typescript: 5.2.2 vue-template-compiler: 2.7.16 dev: true @@ -2090,7 +2084,7 @@ packages: dependencies: '@vue/compiler-ssr': 3.4.21 '@vue/shared': 3.4.21 - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) /@vue/shared@3.4.21: resolution: {integrity: sha512-PuJe7vDIi6VYSinuEbUIQgMIRZGgM8e4R+G+/dQTk0X1NEdvgvvgv7m+rfmDH1gZzyA1OjjoWskvHlfRNfQf3g==} @@ -2105,7 +2099,7 @@ packages: optional: true dependencies: js-beautify: 1.14.11 - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) vue-component-type-helpers: 1.8.26 dev: true @@ -3037,7 +3031,7 @@ packages: vary: 1.1.2 dev: true - /cosmiconfig-typescript-loader@4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6)(ts-node@10.9.2)(typescript@5.4.3): + /cosmiconfig-typescript-loader@4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6)(ts-node@10.9.2)(typescript@5.2.2): resolution: {integrity: sha512-BabizFdC3wBHhbI4kJh0VkQP9GkBfoHPydD0COMce1nJ1kJAB3F2TmJ/I7diULBKtmEWSwEbuN/KDtgnmUUVmw==} engines: {node: '>=v14.21.3'} peerDependencies: @@ -3047,9 +3041,9 @@ packages: typescript: '>=4' dependencies: '@types/node': 20.5.1 - cosmiconfig: 8.3.6(typescript@5.4.3) - ts-node: 10.9.2(@types/node@20.5.1)(typescript@5.4.3) - typescript: 5.4.3 + cosmiconfig: 8.3.6(typescript@5.2.2) + ts-node: 10.9.2(@types/node@20.5.1)(typescript@5.2.2) + typescript: 5.2.2 dev: true /cosmiconfig@7.1.0: @@ -3063,7 +3057,7 @@ packages: yaml: 1.10.2 dev: true - /cosmiconfig@8.3.6(typescript@5.4.3): + /cosmiconfig@8.3.6(typescript@5.2.2): resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==} engines: {node: '>=14'} peerDependencies: @@ -3076,7 +3070,7 @@ packages: js-yaml: 4.1.0 parse-json: 5.2.0 path-type: 4.0.0 - typescript: 5.4.3 + typescript: 5.2.2 dev: true /create-require@1.1.1: @@ -3862,7 +3856,7 @@ packages: eslint: 8.57.0 dev: true - /eslint-config-standard-with-typescript@43.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)(typescript@5.4.3): + /eslint-config-standard-with-typescript@43.0.0(@typescript-eslint/eslint-plugin@6.21.0)(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0)(typescript@5.2.2): resolution: {integrity: sha512-AT0qK01M5bmsWiE3UZvaQO5da1y1n6uQckAKqGNe6zPW5IOzgMLXZxw77nnFm+C11nxAZXsCPrbsgJhSrGfX6Q==} peerDependencies: '@typescript-eslint/eslint-plugin': ^6.4.0 @@ -3872,14 +3866,14 @@ packages: eslint-plugin-promise: ^6.0.0 typescript: '*' dependencies: - '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.4.3) - '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.2.2) + '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2) eslint: 8.57.0 eslint-config-standard: 17.1.0(eslint-plugin-import@2.29.1)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint@8.57.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint@8.57.0) eslint-plugin-n: 16.6.2(eslint@8.57.0) eslint-plugin-promise: 6.1.1(eslint@8.57.0) - typescript: 5.4.3 + typescript: 5.2.2 transitivePeerDependencies: - supports-color dev: true @@ -3930,7 +3924,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2) debug: 3.2.7 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 @@ -3960,7 +3954,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2) array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 array.prototype.flat: 1.3.2 @@ -5942,7 +5936,7 @@ packages: treemate: 0.3.11 vdirs: 0.1.8(vue@3.4.21) vooks: 0.2.12(vue@3.4.21) - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) vueuc: 0.4.58(vue@3.4.21) dev: false @@ -6359,10 +6353,10 @@ packages: peerDependencies: pinia: ^2.0.0 dependencies: - pinia: 2.1.7(typescript@5.4.3)(vue@3.4.21) + pinia: 2.1.7(typescript@5.2.2)(vue@3.4.21) dev: false - /pinia@2.1.7(typescript@5.4.3)(vue@3.4.21): + /pinia@2.1.7(typescript@5.2.2)(vue@3.4.21): resolution: {integrity: sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==} peerDependencies: '@vue/composition-api': ^1.4.0 @@ -6375,8 +6369,8 @@ packages: optional: true dependencies: '@vue/devtools-api': 6.6.1 - typescript: 5.4.3 - vue: 3.4.21(typescript@5.4.3) + typescript: 5.2.2 + vue: 3.4.21(typescript@5.2.2) vue-demi: 0.14.6(vue@3.4.21) dev: false @@ -7504,16 +7498,16 @@ packages: engines: {node: '>=8'} dev: true - /ts-api-utils@1.3.0(typescript@5.4.3): + /ts-api-utils@1.3.0(typescript@5.2.2): resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} engines: {node: '>=16'} peerDependencies: typescript: '>=4.2.0' dependencies: - typescript: 5.4.3 + typescript: 5.2.2 dev: true - /ts-node@10.9.2(@types/node@20.5.1)(typescript@5.4.3): + /ts-node@10.9.2(@types/node@20.5.1)(typescript@5.2.2): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -7539,12 +7533,12 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.4.3 + typescript: 5.2.2 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true - /tsconfck@3.0.3(typescript@5.4.3): + /tsconfck@3.0.3(typescript@5.2.2): resolution: {integrity: sha512-4t0noZX9t6GcPTfBAbIbbIU4pfpCwh0ueq3S4O/5qXI1VwK1outmxhe9dOiEWqMz3MW2LKgDTpqWV+37IWuVbA==} engines: {node: ^18 || >=20} hasBin: true @@ -7554,7 +7548,7 @@ packages: typescript: optional: true dependencies: - typescript: 5.4.3 + typescript: 5.2.2 dev: true /tsconfig-paths@3.15.0: @@ -7668,8 +7662,8 @@ packages: possible-typed-array-names: 1.0.0 dev: true - /typescript@5.4.3: - resolution: {integrity: sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==} + /typescript@5.2.2: + resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} engines: {node: '>=14.17'} hasBin: true @@ -7783,7 +7777,7 @@ packages: minimatch: 9.0.3 resolve: 1.22.8 unplugin: 1.10.0 - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) transitivePeerDependencies: - rollup - supports-color @@ -7870,7 +7864,7 @@ packages: vue: ^3.0.11 dependencies: evtd: 0.2.4 - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) dev: false /vite-bundle-analyzer@0.8.1: @@ -8051,7 +8045,7 @@ packages: svgo: 3.1.0 dev: true - /vite-tsconfig-paths@4.3.2(typescript@5.4.3)(vite@5.2.2): + /vite-tsconfig-paths@4.3.2(typescript@5.2.2)(vite@5.2.2): resolution: {integrity: sha512-0Vd/a6po6Q+86rPlntHye7F31zA2URZMbH8M3saAZ/xR9QoGN/L21bxEGfXdWmFdNkqPpRdxFT7nmNe12e9/uA==} peerDependencies: vite: '*' @@ -8061,7 +8055,7 @@ packages: dependencies: debug: 4.3.4 globrex: 0.1.2 - tsconfck: 3.0.3(typescript@5.4.3) + tsconfck: 3.0.3(typescript@5.2.2) vite: 5.2.2(@types/node@20.5.1)(sass@1.71.1) transitivePeerDependencies: - supports-color @@ -8169,7 +8163,7 @@ packages: vue: ^3.0.0 dependencies: evtd: 0.2.4 - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) dev: false /vue-component-type-helpers@1.8.26: @@ -8188,7 +8182,7 @@ packages: '@vue/composition-api': optional: true dependencies: - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) dev: false /vue-demi@0.14.7(vue@3.4.21): @@ -8203,7 +8197,7 @@ packages: '@vue/composition-api': optional: true dependencies: - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) /vue-eslint-parser@9.3.2(eslint@8.57.0): resolution: {integrity: sha512-q7tWyCVaV9f8iQyIA5Mkj/S6AoJ9KBN8IeUSf3XEmBrOtxOZnfTg5s4KClbZBCK3GtnT/+RyCLZyDHuZwTuBjg==} @@ -8235,7 +8229,7 @@ packages: qs: 6.12.0 query-string: 7.1.3 screenfull: 5.2.0 - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) /vue-i18n@9.9.0(vue@3.4.21): resolution: {integrity: sha512-xQ5SxszUAqK5n84N+uUyHH/PiQl9xZ24FOxyAaNonmOQgXeN+rD9z/6DStOpOxNFQn4Cgcquot05gZc+CdOujA==} @@ -8246,7 +8240,7 @@ packages: '@intlify/core-base': 9.9.0 '@intlify/shared': 9.9.0 '@vue/devtools-api': 6.6.1 - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) /vue-router@4.3.0(vue@3.4.21): resolution: {integrity: sha512-dqUcs8tUeG+ssgWhcPbjHvazML16Oga5w34uCUmsk7i0BcnskoLGwjpa15fqMr2Fa5JgVBrdL2MEgqz6XZ/6IQ==} @@ -8254,7 +8248,7 @@ packages: vue: ^3.2.0 dependencies: '@vue/devtools-api': 6.6.1 - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) dev: false /vue-template-compiler@2.7.16: @@ -8264,19 +8258,19 @@ packages: he: 1.2.0 dev: true - /vue-tsc@1.8.27(typescript@5.4.3): + /vue-tsc@1.8.27(typescript@5.2.2): resolution: {integrity: sha512-WesKCAZCRAbmmhuGl3+VrdWItEvfoFIPXOvUJkjULi+x+6G/Dy69yO3TBRJDr9eUlmsNAwVmxsNZxvHKzbkKdg==} hasBin: true peerDependencies: typescript: '*' dependencies: '@volar/typescript': 1.11.1 - '@vue/language-core': 1.8.27(typescript@5.4.3) + '@vue/language-core': 1.8.27(typescript@5.2.2) semver: 7.6.0 - typescript: 5.4.3 + typescript: 5.2.2 dev: true - /vue@3.4.21(typescript@5.4.3): + /vue@3.4.21(typescript@5.2.2): resolution: {integrity: sha512-5hjyV/jLEIKD/jYl4cavMcnzKwjMKohureP8ejn3hhEjwhWIhWeuzL2kJAjzl/WyVsgPY56Sy4Z40C3lVshxXA==} peerDependencies: typescript: '*' @@ -8289,7 +8283,7 @@ packages: '@vue/runtime-dom': 3.4.21 '@vue/server-renderer': 3.4.21(vue@3.4.21) '@vue/shared': 3.4.21 - typescript: 5.4.3 + typescript: 5.2.2 /vueuc@0.4.58(vue@3.4.21): resolution: {integrity: sha512-Wnj/N8WbPRSxSt+9ji1jtDHPzda5h2OH/0sFBhvdxDRuyCZbjGg3/cKMaKqEoe+dErTexG2R+i6Q8S/Toq1MYg==} @@ -8303,7 +8297,7 @@ packages: seemly: 0.3.8 vdirs: 0.1.8(vue@3.4.21) vooks: 0.2.12(vue@3.4.21) - vue: 3.4.21(typescript@5.4.3) + vue: 3.4.21(typescript@5.2.2) dev: false /webidl-conversions@3.0.1: diff --git a/src/app-components/app/AppAvatar/index.tsx b/src/app-components/app/AppAvatar/index.tsx index 6d018b3c..419a0e34 100644 --- a/src/app-components/app/AppAvatar/index.tsx +++ b/src/app-components/app/AppAvatar/index.tsx @@ -27,7 +27,7 @@ import { getStorage } from '@/utils' import type { PropType } from 'vue' import type { AvatarProps, SpaceProps } from 'naive-ui' -import type { SigningCallback } from '@/store/modules/signing/type' +import type { SigningCallback } from '@/store/modules/signing/types' const AppAvatar = defineComponent({ name: 'AppAvatar', diff --git a/src/app-components/provider/AppStyleProvider/index.tsx b/src/app-components/provider/AppStyleProvider/index.tsx index cd2c7cff..c59f4815 100644 --- a/src/app-components/provider/AppStyleProvider/index.tsx +++ b/src/app-components/provider/AppStyleProvider/index.tsx @@ -20,7 +20,7 @@ import { import { useSettingGetters } from '@/store' import { APP_CATCH_KEY } from '@/app-config' -import type { SettingState } from '@/store/modules/setting/type' +import type { SettingState } from '@/store/modules/setting/types' export default defineComponent({ name: 'AppStyleProvider', diff --git a/src/hooks/template/useAppRoot.ts b/src/hooks/template/useAppRoot.ts index cdccca40..4c1a257c 100644 --- a/src/hooks/template/useAppRoot.ts +++ b/src/hooks/template/useAppRoot.ts @@ -11,7 +11,7 @@ import { useSettingGetters, useSettingActions } from '@/store' -import type { AppRootRoute } from '@/store/modules/setting/type' +import type { AppRootRoute } from '@/store/modules/setting/types' export function useAppRoot() { const { getAppRootRoute } = useSettingGetters() @@ -19,17 +19,20 @@ export function useAppRoot() { /** * - * @remark 获取根路由 + * @description + * 获取根路由。 */ const getRootRoute = getAppRootRoute /** * - * @remark 获取根路由 path + * @description + * 获取根路由 path。 */ const getRootPath = computed(() => getAppRootRoute.value.path) /** * - * @remark 获取根路由 name + * @description + * 获取根路由 name。 */ const getRootName = computed(() => getAppRootRoute.value.name) @@ -37,7 +40,8 @@ export function useAppRoot() { * * @param route 根路由配置内容 * - * 设置根路由 + * @description + * 设置根路由。 * * @example * setRootRoute({ path: '/your root path', name: 'your root name' }) diff --git a/src/hooks/web/useElementFullscreen.ts b/src/hooks/web/useElementFullscreen.ts index 171d00da..c3325456 100644 --- a/src/hooks/web/useElementFullscreen.ts +++ b/src/hooks/web/useElementFullscreen.ts @@ -55,7 +55,7 @@ export interface UseElementFullscreenOptions { let currentZIndex = 999 let isAppend = false const ID_TAG = 'ELEMENT-FULLSCREEN-RAY' -const { height } = useWindowSize() // 获取实际高度避免 100vh 会导致手机端浏览器获取不准确问题 +const { width, height } = useWindowSize() // 获取实际高度避免 100vh 会导致手机端浏览器获取不准确问题 const styleElement = document.createElement('style') /** @@ -107,7 +107,7 @@ export const useElementFullscreen = ( const cssContent = ` [${ID_TAG}] { position: fixed; - width: 100% !important; + width: ${width.value}px !important; height: ${height.value}px !important; transform: translate(-${left}px, -${top}px) !important; transition: all 0.3s var(--r-bezier); @@ -163,6 +163,8 @@ export const useElementFullscreen = ( const element = unrefElement(target) if (element) { + ;(element as HTMLElement).style.transition = cacheStyle.transition ?? '' + element.removeAttribute(ID_TAG) } @@ -181,7 +183,7 @@ export const useElementFullscreen = ( } } - const stopWatch = watch(() => height.value, updateStyle) + const stopWatch = watch(() => [width.value, height.value], updateStyle) effectDispose(() => { const element = unrefElement(target) as HTMLElement | null diff --git a/src/router/utils/routerCopilot.ts b/src/router/utils/routerCopilot.ts index 41fbfd34..8123ca26 100644 --- a/src/router/utils/routerCopilot.ts +++ b/src/router/utils/routerCopilot.ts @@ -89,15 +89,15 @@ export const validMenuItemShow = (option: AppMenuOption) => { */ export const setupRouterLoadingBar = (router: Router) => { router.beforeEach(() => { - window?.$loadingBar.start() + window.$loadingBar?.start() }) router.afterEach(() => { - window?.$loadingBar.finish() + window.$loadingBar?.finish() }) router.onError(() => { - window?.$loadingBar.error() + window.$loadingBar?.error() }) } diff --git a/src/store/modules/keep-alive/index.ts b/src/store/modules/keep-alive/index.ts index 4feaf379..955194dc 100644 --- a/src/store/modules/keep-alive/index.ts +++ b/src/store/modules/keep-alive/index.ts @@ -21,7 +21,7 @@ import { APP_KEEP_ALIVE } from '@/app-config' import { APP_CATCH_KEY } from '@/app-config' -import type { KeepAliveStoreState } from './type' +import type { KeepAliveStoreState } from './types' import type { AppMenuOption } from '@/types' export const piniaKeepAliveStore = defineStore( diff --git a/src/store/modules/keep-alive/type.ts b/src/store/modules/keep-alive/types.ts similarity index 100% rename from src/store/modules/keep-alive/type.ts rename to src/store/modules/keep-alive/types.ts diff --git a/src/store/modules/menu/index.ts b/src/store/modules/menu/index.ts index 6d344ea9..cf452454 100644 --- a/src/store/modules/menu/index.ts +++ b/src/store/modules/menu/index.ts @@ -40,7 +40,7 @@ import { useKeepAliveActions } from '@/store' import { APP_CATCH_KEY } from '@/app-config' import type { AppMenuOption, MenuTagOptions } from '@/types' -import type { MenuState } from '@/store/modules/menu/type' +import type { MenuState } from '@/store/modules/menu/types' import type { LocationQuery } from 'vue-router' let cachePreNormal: AppMenuOption | undefined = void 0 diff --git a/src/store/modules/menu/type.ts b/src/store/modules/menu/types.ts similarity index 100% rename from src/store/modules/menu/type.ts rename to src/store/modules/menu/types.ts diff --git a/src/store/modules/setting/index.ts b/src/store/modules/setting/index.ts index d350b851..a9fac584 100644 --- a/src/store/modules/setting/index.ts +++ b/src/store/modules/setting/index.ts @@ -4,7 +4,7 @@ import { useI18n, useDayjs } from '@/hooks' import { watchOnce } from '@vueuse/core' import { APP_CATCH_KEY, APP_THEME } from '@/app-config' -import type { SettingState } from '@/store/modules/setting/type' +import type { SettingState } from '@/store/modules/setting/types' import type { LocalKey } from '@/hooks' import type { AnyFC } from '@/types' @@ -26,7 +26,7 @@ export const piniaSettingStore = defineStore( primaryColorPressed: primaryColor, }, }, - appTheme: false, // `true` 为黑夜主题, `false` 为白色主题 + appTheme: false, // true 为黑夜主题, false 为明亮主题 menuTagSwitch: true, // 多标签页开关 breadcrumbSwitch: true, // 面包屑开关 localeLanguage: getAppDefaultLanguage(), diff --git a/src/store/modules/setting/type.ts b/src/store/modules/setting/types.ts similarity index 100% rename from src/store/modules/setting/type.ts rename to src/store/modules/setting/types.ts diff --git a/src/store/modules/signing/index.ts b/src/store/modules/signing/index.ts index c121dfb0..fe6b8c78 100644 --- a/src/store/modules/signing/index.ts +++ b/src/store/modules/signing/index.ts @@ -27,7 +27,7 @@ import type { SigningForm, SigningCallback, SigningResponse, -} from '@/store/modules/signing/type' +} from '@/store/modules/signing/types' export const piniaSigningStore = defineStore( 'signing', diff --git a/src/store/modules/signing/type.ts b/src/store/modules/signing/types.ts similarity index 100% rename from src/store/modules/signing/type.ts rename to src/store/modules/signing/types.ts diff --git a/vitest.config.ts b/vitest.config.ts index 88e16e8e..e7713ec1 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -9,7 +9,7 @@ export default defineConfig((configEnv) => defineConfig({ plugins: [tsconfigPaths()], test: { - include: ['**/__test__/**/*'], + include: ['**/__test__/**/*.(spec).(ts|tsx)'], exclude: [ ...configDefaults.exclude, '**/src/**',