Skip to content

Commit

Permalink
Merge branch 'main' into plugin-demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 16, 2024
2 parents 78afea7 + 375645f commit c6bd913
Show file tree
Hide file tree
Showing 268 changed files with 4,179 additions and 3,113 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ node_modules/

# Vitest
tsconfig.vitest-temp.json

# Webstorm
.idea
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"[markdown]": {
"files.trimTrailingWhitespace": false
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
"prettier.enable": true,
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.validate": [
"javascript",
Expand Down
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,57 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.0.0-rc.67](https://github.com/vuepress/ecosystem/compare/v2.0.0-rc.66...v2.0.0-rc.67) (2024-12-16)

### Bug Fixes

- fix define getter ([#304](https://github.com/vuepress/ecosystem/issues/304)) ([a11237c](https://github.com/vuepress/ecosystem/commit/a11237cdc2fdfd286e408e43b0e31251f602b1a6))

### Features

- **plugin-slimsearch:** improve default querySplitter, close [#299](https://github.com/vuepress/ecosystem/issues/299) ([715dde1](https://github.com/vuepress/ecosystem/commit/715dde192c94bad49c5e3b0d5a75743b74f5d097))

# [2.0.0-rc.66](https://github.com/vuepress/ecosystem/compare/v2.0.0-rc.65...v2.0.0-rc.66) (2024-12-13)

### Bug Fixes

- **plugin-sass-palette:** fix module injecting ([356e1a2](https://github.com/vuepress/ecosystem/commit/356e1a2b59ee58c8217792cdad2800fc8bfce167))

### Features

- **plugin-pwa:** improve pwa support ([#301](https://github.com/vuepress/ecosystem/issues/301)) ([487d8c4](https://github.com/vuepress/ecosystem/commit/487d8c45a965dee9234e581d95bcc98c1a8cca86))
- **plugin-sass-palette:** support vite6 ([5a081ff](https://github.com/vuepress/ecosystem/commit/5a081fff1d98e137b8ec6f81354d14589950308b))

# [2.0.0-rc.65](https://github.com/vuepress/ecosystem/compare/v2.0.0-rc.64...v2.0.0-rc.65) (2024-12-09)

### Bug Fixes

- **helper:** `.sr-only` clip ([#297](https://github.com/vuepress/ecosystem/issues/297)) ([0c79df6](https://github.com/vuepress/ecosystem/commit/0c79df69d29644e78438e2e92cc17773f915b081))
- **plugin-slimsearch:** fix hotkey without suggestions, close [#298](https://github.com/vuepress/ecosystem/issues/298) ([51373fd](https://github.com/vuepress/ecosystem/commit/51373fd00c05b404ec1da09b6f8046680d0c2317))

# [2.0.0-rc.64](https://github.com/vuepress/ecosystem/compare/v2.0.0-rc.63...v2.0.0-rc.64) (2024-12-07)

### Bug Fixes

- **plugin-docsearch:** fix broken types, close [#296](https://github.com/vuepress/ecosystem/issues/296) ([9b5f904](https://github.com/vuepress/ecosystem/commit/9b5f90452ebe3d179ead3e3fffe28742a168e590))
- **plugin-theme-data:** fix themeLocaleData type ([dbf0e3d](https://github.com/vuepress/ecosystem/commit/dbf0e3d2292acb411a877b1b04f825d351f0dd6d))

# [2.0.0-rc.63](https://github.com/vuepress/ecosystem/compare/v2.0.0-rc.62...v2.0.0-rc.63) (2024-12-06)

**Note:** Version bump only for package @vuepress/ecosystem

# [2.0.0-rc.62](https://github.com/vuepress/ecosystem/compare/v2.0.0-rc.61...v2.0.0-rc.62) (2024-12-06)

### Bug Fixes

- **create-vuepress:** prevent navbar overlap in blog template ([#294](https://github.com/vuepress/ecosystem/issues/294)) ([c806fb8](https://github.com/vuepress/ecosystem/commit/c806fb8ecaf582c030a9c8f90de298473495c4a0))

### Features

- **helper:** add sr-only style ([04b856d](https://github.com/vuepress/ecosystem/commit/04b856deffe8beb3e1b6d42e2a760013eafeea55))
- **plugin-git:** improve commits parsing and optimize plugins ([#292](https://github.com/vuepress/ecosystem/issues/292)) ([a0241c4](https://github.com/vuepress/ecosystem/commit/a0241c4292fc7580c2a5a755d44d7f5df0050e54))
- **plugin-markdown-hint:** add plugin exports ([8e2aafe](https://github.com/vuepress/ecosystem/commit/8e2aafe6a2fdd8eec6bd16e50e2b8b41bba62d4c))

# [2.0.0-rc.61](https://github.com/vuepress/ecosystem/compare/v2.0.0-rc.60...v2.0.0-rc.61) (2024-11-23)

### Features
Expand Down
6 changes: 3 additions & 3 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { readdirSync, statSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { join } from 'node:path'
import { getDirname } from 'vuepress/utils'

const __dirname = dirname(fileURLToPath(import.meta.url))
const __dirname = getDirname(import.meta.url)

const getSubDirectories = (dir: string): string[] =>
readdirSync(dir).filter((item) => statSync(join(dir, item)).isDirectory())
Expand Down
6 changes: 3 additions & 3 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import process from 'node:process'
import { viteBundler } from '@vuepress/bundler-vite'
import { webpackBundler } from '@vuepress/bundler-webpack'
import { getRealPath } from '@vuepress/helper'
import { getModulePath } from '@vuepress/helper'
import { cachePlugin } from '@vuepress/plugin-cache'
import { catalogPlugin } from '@vuepress/plugin-catalog'
import { commentPlugin } from '@vuepress/plugin-comment'
Expand All @@ -22,7 +22,7 @@ import { getDirname, path } from 'vuepress/utils'
import { head } from './configs/index.js'
import theme from './theme.js'

const __dirname = getDirname(import.meta.url)
const __dirname = import.meta.dirname || getDirname(import.meta.url)

const IS_PROD = process.env.NODE_ENV === 'production'

Expand Down Expand Up @@ -61,7 +61,7 @@ export default defineUserConfig({
const realPath = importPath.replace(
packageName,
path.dirname(
getRealPath(`${packageName}/package.json`, import.meta.url),
getModulePath(`${packageName}/package.json`, import.meta),
),
)

Expand Down
3 changes: 0 additions & 3 deletions docs/.vuepress/configs/head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export const head: HeadConfig[] = [
],
['link', { rel: 'manifest', href: '/manifest.webmanifest' }],
['meta', { name: 'application-name', content: 'VuePress' }],
['meta', { name: 'apple-mobile-web-app-title', content: 'VuePress' }],
['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],
[
'link',
{ rel: 'apple-touch-icon', href: `/images/icons/apple-touch-icon.png` },
Expand All @@ -35,6 +33,5 @@ export const head: HeadConfig[] = [
color: '#3eaf7c',
},
],
['meta', { name: 'msapplication-TileColor', content: '#3eaf7c' }],
['meta', { name: 'theme-color', content: '#3eaf7c' }],
]
12 changes: 6 additions & 6 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"docs:serve": "http-server -a localhost .vuepress/dist"
},
"dependencies": {
"@vuepress/bundler-vite": "2.0.0-rc.18",
"@vuepress/bundler-webpack": "2.0.0-rc.18",
"@vuepress/bundler-vite": "2.0.0-rc.19",
"@vuepress/bundler-webpack": "2.0.0-rc.19",
"@vuepress/helper": "workspace:*",
"@vuepress/plugin-back-to-top": "workspace:*",
"@vuepress/plugin-cache": "workspace:*",
Expand All @@ -36,11 +36,11 @@
"@vuepress/plugin-search": "workspace:*",
"@vuepress/plugin-shiki": "workspace:*",
"@vuepress/theme-default": "workspace:*",
"katex": "0.16.11",
"katex": "0.16.15",
"mathjax-full": "3.2.2",
"sass-embedded": "1.81.0",
"sass-loader": "^16.0.3",
"sass-embedded": "1.83.0",
"sass-loader": "^16.0.4",
"vue": "^3.5.13",
"vuepress": "2.0.0-rc.18"
"vuepress": "2.0.0-rc.19"
}
}
40 changes: 0 additions & 40 deletions docs/plugins/features/photo-swipe.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,6 @@ In preview mode, you can:
- Default: `true`
- Details: Whether close the current image when scrolling.

### delay

- Type: `number`
- Default: `800`
- Details:

The delay of operating dom, in ms.

::: tip

If the theme you are using has a switching animation, it is recommended to configure this option to `Switch animation duration + 200`.

:::

### locales

- Type: `PhotoSwipePluginLocaleConfig`
Expand Down Expand Up @@ -254,32 +240,6 @@ onUnmounted(() => {
</template>
```

`registerPhotoSwipe` allows you to register photoswipe for the given image elements:

```vue
<script setup lang="ts">
import { registerPhotoSwipe } from '@vuepress/plugin-photo-swipe/client'
import { onMounted, onUnmounted } from 'vue'
let destroy: () => null | void = null
onMounted(async () => {
await nextTick()
const images = Array.from(document.querySelectorAll('img'))
// create a new photoswipe instance on image elements
destroy = await registerPhotoSwipe(images, {
// photoswipe options
})
})
onUnmounted(() => {
destroy?.()
})
</script>
```

## Styles

You can customize the style via CSS variables:
Expand Down
25 changes: 23 additions & 2 deletions docs/plugins/markdown/revealjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ You can enable the following themes in reveal.js via `themes` in plugin options:

For the appearance of each theme, see [Themes demo](themes.md).

::: important Assets Path

Since markdown contents between `@slidestart` and `@slideend` are handled by Reveal.js at browser, so you can only use absolute paths for assets in slides, which must be accessible directly in browser, relative paths or alias are not supported.

:::

## Slide Layout

By default, the plugin registers a layout named `SlidePage` for you to render "a slides page".
Expand Down Expand Up @@ -156,12 +162,27 @@ You can enable built-in plugins in reveal.js via `plugins` in plugin options. It

You can also import and call `defineRevealJsConfig` in [client config file][client-config] to customize reveal.js:

The `defineRevealJsConfig` function accepts a ref, getter or plain object as reveal.js options:

```js title=".vuepress/client.js"
import { defineRevealJsConfig } from '@vuepress/plugin-revealjs/client'

defineRevealJsConfig({
// reveal.js options here
// plain object
const options1 = {
// options
}

// or getter
const options2 = () => ({
// options
})

// or ref
const options3 = ref({
// options
})

defineRevealJsConfig(options1or2or3)
```

::: note
Expand Down
22 changes: 3 additions & 19 deletions docs/plugins/pwa/pwa/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,31 +146,15 @@ Special settings for better supporting Safari, ignoring these options are safe.
- Type: `string`
- Details: Icon link used by Safari.

#### apple.statusBarColor

- Type: `"black" | "white"`
- Default: `"black"`
- Details: Status bar color for Safari

#### apple.maskIcon

- Type: `string`
- Details: Safari mask icon

### msTile

Special settings for Microsoft tiles, ignoring these options are safe.

#### msTile.image

- Type: `string`
- Details: Tile image

#### msTile.color
#### apple.statusBarColor

- Type: `string`
- Default value: `themeColor`
- Details: Tile color
- Type: `'black-translucent' | 'black' | 'default`
- Details: Status bar color for Safari

### foundComponent

Expand Down
12 changes: 8 additions & 4 deletions docs/plugins/search/docsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,18 @@ export default {
### defineDocSearchConfig

```ts
interface DocSearchClientOptions extends DocSearchProps {
locales?: Record<string, DocSearchProps>
type DocSearchClientLocaleOptions = Partial<DocSearchProps>

interface DocSearchClientOptions extends DocSearchClientLocaleOptions {
locales?: Record<string, DocSearchClientLocaleOptions>
}

const defineDocSearchConfig: (options: DocSearchClientOptions) => void
const defineDocSearchConfig: (
options: MaybeRefOrGetter<DocSearchClientOptions>,
) => void
```
Customize DocSearch options.
Customize DocSearch options, support plain object, ref or getter.
::: warning
Expand Down
6 changes: 5 additions & 1 deletion docs/plugins/search/slimsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ In particular, [DocSearch](https://docsearch.algolia.com/) is a free search serv

### defineSearchConfig

Customize [search options](https://mister-hope.github.io/slimsearch/interfaces/SearchOptions.html).
Customize [search options](https://mister-hope.github.io/slimsearch/interfaces/SearchOptions.html), accepts plain object, ref or getter functions as parameters.

Since searching is done in a Web Worker, setting function-typed options for `slimsearch` is not supported.

Expand Down Expand Up @@ -587,6 +587,10 @@ interface SearchOptions extends SearchLocaleOptions {
/** Setting different options per locale */
locales?: Record<string, SearchLocaleOptions>
}

export const defineSearchConfig: (
options: MaybeRefOrGetter<SearchOptions>,
) => void
```
```ts title=".vuepress/client.ts"
Expand Down
4 changes: 2 additions & 2 deletions docs/plugins/tools/register-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
```ts
import { getDirname, path } from 'vuepress/utils'

const __dirname = getDirname(import.meta.url)
const __dirname = import.meta.dirname || getDirname(import.meta.url)

export default {
plugins: [
Expand Down Expand Up @@ -73,7 +73,7 @@ export default {
```ts
import { getDirname, path } from 'vuepress/utils'

const __dirname = getDirname(import.meta.url)
const __dirname = import.meta.dirname || getDirname(import.meta.url)

export default {
plugins: [
Expand Down
4 changes: 2 additions & 2 deletions docs/themes/default/extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import { defaultTheme } from '@vuepress/theme-default'
import { defineUserConfig } from 'vuepress'
import { getDirname, path } from 'vuepress/utils'

const __dirname = getDirname(import.meta.url)
const __dirname = import.meta.dirname || getDirname(import.meta.url)

export default defineUserConfig({
theme: defaultTheme(),
Expand Down Expand Up @@ -101,7 +101,7 @@ import { defaultTheme } from '@vuepress/theme-default'
import type { Theme } from 'vuepress/core'
import { getDirname, path } from 'vuepress/utils'

const __dirname = getDirname(import.meta.url)
const __dirname = import.meta.dirname || getDirname(import.meta.url)

export const childTheme = (options: DefaultThemeOptions): Theme => ({
name: 'vuepress-theme-child',
Expand Down
2 changes: 2 additions & 0 deletions docs/tools/helper/client.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Client Related

These functions are only available in `@vuepress/helper/client`.

## Composables APIs

### hasGlobalComponent
Expand Down
6 changes: 4 additions & 2 deletions docs/tools/helper/node/bundler.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Bundler Related

Bundler function is for appending or modifying bundler options in theme and plugins.
Bundler functions for appending or modifying bundler options in theme and plugins.

All functions should be called in `extendsBundlerOptions` lifecycle hook.
These functions are only available via `@vuepress/helper`.

::: tip

All functions should be called in `extendsBundlerOptions` lifecycle hook.

We are omitting that in examples. The actual code should be like this:

```js
Expand Down
Loading

0 comments on commit c6bd913

Please sign in to comment.