valaxy-theme-yun 0.9.3 → 0.10.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.
@@ -79,13 +79,14 @@ const YunTwikoo = config.value.comment.waline.enable
79
79
 
80
80
  <style lang="scss">
81
81
  @use 'valaxy/client/styles/mixins' as *;
82
- @include xl {
82
+
83
+ @include media('xl') {
83
84
  .content{
84
85
  // 8px scrollbar width
85
- max-width: calc(100vw - 2 * var(--va-sidebar-width-mobile) - 1rem - 8px);
86
+ max-width: calc(100vw - 2 * var(--va-sidebar-width) - 1rem - 8px);
86
87
 
87
88
  &.no-aside {
88
- max-width: calc(100vw - var(--va-sidebar-width-mobile));
89
+ max-width: calc(100vw - var(--va-sidebar-width));
89
90
  }
90
91
  }
91
92
  }
@@ -142,9 +142,9 @@ function getRelativePath(absoluteUrl: string) {
142
142
  .dark .DocSearch {
143
143
  --docsearch-modal-shadow: none;
144
144
  --docsearch-footer-shadow: none;
145
- --docsearch-logo-color: var(--va-c-text-2);
145
+ --docsearch-logo-color: var(--va-c-text-light);
146
146
  --docsearch-hit-background: var(--va-c-bg-mute);
147
- --docsearch-hit-color: var(--va-c-text-2);
147
+ --docsearch-hit-color: var(--va-c-text-light);
148
148
  --docsearch-hit-shadow: none;
149
149
  }
150
150
 
@@ -47,7 +47,7 @@ const app = useAppStore()
47
47
  top: 0;
48
48
  bottom: 0;
49
49
 
50
- min-width: var(--va-sidebar-width-mobile);
50
+ min-width: var(--va-sidebar-width);
51
51
 
52
52
  transform: translateX(100%);
53
53
 
@@ -69,7 +69,7 @@ const app = useAppStore()
69
69
  }
70
70
  }
71
71
 
