Skip to content

Commit dd7ce99

Browse files
Merge branch 'v3' into pr/3628
2 parents f29e0d5 + 445aac2 commit dd7ce99

File tree

7 files changed

+476
-13
lines changed

7 files changed

+476
-13
lines changed

Diff for: docs/app/app.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ useHead({
2323
{ key: 'theme-color', name: 'theme-color', content: color }
2424
],
2525
link: [
26-
{ rel: 'icon', type: 'image/svg+xml', href: '/icon.svg' },
26+
// { rel: 'icon', type: 'image/svg+xml', href: '/icon.svg' },
2727
{ rel: 'canonical', href: `https://ui.nuxt.com${withoutTrailingSlash(route.path)}` }
2828
],
2929
style: [
@@ -40,6 +40,8 @@ useServerSeoMeta({
4040
twitterCard: 'summary_large_image'
4141
})
4242
43+
useFaviconFromTheme()
44+
4345
const { frameworks, modules } = useSharedData()
4446
const { mappedNavigation, filteredNavigation } = useContentNavigation(navigation)
4547

Diff for: docs/app/composables/useFaviconFromTheme.ts

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { useColorMode } from '@vueuse/core'
2+
import { onMounted, watch } from 'vue'
3+
import FaviconSvg from 'public/icon.svg?raw'
4+
5+
export function useFaviconFromTheme() {
6+
const colorMode = useColorMode()
7+
8+
function generateFaviconSvg(color: string) {
9+
const parser = new DOMParser()
10+
const doc = parser.parseFromString(FaviconSvg, 'image/svg+xml')
11+
const svg = doc.documentElement
12+
13+
svg.querySelectorAll('path').forEach((path) => {
14+
path.setAttribute('fill', color)
15+
})
16+
17+
return new XMLSerializer().serializeToString(svg)
18+
}
19+
20+
function updateFavicon() {
21+
const root = document.documentElement
22+
const color = getComputedStyle(root).getPropertyValue('--ui-primary').trim() || '#00DC82'
23+
24+
const svg = generateFaviconSvg(color)
25+
const encoded = `data:image/svg+xml,${encodeURIComponent(svg)}`
26+
27+
useFavicon(encoded)
28+
}
29+
30+
function setupMutationObserver() {
31+
const styleTag = document.getElementById('nuxt-ui-colors')
32+
if (!styleTag) return
33+
34+
const observer = new MutationObserver(() => {
35+
updateFavicon()
36+
})
37+
38+
observer.observe(styleTag, {
39+
characterData: true,
40+
subtree: true,
41+
childList: true
42+
})
43+
}
44+
45+
onMounted(() => {
46+
watch(colorMode, () => {
47+
updateFavicon()
48+
}, {
49+
immediate: true,
50+
flush: 'post'
51+
})
52+
53+
setupMutationObserver()
54+
})
55+
}

Diff for: docs/app/error.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ useHead({
2626
{ key: 'theme-color', name: 'theme-color', content: color }
2727
],
2828
link: [
29-
{ rel: 'icon', type: 'image/svg+xml', href: '/icon.svg' }
29+
// { rel: 'icon', type: 'image/svg+xml', href: '/icon.svg' }
3030
],
3131
style: [
3232
{ innerHTML: radius, id: 'nuxt-ui-radius', tagPriority: -2 },
@@ -47,6 +47,8 @@ useServerSeoMeta({
4747
twitterCard: 'summary_large_image'
4848
})
4949
50+
useFaviconFromTheme()
51+
5052
const { frameworks, modules } = useSharedData()
5153
const { mappedNavigation, filteredNavigation } = useContentNavigation(navigation)
5254

Diff for: docs/app/pages/pro/.content/templates.yml

+27-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,34 @@ links:
1616
variant: outline
1717
trailingIcon: i-lucide-arrow-right
1818
templates:
19+
- title: 'Chat'
20+
description: "An AI chatbot template designed to help you build your own chatbot with Nuxt UI Pro components and deployed on [NuxtHub](https://hub.nuxt.com)."
21+
icon: i-lucide-message-circle
22+
thumbnail:
23+
dark: https://assets.hub.nuxt.com/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2NoYXQtdGVtcGxhdGUubnV4dC5kZXYiLCJpYXQiOjE3NDI4NDY2ODB9.n4YCsoNz8xatox7UMoYZFNo7iS1mC_DT0h0A9cKRoTw.jpg?theme=dark
24+
light: https://assets.hub.nuxt.com/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2NoYXQtdGVtcGxhdGUubnV4dC5kZXYiLCJpYXQiOjE3NDI4NDY2ODB9.n4YCsoNz8xatox7UMoYZFNo7iS1mC_DT0h0A9cKRoTw.jpg?theme=light
25+
features:
26+
- title: Powered by Cloudflare AI models
27+
icon: i-simple-icons-cloudflare
28+
- title: GitHub OAuth authentication
29+
icon: i-lucide-lock
30+
- title: Saved chats and messages
31+
icon: i-lucide-database
32+
links:
33+
- label: Preview
34+
to: https://chat-template.nuxt.dev
35+
target: _blank
36+
leadingIcon: i-logos-nuxt-icon
37+
trailingIcon: i-lucide-arrow-up-right
38+
color: neutral
39+
- label: Nuxt Template
40+
to: https://github.com/nuxt-ui-pro/chat
41+
target: _blank
42+
icon: i-simple-icons-github
43+
color: neutral
44+
variant: outline
1945
- title: 'Dashboard'
20-
description: "A template to illustrate how to build your own dashboard with the 15+ latest Nuxt UI Pro components, designed specifically to create a consistent look and feel."
46+
description: "A template to illustrate how to build your own dashboard with 15+ Nuxt UI Pro components, designed specifically to create a consistent look and feel."
2147
icon: i-lucide-bar-chart-big
2248
thumbnail:
2349
dark: https://assets.hub.nuxt.com/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2Rhc2hib2FyZC10ZW1wbGF0ZS5udXh0LmRldiIsImlhdCI6MTczOTQ2MzU2N30._VElt4uvLjvAMdnTLytCInOajMElzWDKbmvOaMZhZUI.jpg?theme=dark

Diff for: docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@iconify-json/lucide": "^1.2.36",
99
"@iconify-json/simple-icons": "^1.2.32",
1010
"@iconify-json/vscode-icons": "^1.2.19",
11-
"@nuxt/content": "^3.4.0",
11+
"@nuxt/content": "https://pkg.pr.new/@nuxt/content@754e480",
1212
"@nuxt/image": "^1.10.0",
1313
"@nuxt/ui": "latest",
1414
"@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@3cc20d8",

0 commit comments

Comments
 (0)