nuxt-og-image 5.1.0 → 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.
Files changed (70) hide show
  1. package/dist/client/200.html +10 -10
  2. package/dist/client/404.html +10 -10
  3. package/dist/client/_nuxt/Br6VVWxo.js +1 -0
  4. package/dist/client/_nuxt/CHRxzU3f.js +1 -0
  5. package/dist/client/_nuxt/Ct9h7GIg.js +1 -0
  6. package/dist/client/_nuxt/Cw1iv1IW.js +4017 -0
  7. package/dist/client/_nuxt/Dtw-SHSX.js +1 -0
  8. package/dist/client/_nuxt/builds/latest.json +1 -1
  9. package/dist/client/_nuxt/builds/meta/17f66c16-3b9b-4db1-b3c4-f2ed69a85873.json +1 -0
  10. package/dist/client/_nuxt/{entry.Dw_RMJvc.css → entry.CPPV_4vb.css} +1 -1
  11. package/dist/client/_nuxt/error-404.q4U0EoKE.css +1 -0
  12. package/dist/client/_nuxt/error-500.DXbjM38H.css +1 -0
  13. package/dist/client/index.html +10 -10
  14. package/dist/content.d.cts +2 -1
  15. package/dist/content.d.mts +2 -1
  16. package/dist/content.d.ts +2 -1
  17. package/dist/module.cjs +5 -5
  18. package/dist/module.d.cts +2 -1
  19. package/dist/module.d.mts +2 -1
  20. package/dist/module.d.ts +2 -1
  21. package/dist/module.json +3 -3
  22. package/dist/module.mjs +6 -6
  23. package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue +5 -12
  24. package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue.d.ts +12 -0
  25. package/dist/runtime/app/components/Templates/Community/Frame.vue +12 -18
  26. package/dist/runtime/app/components/Templates/Community/Frame.vue.d.ts +20 -0
  27. package/dist/runtime/app/components/Templates/Community/Nuxt.vue +9 -15
  28. package/dist/runtime/app/components/Templates/Community/Nuxt.vue.d.ts +11 -0
  29. package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue +51 -88
  30. package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue.d.ts +14 -0
  31. package/dist/runtime/app/components/Templates/Community/Pergel.vue +8 -13
  32. package/dist/runtime/app/components/Templates/Community/Pergel.vue.d.ts +11 -0
  33. package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue +9 -18
  34. package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue.d.ts +8 -0
  35. package/dist/runtime/app/components/Templates/Community/UnJs.vue +18 -33
  36. package/dist/runtime/app/components/Templates/Community/UnJs.vue.d.ts +20 -0
  37. package/dist/runtime/app/components/Templates/Community/Wave.vue +4 -10
  38. package/dist/runtime/app/components/Templates/Community/Wave.vue.d.ts +10 -0
  39. package/dist/runtime/app/components/Templates/Community/WithEmoji.vue +5 -12
  40. package/dist/runtime/app/components/Templates/Community/WithEmoji.vue.d.ts +12 -0
  41. package/dist/runtime/app/composables/defineOgImage.js +20 -18
  42. package/dist/runtime/app/utils/plugins.js +5 -9
  43. package/dist/runtime/app/utils.d.ts +4 -3
  44. package/dist/runtime/app/utils.js +31 -22
  45. package/dist/runtime/pure.js +4 -1
  46. package/dist/runtime/server/og-image/instances.d.ts +2 -2
  47. package/dist/runtime/server/og-image/satori/plugins/classes.d.ts +1 -1
  48. package/dist/runtime/server/og-image/satori/plugins/emojis.d.ts +1 -1
  49. package/dist/runtime/server/og-image/satori/plugins/encoding.d.ts +1 -1
  50. package/dist/runtime/server/og-image/satori/plugins/flex.d.ts +1 -1
  51. package/dist/runtime/server/og-image/satori/plugins/imageSrc.d.ts +1 -1
  52. package/dist/runtime/server/og-image/satori/plugins/nuxt-icon.d.ts +1 -1
  53. package/dist/runtime/server/og-image/satori/plugins/unocss.d.ts +1 -1
  54. package/dist/runtime/server/routes/debug.json.d.ts +1 -1
  55. package/dist/runtime/server/util/wasm.d.ts +1 -1
  56. package/dist/runtime/shared.d.ts +3 -3
  57. package/dist/runtime/shared.js +6 -9
  58. package/dist/runtime/types.d.ts +7 -7
  59. package/dist/types.d.mts +4 -2
  60. package/package.json +36 -39
  61. package/content.d.ts +0 -1
  62. package/dist/client/_nuxt/BKhpHsoX.js +0 -1
  63. package/dist/client/_nuxt/BLmTiKMJ.js +0 -1
  64. package/dist/client/_nuxt/DVcaHLff.js +0 -1
  65. package/dist/client/_nuxt/DpHmQ6sx.js +0 -3991
  66. package/dist/client/_nuxt/Dy0dDCjl.js +0 -1
  67. package/dist/client/_nuxt/builds/meta/a1854235-e297-4e1d-9aec-f8c2f24f15ac.json +0 -1
  68. package/dist/client/_nuxt/error-404.Db0f7OxX.css +0 -1
  69. package/dist/client/_nuxt/error-500.CgBP5IsV.css +0 -1
  70. package/dist/types.d.ts +0 -7
