vuepress-theme-plume 1.0.0-beta.89

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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/lib/client/components/AutoLink.vue +63 -0
  4. package/lib/client/components/Backdrop.vue +41 -0
  5. package/lib/client/components/Blog.vue +34 -0
  6. package/lib/client/components/BlogAvatar.vue +52 -0
  7. package/lib/client/components/DocOutlineItem.vue +57 -0
  8. package/lib/client/components/Flyout/MenuGroup.vue +50 -0
  9. package/lib/client/components/Flyout/MenuLink.vue +58 -0
  10. package/lib/client/components/Flyout/VMenu.vue +77 -0
  11. package/lib/client/components/Flyout/index.vue +148 -0
  12. package/lib/client/components/Home.vue +164 -0
  13. package/lib/client/components/LayoutContent.vue +56 -0
  14. package/lib/client/components/LocalNav.vue +145 -0
  15. package/lib/client/components/LocalNavOutlineDropdown.vue +163 -0
  16. package/lib/client/components/Nav/NavBar.vue +235 -0
  17. package/lib/client/components/Nav/NavBarAppearance.vue +25 -0
  18. package/lib/client/components/Nav/NavBarExtra.vue +92 -0
  19. package/lib/client/components/Nav/NavBarHamburger.vue +116 -0
  20. package/lib/client/components/Nav/NavBarMenu.vue +35 -0
  21. package/lib/client/components/Nav/NavBarMenuGroup.vue +38 -0
  22. package/lib/client/components/Nav/NavBarMenuLink.vue +51 -0
  23. package/lib/client/components/Nav/NavBarSearch.vue +210 -0
  24. package/lib/client/components/Nav/NavBarSocialLinks.vue +27 -0
  25. package/lib/client/components/Nav/NavBarTitle.vue +57 -0
  26. package/lib/client/components/Nav/NavBarTranslations.vue +48 -0
  27. package/lib/client/components/Nav/NavScreen.vue +97 -0
  28. package/lib/client/components/Nav/NavScreenAppearance.vue +33 -0
  29. package/lib/client/components/Nav/NavScreenMenu.vue +26 -0
  30. package/lib/client/components/Nav/NavScreenMenuGroup.vue +128 -0
  31. package/lib/client/components/Nav/NavScreenMenuGroupLink.vue +39 -0
  32. package/lib/client/components/Nav/NavScreenMenuGroupSection.vue +40 -0
  33. package/lib/client/components/Nav/NavScreenMenuLink.vue +36 -0
  34. package/lib/client/components/Nav/NavScreenSocialLinks.vue +14 -0
  35. package/lib/client/components/Nav/NavScreenTranslations.vue +77 -0
  36. package/lib/client/components/Nav/index.vue +52 -0
  37. package/lib/client/components/Page.vue +184 -0
  38. package/lib/client/components/PageAside.vue +95 -0
  39. package/lib/client/components/PageAsideItem.vue +51 -0
  40. package/lib/client/components/PageMeta.vue +131 -0
  41. package/lib/client/components/PostItem.vue +158 -0
  42. package/lib/client/components/PostList.vue +41 -0
  43. package/lib/client/components/Sidebar.vue +143 -0
  44. package/lib/client/components/SidebarItem.vue +238 -0
  45. package/lib/client/components/SkipLink.vue +72 -0
  46. package/lib/client/components/SocialLink.vue +50 -0
  47. package/lib/client/components/SocialLinks.vue +27 -0
  48. package/lib/client/components/Switch.vue +63 -0
  49. package/lib/client/components/SwitchAppearance.vue +120 -0
  50. package/lib/client/components/Toc.d.ts +47 -0
  51. package/lib/client/components/Toc.js +89 -0
  52. package/lib/client/components/VButton.vue +133 -0
  53. package/lib/client/components/VFooter.vue +81 -0
  54. package/lib/client/components/VImage.vue +50 -0
  55. package/lib/client/components/global/Badge.vue +68 -0
  56. package/lib/client/components/icons/IconAlignJustify.vue +21 -0
  57. package/lib/client/components/icons/IconAlignLeft.vue +21 -0
  58. package/lib/client/components/icons/IconAlignRight.vue +21 -0
  59. package/lib/client/components/icons/IconArrowLeft.vue +7 -0
  60. package/lib/client/components/icons/IconArrowRight.vue +7 -0
  61. package/lib/client/components/icons/IconChevronDown.vue +12 -0
  62. package/lib/client/components/icons/IconChevronLeft.vue +12 -0
  63. package/lib/client/components/icons/IconChevronRight.vue +12 -0
  64. package/lib/client/components/icons/IconChevronUp.vue +12 -0
  65. package/lib/client/components/icons/IconClock.vue +8 -0
  66. package/lib/client/components/icons/IconEdit.vue +10 -0
  67. package/lib/client/components/icons/IconExternalLink.vue +13 -0
  68. package/lib/client/components/icons/IconFolder.vue +11 -0
  69. package/lib/client/components/icons/IconHeart.vue +7 -0
  70. package/lib/client/components/icons/IconLanguages.vue +14 -0
  71. package/lib/client/components/icons/IconMinus.vue +5 -0
  72. package/lib/client/components/icons/IconMinusSquare.vue +14 -0
  73. package/lib/client/components/icons/IconMoon.vue +12 -0
  74. package/lib/client/components/icons/IconMoreHorizontal.vue +12 -0
  75. package/lib/client/components/icons/IconPlus.vue +12 -0
  76. package/lib/client/components/icons/IconPlusSquare.vue +10 -0
  77. package/lib/client/components/icons/IconSun.vue +36 -0
  78. package/lib/client/components/icons/IconTag.vue +11 -0
  79. package/lib/client/composables/aside.d.ts +5 -0
  80. package/lib/client/composables/aside.js +100 -0
  81. package/lib/client/composables/darkMode.d.ts +11 -0
  82. package/lib/client/composables/darkMode.js +24 -0
  83. package/lib/client/composables/flyout.d.ts +9 -0
  84. package/lib/client/composables/flyout.js +41 -0
  85. package/lib/client/composables/index.d.ts +6 -0
  86. package/lib/client/composables/index.js +6 -0
  87. package/lib/client/composables/langs.d.ts +13 -0
  88. package/lib/client/composables/langs.js +32 -0
  89. package/lib/client/composables/nav.d.ts +8 -0
  90. package/lib/client/composables/nav.js +30 -0
  91. package/lib/client/composables/sidebar.d.ts +30 -0
  92. package/lib/client/composables/sidebar.js +153 -0
  93. package/lib/client/composables/themeData.d.ts +4 -0
  94. package/lib/client/composables/themeData.js +3 -0
  95. package/lib/client/composables/useResolveRouteWithRedirect.d.ts +5 -0
  96. package/lib/client/composables/useResolveRouteWithRedirect.js +24 -0
  97. package/lib/client/composables/useScrollPromise.d.ts +6 -0
  98. package/lib/client/composables/useScrollPromise.js +14 -0
  99. package/lib/client/config.d.ts +3 -0
  100. package/lib/client/config.js +51 -0
  101. package/lib/client/fonts/inter-italic-cyrillic-ext.woff2 +0 -0
  102. package/lib/client/fonts/inter-italic-cyrillic.woff2 +0 -0
  103. package/lib/client/fonts/inter-italic-greek-ext.woff2 +0 -0
  104. package/lib/client/fonts/inter-italic-greek.woff2 +0 -0
  105. package/lib/client/fonts/inter-italic-latin-ext.woff2 +0 -0
  106. package/lib/client/fonts/inter-italic-latin.woff2 +0 -0
  107. package/lib/client/fonts/inter-italic-vietnamese.woff2 +0 -0
  108. package/lib/client/fonts/inter-roman-cyrillic-ext.woff2 +0 -0
  109. package/lib/client/fonts/inter-roman-cyrillic.woff2 +0 -0
  110. package/lib/client/fonts/inter-roman-greek-ext.woff2 +0 -0
  111. package/lib/client/fonts/inter-roman-greek.woff2 +0 -0
  112. package/lib/client/fonts/inter-roman-latin-ext.woff2 +0 -0
  113. package/lib/client/fonts/inter-roman-latin.woff2 +0 -0
  114. package/lib/client/fonts/inter-roman-vietnamese.woff2 +0 -0
  115. package/lib/client/index.d.ts +4 -0
  116. package/lib/client/index.js +4 -0
  117. package/lib/client/layouts/Layout.vue +65 -0
  118. package/lib/client/layouts/NotFound.vue +101 -0
  119. package/lib/client/shim.d.ts +7 -0
  120. package/lib/client/styles/_variables.scss +5 -0
  121. package/lib/client/styles/code.scss +294 -0
  122. package/lib/client/styles/content.scss +526 -0
  123. package/lib/client/styles/fonts.scss +165 -0
  124. package/lib/client/styles/index.scss +9 -0
  125. package/lib/client/styles/normalize.scss +258 -0
  126. package/lib/client/styles/nprogress.scss +14 -0
  127. package/lib/client/styles/utils.scss +18 -0
  128. package/lib/client/styles/vars.scss +431 -0
  129. package/lib/client/utils/animate.d.ts +9 -0
  130. package/lib/client/utils/animate.js +13 -0
  131. package/lib/client/utils/dom.d.ts +4 -0
  132. package/lib/client/utils/dom.js +53 -0
  133. package/lib/client/utils/index.d.ts +4 -0
  134. package/lib/client/utils/index.js +4 -0
  135. package/lib/client/utils/normalizeLink.d.ts +1 -0
  136. package/lib/client/utils/normalizeLink.js +12 -0
  137. package/lib/client/utils/shared.d.ts +11 -0
  138. package/lib/client/utils/shared.js +52 -0
  139. package/lib/client/utils/socialIcons.d.ts +14 -0
  140. package/lib/client/utils/socialIcons.js +15 -0
  141. package/lib/node/autoFrontmatter.d.ts +4 -0
  142. package/lib/node/autoFrontmatter.js +147 -0
  143. package/lib/node/defaultOptions.d.ts +3 -0
  144. package/lib/node/defaultOptions.js +32 -0
  145. package/lib/node/defineConfig.d.ts +4 -0
  146. package/lib/node/defineConfig.js +2 -0
  147. package/lib/node/index.d.ts +5 -0
  148. package/lib/node/index.js +5 -0
  149. package/lib/node/plugins.d.ts +3 -0
  150. package/lib/node/plugins.js +157 -0
  151. package/lib/node/setupPages.d.ts +5 -0
  152. package/lib/node/setupPages.js +57 -0
  153. package/lib/node/theme.d.ts +3 -0
  154. package/lib/node/theme.js +33 -0
  155. package/lib/shared/base.d.ts +8 -0
  156. package/lib/shared/base.js +1 -0
  157. package/lib/shared/blog.d.ts +9 -0
  158. package/lib/shared/blog.js +1 -0
  159. package/lib/shared/frontmatter.d.ts +30 -0
  160. package/lib/shared/frontmatter.js +1 -0
  161. package/lib/shared/index.d.ts +5 -0
  162. package/lib/shared/index.js +5 -0
  163. package/lib/shared/options/index.d.ts +14 -0
  164. package/lib/shared/options/index.js +3 -0
  165. package/lib/shared/options/locale.d.ts +166 -0
  166. package/lib/shared/options/locale.js +1 -0
  167. package/lib/shared/options/navbar.d.ts +26 -0
  168. package/lib/shared/options/navbar.js +1 -0
  169. package/lib/shared/options/plugins.d.ts +38 -0
  170. package/lib/shared/options/plugins.js +1 -0
  171. package/lib/shared/page.d.ts +13 -0
  172. package/lib/shared/page.js +1 -0
  173. package/package.json +85 -0
  174. package/templates/build.html +24 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (C) 2021 - PRESENT by pengzhanbo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # `vuepress-theme-plume`
