valaxy-theme-press 0.0.1 → 0.0.2

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 ADDED
@@ -0,0 +1,8 @@
1
+ # valaxy-theme-press
2
+
3
+ This is a theme for valaxy docs.
4
+
5
+ ## Reference
6
+
7
+ - [vitepress](https://vitepress.vuejs.org/)
8
+ - [nextjs](https://nextjs.org/)
@@ -0,0 +1,24 @@
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
+ <a href="/docs" :title="t('docs.view_docs')">
14
+ {{ t('docs.view_docs') }}
15
+ </a>
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>
@@ -0,0 +1,88 @@
1
+ <script lang="ts" setup>
2
+ // import { useI18n } from 'vue-i18n'
3
+ import { useData, useFrontmatter } from 'valaxy'
4
+ import { useAppStore } from 'valaxy/client/stores/app'
5
+
6
+ const frontmatter = useFrontmatter()
7
+ const data = useData()
8
+ // const { t } = useI18n()
9
+ const app = useAppStore()
10
+ </script>
11
+
12
+ <template>
13
+ <button
14
+ class="xl:hidden toc-btn shadow fixed press-icon-btn z-350"
15
+ opacity="75" right="2" bottom="19"
16
+ @click="app.toggleRightSidebar()"
17
+ >
18
+ <div i-ri-file-list-line />
19
+ </button>
20
+
21
+ <ValaxyOverlay :show="app.isRightSidebarOpen" @click="app.toggleRightSidebar()" />
22
+
23
+ <aside
24
+ class="press-aside lt-xl:fixed
25
+ press-card xl:(shadow-none hover:shadow-none) shadow hover:shadow-lg"
26
+ p="l-0 xl:l-4" text="center"
27
+ z="10"
28
+ :class="app.isRightSidebarOpen && 'open'"
29
+ >
30
+ <div class="aside-container lt-xl:fixed" flex="~ col">
31
+ <PressToc v-if="frontmatter.toc !== false" :headers="data.headers || []" />
32
+ <div class="flex-grow" />
33
+ <div v-if="$slots.default" class="custom-container">
34
+ <slot />
35
+ </div>
36
+ </div>
37
+ </aside>
38
+ </template>
39
+
40
+ <style lang="scss">
41
+ @use 'valaxy/client/styles/mixins' as *;
42
+
43
+ .press-card{
44
+ box-shadow: none;
45
+ background-color: var(--va-c-bg);
46
+ }
47
+
48
+ .press-aside {
49
+ position: relative;
50
+ min-width: 272px;
51
+ transform: translateX(100%);
52
+ top: 0;
53
+ bottom: 0;
54
+ right: 0;
55
+ z-index: 10;
56
+
57
+ transition: box-shadow var(--va-transition-duration), opacity 0.25s,
58
+ transform var(--va-transition-duration) cubic-bezier(0.19, 1, 0.22, 1);
59
+
60
+ &.open {
61
+ display: block;
62
+ transform: translateX(0);
63
+ }
64
+ }
65
+
66
+ .aside-container {
67
+ position: sticky;
68
+ top: calc(var(--pr-nav-height) + 32px);
69
+ margin-top: calc(var(--pr-nav-height) * -1 - 32px);
70
+ padding-top: calc(var(--pr-nav-height) + 32px);
71
+ height: 100vh;
72
+ }
73
+
74
+ @include media('xl') {
75
+ .aside-container {
76
+ top: 0;
77
+ }
78
+
79
+ .press-aside {
80
+ transform: translateX(0);
81
+ }
82
+ }
83
+
84
+ .toc-btn {
85
+ color: var(--va-c-primary);
86
+ background-color: var(--va-c-bg);
87
+ }
88
+ </style>
@@ -0,0 +1,39 @@
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="press-backdrop" />
10
+ </transition>
11
+ </template>
12
+
13
+ <style scoped lang="scss">
14
+ .press-backdrop {
15
+ position: fixed;
16
+ top: 0;
17
+ right: 0;
18
+ bottom: 0;
19
+ left: 0;
20
+ z-index: var(--pr-z-index-backdrop);
21
+ background: rgba(0, 0, 0, .6);
22
+ transition: opacity 0.5s;
23
+
24
+ .fade-enter-from,
25
+ .fade-leave-to {
26
+ opacity: 0;
27
+ }
28
+
29
+ .fade-leave-active {
30
+ transition-duration: .25s;
31
+ }
32
+ }
33
+
34
+ @media (min-width: 1280px) {
35
+ .press-backdrop {
36
+ display: none;
37
+ }
38
+ }
39
+ </style>
@@ -0,0 +1,38 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from 'vue'
3
+ import { useRouter } from 'vue-router'
4
+ import { EXTERNAL_URL_RE } from 'valaxy'
5
+
6
+ const props = defineProps<{
7
+ theme: 'brand' | 'alt'
8
+ link: string
9
+ text: string
10
+ }>()
11
+
12
+ const isUrl = computed(() => EXTERNAL_URL_RE.test(props.link))
13
+ const router = useRouter()
14
+
15
+ const classes = computed(() => {
16
+ const arr = []
17
+ if (props.theme === 'brand')
18
+ arr.push('from-blue-500', 'to-blue-700')
19
+ else
20
+ arr.push('from-gray-600', 'to-stone-700')
21
+
22
+ return arr
23
+ })
24
+ </script>
25
+
26
+ <template>
27
+ <component
28
+ :is="isUrl ? 'a' : 'button'"
29
+ m="2"
30
+ :class="classes"
31
+ class="sese-btn btn" bg="gradient-to-r"
32
+ :href="isUrl ? link : undefined"
33
+ :target="isUrl ? '_blank' : undefined"
34
+ @click="!isUrl && router.push(link)"
35
+ >
36
+ {{ text }}
37
+ </component>
38
+ </template>
@@ -0,0 +1,50 @@
1
+ <script lang="ts" setup>
2
+ import type { Categories } from 'valaxy'
3
+ import { ref } from 'vue'
4
+
5
+ const props = withDefaults(defineProps<{
6
+ categories: Categories
7
+ /**
8
+ * 当前层级
9
+ */
10
+ level?: number
11
+ displayCategory?: (category: string) => void
12
+ collapsable?: boolean
13
+ }>(), {
14
+ level: 0,
15
+ collapsable: true,
16
+ })
17
+
18
+ const collapsable = ref(props.collapsable)
19
+ </script>
20
+
21
+ <template>
22
+ <ul v-for="category, key in Object.fromEntries(categories)" :key="key" class="category-list" m="l-4">
23
+ <PressCategory :name="key.toString()" :category="category" :level="level + 1" :display-category="displayCategory" :collapsable="collapsable" />
24
+ </ul>
25
+ </template>
26
+
27
+ <style lang="scss">
28
+ .post-list-item {
29
+ a {
30
+ color: var(--va-c-text-light);
31
+ transition: all 0.2s;
32
+
33
+ &:hover {
34
+ color: var(--va-c-primary);
35
+ }
36
+
37
+ &.active {
38
+ color: var(--va-c-primary);
39
+ }
40
+ }
41
+ }
42
+
43
+ .category-list-item {
44
+ .folder-action {
45
+ &:hover {
46
+ color: var(--va-c-primary);
47
+ }
48
+ }
49
+ }
50
+ </style>
@@ -0,0 +1,51 @@
1
+ <script lang="ts" setup>
2
+ import { ref } from 'vue'
3
+ import type { Category, Post } from 'valaxy'
4
+ import { isParentCategory } from 'valaxy'
5
+ import { useI18n } from 'vue-i18n'
6
+
7
+ const props = withDefaults(defineProps<{
8
+ name: string
9
+ // to eliminate the warning
10
+ category: Category
11
+ level?: number
12
+ displayCategory?: (category: string) => void
13
+
14
+ /**
15
+ * collapse children
16
+ */
17
+ collapsable?: boolean
18
+ }>(), {
19
+ collapsable: true,
20
+ })
21
+
22
+ const collapsable = ref(props.collapsable)
23
+ const { t, locale } = useI18n()
24
+
25
+ const getTitle = (post: Post | any) => {
26
+ const lang = locale.value === 'zh-CN' ? 'zh' : locale.value
27
+ return post[`title_${lang}`] ? post[`title_${lang}`] : post.title
28
+ }
29
+ </script>
30
+
31
+ <template>
32
+ <li v-if="category.total" class="category-list-item inline-flex items-center">
33
+ <span class="folder-action inline-flex cursor-pointer" @click="collapsable = !collapsable">
34
+ <div v-if="collapsable" i-ri-folder-add-line />
35
+ <div v-else style="color:var(--va-c-primary)" i-ri-folder-reduce-line /></span>
36
+ <span class="category-name" m="l-1" @click="displayCategory ? displayCategory(name) : null">
37
+ {{ name === 'Uncategorized' ? t('category.uncategorized') : name }} [{{ category.total }}]
38
+ </span>
39
+ </li>
40
+
41
+ <template v-if="!collapsable">
42
+ <ul v-if="!isParentCategory(category)">
43
+ <li v-for="post, i in category.posts" :key="i" class="post-list-item" m="l-4">
44
+ <router-link v-if="post.title" :to="post.path || ''" class="inline-flex items-center" active-class="active">
45
+ <span m="l-1" text="sm">{{ getTitle(post) }}</span>
46
+ </router-link>
47
+ </li>
48
+ </ul>
49
+ <PressCategories v-else :categories="category.children" :display-category="displayCategory" :collapsable="collapsable" />
50
+ </template>
51
+ </template>
@@ -0,0 +1,61 @@
1
+ <script setup lang="ts">
2
+ import type { Feature } from '../types'
3
+
4
+ defineProps<{
5
+ feature: Feature
6
+ }>()
7
+ </script>
8
+
9
+ <template>
10
+ <article class="press-feature">
11
+ <div v-if="feature.icon" class="icon">
12
+ {{ feature.icon }}
13
+ </div>
14
+ <h2 class="title">
15
+ {{ feature.title }}
16
+ </h2>
17
+ <p class="details">
18
+ {{ feature.details }}
19
+ </p>
20
+ </article>
21
+ </template>
22
+
23
+ <style scoped>
24
+ .press-feature {
25
+ border: 1px solid var(--va-c-bg-soft);
26
+ border-radius: 12px;
27
+ padding: 24px;
28
+ height: 100%;
29
+ background-color: var(--va-c-bg-soft);
30
+ }
31
+
32
+ .icon {
33
+ display: flex;
34
+ justify-content: center;
35
+ align-items: center;
36
+ margin-bottom: 20px;
37
+ border-radius: 6px;
38
+ background-color: var(--va-c-gray-light-4);
39
+ width: 48px;
40
+ height: 48px;
41
+ font-size: 24px;
42
+ }
43
+
44
+ .dark .icon {
45
+ background-color: var(--va-c-bg);
46
+ }
47
+
48
+ .title {
49
+ line-height: 24px;
50
+ font-size: 16px;
51
+ font-weight: 600;
52
+ }
53
+
54
+ .details {
55
+ padding-top: 8px;
56
+ line-height: 24px;
57
+ font-size: 14px;
58
+ font-weight: 500;
59
+ color: var(--va-c-text-light);
60
+ }
61
+ </style>
@@ -0,0 +1,26 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from 'vue'
3
+ import type { Feature } from '../types'
4
+
5
+ const props = defineProps<{
6
+ features: Feature[]
7
+ }>()
8
+
9
+ const grid = computed(() => {
10
+ const length = props.features.length
11
+ if (length <= 3)
12
+ return `grid-cols-1 sm:grid-cols-2 md:grid-cols-${length}`
13
+ else
14
+ return 'grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4'
15
+ })
16
+ </script>
17
+
18
+ <template>
19
+ <div class="press-features">
20
+ <div class="m-auto container grid gap-4" :class="[grid]">
21
+ <div v-for="feature in features" :key="feature.title" class="inline-grid">
22
+ <PressFeature :feature="feature" />
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </template>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <div class="press-home">
3
+ <slot name="home-hero-before" />
4
+ <PressHomeHero />
5
+ <slot name="home-hero-after" />
6
+
7
+ <slot name="home-features-before" />
8
+ <PressHomeFeatures />
9
+ <slot name="home-features-after" />
10
+
11
+ <slot>
12
+ <router-view />
13
+ </slot>
14
+
15
+ <p align="center">
16
+ <a href="https://sponsors.yunyoujun.cn">
17
+ <img src="https://sponsors.yunyoujun.cn/sponsors.svg">
18
+ </a>
19
+ </p>
20
+ </div>
21
+ </template>
@@ -0,0 +1,12 @@
1
+ <script setup lang="ts">
2
+ import { useFrontmatter } from 'valaxy'
3
+ const fm = useFrontmatter()
4
+ </script>
5
+
6
+ <template>
7
+ <PressFeatures
8
+ v-if="fm.features"
9
+ class="press-home-features"
10
+ :features="fm.features"
11
+ />
12
+ </template>
@@ -0,0 +1,34 @@
1
+ <script lang="ts" setup>
2
+ import { useFrontmatter } from 'valaxy'
3
+ import PressButton from './PressButton.vue'
4
+
5
+ const fm = useFrontmatter()
6
+ </script>
7
+
8
+ <template>
9
+ <h1 m="md:t-24 t-10 md:t-20" text="center">
10
+ <span text="5rem" font="black" class="gradient-text from-purple-800 to-blue-500" bg="gradient-to-r">
11
+ {{ fm.hero.name }}
12
+ </span>
13
+ <br>
14
+ <small opacity="75">LOGO NOT READY</small>
15
+ </h1>
16
+
17
+ <h1 m="y-10" text="center 6xl" font="black" leading="tight">
18
+ Next Generation
19
+ <br>
20
+ Static <span class="gradient-text from-blue-500 to-purple-700" bg="gradient-to-r">Blog</span> Framework
21
+ </h1>
22
+
23
+ <div p="2" text="center">
24
+ <PressButton
25
+ v-for="action in fm.hero.actions"
26
+ :key="action.link"
27
+ :theme="action.theme"
28
+ :link="action.link"
29
+ :text="action.text"
30
+ />
31
+ </div>
32
+
33
+ <br>
34
+ </template>
@@ -0,0 +1,109 @@
1
+ <script lang="ts" setup>
2
+ import { useSidebar } from 'valaxy/client'
3
+
4
+ defineProps<{
5
+ open: boolean
6
+ }>()
7
+
8
+ defineEmits<{
9
+ (e: 'openMenu'): void
10
+ }>()
11
+
12
+ const { hasSidebar } = useSidebar()
13
+
14
+ function scrollToTop() {
15
+ window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
16
+ }
17
+ </script>
18
+
19
+ <template>
20
+ <div v-if="hasSidebar" class="press-local-nav">
21
+ <button
22
+ class="menu"
23
+ :aria-expanded="open"
24
+ aria-controls="VPSidebarNav"
25
+ @click="$emit('openMenu')"
26
+ >
27
+ <div i-ri-align-left class="menu-icon" />
28
+ <span class="menu-text">Menu</span>
29
+ </button>
30
+
31
+ <a class="top-link" href="#" @click="scrollToTop">
32
+ Return to top
33
+ </a>
34
+ </div>
35
+ </template>
36
+
37
+ <style scoped lang="scss">
38
+ @use 'valaxy/client/styles/mixins' as *;
39
+
40
+ .press-local-nav {
41
+ position: sticky;
42
+ top: 0;
43
+ left: 0;
44
+ z-index: var(--pr-z-index-local-nav);
45
+ display: flex;
46
+ justify-content: space-between;
47
+ align-items: center;
48
+ border-bottom: 1px solid var(--pr-c-divider-light);
49
+ width: 100%;
50
+ background-color: var(--va-c-bg);
51
+ transition: border-color 0.5s;
52
+ }
53
+
54
+ @include media('md') {
55
+ .press-local-nav {
56
+ display: none;
57
+ }
58
+ }
59
+
60
+ .menu {
61
+ display: flex;
62
+ align-items: center;
63
+ padding: 12px 24px 11px;
64
+ line-height: 24px;
65
+ font-size: 12px;
66
+ font-weight: 500;
67
+ color: var(--va-c-text-light);
68
+ transition: color 0.5s;
69
+ }
70
+
71
+ .menu:hover {
72
+ color: var(--va-c-text);
73
+ transition: color 0.25s;
74
+ }
75
+
76
+ @include media('md') {
77
+ .menu {
78
+ padding: 0 32px;
79
+ }
80
+ }
81
+
82
+ .menu-icon {
83
+ margin-right: 8px;
84
+ width: 16px;
85
+ height: 16px;
86
+ fill: currentColor;
87
+ }
88
+
89
+ .top-link {
90
+ display: block;
91
+ padding: 12px 24px 11px;
92
+ line-height: 24px;
93
+ font-size: 12px;
94
+ font-weight: 500;
95
+ color: var(--vp-c-text-2);
96
+ transition: color 0.5s;
97
+ }
98
+
99
+ .top-link:hover {
100
+ color: var(--vp-c-text-1);
101
+ transition: color 0.25s;
102
+ }
103
+
104
+ @include media('md') {
105
+ .top-link {
106
+ padding: 12px 32px 11px;
107
+ }
108
+ }
109
+ </style>
@@ -1,38 +1,20 @@
1
- <script lang="ts" setup>
2
- import { useConfig } from 'valaxy'
3
- import { computed } from 'vue'
4
- import { useRoute } from 'vue-router'
5
- import { useThemeConfig } from '../composables'
6
-
7
- const route = useRoute()
8
- const isIndex = computed(() => route.path.replace(/index.html$/, '') === '/')
9
-
10
- const config = useConfig()
11
- const themeConfig = useThemeConfig()
12
- </script>
13
-
14
1
  <template>
15
- <nav w="full" class="flex justify-between items-center py-10 font-bold">
16
- <a class="text-xl" href="/" :aria-label="config.title">
17
- <img
18
- class="inline-block mr-2"
19
- style="width: 50px; height: 35px"
20
- alt="logo"
21
- :src="config.favicon"
22
- >
23
- <span v-if="!isIndex" class="hidden md:inline">{{ config.title }}</span>
24
- </a>
25
- <div class="text-sm text-gray-500 leading-5">
26
- <template v-for="(item, i) in themeConfig.nav" :key="i">
27
- <a
28
- class="hover:text-gray-700"
29
- :href="item.link"
30
- target="_blank"
31
- rel="noopener"
32
- >{{ item.text }}</a>
33
-
34
- <span v-if="i !== themeConfig.nav.length - 1" class="mr-2 ml-2">·</span>
35
- </template>
36
- </div>
2
+ <nav w="full" class="press-nav relative md:fixed md:z-99 font-bold">
3
+ <PressNavBar />
37
4
  </nav>
38
5
  </template>
6
+
7
+ <style lang="scss">
8
+ @use 'valaxy/client/styles/mixins' as *;
9
+
10
+ .press-nav {
11
+ z-index: var(--pr-z-index-nav);
12
+ }
13
+
14
+ @include media('md') {
15
+ .press-nav {
16
+ -webkit-backdrop-filter: saturate(50%) blur(8px);
17
+ backdrop-filter: saturate(50%) blur(8px);
18
+ }
19
+ }
20
+ </style>
@@ -0,0 +1,68 @@
1
+ <script lang="ts" setup>
2
+ import { useCategory, usePageList, useSidebar } from 'valaxy'
3
+
4
+ defineProps<{
5
+ open: boolean
6
+ }>()
7
+
8
+ const pages = usePageList()
9
+ const categories = useCategory('', pages.value)
10
+ categories.children.delete('Uncategorized')
11
+
12
+ const { hasSidebar } = useSidebar()
13
+ </script>
14
+
15
+ <template>
16
+ <aside
17
+ v-if="hasSidebar"
18
+ class="press-sidebar shadow-lg" :class="{ open }"
19
+ @click.stop
20
+ >
21
+ <div text="left" m="2">
22
+ <PressCategories :categories="categories.children" :collapsable="false" />
23
+ </div>
24
+ </aside>
25
+ </template>
26
+
27
+ <style lang="scss">
28
+ @use 'valaxy/client/styles/mixins' as *;
29
+
30
+ .press-sidebar {
31
+ position: fixed;
32
+ top: 0;
33
+ bottom: 0;
34
+ left: 0;
35
+ padding: 1.5rem 1rem;
36
+ padding-top: var(--pr-nav-height);
37
+ z-index: var(--pr-z-index-sidebar);
38
+ width: calc(100vw - 64px);
39
+ max-width: 320px;
40
+ background-color: var(--va-c-bg);
41
+ opacity: 0;
42
+ overflow-x: hidden;
43
+ overflow-y: auto;
44
+ transform: translateX(-100%);
45
+ transition: opacity 0.5s, transform 0.25s ease;
46
+
47
+ &.open {
48
+ opacity: 1;
49
+ transform: translateX(0);
50
+ transition: opacity 0.25s,
51
+ transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
52
+ }
53
+ }
54
+
55
+ @include media('md') {
56
+ .press-sidebar {
57
+ z-index: 1;
58
+ padding: 1.5rem 1rem;
59
+ padding-top: var(--pr-nav-height);
60
+ width: var(--va-sidebar-width);
61
+ max-width: 100%;
62
+ background-color: var(--va-c-bg-alt);
63
+ opacity: 1;
64
+ box-shadow: none;
65
+ transform: translateX(0);
66
+ }
67
+ }
68
+ </style>