valaxy 0.16.0 → 0.16.1
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 +2 -2
- package/client/composables/features/copy-code.ts +1 -1
- package/client/main.ts +8 -1
- package/client/modules/valaxy.ts +5 -8
- package/client/setup/main.ts +10 -2
- package/dist/{chunk-VAUHX5NB.cjs → chunk-VAGXCK43.cjs} +21 -21
- package/dist/{chunk-WMBDKFPC.mjs → chunk-W4ERA5UC.mjs} +2 -2
- package/dist/node/cli/index.cjs +1 -1
- package/dist/node/cli/index.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +3 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.mjs +1 -1
- package/package.json +11 -8
- /package/dist/{chunk-SWW6JL47.cjs → chunk-R6EC3UMQ.cjs} +0 -0
- /package/dist/{chunk-XKQECU6I.mjs → chunk-YTQABADX.mjs} +0 -0
package/client/App.vue
CHANGED
|
@@ -11,13 +11,13 @@ import pkg from 'valaxy/package.json'
|
|
|
11
11
|
import { useI18n } from 'vue-i18n'
|
|
12
12
|
import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@unhead/schema-org'
|
|
13
13
|
import dayjs from 'dayjs'
|
|
14
|
-
import ValaxyAddons from './components/ValaxyAddons.vue'
|
|
15
|
-
import { isDark, useFrontmatter } from './composables'
|
|
16
14
|
|
|
17
15
|
// https://github.com/vueuse/head
|
|
18
16
|
// you can use this to manipulate the document head in any components,
|
|
19
17
|
// they will be rendered correctly in the html results with vite-ssg
|
|
20
18
|
import { useSiteConfig } from './config'
|
|
19
|
+
import ValaxyAddons from './components/ValaxyAddons.vue'
|
|
20
|
+
import { isDark, useFrontmatter } from './composables'
|
|
21
21
|
|
|
22
22
|
// <link rel="apple-touch-icon" href="/pwa-192x192.png">
|
|
23
23
|
// <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9">
|
|
@@ -3,7 +3,7 @@ import { isClient } from '@vueuse/core'
|
|
|
3
3
|
|
|
4
4
|
export function useCopyCode() {
|
|
5
5
|
if (isClient) {
|
|
6
|
-
const timeoutIdMap: WeakMap<HTMLElement,
|
|
6
|
+
const timeoutIdMap: WeakMap<HTMLElement, ReturnType<typeof setTimeout>> = new WeakMap()
|
|
7
7
|
window.addEventListener('click', (e) => {
|
|
8
8
|
const el = e.target as HTMLElement
|
|
9
9
|
if (el.matches('div[class*="language-"] > button.copy')) {
|
package/client/main.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { ViteSSGContext } from 'vite-ssg'
|
|
|
2
2
|
import { ViteSSG } from 'vite-ssg'
|
|
3
3
|
import generatedRoutes from 'virtual:generated-pages'
|
|
4
4
|
import { setupLayouts } from 'virtual:generated-layouts'
|
|
5
|
+
|
|
6
|
+
import { initValaxyConfig, valaxyConfigSymbol } from 'valaxy'
|
|
5
7
|
import AppLink from './components/AppLink.vue'
|
|
6
8
|
|
|
7
9
|
import App from './App.vue'
|
|
@@ -46,7 +48,12 @@ export const createApp = ViteSSG(
|
|
|
46
48
|
},
|
|
47
49
|
},
|
|
48
50
|
(ctx) => {
|
|
51
|
+
// app-level provide
|
|
52
|
+
const { app } = ctx
|
|
53
|
+
const config = initValaxyConfig()
|
|
54
|
+
app.provide(valaxyConfigSymbol, config)
|
|
55
|
+
|
|
49
56
|
registerComponents(ctx)
|
|
50
|
-
setupMain(ctx)
|
|
57
|
+
setupMain(ctx, config)
|
|
51
58
|
},
|
|
52
59
|
)
|
package/client/modules/valaxy.ts
CHANGED
|
@@ -12,9 +12,10 @@ import { useStorage } from '@vueuse/core'
|
|
|
12
12
|
|
|
13
13
|
import type { Router } from 'vue-router'
|
|
14
14
|
import { ensureSuffix } from '@antfu/utils'
|
|
15
|
-
import type {
|
|
15
|
+
import type { ComputedRef } from 'vue'
|
|
16
|
+
import type { ViteSSGContext } from 'vite-ssg'
|
|
17
|
+
import type { DefaultTheme, ValaxyConfig } from 'valaxy/types'
|
|
16
18
|
import type { PageDataPayload } from '../../types'
|
|
17
|
-
import { initValaxyConfig, valaxyConfigSymbol } from '../config'
|
|
18
19
|
|
|
19
20
|
// @ts-expect-error virtual
|
|
20
21
|
import valaxyMessages from '/@valaxyjs/locales'
|
|
@@ -42,12 +43,8 @@ function shouldHotReload(payload: PageDataPayload): boolean {
|
|
|
42
43
|
return ensureSuffix('/', payloadPath) === ensureSuffix('/', locationPath)
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
const config = initValaxyConfig()
|
|
48
|
-
app.provide(valaxyConfigSymbol, config)
|
|
49
|
-
|
|
50
|
-
const locale = useStorage('valaxy-locale', config.value.siteConfig.lang || 'en')
|
|
46
|
+
export function install({ app, router }: ViteSSGContext, config: ComputedRef<ValaxyConfig<DefaultTheme.Config>>) {
|
|
47
|
+
const locale = useStorage('valaxy-locale', config?.value.siteConfig.lang || 'en')
|
|
51
48
|
|
|
52
49
|
// init i18n, by valaxy config
|
|
53
50
|
const i18n = createI18n({
|
package/client/setup/main.ts
CHANGED
|
@@ -6,17 +6,25 @@ import relativeTime from 'dayjs/plugin/relativeTime'
|
|
|
6
6
|
import utc from 'dayjs/plugin/utc'
|
|
7
7
|
import timezone from 'dayjs/plugin/timezone'
|
|
8
8
|
|
|
9
|
+
import type { ComputedRef } from 'vue'
|
|
10
|
+
|
|
11
|
+
// import type { RouteMeta } from 'vue-router'
|
|
12
|
+
// fix build caused by pnpm
|
|
13
|
+
// This is likely not portable. A type annotation is necessary.
|
|
14
|
+
// https://github.com/microsoft/TypeScript/issues/42873
|
|
15
|
+
import type { DefaultTheme, ValaxyConfig } from 'valaxy/types'
|
|
16
|
+
|
|
9
17
|
import { install as installValaxy } from '../modules/valaxy'
|
|
10
18
|
import { install as installPinia } from '../modules/pinia'
|
|
11
19
|
import { install as installNprogress } from '../modules/nprogress'
|
|
12
20
|
import { install as installSchema } from '../modules/schemaOrg'
|
|
13
21
|
|
|
14
|
-
export default function setupMain(ctx: ViteSSGContext) {
|
|
22
|
+
export default function setupMain(ctx: ViteSSGContext, config: ComputedRef<ValaxyConfig<DefaultTheme.Config>>) {
|
|
15
23
|
// @ts-expect-error inject in runtime
|
|
16
24
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
17
25
|
const injection_arg = ctx
|
|
18
26
|
|
|
19
|
-
installValaxy(ctx)
|
|
27
|
+
installValaxy(ctx, config)
|
|
20
28
|
|
|
21
29
|
installSchema(ctx)
|
|
22
30
|
|