@vuepress/theme-default 2.0.0-rc.32 → 2.0.0-rc.34

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.
Files changed (111) hide show
  1. package/lib/client/components/VPDarkIcon.vue +8 -0
  2. package/lib/client/components/{DropdownTransition.vue → VPDropdownTransition.vue} +10 -1
  3. package/lib/client/components/VPEditIcon.vue +12 -0
  4. package/lib/client/components/VPHome.vue +38 -0
  5. package/lib/client/components/VPHomeFeatures.vue +68 -0
  6. package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -2
  7. package/lib/client/components/{HomeHero.vue → VPHomeHero.vue} +107 -5
  8. package/lib/client/components/VPLightIcon.vue +28 -0
  9. package/lib/client/components/VPNavbar.vue +127 -0
  10. package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +36 -4
  11. package/lib/client/components/VPNavbarDropdown.vue +319 -0
  12. package/lib/client/components/VPNavbarItems.vue +110 -0
  13. package/lib/client/components/VPPage.vue +66 -0
  14. package/lib/client/components/VPPageMeta.vue +132 -0
  15. package/lib/client/components/VPPageNav.vue +118 -0
  16. package/lib/client/components/VPSidebar.vue +112 -0
  17. package/lib/client/components/VPSidebarItem.vue +169 -0
  18. package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +30 -6
  19. package/lib/client/components/VPToggleColorModeButton.vue +54 -0
  20. package/lib/client/components/VPToggleSidebarButton.vue +92 -0
  21. package/lib/client/components/global/Badge.vue +60 -18
  22. package/lib/client/components/global/CodeGroup.d.ts +1 -0
  23. package/lib/client/components/global/CodeGroup.js +4 -3
  24. package/lib/client/components/global/CodeGroupItem.vue +5 -16
  25. package/lib/client/composables/index.d.ts +7 -0
  26. package/lib/client/composables/index.js +7 -0
  27. package/lib/client/composables/useContributors.d.ts +3 -0
  28. package/lib/client/composables/useContributors.js +14 -0
  29. package/lib/client/composables/useDarkMode.js +1 -1
  30. package/lib/client/composables/useEditLink.d.ts +3 -0
  31. package/lib/client/composables/useEditLink.js +31 -0
  32. package/lib/client/composables/useLastUpdated.d.ts +2 -0
  33. package/lib/client/composables/useLastUpdated.js +17 -0
  34. package/lib/client/composables/useNavbarConfig.d.ts +3 -0
  35. package/lib/client/composables/useNavbarConfig.js +25 -0
  36. package/lib/client/composables/useNavbarRepo.d.ts +6 -0
  37. package/lib/client/composables/useNavbarRepo.js +38 -0
  38. package/lib/client/composables/useNavbarSelectLanguage.d.ts +6 -0
  39. package/lib/client/composables/useNavbarSelectLanguage.js +58 -0
  40. package/lib/client/composables/useNavigate.js +4 -7
  41. package/lib/client/composables/useRelatedLinks.d.ts +8 -0
  42. package/lib/client/composables/useRelatedLinks.js +73 -0
  43. package/lib/client/composables/useSidebarItems.d.ts +10 -9
  44. package/lib/client/composables/useSidebarItems.js +58 -47
  45. package/lib/client/config.d.ts +1 -0
  46. package/lib/client/config.js +2 -1
  47. package/lib/client/index.d.ts +1 -0
  48. package/lib/client/index.js +1 -0
  49. package/lib/client/layouts/Layout.vue +111 -18
  50. package/lib/client/layouts/NotFound.vue +1 -1
  51. package/lib/client/styles/_mixins.scss +4 -4
  52. package/lib/client/styles/_variables.module.scss +1 -1
  53. package/lib/client/styles/_variables.scss +1 -0
  54. package/lib/client/styles/code-group.scss +32 -29
  55. package/lib/client/styles/{code.scss → content/code.scss} +81 -99
  56. package/lib/client/styles/{custom-container.scss → content/custom-container.scss} +9 -5
  57. package/lib/client/styles/content/index.scss +4 -0
  58. package/lib/client/styles/content/normalize.scss +39 -0
  59. package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
  60. package/lib/client/styles/external-link-icon.scss +7 -3
  61. package/lib/client/styles/index.scss +2 -13
  62. package/lib/client/styles/layout.scss +3 -203
  63. package/lib/client/styles/normalize.scss +18 -149
  64. package/lib/client/styles/plugins.scss +20 -0
  65. package/lib/client/styles/vars-dark.scss +17 -16
  66. package/lib/client/styles/vars.scss +19 -23
  67. package/lib/client/typings.d.ts +13 -0
  68. package/lib/client/typings.js +1 -0
  69. package/lib/client/utils/{getNavLink.d.ts → getAutoLink.d.ts} +2 -2
  70. package/lib/client/utils/index.d.ts +3 -1
  71. package/lib/client/utils/index.js +3 -1
  72. package/lib/client/utils/isActiveSidebarItem.d.ts +2 -2
  73. package/lib/client/utils/isActiveSidebarItem.js +3 -3
  74. package/lib/client/utils/isLinkInternal.d.ts +1 -0
  75. package/lib/client/utils/isLinkInternal.js +2 -0
  76. package/lib/client/utils/resolvePrefix.d.ts +1 -0
  77. package/lib/client/utils/resolvePrefix.js +4 -0
  78. package/lib/node/defaultTheme.js +9 -1
  79. package/lib/node/utils/assignDefaultLocaleOptions.js +1 -1
  80. package/lib/shared/index.d.ts +2 -0
  81. package/lib/shared/index.js +2 -0
  82. package/lib/shared/nav.d.ts +23 -26
  83. package/lib/shared/navbar.d.ts +21 -0
  84. package/lib/shared/navbar.js +1 -0
  85. package/lib/shared/options.d.ts +4 -3
  86. package/lib/shared/page.d.ts +2 -2
  87. package/lib/shared/sidebar.d.ts +26 -0
  88. package/lib/shared/sidebar.js +1 -0
  89. package/package.json +19 -19
  90. package/templates/build.html +2 -0
  91. package/lib/client/components/Home.vue +0 -15
  92. package/lib/client/components/HomeContent.vue +0 -5
  93. package/lib/client/components/HomeFeatures.vue +0 -22
  94. package/lib/client/components/Navbar.vue +0 -80
  95. package/lib/client/components/NavbarDropdown.vue +0 -125
  96. package/lib/client/components/NavbarItems.vue +0 -198
  97. package/lib/client/components/Page.vue +0 -31
  98. package/lib/client/components/PageMeta.vue +0 -220
  99. package/lib/client/components/PageNav.vue +0 -228
  100. package/lib/client/components/Sidebar.vue +0 -18
  101. package/lib/client/components/SidebarItem.vue +0 -86
  102. package/lib/client/components/ToggleColorModeButton.vue +0 -57
  103. package/lib/client/components/ToggleSidebarButton.vue +0 -24
  104. package/lib/client/styles/badge.scss +0 -36
  105. package/lib/client/styles/home.scss +0 -168
  106. package/lib/client/styles/navbar-dropdown.scss +0 -183
  107. package/lib/client/styles/navbar.scss +0 -197
  108. package/lib/client/styles/page.scss +0 -11
  109. package/lib/client/styles/sidebar.scss +0 -134
  110. package/lib/client/styles/transitions.scss +0 -22
  111. /package/lib/client/utils/{getNavLink.js → getAutoLink.js} +0 -0
