naystack 1.8.15 → 1.8.17

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.
@@ -122,28 +122,42 @@ function getEnv(key, skipCheck) {
122
122
  }
123
123
 
124
124
  // src/utils/client/seo.ts
125
- var setupSEO = (SEO) => (title, description, image) => ({
126
- title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
127
- description: description || SEO.description,
128
- openGraph: {
129
- type: "website",
130
- siteName: SEO.siteName,
131
- ...image ? { images: [image] } : {}
132
- },
133
- twitter: {
134
- card: "summary_large_image",
135
- ...image ? { images: [image] } : {}
136
- },
137
- appleWebApp: {
138
- title: title ? title : SEO.title,
139
- capable: true,
140
- startupImage: `${getEnv("NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */)}/apple-icon.png`
141
- },
142
- applicationName: SEO.siteName,
143
- creator: SEO.siteName,
144
- robots: "index, follow",
145
- publisher: SEO.siteName
146
- });
125
+ var setupSEO = (SEO) => (title, description, image, options) => {
126
+ const isSmallImage = options?.imageSize === "small";
127
+ return {
128
+ title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
129
+ description: description || SEO.description,
130
+ openGraph: {
131
+ type: "website",
132
+ siteName: SEO.siteName,
133
+ // WhatsApp/Slack pick the thumbnail layout off the declared dimensions,
134
+ // so a small image needs them stated explicitly to avoid a full-bleed preview.
135
+ ...image ? {
136
+ images: [
137
+ isSmallImage ? {
138
+ url: image,
139
+ width: SMALL_IMAGE_SIZE,
140
+ height: SMALL_IMAGE_SIZE
141
+ } : image
142
+ ]
143
+ } : {}
144
+ },
145
+ twitter: {
146
+ card: isSmallImage ? "summary" : "summary_large_image",
147
+ ...image ? { images: [image] } : {}
148
+ },
149
+ appleWebApp: {
150
+ title: title ? title : SEO.title,
151
+ capable: true,
152
+ startupImage: `${getEnv("NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */)}/apple-icon.png`
153
+ },
154
+ applicationName: SEO.siteName,
155
+ creator: SEO.siteName,
156
+ robots: "index, follow",
157
+ publisher: SEO.siteName
158
+ };
159
+ };
160
+ var SMALL_IMAGE_SIZE = 200;
147
161
  // Annotate the CommonJS export names for ESM import in node:
