valaxy-theme-press 0.0.3 → 0.1.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.
Files changed (58) hide show
  1. package/README.md +7 -0
  2. package/assets/images/none.jpg +0 -0
  3. package/components/PressAlgoliaSearch.vue +208 -0
  4. package/components/PressArticle.vue +12 -6
  5. package/components/PressAside.vue +24 -17
  6. package/components/PressBackdrop.vue +1 -1
  7. package/components/PressButton.vue +5 -1
  8. package/components/PressCategories.vue +8 -3
  9. package/components/PressCategory.vue +13 -11
  10. package/components/PressDocFooterLastUpdated.vue +2 -1
  11. package/components/PressFeatures.vue +1 -1
  12. package/components/PressFooter.vue +1 -1
  13. package/components/PressHome.vue +1 -1
  14. package/components/PressHomeFeatures.vue +1 -0
  15. package/components/PressHomeHero.vue +12 -10
  16. package/components/PressLocalNav.vue +9 -9
  17. package/components/PressNav.vue +30 -5
  18. package/components/PressNavBar.vue +94 -0
  19. package/components/PressNavBarAppearance.vue +5 -0
  20. package/components/PressNavBarHamburger.vue +79 -0
  21. package/components/PressNavBarMenu.vue +14 -0
  22. package/components/PressNavBarSearch.vue +40 -0
  23. package/components/PressNavBarSocialLinks.vue +26 -0
  24. package/components/PressNavBarTranslations.vue +5 -0
  25. package/components/{nav/PressNavItemGroup.vue → PressNavItemGroup.vue} +8 -5
  26. package/components/{nav/PressNavItemLink.vue → PressNavItemLink.vue} +2 -1
  27. package/components/PressNavScreen.vue +95 -0
  28. package/components/PressNavScreenAppearance.vue +32 -0
  29. package/components/PressNavScreenMenu.vue +22 -0
  30. package/components/PressNavScreenMenuGroup.vue +115 -0
  31. package/components/PressNavScreenMenuGroupLink.vue +32 -0
  32. package/components/PressNavScreenMenuGroupSection.vue +37 -0
  33. package/components/PressNavScreenMenuLink.vue +33 -0
  34. package/components/PressNavScreenSocialLinks.vue +13 -0
  35. package/components/PressNavScreenTranslations.vue +7 -0
  36. package/components/PressOutline.vue +3 -4
  37. package/components/PressPostList.vue +6 -6
  38. package/components/PressSidebar.vue +10 -9
  39. package/components/PressSocialLink.vue +40 -0
  40. package/components/PressSocialLinks.vue +26 -0
  41. package/components/ValaxyMain.vue +46 -33
  42. package/composables/config.ts +0 -1
  43. package/composables/nav.ts +37 -0
  44. package/config/index.ts +5 -2
  45. package/layouts/layout.vue +2 -3
  46. package/locales/en.yml +4 -0
  47. package/locales/zh-CN.yml +4 -0
  48. package/package.json +3 -13
  49. package/pages/{[..all].vue → [...all].vue} +1 -0
  50. package/setup/main.ts +16 -3
  51. package/styles/css-vars.scss +11 -6
  52. package/styles/markdown.scss +9 -12
  53. package/tsconfig.json +11 -11
  54. package/types/index.d.ts +20 -5
  55. package/utils/index.ts +8 -0
  56. package/components/DocsBoard.vue +0 -24
  57. package/components/nav/PressNavBar.vue +0 -111
  58. /package/components/{nav/PressSwitchAppearance.vue → PressSwitchAppearance.vue} +0 -0
