@movk/nuxt-docs 1.4.1 → 1.4.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/app/app.config.ts
CHANGED
package/app/app.vue
CHANGED
|
@@ -45,8 +45,8 @@ provide('navigation', rootNavigation)
|
|
|
45
45
|
<template>
|
|
46
46
|
<UApp :toaster="appConfig.toaster">
|
|
47
47
|
<NuxtLoadingIndicator color="var(--ui-primary)" :height="2" />
|
|
48
|
-
<Analytics v-if="appConfig.vercelAnalytics" />
|
|
49
|
-
<SpeedInsights v-if="appConfig.vercelAnalytics" />
|
|
48
|
+
<Analytics v-if="appConfig.vercelAnalytics" :debug="appConfig.vercelAnalytics?.debug" />
|
|
49
|
+
<SpeedInsights v-if="appConfig.vercelAnalytics" :debug="appConfig.vercelAnalytics?.debug" />
|
|
50
50
|
|
|
51
51
|
<div :class="{ root: route.path.startsWith('/docs/') }">
|
|
52
52
|
<template v-if="!route.path.startsWith('/examples')">
|
|
@@ -13,7 +13,7 @@ const items = [
|
|
|
13
13
|
label: 'Copy Markdown link',
|
|
14
14
|
icon: 'i-lucide-link',
|
|
15
15
|
onSelect() {
|
|
16
|
-
if (vercelAnalytics) track ('Page Action', { action: 'Copy Markdown Link' })
|
|
16
|
+
if (vercelAnalytics?.debug) track ('Page Action', { action: 'Copy Markdown Link' })
|
|
17
17
|
copy(mdPath.value)
|
|
18
18
|
toast.add({
|
|
19
19
|
title: 'Copied to clipboard',
|
|
@@ -27,7 +27,7 @@ const items = [
|
|
|
27
27
|
target: '_blank',
|
|
28
28
|
to: `/raw${route.path}.md`,
|
|
29
29
|
onSelect() {
|
|
30
|
-
if (vercelAnalytics) track('Page Action', { action: 'View as Markdown' })
|
|
30
|
+
if (vercelAnalytics?.debug) track('Page Action', { action: 'View as Markdown' })
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
{
|
|
@@ -36,7 +36,7 @@ const items = [
|
|
|
36
36
|
target: '_blank',
|
|
37
37
|
to: `https://chatgpt.com/?hints=search&q=${encodeURIComponent(`Read ${mdPath.value} so I can ask questions about it.`)}`,
|
|
38
38
|
onSelect() {
|
|
39
|
-
if (vercelAnalytics) track('Page Action', { action: 'Open in ChatGPT' })
|
|
39
|
+
if (vercelAnalytics?.debug) track('Page Action', { action: 'Open in ChatGPT' })
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
{
|
|
@@ -45,13 +45,13 @@ const items = [
|
|
|
45
45
|
target: '_blank',
|
|
46
46
|
to: `https://claude.ai/new?q=${encodeURIComponent(`Read ${mdPath.value} so I can ask questions about it.`)}`,
|
|
47
47
|
onSelect() {
|
|
48
|
-
if (vercelAnalytics) track('Page Action', { action: 'Open in Claude' })
|
|
48
|
+
if (vercelAnalytics?.debug) track('Page Action', { action: 'Open in Claude' })
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
]
|
|
52
52
|
|
|
53
53
|
async function copyPage() {
|
|
54
|
-
if (vercelAnalytics) track('Page Action', { action: 'Copy Page Content' })
|
|
54
|
+
if (vercelAnalytics?.debug) track('Page Action', { action: 'Copy Page Content' })
|
|
55
55
|
copy(await $fetch<string>(`/raw${route.path}.md`))
|
|
56
56
|
}
|
|
57
57
|
</script>
|
|
@@ -13,7 +13,7 @@ const { track } = useAnalytics()
|
|
|
13
13
|
const open = ref(false)
|
|
14
14
|
|
|
15
15
|
watch(open, (isOpen) => {
|
|
16
|
-
if (isOpen && appConfig.vercelAnalytics) {
|
|
16
|
+
if (isOpen && appConfig.vercelAnalytics?.debug) {
|
|
17
17
|
track('Theme Picker Opened')
|
|
18
18
|
}
|
|
19
19
|
})
|
|
@@ -29,7 +29,7 @@ const neutral = computed({
|
|
|
29
29
|
set(option) {
|
|
30
30
|
appConfig.ui.colors.neutral = option
|
|
31
31
|
window.localStorage.setItem(`${site.name}-ui-neutral`, appConfig.ui.colors.neutral)
|
|
32
|
-
if (appConfig.vercelAnalytics) track('Theme Changed', { setting: 'neutral', value: option })
|
|
32
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'neutral', value: option })
|
|
33
33
|
}
|
|
34
34
|
})
|
|
35
35
|
|
|
@@ -43,7 +43,7 @@ const primary = computed({
|
|
|
43
43
|
appConfig.ui.colors.primary = option
|
|
44
44
|
window.localStorage.setItem(`${site.name}-ui-primary`, appConfig.ui.colors.primary)
|
|
45
45
|
setBlackAsPrimary(false)
|
|
46
|
-
if (appConfig.vercelAnalytics) track('Theme Changed', { setting: 'primary', value: option })
|
|
46
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'primary', value: option })
|
|
47
47
|
}
|
|
48
48
|
})
|
|
49
49
|
|
|
@@ -55,7 +55,7 @@ const radius = computed({
|
|
|
55
55
|
set(option) {
|
|
56
56
|
appConfig.theme.radius = option
|
|
57
57
|
window.localStorage.setItem(`${site.name}-ui-radius`, String(appConfig.theme.radius))
|
|
58
|
-
if (appConfig.vercelAnalytics) track('Theme Changed', { setting: 'radius', value: option })
|
|
58
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'radius', value: option })
|
|
59
59
|
}
|
|
60
60
|
})
|
|
61
61
|
|
|
@@ -70,14 +70,14 @@ const mode = computed({
|
|
|
70
70
|
},
|
|
71
71
|
set(option) {
|
|
72
72
|
colorMode.preference = option
|
|
73
|
-
if (appConfig.vercelAnalytics) track('Theme Changed', { setting: 'color mode', value: option })
|
|
73
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'color mode', value: option })
|
|
74
74
|
}
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
function setBlackAsPrimary(value: boolean) {
|
|
78
78
|
appConfig.theme.blackAsPrimary = value
|
|
79
79
|
window.localStorage.setItem(`${site.name}-ui-black-as-primary`, String(value))
|
|
80
|
-
if (appConfig.vercelAnalytics) track('Theme Changed', { setting: 'black as primary', value })
|
|
80
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'black as primary', value })
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
const fonts = ['Public Sans', 'DM Sans', 'Geist', 'Inter', 'Poppins', 'Outfit', 'Raleway']
|
|
@@ -88,7 +88,7 @@ const font = computed({
|
|
|
88
88
|
set(option) {
|
|
89
89
|
appConfig.theme.font = option
|
|
90
90
|
window.localStorage.setItem(`${site.name}-ui-font`, appConfig.theme.font)
|
|
91
|
-
if (appConfig.vercelAnalytics) track('Theme Changed', { setting: 'font', value: option })
|
|
91
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'font', value: option })
|
|
92
92
|
}
|
|
93
93
|
})
|
|
94
94
|
|
|
@@ -113,7 +113,7 @@ const icon = computed({
|
|
|
113
113
|
appConfig.theme.icons = option
|
|
114
114
|
appConfig.ui.icons = themeIcons[option as keyof typeof themeIcons] as any
|
|
115
115
|
window.localStorage.setItem(`${site.name}-ui-icons`, appConfig.theme.icons)
|
|
116
|
-
if (appConfig.vercelAnalytics) track('Theme Changed', { setting: 'icons', value: option })
|
|
116
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'icons', value: option })
|
|
117
117
|
}
|
|
118
118
|
})
|
|
119
119
|
|
|
@@ -130,7 +130,7 @@ const hasAppConfigChanges = computed(() => {
|
|
|
130
130
|
})
|
|
131
131
|
|
|
132
132
|
function exportCSS() {
|
|
133
|
-
if (appConfig.vercelAnalytics) track('Theme Exported', { type: 'css' })
|
|
133
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Exported', { type: 'css' })
|
|
134
134
|
|
|
135
135
|
const lines = [
|
|
136
136
|
'@import "tailwindcss";',
|
|
@@ -161,7 +161,7 @@ function exportCSS() {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
function exportAppConfig() {
|
|
164
|
-
if (appConfig.vercelAnalytics) track('Theme Exported', { type: 'appConfig' })
|
|
164
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Exported', { type: 'appConfig' })
|
|
165
165
|
|
|
166
166
|
const config: Record<string, any> = {}
|
|
167
167
|
|
|
@@ -192,7 +192,7 @@ function exportAppConfig() {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
function resetTheme() {
|
|
195
|
-
if (appConfig.vercelAnalytics) track('Theme Reset')
|
|
195
|
+
if (appConfig.vercelAnalytics?.debug) track('Theme Reset')
|
|
196
196
|
|
|
197
197
|
// Reset without triggering individual tracking events
|
|
198
198
|
appConfig.ui.colors.primary = 'green'
|
package/app/types/index.d.ts
CHANGED
|
@@ -2,7 +2,10 @@ import type { ButtonProps } from '@nuxt/ui'
|
|
|
2
2
|
|
|
3
3
|
declare module 'nuxt/schema' {
|
|
4
4
|
interface AppConfig {
|
|
5
|
-
vercelAnalytics:
|
|
5
|
+
vercelAnalytics: {
|
|
6
|
+
enable: boolean
|
|
7
|
+
debug: boolean
|
|
8
|
+
}
|
|
6
9
|
seo: {
|
|
7
10
|
titleTemplate: string
|
|
8
11
|
title: string
|
|
@@ -38,12 +41,12 @@ declare module 'nuxt/schema' {
|
|
|
38
41
|
suffix: string
|
|
39
42
|
per_page: number
|
|
40
43
|
until: string
|
|
41
|
-
author
|
|
44
|
+
author: string
|
|
42
45
|
/**
|
|
43
46
|
* 日期格式化配置
|
|
44
47
|
* @example { locale: 'zh-CN', options: { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' } }
|
|
45
48
|
*/
|
|
46
|
-
dateFormat
|
|
49
|
+
dateFormat: {
|
|
47
50
|
locale?: string
|
|
48
51
|
options?: Intl.DateTimeFormatOptions
|
|
49
52
|
}
|
package/package.json
CHANGED