next-sanity 5.5.10 → 6.0.1

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/README.md CHANGED
@@ -37,7 +37,6 @@ The official [Sanity.io][sanity] toolkit for Next.js apps.
37
37
  - [Configuring Sanity Studio on a route](#configuring-sanity-studio-on-a-route)
38
38
  - [Manual installation](#manual-installation)
39
39
  - [Studio route with App Router](#studio-route-with-app-router)
40
- - [Studio Routes with Pages Router](#studio-routes-with-pages-router)
41
40
  - [Lower level control with `StudioProvider` and `StudioLayout`](#lower-level-control-with-studioprovider-and-studiolayout)
42
41
  - [Migration guides](#migration-guides)
43
42
  - [License](#license)
@@ -416,9 +415,9 @@ To aid in debugging and understanding what's in the cache, revalidated, skipped,
416
415
  ```js
417
416
  // ./next.config.js
418
417
  module.exports = {
419
- experimental: {
420
- logging: {
421
- level: 'verbose',
418
+ logging: {
419
+ fetches: {
420
+ fullUrl: true,
422
421
  },
423
422
  },
424
423
  }
@@ -578,7 +577,7 @@ npx sanity@latest init
578
577
 
579
578
  ### Manual installation
580
579
 
581
- Make a file called `sanity.config.ts` (or `.js` for non-TypeScript projects) in the project's root (same place as `next.config.ts`) and copy the example below. Both the Next `/app` and `/pages` examples use this config file:
580
+ Make a file called `sanity.config.ts` (or `.js` for non-TypeScript projects) in the project's root (same place as `next.config.ts`) and copy the example below:
582
581
 
583
582
  ```ts
584
583
  // ./sanity.config.ts
@@ -591,7 +590,7 @@ const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!
591
590
  const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET!
592
591
 
593
592
  export default defineConfig({
594
- basePath: '/admin', // <-- important that `basePath` matches the route you're mounting your studio from, it applies to both `/pages` and `/app`
593
+ basePath: '/admin', // <-- important that `basePath` matches the route you're mounting your studio from
595
594
 
596
595
  projectId,
597
596
  dataset,
@@ -625,6 +624,8 @@ Now you can run commands like `npx sanity cors add`. Run `npx sanity help` for a
625
624
 
626
625
  ### Studio route with App Router
627
626
 
627
+ Even if the rest of your app is using Pages Router, you should still mount the Studio on an App Router route. [Next supports both routers in the same app.](https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#migrating-from-pages-to-app)
628
+
628
629
  ```tsx
629
630
  // ./src/app/studio/[[...index]]/page.tsx
630
631
  import {Studio} from './Studio'
@@ -634,6 +635,7 @@ export const dynamic = 'force-static'
634
635
 
635
636
  // Set the right `viewport`, `robots` and `referer` meta tags
636
637
  export {metadata} from 'next-sanity/studio/metadata'
638
+ export {viewport} from 'next-sanity/studio/viewport'
637
639
 
638
640
  export default function StudioPage() {
639
641
  return <Studio />
@@ -659,43 +661,27 @@ How to customize meta tags:
659
661
  ```tsx
660
662
  // ./src/app/studio/[[...index]]/page.tsx
661
663
  import type {Metadata} from 'next'
664
+ import type {Viewport} from 'next'
662
665
  import {metadata as studioMetadata} from 'next-sanity/studio/metadata'
666
+ import {viewport as studioViewport} from 'next-sanity/studio/viewport'
663
667
 
664
668
  import {Studio} from './Studio'
665
669
 
666
670
  // Set the right `viewport`, `robots` and `referer` meta tags
667
671
  export const metadata: Metadata = {
668
672
  ...studioMetadata,
669
- // Overrides the viewport to resize behavior
670
- viewport: `${studioMetadata.viewport}, interactive-widget=resizes-content`,
671
- }
672
-
673
- export default function StudioPage() {
674
- return <Studio />
673
+ // Overrides the title until the Studio is loaded
674
+ title: 'Loading Studio…',
675
675
  }
676
- ```
677
676
 
678
- ### Studio Routes with Pages Router
679
-
680
- ```tsx
681
- // ./pages/studio/[[...index]].tsx
682
- import Head from 'next/head'
683
- import {NextStudio} from 'next-sanity/studio'
684
- import {metadata} from 'next-sanity/studio/metadata'
685
-
686
- import config from '../../sanity.config'
677
+ export const viewport: Viewport = {
678
+ ...studioViewport,
679
+ // Overrides the viewport to resize behavior
680
+ interactiveWidget: 'resizes-content'
681
+ })
687
682
 
688
683
  export default function StudioPage() {
689
- return (
690
- <>
691
- <Head>
692
- {Object.entries(metadata).map(([key, value]) => (
693
- <meta key={key} name={key} content={value} />
694
- ))}
695
- </Head>
696
- <NextStudio config={config} />
697
- </>
698
- )
684
+ return <Studio />
699
685
  }
700
686
  ```
701
687
 
@@ -704,6 +690,8 @@ export default function StudioPage() {
704
690
  If you want to go to a lower level and have more control over the Studio, you can pass `StudioProvider` and `StudioLayout` from `sanity` as `children`:
705
691
 
706
692
  ```tsx
693
+ 'use client'
694
+
707
695
  import {NextStudio} from 'next-sanity/studio'
708
696
  import {StudioProvider, StudioLayout} from 'sanity'
709
697
 
@@ -723,6 +711,7 @@ function StudioPage() {
723
711
 
724
712
  ## Migration guides
725
713
 
714
+ - [From `v5` to `v6`][migrate-v5-to-v6]
726
715
  - From `v4` to `v5`
727
716
  - [`app-router`][migrate-v4-to-v5-app]
728
717
  - [`pages-router`][migrate-v4-to-v5-pages]
@@ -748,6 +737,7 @@ MIT-licensed. See [LICENSE][LICENSE].
748
737
  [migrate-v1-to-v4]: ./MIGRATE-v1-to-v4.md
749
738
  [migrate-v4-to-v5-app]: ./MIGRATE-v4-to-v5-pages-app-router.md
750
739
  [migrate-v4-to-v5-pages]: ./MIGRATE-v4-to-v5-pages-pages-router.md
740
+ [migrate-v5-to-v6]: ./MIGRATE-v5-to-v6.md
751
741
  [next-cache]: https://nextjs.org/docs/app/building-your-application/caching
752
742
  [next-data-fetching]: https://nextjs.org/docs/basic-features/data-fetching/overview
753
743
  [next-preview-mode]: https://nextjs.org/docs/advanced-features/preview-mode
@@ -5,8 +5,6 @@ Object.defineProperty(exports, '__esModule', {
5
5
  value: true
6
6
  });
7
7
  const metadata = {
8
- // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
9
- viewport: "width=device-width,initial-scale=1,viewport-fit=cover",
10
8
  referrer: "same-origin",
11
9
  robots: "noindex"
12
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.cjs","sources":["../../src/studio/metadata.ts"],"sourcesContent":["import type {Metadata} from 'next'\n\n/**\n * In Next 13 appDir mode (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the metadata directly:\n * export {metadata} from 'next-sanity/studio'\n *\n * // To customize the metadata, spread it on the export:\n * import {metadata as studioMetadata} from 'next-sanity/studio'\n * import type { Metadata } from 'next'\n *\n * export const metadata: Metadata = {\n * ...studioMetadata,\n * // Overrides the viewport to resize behavior\n * viewport: `${studioMetadata.viewport}, interactive-widget=resizes-content`,\n * })\n * ```\n * If you're using Next 12 or the `pages` folder (`/pages/studio/[[...index]].tsx`):\n * ```tsx\n * import Head from 'next/head'\n * import {NextStudio, metadata} from 'next-sanity/studio'\n *\n * export default function StudioPage() {\n * return (\n * <>\n * <Head>\n * {Object.entries(metadata).map(([key, value]) => (\n * <meta key={key} name={key} content={value} />\n * ))}\n * </Head>\n * <NextStudio config={config} />\n * </>\n * )\n * }\n * ```\n * @public\n */\nexport const metadata = {\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n viewport: 'width=device-width,initial-scale=1,viewport-fit=cover' as const,\n referrer: 'same-origin' as const,\n robots: 'noindex' as const,\n} satisfies Metadata\n"],"names":["viewport","referrer","robots"],"mappings":";;;;;;AAsCO;AAAiB;AAEtBA;AACAC;AACAC;AACF;"}
1
+ {"version":3,"file":"metadata.cjs","sources":["../../src/studio/metadata.ts"],"sourcesContent":["import type {Metadata} from 'next'\n\n/**\n * In App Router segments (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the metadata directly:\n * export {metadata} from 'next-sanity/studio/metadata'\n *\n * // To customize the metadata, spread it on the export:\n * import {metadata as studioMetadata} from 'next-sanity/studio/metadata'\n * import type { Metadata } from 'next'\n *\n * export const metadata: Metadata = {\n * ...studioMetadata,\n * // Set another title\n * title: 'My Studio',\n * })\n * ```\n * @public\n */\nexport const metadata = {\n referrer: 'same-origin' as const,\n robots: 'noindex' as const,\n} satisfies Metadata\n"],"names":["referrer","robots"],"mappings":";;;;;;AAoBO;AACLA;AACAC;AACF;"}
@@ -1,41 +1,22 @@
1
1
  /**
2
- * In Next 13 appDir mode (`/app/studio/[[...index]]/page.tsx`):
2
+ * In App Router segments (`/app/studio/[[...index]]/page.tsx`):
3
3
  * ```tsx
4
4
  * // If you don't want to change any defaults you can just re-export the metadata directly:
5
- * export {metadata} from 'next-sanity/studio'
5
+ * export {metadata} from 'next-sanity/studio/metadata'
6
6
  *
7
7
  * // To customize the metadata, spread it on the export:
8
- * import {metadata as studioMetadata} from 'next-sanity/studio'
8
+ * import {metadata as studioMetadata} from 'next-sanity/studio/metadata'
9
9
  * import type { Metadata } from 'next'
10
10
  *
11
11
  * export const metadata: Metadata = {
12
12
  * ...studioMetadata,
13
- * // Overrides the viewport to resize behavior
14
- * viewport: `${studioMetadata.viewport}, interactive-widget=resizes-content`,
13
+ * // Set another title
14
+ * title: 'My Studio',
15
15
  * })
16
16
  * ```
17
- * If you're using Next 12 or the `pages` folder (`/pages/studio/[[...index]].tsx`):
18
- * ```tsx
19
- * import Head from 'next/head'
20
- * import {NextStudio, metadata} from 'next-sanity/studio'
21
- *
22
- * export default function StudioPage() {
23
- * return (
24
- * <>
25
- * <Head>
26
- * {Object.entries(metadata).map(([key, value]) => (
27
- * <meta key={key} name={key} content={value} />
28
- * ))}
29
- * </Head>
30
- * <NextStudio config={config} />
31
- * </>
32
- * )
33
- * }
34
- * ```
35
17
  * @public
36
18
  */
37
19
  export declare const metadata: {
38
- viewport: 'width=device-width,initial-scale=1,viewport-fit=cover'
39
20
  referrer: 'same-origin'
40
21
  robots: 'noindex'
41
22
  }
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
  const metadata = {
3
- // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
4
- viewport: "width=device-width,initial-scale=1,viewport-fit=cover",
5
3
  referrer: "same-origin",
6
4
  robots: "noindex"
7
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","sources":["../../src/studio/metadata.ts"],"sourcesContent":["import type {Metadata} from 'next'\n\n/**\n * In Next 13 appDir mode (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the metadata directly:\n * export {metadata} from 'next-sanity/studio'\n *\n * // To customize the metadata, spread it on the export:\n * import {metadata as studioMetadata} from 'next-sanity/studio'\n * import type { Metadata } from 'next'\n *\n * export const metadata: Metadata = {\n * ...studioMetadata,\n * // Overrides the viewport to resize behavior\n * viewport: `${studioMetadata.viewport}, interactive-widget=resizes-content`,\n * })\n * ```\n * If you're using Next 12 or the `pages` folder (`/pages/studio/[[...index]].tsx`):\n * ```tsx\n * import Head from 'next/head'\n * import {NextStudio, metadata} from 'next-sanity/studio'\n *\n * export default function StudioPage() {\n * return (\n * <>\n * <Head>\n * {Object.entries(metadata).map(([key, value]) => (\n * <meta key={key} name={key} content={value} />\n * ))}\n * </Head>\n * <NextStudio config={config} />\n * </>\n * )\n * }\n * ```\n * @public\n */\nexport const metadata = {\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n viewport: 'width=device-width,initial-scale=1,viewport-fit=cover' as const,\n referrer: 'same-origin' as const,\n robots: 'noindex' as const,\n} satisfies Metadata\n"],"names":["viewport","referrer","robots"],"mappings":";AAsCO;AAAiB;AAEtBA;AACAC;AACAC;AACF;"}
1
+ {"version":3,"file":"metadata.js","sources":["../../src/studio/metadata.ts"],"sourcesContent":["import type {Metadata} from 'next'\n\n/**\n * In App Router segments (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the metadata directly:\n * export {metadata} from 'next-sanity/studio/metadata'\n *\n * // To customize the metadata, spread it on the export:\n * import {metadata as studioMetadata} from 'next-sanity/studio/metadata'\n * import type { Metadata } from 'next'\n *\n * export const metadata: Metadata = {\n * ...studioMetadata,\n * // Set another title\n * title: 'My Studio',\n * })\n * ```\n * @public\n */\nexport const metadata = {\n referrer: 'same-origin' as const,\n robots: 'noindex' as const,\n} satisfies Metadata\n"],"names":["referrer","robots"],"mappings":";AAoBO;AACLA;AACAC;AACF;"}
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', {
5
+ value: true
6
+ });
7
+ const viewport = {
8
+ width: "device-width",
9
+ initialScale: 1,
10
+ // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
11
+ viewportFit: "cover"
12
+ };
13
+ exports.viewport = viewport;
14
+ //# sourceMappingURL=viewport.cjs.map
@@ -0,0 +1,4 @@
1
+ import cjs from './viewport.cjs';
2
+
3
+ export const viewport = cjs.viewport;
4
+
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewport.cjs","sources":["../../src/studio/viewport.ts"],"sourcesContent":["import type {Viewport} from 'next'\n\n/**\n * In App Router segments (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the viewport config directly:\n * export {viewport} from 'next-sanity/studio/viewport'\n *\n * // To customize the viewport config, spread it on the export:\n * import {viewport as studioViewport} from 'next-sanity/studio/viewport'\n * import type { Viewport } from 'next'\n *\n * export const viewport: Viewport = {\n * ...studioViewport,\n * // Overrides the viewport to resize behavior\n * interactiveWidget: 'resizes-content'\n * })\n * ```\n * @public\n */\nexport const viewport = {\n width: 'device-width',\n initialScale: 1,\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n viewportFit: 'cover',\n} satisfies Viewport\n"],"names":["width","initialScale","viewportFit"],"mappings":";;;;;;AAoBO;AACLA;AACAC;AAAc;AAEdC;AACF;"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * In App Router segments (`/app/studio/[[...index]]/page.tsx`):
3
+ * ```tsx
4
+ * // If you don't want to change any defaults you can just re-export the viewport config directly:
5
+ * export {viewport} from 'next-sanity/studio/viewport'
6
+ *
7
+ * // To customize the viewport config, spread it on the export:
8
+ * import {viewport as studioViewport} from 'next-sanity/studio/viewport'
9
+ * import type { Viewport } from 'next'
10
+ *
11
+ * export const viewport: Viewport = {
12
+ * ...studioViewport,
13
+ * // Overrides the viewport to resize behavior
14
+ * interactiveWidget: 'resizes-content'
15
+ * })
16
+ * ```
17
+ * @public
18
+ */
19
+ export declare const viewport: {
20
+ width: string
21
+ initialScale: number
22
+ viewportFit: 'cover'
23
+ }
24
+
25
+ export {}
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+ const viewport = {
3
+ width: "device-width",
4
+ initialScale: 1,
5
+ // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
6
+ viewportFit: "cover"
7
+ };
8
+ export { viewport };
9
+ //# sourceMappingURL=viewport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewport.js","sources":["../../src/studio/viewport.ts"],"sourcesContent":["import type {Viewport} from 'next'\n\n/**\n * In App Router segments (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the viewport config directly:\n * export {viewport} from 'next-sanity/studio/viewport'\n *\n * // To customize the viewport config, spread it on the export:\n * import {viewport as studioViewport} from 'next-sanity/studio/viewport'\n * import type { Viewport } from 'next'\n *\n * export const viewport: Viewport = {\n * ...studioViewport,\n * // Overrides the viewport to resize behavior\n * interactiveWidget: 'resizes-content'\n * })\n * ```\n * @public\n */\nexport const viewport = {\n width: 'device-width',\n initialScale: 1,\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n viewportFit: 'cover',\n} satisfies Viewport\n"],"names":["width","initialScale","viewportFit"],"mappings":";AAoBO;AACLA;AACAC;AAAc;AAEdC;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-sanity",
3
- "version": "5.5.10",
3
+ "version": "6.0.1",
4
4
  "description": "Sanity.io toolkit for Next.js",
5
5
  "keywords": [
6
6
  "sanity",
@@ -101,6 +101,17 @@
101
101
  "import": "./dist/studio/metadata.js",
102
102
  "default": "./dist/studio/metadata.js"
103
103
  },
104
+ "./studio/viewport": {
105
+ "types": "./dist/studio/viewport.d.ts",
106
+ "source": "./src/studio/viewport.ts",
107
+ "require": "./dist/studio/viewport.cjs",
108
+ "node": {
109
+ "module": "./dist/studio/viewport.js",
110
+ "import": "./dist/studio/viewport.cjs.js"
111
+ },
112
+ "import": "./dist/studio/viewport.js",
113
+ "default": "./dist/studio/viewport.js"
114
+ },
104
115
  "./webhook": {
105
116
  "types": "./dist/webhook.d.ts",
106
117
  "source": "./src/webhook/index.ts",
@@ -138,6 +149,9 @@
138
149
  "studio/metadata": [
139
150
  "./dist/studio/metadata.d.ts"
140
151
  ],
152
+ "studio/viewport": [
153
+ "./dist/studio/viewport.d.ts"
154
+ ],
141
155
  "webhook": [
142
156
  "./dist/webhook.d.ts"
143
157
  ]
@@ -174,27 +188,26 @@
174
188
  "singleQuote": true
175
189
  },
176
190
  "dependencies": {
177
- "@sanity/client": "^6.7.0",
191
+ "@sanity/client": "^6.7.1",
178
192
  "@sanity/preview-kit": "3.2.6",
179
193
  "@sanity/webhook": "3.0.1",
180
- "groq": "^3.0.0"
194
+ "groq": "^3.19"
181
195
  },
182
196
  "devDependencies": {
183
- "@next/bundle-analyzer": "^14.0.0",
184
- "@next/eslint-plugin-next": "14.0.0",
197
+ "@next/bundle-analyzer": "^14.0.1",
198
+ "@next/eslint-plugin-next": "14.0.1",
185
199
  "@rollup/plugin-url": "^8.0.2",
186
200
  "@sanity/eslint-config-studio": "^3.0.1",
187
201
  "@sanity/image-url": "^1.0.2",
188
202
  "@sanity/pkg-utils": "^2.4.10",
189
203
  "@sanity/ui": "^1.8.3",
190
- "@sanity/vision": "3.18.1",
191
- "@types/react": "^18.2.33",
204
+ "@sanity/vision": "3.19.1",
205
+ "@types/react": "^18.2.35",
192
206
  "@types/react-dom": "^18.2.14",
193
- "@types/styled-components": "^5.1.29",
194
- "@typescript-eslint/eslint-plugin": "^6.9.0",
207
+ "@typescript-eslint/eslint-plugin": "^6.9.1",
195
208
  "@vitest/coverage-v8": "^0.34.6",
196
209
  "autoprefixer": "^10.4.16",
197
- "eslint": "^8.52.0",
210
+ "eslint": "^8.53.0",
198
211
  "eslint-config-prettier": "^9.0.0",
199
212
  "eslint-config-sanity": "^7.0.1",
200
213
  "eslint-gitignore": "^0.1.0",
@@ -202,7 +215,7 @@
202
215
  "eslint-plugin-simple-import-sort": "^10.0.0",
203
216
  "groqd": "^0.15.9",
204
217
  "ls-engines": "^0.9.0",
205
- "next": "14.0.0",
218
+ "next": "14.0.1",
206
219
  "postcss": "^8.4.31",
207
220
  "prettier": "^3.0.3",
208
221
  "prettier-plugin-packagejson": "^2.4.6",
@@ -211,9 +224,9 @@
211
224
  "react-dom": "^18.2.0",
212
225
  "react-is": "^18.2.0",
213
226
  "rollup": "^3.29.4",
214
- "sanity": "3.18.1",
227
+ "sanity": "3.19.1",
215
228
  "server-only": "^0.0.1",
216
- "styled-components": "^5.3.11",
229
+ "styled-components": "^6.1.0",
217
230
  "suspend-react": "^0.1.3",
218
231
  "tailwindcss": "^3.3.5",
219
232
  "typescript": "^5.2.2",
@@ -222,14 +235,14 @@
222
235
  "vitest-github-actions-reporter": "^0.10.0"
223
236
  },
224
237
  "peerDependencies": {
225
- "@sanity/client": "^6.4.9",
226
- "@sanity/icons": "^2.0.0",
227
- "@sanity/types": "^3.0.0",
228
- "@sanity/ui": "^1.0.0",
229
- "next": "^13.0.0 || ^14.0.0",
230
- "react": "^18.0.0",
231
- "sanity": "^3.0.0",
232
- "styled-components": "^5.2.0 || ^6.0.0"
238
+ "@sanity/client": "^6.7.1",
239
+ "@sanity/icons": "^2.0",
240
+ "@sanity/types": "^3.19",
241
+ "@sanity/ui": "^1.8",
242
+ "next": "^14.0",
243
+ "react": "^18.2",
244
+ "sanity": "^3.19",
245
+ "styled-components": "^5.2 || ^6.0"
233
246
  },
234
247
  "engines": {
235
248
  "node": ">=18"
@@ -1,44 +1,24 @@
1
1
  import type {Metadata} from 'next'
2
2
 
3
3
  /**
4
- * In Next 13 appDir mode (`/app/studio/[[...index]]/page.tsx`):
4
+ * In App Router segments (`/app/studio/[[...index]]/page.tsx`):
5
5
  * ```tsx
6
6
  * // If you don't want to change any defaults you can just re-export the metadata directly:
7
- * export {metadata} from 'next-sanity/studio'
7
+ * export {metadata} from 'next-sanity/studio/metadata'
8
8
  *
9
9
  * // To customize the metadata, spread it on the export:
10
- * import {metadata as studioMetadata} from 'next-sanity/studio'
10
+ * import {metadata as studioMetadata} from 'next-sanity/studio/metadata'
11
11
  * import type { Metadata } from 'next'
12
12
  *
13
13
  * export const metadata: Metadata = {
14
14
  * ...studioMetadata,
15
- * // Overrides the viewport to resize behavior
16
- * viewport: `${studioMetadata.viewport}, interactive-widget=resizes-content`,
15
+ * // Set another title
16
+ * title: 'My Studio',
17
17
  * })
18
18
  * ```
19
- * If you're using Next 12 or the `pages` folder (`/pages/studio/[[...index]].tsx`):
20
- * ```tsx
21
- * import Head from 'next/head'
22
- * import {NextStudio, metadata} from 'next-sanity/studio'
23
- *
24
- * export default function StudioPage() {
25
- * return (
26
- * <>
27
- * <Head>
28
- * {Object.entries(metadata).map(([key, value]) => (
29
- * <meta key={key} name={key} content={value} />
30
- * ))}
31
- * </Head>
32
- * <NextStudio config={config} />
33
- * </>
34
- * )
35
- * }
36
- * ```
37
19
  * @public
38
20
  */
39
21
  export const metadata = {
40
- // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
41
- viewport: 'width=device-width,initial-scale=1,viewport-fit=cover' as const,
42
22
  referrer: 'same-origin' as const,
43
23
  robots: 'noindex' as const,
44
24
  } satisfies Metadata
@@ -0,0 +1,26 @@
1
+ import type {Viewport} from 'next'
2
+
3
+ /**
4
+ * In App Router segments (`/app/studio/[[...index]]/page.tsx`):
5
+ * ```tsx
6
+ * // If you don't want to change any defaults you can just re-export the viewport config directly:
7
+ * export {viewport} from 'next-sanity/studio/viewport'
8
+ *
9
+ * // To customize the viewport config, spread it on the export:
10
+ * import {viewport as studioViewport} from 'next-sanity/studio/viewport'
11
+ * import type { Viewport } from 'next'
12
+ *
13
+ * export const viewport: Viewport = {
14
+ * ...studioViewport,
15
+ * // Overrides the viewport to resize behavior
16
+ * interactiveWidget: 'resizes-content'
17
+ * })
18
+ * ```
19
+ * @public
20
+ */
21
+ export const viewport = {
22
+ width: 'device-width',
23
+ initialScale: 1,
24
+ // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
25
+ viewportFit: 'cover',
26
+ } satisfies Viewport