package/types/index.d.ts CHANGED
@@ -5,8 +5,13 @@ export namespace PressTheme {
5
5
  export type Sidebar = any
6
6
 
7
7
  export interface Footer {
8
- message?: string;
9
- copyright?: string;
8
+ message?: string
9
+ copyright?: string
10
+ }
11
+
12
+ export interface SocialLink {
13
+ icon: string
14
+ link: string
10
15
  }
11
16
 
12
17
  export interface EditLink {
@@ -26,6 +31,8 @@ export namespace PressTheme {
26
31
  }
27
32
 
28
33
  export interface Config {
34
+ logo: string
35
+
29
36
  /**
30
37
  * toc title
31
38
  * @default 'On this page'
@@ -46,6 +53,16 @@ export namespace PressTheme {
46
53
  editLink: EditLink
47
54
 
48
55
  footer: Footer
56
+
57
+ socialLinks: SocialLink[]
58
+
59
+ // label
60
+ /**
61
+ * Toggle dark label
62
+ */
63
+ darkModeSwitchLabel?: string
64
+
65
+ lastUpdatedText?: string
49
66
  }
50
67
  }
51
68
 
@@ -62,10 +79,8 @@ export interface NavItemGroup {
62
79
 
63
80
  export type NavItem = NavItemLink | NavItemGroup
64
81
 
65
-
66
-
67
82
  /**
68
83
  * Theme Config
69
84
  */
70
85
  export type ThemeConfig = PressTheme.Config
71
- export type ThemeUserConfig = Partial<ThemeConfig>
86
+ export type UserThemeConfig = Partial<ThemeConfig>
package/utils/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * get locale title
3
+ * @param locale
4
+ * @param frontmatter
5
+ */
6
+ export function getLocaleTitle(locale: string, frontmatter: any) {
7
+ return frontmatter[`title${locale === 'en' ? '' : `_${locale}`}`]
8
+ }
@@ -1,24 +0,0 @@
1
- <script lang="ts" setup>
2
- import { useI18n } from 'vue-i18n'
3
-
4
- const { t } = useI18n()
5
- </script>
6
-
7
- <template>
8
- <YunBoard m="t-4">
9
- 这里是 Valaxy 的文档兼测试站点
10
-
11
- <ul>
12
- <li>
13
- <router-link to="/docs" :title="t('docs.view_docs')">
14
- {{ t('docs.view_docs') }}
15
- </router-link>
16
- </li>
17
- <li>
18
- <router-link class="flex justify-center" to="/examples">
19
- Examples
20
- </router-link>
21
- </li>
22
- </ul>
23
- </YunBoard>
24
- </template>
@@ -1,111 +0,0 @@
1
- <script lang="ts" setup>
2
- import { useConfig, useSidebar } from 'valaxy'
3
- import { useThemeConfig } from '../../composables'
4
- import PressSwitchAppearance from './PressSwitchAppearance.vue'
5
- import PressNavItemLink from './PressNavItemLink.vue'
6
- import PressNavItemGroup from './PressNavItemGroup.vue'
7
-
8
- defineProps<{
9
- isScreenOpen?: boolean
10
- }>()
11
-
12
- defineEmits<{
13
- (e: 'toggle-screen'): void
14
- }>()
15
-
16
- const { hasSidebar } = useSidebar()
17
-
18
- const config = useConfig()
19
- const themeConfig = useThemeConfig()
20
- </script>
21
-
22
- <template>
23
- <div class="press-navbar flex justify-between items-center px-6 py-4" :class="{ 'has-sidebar': hasSidebar }">
24
- <router-link class="text-xl" to="/" :aria-label="config.title">
25
- <span class="md:inline">{{ config.title }}</span>
26
- </router-link>
27
- <div class="self-stretch flex justify-center items-center text-sm leading-5">
28
- <template v-for="item in themeConfig.nav" :key="item.text">
29
- <PressNavItemLink v-if="'link' in item" class="px-2" :item="item" />
30
- <PressNavItemGroup v-else class="px-2" :item="item" />
31
- </template>
32
- <PressToggleLocale p="x-2" />
33
- <PressSwitchAppearance m="l-2" />
34
- </div>
35
- </div>
36
- </template>
37
-
38
- <style lang="scss">
39
- @use 'valaxy/client/styles/mixins' as *;
40
-
41
- :root {
42
- --pr-navbar-c-bg: rgba(255, 255, 255, 0.8);
43
- }
44
-
45
- .dark {
46
- --pr-navbar-c-bg: rgba(24, 24, 24, 0.8);
47
- }
48
-
49
- .press-navbar {
50
- position: relative;
51
- border-bottom: 1px solid var(--pr-c-divider-light);
52
- padding: 0 8px 0 24px;
53
- height: var(--pr-nav-height);
54
- transition: border-color 0.5s;
55
- background-color: var(--pr-navbar-c-bg);
56
- }
57
-
58
- @include media('md') {
59
- .press-navbar {
60
- padding: 0 32px;
61
- }
62
- }
63
-
64
- @include media('md') {
65
- .press-navbar.has-sidebar .content {
66
- margin-right: -32px;
67
- padding-right: 32px;
68
- -webkit-backdrop-filter: saturate(50%) blur(8px);
69
- backdrop-filter: saturate(50%) blur(8px);
70
- }
71
-
72
- @supports not (backdrop-filter: saturate(50%) blur(8px)) {
73
- .press-navbar.has-sidebar .content {
74
- background: rgba(255, 255, 255, 0.95);
75
- }
76
-
77
- .dark .press-navbar.has-sidebar .content {
78
- background: rgba(36, 36, 36, 0.95);
79
- }
80
- }
81
- }
82
-
83
- .container {
84
- display: flex;
85
- justify-content: space-between;
86
- margin: 0 auto;
87
- max-width: calc(var(--pr-layout-max-width) - 64px);
88
- }
89
-
90
- .menu + .translations::before,
91
- .menu + .appearance::before,
92
- .menu + .social-links::before,
93
- .translations + .appearance::before,
94
- .appearance + .social-links::before {
95
- margin-right: 8px;
96
- margin-left: 8px;
97
- width: 1px;
98
- height: 24px;
99
- background-color: var(--pr-c-divider-light);
100
- content: "";
101
- }
102
-
103
- .menu + .appearance::before,
104
- .translations + .appearance::before {
105
- margin-right: 16px;
106
- }
107
-
108
- .appearance + .social-links::before {
109
- margin-left: 16px;
110
- }
111
- </style>