72
- @include xl {
72
+ @include media('xl') {
73
73
  .aside {
74
74
  transform: translateX(0);
75
75
  }
@@ -27,7 +27,7 @@ const collapsable = ref(props.collapsable)
27
27
  <style lang="scss">
28
28
  .post-list-item {
29
29
  a {
30
- color: var(--va-c-text);
30
+ color: var(--va-c-text-lighter);
31
31
 
32
32
  &:hover {
33
33
  color: var(--va-c-primary);
@@ -15,6 +15,8 @@
15
15
  </template>
16
16
 
17
17
  <style lang="scss">
18
+ @use 'valaxy/client/styles/mixins' as *;
19
+
18
20
  .cloud {
19
21
  display: flex;
20
22
  width: 100%;
@@ -32,7 +34,7 @@
32
34
  width: 100%;
33
35
  height: 100px;
34
36
 
35
- @media (max-width: 768px) {
37
+ @include media('md') {
36
38
  height: 40px;
37
39
  }
38
40
  }
@@ -110,7 +110,7 @@ function handleClick({ target: el }: Event) {
110
110
  .outline-link {
111
111
  display: block;
112
112
  line-height: 28px;
113
- color: var(--va-c-text-2);
113
+ color: var(--va-c-text-light);
114
114
  white-space: nowrap;
115
115
  overflow: hidden;
116
116
  text-overflow: ellipsis;
package/layouts/home.vue CHANGED
@@ -1,13 +1,15 @@
1
1
  <script lang="ts" setup>
2
2
  import { useAppStore, useConfig, useLayout } from 'valaxy'
3
+ import { useThemeConfig } from '../composables'
3
4
 
4
5
  const app = useAppStore()
5
6
  const config = useConfig()
7
+ const themeConfig = useThemeConfig()
6
8
  const isHome = useLayout('home')
7
9
  </script>
8
10
 
9
11
  <template>
10
- <YunBg v-if="config.themeConfig.bg_image.enable" />
12
+ <YunBg v-if="themeConfig.bg_image.enable" />
11
13
 
12
14
  <main class="yun-main justify-center items-center" :class="(isHome && !app.isSidebarOpen) && 'pl-0'" flex="~ col" w="full">
13
15
  <ValaxySidebar>
@@ -1,6 +1,4 @@
1
- import type { ThemeConfig, ThemeUserConfig } from '../types'
2
-
3
- export const anonymousImage = 'https://cdn.yunyoujun.cn/img/avatar/none.jpg'
1
+ import type { ThemeConfig } from '../types'
4
2
 
5
3
  /**
6
4
  * Default Config
@@ -106,34 +104,3 @@ export const defaultThemeConfig: ThemeConfig = {
106
104
  },
107
105
  },
108
106
  }
109
-
110
- export default defaultThemeConfig
111
-
112
- /**
113
- * generateSafelist by config
114
- * @param themeConfig
115
- * @returns
116
- */
117
- export function generateSafelist(themeConfig: ThemeUserConfig) {
118
- const safelist = []
119
-
120
- const types = themeConfig.types
121
- if (types) {
122
- for (const type in types)
123
- safelist.push(types[type]?.icon)
124
- }
125
-
126
- if (themeConfig.footer?.icon?.name)
127
- safelist.push(themeConfig.footer?.icon?.name)
128
-
129
- if (themeConfig.menu?.custom?.icon)
130
- safelist.push(themeConfig.menu?.custom?.icon)
131
-
132
- if (themeConfig.pages) {
133
- themeConfig.pages?.forEach((item) => {
134
- item.icon && safelist.push(item.icon)
135
- })
136
- }
137
-
138
- return safelist
139
- }
package/node/index.ts CHANGED
@@ -1,43 +1,4 @@
1
- import { defineThemePlugin } from 'valaxy'
2
- import type { ResolvedValaxyOptions } from 'valaxy'
3
- import type { Plugin } from 'vite'
1
+ export * from '../types/index.d'
4
2
 
5
- export * from '../config'
6
- export * from '../types'
7
-
8
- export interface UserOptions {
9
- colors: {
10
- primary: string
11
- }
12
- }
13
-
14
- function ThemeYunVitePlugin(options: ResolvedValaxyOptions): Plugin {
15
- const themeConfig = options.config.themeConfig
16
- return {
17
- name: 'valaxy-theme-yun',
18
- enforce: 'pre',
19
- config() {
20
- return {
21
- css: {
22
- preprocessorOptions: {
23
- scss: {
24
- additionalData: `$c-primary: ${themeConfig.colors?.primary || '#0078E7'} !default;`,
25
- },
26
- },
27
- },
28
-
29
- optimizeDeps: {
30
- exclude: ['@docsearch/js'],
31
- },
32
- }
33
- },
34
- }
35
- }
36
-
37
- export default defineThemePlugin((options) => {
38
- return {
39
- vite: {
40
- plugins: [ThemeYunVitePlugin(options)],
41
- },
42
- }
43
- })
3
+ export * from './config'
4
+ export * from './unocss'
package/node/unocss.ts ADDED
@@ -0,0 +1,32 @@
1
+ import type { ResolvedValaxyOptions } from 'valaxy'
2
+ import type { ThemeUserConfig } from '../types'
3
+
4
+ /**
5
+ * generateSafelist by config
6
+ * @param themeConfig
7
+ * @returns
8
+ */
9
+ export function generateSafelist(options: ResolvedValaxyOptions<ThemeUserConfig>) {
10
+ const themeConfig = options.config.themeConfig || {}
11
+ const safelist = []
12
+
13
+ const types = themeConfig.types
14
+ if (types) {
15
+ for (const type in types)
16
+ safelist.push(types[type]?.icon)
17
+ }
18
+
19
+ if (themeConfig.footer?.icon?.name)
20
+ safelist.push(themeConfig.footer?.icon?.name)
21
+
22
+ if (themeConfig.menu?.custom?.icon)
23
+ safelist.push(themeConfig.menu?.custom?.icon)
24
+
25
+ if (themeConfig.pages) {
26
+ themeConfig.pages?.forEach((item) => {
27
+ item.icon && safelist.push(item.icon)
28
+ })
29
+ }
30
+
31
+ return safelist
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.9.3",
3
+ "version": "0.10.0",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -12,15 +12,10 @@
12
12
  "url": "https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-theme-yun"
13
13
  },
14
14
  "exports": {
15
- ".": {
16
- "require": "./dist/index.js",
17
- "import": "./dist/index.mjs"
18
- },
19
15
  "./*": "./*"
20
16
  },
21
- "main": "dist/index.js",
22
- "module": "dist/index.mjs",
23
- "types": "dist/index.d.ts",
17
+ "main": "node/index.ts",
18
+ "types": "types/index.d.ts",
24
19
  "dependencies": {
25
20
  "@docsearch/css": "^3.1.1",
26
21
  "@docsearch/js": "^3.1.1",
@@ -28,10 +23,6 @@
28
23
  "@iconify-json/simple-icons": "^1.1.19"
29
24
  },
30
25
  "devDependencies": {
31
- "valaxy": "0.9.3"
32
- },
33
- "scripts": {
34
- "build": "rimraf dist && tsup",
35
- "dev": "tsup --watch"
26
+ "valaxy": "0.10.0"
36
27
  }
37
28
  }
@@ -2,7 +2,7 @@
2
2
  @use "./post" as *;
3
3
 
4
4
  .yun-main {
5
- padding-left: var(--va-sidebar-width-mobile);
5
+ padding-left: var(--va-sidebar-width);
6
6
  transition: padding-left var(--va-transition-duration);
7
7
  box-sizing: border-box;
8
8
  }
@@ -1,3 +1,5 @@
1
+ export * from '../composables'
2
+
1
3
  export namespace YunTheme {
2
4
  export type Config = ThemeConfig
3
5
  export type Sidebar = any
package/utils/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { anonymousImage } from '../config'
1
+ export const anonymousImage = 'https://cdn.yunyoujun.cn/img/avatar/none.jpg'
2
2
 
3
3
  export const onImgError = (e: Event) => {
4
4
  (e.target as HTMLImageElement).src = anonymousImage
@@ -0,0 +1,40 @@
1
+ import type { ResolvedValaxyOptions } from 'valaxy'
2
+ import { defineTheme } from 'valaxy'
3
+ import type { Plugin } from 'vite'
4
+ import type { ThemeConfig } from './types'
5
+ import { defaultThemeConfig, generateSafelist } from './node'
6
+
7
+ function ThemeVitePlugin(options: ResolvedValaxyOptions<ThemeConfig>): Plugin {
8
+ const themeConfig = options.config.themeConfig || {}
9
+ return {
10
+ name: 'valaxy-theme-yun',
11
+ enforce: 'pre',
12
+ config() {
13
+ return {
14
+ css: {
15
+ preprocessorOptions: {
16
+ scss: {
17
+ additionalData: `$c-primary: ${themeConfig.colors?.primary || '#0078E7'} !default;`,
18
+ },
19
+ },
20
+ },
21
+
22
+ optimizeDeps: {
23
+ exclude: ['@docsearch/js'],
24
+ },
25
+ }
26
+ },
27
+ }
28
+ }
29
+
30
+ export default defineTheme<ThemeConfig>((options) => {
31
+ return {
32
+ themeConfig: defaultThemeConfig,
33
+ vite: {
34
+ plugins: [ThemeVitePlugin(options)],
35
+ },
36
+ unocss: {
37
+ safelist: generateSafelist(options),
38
+ },
39
+ }
40
+ })
package/dist/index.d.ts DELETED
@@ -1,137 +0,0 @@
1
- import * as valaxy_dist_node from 'valaxy/dist/node';
2
-
3
- declare namespace YunTheme {
4
- type Config = ThemeConfig;
5
- type Sidebar = any;
6
- }
7
- /**
8
- * Theme Config
9
- */
10
- interface ThemeConfig {
11
- /**
12
- * toc title
13
- * @default 'On this page'
14
- */
15
- outlineTitle: string;
16
- colors: {
17
- /**
18
- * primary color
19
- * @default '#0078E7'
20
- */
21
- primary: string;
22
- };
23
- /**
24
- * 首页标语
25
- */
26
- banner: {
27
- enable: boolean;
28
- /**
29
- * 标题
30
- */
31
- title: string;
32
- };
33
- bg_image: {
34
- enable: boolean;
35
- url: string;
36
- dark?: string;
37
- opacity?: number;
38
- };
39
- /**
40
- * say something
41
- * https://say.elpsy.cn
42
- */
43
- say: {
44
- enable: boolean;
45
- api: string;
46
- hitokoto: {
47
- enable: boolean;
48
- api: string;
49
- };
50
- };
51
- pages: {
52
- name: string;
53
- url: string;
54
- icon: string;
55
- color: string;
56
- }[];
57
- sidebar: YunTheme.Sidebar;
58
- /**
59
- * footer
60
- */
61
- footer: Partial<{
62
- /**
63
- * 建站于
64
- */
65
- since: number;
66
- /**
67
- * Icon between year and copyright info.
68
- */
69
- icon: {
70
- /**
71
- * icon name, i-xxx
72
- */
73
- name: string;
74
- animated: boolean;
75
- color: string;
76
- url: string;
77
- title: string;
78
- };
79
- /**
80
- * Powered by valaxy & valaxy-theme-${name}, default is yun
81
- */
82
- powered: boolean;
83
- /**
84
- * Chinese Users | 中国用户
85
- * 备案 ICP
86
- * 国内用户需要在网站页脚展示备案 ICP 号
87
- * https://beian.miit.gov.cn/
88
- */
89
- beian: {
90
- enable: boolean;
91
- /**
92
- * 苏ICP备xxxxxxxx号
93
- */
94
- icp: string;
95
- };
96
- }>;
97
- /**
98
- * post card types
99
- */
100
- types: Record<string, {
101
- color: string;
102
- icon: string;
103
- }>;
104
- /**
105
- * 菜单栏
106
- */
107
- menu: {
108
- custom: {
109
- title: string;
110
- url: string;
111
- icon: string;
112
- };
113
- };
114
- }
115
- declare type ThemeUserConfig = Partial<ThemeConfig>;
116
-
117
- declare const anonymousImage = "https://cdn.yunyoujun.cn/img/avatar/none.jpg";
118
- /**
119
- * Default Config
120
- */
121
- declare const defaultThemeConfig: ThemeConfig;
122
-
123
- /**
124
- * generateSafelist by config
125
- * @param themeConfig
126
- * @returns
127
- */
128
- declare function generateSafelist(themeConfig: ThemeUserConfig): string[];
129
-
130
- interface UserOptions {
131
- colors: {
132
- primary: string;
133
- };
134
- }
135
- declare const _default: valaxy_dist_node.ThemeConfigExport;
136
-
137
- export { ThemeConfig, ThemeUserConfig, UserOptions, YunTheme, anonymousImage, _default as default, defaultThemeConfig, generateSafelist };
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var x=(i,o)=>{for(var e in o)a(i,e,{get:o[e],enumerable:!0})},v=(i,o,e,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of d(o))!h.call(i,n)&&n!==e&&a(i,n,{get:()=>o[n],enumerable:!(t=b(o,n))||t.enumerable});return i};var j=i=>v(a({},"__esModule",{value:!0}),i);var O={};x(O,{anonymousImage:()=>w,default:()=>E,defaultThemeConfig:()=>T,generateSafelist:()=>k});module.exports=j(O);var g=require("valaxy");var w="https://cdn.yunyoujun.cn/img/avatar/none.jpg",T={outlineTitle:"On this page",colors:{primary:"#0078E7"},banner:{enable:!0,title:"\u4E91\u6E38\u541B\u7684\u5C0F\u7AD9"},bg_image:{enable:!0,url:"https://cdn.yunyoujun.cn/img/bg/stars-timing-0-blur-30px.jpg",dark:"https://cdn.yunyoujun.cn/img/bg/galaxy.jpg"},say:{enable:!0,api:"https://el-bot-api.vercel.app/api/words/young",hitokoto:{enable:!1,api:"https://v1.hitokoto.cn"}},pages:[],sidebar:null,footer:{since:2022,icon:{name:"i-ri-cloud-line",animated:!0,color:"var(--va-c-primary)",url:"https://sponsors.yunyoujun.cn",title:"Sponsor YunYouJun"},powered:!0,beian:{enable:!1,icp:""}},types:{link:{color:"var(--va-c-primary)",icon:"i-ri-external-link-line"},bilibili:{color:"#FF8EB3",icon:"i-ri-bilibili-line"},douban:{color:"#007722",icon:"i-ri-douban-line"},github:{color:"var(--va-c-text)",icon:"i-ri-github-line"},"netease-cloud-music":{color:"#C10D0C",icon:"i-ri-netease-cloud-music-line"},notion:{color:"var(--va-c-text)",icon:"i-simple-icons-notion"},twitter:{color:"#1da1f2",icon:"i-ri-twitter-line"},wechat:{color:"#1AAD19",icon:"i-ri-wechat-2-line"},weibo:{color:"#E6162D",icon:"i-ri-weibo-line"},yuque:{color:"#25b864",icon:"i-ant-design-yuque-outlined"},zhihu:{color:"#0084FF",icon:"i-ri-zhihu-line"}},menu:{custom:{title:"button.about",icon:"i-ri-clipboard-line",url:"/about"}}};function k(i){var t,n,c,l,u,s,p,m,y,f;let o=[],e=i.types;if(e)for(let r in e)o.push((t=e[r])==null?void 0:t.icon);return(c=(n=i.footer)==null?void 0:n.icon)!=null&&c.name&&o.push((u=(l=i.footer)==null?void 0:l.icon)==null?void 0:u.name),(p=(s=i.menu)==null?void 0:s.custom)!=null&&p.icon&&o.push((y=(m=i.menu)==null?void 0:m.custom)==null?void 0:y.icon),i.pages&&((f=i.pages)==null||f.forEach(r=>{r.icon&&o.push(r.icon)})),o}function D(i){let o=i.config.themeConfig;return{name:"valaxy-theme-yun",enforce:"pre",config(){var e;return{css:{preprocessorOptions:{scss:{additionalData:`$c-primary: ${((e=o.colors)==null?void 0:e.primary)||"#0078E7"} !default;`}}},optimizeDeps:{exclude:["@docsearch/js"]}}}}}var E=(0,g.defineThemePlugin)(i=>({vite:{plugins:[D(i)]}}));0&&(module.exports={anonymousImage,defaultThemeConfig,generateSafelist});
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{defineThemePlugin as f}from"valaxy";var b="https://cdn.yunyoujun.cn/img/avatar/none.jpg",d={outlineTitle:"On this page",colors:{primary:"#0078E7"},banner:{enable:!0,title:"\u4E91\u6E38\u541B\u7684\u5C0F\u7AD9"},bg_image:{enable:!0,url:"https://cdn.yunyoujun.cn/img/bg/stars-timing-0-blur-30px.jpg",dark:"https://cdn.yunyoujun.cn/img/bg/galaxy.jpg"},say:{enable:!0,api:"https://el-bot-api.vercel.app/api/words/young",hitokoto:{enable:!1,api:"https://v1.hitokoto.cn"}},pages:[],sidebar:null,footer:{since:2022,icon:{name:"i-ri-cloud-line",animated:!0,color:"var(--va-c-primary)",url:"https://sponsors.yunyoujun.cn",title:"Sponsor YunYouJun"},powered:!0,beian:{enable:!1,icp:""}},types:{link:{color:"var(--va-c-primary)",icon:"i-ri-external-link-line"},bilibili:{color:"#FF8EB3",icon:"i-ri-bilibili-line"},douban:{color:"#007722",icon:"i-ri-douban-line"},github:{color:"var(--va-c-text)",icon:"i-ri-github-line"},"netease-cloud-music":{color:"#C10D0C",icon:"i-ri-netease-cloud-music-line"},notion:{color:"var(--va-c-text)",icon:"i-simple-icons-notion"},twitter:{color:"#1da1f2",icon:"i-ri-twitter-line"},wechat:{color:"#1AAD19",icon:"i-ri-wechat-2-line"},weibo:{color:"#E6162D",icon:"i-ri-weibo-line"},yuque:{color:"#25b864",icon:"i-ant-design-yuque-outlined"},zhihu:{color:"#0084FF",icon:"i-ri-zhihu-line"}},menu:{custom:{title:"button.about",icon:"i-ri-clipboard-line",url:"/about"}}};function h(i){var t,r,a,c,l,u,s,p,m,y;let o=[],e=i.types;if(e)for(let n in e)o.push((t=e[n])==null?void 0:t.icon);return(a=(r=i.footer)==null?void 0:r.icon)!=null&&a.name&&o.push((l=(c=i.footer)==null?void 0:c.icon)==null?void 0:l.name),(s=(u=i.menu)==null?void 0:u.custom)!=null&&s.icon&&o.push((m=(p=i.menu)==null?void 0:p.custom)==null?void 0:m.icon),i.pages&&((y=i.pages)==null||y.forEach(n=>{n.icon&&o.push(n.icon)})),o}function g(i){let o=i.config.themeConfig;return{name:"valaxy-theme-yun",enforce:"pre",config(){var e;return{css:{preprocessorOptions:{scss:{additionalData:`$c-primary: ${((e=o.colors)==null?void 0:e.primary)||"#0078E7"} !default;`}}},optimizeDeps:{exclude:["@docsearch/js"]}}}}}var j=f(i=>({vite:{plugins:[g(i)]}}));export{b as anonymousImage,j as default,d as defaultThemeConfig,h as generateSafelist};
package/tsup.config.ts DELETED
@@ -1,16 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
-
3
- export default defineConfig((options) => {
4
- return {
5
- entry: ['node/index.ts'],
6
- // disable for dev watch before valaxy watch
7
- clean: !options.watch,
8
- dts: true,
9
- format: ['cjs', 'esm'],
10
- minify: !options.watch,
11
- external: [
12
- 'valaxy',
13
- 'vite',
14
- ],
15
- }
16
- })