next-sanity 0.6.3 → 0.6.7

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.
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ import { StudioProps } from 'sanity';
3
+ import { NextStudioHeadProps, NextStudioGlobalStyleProps } from '.';
4
+ export interface NextStudioProps extends StudioProps {
5
+ /**
6
+ * Override how the Studio renders by passing children.
7
+ * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:
8
+ * import {StudioProvider, StudioLayout} from 'sanity'
9
+ * import {NextStudio} from 'next-sanity/studio'
10
+ * <NextStudio config={config}>
11
+ * <StudioProvider config={config}>
12
+ * <CustomComponentThatUsesContextFromStudioProvider />
13
+ * <StudioLayout />
14
+ * </StudioProvider>
15
+ * </NextStudio>
16
+ */
17
+ children?: React.ReactNode;
18
+ /**
19
+ * Turns off the default global styling
20
+ */
21
+ unstable__noGlobalStyle?: boolean;
22
+ /**
23
+ * Apply fix with SVG icon centering that happens if TailwindCSS is loaded, on by defautl
24
+ */
25
+ unstable__noTailwindSvgFix?: NextStudioGlobalStyleProps['unstable__tailwindSvgFix'];
26
+ /**
27
+ * Add stuff to the head with next/head
28
+ */
29
+ unstable__head?: NextStudioHeadProps['children'];
30
+ /**
31
+ * Sets the document title
32
+ */
33
+ unstable__document_title?: NextStudioHeadProps['title'];
34
+ /**
35
+ * Sets the background color of <html>
36
+ */
37
+ unstable__bg?: NextStudioGlobalStyleProps['bg'];
38
+ /**
39
+ * Don't load the favicon meta tags
40
+ */
41
+ unstable__noFavicons?: boolean;
42
+ }
43
+ export declare const NextStudio: import("react").MemoExoticComponent<({ children, config, unstable__noGlobalStyle, unstable__noTailwindSvgFix, unstable__head, unstable__document_title, unstable__bg, unstable__noFavicons, ...props }: NextStudioProps) => JSX.Element>;
@@ -0,0 +1,5 @@
1
+ export interface NextStudioGlobalStyleProps {
2
+ bg?: string;
3
+ unstable__tailwindSvgFix?: boolean;
4
+ }
5
+ export declare const NextStudioGlobalStyle: import("styled-components").GlobalStyleComponent<NextStudioGlobalStyleProps, import("styled-components").DefaultTheme>;
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import Document, { DocumentContext } from 'next/document';
3
+ /**
4
+ * Usage, from a pages/_document.tsx file:
5
+ * import {ServerStyleSheetDocument} from 'next-sanity/studio'
6
+ *
7
+ * export default class MyDocument extends ServerStyleSheetDocument {}
8
+ *
9
+ * To do extra stuff in getInitialProps:
10
+ * import {ServerStyleSheetDocument} from 'next-sanity/studio'
11
+ * import { type DocumentContext } from 'next/document'
12
+ *
13
+ * export default class MyDocument extends ServerStyleSheetDocument {
14
+ * static async getInitialProps(ctx: DocumentContext) {
15
+ * // You can still override renderPage:
16
+ * const originalRenderPage = ctx.renderPage
17
+ * ctx.renderPage = () => originalRenderPage({
18
+ * enhanceApp: (App) => (props) => <App {...props} />
19
+ * })
20
+ *
21
+ * const initialProps = await ServerStyleSheetDocument.getInitialProps(ctx)
22
+ * const extraStyles = await getStyles()
23
+ * return {
24
+ * ...initialProps,
25
+ * styles: [initialProps.styles, extraStyles],
26
+ * }
27
+ * }
28
+ * }
29
+ */
30
+ export declare class ServerStyleSheetDocument extends Document {
31
+ static getInitialProps(ctx: DocumentContext): Promise<{
32
+ styles: ({} | undefined)[];
33
+ html: string;
34
+ head?: (JSX.Element | null)[] | undefined;
35
+ }>;
36
+ }
@@ -0,0 +1,5 @@
1
+ export * from './NextStudio';
2
+ export * from './NextStudioGlobalStyle';
3
+ export * from './NextStudioHead';
4
+ export * from './ServerStyleSheetDocument';
5
+ export * from './utils';
@@ -0,0 +1,24 @@
1
+ import { Config, StudioTheme, WorkspaceOptions } from 'sanity';
2
+ export declare function isWorkspaces(config: Config): config is WorkspaceOptions[];
3
+ export interface WorkspaceWithTheme extends Omit<WorkspaceOptions, 'theme'> {
4
+ theme: StudioTheme;
5
+ }
6
+ export declare function isWorkspaceWithTheme(workspace: WorkspaceOptions): workspace is WorkspaceWithTheme;
7
+ export declare function useTheme(config: Config): StudioTheme;
8
+ export declare type MetaThemeColors = {
9
+ themeColorLight: string;
10
+ themeColorDark: string;
11
+ };
12
+ export declare const useBackgroundColorsFromTheme: (theme: StudioTheme) => MetaThemeColors;
13
+ /**
14
+ * Parses the next route to determine the what the base path for Sanity Studio should be
15
+ */
16
+ export declare function useBasePath(): string;
17
+ export interface WorkspaceWithBasePath extends Omit<WorkspaceOptions, 'basePath'> {
18
+ basePath: string;
19
+ }
20
+ export declare type ConfigWithBasePath = WorkspaceWithBasePath | WorkspaceWithBasePath[];
21
+ /**
22
+ * Apply the base path from next to the config, prefixing any defined base path
23
+ */
24
+ export declare function useConfigWithBasePath(config: Config): ConfigWithBasePath;
@@ -0,0 +1 @@
1
+ export * from './studio/index';
Binary file
Binary file
Binary file
@@ -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>
@@ -0,0 +1,301 @@
1
+ var $aBkVq$reactjsxruntime = require("react/jsx-runtime");
2
+ var $aBkVq$react = require("react");
3
+ var $aBkVq$sanity = require("sanity");
4
+ var $aBkVq$styledcomponents = require("styled-components");
5
+ var $aBkVq$nexthead = require("next/head");
6
+ var $aBkVq$nextdocument = require("next/document");
7
+ var $aBkVq$nextrouter = require("next/router");
8
+
9
+ function $parcel$exportWildcard(dest, source) {
10
+ Object.keys(source).forEach(function(key) {
11
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
12
+ return;
13
+ }
14
+
15
+ Object.defineProperty(dest, key, {
16
+ enumerable: true,
17
+ get: function get() {
18
+ return source[key];
19
+ }
20
+ });
21
+ });
22
+
23
+ return dest;
24
+ }
25
+ function $parcel$export(e, n, v, s) {
26
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
27
+ }
28
+ function $parcel$interopDefault(a) {
29
+ return a && a.__esModule ? a.default : a;
30
+ }
31
+ var $de3959199b10acaa$exports = {};
32
+ var $53f899201c613ec3$exports = {};
33
+
34
+ $parcel$export($53f899201c613ec3$exports, "NextStudio", () => $53f899201c613ec3$export$eefb95cccd1bb6c5);
35
+
36
+
37
+
38
+
39
+ /**
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
+ * It's a drop-in replacement for `import {Studio} from 'sanity'`
42
+ */ const $53f899201c613ec3$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, $c1f9915ed553476b$export$93d4e7f90805808f)(config);
44
+ const { themeColorLight: themeColorLight , themeColorDark: themeColorDark } = (0, $c1f9915ed553476b$export$d3a2146a441ec034)(theme);
45
+ return /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsxs)((0, $aBkVq$reactjsxruntime.Fragment), {
46
+ children: [
47
+ children || /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)((0, $aBkVq$sanity.Studio), {
48
+ config: config,
49
+ ...props
50
+ }),
51
+ /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)((0, $3e6cd9b42bc397c4$export$79723eee2c1bf75e), {
52
+ themeColorLight: themeColorLight,
53
+ themeColorDark: themeColorDark,
54
+ title: unstable__document_title,
55
+ favicons: !unstable__noFavicons,
56
+ children: unstable__head
57
+ }),
58
+ !unstable__noGlobalStyle && /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)((0, $9f395ae24b7d6f36$export$c8fda7ee7699d07e), {
59
+ bg: unstable__bg !== null && unstable__bg !== void 0 ? unstable__bg : themeColorLight,
60
+ unstable__tailwindSvgFix: !unstable__noTailwindSvgFix
61
+ })
62
+ ]
63
+ });
64
+ };
65
+ const $53f899201c613ec3$export$eefb95cccd1bb6c5 = /*#__PURE__*/ (0, $aBkVq$react.memo)($53f899201c613ec3$var$NextStudioComponent);
66
+
67
+
68
+ var $9f395ae24b7d6f36$exports = {};
69
+
70
+ $parcel$export($9f395ae24b7d6f36$exports, "NextStudioGlobalStyle", () => $9f395ae24b7d6f36$export$c8fda7ee7699d07e);
71
+
72
+ const $9f395ae24b7d6f36$export$c8fda7ee7699d07e = (0, $aBkVq$styledcomponents.createGlobalStyle)`
73
+ ${({ bg: bg })=>bg ? (0, $aBkVq$styledcomponents.css)`
74
+ html {
75
+ background-color: ${bg};
76
+ }
77
+ ` : ""}
78
+ html,
79
+ body,
80
+ #__next {
81
+ height: 100%;
82
+ }
83
+ body {
84
+ margin: 0;
85
+ overscroll-behavior: none;
86
+ -webkit-font-smoothing: antialiased;
87
+ }
88
+ ${({ unstable__tailwindSvgFix: unstable__tailwindSvgFix })=>unstable__tailwindSvgFix ? (0, $aBkVq$styledcomponents.css)`
89
+ /* override tailwind reset */
90
+ :root svg {
91
+ display: inline;
92
+ }
93
+ ` : ""}`;
94
+
95
+
96
+ var $3e6cd9b42bc397c4$exports = {};
97
+
98
+ $parcel$export($3e6cd9b42bc397c4$exports, "NextStudioHead", () => $3e6cd9b42bc397c4$export$79723eee2c1bf75e);
99
+
100
+
101
+
102
+ var $d62a91800808f0a8$exports = {};
103
+ $d62a91800808f0a8$exports = new URL("apple-touch-icon.abc4aca2.png", "file:" + __filename).toString();
104
+
105
+
106
+ var $60a89fb72f908889$exports = {};
107
+ $60a89fb72f908889$exports = new URL("favicon.648fc2f2.ico", "file:" + __filename).toString();
108
+
109
+
110
+ var $9ea421369d9d5398$exports = {};
111
+ $9ea421369d9d5398$exports = new URL("favicon.8f76876f.svg", "file:" + __filename).toString();
112
+
113
+
114
+ var $baad41aac6f7f102$exports = {};
115
+ $baad41aac6f7f102$exports = new URL("favicon-192.40c8bab4.png", "file:" + __filename).toString();
116
+
117
+
118
+ var $cbbee0dee6b72f0a$exports = {};
119
+ $cbbee0dee6b72f0a$exports = new URL("favicon-512.5e08f951.png", "file:" + __filename).toString();
120
+
121
+
122
+ var $4365e057d007ed0b$exports = {};
123
+ $4365e057d007ed0b$exports = JSON.parse('{"icons":[{"src":"./favicon-192.png","type":"image/png","sizes":"192x192"},{"src":"./favicon-512.png","type":"image/png","sizes":"512x512"}]}');
124
+
125
+
126
+ // Interop between how Parcel and Next deals with asset imports
127
+ const $3e6cd9b42bc397c4$var$interop = (href)=>typeof href === "string" ? href : href.src;
128
+ const $3e6cd9b42bc397c4$var$NextStudioHeadComponent = ({ children: children , themeColorDark: themeColorDark , themeColorLight: themeColorLight , title: title = "Sanity Studio" , favicons: favicons })=>{
129
+ const inlineWebmanifest = (0, $aBkVq$react.useCallback)(()=>{
130
+ const manifest = JSON.parse(JSON.stringify((0, (/*@__PURE__*/$parcel$interopDefault($4365e057d007ed0b$exports)))));
131
+ const icons = manifest.icons.map((icon)=>{
132
+ // Inline manifests works best when URLs are absolute
133
+ const src = // eslint-disable-next-line no-nested-ternary
134
+ icon.src === "./favicon-192.png" ? $3e6cd9b42bc397c4$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($baad41aac6f7f102$exports)))) : icon.src === "./favicon-512.png" ? $3e6cd9b42bc397c4$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($cbbee0dee6b72f0a$exports)))) : icon.src;
135
+ return {
136
+ ...icon,
137
+ src: process.env.NEXT_PUBLIC_VERCEL_URL ? new URL(src, `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`).toString() : src
138
+ };
139
+ });
140
+ return `data:application/manifest+json,${encodeURIComponent(JSON.stringify({
141
+ ...manifest,
142
+ icons: icons
143
+ }))}`;
144
+ }, []);
145
+ return /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsxs)((0, ($parcel$interopDefault($aBkVq$nexthead))), {
146
+ children: [
147
+ /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("meta", {
148
+ name: "viewport",
149
+ // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly
150
+ content: "width=device-width, initial-scale=1, viewport-fit=cover"
151
+ }),
152
+ /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("meta", {
153
+ name: "robots",
154
+ content: "noindex"
155
+ }),
156
+ /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("meta", {
157
+ name: "referrer",
158
+ content: "same-origin"
159
+ }),
160
+ /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("title", {
161
+ children: title
162
+ }),
163
+ favicons && /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("link", {
164
+ rel: "icon",
165
+ href: $3e6cd9b42bc397c4$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($60a89fb72f908889$exports)))),
166
+ sizes: "any"
167
+ }),
168
+ favicons && /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("link", {
169
+ rel: "icon",
170
+ href: $3e6cd9b42bc397c4$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($9ea421369d9d5398$exports)))),
171
+ type: "image/svg+xml"
172
+ }),
173
+ favicons && /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("link", {
174
+ rel: "apple-touch-icon",
175
+ href: $3e6cd9b42bc397c4$var$interop((0, (/*@__PURE__*/$parcel$interopDefault($d62a91800808f0a8$exports))))
176
+ }),
177
+ favicons && /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("link", {
178
+ rel: "manifest",
179
+ // eslint-disable-next-line no-warning-comments
180
+ // @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
181
+ href: process.env.NEXT_PUBLIC_VERCEL_URL ? inlineWebmanifest() : "https://next-studio-layout.sanity.build/manifest.webmanifest"
182
+ }),
183
+ themeColorLight && /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("meta", {
184
+ name: "theme-color",
185
+ content: themeColorLight,
186
+ media: "(prefers-color-scheme: light)"
187
+ }, "theme-color-light"),
188
+ themeColorDark && /*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)("meta", {
189
+ name: "theme-color",
190
+ content: themeColorDark,
191
+ media: "(prefers-color-scheme: dark)"
192
+ }, "theme-color-dark"),
193
+ children
194
+ ]
195
+ });
196
+ };
197
+ const $3e6cd9b42bc397c4$export$79723eee2c1bf75e = /*#__PURE__*/ (0, $aBkVq$react.memo)($3e6cd9b42bc397c4$var$NextStudioHeadComponent);
198
+
199
+
200
+ var $db5d004cc2549fcd$exports = {};
201
+
202
+ $parcel$export($db5d004cc2549fcd$exports, "ServerStyleSheetDocument", () => $db5d004cc2549fcd$export$f64e2f55a1dca172);
203
+
204
+
205
+
206
+ class $db5d004cc2549fcd$export$f64e2f55a1dca172 extends (0, ($parcel$interopDefault($aBkVq$nextdocument))) {
207
+ static async getInitialProps(ctx) {
208
+ const sheet = new (0, $aBkVq$styledcomponents.ServerStyleSheet)();
209
+ const originalRenderPage = ctx.renderPage;
210
+ try {
211
+ ctx.renderPage = ()=>originalRenderPage({
212
+ enhanceApp: (App)=>(props)=>sheet.collectStyles(/*#__PURE__*/ (0, $aBkVq$reactjsxruntime.jsx)(App, {
213
+ ...props
214
+ }))
215
+ });
216
+ const initialProps = await (0, ($parcel$interopDefault($aBkVq$nextdocument))).getInitialProps(ctx);
217
+ return {
218
+ ...initialProps,
219
+ styles: [
220
+ initialProps.styles,
221
+ sheet.getStyleElement()
222
+ ]
223
+ };
224
+ } finally{
225
+ sheet.seal();
226
+ }
227
+ }
228
+ }
229
+
230
+
231
+ var $c1f9915ed553476b$exports = {};
232
+
233
+ $parcel$export($c1f9915ed553476b$exports, "isWorkspaces", () => $c1f9915ed553476b$export$b7c6924067135ce);
234
+ $parcel$export($c1f9915ed553476b$exports, "isWorkspaceWithTheme", () => $c1f9915ed553476b$export$31236b9ee07dd150);
235
+ $parcel$export($c1f9915ed553476b$exports, "useTheme", () => $c1f9915ed553476b$export$93d4e7f90805808f);
236
+ $parcel$export($c1f9915ed553476b$exports, "useBackgroundColorsFromTheme", () => $c1f9915ed553476b$export$d3a2146a441ec034);
237
+ $parcel$export($c1f9915ed553476b$exports, "useBasePath", () => $c1f9915ed553476b$export$53bdd69a9f9bd75);
238
+ $parcel$export($c1f9915ed553476b$exports, "useConfigWithBasePath", () => $c1f9915ed553476b$export$297ba38aa0562c6e);
239
+
240
+
241
+
242
+ function $c1f9915ed553476b$export$b7c6924067135ce(config) {
243
+ return Array.isArray(config);
244
+ }
245
+ function $c1f9915ed553476b$export$31236b9ee07dd150(workspace) {
246
+ return Boolean(workspace.theme);
247
+ }
248
+ function $c1f9915ed553476b$export$93d4e7f90805808f(config) {
249
+ const workspace = (0, $aBkVq$react.useMemo)(()=>$c1f9915ed553476b$export$b7c6924067135ce(config) ? config[0] : config, [
250
+ config
251
+ ]);
252
+ return (0, $aBkVq$react.useMemo)(()=>$c1f9915ed553476b$export$31236b9ee07dd150(workspace) ? workspace.theme : (0, $aBkVq$sanity.defaultTheme), [
253
+ workspace
254
+ ]);
255
+ }
256
+ const $c1f9915ed553476b$export$d3a2146a441ec034 = (theme)=>{
257
+ return (0, $aBkVq$react.useMemo)(()=>({
258
+ themeColorLight: theme.color.light.default.base.bg,
259
+ themeColorDark: theme.color.dark.default.base.bg
260
+ }), [
261
+ theme
262
+ ]);
263
+ };
264
+ function $c1f9915ed553476b$export$53bdd69a9f9bd75() {
265
+ const router = (0, $aBkVq$nextrouter.useRouter)();
266
+ return (0, $aBkVq$react.useMemo)(()=>{
267
+ const [basePath = "/"] = router.route.split("/[");
268
+ return basePath;
269
+ }, [
270
+ router.route
271
+ ]);
272
+ }
273
+ function $c1f9915ed553476b$export$297ba38aa0562c6e(config) {
274
+ const basePath = $c1f9915ed553476b$export$53bdd69a9f9bd75();
275
+ return (0, $aBkVq$react.useMemo)(()=>{
276
+ if ($c1f9915ed553476b$export$b7c6924067135ce(config)) return config.map((workspace)=>({
277
+ ...workspace,
278
+ basePath: workspace.basePath === "/" ? basePath : `${basePath}${workspace.basePath || ""}`
279
+ }));
280
+ return {
281
+ ...config,
282
+ basePath: config.basePath === "/" ? basePath : `${basePath}${config.basePath || ""}`
283
+ };
284
+ }, [
285
+ config,
286
+ basePath
287
+ ]);
288
+ }
289
+
290
+
291
+ $parcel$exportWildcard($de3959199b10acaa$exports, $53f899201c613ec3$exports);
292
+ $parcel$exportWildcard($de3959199b10acaa$exports, $9f395ae24b7d6f36$exports);
293
+ $parcel$exportWildcard($de3959199b10acaa$exports, $3e6cd9b42bc397c4$exports);
294
+ $parcel$exportWildcard($de3959199b10acaa$exports, $db5d004cc2549fcd$exports);
295
+ $parcel$exportWildcard($de3959199b10acaa$exports, $c1f9915ed553476b$exports);
296
+
297
+
298
+ $parcel$exportWildcard(module.exports, $de3959199b10acaa$exports);
299
+
300
+
301
+ //# sourceMappingURL=studio.js.map
@@ -0,0 +1 @@
1
+ {"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QACjD,OAAO,QAAQ,CAAA;KAChB,EAAE;QAAC,MAAM,CAAC,KAAK;KAAC,CAAC,CAAA;CACnB;AASM,SAAS,yCAAqB,CAAC,MAAc,EAAsB;IACxE,MAAM,QAAQ,GAAG,wCAAW,EAAE;IAC9B,OAAO,CAAA,GAAA,oBAAO,CAAA,CAAC,IAAM;QACnB,IAAI,wCAAY,CAAC,MAAM,CAAC,EACtB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,GAAM,CAAA;gBAChC,GAAG,SAAS;gBACZ,QAAQ,EACN,SAAS,CAAC,QAAQ,KAAK,GAAG,GAAG,QAAQ,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;aACnF,CAAA,AAAC,CAAC,CAAA;QAEL,OAAO;YACL,GAAG,MAAM;YACT,QAAQ,EAAE,MAAM,CAAC,QAAQ,KAAK,GAAG,GAAG,QAAQ,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;SACrF,CAAA;KACF,EAAE;QAAC,MAAM;QAAE,QAAQ;KAAC,CAAC,CAAA;CACvB;;;;;;;;;AZ5ED","sources":["src/studio.ts","src/studio/index.ts","src/studio/NextStudio.tsx","src/studio/NextStudioGlobalStyle.ts","src/studio/NextStudioHead.tsx","node_modules/@parcel/runtime-js/lib/runtime-31b9b830025f9bd9.js","node_modules/@parcel/runtime-js/lib/runtime-3ab4815ff78cfaf2.js","node_modules/@parcel/runtime-js/lib/runtime-a11a89b7de207d59.js","node_modules/@parcel/runtime-js/lib/runtime-dde0b28484ba060d.js","node_modules/@parcel/runtime-js/lib/runtime-e4ee6d7176747ac5.js","public/webmanifest.json","src/studio/ServerStyleSheetDocument.tsx","src/studio/utils.ts"],"sourcesContent":["export * from './studio/index'\n","export * from './NextStudio'\nexport * from './NextStudioGlobalStyle'\nexport * from './NextStudioHead'\nexport * from './ServerStyleSheetDocument'\nexport * from './utils'\n","import {memo} from 'react'\nimport {type StudioProps, Studio} from 'sanity'\n\nimport {\n type NextStudioHeadProps,\n NextStudioGlobalStyle,\n NextStudioGlobalStyleProps,\n NextStudioHead,\n useBackgroundColorsFromTheme,\n useTheme,\n} from '.'\n\nexport interface NextStudioProps extends StudioProps {\n /**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n */\n children?: React.ReactNode\n /**\n * Turns off the default global styling\n */\n unstable__noGlobalStyle?: boolean\n /**\n * Apply fix with SVG icon centering that happens if TailwindCSS is loaded, on by defautl\n */\n unstable__noTailwindSvgFix?: NextStudioGlobalStyleProps['unstable__tailwindSvgFix']\n /**\n * Add stuff to the head with next/head\n */\n unstable__head?: NextStudioHeadProps['children']\n /**\n * Sets the document title\n */\n unstable__document_title?: NextStudioHeadProps['title']\n /**\n * Sets the background color of <html>\n */\n unstable__bg?: NextStudioGlobalStyleProps['bg']\n /**\n * Don't load the favicon meta tags\n */\n unstable__noFavicons?: boolean\n}\n/**\n * 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\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noGlobalStyle,\n unstable__noTailwindSvgFix,\n unstable__head,\n unstable__document_title,\n unstable__bg,\n unstable__noFavicons,\n ...props\n}: NextStudioProps) => {\n const theme = useTheme(config)\n const {themeColorLight, themeColorDark} = useBackgroundColorsFromTheme(theme)\n return (\n <>\n {children || <Studio config={config} {...props} />}\n <NextStudioHead\n themeColorLight={themeColorLight}\n themeColorDark={themeColorDark}\n title={unstable__document_title}\n favicons={!unstable__noFavicons}\n >\n {unstable__head}\n </NextStudioHead>\n {!unstable__noGlobalStyle && (\n <NextStudioGlobalStyle\n bg={unstable__bg ?? themeColorLight}\n unstable__tailwindSvgFix={!unstable__noTailwindSvgFix}\n />\n )}\n </>\n )\n}\nexport const NextStudio = memo(NextStudioComponent)\n","import {createGlobalStyle, css} from 'styled-components'\n\nexport interface NextStudioGlobalStyleProps {\n bg?: string\n unstable__tailwindSvgFix?: boolean\n}\nexport const NextStudioGlobalStyle = createGlobalStyle<NextStudioGlobalStyleProps>`\n${({bg}) =>\n bg\n ? css`\n html {\n background-color: ${bg};\n }\n `\n : ''}\nhtml,\nbody,\n#__next {\n height: 100%;\n}\nbody {\n margin: 0;\n overscroll-behavior: none;\n -webkit-font-smoothing: antialiased;\n}\n${({unstable__tailwindSvgFix}) =>\n unstable__tailwindSvgFix\n ? css`\n /* override tailwind reset */\n :root svg {\n display: inline;\n }\n `\n : ''}`\n","/* eslint-disable no-process-env */\nimport Head from 'next/head'\nimport {type ComponentProps, memo, useCallback} from 'react'\n\nimport iconApple from '../../public/apple-touch-icon.png'\nimport iconIco from '../../public/favicon.ico'\nimport iconSvg from '../../public/favicon.svg'\nimport icon192 from '../../public/favicon-192.png'\nimport icon512 from '../../public/favicon-512.png'\nimport webmanifest from '../../public/webmanifest.json'\nimport type {MetaThemeColors} from './utils'\n\n// Interop between how Parcel and Next deals with asset imports\nconst interop = (href: string | {src: string}): string =>\n typeof href === 'string' ? href : href.src\n\nexport interface NextStudioHeadProps extends Partial<MetaThemeColors> {\n children?: ComponentProps<typeof Head>['children']\n title?: string\n favicons?: boolean\n}\nconst NextStudioHeadComponent = ({\n children,\n themeColorDark,\n themeColorLight,\n title = 'Sanity Studio',\n favicons,\n}: NextStudioHeadProps) => {\n const inlineWebmanifest = useCallback(() => {\n const manifest = JSON.parse(JSON.stringify(webmanifest))\n const icons = manifest.icons.map((icon: any) => {\n // Inline manifests works best when URLs are absolute\n const src =\n // eslint-disable-next-line no-nested-ternary\n icon.src === './favicon-192.png'\n ? interop(icon192)\n : icon.src === './favicon-512.png'\n ? interop(icon512)\n : icon.src\n return {\n ...icon,\n src: process.env.NEXT_PUBLIC_VERCEL_URL\n ? new URL(src, `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`).toString()\n : src,\n }\n })\n return `data:application/manifest+json,${encodeURIComponent(\n JSON.stringify({...manifest, icons})\n )}`\n }, [])\n\n return (\n <Head>\n <meta\n name=\"viewport\"\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n content=\"width=device-width, initial-scale=1, viewport-fit=cover\"\n />\n <meta name=\"robots\" content=\"noindex\" />\n <meta name=\"referrer\" content=\"same-origin\" />\n <title>{title}</title>\n {favicons && <link rel=\"icon\" href={interop(iconIco)} sizes=\"any\" />}\n {favicons && <link rel=\"icon\" href={interop(iconSvg)} type=\"image/svg+xml\" />}\n {favicons && <link rel=\"apple-touch-icon\" href={interop(iconApple)} />}\n {favicons && (\n <link\n rel=\"manifest\"\n // eslint-disable-next-line no-warning-comments\n // @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\n href={\n process.env.NEXT_PUBLIC_VERCEL_URL\n ? inlineWebmanifest()\n : 'https://next-studio-layout.sanity.build/manifest.webmanifest'\n }\n />\n )}\n {/* These theme-color tags makes the Studio look really really good on devices like iPads as the browser chrome adopts the Studio background */}\n {themeColorLight && (\n <meta\n key=\"theme-color-light\"\n name=\"theme-color\"\n content={themeColorLight}\n media=\"(prefers-color-scheme: light)\"\n />\n )}\n {themeColorDark && (\n <meta\n key=\"theme-color-dark\"\n name=\"theme-color\"\n content={themeColorDark}\n media=\"(prefers-color-scheme: dark)\"\n />\n )}\n {children}\n </Head>\n )\n}\n\nexport const NextStudioHead = memo(NextStudioHeadComponent)\n","module.exports = new __parcel__URL__(\"apple-touch-icon.abc4aca2.png\").toString();","module.exports = new __parcel__URL__(\"favicon.648fc2f2.ico\").toString();","module.exports = new __parcel__URL__(\"favicon.8f76876f.svg\").toString();","module.exports = new __parcel__URL__(\"favicon-192.40c8bab4.png\").toString();","module.exports = new __parcel__URL__(\"favicon-512.5e08f951.png\").toString();","{\n \"icons\": [\n {\n \"src\": \"./favicon-192.png\",\n \"type\": \"image/png\",\n \"sizes\": \"192x192\"\n },\n {\n \"src\": \"./favicon-512.png\",\n \"type\": \"image/png\",\n \"sizes\": \"512x512\"\n }\n ]\n}\n","// We can disable this rule safely as we're not trying to use it outside pages/document, we're shipping a wrapper\n// eslint-disable-next-line @next/next/no-document-import-in-page\nimport Document, {type DocumentContext} from 'next/document'\nimport {ServerStyleSheet} from 'styled-components'\n\n/**\n * Usage, from a pages/_document.tsx file:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {}\n *\n * To do extra stuff in getInitialProps:\n * import {ServerStyleSheetDocument} from 'next-sanity/studio'\n * import { type DocumentContext } from 'next/document'\n *\n * export default class MyDocument extends ServerStyleSheetDocument {\n * static async getInitialProps(ctx: DocumentContext) {\n * // You can still override renderPage:\n * const originalRenderPage = ctx.renderPage\n * ctx.renderPage = () => originalRenderPage({\n * enhanceApp: (App) => (props) => <App {...props} />\n * })\n *\n * const initialProps = await ServerStyleSheetDocument.getInitialProps(ctx)\n * const extraStyles = await getStyles()\n * return {\n * ...initialProps,\n * styles: [initialProps.styles, extraStyles],\n * }\n * }\n * }\n */\n\nexport class ServerStyleSheetDocument extends Document {\n static async getInitialProps(ctx: DocumentContext) {\n const sheet = new ServerStyleSheet()\n const originalRenderPage = ctx.renderPage\n\n try {\n ctx.renderPage = () =>\n originalRenderPage({\n enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),\n })\n\n const initialProps = await Document.getInitialProps(ctx)\n return {\n ...initialProps,\n styles: [initialProps.styles, sheet.getStyleElement()],\n }\n } finally {\n sheet.seal()\n }\n }\n}\n","import {useRouter} from 'next/router'\nimport {useMemo} from 'react'\nimport {type Config, type StudioTheme, type WorkspaceOptions, defaultTheme} from 'sanity'\n\nexport function isWorkspaces(config: Config): config is WorkspaceOptions[] {\n return Array.isArray(config)\n}\n\nexport interface WorkspaceWithTheme extends Omit<WorkspaceOptions, 'theme'> {\n theme: StudioTheme\n}\n\nexport function isWorkspaceWithTheme(\n workspace: WorkspaceOptions\n): workspace is WorkspaceWithTheme {\n return Boolean(workspace.theme)\n}\n\nexport function useTheme(config: Config): StudioTheme {\n const workspace = useMemo<WorkspaceOptions>(\n () => (isWorkspaces(config) ? config[0] : config),\n [config]\n )\n return useMemo<StudioTheme>(\n () => (isWorkspaceWithTheme(workspace) ? workspace.theme : defaultTheme),\n [workspace]\n )\n}\n\nexport type MetaThemeColors = {\n themeColorLight: string\n themeColorDark: string\n}\nexport const useBackgroundColorsFromTheme = (theme: StudioTheme): MetaThemeColors => {\n return useMemo<MetaThemeColors>(\n () => ({\n themeColorLight: theme.color.light.default.base.bg,\n themeColorDark: theme.color.dark.default.base.bg,\n }),\n [theme]\n )\n}\n\n/**\n * Parses the next route to determine the what the base path for Sanity Studio should be\n */\nexport function useBasePath(): string {\n const router = useRouter()\n return useMemo(() => {\n const [basePath = '/'] = router.route.split('/[')\n return basePath\n }, [router.route])\n}\n\nexport interface WorkspaceWithBasePath extends Omit<WorkspaceOptions, 'basePath'> {\n basePath: string\n}\nexport type ConfigWithBasePath = WorkspaceWithBasePath | WorkspaceWithBasePath[]\n/**\n * Apply the base path from next to the config, prefixing any defined base path\n */\nexport function useConfigWithBasePath(config: Config): ConfigWithBasePath {\n const basePath = useBasePath()\n return useMemo(() => {\n if (isWorkspaces(config)) {\n return config.map((workspace) => ({\n ...workspace,\n basePath:\n workspace.basePath === '/' ? basePath : `${basePath}${workspace.basePath || ''}`,\n }))\n }\n return {\n ...config,\n basePath: config.basePath === '/' ? basePath : `${basePath}${config.basePath || ''}`,\n }\n }, [config, basePath])\n}\n"],"names":[],"version":3,"file":"studio.js.map","sourceRoot":"../../"}
Binary file
Binary file
Binary file
@@ -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>