2
+
3
+ 一款基于 VuePress@2 的博客皮肤。
4
+
5
+ [查看使用文档](https://pengzhanbo.cn/note/vuepress-theme-plume)
6
+
7
+ ## Install
8
+ ``` sh
9
+ # use yarn
10
+ yarn add vuepress-theme-plume
11
+ # or npm
12
+ npm i vuepress-theme-plume
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ``` js
18
+ // .vuepress/config.ts
19
+ import { defineUserConfig } from 'vuepress'
20
+ import { plumeTheme } from 'vuepress-theme-plume'
21
+
22
+ export default defineUserConfig({
23
+ theme: plumeTheme({
24
+ // theme config
25
+ })
26
+ })
27
+ ```
@@ -0,0 +1,63 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from 'vue'
3
+ import { useRouter } from 'vue-router'
4
+ import { EXTERNAL_URL_RE, normalizeLink } from '../utils/index.js'
5
+ import IconExternalLink from './icons/IconExternalLink.vue'
6
+
7
+ const props = defineProps<{
8
+ tag?: string
9
+ href?: string
10
+ noIcon?: boolean
11
+ target?: string
12
+ rel?: string
13
+ }>()
14
+
15
+ const router = useRouter()
16
+
17
+ const tag = computed(() => props.tag ?? (props.href ? 'a' : 'span'))
18
+ const isExternal = computed(
19
+ () => props.href && EXTERNAL_URL_RE.test(props.href)
20
+ )
21
+
22
+ const linkTo = (e: Event) => {
23
+ if (!isExternal.value) {
24
+ e.preventDefault()
25
+ if (props.href) {
26
+ router.push({ path: props.href })
27
+ }
28
+ }
29
+ }
30
+ </script>
31
+
32
+ <template>
33
+ <Component
34
+ :is="tag"
35
+ class="auto-link"
36
+ :class="{ link: href }"
37
+ :href="href ? normalizeLink(href) : undefined"
38
+ :target="target ?? (isExternal ? '_blank' : undefined)"
39
+ :rel="rel ?? (isExternal ? 'noreferrer' : undefined)"
40
+ @click="linkTo($event)"
41
+ >
42
+ <slot />
43
+ <IconExternalLink v-if="isExternal && !noIcon" class="icon" />
44
+ </Component>
45
+ </template>
46
+
47
+ <style scoped>
48
+ .icon {
49
+ display: inline-block;
50
+ margin-top: -1px;
51
+ margin-left: 4px;
52
+ width: 11px;
53
+ height: 11px;
54
+ fill: var(--vp-c-text-3);
55
+ transition: fill 0.25s;
56
+ }
57
+
58
+ .auto-link :deep(i) {
59
+ font-style: normal;
60
+ font-weight: inherit;
61
+ line-height: normal;
62
+ }
63
+ </style>
@@ -0,0 +1,41 @@
1
+ <script lang="ts" setup>
2
+ defineProps<{
3
+ show: boolean
4
+ }>()
5
+ </script>
6
+
7
+ <template>
8
+ <Transition name="fade">
9
+ <div v-if="show" class="backdrop" />
10
+ </Transition>
11
+ </template>
12
+
13
+ <style scoped>
14
+ .backdrop {
15
+ position: fixed;
16
+ top: 0;
17
+ /*rtl:ignore*/
18
+ right: 0;
19
+ bottom: 0;
20
+ /*rtl:ignore*/
21
+ left: 0;
22
+ z-index: var(--vp-z-index-backdrop);
23
+ background: var(--vp-backdrop-bg-color);
24
+ transition: opacity 0.5s;
25
+ }
26
+
27
+ .backdrop.fade-enter-from,
28
+ .backdrop.fade-leave-to {
29
+ opacity: 0;
30
+ }
31
+
32
+ .backdrop.fade-leave-active {
33
+ transition-duration: 0.25s;
34
+ }
35
+
36
+ @media (min-width: 1280px) {
37
+ .backdrop {
38
+ display: none;
39
+ }
40
+ }
41
+ </style>
@@ -0,0 +1,34 @@
1
+ <script lang="ts" setup>
2
+ import BlogAvatar from './BlogAvatar.vue'
3
+ import PostList from './PostList.vue'
4
+ </script>
5
+ <template>
6
+ <div class="blog-wrapper">
7
+ <PostList />
8
+ <BlogAvatar />
9
+ </div>
10
+ </template>
11
+
12
+ <style scoped>
13
+ .blog-wrapper {
14
+ display: flex;
15
+ align-items: flex-start;
16
+ justify-content: flex-start;
17
+ width: 100%;
18
+ margin: 0 auto;
19
+ padding-top: var(--vp-nav-height);
20
+ }
21
+
22
+ @media (min-width: 960px) {
23
+ .blog-wrapper {
24
+ max-width: 784px;
25
+ padding-top: 0;
26
+ }
27
+ }
28
+
29
+ @media (min-width: 1440px) {
30
+ .blog-wrapper {
31
+ max-width: 1104px;
32
+ }
33
+ }
34
+ </style>
@@ -0,0 +1,52 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from 'vue'
3
+ import { useThemeLocaleData } from '../composables/index.js'
4
+
5
+ const theme = useThemeLocaleData()
6
+
7
+ const avatar = computed(() => theme.value.avatar)
8
+ </script>
9
+
10
+ <template>
11
+ <div v-if="avatar" class="blog-avatar-wrapper">
12
+ <div class="avatar-profile">
13
+ <p v-if="avatar.url">
14
+ <img :src="avatar.url" :alt="avatar.name" />
15
+ </p>
16
+ <div>
17
+ <h3>{{ avatar.name }}</h3>
18
+ <p>{{ avatar.description }}</p>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </template>
23
+
24
+ <style lang="scss" scoped>
25
+ .blog-avatar-wrapper {
26
+ position: sticky;
27
+ top: calc(var(--vp-nav-height) + 2rem);
28
+ width: 270px;
29
+ margin-left: 2rem;
30
+ margin-top: 2rem;
31
+ border-left: solid 1px var(--vp-c-divider);
32
+ text-align: center;
33
+ padding: 1rem 0;
34
+
35
+ img {
36
+ width: 50%;
37
+ margin: auto;
38
+ }
39
+
40
+ h3 {
41
+ font-size: 16px;
42
+ font-weight: 600;
43
+ margin-top: 1.5rem;
44
+ }
45
+ }
46
+
47
+ @media (max-width: 768px) {
48
+ .blog-avatar-wrapper {
49
+ display: none;
50
+ }
51
+ }
52
+ </style>
@@ -0,0 +1,57 @@
1
+ <script setup lang="ts">
2
+ import type { PageHeader } from '@vuepress/client'
3
+
4
+ defineProps<{
5
+ headers: PageHeader[]
6
+ root?: boolean
7
+ }>()
8
+
9
+ function onClick({ target: el }: Event) {
10
+ const id = (el as HTMLAnchorElement).href!.split('#')[1]
11
+ const heading = document.getElementById(decodeURIComponent(id))
12
+ heading?.focus({ preventScroll: true })
13
+ }
14
+ </script>
15
+
16
+ <template>
17
+ <ul :class="root ? 'root' : 'nested'">
18
+ <li v-for="{ children, link, title } in headers" :key="link">
19
+ <a class="outline-link" :href="link" :title="title" @click="onClick">{{ title }}</a>
20
+ <template v-if="children?.length">
21
+ <DocOutlineItem :headers="children" />
22
+ </template>
23
+ </li>
24
+ </ul>
25
+ </template>
26
+
27
+ <style scoped>
28
+ .root {
29
+ position: relative;
30
+ z-index: 1;
31
+ }
32
+
33
+ .nested {
34
+ padding-left: 16px;
35
+ }
36
+
37
+ .outline-link {
38
+ display: block;
39
+ line-height: 28px;
40
+ color: var(--vp-c-text-2);
41
+ white-space: nowrap;
42
+ overflow: hidden;
43
+ text-overflow: ellipsis;
44
+ transition: color 0.5s;
45
+ font-weight: 400;
46
+ }
47
+
48
+ .outline-link:hover,
49
+ .outline-link.active {
50
+ color: var(--vp-c-text-1);
51
+ transition: color 0.25s;
52
+ }
53
+
54
+ .outline-link.nested {
55
+ padding-left: 13px;
56
+ }
57
+ </style>
@@ -0,0 +1,50 @@
1
+ <script lang="ts" setup>
2
+ import MenuLink from './MenuLink.vue'
3
+
4
+ defineProps<{
5
+ text?: string
6
+ icon?: string
7
+ items: any[]
8
+ }>()
9
+ </script>
10
+
11
+ <template>
12
+ <div class="menu-group">
13
+ <p v-if="text" class="title">
14
+ <Icon v-if="icon" :name="icon" />
15
+ <span v-text="text"></span>
16
+ </p>
17
+
18
+ <template v-for="item in items">
19
+ <MenuLink v-if="'link' in item" :key="item?.link" :item="item" />
20
+ </template>
21
+ </div>
22
+ </template>
23
+
24
+ <style scoped>
25
+ .menu-group {
26
+ margin: 12px -12px 0;
27
+ border-top: 1px solid var(--vp-c-divider);
28
+ padding: 12px 12px 0;
29
+ }
30
+
31
+ .menu-group:first-child {
32
+ margin-top: 0;
33
+ border-top: 0;
34
+ padding-top: 0;
35
+ }
36
+
37
+ .menu-group + .menu-group {
38
+ margin-top: 12px;
39
+ border-top: 1px solid var(--vp-c-divider);
40
+ }
41
+
42
+ .title {
43
+ padding: 0 12px;
44
+ line-height: 32px;
45
+ font-size: 14px;
46
+ font-weight: 600;
47
+ color: var(--vp-c-text-2);
48
+ transition: color 0.25s;
49
+ }
50
+ </style>
@@ -0,0 +1,58 @@
1
+ <script lang="ts" setup>
2
+ import { usePageData } from '@vuepress/client'
3
+ import { isActive } from '../../utils/index.js'
4
+ import AutoLink from '../AutoLink.vue'
5
+
6
+ defineProps<{
7
+ item: any
8
+ }>()
9
+
10
+ const page = usePageData()
11
+ </script>
12
+
13
+ <template>
14
+ <div class="menu-link">
15
+ <AutoLink
16
+ :class="{
17
+ active: isActive(
18
+ page.path,
19
+ item.activeMatch || item.link,
20
+ !!item.activeMatch
21
+ ),
22
+ }"
23
+ :href="item.link"
24
+ >
25
+ <Icon v-if="item.icon" :name="item.icon" />
26
+ <i v-text="item.text"></i>
27
+ </AutoLink>
28
+ </div>
29
+ </template>
30
+
31
+ <style scoped>
32
+ .menu-group + .menu-link {
33
+ margin: 12px -12px 0;
34
+ border-top: 1px solid var(--vp-c-divider);
35
+ padding: 12px 12px 0;
36
+ }
37
+
38
+ .link {
39
+ display: block;
40
+ border-radius: 6px;
41
+ padding: 0 12px;
42
+ line-height: 32px;
43
+ font-size: 14px;
44
+ font-weight: 500;
45
+ color: var(--vp-c-text-1);
46
+ white-space: nowrap;
47
+ transition: background-color 0.25s, color 0.25s;
48
+ }
49
+
50
+ .link:hover {
51
+ color: var(--vp-c-brand);
52
+ background-color: var(--vp-c-bg-elv-mute);
53
+ }
54
+
55
+ .link.active {
56
+ color: var(--vp-c-brand);
57
+ }
58
+ </style>
@@ -0,0 +1,77 @@
1
+ <script lang="ts" setup>
2
+ import MenuGroup from './MenuGroup.vue'
3
+ import MenuLink from './MenuLink.vue'
4
+
5
+ defineProps<{
6
+ items?: any[]
7
+ }>()
8
+ </script>
9
+
10
+ <template>
11
+ <div class="menu-wrapper">
12
+ <div v-if="items" class="items">
13
+ <template v-for="item in items" :key="item.text">
14
+ <MenuLink v-if="'link' in item" :item="item" />
15
+ <MenuGroup
16
+ v-else
17
+ :text="item.text"
18
+ :items="item.items"
19
+ :icon="item.icon"
20
+ />
21
+ </template>
22
+ </div>
23
+
24
+ <slot />
25
+ </div>
26
+ </template>
27
+
28
+ <style scoped>
29
+ .menu-wrapper {
30
+ border-radius: 12px;
31
+ padding: 12px;
32
+ min-width: 128px;
33
+ border: 1px solid var(--vp-c-divider);
34
+ background-color: var(--vp-c-bg-elv);
35
+ box-shadow: var(--vp-shadow-3);
36
+ transition: background-color 0.5s;
37
+ max-height: calc(100vh - var(--vp-nav-height));
38
+ overflow-y: auto;
39
+ }
40
+
41
+ .menu-wrapper :deep(.group) {
42
+ margin: 0 -12px;
43
+ padding: 0 12px 12px;
44
+ }
45
+
46
+ .menu-wrapper :deep(.group + .group) {
47
+ border-top: 1px solid var(--vp-c-divider);
48
+ padding: 11px 12px 12px;
49
+ }
50
+
51
+ .menu-wrapper :deep(.group:last-child) {
52
+ padding-bottom: 0;
53
+ }
54
+
55
+ .menu-wrapper :deep(.group + .item) {
56
+ border-top: 1px solid var(--vp-c-divider);
57
+ padding: 11px 16px 0;
58
+ }
59
+
60
+ .menu-wrapper :deep(.item) {
61
+ padding: 0 16px;
62
+ white-space: nowrap;
63
+ }
64
+
65
+ .menu-wrapper :deep(.label) {
66
+ flex-grow: 1;
67
+ line-height: 28px;
68
+ font-size: 12px;
69
+ font-weight: 500;
70
+ color: var(--vp-c-text-2);
71
+ transition: color 0.5s;
72
+ }
73
+
74
+ .menu-wrapper :deep(.action) {
75
+ padding-left: 24px;
76
+ }
77
+ </style>
@@ -0,0 +1,148 @@
1
+ <script lang="ts" setup>
2
+ import { ref } from 'vue'
3
+ import { useFlyout } from '../../composables/flyout.js'
4
+ import IconChevronDown from '../icons/IconChevronDown.vue'
5
+ import IconMoreHorizontal from '../icons/IconMoreHorizontal.vue'
6
+ import VMenu from './VMenu.vue'
7
+
8
+ defineProps<{
9
+ prefixIcon?: string
10
+ icon?: any
11
+ button?: string
12
+ label?: string
13
+ items?: any[]
14
+ }>()
15
+
16
+ const open = ref(false)
17
+ const el = ref<HTMLElement>()
18
+
19
+ useFlyout({ el, onBlur })
20
+
21
+ function onBlur() {
22
+ open.value = false
23
+ }
24
+ </script>
25
+
26
+ <script lang="ts">
27
+ export default {
28
+ // eslint-disable-next-line vue/match-component-file-name
29
+ name: 'Flyout',
30
+ }
31
+ </script>
32
+
33
+ <template>
34
+ <div
35
+ ref="el"
36
+ class="flyout-wrapper"
37
+ @mouseenter="open = true"
38
+ @mouseleave="open = false"
39
+ >
40
+ <button
41
+ type="button"
42
+ class="button"
43
+ aria-haspopup="true"
44
+ :aria-expanded="open"
45
+ :aria-label="label"
46
+ @click="open = !open"
47
+ >
48
+ <span v-if="button || icon" class="text">
49
+ <Icon v-if="prefixIcon" :name="prefixIcon" />
50
+ <Component :is="icon" v-if="icon" class="option-icon" />
51
+ {{ button }}
52
+ <IconChevronDown class="text-icon" />
53
+ </span>
54
+
55
+ <IconMoreHorizontal v-else class="icon" />
56
+ </button>
57
+
58
+ <div class="menu">
59
+ <VMenu :items="items">
60
+ <slot />
61
+ </VMenu>
62
+ </div>
63
+ </div>
64
+ </template>
65
+
66
+ <style scoped>
67
+ .flyout-wrapper {
68
+ position: relative;
69
+ }
70
+
71
+ .flyout-wrapper:hover {
72
+ color: var(--vp-c-brand);
73
+ transition: color 0.25s;
74
+ }
75
+
76
+ .flyout-wrapper:hover .text {
77
+ color: var(--vp-c-text-2);
78
+ }
79
+
80
+ .flyout-wrapper:hover .icon {
81
+ fill: var(--vp-c-text-2);
82
+ }
83
+
84
+ .flyout-wrapper.active .text {
85
+ color: var(--vp-c-brand);
86
+ }
87
+
88
+ .flyout-wrapper.active:hover .text {
89
+ color: var(--vp-c-brand-dark);
90
+ }
91
+
92
+ .flyout-wrapper:hover .menu,
93
+ .button[aria-expanded='true'] + .menu {
94
+ opacity: 1;
95
+ visibility: visible;
96
+ transform: translateY(0);
97
+ }
98
+
99
+ .button {
100
+ display: flex;
101
+ align-items: center;
102
+ padding: 0 12px;
103
+ height: var(--vp-nav-height);
104
+ color: var(--vp-c-text-1);
105
+ transition: color 0.5s;
106
+ }
107
+
108
+ .text {
109
+ display: flex;
110
+ align-items: center;
111
+ /* line-height: var(--vp-nav-height); */
112
+ line-height: normal;
113
+ font-size: 14px;
114
+ font-weight: 500;
115
+ color: var(--vp-c-text-1);
116
+ transition: color 0.25s;
117
+ }
118
+
119
+ .option-icon {
120
+ margin-right: 0px;
121
+ width: 16px;
122
+ height: 16px;
123
+ fill: currentColor;
124
+ }
125
+
126
+ .text-icon {
127
+ margin-left: 4px;
128
+ width: 14px;
129
+ height: 14px;
130
+ fill: currentColor;
131
+ }
132
+
133
+ .icon {
134
+ width: 20px;
135
+ height: 20px;
136
+ fill: currentColor;
137
+ transition: fill 0.25s;
138
+ }
139
+
140
+ .menu {
141
+ position: absolute;
142
+ top: calc(var(--vp-nav-height) / 2 + 20px);
143
+ right: 0;
144
+ opacity: 0;
145
+ visibility: hidden;
146
+ transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
147
+ }
148
+ </style>