@movk/nuxt-docs 1.17.1 → 1.17.3

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.
@@ -7,11 +7,12 @@ export function useTheme() {
7
7
  const appConfig = useAppConfig()
8
8
  const colorMode = useColorMode()
9
9
  const site = useSiteConfig()
10
+ const name = kebabCase(site.name)
10
11
 
11
- const radius = useLocalStorage(`${site.name}-ui-radius`, 0.25)
12
- const font = useLocalStorage(`${site.name}-ui-font`, 'Alibaba PuHuiTi')
13
- const _iconSet = useLocalStorage(`${site.name}-ui-icons`, 'lucide')
14
- const blackAsPrimary = useLocalStorage(`${site.name}-ui-black-as-primary`, false)
12
+ const radius = useLocalStorage(`${name}-ui-radius`, 0.25)
13
+ const font = useLocalStorage(`${name}-ui-font`, 'Alibaba PuHuiTi')
14
+ const _iconSet = useLocalStorage(`${name}-ui-icons`, 'lucide')
15
+ const blackAsPrimary = useLocalStorage(`${name}-ui-black-as-primary`, false)
15
16
 
16
17
  const neutralColors = ['slate', 'gray', 'zinc', 'neutral', 'stone', 'taupe', 'mauve', 'mist', 'olive']
17
18
  const neutral = computed({
@@ -20,7 +21,7 @@ export function useTheme() {
20
21
  },
21
22
  set(option) {
22
23
  appConfig.ui.colors.neutral = option
23
- window.localStorage.setItem(`${site.name}-ui-neutral`, appConfig.ui.colors.neutral)
24
+ window.localStorage.setItem(`${name}-ui-neutral`, appConfig.ui.colors.neutral)
24
25
  }
25
26
  })
26
27
 
@@ -32,7 +33,7 @@ export function useTheme() {
32
33
  },
33
34
  set(option) {
34
35
  appConfig.ui.colors.primary = option
35
- window.localStorage.setItem(`${site.name}-ui-primary`, appConfig.ui.colors.primary)
36
+ window.localStorage.setItem(`${name}-ui-primary`, appConfig.ui.colors.primary)
36
37
  blackAsPrimary.value = false
37
38
  }
38
39
  })
@@ -92,9 +93,9 @@ export function useTheme() {
92
93
  })
93
94
 
94
95
  const style = [
95
- { innerHTML: radiusStyle, id: `${site.name}-ui-radius`, tagPriority: -2 },
96
- { innerHTML: blackAsPrimaryStyle, id: `${site.name}-ui-black-as-primary`, tagPriority: -2 },
97
- { innerHTML: fontStyle, id: `${site.name}-ui-font`, tagPriority: -2 }
96
+ { innerHTML: radiusStyle, id: `${name}-ui-radius`, tagPriority: -2 },
97
+ { innerHTML: blackAsPrimaryStyle, id: `${name}-ui-black-as-primary`, tagPriority: -2 },
98
+ { innerHTML: fontStyle, id: `${name}-ui-font`, tagPriority: -2 }
98
99
  ]
99
100
 
