vitepress 0.22.2 → 1.0.0-draft.1
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 +4 -4
- package/client.d.ts +2 -3
- package/dist/client/app/components/ClientOnly.js +1 -1
- package/dist/client/app/index.js +5 -7
- package/dist/client/app/router.js +11 -5
- package/dist/client/theme-default/Layout.vue +25 -183
- package/dist/client/theme-default/NotFound.vue +9 -8
- package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +127 -0
- package/dist/client/theme-default/components/VPBackdrop.vue +39 -0
- package/dist/client/theme-default/components/VPContent.vue +44 -0
- package/dist/client/theme-default/components/VPContentDoc.vue +173 -0
- package/dist/client/theme-default/components/VPContentDocFooter.vue +140 -0
- package/dist/client/theme-default/components/VPContentDocOutline.vue +108 -0
- package/dist/client/theme-default/components/VPFlyout.vue +149 -0
- package/dist/client/theme-default/components/VPLink.vue +37 -0
- package/dist/client/theme-default/components/VPLocalNav.vue +106 -0
- package/dist/client/theme-default/components/VPMenu.vue +79 -0
- package/dist/client/theme-default/components/VPMenuGroup.vue +35 -0
- package/dist/client/theme-default/components/VPMenuLink.vue +30 -0
- package/dist/client/theme-default/components/VPNav.vue +33 -0
- package/dist/client/theme-default/components/VPNavBar.vue +109 -0
- package/dist/client/theme-default/components/VPNavBarAppearance.vue +22 -0
- package/dist/client/theme-default/components/VPNavBarExtra.vue +107 -0
- package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
- package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +18 -0
- package/dist/client/theme-default/components/VPNavBarMenuLink.vue +56 -0
- package/dist/client/theme-default/components/VPNavBarSearch.vue +269 -0
- package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPNavBarTitle.vue +44 -0
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +74 -0
- package/dist/client/theme-default/components/VPNavScreen.vue +100 -0
- package/dist/client/theme-default/components/VPNavScreenAppearance.vue +30 -0
- package/dist/client/theme-default/components/VPNavScreenMenu.vue +24 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +118 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +33 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +35 -0
- package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +34 -0
- package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
- package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
- package/dist/client/theme-default/components/VPSidebar.vue +118 -0
- package/dist/client/theme-default/components/VPSidebarGroup.vue +44 -0
- package/dist/client/theme-default/components/VPSidebarLink.vue +57 -0
- package/dist/client/theme-default/components/VPSkipLink.vue +72 -0
- package/dist/client/theme-default/components/VPSocialLink.vue +63 -0
- package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPSwitch.vue +66 -0
- package/dist/client/theme-default/components/VPSwitchAppearance.vue +74 -0
- package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
- package/dist/client/theme-default/components/icons/{ArrowLeft.vue → VPIconArrowLeft.vue} +0 -0
- package/dist/client/theme-default/components/icons/{ArrowRight.vue → VPIconArrowRight.vue} +0 -0
- package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconDiscord.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconExternalLink.vue +13 -0
- package/dist/client/theme-default/components/icons/VPIconFacebook.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconGitHub.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconInstagram.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
- package/dist/client/theme-default/components/icons/VPIconLinkedIn.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconSlack.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
- package/dist/client/theme-default/components/icons/VPIconTwitter.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconYouTube.vue +5 -0
- package/dist/client/theme-default/composables/edit-link.js +22 -0
- package/dist/client/theme-default/composables/flyout.js +40 -0
- package/dist/client/theme-default/composables/nav.js +27 -1
- package/dist/client/theme-default/composables/outline.js +130 -0
- package/dist/client/theme-default/composables/prev-next.js +18 -0
- package/dist/client/theme-default/composables/sidebar.js +57 -0
- package/dist/client/theme-default/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/index.js +4 -4
- package/dist/client/theme-default/styles/base.css +200 -0
- package/dist/client/theme-default/styles/fonts.css +67 -0
- package/dist/client/theme-default/styles/utils.css +9 -0
- package/dist/client/theme-default/styles/vars.css +206 -66
- package/dist/client/theme-default/styles/vp-doc.css +419 -0
- package/dist/client/theme-default/support/sidebar.js +29 -0
- package/dist/client/theme-default/support/utils.js +43 -0
- package/dist/node/cli.js +1 -1
- package/dist/node/index.d.ts +106 -81
- package/dist/node/index.js +1 -1
- package/dist/node/{serve-cf4b2162.js → serve-428d4610.js} +27 -10
- package/package.json +31 -27
- package/types/default-theme.d.ts +105 -80
- package/dist/client/theme-default/components/AlgoliaSearchBox.vue +0 -195
- package/dist/client/theme-default/components/BuySellAds.vue +0 -152
- package/dist/client/theme-default/components/CarbonAds.vue +0 -99
- package/dist/client/theme-default/components/EditLink.vue +0 -38
- package/dist/client/theme-default/components/Home.vue +0 -31
- package/dist/client/theme-default/components/HomeFeatures.vue +0 -143
- package/dist/client/theme-default/components/HomeFooter.vue +0 -50
- package/dist/client/theme-default/components/HomeHero.vue +0 -161
- package/dist/client/theme-default/components/LastUpdated.vue +0 -60
- package/dist/client/theme-default/components/NavBar.vue +0 -60
- package/dist/client/theme-default/components/NavBarTitle.vue +0 -41
- package/dist/client/theme-default/components/NavDropdownLink.vue +0 -135
- package/dist/client/theme-default/components/NavDropdownLinkItem.vue +0 -76
- package/dist/client/theme-default/components/NavLink.vue +0 -61
- package/dist/client/theme-default/components/NavLinks.vue +0 -52
- package/dist/client/theme-default/components/NextAndPrevLinks.vue +0 -88
- package/dist/client/theme-default/components/Page.vue +0 -53
- package/dist/client/theme-default/components/PageFooter.vue +0 -44
- package/dist/client/theme-default/components/SideBar.vue +0 -60
- package/dist/client/theme-default/components/SideBarLink.js +0 -68
- package/dist/client/theme-default/components/SideBarLinks.vue +0 -12
- package/dist/client/theme-default/components/ToggleSideBarButton.vue +0 -46
- package/dist/client/theme-default/components/icons/OutboundLink.vue +0 -31
- package/dist/client/theme-default/composables/activeSidebarLink.js +0 -99
- package/dist/client/theme-default/composables/editLink.js +0 -49
- package/dist/client/theme-default/composables/navLink.js +0 -42
- package/dist/client/theme-default/composables/nextAndPrevLinks.js +0 -37
- package/dist/client/theme-default/composables/repo.js +0 -38
- package/dist/client/theme-default/composables/sideBar.js +0 -57
- package/dist/client/theme-default/styles/code.css +0 -299
- package/dist/client/theme-default/styles/custom-blocks.css +0 -76
- package/dist/client/theme-default/styles/layout.css +0 -236
- package/dist/client/theme-default/styles/sidebar-links.css +0 -107
- package/dist/client/theme-default/support/sideBar.js +0 -46
- package/dist/client/theme-default/utils.js +0 -63
package/types/default-theme.d.ts
CHANGED
|
@@ -1,127 +1,158 @@
|
|
|
1
1
|
export namespace DefaultTheme {
|
|
2
2
|
export interface Config {
|
|
3
|
-
logo?: string
|
|
4
|
-
nav?: NavItem[] | false
|
|
5
|
-
sidebar?: SideBarConfig | MultiSideBarConfig
|
|
6
|
-
|
|
7
3
|
/**
|
|
8
|
-
*
|
|
4
|
+
* The logo file of the site.
|
|
9
5
|
*
|
|
10
|
-
* @example
|
|
6
|
+
* @example '/logo.svg'
|
|
11
7
|
*/
|
|
12
|
-
|
|
8
|
+
logo?: string
|
|
13
9
|
|
|
14
10
|
/**
|
|
15
|
-
*
|
|
16
|
-
* depending on the provided repo.
|
|
17
|
-
*
|
|
18
|
-
* @example `"Contribute!"`
|
|
11
|
+
* The nav items.
|
|
19
12
|
*/
|
|
20
|
-
|
|
13
|
+
nav?: NavItem[]
|
|
21
14
|
|
|
22
15
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @example `"vuejs/docs-next"`
|
|
16
|
+
* The sidebar items.
|
|
26
17
|
*/
|
|
27
|
-
|
|
18
|
+
sidebar?: Sidebar
|
|
28
19
|
|
|
29
20
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @example `"docs"`
|
|
21
|
+
* Info for the edit link. If it's undefined, the edit link feature will
|
|
22
|
+
* be disabled.
|
|
33
23
|
*/
|
|
34
|
-
|
|
24
|
+
editLink?: EditLink
|
|
35
25
|
|
|
36
26
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @example `"next"`
|
|
27
|
+
* The social links to be displayed at the end of the nav bar. Perfect for
|
|
28
|
+
* placing links to social services such as GitHub, Twitter, Facebook, etc.
|
|
40
29
|
*/
|
|
41
|
-
|
|
30
|
+
socialLinks?: SocialLink[]
|
|
42
31
|
|
|
43
32
|
/**
|
|
44
|
-
*
|
|
33
|
+
* Adds locale menu to the nav. This option should be used when you have
|
|
34
|
+
* your translated sites outside of the project.
|
|
45
35
|
*/
|
|
46
|
-
|
|
36
|
+
localeLinks?: LocaleLinks
|
|
47
37
|
|
|
48
38
|
/**
|
|
49
|
-
*
|
|
39
|
+
* The algolia options. Leave it undefined to disable the search feature.
|
|
50
40
|
*/
|
|
51
|
-
|
|
41
|
+
algolia?: AlgoliaSearchOptions
|
|
52
42
|
|
|
53
43
|
/**
|
|
54
|
-
*
|
|
55
|
-
* If given a string, it will be displayed as a prefix (default value:
|
|
56
|
-
* "Last Updated").
|
|
44
|
+
* The carbon ads options. Leave it undefined to disable the ads feature.
|
|
57
45
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
prevLinks?: boolean
|
|
61
|
-
nextLinks?: boolean
|
|
62
|
-
|
|
63
|
-
locales?: Record<string, LocaleConfig & Omit<Config, 'locales'>>
|
|
64
|
-
|
|
65
|
-
algolia?: AlgoliaSearchOptions
|
|
66
|
-
|
|
67
|
-
carbonAds?: {
|
|
68
|
-
carbon: string
|
|
69
|
-
custom?: string
|
|
70
|
-
placement: string
|
|
71
|
-
}
|
|
46
|
+
carbonAds?: CarbonAdsOptions
|
|
72
47
|
}
|
|
73
48
|
|
|
74
|
-
//
|
|
49
|
+
// nav -----------------------------------------------------------------------
|
|
75
50
|
|
|
76
51
|
export type NavItem = NavItemWithLink | NavItemWithChildren
|
|
77
52
|
|
|
78
|
-
export
|
|
53
|
+
export type NavItemWithLink = {
|
|
79
54
|
text: string
|
|
80
|
-
target?: string
|
|
81
|
-
rel?: string
|
|
82
|
-
ariaLabel?: string
|
|
83
|
-
activeMatch?: string
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface NavItemWithLink extends NavItemBase {
|
|
87
55
|
link: string
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* `activeMatch` is expected to be a regex string. We can't use actual
|
|
59
|
+
* RegExp object here because it isn't serializable
|
|
60
|
+
*/
|
|
61
|
+
activeMatch?: string
|
|
88
62
|
}
|
|
89
63
|
|
|
90
|
-
export interface NavItemWithChildren
|
|
64
|
+
export interface NavItemWithChildren {
|
|
65
|
+
text?: string
|
|
91
66
|
items: NavItemWithLink[]
|
|
92
67
|
}
|
|
93
68
|
|
|
94
69
|
// sidebar -------------------------------------------------------------------
|
|
95
70
|
|
|
96
|
-
export type
|
|
71
|
+
export type Sidebar = SidebarGroup[] | SidebarMulti
|
|
97
72
|
|
|
98
|
-
export interface
|
|
99
|
-
[path: string]:
|
|
73
|
+
export interface SidebarMulti {
|
|
74
|
+
[path: string]: SidebarGroup[]
|
|
100
75
|
}
|
|
101
76
|
|
|
102
|
-
export
|
|
77
|
+
export interface SidebarGroup {
|
|
78
|
+
text: string
|
|
79
|
+
items: SidebarItem[]
|
|
80
|
+
}
|
|
103
81
|
|
|
104
|
-
export interface
|
|
82
|
+
export interface SidebarItem {
|
|
105
83
|
text: string
|
|
106
84
|
link: string
|
|
107
85
|
}
|
|
108
86
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
87
|
+
// edit link -----------------------------------------------------------------
|
|
88
|
+
|
|
89
|
+
export interface EditLink {
|
|
90
|
+
/**
|
|
91
|
+
* Repo of the site.
|
|
92
|
+
*
|
|
93
|
+
* @example 'vuejs/docs'
|
|
94
|
+
*/
|
|
95
|
+
repo: string
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Branch of the repo.
|
|
99
|
+
*
|
|
100
|
+
* @default 'main'
|
|
101
|
+
*/
|
|
102
|
+
branch?: string
|
|
112
103
|
|
|
113
104
|
/**
|
|
114
|
-
*
|
|
105
|
+
* If your docs are not at the root of the repo.
|
|
106
|
+
*
|
|
107
|
+
* @example 'docs'
|
|
115
108
|
*/
|
|
116
|
-
|
|
109
|
+
dir?: string
|
|
117
110
|
|
|
118
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Custom text for edit link.
|
|
113
|
+
*
|
|
114
|
+
* @default 'Edit this page'
|
|
115
|
+
*/
|
|
116
|
+
text?: string
|
|
119
117
|
}
|
|
120
118
|
|
|
121
|
-
//
|
|
122
|
-
|
|
119
|
+
// social link ---------------------------------------------------------------
|
|
120
|
+
|
|
121
|
+
export interface SocialLink {
|
|
122
|
+
icon: SocialLinkIcon
|
|
123
|
+
link: string
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export type SocialLinkIcon =
|
|
127
|
+
| 'discord'
|
|
128
|
+
| 'facebook'
|
|
129
|
+
| 'github'
|
|
130
|
+
| 'instagram'
|
|
131
|
+
| 'linkedin'
|
|
132
|
+
| 'slack'
|
|
133
|
+
| 'twitter'
|
|
134
|
+
| 'youtube'
|
|
135
|
+
|
|
136
|
+
// locales -------------------------------------------------------------------
|
|
137
|
+
|
|
138
|
+
export interface LocaleLinks {
|
|
139
|
+
text: string
|
|
140
|
+
items: LocaleLink[]
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface LocaleLink {
|
|
144
|
+
text: string
|
|
145
|
+
link: string
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// algolia ------------------------------------------------------------------
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The Algolia search options. Partially copied from
|
|
152
|
+
* `@docsearch/react/dist/esm/DocSearch.d.ts`
|
|
153
|
+
*/
|
|
123
154
|
export interface AlgoliaSearchOptions {
|
|
124
|
-
appId
|
|
155
|
+
appId: string
|
|
125
156
|
apiKey: string
|
|
126
157
|
indexName: string
|
|
127
158
|
placeholder?: string
|
|
@@ -130,17 +161,11 @@ export namespace DefaultTheme {
|
|
|
130
161
|
initialQuery?: string
|
|
131
162
|
}
|
|
132
163
|
|
|
133
|
-
//
|
|
164
|
+
// carbon ads ----------------------------------------------------------------
|
|
134
165
|
|
|
135
|
-
export interface
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
selectText?: string
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Label for this locale in the language dropdown.
|
|
143
|
-
*/
|
|
144
|
-
label?: string
|
|
166
|
+
export interface CarbonAdsOptions {
|
|
167
|
+
carbon: string
|
|
168
|
+
custom?: string
|
|
169
|
+
placement: string
|
|
145
170
|
}
|
|
146
171
|
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import '@docsearch/css'
|
|
3
|
-
import docsearch from '@docsearch/js'
|
|
4
|
-
import { useRoute, useRouter, useData } from 'vitepress'
|
|
5
|
-
import { getCurrentInstance, onMounted, watch } from 'vue'
|
|
6
|
-
import type { DefaultTheme } from '../config'
|
|
7
|
-
import type { DocSearchHit } from '@docsearch/react/dist/esm/types'
|
|
8
|
-
|
|
9
|
-
const props = defineProps<{
|
|
10
|
-
options: DefaultTheme.AlgoliaSearchOptions
|
|
11
|
-
multilang?: boolean
|
|
12
|
-
}>()
|
|
13
|
-
|
|
14
|
-
const vm = getCurrentInstance()
|
|
15
|
-
const route = useRoute()
|
|
16
|
-
const router = useRouter()
|
|
17
|
-
|
|
18
|
-
watch(
|
|
19
|
-
() => props.options,
|
|
20
|
-
(value) => {
|
|
21
|
-
update(value)
|
|
22
|
-
}
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
onMounted(() => {
|
|
26
|
-
initialize(props.options)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
function isSpecialClick(event: MouseEvent) {
|
|
30
|
-
return (
|
|
31
|
-
event.button === 1 ||
|
|
32
|
-
event.altKey ||
|
|
33
|
-
event.ctrlKey ||
|
|
34
|
-
event.metaKey ||
|
|
35
|
-
event.shiftKey
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function getRelativePath(absoluteUrl: string) {
|
|
40
|
-
const { pathname, hash } = new URL(absoluteUrl)
|
|
41
|
-
|
|
42
|
-
return pathname + hash
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function update(options: any) {
|
|
46
|
-
if (vm && vm.vnode.el) {
|
|
47
|
-
vm.vnode.el.innerHTML =
|
|
48
|
-
'<div class="algolia-search-box" id="docsearch"></div>'
|
|
49
|
-
initialize(options)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const { lang } = useData()
|
|
54
|
-
|
|
55
|
-
// if the user has multiple locales, the search results should be filtered
|
|
56
|
-
// based on the language
|
|
57
|
-
const facetFilters: string[] = props.multilang
|
|
58
|
-
? ['lang:' + lang.value]
|
|
59
|
-
: []
|
|
60
|
-
|
|
61
|
-
if (props.options.searchParameters?.facetFilters) {
|
|
62
|
-
facetFilters.push(...props.options.searchParameters.facetFilters)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
watch(
|
|
66
|
-
lang,
|
|
67
|
-
(newLang, oldLang) => {
|
|
68
|
-
const index = facetFilters.findIndex(
|
|
69
|
-
(filter) => filter === 'lang:' + oldLang
|
|
70
|
-
)
|
|
71
|
-
if (index > -1) {
|
|
72
|
-
facetFilters.splice(index, 1, 'lang:' + newLang)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
function initialize(userOptions: any) {
|
|
78
|
-
docsearch(
|
|
79
|
-
Object.assign({}, userOptions, {
|
|
80
|
-
container: '#docsearch',
|
|
81
|
-
|
|
82
|
-
searchParameters: Object.assign({}, userOptions.searchParameters, {
|
|
83
|
-
// pass a custom lang facetFilter to allow multiple language search
|
|
84
|
-
// https://github.com/algolia/docsearch-configs/pull/3942
|
|
85
|
-
facetFilters
|
|
86
|
-
}),
|
|
87
|
-
|
|
88
|
-
navigator: {
|
|
89
|
-
navigate: ({ itemUrl }: { itemUrl: string }) => {
|
|
90
|
-
const { pathname: hitPathname } = new URL(
|
|
91
|
-
window.location.origin + itemUrl
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
// Router doesn't handle same-page navigation so we use the native
|
|
95
|
-
// browser location API for anchor navigation
|
|
96
|
-
if (route.path === hitPathname) {
|
|
97
|
-
window.location.assign(window.location.origin + itemUrl)
|
|
98
|
-
} else {
|
|
99
|
-
router.go(itemUrl)
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
transformItems: (items: DocSearchHit[]) => {
|
|
105
|
-
return items.map((item) => {
|
|
106
|
-
return Object.assign({}, item, {
|
|
107
|
-
url: getRelativePath(item.url)
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
hitComponent: ({
|
|
113
|
-
hit,
|
|
114
|
-
children
|
|
115
|
-
}: {
|
|
116
|
-
hit: DocSearchHit
|
|
117
|
-
children: any
|
|
118
|
-
}) => {
|
|
119
|
-
const relativeHit = hit.url.startsWith('http')
|
|
120
|
-
? getRelativePath(hit.url as string)
|
|
121
|
-
: hit.url
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
type: 'a',
|
|
125
|
-
ref: undefined,
|
|
126
|
-
constructor: undefined,
|
|
127
|
-
key: undefined,
|
|
128
|
-
props: {
|
|
129
|
-
href: hit.url,
|
|
130
|
-
onClick: (event: MouseEvent) => {
|
|
131
|
-
if (isSpecialClick(event)) {
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// we rely on the native link scrolling when user is already on
|
|
136
|
-
// the right anchor because Router doesn't support duplicated
|
|
137
|
-
// history entries
|
|
138
|
-
if (route.path === relativeHit) {
|
|
139
|
-
return
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// if the hits goes to another page, we prevent the native link
|
|
143
|
-
// behavior to leverage the Router loading feature
|
|
144
|
-
if (route.path !== relativeHit) {
|
|
145
|
-
event.preventDefault()
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
router.go(relativeHit)
|
|
149
|
-
},
|
|
150
|
-
children
|
|
151
|
-
},
|
|
152
|
-
__v: null
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
</script>
|
|
159
|
-
|
|
160
|
-
<template>
|
|
161
|
-
<div class="algolia-search-box" id="docsearch" />
|
|
162
|
-
</template>
|
|
163
|
-
|
|
164
|
-
<style>
|
|
165
|
-
.algolia-search-box {
|
|
166
|
-
padding-top: 1px;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
@media (min-width: 720px) {
|
|
170
|
-
.algolia-search-box {
|
|
171
|
-
padding-left: 8px;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
@media (min-width: 751px) {
|
|
176
|
-
.algolia-search-box {
|
|
177
|
-
min-width: 176.3px; /* avoid layout shift */
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.algolia-search-box .DocSearch-Button-Placeholder {
|
|
181
|
-
padding-left: 8px;
|
|
182
|
-
font-size: 0.9rem;
|
|
183
|
-
font-weight: 500;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.DocSearch {
|
|
188
|
-
--docsearch-primary-color: var(--c-brand);
|
|
189
|
-
--docsearch-highlight-color: var(--docsearch-primary-color);
|
|
190
|
-
--docsearch-searchbox-shadow: inset 0 0 0 2px var(--docsearch-primary-color);
|
|
191
|
-
--docsearch-text-color: var(--c-text-light);
|
|
192
|
-
--docsearch-muted-color: var(--c-text-lighter);
|
|
193
|
-
--docsearch-searchbox-background: #f2f2f2;
|
|
194
|
-
}
|
|
195
|
-
</style>
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onMounted } from 'vue'
|
|
3
|
-
|
|
4
|
-
// global _bsa
|
|
5
|
-
const ID = 'bsa-cpc-script'
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
var _bsa: BSA | undefined
|
|
9
|
-
|
|
10
|
-
interface BSA {
|
|
11
|
-
init(
|
|
12
|
-
name: string,
|
|
13
|
-
code: string,
|
|
14
|
-
placement: string,
|
|
15
|
-
options: {
|
|
16
|
-
target: string
|
|
17
|
-
align: string
|
|
18
|
-
disable_css?: 'true' | 'false'
|
|
19
|
-
}
|
|
20
|
-
): void
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const { code, placement } = defineProps<{
|
|
25
|
-
code: string
|
|
26
|
-
placement: string
|
|
27
|
-
}>()
|
|
28
|
-
|
|
29
|
-
onMounted(() => {
|
|
30
|
-
if (!document.getElementById(ID)) {
|
|
31
|
-
const s = document.createElement('script')
|
|
32
|
-
|
|
33
|
-
s.id = ID
|
|
34
|
-
s.src = '//m.servedby-buysellads.com/monetization.js'
|
|
35
|
-
|
|
36
|
-
document.head.appendChild(s)
|
|
37
|
-
|
|
38
|
-
s.onload = () => {
|
|
39
|
-
load()
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
load()
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
function load() {
|
|
47
|
-
if (typeof _bsa !== 'undefined' && _bsa) {
|
|
48
|
-
const parent = document.querySelector('.bsa-cpc')!
|
|
49
|
-
// cleanup any existing ad to avoid them stacking
|
|
50
|
-
parent.innerHTML = ''
|
|
51
|
-
|
|
52
|
-
_bsa.init('default', code, `placement:${placement}`, {
|
|
53
|
-
target: '.bsa-cpc',
|
|
54
|
-
align: 'horizontal',
|
|
55
|
-
disable_css: 'true'
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
<template>
|
|
62
|
-
<div class="buy-sell-ads">
|
|
63
|
-
<div class="bsa-cpc" />
|
|
64
|
-
</div>
|
|
65
|
-
</template>
|
|
66
|
-
|
|
67
|
-
<style scoped>
|
|
68
|
-
.buy-sell-ads {
|
|
69
|
-
margin: 0 auto;
|
|
70
|
-
padding-top: 2rem;
|
|
71
|
-
font-size: 0.85rem;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.bsa-cpc {
|
|
75
|
-
border-radius: 6px;
|
|
76
|
-
background-color: var(--c-bg-accent);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.bsa-cpc ::v-deep(a._default_) {
|
|
80
|
-
display: flex;
|
|
81
|
-
flex-wrap: wrap;
|
|
82
|
-
align-items: flex-start;
|
|
83
|
-
margin-bottom: 20px;
|
|
84
|
-
padding: 12px;
|
|
85
|
-
text-decoration: none;
|
|
86
|
-
line-height: 1.4;
|
|
87
|
-
font-weight: 400;
|
|
88
|
-
color: var(--c-text-light);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@media (min-width: 512px) {
|
|
92
|
-
.bsa-cpc ::v-deep(a._default_) {
|
|
93
|
-
flex-wrap: nowrap;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.bsa-cpc ::v-deep(.default-ad) {
|
|
98
|
-
display: none;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.bsa-cpc ::v-deep(a._default_ .default-image) {
|
|
102
|
-
flex-shrink: 0;
|
|
103
|
-
margin-right: 12px;
|
|
104
|
-
width: 24px;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.bsa-cpc ::v-deep(a._default_ .default-image img) {
|
|
108
|
-
border-radius: 4px;
|
|
109
|
-
height: 24px;
|
|
110
|
-
vertical-align: middle;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.bsa-cpc ::v-deep(._default_::after) {
|
|
114
|
-
border: 1px solid #1c90f3;
|
|
115
|
-
border-radius: 4px;
|
|
116
|
-
margin-top: 8px;
|
|
117
|
-
margin-left: 36px;
|
|
118
|
-
padding: 0 8px;
|
|
119
|
-
line-height: 22px;
|
|
120
|
-
font-size: 0.85em;
|
|
121
|
-
font-weight: 500;
|
|
122
|
-
color: #1c90f3;
|
|
123
|
-
content: 'Sponsored';
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@media (min-width: 512px) {
|
|
127
|
-
.bsa-cpc ::v-deep(._default_::after) {
|
|
128
|
-
margin-top: 0px;
|
|
129
|
-
margin-left: 12px;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.bsa-cpc ::v-deep(.default-text) {
|
|
134
|
-
flex-grow: 1;
|
|
135
|
-
align-self: center;
|
|
136
|
-
width: calc(100% - 36px);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
@media (min-width: 512px) {
|
|
140
|
-
.bsa-cpc ::v-deep(.default-text) {
|
|
141
|
-
width: auto;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.bsa-cpc ::v-deep(.default-title) {
|
|
146
|
-
font-weight: 600;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.bsa-cpc ::v-deep(.default-description) {
|
|
150
|
-
padding-left: 8px;
|
|
151
|
-
}
|
|
152
|
-
</style>
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref, onMounted } from 'vue'
|
|
3
|
-
|
|
4
|
-
const { code, placement } = defineProps<{
|
|
5
|
-
code: string
|
|
6
|
-
placement: string
|
|
7
|
-
}>()
|
|
8
|
-
|
|
9
|
-
const el = ref()
|
|
10
|
-
|
|
11
|
-
onMounted(() => {
|
|
12
|
-
const s = document.createElement('script')
|
|
13
|
-
s.id = '_carbonads_js'
|
|
14
|
-
s.src = `//cdn.carbonads.com/carbon.js?serve=${code}&placement=${placement}`
|
|
15
|
-
el.value.appendChild(s)
|
|
16
|
-
})
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<template>
|
|
20
|
-
<div class="carbon-ads" ref="el" />
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<style scoped>
|
|
24
|
-
.carbon-ads {
|
|
25
|
-
border-radius: 4px;
|
|
26
|
-
margin: 0 auto;
|
|
27
|
-
padding: 8px;
|
|
28
|
-
max-width: 280px;
|
|
29
|
-
font-size: 0.75rem;
|
|
30
|
-
background-color: var(--c-bg-accent);
|
|
31
|
-
min-height: 105.38px; /* avoid layout shift on mobile */
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.carbon-ads::after {
|
|
35
|
-
clear: both;
|
|
36
|
-
display: block;
|
|
37
|
-
content: '';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@media (min-width: 420px) {
|
|
41
|
-
.carbon-ads {
|
|
42
|
-
z-index: 1;
|
|
43
|
-
float: right;
|
|
44
|
-
margin: -8px -8px 24px 24px;
|
|
45
|
-
width: 146px;
|
|
46
|
-
max-width: 100%;
|
|
47
|
-
min-height: 200px;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@media (min-width: 1400px) {
|
|
52
|
-
.carbon-ads {
|
|
53
|
-
right: 8px;
|
|
54
|
-
float: none;
|
|
55
|
-
margin: 0;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.carbon-ads :deep(.carbon-img) {
|
|
60
|
-
float: left;
|
|
61
|
-
margin-right: 0.75rem;
|
|
62
|
-
max-width: 110px;
|
|
63
|
-
border: 1px solid var(--c-divider);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@media (min-width: 420px) {
|
|
67
|
-
.carbon-ads :deep(.carbon-img) {
|
|
68
|
-
float: none;
|
|
69
|
-
display: block;
|
|
70
|
-
margin-right: 0;
|
|
71
|
-
max-width: 130px;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.carbon-ads :deep(.carbon-img img) {
|
|
76
|
-
display: block;
|
|
77
|
-
width: 100%;
|
|
78
|
-
height: auto;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@media (min-width: 420px) {
|
|
82
|
-
.carbon-ads :deep(.carbon-text) {
|
|
83
|
-
padding-top: 8px;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.carbon-ads :deep(.carbon-text) {
|
|
88
|
-
display: block;
|
|
89
|
-
font-weight: 400;
|
|
90
|
-
color: var(--c-text-light);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.carbon-ads :deep(.carbon-poweredby) {
|
|
94
|
-
display: block;
|
|
95
|
-
padding-top: 2px;
|
|
96
|
-
font-weight: 400;
|
|
97
|
-
color: var(--c-text-lighter);
|
|
98
|
-
}
|
|
99
|
-
</style>
|