@viteplus/versions 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -107
- package/components/version-switcher.component.vue +128 -108
- package/dist/index.d.ts +1763 -214
- package/dist/index.js +2 -2
- package/dist/index.js.map +5 -5
- package/package.json +18 -6
package/README.md
CHANGED
|
@@ -1,148 +1,184 @@
|
|
|
1
1
|
# @viteplus/versions
|
|
2
2
|
|
|
3
|
-
[](https://
|
|
4
|
-
[](https://viteplus.github.io/versions/)
|
|
4
|
+
[](https://www.npmjs.com/package/@viteplus/versions)
|
|
5
5
|
[](https://opensource.org/licenses/MPL-2.0)
|
|
6
|
-
[](https://deepwiki.com/
|
|
6
|
+
[](https://github.com/viteplus/versions/actions/workflows/node.js.yml)
|
|
7
|
+
[](https://deepwiki.com/viteplus/versions)
|
|
8
8
|
|
|
9
|
-
A plugin
|
|
9
|
+
A **VitePress plugin** that enables versioned documentation, including:
|
|
10
|
+
|
|
11
|
+
- Automatic versioned routes
|
|
12
|
+
- Sidebar & navigation per version
|
|
13
|
+
- Version switcher component
|
|
14
|
+
- support 2.0.0-alpha.12
|
|
15
|
+
|
|
16
|
+
---
|
|
10
17
|
|
|
11
18
|
## Installation
|
|
12
19
|
|
|
13
|
-
Install
|
|
20
|
+
Install via your preferred package manager:
|
|
21
|
+
|
|
14
22
|
```bash
|
|
15
|
-
pnpm
|
|
23
|
+
pnpm add @viteplus/versions
|
|
16
24
|
# or
|
|
17
25
|
npm install @viteplus/versions
|
|
18
26
|
# or
|
|
19
27
|
yarn add @viteplus/versions
|
|
20
28
|
```
|
|
21
29
|
|
|
22
|
-
##
|
|
23
|
-
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
1. **Add the plugin to your VitePress config:**
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// .vitepress/config.js
|
|
36
|
+
import { withVersions } from '@viteplus/versions';
|
|
37
|
+
|
|
38
|
+
export default withVersions({
|
|
39
|
+
// your VitePress config here
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. **Configure navigation and sidebar:**
|
|
44
|
+
- Define them at the root-level to apply for all versions.
|
|
45
|
+
- Or, define them for specific versions (e.g., `v1.0` or `v2.0`) to customize per version.
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
themeConfig: {
|
|
49
|
+
nav: {
|
|
50
|
+
root: [ /* Global navigation */ ],
|
|
51
|
+
'v1.0': [ /* Navigation for version 1.0 */ ],
|
|
52
|
+
'v2.0': [ /* Navigation for version 2.0 */ ]
|
|
53
|
+
},
|
|
54
|
+
sidebar: {
|
|
55
|
+
root: [ /* Global sidebar */ ],
|
|
56
|
+
'v1.0': [ /* Sidebar for version 1.0 */ ],
|
|
57
|
+
'v2.0': [ /* Sidebar for version 2.0 */ ]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
24
61
|
|
|
25
|
-
|
|
26
|
-
This is critical because the plugin relies on relative paths to determine the correct versioned file to link to.
|
|
62
|
+
## Sidebar & Navigation Configuration
|
|
27
63
|
|
|
28
|
-
|
|
29
|
-
```markdown
|
|
30
|
-
./advanced-setup.md
|
|
31
|
-
```
|
|
64
|
+
Both the navigation (`nav`) and sidebar (`sidebar`) can be defined in your VitePress configuration in two flexible ways:
|
|
32
65
|
|
|
33
|
-
-
|
|
34
|
-
```markdown
|
|
35
|
-
../help/faq.md
|
|
36
|
-
```
|
|
66
|
+
- **As an Array:** Simply provide an array to apply a global navigation or sidebar for all versions.
|
|
37
67
|
|
|
38
|
-
|
|
39
|
-
|
|
68
|
+
```ts
|
|
69
|
+
themeConfig: {
|
|
70
|
+
nav: [ /* Global navigation for all versions */ ],
|
|
71
|
+
sidebar: [ /* Global sidebar for all versions */ ]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- **As a Mapping/Object:** Provide an object to specify different navigation or sidebar options for each version.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
themeConfig: {
|
|
79
|
+
nav: {
|
|
80
|
+
root: [ /* Navigation for all versions */ ],
|
|
81
|
+
'v1.0': [ /* Navigation for version 1.0 */ ]
|
|
82
|
+
},
|
|
83
|
+
sidebar: {
|
|
84
|
+
root: [ /* Sidebar for all versions */ ],
|
|
85
|
+
'v2.0': [ /* Sidebar for version 2.0 */ ]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
40
89
|
|
|
41
|
-
|
|
90
|
+
## customize navigation (`nav`) and sidebar (`sidebar`)
|
|
42
91
|
|
|
43
|
-
|
|
92
|
+
You can fully customize your documentation's navigation (`nav`) and sidebar (`sidebar`) according to your needs:
|
|
44
93
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export default defineVersionedConfig({
|
|
49
|
-
root: 'docs', // root folder
|
|
50
|
-
title: 'SomeProject',
|
|
51
|
-
base: '/SomeProject/', // in case github page that have prefix
|
|
52
|
-
srcDir: 'src',
|
|
53
|
-
versioning: {
|
|
54
|
-
latestVersion: '1.0.0',
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
```
|
|
94
|
+
- **Global:**
|
|
95
|
+
Use an array to apply a navigation or sidebar structure for all locales and all versions.
|
|
58
96
|
|
|
59
|
-
|
|
97
|
+
- **Per-Version:**
|
|
98
|
+
Use an object mapping to specify different navigation/sidebar for each version
|
|
99
|
+
while still supporting a global (`root`) fallback.
|
|
60
100
|
|
|
61
|
-
|
|
101
|
+
- **Per-Locale:**
|
|
102
|
+
Use the `locales` property to define locale-specific structure.
|
|
103
|
+
Each locale can individually specify its own nav and sidebar
|
|
104
|
+
as either an array (for that locale) or as a mapping of versions.
|
|
62
105
|
|
|
63
|
-
|
|
106
|
+
### Example: Per-locale, per-version, and global navigation/sidebar
|
|
64
107
|
|
|
65
108
|
```ts
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
locales: {
|
|
110
|
+
'root': {
|
|
111
|
+
label: 'English',
|
|
112
|
+
lang: 'en',
|
|
113
|
+
themeConfig: {
|
|
114
|
+
nav: [
|
|
115
|
+
{ text: 'Home', link: '/' },
|
|
116
|
+
{ text: 'Examples', link: '/api' }
|
|
117
|
+
],
|
|
118
|
+
sidebar: [
|
|
119
|
+
{
|
|
120
|
+
text: 'Examples',
|
|
121
|
+
items: [
|
|
122
|
+
{ text: 'Markdown Examples', link: '/guide' },
|
|
123
|
+
{ text: 'Runtime API Examples', link: '/guide/getting-started' },
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
'fr': {
|
|
130
|
+
label: 'fr',
|
|
131
|
+
lang: 'fr',
|
|
132
|
+
themeConfig: {
|
|
133
|
+
nav: [
|
|
134
|
+
{ text: 'Sākums', link: '/' },
|
|
135
|
+
{ text: 'Piemēri', link: '/api' }
|
|
136
|
+
],
|
|
137
|
+
sidebar: [
|
|
138
|
+
{
|
|
139
|
+
text: 'Examples',
|
|
140
|
+
items: [
|
|
141
|
+
{ text: 'fr - Markdown Examples', link: '/guide' },
|
|
142
|
+
{ text: 'fr - Runtime API Examples', link: '/guide/getting-started' },
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
'fr/xs': {
|
|
149
|
+
label: 'fr-xs',
|
|
150
|
+
lang: 'fr-xs',
|
|
151
|
+
base: 'fr',
|
|
152
|
+
themeConfig: {
|
|
153
|
+
nav: [
|
|
154
|
+
{ text: 'Sākums', link: '/' },
|
|
155
|
+
{ text: 'Piemēri', link: '/api' }
|
|
156
|
+
],
|
|
157
|
+
sidebar: [
|
|
158
|
+
{
|
|
159
|
+
text: 'Examples',
|
|
160
|
+
items: [
|
|
161
|
+
{ text: 'fr - Markdown Examples', link: '/guide' },
|
|
162
|
+
{ text: 'fr - Runtime API Examples', link: '/guide/getting-started' },
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
95
168
|
}
|
|
96
|
-
} satisfies Theme;
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
2. Add it to your navbar:
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
themeConfig: {
|
|
103
|
-
versionSwitcher: false, // hide default switcher
|
|
104
|
-
nav: [
|
|
105
|
-
...,
|
|
106
|
-
{
|
|
107
|
-
component: 'VersionSwitcher',
|
|
108
|
-
},
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
169
|
|
|
113
|
-
## Troubleshooting
|
|
114
|
-
1. Sidebar Cannot Be an Array
|
|
115
|
-
|
|
116
|
-
```ts
|
|
117
|
-
// ❌ Incorrect
|
|
118
|
-
sidebar: [
|
|
119
|
-
{ text: '1.0.0', link: '/' },
|
|
120
|
-
]
|
|
121
|
-
|
|
122
|
-
// ✅ Correct
|
|
123
|
-
sidebar: {
|
|
124
|
-
'/': [
|
|
125
|
-
{ text: '1.0.0', link: '/' },
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
170
|
```
|
|
129
171
|
|
|
130
172
|
## Acknowledgments
|
|
131
173
|
|
|
132
174
|
I would like to express my gratitude to those who inspired and supported this project:
|
|
133
|
-
- `@IMB11`, for the original vitepress-versioning-plugin
|
|
134
175
|
|
|
176
|
+
- `@IMB11`, for the original vitepress-versioning-plugin
|
|
135
177
|
|
|
136
178
|
## Documentation
|
|
137
179
|
|
|
138
|
-
For complete API documentation, examples, and guides, visit: [Documentation](https://
|
|
139
|
-
|
|
140
|
-
## Compatibility
|
|
180
|
+
For complete API documentation, examples, and guides, visit: [Documentation](https://viteplus.github.io/versions/)
|
|
141
181
|
|
|
142
|
-
- Node.js 20+
|
|
143
|
-
- All modern browsers (via bundlers)
|
|
144
|
-
- TypeScript 4.5+
|
|
145
|
-
-
|
|
146
182
|
## Contributing
|
|
147
183
|
|
|
148
184
|
Contributions are welcome!\
|
|
@@ -13,189 +13,209 @@ import { useData, useRouter } from 'vitepress';
|
|
|
13
13
|
import VPFlyout from 'vitepress/dist/client/theme-default/components/VPFlyout.vue';
|
|
14
14
|
import VPMenuLink from 'vitepress/dist/client/theme-default/components/VPMenuLink.vue';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Interfaces
|
|
18
|
+
*/
|
|
19
|
+
|
|
16
20
|
interface VersioningPlugin {
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
versions: Array<string>;
|
|
22
|
+
currentVersion: string;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}>()
|
|
25
|
-
|
|
26
|
-
const router = useRouter()
|
|
27
|
-
const { site } = useData()
|
|
28
|
-
|
|
29
|
-
// Optimize version detection using find() instead of for loop
|
|
30
|
-
const currentVersion = computed(() => {
|
|
31
|
-
const basePath = site.value.base
|
|
32
|
-
const { versions, latestVersion } = props.versioningPlugin
|
|
25
|
+
/**
|
|
26
|
+
* Defines
|
|
27
|
+
*/
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
const router = useRouter();
|
|
30
|
+
const isOpen = ref(false);
|
|
31
|
+
const { site } = useData();
|
|
32
|
+
const props = defineProps<{
|
|
33
|
+
versioningPlugin: VersioningPlugin
|
|
34
|
+
screenMenu?: boolean
|
|
35
|
+
}>();
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const getActiveVersion = computed(() => {
|
|
38
|
+
const path = router.route.data.relativePath.split('/');
|
|
39
|
+
const { versions, currentVersion } = props.versioningPlugin
|
|
40
|
+
const index = (site.value.lang === path[0]) ? versions.indexOf(path[1]) : versions.indexOf(path[0]);
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
const createVersionMenuItem = (version: string) => ({
|
|
44
|
-
text: version,
|
|
45
|
-
link: version === props.versioningPlugin.latestVersion ? '/' : `/${ version }/`
|
|
42
|
+
return (index === -1) ? currentVersion : versions[index];
|
|
46
43
|
})
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
45
|
+
function createVersionMenuItem(version: string): { text: string, link: string } {
|
|
46
|
+
const { versions, currentVersion } = props.versioningPlugin
|
|
47
|
+
const relativePath = router.route.data.relativePath
|
|
48
|
+
const pathSegments = relativePath.split('/')
|
|
49
|
+
|
|
50
|
+
let newPathSegments: Array<string>;
|
|
51
|
+
if (version !== currentVersion) {
|
|
52
|
+
const langSegment = pathSegments.includes(site.value.lang) ? site.value.lang : undefined
|
|
53
|
+
newPathSegments = langSegment
|
|
54
|
+
? [langSegment, version, ...pathSegments.slice(1)]
|
|
55
|
+
: [version, ...pathSegments];
|
|
56
|
+
} else {
|
|
57
|
+
if (versions.includes(pathSegments[0])) {
|
|
58
|
+
newPathSegments = pathSegments.slice(1)
|
|
59
|
+
} else if (versions.includes(pathSegments[1])) {
|
|
60
|
+
newPathSegments = [...pathSegments.slice(0, 1), ...pathSegments.slice(2)]
|
|
61
|
+
} else {
|
|
62
|
+
newPathSegments = [...pathSegments]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return { text: version, link: `/${ newPathSegments.join('/') }` }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function toggle() {
|
|
70
|
+
return isOpen.value = !isOpen.value;
|
|
51
71
|
}
|
|
52
72
|
</script>
|
|
53
73
|
|
|
54
74
|
<template>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
>
|
|
63
|
-
<div class="items">
|
|
64
|
-
<!-- Only show latest version link if we're not already on latest -->
|
|
65
|
-
<VPMenuLink
|
|
66
|
-
v-if="currentVersion !== versioningPlugin.latestVersion"
|
|
67
|
-
:item="createVersionMenuItem(versioningPlugin.latestVersion)"
|
|
68
|
-
/>
|
|
69
|
-
<!-- Show all version links except current version -->
|
|
70
|
-
<template v-for="version in versioningPlugin.versions" :key="version">
|
|
71
|
-
<VPMenuLink
|
|
72
|
-
v-if="currentVersion !== version"
|
|
73
|
-
:item="createVersionMenuItem(version)"
|
|
74
|
-
/>
|
|
75
|
-
</template>
|
|
76
|
-
</div>
|
|
77
|
-
</VPFlyout>
|
|
78
|
-
|
|
79
|
-
<!-- Mobile version dropdown -->
|
|
80
|
-
<div v-else class="VPScreenVersionSwitcher" :class="{ open: isOpen }">
|
|
81
|
-
<button
|
|
82
|
-
class="button"
|
|
83
|
-
aria-controls="navbar-group-version"
|
|
84
|
-
:aria-expanded="isOpen"
|
|
85
|
-
@click="toggle"
|
|
75
|
+
<!-- Desktop version flyout -->
|
|
76
|
+
<VPFlyout
|
|
77
|
+
v-if="!screenMenu"
|
|
78
|
+
class="VPVersionSwitcher"
|
|
79
|
+
icon="vpi-versioning"
|
|
80
|
+
:button="getActiveVersion"
|
|
81
|
+
label="Switch Version"
|
|
86
82
|
>
|
|
83
|
+
<div class="items">
|
|
84
|
+
<!-- Only show latest version link if we're not already on latest -->
|
|
85
|
+
<VPMenuLink
|
|
86
|
+
v-if="getActiveVersion !== versioningPlugin.currentVersion"
|
|
87
|
+
:item="createVersionMenuItem(versioningPlugin.currentVersion)"
|
|
88
|
+
/>
|
|
89
|
+
<!-- Show all version links except current version -->
|
|
90
|
+
<template v-for="version in versioningPlugin.versions" :key="version">
|
|
91
|
+
<VPMenuLink
|
|
92
|
+
v-if="getActiveVersion !== version"
|
|
93
|
+
:item="createVersionMenuItem(version)"
|
|
94
|
+
/>
|
|
95
|
+
</template>
|
|
96
|
+
</div>
|
|
97
|
+
</VPFlyout>
|
|
98
|
+
|
|
99
|
+
<!-- Mobile version dropdown -->
|
|
100
|
+
<div v-else class="VPScreenVersionSwitcher" :class="{ open: isOpen }">
|
|
101
|
+
<button
|
|
102
|
+
class="button"
|
|
103
|
+
aria-controls="navbar-group-version"
|
|
104
|
+
:aria-expanded="isOpen"
|
|
105
|
+
@click="toggle"
|
|
106
|
+
>
|
|
87
107
|
<span class="button-text">
|
|
88
108
|
<span class="vpi-versioning icon"/>Switch Version
|
|
89
109
|
</span>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
110
|
+
<span class="vpi-plus button-icon"/>
|
|
111
|
+
</button>
|
|
112
|
+
|
|
113
|
+
<div id="navbar-group-version" class="items">
|
|
114
|
+
<!-- Always show latest version link -->
|
|
115
|
+
<VPMenuLink :item="createVersionMenuItem(versioningPlugin.currentVersion)"/>
|
|
116
|
+
<!-- Show all version links -->
|
|
117
|
+
<VPMenuLink
|
|
118
|
+
v-for="version in versioningPlugin.versions"
|
|
119
|
+
:key="version"
|
|
120
|
+
:item="createVersionMenuItem(version)"
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
102
123
|
</div>
|
|
103
|
-
</div>
|
|
104
124
|
</template>
|
|
105
125
|
|
|
106
126
|
<style>
|
|
107
127
|
/* Versioning icon styling */
|
|
108
128
|
.vpi-versioning.option-icon {
|
|
109
|
-
|
|
129
|
+
margin-right: 2px !important;
|
|
110
130
|
}
|
|
111
131
|
|
|
112
132
|
.vpi-versioning {
|
|
113
|
-
|
|
133
|
+
--icon: url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB3aWR0aD0iNjRweCIgaGVpZ2h0PSI2NHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHN0cm9rZS13aWR0aD0iMi4yIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNvbG9yPSIjMDAwMDAwIj48cGF0aCBkPSJNMTcgN0MxOC4xMDQ2IDcgMTkgNi4xMDQ1NyAxOSA1QzE5IDMuODk1NDMgMTguMTA0NiAzIDE3IDNDMTUuODk1NCAzIDE1IDMuODk1NDMgMTUgNUMxNSA2LjEwNDU3IDE1Ljg5NTQgNyAxNyA3WiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIuMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+PHBhdGggZD0iTTcgN0M4LjEwNDU3IDcgOSA2LjEwNDU3IDkgNUM5IDMuODk1NDMgOC4xMDQ1NyAzIDcgM0M1Ljg5NTQzIDMgNSAzLjg5NTQzIDUgNUM1IDYuMTA0NTcgNS44OTU0MyA3IDcgN1oiIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIyLjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PC9wYXRoPjxwYXRoIGQ9Ik03IDIxQzguMTA0NTcgMjEgOSAyMC4xMDQ2IDkgMTlDOSAxNy44OTU0IDguMTA0NTcgMTcgNyAxN0M1Ljg5NTQzIDE3IDUgMTcuODk1NCA1IDE5QzUgMjAuMTA0NiA1Ljg5NTQzIDIxIDcgMjFaIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMi4yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD48cGF0aCBkPSJNNyA3VjE3IiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMi4yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD48cGF0aCBkPSJNMTcgN1Y4QzE3IDEwLjUgMTUgMTEgMTUgMTFMOSAxM0M5IDEzIDcgMTMuNSA3IDE2VjE3IiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMi4yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD48L3N2Zz4=")
|
|
114
134
|
}
|
|
115
135
|
</style>
|
|
116
136
|
|
|
117
137
|
<style scoped>
|
|
118
138
|
/* Component styling with minor optimizations */
|
|
119
139
|
.VPVersionSwitcher {
|
|
120
|
-
|
|
121
|
-
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
122
142
|
}
|
|
123
143
|
|
|
124
144
|
.icon {
|
|
125
|
-
|
|
145
|
+
padding: 8px;
|
|
126
146
|
}
|
|
127
147
|
|
|
128
148
|
.title {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
padding: 0 24px 0 12px;
|
|
150
|
+
line-height: 32px;
|
|
151
|
+
font-size: 14px;
|
|
152
|
+
font-weight: 700;
|
|
153
|
+
color: var(--vp-c-text-1);
|
|
134
154
|
}
|
|
135
155
|
|
|
136
156
|
/* Mobile version switcher styles */
|
|
137
157
|
.VPScreenVersionSwitcher {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
158
|
+
border-bottom: 1px solid var(--vp-c-divider);
|
|
159
|
+
height: 48px;
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
transition: border-color 0.5s;
|
|
142
162
|
}
|
|
143
163
|
|
|
144
164
|
.VPScreenVersionSwitcher .items {
|
|
145
|
-
|
|
165
|
+
visibility: hidden;
|
|
146
166
|
}
|
|
147
167
|
|
|
148
168
|
.VPScreenVersionSwitcher.open {
|
|
149
|
-
|
|
150
|
-
|
|
169
|
+
padding-bottom: 10px;
|
|
170
|
+
height: auto;
|
|
151
171
|
}
|
|
152
172
|
|
|
153
173
|
.VPScreenVersionSwitcher.open .items {
|
|
154
|
-
|
|
174
|
+
visibility: visible;
|
|
155
175
|
}
|
|
156
176
|
|
|
157
177
|
.VPScreenVersionSwitcher.open .button {
|
|
158
|
-
|
|
159
|
-
|
|
178
|
+
padding-bottom: 6px;
|
|
179
|
+
color: var(--vp-c-brand-1);
|
|
160
180
|
}
|
|
161
181
|
|
|
162
182
|
.VPScreenVersionSwitcher.open .button-icon {
|
|
163
|
-
|
|
164
|
-
|
|
183
|
+
/*rtl:ignore*/
|
|
184
|
+
transform: rotate(45deg);
|
|
165
185
|
}
|
|
166
186
|
|
|
167
187
|
.VPScreenVersionSwitcher button .icon {
|
|
168
|
-
|
|
188
|
+
margin-right: 8px;
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
.button {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
192
|
+
display: flex;
|
|
193
|
+
justify-content: space-between;
|
|
194
|
+
align-items: center;
|
|
195
|
+
padding: 12px 4px 11px 0;
|
|
196
|
+
width: 100%;
|
|
197
|
+
line-height: 24px;
|
|
198
|
+
font-size: 14px;
|
|
199
|
+
font-weight: 500;
|
|
200
|
+
color: var(--vp-c-text-1);
|
|
201
|
+
transition: color 0.25s;
|
|
182
202
|
}
|
|
183
203
|
|
|
184
204
|
.button:hover {
|
|
185
|
-
|
|
205
|
+
color: var(--vp-c-brand-1);
|
|
186
206
|
}
|
|
187
207
|
|
|
188
208
|
.button-icon {
|
|
189
|
-
|
|
209
|
+
transition: transform 0.25s;
|
|
190
210
|
}
|
|
191
211
|
|
|
192
212
|
/* Group styling */
|
|
193
213
|
.group:first-child {
|
|
194
|
-
|
|
214
|
+
padding-top: 0;
|
|
195
215
|
}
|
|
196
216
|
|
|
197
217
|
.group + .group,
|
|
198
218
|
.group + .item {
|
|
199
|
-
|
|
219
|
+
padding-top: 4px;
|
|
200
220
|
}
|
|
201
221
|
</style>
|