100
101
  const hasCSSChanges = computed(() => {
@@ -166,10 +167,10 @@ export function useTheme() {
166
167
 
167
168
  function resetTheme() {
168
169
  appConfig.ui.colors.primary = 'green'
169
- window.localStorage.removeItem(`${site.name}-ui-primary`)
170
+ window.localStorage.removeItem(`${name}-ui-primary`)
170
171
 
171
172
  appConfig.ui.colors.neutral = 'slate'
172
- window.localStorage.removeItem(`${site.name}-ui-neutral`)
173
+ window.localStorage.removeItem(`${name}-ui-neutral`)
173
174
 
174
175
  radius.value = 0.25
175
176
  font.value = 'Alibaba PuHuiTi'
@@ -177,9 +178,9 @@ export function useTheme() {
177
178
  appConfig.ui.icons = themeIcons.lucide as any
178
179
  blackAsPrimary.value = false
179
180
 
180
- window.localStorage.removeItem(`${site.name}-ui-ai-theme`)
181
- window.localStorage.removeItem(`${site.name}-ui-custom-colors`)
182
- window.localStorage.removeItem(`${site.name}-ui-css-variables`)
181
+ window.localStorage.removeItem(`${name}-ui-ai-theme`)
182
+ window.localStorage.removeItem(`${name}-ui-custom-colors`)
183
+ window.localStorage.removeItem(`${name}-ui-css-variables`)
183
184
  }
184
185
 
185
186
  return {
@@ -1,19 +1,21 @@
1
1
  import { themeIcons } from '../utils/theme'
2
+ import { kebabCase } from '@movk/core'
2
3
 
3
4
  export default defineNuxtPlugin({
4
5
  enforce: 'post',
5
6
  setup() {
6
7
  const appConfig = useAppConfig()
7
8
  const site = useSiteConfig()
9
+ const name = kebabCase(site.name)
8
10
 
9
11
  if (import.meta.client) {
10
- const primary = localStorage.getItem(`${site.name}-ui-primary`)
12
+ const primary = localStorage.getItem(`${name}-ui-primary`)
11
13
  if (primary) appConfig.ui.colors.primary = primary
12
14
 
13
- const neutral = localStorage.getItem(`${site.name}-ui-neutral`)
15
+ const neutral = localStorage.getItem(`${name}-ui-neutral`)
14
16
  if (neutral) appConfig.ui.colors.neutral = neutral
15
17
 
16
- const icons = localStorage.getItem(`${site.name}-ui-icons`)
18
+ const icons = localStorage.getItem(`${name}-ui-icons`)
17
19
  if (icons) appConfig.ui.icons = themeIcons[icons as keyof typeof themeIcons] as any
18
20
  }
19
21
 
@@ -24,8 +26,8 @@ export default defineNuxtPlugin({
24
26
  var colorsEl = document.querySelector('style#nuxt-ui-colors');
25
27
  if (colorsEl) {
26
28
  let html = colorsEl.innerHTML;
27
- if (localStorage.getItem('${site.name}-ui-primary')) {
28
- const primaryColor = localStorage.getItem('${site.name}-ui-primary');
29
+ if (localStorage.getItem('${name}-ui-primary')) {
30
+ const primaryColor = localStorage.getItem('${name}-ui-primary');
29
31
  if (primaryColor !== 'black') {
30
32
  html = html.replace(
31
33
  /(--ui-color-primary-\\d{2,3}:\\s*var\\(--color-)${appConfig.ui.colors.primary}(-\\d{2,3}.*?\\))/g,
@@ -33,8 +35,8 @@ export default defineNuxtPlugin({
33
35
  );
34
36
  }
35
37
  }
36
- if (localStorage.getItem('${site.name}-ui-neutral')) {
37
- let neutralColor = localStorage.getItem('${site.name}-ui-neutral');
38
+ if (localStorage.getItem('${name}-ui-neutral')) {
39
+ let neutralColor = localStorage.getItem('${name}-ui-neutral');
38
40
  html = html.replace(
39
41
  /(--ui-color-neutral-\\d{2,3}:\\s*var\\(--color-)${appConfig.ui.colors.neutral}(-\\d{2,3}.*?\\))/g,
40
42
  \`$1\${neutralColor === 'neutral' ? 'old-neutral' : neutralColor}$2\`
@@ -48,25 +50,25 @@ export default defineNuxtPlugin({
48
50
  tagPriority: -1
49
51
  }, {
50
52
  innerHTML: `
51
- if (localStorage.getItem('${site.name}-ui-radius')) {
52
- document.getElementById('${site.name}-ui-radius').innerHTML = ':root { --ui-radius: ' + localStorage.getItem('${site.name}-ui-radius') + 'rem; }';
53
+ if (localStorage.getItem('${name}-ui-radius')) {
54
+ document.getElementById('${name}-ui-radius').innerHTML = ':root { --ui-radius: ' + localStorage.getItem('${name}-ui-radius') + 'rem; }';
53
55
  }
54
56
  `.replace(/\s+/g, ' '),
55
57
  type: 'text/javascript',
56
58
  tagPriority: -1
57
59
  }, {
58
60
  innerHTML: `
59
- if (localStorage.getItem('${site.name}-ui-black-as-primary') === 'true') {
60
- document.getElementById('${site.name}-ui-black-as-primary').innerHTML = ':root { --ui-primary: black; } .dark { --ui-primary: white; }';
61
+ if (localStorage.getItem('${name}-ui-black-as-primary') === 'true') {
62
+ document.getElementById('${name}-ui-black-as-primary').innerHTML = ':root { --ui-primary: black; } .dark { --ui-primary: white; }';
61
63
  } else {
62
- document.getElementById('${site.name}-ui-black-as-primary').innerHTML = '';
64
+ document.getElementById('${name}-ui-black-as-primary').innerHTML = '';
63
65
  }
64
66
  `.replace(/\s+/g, ' ')
65
67
  }, {
66
68
  innerHTML: [
67
- `if (localStorage.getItem('${site.name}-ui-font')) {`,
68
- `var font = localStorage.getItem('${site.name}-ui-font');`,
69
- `document.getElementById('${site.name}-ui-font').innerHTML = ':root { --font-sans: \\'' + font + '\\', sans-serif; }';`,
69
+ `if (localStorage.getItem('${name}-ui-font')) {`,
70
+ `var font = localStorage.getItem('${name}-ui-font');`,
71
+ `document.getElementById('${name}-ui-font').innerHTML = ':root { --font-sans: \\'' + font + '\\', sans-serif; }';`,
70
72
  `if (font !== 'Alibaba PuHuiTi' && ['Alibaba PuHuiTi', 'Public Sans', 'DM Sans', 'Geist', 'Inter', 'Poppins', 'Outfit', 'Raleway'].includes(font)) {`,
71
73
  `var lnk = document.createElement('link');`,
72
74
  `lnk.rel = 'stylesheet';`,
@@ -6,6 +6,13 @@ export interface ExtendedButtonProps extends ButtonProps {
6
6
 
7
7
  declare module 'nuxt/schema' {
8
8
  interface AppConfig {
9
+ ui: {
10
+ colors: {
11
+ primary: string
12
+ neutral: string
13
+ }
14
+ icons: Record<string, string>
15
+ }
9
16
  seo: {
10
17
  titleTemplate: string
11
18
  title: string
package/modules/module.ts CHANGED
@@ -130,17 +130,17 @@ export default defineNuxtModule<ModuleOptions>({
130
130
  }
131
131
  })
132
132
 
133
- nuxt.options.appConfig.header = defu(nuxt.options.appConfig.header, {
133
+ nuxt.options.appConfig.header = defu(nuxt.options.appConfig.header as Record<string, any>, {
134
134
  title: startCase(siteName)
135
135
  })
136
136
 
137
- nuxt.options.appConfig.seo = defu(nuxt.options.appConfig.seo, {
137
+ nuxt.options.appConfig.seo = defu(nuxt.options.appConfig.seo as Record<string, any>, {
138
138
  titleTemplate: `%s - ${siteName}`,
139
139
  title: siteName,
140
140
  description: meta.description || ''
141
141
  })
142
142
 
143
- nuxt.options.appConfig.github = defu(nuxt.options.appConfig.github, {
143
+ nuxt.options.appConfig.github = defu(nuxt.options.appConfig.github as Record<string, any>, {
144
144
  owner: gitInfo?.owner,
145
145
  name: gitInfo?.name,
146
146
  url: gitInfo?.url,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@movk/nuxt-docs",
3
3
  "type": "module",
4
- "version": "1.17.1",
4
+ "version": "1.17.3",
5
5
  "private": false,
6
6
  "description": "Modern Nuxt 4 documentation theme with auto-generated component docs, AI chat assistant, MCP server, and complete developer experience optimization.",
7
7
  "author": "YiXuan <mhaibaraai@gmail.com>",
@@ -29,14 +29,13 @@
29
29
  },
30
30
  "files": [
31
31
  "app",
32
- "content.config.ts",
33
32
  "modules",
34
- "nuxt.config.ts",
35
- "nuxt.schema.ts",
36
33
  "providers",
37
34
  "server",
38
35
  "utils",
39
- "pnpm-workspace.yaml",
36
+ "content.config.ts",
37
+ "nuxt.config.ts",
38
+ "nuxt.schema.ts",
40
39
  "README.md"
41
40
  ],
42
41
  "dependencies": {
@@ -46,7 +45,7 @@
46
45
  "@iconify-json/lucide": "^1.2.101",
47
46
  "@iconify-json/simple-icons": "^1.2.76",
48
47
  "@iconify-json/vscode-icons": "^1.2.45",
49
- "@movk/core": "^1.2.2",
48
+ "@movk/core": "^1.2.3",
50
49
  "@nuxt/a11y": "^1.0.0-alpha.1",
51
50
  "@nuxt/content": "^3.12.0",
52
51
  "@nuxt/image": "^2.0.0",