Skip to content

Commit 252a0e2

Browse files
committed
docs: clean up GlobalConfig type definition by moving it to a separate type file
1 parent bbb7670 commit 252a0e2

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

site/src/App.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
<script lang="ts">
1212
import { computed, defineComponent, provide, watch, ref } from 'vue';
13-
import type { Ref } from 'vue';
1413
import { useRoute } from 'vue-router';
1514
import { useI18n } from 'vue-i18n';
1615
import useMediaQuery from './hooks/useMediaQuery';
@@ -21,16 +20,11 @@ import dayjs from 'dayjs';
2120
import 'dayjs/locale/zh-cn';
2221
import { theme as antdTheme } from 'ant-design-vue';
2322
import SiteToken from './SiteToken.vue';
23+
import type { GlobalConfig } from './type';
2424
function isZhCN(name: string) {
2525
return /-cn\/?$/.test(name);
2626
}
27-
export interface GlobalConfig {
28-
isMobile: Ref<boolean>;
29-
lang: Ref<'zh-CN' | 'en-US'>;
30-
isZhCN: Ref<boolean>;
31-
responsive: Ref<null | 'narrow' | 'crowded'>;
32-
blocked: Ref<boolean>;
33-
}
27+
3428
export type ThemeName = '' | 'light' | 'dark' | 'compact';
3529
const getAlgorithm = (themes: ThemeName[] = []) =>
3630
themes

site/src/layouts/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
</div>
109109
</template>
110110
<script lang="ts">
111-
import type { GlobalConfig } from '../App.vue';
112111
import { GLOBAL_CONFIG } from '../SymbolKey';
113112
import { defineComponent, inject, computed, ref, provide, watch } from 'vue';
114113
import { useRoute } from 'vue-router';
@@ -129,6 +128,7 @@ import CompactIcon from './icons/Compact';
129128
import surelyVueVue from '../components/surelyVue.vue';
130129
import WWAdsVue from '../components/rice/WWAds.vue';
131130
import { useWindowScroll } from '@vueuse/core';
131+
import type { GlobalConfig } from '../type';
132132
133133
const rControl = /[\u0000-\u001f]/g;
134134
const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'<>,.?/]+/g;

site/src/type.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { Ref } from 'vue';
2+
export interface GlobalConfig {
3+
isMobile: Ref<boolean>;
4+
lang: Ref<'zh-CN' | 'en-US'>;
5+
isZhCN: Ref<boolean>;
6+
responsive: Ref<null | 'narrow' | 'crowded'>;
7+
blocked: Ref<boolean>;
8+
}

0 commit comments

Comments
 (0)