Skip to content

Commit

Permalink
chore: tweak types (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope authored Dec 29, 2024
1 parent 764a18c commit c43174a
Show file tree
Hide file tree
Showing 46 changed files with 74 additions and 109 deletions.
2 changes: 1 addition & 1 deletion docs/plugins/blog/comment/waline/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@

```ts
interface WalineLocales {
[localePath: string]: WalineLocale
[localePath: string]: Partial<WalineLocale>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/development/reading-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const readingTimeLocale = useReadingTimeLocale() // { time: "1 minute", words: "
}

interface ReadingTimePluginLocaleConfig {
[localePath: string]: ReadingTimePluginLocaleData
[localePath: string]: Partial<ReadingTimePluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/features/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Project with order -1
}

interface CatalogPluginLocaleConfig {
[localePath: string]: CatalogPluginLocaleData
[localePath: string]: Partial<CatalogPluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/features/copy-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default {
}

interface CopyCodePluginLocaleConfig {
[localePath: string]: CopyCodePluginLocaleData
[localePath: string]: Partial<CopyCodePluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/features/copyright.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ So copyright message triggered on another site also points to your preferred sit
}

interface CopyrightPluginLocaleConfig {
[localePath: string]: CopyrightPluginLocaleData
[localePath: string]: Partial<CopyrightPluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/features/photo-swipe.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ In preview mode, you can:
}

interface PhotoSwipePluginLocaleConfig {
[localePath: string]: PhotoSwipePluginLocaleData
[localePath: string]: Partial<PhotoSwipePluginLocaleData>
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/plugins/markdown/markdown-hint.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ The plugin also provides an `alert` option to support gfm alerts:

### locales

- Type: `MarkdownHintPluginLocaleOptions`
- Type: `MarkdownHintPluginLocaleConfig`

```ts
interface MarkdownHintPluginLocaleOptions {
[localePath: string]: MarkdownHintPluginLocaleData
interface MarkdownHintPluginLocaleConfig {
[localePath: string]: Partial<MarkdownHintPluginLocaleData>
}

interface MarkdownHintPluginLocaleData {
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/pwa/pwa/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Special settings for better supporting Safari, ignoring these options are safe.
}

interface PwaPluginLocaleConfig {
[localePath: string]: PwaPluginLocaleData
[localePath: string]: Partial<PwaPluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/tools/redirect.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ By default, the plugin will output to `.vuepress/redirect` directory under sourc
}

interface RedirectPluginLocaleConfig {
[localePath: string]: RedirectPluginLocaleData
[localePath: string]: Partial<RedirectPluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/blog/comment/waline/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@

```ts
interface WalineLocales {
[localePath: string]: WalineLocale
[localePath: string]: Partial<WalineLocale>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/development/reading-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const readingTimeLocale = useReadingTimeLocale() // { time: "1 分钟", words: "
}

interface ReadingTimePluginLocaleConfig {
[localePath: string]: ReadingTimePluginLocaleData
[localePath: string]: Partial<ReadingTimePluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/features/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ order -1 的项目
}

interface CatalogPluginLocaleConfig {
[localePath: string]: CatalogPluginLocaleData
[localePath: string]: Partial<CatalogPluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/features/copy-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default {
}

interface CopyCodePluginLocaleConfig {
[localePath: string]: CopyCodePluginLocaleData
[localePath: string]: Partial<CopyCodePluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/features/copyright.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default {
}

interface CopyrightPluginLocaleConfig {
[localePath: string]: CopyrightPluginLocaleData
[localePath: string]: Partial<CopyrightPluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/features/photo-swipe.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default {
}

interface PhotoSwipePluginLocaleConfig {
[localePath: string]: PhotoSwipePluginLocaleData
[localePath: string]: Partial<PhotoSwipePluginLocaleData>
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/zh/plugins/markdown/markdown-hint.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ const a = 1

### locales

- 类型:`MarkdownHintPluginLocaleOptions`
- 类型:`MarkdownHintPluginLocaleConfig`

```ts
interface MarkdownHintPluginLocaleOptions {
[localePath: string]: MarkdownHintPluginLocaleData
interface MarkdownHintPluginLocaleConfig {
[localePath: string]: Partial<MarkdownHintPluginLocaleData>
}

interface MarkdownHintPluginLocaleData {
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/pwa/pwa/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
}

interface PwaPluginLocaleConfig {
[localePath: string]: PwaPluginLocaleData
[localePath: string]: Partial<PwaPluginLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/search/slimsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ export default defineUserConfig({
}

interface SlimSearchLocaleConfig {
[localePath: string]: SlimSearchLocaleData
[localePath: string]: Partial<SlimSearchLocaleData>
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/plugins/tools/redirect.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Options:
}

interface RedirectPluginLocaleConfig {
[localePath: string]: RedirectPluginLocaleData
[localePath: string]: Partial<RedirectPluginLocaleData>
}
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ExactLocaleConfig } from '@vuepress/helper/client'
import { LoadingIcon, useLocaleConfig, wait } from '@vuepress/helper/client'
import { watchImmediate } from '@vueuse/core'
import { pageviewCount } from '@waline/client/pageview'
Expand All @@ -13,15 +14,15 @@ import {
import { usePageFrontmatter, usePageLang } from 'vuepress/client'
import type {
CommentPluginFrontmatter,
WalineLocaleConfig,
WalineLocaleData,
} from '../../shared/index.js'
import { useWalineOptions } from '../helpers/index.js'

import '@waline/client/waline.css'
import '../styles/waline.css'

declare const WALINE_META: boolean
declare const WALINE_LOCALES: WalineLocaleConfig
declare const WALINE_LOCALES: ExactLocaleConfig<WalineLocaleData>

const walineLocales = WALINE_LOCALES

Expand Down
3 changes: 0 additions & 3 deletions plugins/blog/plugin-comment/src/shared/options/waline.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import type { ExactLocaleConfig } from '@vuepress/helper'
import type { WalineInitOptions, WalineLocale } from '@waline/client'
import type { BaseCommentPluginOptions } from './base.js'

export type WalineLocaleData = Partial<WalineLocale>

export type WalineLocaleConfig = ExactLocaleConfig<WalineLocaleData>

export interface WalineOptions
extends BaseCommentPluginOptions,
Omit<WalineInitOptions, 'comment' | 'el' | 'locale'> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import type { ExactLocaleConfig } from '@vuepress/helper/client'
import { useLocaleConfig } from '@vuepress/helper/client'
import type { ComputedRef } from 'vue'
import { computed } from 'vue'
import type {
ReadingTimePluginLocaleConfig,
ReadingTimePluginLocaleData,
} from '../../shared/index.js'
import type { ReadingTimePluginLocaleData } from '../../shared/index.js'
import { getReadingTimeLocale } from '../utils/index.js'
import { useReadingTimeData } from './useReadingTimeData.js'

declare const __READING_TIME_LOCALES__:
| ReadingTimePluginLocaleConfig
| ExactLocaleConfig<ReadingTimePluginLocaleData>
| undefined

const DEFAULT_LOCALE = { words: '', time: '' }
Expand Down
5 changes: 0 additions & 5 deletions plugins/development/plugin-reading-time/src/shared/locales.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ExactLocaleConfig } from '@vuepress/helper/shared'

/**
* Multi language config for `@vuepress/plugin-reading-time` plugin
*
Expand Down Expand Up @@ -27,6 +25,3 @@ export interface ReadingTimePluginLocaleData {
*/
time: string
}

export type ReadingTimePluginLocaleConfig =
ExactLocaleConfig<ReadingTimePluginLocaleData>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ExactLocaleConfig } from '@vuepress/helper/client'
import { useLocaleConfig } from '@vuepress/helper/client'
import { useElementSize, useWindowScroll, useWindowSize } from '@vueuse/core'
import {
Expand All @@ -9,11 +10,11 @@ import {
shallowRef,
} from 'vue'
import { usePageFrontmatter } from 'vuepress/client'
import type { BackToTopPluginLocaleConfig } from '../../shared/index.js'
import type { BackToTopPluginLocaleData } from '../../shared/index.js'

import '../styles/back-to-top.css'

declare const __BACK_TO_TOP_LOCALES__: BackToTopPluginLocaleConfig
declare const __BACK_TO_TOP_LOCALES__: ExactLocaleConfig<BackToTopPluginLocaleData>
declare const __BACK_TO_TOP_PROGRESS__: boolean
declare const __BACK_TO_TOP_THRESHOLD__: number

Expand Down
5 changes: 0 additions & 5 deletions plugins/features/plugin-back-to-top/src/shared/locales.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ExactLocaleConfig } from '@vuepress/helper/shared'

export interface BackToTopPluginLocaleData {
/**
* Back to top button label text
Expand All @@ -8,6 +6,3 @@ export interface BackToTopPluginLocaleData {
*/
backToTop: string
}

export type BackToTopPluginLocaleConfig =
ExactLocaleConfig<BackToTopPluginLocaleData>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-shadow */
import type { ExactLocaleConfig } from '@vuepress/helper/client'
import {
endsWith,
ensureEndingSlash,
Expand All @@ -14,13 +15,13 @@ import {
import type { VNode } from 'vue'
import { computed, defineComponent, h, shallowRef } from 'vue'
import { RouteLink, usePageData, useRoutes, useSiteData } from 'vuepress/client'
import type { CatalogPluginLocaleConfig } from '../../shared/index.js'
import type { CatalogPluginLocaleData } from '../../shared/index.js'
import type { CatalogInfo } from '../helpers/index.js'
import { useCatalogInfoGetter } from '../helpers/index.js'

import '../styles/catalog.css'

declare const __CATALOG_LOCALES__: CatalogPluginLocaleConfig
declare const __CATALOG_LOCALES__: ExactLocaleConfig<CatalogPluginLocaleData>

export interface CatalogProps {
base?: string
Expand Down
5 changes: 0 additions & 5 deletions plugins/features/plugin-catalog/src/shared/locales.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ExactLocaleConfig } from '@vuepress/helper'

export interface CatalogPluginLocaleData {
/**
* Catalog title text
Expand All @@ -15,6 +13,3 @@ export interface CatalogPluginLocaleData {
*/
empty: string
}

export type CatalogPluginLocaleConfig =
ExactLocaleConfig<CatalogPluginLocaleData>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@vueuse/core'
import { computed, nextTick } from 'vue'
import { usePageData } from 'vuepress/client'
import type { CopyCodePluginLocaleConfig } from '../../shared/index.js'
import type { CopyCodePluginLocaleConfig } from '../types.js'

import '../styles/copy-code.css'
import '../styles/vars.css'
Expand Down
2 changes: 1 addition & 1 deletion plugins/features/plugin-copy-code/src/client/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineClientConfig } from 'vuepress/client'
import type { CopyCodePluginLocaleConfig } from '../shared/index.js'
import { useCopyCode } from './composables/index.js'
import type { CopyCodePluginLocaleConfig } from './types.js'

declare const __CC_DELAY__: number
declare const __CC_DURATION__: number
Expand Down
5 changes: 5 additions & 0 deletions plugins/features/plugin-copy-code/src/client/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { ExactLocaleConfig } from '@vuepress/helper/client'
import type { CopyCodePluginLocaleData } from '../shared/index.js'

export type CopyCodePluginLocaleConfig =
ExactLocaleConfig<CopyCodePluginLocaleData>
5 changes: 0 additions & 5 deletions plugins/features/plugin-copy-code/src/shared/locales.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ExactLocaleConfig } from '@vuepress/helper/shared'

export interface CopyCodePluginLocaleData {
/**
* Copy text
Expand All @@ -15,6 +13,3 @@ export interface CopyCodePluginLocaleData {
*/
copied: string
}

export type CopyCodePluginLocaleConfig =
ExactLocaleConfig<CopyCodePluginLocaleData>
5 changes: 0 additions & 5 deletions plugins/features/plugin-copyright/src/shared/locales.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ExactLocaleConfig } from '@vuepress/helper'

export interface CopyrightPluginLocaleData {
/**
* Author text
Expand Down Expand Up @@ -34,6 +32,3 @@ export interface CopyrightPluginLocaleData {
*/
link: string
}

export type CopyrightPluginLocaleConfig =
ExactLocaleConfig<CopyrightPluginLocaleData>
5 changes: 0 additions & 5 deletions plugins/features/plugin-photo-swipe/src/shared/locales.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ExactLocaleConfig } from '@vuepress/helper'

export interface PhotoSwipePluginLocaleData {
/**
* Close button label text
Expand Down Expand Up @@ -43,6 +41,3 @@ export interface PhotoSwipePluginLocaleData {
*/
arrowNext: string
}

export type PhotoSwipePluginLocaleConfig =
ExactLocaleConfig<PhotoSwipePluginLocaleData>
Loading

0 comments on commit c43174a

Please sign in to comment.