valaxy 0.14.26 → 0.14.27

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/client/App.vue CHANGED
@@ -1,8 +1,10 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, provide, ref } from 'vue'
3
3
  import { useHead, useSeoMeta } from '@vueuse/head'
4
+
4
5
  // @ts-expect-error virtual module
5
6
  import ValaxyUserApp from '/@valaxyjs/UserAppVue'
7
+
6
8
  // @ts-expect-error virtual module
7
9
  import ValaxyThemeApp from '/@valaxyjs/ThemeAppVue'
8
10
  import pkg from 'valaxy/package.json'
@@ -51,8 +51,6 @@ const licenseHtml = computed(() => {
51
51
  </template>
52
52
 
53
53
  <style lang="scss">
54
- @use "valaxy/client/styles/mixins/index.scss" as *;
55
-
56
54
  .post-copyright {
57
55
  font-size: 0.9rem;
58
56
  padding: 0.5rem 1rem;
@@ -15,8 +15,7 @@ withDefaults(defineProps<{
15
15
  <style lang="scss">
16
16
  @use "sass:map";
17
17
 
18
- @use "valaxy/client/styles/vars" as *;
19
- @use "valaxy/client/styles/mixins" as *;
18
+ @use "valaxy/client/styles/mixins/index.scss" as *;
20
19
 
21
20
  .va-overlay {
22
21
  background-color: rgba(0, 0, 0, 0.3);
@@ -42,7 +42,7 @@ export function isCategoryList(category: any): category is CategoryList {
42
42
  * }
43
43
  * @returns
44
44
  */
45
- export function useCategory(category?: MaybeRef<string>, posts: Post[] = []) {
45
+ export function useCategories(category?: MaybeRef<string>, posts: Post[] = []) {
46
46
  return computed(() => {
47
47
  const categories = unref(category)
48
48
 
@@ -154,3 +154,8 @@ export function removeItemFromCategory(categoryList: CategoryList, categoryName:
154
154
  categoryList.children.splice(categoryListItemIndex, 1)
155
155
  }
156
156
  }
157
+
158
+ /**
159
+ * @deprecated use `useCategories` instead
160
+ */
161
+ export const useCategory = useCategories
@@ -1,7 +1,7 @@
1
1
  // for classify
2
- export * from './category'
2
+ export * from './categories'
3
3
  export * from './post'
4
- export * from './tag'
4
+ export * from './tags'
5
5
 
6
6
  // common
7
7
  export * from './common'
@@ -1,4 +1,3 @@
1
- import { TinyColor } from '@ctrl/tinycolor'
2
1
  import { computed } from 'vue'
3
2
  import type { Post } from '../..'
4
3
  import { useSiteStore } from '../stores'
@@ -7,46 +6,12 @@ export type Tags = Map<string, {
7
6
  count: number
8
7
  }>
9
8
 
10
- /**
11
- * get utils about tags
12
- */
13
- export function useTags(options: {
14
- /**
15
- * Primary Color
16
- */
17
- primary: string
18
- } = {
19
- primary: '#0078E7',
20
- }) {
21
- const tags = useTag()
22
-
23
- const gray = new TinyColor('#999999')
24
- const primaryColor = new TinyColor(options.primary)
25
-
26
- const getTagStyle = (count: number) => {
27
- const counts = Array.from(tags.value).map(([_, value]) => value.count)
28
- const max = Math.max(...counts)
29
- const min = Math.min(...counts)
30
- const range = max - min
31
- const percent = (count - min) / range
32
- return {
33
- '--yun-tag-color': gray.mix(primaryColor, percent * 100).toString(),
34
- 'fontSize': `${percent * 36 + 12}px`,
35
- }
36
- }
37
-
38
- return {
39
- tags,
40
- getTagStyle,
41
- }
42
- }
43
-
44
9
  /**
45
10
  * get tag map
46
11
  * [tagName]: count
47
12
  * @returns
48
13
  */
49
- export function useTag() {
14
+ export function useTags() {
50
15
  const site = useSiteStore()
51
16
 
52
17
  return computed(() => {
@@ -78,3 +43,8 @@ export function useTag() {
78
43
  return tagMap
79
44
  })
80
45
  }
46
+
47
+ /**
48
+ * @deprecated use `useTags` instead
49
+ */
50
+ export const useTag = useTags
package/client/config.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  // @ts-expect-error virtual module @valaxyjs/config
2
2
  import valaxyConfig from '/@valaxyjs/config'
3
+
3
4
  // @ts-expect-error virtual module @valaxyjs/context
4
5
  import valaxyContext from '/@valaxyjs/context'
5
6
  import type { ComputedRef, InjectionKey } from 'vue'
6
7
  import { computed, inject, readonly, shallowRef } from 'vue'
8
+
7
9
  // import type { RouteMeta } from 'vue-router'
8
10
  // fix build caused by pnpm
9
11
  // This is likely not portable. A type annotation is necessary.
package/client/main.ts CHANGED
@@ -4,6 +4,7 @@ import { setupLayouts } from 'virtual:generated-layouts'
4
4
  import App from './App.vue'
5
5
 
6
6
  import '@unocss/reset/tailwind.css'
7
+
7
8
  // generate user styles
8
9
  import '/@valaxyjs/styles'
9
10
  import 'uno.css'
@@ -15,6 +15,7 @@ import { ensureSuffix } from '@antfu/utils'
15
15
  import type { UserModule } from 'valaxy/client/types'
16
16
  import type { PageDataPayload } from '../../types'
17
17
  import { initValaxyConfig, valaxyConfigSymbol } from '../config'
18
+
18
19
  // @ts-expect-error virtual
19
20
  import valaxyMessages from '/@valaxyjs/locales'
20
21
 
@@ -1,4 +1,4 @@
1
- @use "valaxy/client/styles/mixins" as *;
1
+ @use "valaxy/client/styles/mixins/index.scss" as *;
2
2
 
3
3
  @include mobile {
4
4
  .markdown-body {
@@ -1,4 +1,4 @@
1
- @use "valaxy/client/styles/mixins" as *;
1
+ @use "valaxy/client/styles/mixins/index.scss" as *;
2
2
 
3
3
  ::-webkit-scrollbar {
4
4
  width: 8px;
@@ -32,7 +32,13 @@ $c-primary: #0078e7 !default;
32
32
  @include set-css-var-from-map(palette.$light);
33
33
  }
34
34
 
35
- // code
35
+ // dark
36
+ html.dark {
37
+ color-scheme: dark;
38
+ @include set-css-var-from-map(palette.$dark);
39
+ }
40
+
41
+ /* code */
36
42
  :root {
37
43
  --va-code-line-height: 1.7;
38
44
  --va-code-font-size: 0.875em;
@@ -47,15 +53,7 @@ $c-primary: #0078e7 !default;
47
53
  --va-code-copy-code-active-text: var(--va-c-text-dark-2);
48
54
  }
49
55
 
50
- // dark
51
- html.dark {
52
- color-scheme: dark;
53
- @include set-css-var-from-map(palette.$dark);
54
- }
55
-
56
- /**
57
- * Icons
58
- * -------------------------------------------------------------------------- */
56
+ /* Icons */
59
57
  :root {
60
58
  --va-icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' class='h-6 w-6' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2'/%3E%3C/svg%3E");
61
59
  --va-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' class='h-6 w-6' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-6 9 2 2 4-4'/%3E%3C/svg%3E");