@@ -0,0 +1,118 @@
1
+ <script setup lang="ts">
2
+ import { useNavigate } from '@theme/useNavigate'
3
+ import { useRelatedLinks } from '@theme/useRelatedLinks'
4
+ import { useThemeLocaleData } from '@theme/useThemeData'
5
+ import { useEventListener } from '@vueuse/core'
6
+ import { computed } from 'vue'
7
+ import { AutoLink } from 'vuepress/client'
8
+
9
+ const themeLocale = useThemeLocaleData()
10
+ const navigate = useNavigate()
11
+
12
+ const { prevLink, nextLink } = useRelatedLinks()
13
+
14
+ const navbarLabel = computed(() => {
15
+ const themeLocale = useThemeLocaleData()
16
+ return themeLocale.value.pageNavbarLabel ?? 'page navigation'
17
+ })
18
+
19
+ useEventListener('keydown', (event): void => {
20
+ if (event.altKey) {
21
+ if (event.key === 'ArrowRight') {
22
+ if (nextLink.value) {
23
+ navigate(nextLink.value.link)
24
+ event.preventDefault()
25
+ }
26
+ } else if (event.key === 'ArrowLeft') {
27
+ if (prevLink.value) {
28
+ navigate(prevLink.value.link)
29
+ event.preventDefault()
30
+ }
31
+ }
32
+ }
33
+ })
34
+ </script>
35
+
36
+ <template>
37
+ <nav
38
+ v-if="prevLink || nextLink"
39
+ class="vp-page-nav"
40
+ :aria-label="navbarLabel"
41
+ >
42
+ <AutoLink v-if="prevLink" class="prev" :config="prevLink">
43
+ <div class="hint">
44
+ <span class="arrow left" />
45
+ {{ themeLocale.prev ?? 'Prev' }}
46
+ </div>
47
+ <div class="link">
48
+ <span>{{ prevLink.text }}</span>
49
+ </div>
50
+ </AutoLink>
51
+
52
+ <AutoLink v-if="nextLink" class="next" :config="nextLink">
53
+ <div class="hint">
54
+ {{ themeLocale.next ?? 'Next' }}
55
+ <span class="arrow right" />
56
+ </div>
57
+ <div class="link">
58
+ <span>{{ nextLink.text }}</span>
59
+ </div>
60
+ </AutoLink>
61
+ </nav>
62
+ </template>
63
+
64
+ <style lang="scss">
65
+ @import '../styles/variables';
66
+
67
+ .vp-page-nav {
68
+ display: flex;
69
+ flex-wrap: wrap;
70
+
71
+ max-width: var(--content-width, 740px);
72
+ min-height: 2rem;
73
+ margin-top: 0;
74
+ margin-right: auto;
75
+ margin-left: auto;
76
+ padding: 1rem 2rem 0;
77
+ border-top: 1px solid var(--c-border);
78
+
79
+ transition: border-top var(--t-color);
80
+
81
+ @media (max-width: $MQNarrow) {
82
+ padding-right: 1rem;
83
+ padding-left: 1rem;
84
+ }
85
+
86
+ @media print {
87
+ display: none;
88
+ }
89
+
90
+ .route-link {
91
+ display: inline-block;
92
+ flex-grow: 1;
93
+
94
+ margin: 0.25rem;
95
+ padding: 0.25rem 0.5rem;
96
+ border: 1px solid var(--c-border);
97
+ border-radius: 0.25rem;
98
+
99
+ &:hover {
100
+ background: var(--c-bg-light);
101
+ }
102
+
103
+ .hint {
104
+ color: var(--c-text-quote);
105
+ font-size: 0.875rem;
106
+ line-height: 2;
107
+ }
108
+ }
109
+
110
+ .prev {
111
+ text-align: start;
112
+ }
113
+
114
+ .next {
115
+ text-align: end;
116
+ }
117
+ }
118
+ </style>
@@ -0,0 +1,112 @@
1
+ <script setup lang="ts">
2
+ import VPNavbarItems from '@theme/VPNavbarItems.vue'
3
+ import VPSidebarItems from '@theme/VPSidebarItems.vue'
4
+
5
+ defineSlots<{
6
+ top?: (props: Record<never, never>) => any
7
+ bottom?: (props: Record<never, never>) => any
8
+ }>()
9
+ </script>
10
+
11
+ <template>
12
+ <aside class="vp-sidebar">
13
+ <VPNavbarItems />
14
+ <slot name="top" />
15
+ <VPSidebarItems />
16
+ <slot name="bottom" />
17
+ </aside>
18
+ </template>
19
+
20
+ <style lang="scss">
21
+ @import '../styles/variables';
22
+
23
+ .vp-sidebar {
24
+ position: fixed;
25
+
26
+ // leave space for navbar
27
+ top: var(--navbar-height);
28
+ bottom: 0;
29
+ left: 0;
30
+ z-index: 10;
31
+
32
+ overflow-y: auto;
33
+ box-sizing: border-box;
34
+
35
+ width: var(--sidebar-width);
36
+ margin: 0;
37
+ border-right: 1px solid var(--c-border);
38
+
39
+ background-color: var(--c-bg-sidebar);
40
+
41
+ font-size: 16px;
42
+
43
+ transition:
44
+ transform var(--t-transform),
45
+ background-color var(--t-color),
46
+ border-color var(--t-color);
47
+
48
+ scrollbar-color: var(--c-brand) var(--c-border);
49
+ scrollbar-width: thin;
50
+
51
+ // narrow desktop / iPad
52
+ @media (max-width: $MQNarrow) {
53
+ width: var(--sidebar-width-mobile);
54
+ font-size: 15px;
55
+ }
56
+
57
+ // wide mobile
58
+ @media (max-width: $MQMobile) {
59
+ top: 0;
60
+
61
+ // leave space for navbar
62
+ padding-top: var(--navbar-height);
63
+ transform: translateX(-100%);
64
+ }
65
+
66
+ &::-webkit-scrollbar {
67
+ width: 7px;
68
+ }
69
+
70
+ &::-webkit-scrollbar-track {
71
+ background-color: var(--c-border);
72
+ }
73
+
74
+ &::-webkit-scrollbar-thumb {
75
+ background-color: var(--c-brand);
76
+ }
77
+
78
+ // override styles
79
+ .vp-navbar-items {
80
+ display: none;
81
+ padding: 0.5rem 0 0.75rem;
82
+ border-bottom: 1px solid var(--c-border);
83
+ transition: border-color var(--t-color);
84
+
85
+ @media (max-width: $MQMobile) {
86
+ display: block;
87
+
88
+ .vp-navbar-dropdown-item a.route-link-active::after {
89
+ top: calc(1rem - 2px);
90
+ }
91
+ }
92
+
93
+ ul {
94
+ margin: 0;
95
+ padding: 0;
96
+ list-style-type: none;
97
+ }
98
+
99
+ a {
100
+ font-weight: 600;
101
+ }
102
+ }
103
+
104
+ // override styles
105
+ .vp-navbar-item {
106
+ display: block;
107
+ padding: 0.5rem 0 0.5rem 1.5rem;
108
+ font-size: 1.1em;
109
+ line-height: 1.25rem;
110
+ }
111
+ }
112
+ </style>
@@ -0,0 +1,169 @@
1
+ <script setup lang="ts">
2
+ import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
3
+ import { useToggle } from '@vueuse/core'
4
+ import { computed, nextTick, onBeforeUnmount, toRefs } from 'vue'
5
+ import { AutoLink, useRoute, useRouter } from 'vuepress/client'
6
+ import type { SidebarItem } from '../typings.js'
7
+ import { isActiveLinkItem } from '../utils/index.js'
8
+
9
+ const props = withDefaults(
10
+ defineProps<{
11
+ item: SidebarItem
12
+ depth?: number
13
+ }>(),
14
+ { depth: 0 },
15
+ )
16
+
17
+ const { item, depth } = toRefs(props)
18
+ const route = useRoute()
19
+ const router = useRouter()
20
+
21
+ const collapsible = computed(
22
+ () => 'collapsible' in item.value && item.value.collapsible,
23
+ )
24
+ const isActive = computed(() => isActiveLinkItem(item.value, route))
25
+ const itemClass = computed(() => ({
26
+ 'vp-sidebar-item': true,
27
+ 'vp-sidebar-heading': depth.value === 0,
28
+ 'active': isActive.value,
29
+ 'collapsible': collapsible.value,
30
+ }))
31
+
32
+ const isOpenDefault = computed(() =>
33
+ collapsible.value ? isActive.value : true,
34
+ )
35
+ const [isOpen, toggleIsOpen] = useToggle(isOpenDefault.value)
36
+ const onClick = (e: Event): void => {
37
+ if (collapsible.value) {
38
+ e.preventDefault()
39
+ // toggle open status on click
40
+ toggleIsOpen()
41
+ }
42
+ }
43
+
44
+ // reset open status after navigation
45
+ const unregisterRouterHook = router.afterEach((to) => {
46
+ nextTick(() => {
47
+ isOpen.value = isOpenDefault.value
48
+ })
49
+ })
50
+ onBeforeUnmount(() => {
51
+ unregisterRouterHook()
52
+ })
53
+ </script>
54
+
55
+ <template>
56
+ <li>
57
+ <AutoLink v-if="item.link" :class="itemClass" :config="item" />
58
+ <p
59
+ v-else
60
+ tabindex="0"
61
+ :class="itemClass"
62
+ @click="onClick"
63
+ @keydown.enter="onClick"
64
+ >
65
+ {{ item.text }}
66
+ <span
67
+ v-if="collapsible"
68
+ class="arrow"
69
+ :class="isOpen ? 'down' : 'right'"
70
+ />
71
+ </p>
72
+
73
+ <VPDropdownTransition v-if="'children' in item && item.children.length">
74
+ <ul v-show="isOpen" class="vp-sidebar-children">
75
+ <VPSidebarItem
76
+ v-for="child in item.children"
77
+ :key="`${depth}${child.text}${child.link}`"
78
+ :item="child"
79
+ :depth="depth + 1"
80
+ />
81
+ </ul>
82
+ </VPDropdownTransition>
83
+ </li>
84
+ </template>
85
+
86
+ <style lang="scss">
87
+ @use '../styles/mixins';
88
+ @import '../styles/variables';
89
+
90
+ .vp-sidebar-item {
91
+ border-left: 0.25rem solid transparent;
92
+ color: var(--c-text);
93
+ cursor: default;
94
+
95
+ &:focus-visible {
96
+ outline-width: 1px;
97
+ outline-offset: -1px;
98
+ }
99
+
100
+ &.vp-sidebar-heading {
101
+ box-sizing: border-box;
102
+
103
+ width: 100%;
104
+ margin: 0;
105
+ padding: 0.35rem 1.5rem 0.35rem 1.25rem;
106
+
107
+ font-weight: bold;
108
+ font-size: 1.1em;
109
+
110
+ transition: color 0.15s ease;
111
+
112
+ + .vp-sidebar-children {
113
+ @include mixins.dropdown-wrapper;
114
+
115
+ margin-bottom: 0.75rem;
116
+ }
117
+ }
118
+
119
+ &.collapsible {
120
+ cursor: pointer;
121
+ }
122
+
123
+ &:not(.vp-sidebar-heading) {
124
+ display: inline-block;
125
+
126
+ box-sizing: border-box;
127
+
128
+ width: 100%;
129
+ margin: 0;
130
+ padding: 0.35rem 1rem 0.35rem 2rem;
131
+
132
+ font-weight: 400;
133
+ font-size: 1em;
134
+ line-height: 1.4;
135
+
136
+ + .vp-sidebar-children {
137
+ padding-left: 1rem;
138
+ font-size: 0.95em;
139
+ }
140
+
141
+ .vp-sidebar-children .vp-sidebar-children & {
142
+ padding: 0.25rem 1rem 0.25rem 1.75rem;
143
+
144
+ &.active {
145
+ border-left-color: transparent;
146
+ font-weight: 500;
147
+ }
148
+ }
149
+
150
+ a.vp-sidebar-heading + .vp-sidebar-children &.active {
151
+ border-left-color: transparent;
152
+ }
153
+ }
154
+
155
+ &.active:not(p.vp-sidebar-heading) {
156
+ border-left-color: var(--c-text-accent);
157
+ color: var(--c-text-accent);
158
+ font-weight: 600;
159
+ }
160
+ }
161
+
162
+ a.vp-sidebar-item {
163
+ cursor: pointer;
164
+
165
+ &:hover {
166
+ color: var(--c-text-accent);
167
+ }
168
+ }
169
+ </style>
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
- import SidebarItem from '@theme/SidebarItem.vue'
2
+ import { useSidebarItems } from '@theme/useSidebarItems'
3
+ import VPSidebarItem from '@theme/VPSidebarItem.vue'
3
4
  import { onMounted, watch } from 'vue'