@@ -1,20 +1,14 @@
1
- <script setup lang="ts">
2
- /**
3
- * @credits @arashsheyda <https://github.com/arashsheyda>
4
- */
5
-
6
- withDefaults(defineProps<{
7
- title?: string
8
- description?: string
9
- bg?: string
10
- icon?: string
11
- logo?: string
12
- image?: string
13
- username?: string
14
- socials?: { name: string, icon: string }[]
15
- }>(), {
16
- bg: 'linear-gradient(to bottom right, #171717, #131313)',
17
- })
1
+ <script setup>
2
+ defineProps({
3
+ title: { type: String, required: false },
4
+ description: { type: String, required: false },
5
+ bg: { type: String, required: false, default: "linear-gradient(to bottom right, #171717, #131313)" },
6
+ icon: { type: String, required: false },
7
+ logo: { type: String, required: false },
8
+ image: { type: String, required: false },
9
+ username: { type: String, required: false },
10
+ socials: { type: Array, required: false }
11
+ });
18
12
  </script>
19
13
 
20
14
  <template>
@@ -56,7 +50,7 @@ withDefaults(defineProps<{
56
50
  <Icon
57
51
  v-for="social of socials"
58
52
  :key="social.name"
59
- :name="social.icon!"
53
+ :name="social.icon"
60
54
  class="w-7 h-7"
61
55
  />
62
56
  </div>
@@ -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 lang="ts" setup>
2
- /**
3
- * @credits NuxtLabs <https://nuxtlabs.com/>
4
- * @see https://github.com/nuxt/nuxt.com/blob/main/components/OgImage/Docs.vue
5
- */
6
- import { computed } from 'vue'
7
-
8
- const props = withDefaults(defineProps<{ title?: string, description?: string, headline?: string }>(), {
9
- title: 'title',
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 lang="ts">
2
- /**
3
- * @credits Nuxt SEO <https://nuxtseo.com/>
4
- */
5
-
6
- import { useSiteConfig } from '#imports'
7
- import { useOgImageRuntimeConfig } from '#og-image/shared'
8
- import { computed, defineComponent, h, resolveComponent } from 'vue'
9
-
10
- // convert to typescript props
11
- const props = withDefaults(defineProps<{
12
- colorMode?: 'dark' | 'light'
13
- title?: string
14
- description?: string
15
- icon?: string | boolean
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 || 'light'
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
- // if it's rgb or rgba, we convert it to hex
42
- if (props.theme.startsWith('rgb')) {
43
- const rgb = props.theme
44
- .replace('rgb(', '')
45
- .replace('rgba(', '')
46
- .replace(')', '')
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 '#FFFFFF'
58
- })
59
-
32
+ return "#FFFFFF";
33
+ });
60
34
  const themeRgb = computed(() => {
61
- // we want to convert it so it's just `<red>, <green>, <blue>` (255, 255, 255)
62
- return themeHex.value
63
- .replace('#', '')
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
- const IconComponent = runtimeConfig.hasNuxtIcon
78
- ? resolveComponent('Icon')
79
- : defineComponent({
80
- render() {
81
- return h('div', 'missing @nuxt/icon')
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
- colorMode === 'light' ? ['bg-white', 'text-gray-900'] : ['bg-gray-900', 'text-white'],
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
- width: '200%',
102
- height: '200%',
103
- 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%)`,
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
- colorMode === 'light' ? ['text-gray-700'] : ['text-gray-300'],
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 lang="ts" setup>
2
- /**
3
- * @credits Pergel <https://nuxtlabs.com/>
4
- */
5
- import { computed } from 'vue'
6
-
7
- const props = withDefaults(defineProps<{ title?: string, description?: string, headline?: string }>(), {
8
- title: 'title',
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 lang="ts">
2
- /**
3
- * @credits Full Stack Heroes <https://fullstackheroes.com/>
4
- */
5
-
6
- import { computed, useSiteConfig } from '#imports'
7
- import { parseURL } from 'ufo'
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 lang="ts">
2
- import { computed } from '#imports'
3
-
4
- /**
5
- * @credits UnJS <https://unjs.io/>
6
- */
7
-
8
- const props = withDefaults(defineProps<{
9
- title?: string
10
- description?: string
11
- emoji?: string
12
- downloads?: string | number
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('en-US', { notation: 'compact', compactDisplay: 'short' }).format(Number(props.stars || 0))
29
- })
30
- const downloads = computed(() => new Intl.NumberFormat('en-US', { notation: 'compact', compactDisplay: 'short' })
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 lang="ts">
2
- /**
3
- * @credits Full Stack Heroes <https://fullstackheroes.com/>
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 lang="ts">
2
- /**
3
- * @credits Full Stack Heroes <https://fullstackheroes.com/>
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, separateProps, useOgImageRuntimeConfig } from "../../shared.js";
7
- import { createOgImageMeta, normaliseOptions } from "../utils.js";
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 = normaliseOptions(defu({
37
- ..._options
38
- }, {
39
- component: defaults.component
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
- const resolvedOptions = normaliseOptions(defu(separateProps(_options), separateProps(routeRules), defaults));
44
- if (resolvedOptions.url) {
45
- createOgImageMeta(null, options, resolvedOptions, nuxtApp.ssrContext);
46
- } else {
47
- const path = getOgImagePath(basePath, defu(resolvedOptions, { _query: options._query }));
48
- if (import.meta.prerender) {
49
- appendHeader(useRequestEvent(nuxtApp), "x-nitro-prerender", path);
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, normaliseOptions } from "../../app/utils.js";
8
+ import { createOgImageMeta } from "../../app/utils.js";
9
9
  import { isInternalRoute, separateProps } from "../../pure.js";
10
- import { getOgImagePath, useOgImageRuntimeConfig } from "../../shared.js";
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
- const { defaults } = useOgImageRuntimeConfig();
86
- routeRules = normaliseOptions(defu(nuxtApp.ssrContext?.event.context._nitro?.routeRules?.ogImage, routeRules, {
87
- component: defaults.component
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 { DefineOgImageInput, OgImageOptions, OgImagePrebuilt } from '../types.js';
3
- export declare function createOgImageMeta(src: string | null, input: OgImageOptions | OgImagePrebuilt, resolvedOptions: OgImageOptions, ssrContext: NuxtSSRContext): void;
4
- export declare function normaliseOptions(_options: DefineOgImageInput): OgImageOptions | OgImagePrebuilt;
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'];