next-sanity 0.6.10 → 0.7.0
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 +170 -1
- package/{src/studio/static/apple-touch-icon.png → lib/cjs/apple-touch-icon.abc4aca2.png} +0 -0
- package/{src/studio/static/favicon-192.png → lib/cjs/favicon-192.40c8bab4.png} +0 -0
- package/{src/studio/static/favicon-512.png → lib/cjs/favicon-512.5e08f951.png} +0 -0
- package/{src/studio/static/favicon.ico → lib/cjs/favicon.648fc2f2.ico} +0 -0
- package/lib/cjs/favicon.8f76876f.svg +7 -0
- package/lib/cjs/studio.js +108 -92
- package/lib/cjs/studio.js.map +1 -1
- package/lib/dts/aborter.d.ts +5 -0
- package/lib/dts/client.d.ts +2 -0
- package/lib/dts/currentUser.d.ts +11 -0
- package/lib/dts/index.d.ts +10 -0
- package/lib/dts/studio/NextStudio.d.ts +43 -0
- package/lib/dts/studio/NextStudioGlobalStyle.d.ts +5 -0
- package/lib/dts/studio/NextStudioHead.d.ts +9 -0
- package/lib/dts/studio/ServerStyleSheetDocument.d.ts +36 -0
- package/lib/dts/studio/index.d.ts +5 -0
- package/lib/dts/studio/utils.d.ts +24 -0
- package/lib/dts/studio.d.ts +1 -0
- package/lib/dts/types.d.ts +14 -0
- package/lib/dts/useSubscription.d.ts +14 -0
- package/lib/esm/apple-touch-icon.abc4aca2.png +0 -0
- package/lib/esm/favicon-192.40c8bab4.png +0 -0
- package/lib/esm/favicon-512.5e08f951.png +0 -0
- package/lib/esm/favicon.648fc2f2.ico +0 -0
- package/lib/esm/favicon.8f76876f.svg +7 -0
- package/lib/esm/studio.js +108 -92
- package/lib/esm/studio.js.map +1 -1
- package/package.json +18 -10
- package/src/studio/NextStudioHead.tsx +12 -8
- package/src/studio/apple-touch-icon.png +0 -0
- package/src/studio/favicon-192.png +0 -0
- package/src/studio/favicon-512.png +0 -0
- package/src/studio/favicon.ico +0 -0
- /package/src/studio/{static/favicon.svg → favicon.svg} +0 -0
- /package/src/studio/{static/webmanifest.json → webmanifest.json} +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# next-sanity
|
|
1
|
+
# next-sanity<!-- omit in toc -->
|
|
2
2
|
|
|
3
3
|
[Sanity.io](https://www.sanity.io/?utm_source=github&utm_medium=readme&utm_campaign=next-sanity) toolkit for Next.js.
|
|
4
4
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
- Client-side live real-time preview for authenticated users
|
|
8
8
|
- GROQ syntax highlighting
|
|
9
|
+
- [Embed](#next-sanitystudio-dev-preview) [Studio v3](https://www.sanity.io/studio-v3) in [Next.js](https://nextjs.org/) apps
|
|
9
10
|
|
|
10
11
|
## Table of contents
|
|
11
12
|
|
|
@@ -16,7 +17,15 @@
|
|
|
16
17
|
- [Optimizing bundle size](#optimizing-bundle-size)
|
|
17
18
|
- [Usage](#usage)
|
|
18
19
|
- [Example: Minimal blog post template](#example-minimal-blog-post-template)
|
|
20
|
+
- [`next-sanity/studio` (dev-preview)](#next-sanitystudio-dev-preview)
|
|
21
|
+
- [Usage](#usage-1)
|
|
22
|
+
- [Opt-in to using `StudioProvider` and `StudioLayout`](#opt-in-to-using-studioprovider-and-studiolayout)
|
|
23
|
+
- [Customize `<ServerStyleSheetDocument />`](#customize-serverstylesheetdocument-)
|
|
24
|
+
- [Full-control mode](#full-control-mode)
|
|
19
25
|
- [Migrate](#migrate)
|
|
26
|
+
- [From `v0.4`](#from-v04)
|
|
27
|
+
- [`createPortableTextComponent` is removed](#createportabletextcomponent-is-removed)
|
|
28
|
+
- [`createImageUrlBuilder` is removed](#createimageurlbuilder-is-removed)
|
|
20
29
|
- [License](#license)
|
|
21
30
|
|
|
22
31
|
## Installation
|
|
@@ -203,6 +212,166 @@ export async function getStaticPaths() {
|
|
|
203
212
|
}
|
|
204
213
|
```
|
|
205
214
|
|
|
215
|
+
## `next-sanity/studio` (dev-preview)
|
|
216
|
+
|
|
217
|
+
> [See it live](https://next.sanity.build/)
|
|
218
|
+
|
|
219
|
+
The latest version of Sanity Studio allows you to embed a near-infinitely configurable content editing interface into any React application. This opens up many possibilities:
|
|
220
|
+
|
|
221
|
+
- Any service that hosts Next.js apps can now host your Studio.
|
|
222
|
+
- Building previews for your content is easier as your Studio lives in the same environment.
|
|
223
|
+
- Use [Data Fetching](https://nextjs.org/docs/basic-features/data-fetching/overview) to configure your Studio.
|
|
224
|
+
- Easy setup of [Preview Mode](https://nextjs.org/docs/advanced-features/preview-mode).
|
|
225
|
+
|
|
226
|
+
### Usage
|
|
227
|
+
|
|
228
|
+
The basic setup is two files:
|
|
229
|
+
|
|
230
|
+
1. `pages/[[...index]].tsx`
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
// Import your sanity.config.ts file
|
|
234
|
+
import config from '../sanity.config'
|
|
235
|
+
import {NextStudio} from 'next-sanity/studio'
|
|
236
|
+
|
|
237
|
+
export default function StudioPage() {
|
|
238
|
+
// Loads the Studio, with all the needed neta tags and global CSS reqiired for it to render correctly
|
|
239
|
+
return <NextStudio config={config} />
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The `<NextStudio />` wraps `<Studio />` component and supports forwarding all its props:
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
import {Studio} from 'sanity'
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
2. `pages/_document.tsx`
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
import {ServerStyleSheetDocument} from 'next-sanity/studio'
|
|
253
|
+
|
|
254
|
+
// Set up SSR for styled-components, ensuring there's no missing CSS when deploying a Studio in Next.js into production
|
|
255
|
+
export default class Document extends ServerStyleSheetDocument {}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Opt-in to using `StudioProvider` and `StudioLayout`
|
|
259
|
+
|
|
260
|
+
If you want to go lower level and have more control over the studio you can pass `StudioProvider` and `StudioLayout` from `sanity` as `children`:
|
|
261
|
+
|
|
262
|
+
```tsx
|
|
263
|
+
import {NextStudio} from 'next-sanity/studio'
|
|
264
|
+
import {StudioProvider, StudioLayout} from 'sanity'
|
|
265
|
+
|
|
266
|
+
import config from '../sanity.config'
|
|
267
|
+
|
|
268
|
+
function StudioPage() {
|
|
269
|
+
return (
|
|
270
|
+
<NextStudio config={config}>
|
|
271
|
+
<StudioProvider config={config}>
|
|
272
|
+
{/* Put components here and you'll have access to the same React hooks as Studio gives you when writing plugins */}
|
|
273
|
+
<StudioLayout />
|
|
274
|
+
</StudioProvider>
|
|
275
|
+
</NextStudio>
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Customize `<ServerStyleSheetDocument />`
|
|
281
|
+
|
|
282
|
+
You can still customize `_document.tsx`, the same way you would the default `<Document />` component from `next/document`:
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
import {ServerStyleSheetDocument} from 'next-sanity/studio'
|
|
286
|
+
|
|
287
|
+
export default class Document extends ServerStyleSheetDocument {
|
|
288
|
+
static async getInitialProps(ctx: DocumentContext) {
|
|
289
|
+
// You can still override renderPage:
|
|
290
|
+
const originalRenderPage = ctx.renderPage
|
|
291
|
+
ctx.renderPage = () =>
|
|
292
|
+
originalRenderPage({
|
|
293
|
+
enhanceApp: (App) => (props) => <App {...props} />,
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
const initialProps = await ServerStyleSheetDocument.getInitialProps(ctx)
|
|
297
|
+
|
|
298
|
+
const extraStyles = await getStyles()
|
|
299
|
+
return {
|
|
300
|
+
...initialProps,
|
|
301
|
+
// Add to the default styles if you want
|
|
302
|
+
styles: [initialProps.styles, extraStyles],
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
render() {
|
|
306
|
+
// do the same stuff as in `next/document`
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Full-control mode
|
|
312
|
+
|
|
313
|
+
If you only need parts of what `<NextStudio />` does for you, but not all of it.
|
|
314
|
+
No problem. You can import any which one of the components that `<NextStudio />` is importing and assemble them in any way you want.
|
|
315
|
+
|
|
316
|
+
```tsx
|
|
317
|
+
import {Studio, type Config} from 'sanity'
|
|
318
|
+
import {NextStudioGlobalStyle, NextStudioHead} from 'next-sanity/studio'
|
|
319
|
+
// This implementation will only load the bare minimum of what's required for the Studio to render correctly. No favicons, fancy <meta name="theme-color"> tags or the like
|
|
320
|
+
export default function CustomNextStudio({config}: {config: Config}) {
|
|
321
|
+
return (
|
|
322
|
+
<>
|
|
323
|
+
<Studio config={config} />
|
|
324
|
+
<NextStudioHead>{/* Custom extra stuff in <head> */}</NextStudioHead>
|
|
325
|
+
<NextStudioGlobalStyle />
|
|
326
|
+
</>
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
And while `<NextStudio />` have all features enabled by default allowing you to opt-out by giving it props, the inner components `<NextStudioHead />` and `<NextStudioGlobalStyle />` are opt-in.
|
|
332
|
+
This means that these two `StudioPage` components are functionally identical:
|
|
333
|
+
|
|
334
|
+
```tsx
|
|
335
|
+
import {
|
|
336
|
+
NextStudio,
|
|
337
|
+
NextStudioGlobalStyle,
|
|
338
|
+
NextStudioHead,
|
|
339
|
+
useThem,
|
|
340
|
+
useBackgroundColorsFromTheme,
|
|
341
|
+
} from 'next-sanity/studio'
|
|
342
|
+
import {Studio} from 'sanity'
|
|
343
|
+
import config from '../sanity.config'
|
|
344
|
+
|
|
345
|
+
// Turning all the features off, leaving only bare minimum required meta tags and styling
|
|
346
|
+
function StudioPage() {
|
|
347
|
+
return (
|
|
348
|
+
<NextStudio
|
|
349
|
+
config={config}
|
|
350
|
+
// an empty string turns off the CSS that sets a background on <html>
|
|
351
|
+
unstable__bg=""
|
|
352
|
+
unstable__noTailwindSvgFix
|
|
353
|
+
unstable__noFavicons
|
|
354
|
+
// an empty string turns off the <title> tag
|
|
355
|
+
unstable__document_title=""
|
|
356
|
+
/>
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// Since no features are enabled it works the same way
|
|
361
|
+
function Studiopage() {
|
|
362
|
+
const theme = useTheme(config)
|
|
363
|
+
const {themeColorLight, themeColorDark} = useBackgroundColorsFromTheme(theme)
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
<>
|
|
367
|
+
<Studio config={config} />
|
|
368
|
+
<NextStudioHead themeColorLight={themeColorLight} themeColorDark={themeColorDark} />
|
|
369
|
+
<NextStudioGlobalStyle />
|
|
370
|
+
</>
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
206
375
|
## Migrate
|
|
207
376
|
|
|
208
377
|
### From `v0.4`
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<rect width="512" height="512" fill="#F03E2F" rx="30"></rect>
|
|
4
|
+
<path d="M161.527 136.723C161.527 179.76 187.738 205.443 240.388 219.095L296 232.283C345.687 243.852 376 272.775 376 319.514C376 341.727 369.162 360.931 357.538 375.971C357.538 329.232 333.607 303.78 276.171 288.74L221.47 276.246C177.709 266.065 143.977 242.464 143.977 191.56C143.977 170.505 150.359 151.994 161.527 136.723Z" fill="white"></path>
|
|
5
|
+
<path opacity="0.5" d="M323.35 308.176C347.054 323.679 357.538 345.197 357.538 376.202C337.709 401.654 303.293 416 262.724 416C194.575 416 146.484 381.756 136 322.753H201.641C210.074 350.056 232.41 362.551 262.268 362.551C298.735 362.32 322.895 342.652 323.35 308.176Z" fill="white"></path>
|
|
6
|
+
<path opacity="0.5" d="M195.715 200.816C172.923 186.007 161.527 165.183 161.527 136.954C180.672 111.503 213.493 96 253.835 96C323.35 96 363.692 133.252 373.721 185.776H310.359C303.293 165.183 285.971 148.986 254.291 148.986C220.33 148.986 197.311 169.116 195.715 200.816Z" fill="white"></path>
|
|
7
|
+
</svg>
|
package/lib/cjs/studio.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
1
|
+
var $cerUD$reactjsxruntime = require("react/jsx-runtime");
|
|
2
|
+
var $cerUD$react = require("react");
|
|
3
|
+
var $cerUD$sanity = require("sanity");
|
|
4
|
+
var $cerUD$styledcomponents = require("styled-components");
|
|
5
|
+
var $cerUD$nexthead = require("next/head");
|
|
6
|
+
var $cerUD$nextdocument = require("next/document");
|
|
7
|
+
var $cerUD$nextrouter = require("next/router");
|
|
8
8
|
|
|
9
9
|
function $parcel$exportWildcard(dest, source) {
|
|
10
10
|
Object.keys(source).forEach(function(key) {
|
|
@@ -28,10 +28,10 @@ function $parcel$export(e, n, v, s) {
|
|
|
28
28
|
function $parcel$interopDefault(a) {
|
|
29
29
|
return a && a.__esModule ? a.default : a;
|
|
30
30
|
}
|
|
31
|
-
var $
|
|
32
|
-
var $
|
|
31
|
+
var $5aa79282f535e8b1$exports = {};
|
|
32
|
+
var $c8bf9e0a6313dcb9$exports = {};
|
|
33
33
|
|
|
34
|
-
$parcel$export($
|
|
34
|
+
$parcel$export($c8bf9e0a6313dcb9$exports, "NextStudio", () => $c8bf9e0a6313dcb9$export$eefb95cccd1bb6c5);
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -39,42 +39,39 @@ $parcel$export($53f899201c613ec3$exports, "NextStudio", () => $53f899201c613ec3$
|
|
|
39
39
|
/**
|
|
40
40
|
* Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render
|
|
41
41
|
* It's a drop-in replacement for `import {Studio} from 'sanity'`
|
|
42
|
-
*/ const $
|
|
43
|
-
const theme = (0, $
|
|
44
|
-
const { themeColorLight: themeColorLight , themeColorDark: themeColorDark } = (0, $
|
|
45
|
-
return /*#__PURE__*/ (0, $
|
|
42
|
+
*/ const $c8bf9e0a6313dcb9$var$NextStudioComponent = ({ children: children , config: config , unstable__noGlobalStyle: unstable__noGlobalStyle , unstable__noTailwindSvgFix: unstable__noTailwindSvgFix , unstable__head: unstable__head , unstable__document_title: unstable__document_title , unstable__bg: unstable__bg , unstable__noFavicons: unstable__noFavicons , ...props })=>{
|
|
43
|
+
const theme = (0, $b07d91633f3d677b$export$93d4e7f90805808f)(config);
|
|
44
|
+
const { themeColorLight: themeColorLight , themeColorDark: themeColorDark } = (0, $b07d91633f3d677b$export$d3a2146a441ec034)(theme);
|
|
45
|
+
return /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsxs)((0, $cerUD$reactjsxruntime.Fragment), {
|
|
46
46
|
children: [
|
|
47
|
-
children || /*#__PURE__*/ (0, $
|
|
47
|
+
children || /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)((0, $cerUD$sanity.Studio), {
|
|
48
48
|
config: config,
|
|
49
49
|
...props
|
|
50
50
|
}),
|
|
51
|
-
/*#__PURE__*/ (0, $
|
|
51
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)((0, $9a339c4a487c3478$export$79723eee2c1bf75e), {
|
|
52
52
|
themeColorLight: themeColorLight,
|
|
53
53
|
themeColorDark: themeColorDark,
|
|
54
54
|
title: unstable__document_title,
|
|
55
55
|
favicons: !unstable__noFavicons,
|
|
56
56
|
children: unstable__head
|
|
57
57
|
}),
|
|
58
|
-
!unstable__noGlobalStyle && /*#__PURE__*/ (0, $
|
|
58
|
+
!unstable__noGlobalStyle && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)((0, $1ac20522861d7f1e$export$c8fda7ee7699d07e), {
|
|
59
59
|
bg: unstable__bg !== null && unstable__bg !== void 0 ? unstable__bg : themeColorLight,
|
|
60
60
|
unstable__tailwindSvgFix: !unstable__noTailwindSvgFix
|
|
61
61
|
})
|
|
62
62
|
]
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
|
-
const $
|
|
65
|
+
const $c8bf9e0a6313dcb9$export$eefb95cccd1bb6c5 = /*#__PURE__*/ (0, $cerUD$react.memo)($c8bf9e0a6313dcb9$var$NextStudioComponent);
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
var $
|
|
68
|
+
var $1ac20522861d7f1e$exports = {};
|
|
69
69
|
|
|
70
|
-
$parcel$export($
|
|
70
|
+
$parcel$export($1ac20522861d7f1e$exports, "NextStudioGlobalStyle", () => $1ac20522861d7f1e$export$c8fda7ee7699d07e);
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
$
|
|
74
|
-
|
|
75
|
-
background-color: ${bg};
|
|
76
|
-
}
|
|
77
|
-
` : ""}
|
|
72
|
+
let $1ac20522861d7f1e$var$_ = (t)=>t, $1ac20522861d7f1e$var$t, $1ac20522861d7f1e$var$t1, $1ac20522861d7f1e$var$t2;
|
|
73
|
+
const $1ac20522861d7f1e$export$c8fda7ee7699d07e = (0, $cerUD$styledcomponents.createGlobalStyle)($1ac20522861d7f1e$var$t2 || ($1ac20522861d7f1e$var$t2 = $1ac20522861d7f1e$var$_`
|
|
74
|
+
${0}
|
|
78
75
|
html,
|
|
79
76
|
body,
|
|
80
77
|
#__next {
|
|
@@ -85,41 +82,60 @@ body {
|
|
|
85
82
|
overscroll-behavior: none;
|
|
86
83
|
-webkit-font-smoothing: antialiased;
|
|
87
84
|
}
|
|
88
|
-
${({
|
|
85
|
+
${0}`), ({ bg: bg })=>bg ? (0, $cerUD$styledcomponents.css)($1ac20522861d7f1e$var$t || ($1ac20522861d7f1e$var$t = $1ac20522861d7f1e$var$_`
|
|
86
|
+
html {
|
|
87
|
+
background-color: ${0};
|
|
88
|
+
}
|
|
89
|
+
`), bg) : "", ({ unstable__tailwindSvgFix: unstable__tailwindSvgFix })=>unstable__tailwindSvgFix ? (0, $cerUD$styledcomponents.css)($1ac20522861d7f1e$var$t1 || ($1ac20522861d7f1e$var$t1 = $1ac20522861d7f1e$var$_`
|
|
89
90
|
/* override tailwind reset */
|
|
90
91
|
:root svg {
|
|
91
92
|
display: inline;
|
|
92
93
|
}
|
|
93
|
-
` : ""
|
|
94
|
+
`)) : "");
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
var $9a339c4a487c3478$exports = {};
|
|
98
|
+
|
|
99
|
+
$parcel$export($9a339c4a487c3478$exports, "NextStudioHead", () => $9a339c4a487c3478$export$79723eee2c1bf75e);
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
var $f8b95ae7ca517cc1$exports = {};
|
|
104
|
+
$f8b95ae7ca517cc1$exports = new URL("apple-touch-icon.abc4aca2.png", "file:" + __filename).toString();
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
var $f55f7bae1fab74eb$exports = {};
|
|
108
|
+
$f55f7bae1fab74eb$exports = new URL("favicon.648fc2f2.ico", "file:" + __filename).toString();
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
var $6951ae923d5c6ed1$exports = {};
|
|
112
|
+
$6951ae923d5c6ed1$exports = new URL("favicon.8f76876f.svg", "file:" + __filename).toString();
|
|
94
113
|
|
|
95
114
|
|
|
96
|
-
var $
|
|
115
|
+
var $20032f35397ac709$exports = {};
|
|
116
|
+
$20032f35397ac709$exports = new URL("favicon-192.40c8bab4.png", "file:" + __filename).toString();
|
|
97
117
|
|
|
98
|
-
$parcel$export($3e6cd9b42bc397c4$exports, "NextStudioHead", () => $3e6cd9b42bc397c4$export$79723eee2c1bf75e);
|
|
99
118
|
|
|
119
|
+
var $0f7b7d4813cad0d8$exports = {};
|
|
120
|
+
$0f7b7d4813cad0d8$exports = new URL("favicon-512.5e08f951.png", "file:" + __filename).toString();
|
|
100
121
|
|
|
101
122
|
|
|
102
|
-
var $
|
|
103
|
-
$
|
|
123
|
+
var $c480472b608d459a$exports = {};
|
|
124
|
+
$c480472b608d459a$exports = JSON.parse('{"icons":[{"src":"./favicon-192.png","type":"image/png","sizes":"192x192"},{"src":"./favicon-512.png","type":"image/png","sizes":"512x512"}]}');
|
|
104
125
|
|
|
105
126
|
|
|
106
|
-
const $3e6cd9b42bc397c4$var$iconApple = new URL("92ea002ae7d17215", "file:" + __filename).toString();
|
|
107
|
-
const $3e6cd9b42bc397c4$var$iconSvg = new URL("fcac50a5aa5f709c", "file:" + __filename).toString();
|
|
108
|
-
const $3e6cd9b42bc397c4$var$iconIco = new URL("3615be30c513e586", "file:" + __filename).toString();
|
|
109
|
-
const $3e6cd9b42bc397c4$var$icon192 = new URL("d22f93fc281dd3c3", "file:" + __filename).toString();
|
|
110
|
-
const $3e6cd9b42bc397c4$var$icon512 = new URL("48f1f57287738032", "file:" + __filename).toString();
|
|
111
127
|
// Interop between how Parcel and Next deals with asset imports
|
|
112
|
-
const $
|
|
113
|
-
const $
|
|
114
|
-
const inlineWebmanifest = (0, $
|
|
115
|
-
const manifest = JSON.parse(JSON.stringify((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
128
|
+
const $9a339c4a487c3478$var$interop = (href)=>typeof href === "string" ? href : href.src;
|
|
129
|
+
const $9a339c4a487c3478$var$NextStudioHeadComponent = ({ children: children , themeColorDark: themeColorDark , themeColorLight: themeColorLight , title: title = "Sanity Studio" , favicons: favicons })=>{
|
|
130
|
+
const inlineWebmanifest = (0, $cerUD$react.useCallback)(()=>{
|
|
131
|
+
const manifest = JSON.parse(JSON.stringify((0, (/*@__PURE__*/$parcel$interopDefault($c480472b608d459a$exports)))));
|
|
116
132
|
const icons = manifest.icons.map((icon)=>{
|
|
117
133
|
// Inline manifests works best when URLs are absolute
|
|
118
134
|
const src = // eslint-disable-next-line no-nested-ternary
|
|
119
|
-
icon.src === "./favicon-192.png" ? $
|
|
135
|
+
icon.src === "./favicon-192.png" ? $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($20032f35397ac709$exports)))) : icon.src === "./favicon-512.png" ? $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($0f7b7d4813cad0d8$exports)))) : icon.src;
|
|
120
136
|
return {
|
|
121
137
|
...icon,
|
|
122
|
-
src:
|
|
138
|
+
src: src
|
|
123
139
|
};
|
|
124
140
|
});
|
|
125
141
|
return `data:application/manifest+json,${encodeURIComponent(JSON.stringify({
|
|
@@ -127,50 +143,50 @@ const $3e6cd9b42bc397c4$var$NextStudioHeadComponent = ({ children: children , th
|
|
|
127
143
|
icons: icons
|
|
128
144
|
}))}`;
|
|
129
145
|
}, []);
|
|
130
|
-
return /*#__PURE__*/ (0, $
|
|
146
|
+
return /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($cerUD$nexthead))), {
|
|
131
147
|
children: [
|
|
132
|
-
/*#__PURE__*/ (0, $
|
|
148
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
133
149
|
name: "viewport",
|
|
134
150
|
// Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
|
|
135
151
|
content: "width=device-width, initial-scale=1, viewport-fit=cover"
|
|
136
152
|
}),
|
|
137
|
-
/*#__PURE__*/ (0, $
|
|
153
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
138
154
|
name: "robots",
|
|
139
155
|
content: "noindex"
|
|
140
156
|
}),
|
|
141
|
-
/*#__PURE__*/ (0, $
|
|
157
|
+
/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
142
158
|
name: "referrer",
|
|
143
159
|
content: "same-origin"
|
|
144
160
|
}),
|
|
145
|
-
/*#__PURE__*/ (0, $
|
|
161
|
+
title && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("title", {
|
|
146
162
|
children: title
|
|
147
163
|
}),
|
|
148
|
-
favicons && /*#__PURE__*/ (0, $
|
|
164
|
+
favicons && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("link", {
|
|
149
165
|
rel: "icon",
|
|
150
|
-
href: $
|
|
166
|
+
href: $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($f55f7bae1fab74eb$exports)))),
|
|
151
167
|
sizes: "any"
|
|
152
168
|
}),
|
|
153
|
-
favicons && /*#__PURE__*/ (0, $
|
|
169
|
+
favicons && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("link", {
|
|
154
170
|
rel: "icon",
|
|
155
|
-
href: $
|
|
171
|
+
href: $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($6951ae923d5c6ed1$exports)))),
|
|
156
172
|
type: "image/svg+xml"
|
|
157
173
|
}),
|
|
158
|
-
favicons && /*#__PURE__*/ (0, $
|
|
174
|
+
favicons && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("link", {
|
|
159
175
|
rel: "apple-touch-icon",
|
|
160
|
-
href: $
|
|
176
|
+
href: $9a339c4a487c3478$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($f8b95ae7ca517cc1$exports))))
|
|
161
177
|
}),
|
|
162
|
-
favicons && /*#__PURE__*/ (0, $
|
|
178
|
+
favicons && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("link", {
|
|
163
179
|
rel: "manifest",
|
|
164
180
|
// eslint-disable-next-line no-warning-comments
|
|
165
181
|
// @TODO until parcel fixes https://github.com/parcel-bundler/parcel/issues/8025 and stops stripping process.env.NEXT_PUBLIC_VERCEL_URL from the compiled code, use the remove webmanifest
|
|
166
|
-
href:
|
|
182
|
+
href: "https://next.sanity.build/manifest.webmanifest"
|
|
167
183
|
}),
|
|
168
|
-
themeColorLight && /*#__PURE__*/ (0, $
|
|
184
|
+
themeColorLight && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
169
185
|
name: "theme-color",
|
|
170
186
|
content: themeColorLight,
|
|
171
187
|
media: "(prefers-color-scheme: light)"
|
|
172
188
|
}, "theme-color-light"),
|
|
173
|
-
themeColorDark && /*#__PURE__*/ (0, $
|
|
189
|
+
themeColorDark && /*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)("meta", {
|
|
174
190
|
name: "theme-color",
|
|
175
191
|
content: themeColorDark,
|
|
176
192
|
media: "(prefers-color-scheme: dark)"
|
|
@@ -179,26 +195,26 @@ const $3e6cd9b42bc397c4$var$NextStudioHeadComponent = ({ children: children , th
|
|
|
179
195
|
]
|
|
180
196
|
});
|
|
181
197
|
};
|
|
182
|
-
const $
|
|
198
|
+
const $9a339c4a487c3478$export$79723eee2c1bf75e = /*#__PURE__*/ (0, $cerUD$react.memo)($9a339c4a487c3478$var$NextStudioHeadComponent);
|
|
183
199
|
|
|
184
200
|
|
|
185
|
-
var $
|
|
201
|
+
var $4dc132240adf8d31$exports = {};
|
|
186
202
|
|
|
187
|
-
$parcel$export($
|
|
203
|
+
$parcel$export($4dc132240adf8d31$exports, "ServerStyleSheetDocument", () => $4dc132240adf8d31$export$f64e2f55a1dca172);
|
|
188
204
|
|
|
189
205
|
|
|
190
206
|
|
|
191
|
-
class $
|
|
207
|
+
class $4dc132240adf8d31$export$f64e2f55a1dca172 extends (0, ($parcel$interopDefault($cerUD$nextdocument))) {
|
|
192
208
|
static async getInitialProps(ctx) {
|
|
193
|
-
const sheet = new (0, $
|
|
209
|
+
const sheet = new (0, $cerUD$styledcomponents.ServerStyleSheet)();
|
|
194
210
|
const originalRenderPage = ctx.renderPage;
|
|
195
211
|
try {
|
|
196
212
|
ctx.renderPage = ()=>originalRenderPage({
|
|
197
|
-
enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ (0, $
|
|
213
|
+
enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ (0, $cerUD$reactjsxruntime.jsx)(App, {
|
|
198
214
|
...props
|
|
199
215
|
}))
|
|
200
216
|
});
|
|
201
|
-
const initialProps = await (0, ($parcel$interopDefault($
|
|
217
|
+
const initialProps = await (0, ($parcel$interopDefault($cerUD$nextdocument))).getInitialProps(ctx);
|
|
202
218
|
return {
|
|
203
219
|
...initialProps,
|
|
204
220
|
styles: [
|
|
@@ -213,52 +229,52 @@ class $db5d004cc2549fcd$export$f64e2f55a1dca172 extends (0, ($parcel$interopDefa
|
|
|
213
229
|
}
|
|
214
230
|
|
|
215
231
|
|
|
216
|
-
var $
|
|
232
|
+
var $b07d91633f3d677b$exports = {};
|
|
217
233
|
|
|
218
|
-
$parcel$export($
|
|
219
|
-
$parcel$export($
|
|
220
|
-
$parcel$export($
|
|
221
|
-
$parcel$export($
|
|
222
|
-
$parcel$export($
|
|
223
|
-
$parcel$export($
|
|
234
|
+
$parcel$export($b07d91633f3d677b$exports, "isWorkspaces", () => $b07d91633f3d677b$export$b7c6924067135ce);
|
|
235
|
+
$parcel$export($b07d91633f3d677b$exports, "isWorkspaceWithTheme", () => $b07d91633f3d677b$export$31236b9ee07dd150);
|
|
236
|
+
$parcel$export($b07d91633f3d677b$exports, "useTheme", () => $b07d91633f3d677b$export$93d4e7f90805808f);
|
|
237
|
+
$parcel$export($b07d91633f3d677b$exports, "useBackgroundColorsFromTheme", () => $b07d91633f3d677b$export$d3a2146a441ec034);
|
|
238
|
+
$parcel$export($b07d91633f3d677b$exports, "useBasePath", () => $b07d91633f3d677b$export$53bdd69a9f9bd75);
|
|
239
|
+
$parcel$export($b07d91633f3d677b$exports, "useConfigWithBasePath", () => $b07d91633f3d677b$export$297ba38aa0562c6e);
|
|
224
240
|
|
|
225
241
|
|
|
226
242
|
|
|
227
|
-
function $
|
|
243
|
+
function $b07d91633f3d677b$export$b7c6924067135ce(config) {
|
|
228
244
|
return Array.isArray(config);
|
|
229
245
|
}
|
|
230
|
-
function $
|
|
246
|
+
function $b07d91633f3d677b$export$31236b9ee07dd150(workspace) {
|
|
231
247
|
return Boolean(workspace.theme);
|
|
232
248
|
}
|
|
233
|
-
function $
|
|
234
|
-
const workspace = (0, $
|
|
249
|
+
function $b07d91633f3d677b$export$93d4e7f90805808f(config) {
|
|
250
|
+
const workspace = (0, $cerUD$react.useMemo)(()=>$b07d91633f3d677b$export$b7c6924067135ce(config) ? config[0] : config, [
|
|
235
251
|
config
|
|
236
252
|
]);
|
|
237
|
-
return (0, $
|
|
253
|
+
return (0, $cerUD$react.useMemo)(()=>$b07d91633f3d677b$export$31236b9ee07dd150(workspace) ? workspace.theme : (0, $cerUD$sanity.defaultTheme), [
|
|
238
254
|
workspace
|
|
239
255
|
]);
|
|
240
256
|
}
|
|
241
|
-
const $
|
|
242
|
-
return (0, $
|
|
257
|
+
const $b07d91633f3d677b$export$d3a2146a441ec034 = (theme)=>{
|
|
258
|
+
return (0, $cerUD$react.useMemo)(()=>({
|
|
243
259
|
themeColorLight: theme.color.light.default.base.bg,
|
|
244
260
|
themeColorDark: theme.color.dark.default.base.bg
|
|
245
261
|
}), [
|
|
246
262
|
theme
|
|
247
263
|
]);
|
|
248
264
|
};
|
|
249
|
-
function $
|
|
250
|
-
const router = (0, $
|
|
251
|
-
return (0, $
|
|
265
|
+
function $b07d91633f3d677b$export$53bdd69a9f9bd75() {
|
|
266
|
+
const router = (0, $cerUD$nextrouter.useRouter)();
|
|
267
|
+
return (0, $cerUD$react.useMemo)(()=>{
|
|
252
268
|
const [basePath = "/"] = router.route.split("/[");
|
|
253
269
|
return basePath;
|
|
254
270
|
}, [
|
|
255
271
|
router.route
|
|
256
272
|
]);
|
|
257
273
|
}
|
|
258
|
-
function $
|
|
259
|
-
const basePath = $
|
|
260
|
-
return (0, $
|
|
261
|
-
if ($
|
|
274
|
+
function $b07d91633f3d677b$export$297ba38aa0562c6e(config) {
|
|
275
|
+
const basePath = $b07d91633f3d677b$export$53bdd69a9f9bd75();
|
|
276
|
+
return (0, $cerUD$react.useMemo)(()=>{
|
|
277
|
+
if ($b07d91633f3d677b$export$b7c6924067135ce(config)) return config.map((workspace)=>({
|
|
262
278
|
...workspace,
|
|
263
279
|
basePath: workspace.basePath === "/" ? basePath : `${basePath}${workspace.basePath || ""}`
|
|
264
280
|
}));
|
|
@@ -273,14 +289,14 @@ function $c1f9915ed553476b$export$297ba38aa0562c6e(config) {
|
|
|
273
289
|
}
|
|
274
290
|
|
|
275
291
|
|
|
276
|
-
$parcel$exportWildcard($
|
|
277
|
-
$parcel$exportWildcard($
|
|
278
|
-
$parcel$exportWildcard($
|
|
279
|
-
$parcel$exportWildcard($
|
|
280
|
-
$parcel$exportWildcard($
|
|
292
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $c8bf9e0a6313dcb9$exports);
|
|
293
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $1ac20522861d7f1e$exports);
|
|
294
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $9a339c4a487c3478$exports);
|
|
295
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $4dc132240adf8d31$exports);
|
|
296
|
+
$parcel$exportWildcard($5aa79282f535e8b1$exports, $b07d91633f3d677b$exports);
|
|
281
297
|
|
|
282
298
|
|
|
283
|
-
$parcel$exportWildcard(module.exports, $
|
|
299
|
+
$parcel$exportWildcard(module.exports, $5aa79282f535e8b1$exports);
|
|
284
300
|
|
|
285
301
|
|
|
286
302
|
//# sourceMappingURL=studio.js.map
|