148
162
  0 && (module.exports = {
149
163
  setupSEO,
@@ -1,4 +1,4 @@
1
1
  export { useBreakpoint, useVisibility } from './hooks.mjs';
2
- export { setupSEO } from './seo.mjs';
2
+ export { SEOOptions, setupSEO } from './seo.mjs';
3
3
  import 'react';
4
4
  import 'next';
@@ -1,4 +1,4 @@
1
1
  export { useBreakpoint, useVisibility } from './hooks.js';
2
- export { setupSEO } from './seo.js';
2
+ export { SEOOptions, setupSEO } from './seo.js';
3
3
  import 'react';
4
4
  import 'next';
@@ -94,28 +94,42 @@ function getEnv(key, skipCheck) {
94
94
  }
95
95
 
96
96
  // src/utils/client/seo.ts
97
- var setupSEO = (SEO) => (title, description, image) => ({
98
- title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
99
- description: description || SEO.description,
100
- openGraph: {
101
- type: "website",
102
- siteName: SEO.siteName,
103
- ...image ? { images: [image] } : {}
104
- },
105
- twitter: {
106
- card: "summary_large_image",
107
- ...image ? { images: [image] } : {}
108
- },
109
- appleWebApp: {
110
- title: title ? title : SEO.title,
111
- capable: true,
112
- startupImage: `${getEnv("NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */)}/apple-icon.png`
113
- },
114
- applicationName: SEO.siteName,
115
- creator: SEO.siteName,
116
- robots: "index, follow",
117
- publisher: SEO.siteName
118
- });
97
+ var setupSEO = (SEO) => (title, description, image, options) => {
98
+ const isSmallImage = options?.imageSize === "small";
99
+ return {
100
+ title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
101
+ description: description || SEO.description,
102
+ openGraph: {
103
+ type: "website",
104
+ siteName: SEO.siteName,
105
+ // WhatsApp/Slack pick the thumbnail layout off the declared dimensions,
106
+ // so a small image needs them stated explicitly to avoid a full-bleed preview.
107
+ ...image ? {
108
+ images: [
109
+ isSmallImage ? {
110
+ url: image,
111
+ width: SMALL_IMAGE_SIZE,
112
+ height: SMALL_IMAGE_SIZE
113
+ } : image
114
+ ]
115
+ } : {}
116
+ },
117
+ twitter: {
118
+ card: isSmallImage ? "summary" : "summary_large_image",
119
+ ...image ? { images: [image] } : {}
120
+ },
121
+ appleWebApp: {
122
+ title: title ? title : SEO.title,
123
+ capable: true,
124
+ startupImage: `${getEnv("NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */)}/apple-icon.png`
125
+ },
126
+ applicationName: SEO.siteName,
127
+ creator: SEO.siteName,
128
+ robots: "index, follow",
129
+ publisher: SEO.siteName
130
+ };
131
+ };
132
+ var SMALL_IMAGE_SIZE = 200;
119
133
  export {
120
134
  setupSEO,
121
135
  useBreakpoint,
@@ -75,28 +75,42 @@ function getEnv(key, skipCheck) {
75
75
  }
76
76
 
77
77
  // src/utils/client/seo.ts
78
- var setupSEO = (SEO) => (title, description, image) => ({
79
- title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
80
- description: description || SEO.description,
81
- openGraph: {
82
- type: "website",
83
- siteName: SEO.siteName,
84
- ...image ? { images: [image] } : {}
85
- },
86
- twitter: {
87
- card: "summary_large_image",
88
- ...image ? { images: [image] } : {}
89
- },
90
- appleWebApp: {
91
- title: title ? title : SEO.title,
92
- capable: true,
93
- startupImage: `${getEnv("NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */)}/apple-icon.png`
94
- },
95
- applicationName: SEO.siteName,
96
- creator: SEO.siteName,
97
- robots: "index, follow",
98
- publisher: SEO.siteName
99
- });
78
+ var setupSEO = (SEO) => (title, description, image, options) => {
79
+ const isSmallImage = options?.imageSize === "small";
80
+ return {
81
+ title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
82
+ description: description || SEO.description,
83
+ openGraph: {
84
+ type: "website",
85
+ siteName: SEO.siteName,
86
+ // WhatsApp/Slack pick the thumbnail layout off the declared dimensions,
87
+ // so a small image needs them stated explicitly to avoid a full-bleed preview.
88
+ ...image ? {
89
+ images: [
90
+ isSmallImage ? {
91
+ url: image,
92
+ width: SMALL_IMAGE_SIZE,
93
+ height: SMALL_IMAGE_SIZE
94
+ } : image
95
+ ]
96
+ } : {}
97
+ },
98
+ twitter: {
99
+ card: isSmallImage ? "summary" : "summary_large_image",
100
+ ...image ? { images: [image] } : {}
101
+ },
102
+ appleWebApp: {
103
+ title: title ? title : SEO.title,
104
+ capable: true,
105
+ startupImage: `${getEnv("NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */)}/apple-icon.png`
106
+ },
107
+ applicationName: SEO.siteName,
108
+ creator: SEO.siteName,
109
+ robots: "index, follow",
110
+ publisher: SEO.siteName
111
+ };
112
+ };
113
+ var SMALL_IMAGE_SIZE = 200;
100
114
  // Annotate the CommonJS export names for ESM import in node:
101
115
  0 && (module.exports = {
102
116
  setupSEO
@@ -12,7 +12,7 @@ import { Metadata } from 'next';
12
12
  * @param SEO.description - Default meta description.
13
13
  * @param SEO.siteName - Application/site name (used in openGraph, twitter, and as the separator in titles).
14
14
  * @param SEO.themeColor - Theme color for mobile browsers (e.g. `"#000000"`).
15
- * @returns A function `(title?, description?, image?) => Metadata`. Pass page-specific overrides; they fill in or replace the defaults.
15
+ * @returns A function `(title?, description?, image?, options?) => Metadata`. Pass page-specific overrides; they fill in or replace the defaults.
16
16
  *
17
17
  * @example Setup in a utility file:
18
18
  * ```ts
@@ -44,6 +44,11 @@ import { Metadata } from 'next';
44
44
  * }
45
45
  * ```
46
46
  *
47
+ * @example Thumbnail-sized preview (avatars, icons — anything not a hero image):
48
+ * ```ts
49
+ * return getSEO(post.title, post.body, post.author.photo, { imageSize: "small" });
50
+ * ```
51
+ *
47
52
  * @category Client
48
53
  */
49
54
  declare const setupSEO: (SEO: {
@@ -51,6 +56,13 @@ declare const setupSEO: (SEO: {
51
56
  description: string;
52
57
  siteName: string;
53
58
  themeColor: string;
54
- }) => (title?: string, description?: string, image?: string | null) => Metadata;
59
+ }) => (title?: string, description?: string, image?: string | null, options?: SEOOptions) => Metadata;
60
+ interface SEOOptions {
61
+ /**
62
+ * `"large"` (default) renders a full-width hero preview; `"small"` renders a
63
+ * square thumbnail next to the text — right for avatars and icons.
64
+ */
65
+ imageSize?: "large" | "small";
66
+ }
55
67
 
56
- export { setupSEO };
68
+ export { type SEOOptions, setupSEO };
@@ -12,7 +12,7 @@ import { Metadata } from 'next';
12
12
  * @param SEO.description - Default meta description.
13
13
  * @param SEO.siteName - Application/site name (used in openGraph, twitter, and as the separator in titles).
14
14
  * @param SEO.themeColor - Theme color for mobile browsers (e.g. `"#000000"`).
15
- * @returns A function `(title?, description?, image?) => Metadata`. Pass page-specific overrides; they fill in or replace the defaults.
15
+ * @returns A function `(title?, description?, image?, options?) => Metadata`. Pass page-specific overrides; they fill in or replace the defaults.
16
16
  *
17
17
  * @example Setup in a utility file:
18
18
  * ```ts
@@ -44,6 +44,11 @@ import { Metadata } from 'next';
44
44
  * }
45
45
  * ```
46
46
  *
47
+ * @example Thumbnail-sized preview (avatars, icons — anything not a hero image):
48
+ * ```ts
49
+ * return getSEO(post.title, post.body, post.author.photo, { imageSize: "small" });
50
+ * ```
51
+ *
47
52
  * @category Client
48
53
  */
49
54
  declare const setupSEO: (SEO: {
@@ -51,6 +56,13 @@ declare const setupSEO: (SEO: {
51
56
  description: string;
52
57
  siteName: string;
53
58
  themeColor: string;
54
- }) => (title?: string, description?: string, image?: string | null) => Metadata;
59
+ }) => (title?: string, description?: string, image?: string | null, options?: SEOOptions) => Metadata;
60
+ interface SEOOptions {
61
+ /**
62
+ * `"large"` (default) renders a full-width hero preview; `"small"` renders a
63
+ * square thumbnail next to the text — right for avatars and icons.
64
+ */
65
+ imageSize?: "large" | "small";
66
+ }
55
67
 
56
- export { setupSEO };
68
+ export { type SEOOptions, setupSEO };
@@ -49,28 +49,42 @@ function getEnv(key, skipCheck) {
49
49
  }
50
50
 
51
51
  // src/utils/client/seo.ts
52
- var setupSEO = (SEO) => (title, description, image) => ({
53
- title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
54
- description: description || SEO.description,
55
- openGraph: {
56
- type: "website",
57
- siteName: SEO.siteName,
58
- ...image ? { images: [image] } : {}
59
- },
60
- twitter: {
61
- card: "summary_large_image",
62
- ...image ? { images: [image] } : {}
63
- },
64
- appleWebApp: {
65
- title: title ? title : SEO.title,
66
- capable: true,
67
- startupImage: `${getEnv("NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */)}/apple-icon.png`
68
- },
69
- applicationName: SEO.siteName,
70
- creator: SEO.siteName,
71
- robots: "index, follow",
72
- publisher: SEO.siteName
73
- });
52
+ var setupSEO = (SEO) => (title, description, image, options) => {
53
+ const isSmallImage = options?.imageSize === "small";
54
+ return {
55
+ title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
56
+ description: description || SEO.description,
57
+ openGraph: {
58
+ type: "website",
59
+ siteName: SEO.siteName,
60
+ // WhatsApp/Slack pick the thumbnail layout off the declared dimensions,
61
+ // so a small image needs them stated explicitly to avoid a full-bleed preview.
62
+ ...image ? {
63
+ images: [
64
+ isSmallImage ? {
65
+ url: image,
66
+ width: SMALL_IMAGE_SIZE,
67
+ height: SMALL_IMAGE_SIZE
68
+ } : image
69
+ ]
70
+ } : {}
71
+ },
72
+ twitter: {
73
+ card: isSmallImage ? "summary" : "summary_large_image",
74
+ ...image ? { images: [image] } : {}
75
+ },
76
+ appleWebApp: {
77
+ title: title ? title : SEO.title,
78
+ capable: true,
79
+ startupImage: `${getEnv("NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */)}/apple-icon.png`
80
+ },
81
+ applicationName: SEO.siteName,
82
+ creator: SEO.siteName,
83
+ robots: "index, follow",
84
+ publisher: SEO.siteName
85
+ };
86
+ };
87
+ var SMALL_IMAGE_SIZE = 200;
74
88
  export {
75
89
  setupSEO
76
90
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.8.15",
3
+ "version": "1.8.17",
4
4
  "description": "A stack built with Next + GraphQL + S3 + Auth",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",