4
5
  import { useRoute } from 'vuepress/client'
5
- import { useSidebarItems } from '../composables/index.js'
6
6
 
7
7
  const route = useRoute()
8
8
  const sidebarItems = useSidebarItems()
@@ -12,12 +12,12 @@ onMounted(() => {
12
12
  () => route.hash,
13
13
  (hash) => {
14
14
  // get the sidebar DOM
15
- const sidebar = document.querySelector('.sidebar')
15
+ const sidebar = document.querySelector('.vp-sidebar')
16
16
  if (!sidebar) return
17
17
 
18
18
  // get the active sidebar item DOM, whose href equals to the current route
19
19
  const activeSidebarItem = document.querySelector(
20
- `.sidebar a.sidebar-item[href="${route.path}${hash}"]`,
20
+ `.vp=sidebar a.vp-sidebar-item[href="${route.path}${hash}"]`,
21
21
  )
22
22
  if (!activeSidebarItem) return
23
23
 
@@ -47,11 +47,35 @@ onMounted(() => {
47
47
  </script>
48
48
 
49
49
  <template>
50
- <ul v-if="sidebarItems.length" class="sidebar-items">
51
- <SidebarItem
50
+ <ul v-if="sidebarItems.length" class="vp-sidebar-items">
51
+ <VPSidebarItem
52
52
  v-for="item in sidebarItems"
53
53
  :key="`${item.text}${item.link}`"
54
54
  :item="item"
55
55
  />
56
56
  </ul>
57
57
  </template>
58
+
59
+ <style lang="scss">
60
+ @import '../styles/variables';
61
+
62
+ .vp-sidebar-items {
63
+ margin: 0;
64
+ padding: 1.5rem 0;
65
+ list-style-type: none;
66
+
67
+ @media (max-width: $MQMobile) {
68
+ padding: 1rem 0;
69
+ }
70
+
71
+ ul {
72
+ margin: 0;
73
+ padding: 0;
74
+ list-style-type: none;
75
+ }
76
+
77
+ a {
78
+ display: inline-block;
79
+ }
80
+ }
81
+ </style>
@@ -0,0 +1,54 @@
1
+ <script setup lang="ts">
2
+ import { useDarkMode } from '@theme/useDarkMode'
3
+ import { useThemeLocaleData } from '@theme/useThemeData'
4
+ import VPDarkIcon from '@theme/VPDarkIcon.vue'
5
+ import VPLightIcon from '@theme/VPLightIcon.vue'
6
+
7
+ const themeLocale = useThemeLocaleData()
8
+ const isDarkMode = useDarkMode()
9
+
10
+ const toggleColorMode = (): void => {
11
+ isDarkMode.value = !isDarkMode.value
12
+ }
13
+ </script>
14
+
15
+ <template>
16
+ <button
17
+ class="vp-toggle-color-mode-button"
18
+ :title="themeLocale.toggleColorMode"
19
+ @click="toggleColorMode"
20
+ >
21
+ <VPLightIcon v-show="!isDarkMode" />
22
+ <VPDarkIcon v-show="isDarkMode" />
23
+ </button>
24
+ </template>
25
+
26
+ <style lang="scss">
27
+ .vp-toggle-color-mode-button {
28
+ display: flex;
29
+
30
+ margin: auto;
31
+ margin-left: 1rem;
32
+ border: 0;
33
+
34
+ background: none;
35
+ color: var(--c-text);
36
+
37
+ opacity: 0.8;
38
+ cursor: pointer;
39
+
40
+ @media print {
41
+ display: none;
42
+ }
43
+
44
+ &:hover {
45
+ opacity: 1;
46
+ }
47
+
48
+ .light-icon,
49
+ .dark-icon {
50
+ width: 1.25rem;
51
+ height: 1.25rem;
52
+ }
53
+ }
54
+ </style>
@@ -0,0 +1,92 @@
1
+ <script setup lang="ts">
2
+ import { useThemeLocaleData } from '@theme/useThemeData'
3
+
4
+ defineEmits<(e: 'toggle') => void>()
5
+
6
+ const themeLocale = useThemeLocaleData()
7
+ </script>
8
+
9
+ <template>
10
+ <div
11
+ class="vp-toggle-sidebar-button"
12
+ :title="themeLocale.toggleSidebar"
13
+ aria-expanded="false"
14
+ role="button"
15
+ tabindex="0"
16
+ @click="$emit('toggle')"
17
+ >
18
+ <div class="icon" aria-hidden="true">
19
+ <span></span>
20
+ <span></span>
21
+ <span></span>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <style lang="scss">
27
+ /* stylelint-disable max-nesting-depth */
28
+ @import '../styles/variables';
29
+
30
+ .vp-toggle-sidebar-button {
31
+ position: absolute;
32
+ top: 0.6rem;
33
+ left: 1rem;
34
+
35
+ display: none;
36
+
37
+ padding: 0.6rem;
38
+
39
+ cursor: pointer;
40
+
41
+ @media screen and (max-width: $MQMobile) {
42
+ display: block;
43
+ }
44
+
45
+ .icon {
46
+ display: flex;
47
+ flex-direction: column;
48
+ align-items: center;
49
+ justify-content: center;
50
+
51
+ width: 1.25rem;
52
+ height: 1.25rem;
53
+
54
+ cursor: inherit;
55
+
56
+ span {
57
+ display: inline-block;
58
+
59
+ width: 100%;
60
+ height: 2px;
61
+ border-radius: 2px;
62
+
63
+ background-color: var(--c-text);
64
+
65
+ transition: transform var(--t-transform);
66
+
67
+ &:nth-child(2) {
68
+ margin: 6px 0;
69
+ }
70
+
71
+ .vp-theme-container.sidebar-open & {
72
+ &:nth-child(1) {
73
+ transform: rotate(45deg) translate3d(5.5px, 5.5px, 0);
74
+ }
75
+
76
+ &:nth-child(2) {
77
+ transform: scale3d(0, 1, 1);
78
+ }
79
+
80
+ &:nth-child(3) {
81
+ transform: rotate(-45deg) translate3d(6px, -6px, 0);
82
+ }
83
+
84
+ &:nth-child(1),
85
+ &:nth-child(3) {
86
+ transform-origin: center;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ </style>
@@ -1,30 +1,27 @@
1
1
  <script setup lang="ts">
2
- defineProps({
3
- type: {
4
- type: String,
5
- required: false,
6
- default: 'tip',
7
- },
8
- text: {
9
- type: String,
10
- required: false,
11
- default: '',
12
- },
13
- vertical: {
14
- type: String,
15
- required: false,
16
- default: undefined,
2
+ import type { VNode } from 'vue'
3
+
4
+ withDefaults(
5
+ defineProps<{
6
+ type?: string
7
+ text?: string
8
+ vertical?: string
9
+ }>(),
10
+ {
11
+ type: 'tip',
12
+ text: '',
13
+ vertical: undefined,
17
14
  },
18
- })
15
+ )
19
16
 
20
17
  defineSlots<{
21
- default?: () => any
18
+ default?: () => VNode | VNode | string | null
22
19
  }>()
23
20
  </script>
24
21
 
25
22
  <template>
26
23
  <span
27
- class="badge"
24
+ class="vp-badge"
28
25
  :class="type"
29
26
  :style="{
30
27
  verticalAlign: vertical,
@@ -33,3 +30,48 @@ defineSlots<{
33
30
  <slot>{{ text }}</slot>
34
31
  </span>
35
32
  </template>
33
+
34
+ <style lang="scss">
35
+ .vp-badge {
36
+ display: inline-block;
37
+ vertical-align: top;
38
+
39
+ height: 18px;
40
+ padding: 0 6px;
41
+ border-radius: 3px;
42
+
43
+ color: var(--c-bg);
44
+
45
+ font-weight: 600;
46
+ font-size: 14px;
47
+ line-height: 18px;
48
+
49
+ transition:
50
+ color var(--t-color),
51
+ background-color var(--t-color);
52
+
53
+ &.tip {
54
+ background-color: var(--c-badge-tip);
55
+ }
56
+
57
+ &.warning {
58
+ background-color: var(--c-badge-warning);
59
+ color: var(--c-badge-warning-text);
60
+ }
61
+
62
+ &.danger {
63
+ background-color: var(--c-badge-danger);
64
+ color: var(--c-badge-danger-text);
65
+ }
66
+
67
+ // update the vertical align for the badge in toc
68
+ .table-of-contents & {
69
+ vertical-align: middle;
70
+ }
71
+
72
+ // avoid extra space between badges
73
+ & + & {
74
+ margin-left: 5px;
75
+ }
76
+ }
77
+ </style>
@@ -1,4 +1,5 @@
1
1
  import type { SlotsType, VNode } from 'vue';
2
+ import '../../styles/code-group.scss';
2
3
  export declare const CodeGroup: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
4
  [key: string]: any;
4
5
  }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, SlotsType<{