nuxt-og-image 5.1.1 → 5.1.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/dist/client/200.html +10 -10
- package/dist/client/404.html +10 -10
- package/dist/client/_nuxt/Br6VVWxo.js +1 -0
- package/dist/client/_nuxt/CHRxzU3f.js +1 -0
- package/dist/client/_nuxt/Ct9h7GIg.js +1 -0
- package/dist/client/_nuxt/Cw1iv1IW.js +4017 -0
- package/dist/client/_nuxt/Dtw-SHSX.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/17f66c16-3b9b-4db1-b3c4-f2ed69a85873.json +1 -0
- package/dist/client/_nuxt/{entry.Dw_RMJvc.css → entry.CPPV_4vb.css} +1 -1
- package/dist/client/_nuxt/error-404.q4U0EoKE.css +1 -0
- package/dist/client/_nuxt/error-500.DXbjM38H.css +1 -0
- package/dist/client/index.html +10 -10
- package/dist/content.d.cts +2 -1
- package/dist/content.d.mts +2 -1
- package/dist/content.d.ts +2 -1
- package/dist/module.cjs +1 -1
- package/dist/module.d.cts +2 -1
- package/dist/module.d.mts +2 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +2 -2
- package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue +5 -12
- package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue.d.ts +12 -0
- package/dist/runtime/app/components/Templates/Community/Frame.vue +12 -18
- package/dist/runtime/app/components/Templates/Community/Frame.vue.d.ts +20 -0
- package/dist/runtime/app/components/Templates/Community/Nuxt.vue +9 -15
- package/dist/runtime/app/components/Templates/Community/Nuxt.vue.d.ts +11 -0
- package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue +51 -88
- package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue.d.ts +14 -0
- package/dist/runtime/app/components/Templates/Community/Pergel.vue +8 -13
- package/dist/runtime/app/components/Templates/Community/Pergel.vue.d.ts +11 -0
- package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue +9 -18
- package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue.d.ts +8 -0
- package/dist/runtime/app/components/Templates/Community/UnJs.vue +18 -33
- package/dist/runtime/app/components/Templates/Community/UnJs.vue.d.ts +20 -0
- package/dist/runtime/app/components/Templates/Community/Wave.vue +4 -10
- package/dist/runtime/app/components/Templates/Community/Wave.vue.d.ts +10 -0
- package/dist/runtime/app/components/Templates/Community/WithEmoji.vue +5 -12
- package/dist/runtime/app/components/Templates/Community/WithEmoji.vue.d.ts +12 -0
- package/dist/runtime/app/composables/defineOgImage.js +20 -18
- package/dist/runtime/app/utils/plugins.js +5 -9
- package/dist/runtime/app/utils.d.ts +4 -3
- package/dist/runtime/app/utils.js +31 -22
- package/dist/runtime/pure.js +4 -1
- package/dist/runtime/server/og-image/instances.d.ts +2 -2
- package/dist/runtime/server/og-image/satori/plugins/classes.d.ts +1 -1
- package/dist/runtime/server/og-image/satori/plugins/emojis.d.ts +1 -1
- package/dist/runtime/server/og-image/satori/plugins/encoding.d.ts +1 -1
- package/dist/runtime/server/og-image/satori/plugins/flex.d.ts +1 -1
- package/dist/runtime/server/og-image/satori/plugins/imageSrc.d.ts +1 -1
- package/dist/runtime/server/og-image/satori/plugins/nuxt-icon.d.ts +1 -1
- package/dist/runtime/server/og-image/satori/plugins/unocss.d.ts +1 -1
- package/dist/runtime/server/routes/debug.json.d.ts +1 -1
- package/dist/runtime/server/util/wasm.d.ts +1 -1
- package/dist/runtime/shared.d.ts +3 -3
- package/dist/runtime/shared.js +6 -9
- package/dist/runtime/types.d.ts +7 -7
- package/dist/types.d.mts +4 -2
- package/package.json +36 -39
- package/content.d.ts +0 -1
- package/dist/client/_nuxt/BKhpHsoX.js +0 -1
- package/dist/client/_nuxt/BLmTiKMJ.js +0 -1
- package/dist/client/_nuxt/DVcaHLff.js +0 -1
- package/dist/client/_nuxt/DpHmQ6sx.js +0 -3991
- package/dist/client/_nuxt/Dy0dDCjl.js +0 -1
- package/dist/client/_nuxt/builds/meta/c5f3b216-b4a4-46fd-8c8f-d7974f7d29a9.json +0 -1
- package/dist/client/_nuxt/error-404.Db0f7OxX.css +0 -1
- package/dist/client/_nuxt/error-500.CgBP5IsV.css +0 -1
- package/dist/types.d.ts +0 -7
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @credits @arashsheyda <https://github.com/arashsheyda>
|
|
3
|
+
*/
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
bg?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
logo?: string;
|
|
10
|
+
image?: string;
|
|
11
|
+
username?: string;
|
|
12
|
+
socials?: {
|
|
13
|
+
name: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
|
+
bg: string;
|
|
19
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
export default _default;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
description: 'description',
|
|
11
|
-
headline: 'headline',
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const title = computed(() => (props.title || '').slice(0, 60))
|
|
15
|
-
const description = computed(() => (props.description || '').slice(0, 200))
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
title: { type: String, required: false, default: "title" },
|
|
5
|
+
description: { type: String, required: false, default: "description" },
|
|
6
|
+
headline: { type: String, required: false, default: "headline" }
|
|
7
|
+
});
|
|
8
|
+
const title = computed(() => (props.title || "").slice(0, 60));
|
|
9
|
+
const description = computed(() => (props.description || "").slice(0, 200));
|
|
16
10
|
</script>
|
|
17
11
|
|
|
18
12
|
<template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
headline?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
headline: string;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
export default _default;
|
|
@@ -1,91 +1,54 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
siteName?: string
|
|
17
|
-
siteLogo?: string
|
|
18
|
-
theme?: string
|
|
19
|
-
}>(), {
|
|
20
|
-
theme: '#00dc82',
|
|
21
|
-
title: 'title',
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const HexRegex = /^#(?:[0-9a-f]{3}){1,2}$/i
|
|
25
|
-
|
|
26
|
-
const runtimeConfig = useOgImageRuntimeConfig()
|
|
27
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useSiteConfig } from "#imports";
|
|
3
|
+
import { useOgImageRuntimeConfig } from "#og-image/shared";
|
|
4
|
+
import { computed, defineComponent, h, resolveComponent } from "vue";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
colorMode: { type: String, required: false },
|
|
7
|
+
title: { type: String, required: false, default: "title" },
|
|
8
|
+
description: { type: String, required: false },
|
|
9
|
+
icon: { type: [String, Boolean], required: false },
|
|
10
|
+
siteName: { type: String, required: false },
|
|
11
|
+
siteLogo: { type: String, required: false },
|
|
12
|
+
theme: { type: String, required: false, default: "#00dc82" }
|
|
13
|
+
});
|
|
14
|
+
const HexRegex = /^#(?:[0-9a-f]{3}){1,2}$/i;
|
|
15
|
+
const runtimeConfig = useOgImageRuntimeConfig();
|
|
28
16
|
const colorMode = computed(() => {
|
|
29
|
-
return props.colorMode || runtimeConfig.colorPreference ||
|
|
30
|
-
})
|
|
31
|
-
|
|
17
|
+
return props.colorMode || runtimeConfig.colorPreference || "light";
|
|
18
|
+
});
|
|
32
19
|
const themeHex = computed(() => {
|
|
33
|
-
// regex test if valid hex
|
|
34
20
|
if (HexRegex.test(props.theme))
|
|
35
|
-
return props.theme
|
|
36
|
-
|
|
37
|
-
// if it's hex without the hash, just add the hash
|
|
21
|
+
return props.theme;
|
|
38
22
|
if (HexRegex.test(`#${props.theme}`))
|
|
39
|
-
return `#${props.theme}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.split(',')
|
|
48
|
-
.map(v => Number.parseInt(v.trim(), 10))
|
|
49
|
-
const hex = rgb
|
|
50
|
-
.map((v) => {
|
|
51
|
-
const hex = v.toString(16)
|
|
52
|
-
return hex.length === 1 ? `0${hex}` : hex
|
|
53
|
-
})
|
|
54
|
-
.join('')
|
|
55
|
-
return `#${hex}`
|
|
23
|
+
return `#${props.theme}`;
|
|
24
|
+
if (props.theme.startsWith("rgb")) {
|
|
25
|
+
const rgb = props.theme.replace("rgb(", "").replace("rgba(", "").replace(")", "").split(",").map((v) => Number.parseInt(v.trim(), 10));
|
|
26
|
+
const hex = rgb.map((v) => {
|
|
27
|
+
const hex2 = v.toString(16);
|
|
28
|
+
return hex2.length === 1 ? `0${hex2}` : hex2;
|
|
29
|
+
}).join("");
|
|
30
|
+
return `#${hex}`;
|
|
56
31
|
}
|
|
57
|
-
return
|
|
58
|
-
})
|
|
59
|
-
|
|
32
|
+
return "#FFFFFF";
|
|
33
|
+
});
|
|
60
34
|
const themeRgb = computed(() => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.match(/.{1,2}/g)
|
|
65
|
-
?.map(v => Number.parseInt(v, 16))
|
|
66
|
-
.join(', ')
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
const siteConfig = useSiteConfig()
|
|
35
|
+
return themeHex.value.replace("#", "").match(/.{1,2}/g)?.map((v) => Number.parseInt(v, 16)).join(", ");
|
|
36
|
+
});
|
|
37
|
+
const siteConfig = useSiteConfig();
|
|
70
38
|
const siteName = computed(() => {
|
|
71
|
-
return props.siteName || siteConfig.name
|
|
72
|
-
})
|
|
39
|
+
return props.siteName || siteConfig.name;
|
|
40
|
+
});
|
|
73
41
|
const siteLogo = computed(() => {
|
|
74
|
-
return props.siteLogo || siteConfig.logo
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (typeof props.icon === 'string' && !runtimeConfig.hasNuxtIcon && process.dev) {
|
|
85
|
-
console.warn('Please install `@nuxt/icon` to use icons with the fallback OG Image component.')
|
|
86
|
-
// eslint-disable-next-line no-console
|
|
87
|
-
console.log('\nnpx nuxi module add icon\n')
|
|
88
|
-
// create simple div renderer component
|
|
42
|
+
return props.siteLogo || siteConfig.logo;
|
|
43
|
+
});
|
|
44
|
+
const IconComponent = runtimeConfig.hasNuxtIcon ? resolveComponent("Icon") : defineComponent({
|
|
45
|
+
render() {
|
|
46
|
+
return h("div", "missing @nuxt/icon");
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (typeof props.icon === "string" && !runtimeConfig.hasNuxtIcon && process.dev) {
|
|
50
|
+
console.warn("Please install `@nuxt/icon` to use icons with the fallback OG Image component.");
|
|
51
|
+
console.log("\nnpx nuxi module add icon\n");
|
|
89
52
|
}
|
|
90
53
|
</script>
|
|
91
54
|
|
|
@@ -93,15 +56,15 @@ if (typeof props.icon === 'string' && !runtimeConfig.hasNuxtIcon && process.dev)
|
|
|
93
56
|
<div
|
|
94
57
|
class="w-full h-full flex justify-between relative p-[60px]"
|
|
95
58
|
:class="[
|
|
96
|
-
|
|
97
|
-
|
|
59
|
+
colorMode === 'light' ? ['bg-white', 'text-gray-900'] : ['bg-gray-900', 'text-white']
|
|
60
|
+
]"
|
|
98
61
|
>
|
|
99
62
|
<div
|
|
100
63
|
class="flex absolute top-0 right-[-100%]" :style="{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
64
|
+
width: '200%',
|
|
65
|
+
height: '200%',
|
|
66
|
+
backgroundImage: `radial-gradient(circle, rgba(${themeRgb}, 0.5) 0%, ${colorMode === 'dark' ? 'rgba(5, 5, 5,0.3)' : 'rgba(255, 255, 255, 0.7)'} 50%, ${props.colorMode === 'dark' ? 'rgba(5, 5, 5,0)' : 'rgba(255, 255, 255, 0)'} 70%)`
|
|
67
|
+
}"
|
|
105
68
|
/>
|
|
106
69
|
<div class="h-full w-full justify-between relative">
|
|
107
70
|
<div class="flex flex-row justify-between items-start">
|
|
@@ -111,8 +74,8 @@ if (typeof props.icon === 'string' && !runtimeConfig.hasNuxtIcon && process.dev)
|
|
|
111
74
|
</h1>
|
|
112
75
|
<p
|
|
113
76
|
v-if="description" class="text-[35px]" :class="[
|
|
114
|
-
|
|
115
|
-
|
|
77
|
+
colorMode === 'light' ? ['text-gray-700'] : ['text-gray-300']
|
|
78
|
+
]"
|
|
116
79
|
>
|
|
117
80
|
{{ description }}
|
|
118
81
|
</p>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
colorMode?: 'dark' | 'light';
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
icon?: string | boolean;
|
|
6
|
+
siteName?: string;
|
|
7
|
+
siteLogo?: string;
|
|
8
|
+
theme?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
+
title: string;
|
|
12
|
+
theme: string;
|
|
13
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
description: 'description',
|
|
10
|
-
headline: 'headline',
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const title = computed(() => props.title.slice(0, 60))
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
title: { type: String, required: false, default: "title" },
|
|
5
|
+
description: { type: String, required: false, default: "description" },
|
|
6
|
+
headline: { type: String, required: false, default: "headline" }
|
|
7
|
+
});
|
|
8
|
+
const title = computed(() => props.title.slice(0, 60));
|
|
14
9
|
</script>
|
|
15
10
|
|
|
16
11
|
<template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
headline?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
headline: string;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
export default _default;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const props = withDefaults(defineProps<{
|
|
10
|
-
title?: string
|
|
11
|
-
website?: string
|
|
12
|
-
}>(), {
|
|
13
|
-
title: 'title',
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
// fallback to site name
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, useSiteConfig } from "#imports";
|
|
3
|
+
import { parseURL } from "ufo";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
title: { type: String, required: false, default: "title" },
|
|
6
|
+
website: { type: String, required: false }
|
|
7
|
+
});
|
|
17
8
|
const website = computed(() => {
|
|
18
|
-
return props.website || parseURL(useSiteConfig().url).host
|
|
19
|
-
})
|
|
9
|
+
return props.website || parseURL(useSiteConfig().url).host;
|
|
10
|
+
});
|
|
20
11
|
</script>
|
|
21
12
|
|
|
22
13
|
<template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
title?: string;
|
|
3
|
+
website?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
|
+
title: string;
|
|
7
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
export default _default;
|
|
@@ -1,37 +1,22 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { computed } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
stars?: string | number
|
|
14
|
-
contributors?: string | number
|
|
15
|
-
}>(), {
|
|
16
|
-
title: 'unjs/h3',
|
|
17
|
-
description: 'Minimal H(TTP) framework built for high performance and portability',
|
|
18
|
-
emoji: '⚡',
|
|
19
|
-
downloads: '2500000',
|
|
20
|
-
stars: '2400',
|
|
21
|
-
contributors: '30',
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const org = computed(() => props.title.split('/')[0])
|
|
25
|
-
const repo = computed(() => props.title.split('/')[1])
|
|
26
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "#imports";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
title: { type: String, required: false, default: "unjs/h3" },
|
|
5
|
+
description: { type: String, required: false, default: "Minimal H(TTP) framework built for high performance and portability" },
|
|
6
|
+
emoji: { type: String, required: false, default: "\u26A1" },
|
|
7
|
+
downloads: { type: [String, Number], required: false, default: "2500000" },
|
|
8
|
+
stars: { type: [String, Number], required: false, default: "2400" },
|
|
9
|
+
contributors: { type: [String, Number], required: false, default: "30" }
|
|
10
|
+
});
|
|
11
|
+
const org = computed(() => props.title.split("/")[0]);
|
|
12
|
+
const repo = computed(() => props.title.split("/")[1]);
|
|
27
13
|
const stars = computed(() => {
|
|
28
|
-
return new Intl.NumberFormat(
|
|
29
|
-
})
|
|
30
|
-
const downloads = computed(
|
|
31
|
-
.format(Number(props.downloads || 0))
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const description = computed(() => (props.description || '').slice(0, 200))
|
|
14
|
+
return new Intl.NumberFormat("en-US", { notation: "compact", compactDisplay: "short" }).format(Number(props.stars || 0));
|
|
15
|
+
});
|
|
16
|
+
const downloads = computed(
|
|
17
|
+
() => new Intl.NumberFormat("en-US", { notation: "compact", compactDisplay: "short" }).format(Number(props.downloads || 0))
|
|
18
|
+
);
|
|
19
|
+
const description = computed(() => (props.description || "").slice(0, 200));
|
|
35
20
|
</script>
|
|
36
21
|
|
|
37
22
|
<template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @credits UnJS <https://unjs.io/>
|
|
3
|
+
*/
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
emoji?: string;
|
|
8
|
+
downloads?: string | number;
|
|
9
|
+
stars?: string | number;
|
|
10
|
+
contributors?: string | number;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
emoji: string;
|
|
16
|
+
downloads: string | number;
|
|
17
|
+
stars: string | number;
|
|
18
|
+
contributors: string | number;
|
|
19
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
export default _default;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
withDefaults(defineProps<{
|
|
7
|
-
title?: string
|
|
8
|
-
}>(), {
|
|
9
|
-
title: 'title',
|
|
10
|
-
})
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
title: { type: String, required: false, default: "title" }
|
|
4
|
+
});
|
|
11
5
|
</script>
|
|
12
6
|
|
|
13
7
|
<template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @credits Full Stack Heroes <https://fullstackheroes.com/>
|
|
3
|
+
*/
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
title?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
8
|
+
title: string;
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
export default _default;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
withDefaults(defineProps<{
|
|
7
|
-
emoji?: string
|
|
8
|
-
title?: string
|
|
9
|
-
}>(), {
|
|
10
|
-
title: 'title',
|
|
11
|
-
emoji: '👋',
|
|
12
|
-
})
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
emoji: { type: String, required: false, default: "\u{1F44B}" },
|
|
4
|
+
title: { type: String, required: false, default: "title" }
|
|
5
|
+
});
|
|
13
6
|
</script>
|
|
14
7
|
|
|
15
8
|
<template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @credits Full Stack Heroes <https://fullstackheroes.com/>
|
|
3
|
+
*/
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
emoji?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
9
|
+
title: string;
|
|
10
|
+
emoji: string;
|
|
11
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { defu } from "defu";
|
|
2
1
|
import { appendHeader } from "h3";
|
|
3
2
|
import { createError, useNuxtApp, useRequestEvent, useRoute, useState } from "nuxt/app";
|
|
4
|
-
import { ref } from "vue";
|
|
3
|
+
import { ref, toValue } from "vue";
|
|
5
4
|
import { createNitroRouteRuleMatcher } from "../../server/util/kit.js";
|
|
6
|
-
import { getOgImagePath,
|
|
7
|
-
import { createOgImageMeta,
|
|
5
|
+
import { getOgImagePath, useOgImageRuntimeConfig } from "../../shared.js";
|
|
6
|
+
import { createOgImageMeta, setHeadOgImagePrebuilt } from "../utils.js";
|
|
8
7
|
export function defineOgImage(_options = {}) {
|
|
9
8
|
const nuxtApp = useNuxtApp();
|
|
10
9
|
const route = useRoute();
|
|
@@ -33,21 +32,24 @@ export function defineOgImage(_options = {}) {
|
|
|
33
32
|
return;
|
|
34
33
|
}
|
|
35
34
|
const { defaults } = useOgImageRuntimeConfig();
|
|
36
|
-
const options =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
35
|
+
const options = toValue(_options);
|
|
36
|
+
for (const key in routeRules) {
|
|
37
|
+
if (options[key] === void 0)
|
|
38
|
+
options[key] = routeRules[key];
|
|
39
|
+
}
|
|
40
|
+
for (const key in defaults) {
|
|
41
|
+
if (options[key] === void 0)
|
|
42
|
+
options[key] = defaults[key];
|
|
43
|
+
}
|
|
41
44
|
if (route.query)
|
|
42
45
|
options._query = route.query;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
createOgImageMeta(path, options, resolvedOptions, nuxtApp.ssrContext);
|
|
46
|
+
if (options.url) {
|
|
47
|
+
setHeadOgImagePrebuilt(options);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const path = getOgImagePath(basePath, options);
|
|
51
|
+
if (import.meta.prerender) {
|
|
52
|
+
appendHeader(useRequestEvent(nuxtApp), "x-nitro-prerender", path);
|
|
52
53
|
}
|
|
54
|
+
createOgImageMeta(path, options, nuxtApp.ssrContext);
|
|
53
55
|
}
|
|
@@ -5,9 +5,9 @@ import { parse, stringify } from "devalue";
|
|
|
5
5
|
import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
6
6
|
import { parseURL, withoutBase } from "ufo";
|
|
7
7
|
import { toValue } from "vue";
|
|
8
|
-
import { createOgImageMeta
|
|
8
|
+
import { createOgImageMeta } from "../../app/utils.js";
|
|
9
9
|
import { isInternalRoute, separateProps } from "../../pure.js";
|
|
10
|
-
import { getOgImagePath
|
|
10
|
+
import { getOgImagePath } from "../../shared.js";
|
|
11
11
|
export function ogImageCanonicalUrls(nuxtApp) {
|
|
12
12
|
nuxtApp.hooks.hook("app:rendered", async (ctx) => {
|
|
13
13
|
const { ssrContext } = ctx;
|
|
@@ -82,12 +82,8 @@ export function routeRuleOgImage(nuxtApp) {
|
|
|
82
82
|
nuxtApp.ssrContext._ogImageInstances = void 0;
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}));
|
|
89
|
-
const resolvedOptions = normaliseOptions(defu(routeRules, defaults));
|
|
90
|
-
const src = getOgImagePath(ssrContext.url, resolvedOptions);
|
|
91
|
-
createOgImageMeta(src, routeRules, resolvedOptions, nuxtApp.ssrContext);
|
|
85
|
+
routeRules = defu(nuxtApp.ssrContext?.event.context._nitro?.routeRules?.ogImage, routeRules);
|
|
86
|
+
const src = getOgImagePath(ssrContext.url, routeRules);
|
|
87
|
+
createOgImageMeta(src, routeRules, nuxtApp.ssrContext);
|
|
92
88
|
});
|
|
93
89
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NuxtSSRContext } from 'nuxt/app';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
2
|
+
import type { OgImageOptions, OgImagePrebuilt } from '../types.js';
|
|
3
|
+
export declare function setHeadOgImagePrebuilt(input: OgImagePrebuilt): void;
|
|
4
|
+
export declare function createOgImageMeta(src: string, input: OgImageOptions | OgImagePrebuilt, ssrContext: NuxtSSRContext): void;
|
|
5
|
+
export declare function resolveComponentName(component: OgImageOptions['component'], fallback: string): OgImageOptions['component'];
|