next-sanity 5.5.4 → 5.5.6
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 +5 -6
- package/dist/client.cjs +1 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/preview/index.cjs +1 -0
- package/dist/preview/index.cjs.map +1 -1
- package/dist/preview/index.js +1 -0
- package/dist/preview/index.js.map +1 -1
- package/dist/preview/live-query.cjs +1 -0
- package/dist/preview/live-query.cjs.map +1 -1
- package/dist/preview/live-query.js +1 -0
- package/dist/preview/live-query.js.map +1 -1
- package/dist/studio/NextStudio.cjs +1 -0
- package/dist/studio/NextStudio.cjs.map +1 -1
- package/dist/studio/NextStudio.js +1 -0
- package/dist/studio/NextStudio.js.map +1 -1
- package/dist/studio/NextStudioClientOnly.cjs +1 -0
- package/dist/studio/NextStudioClientOnly.cjs.map +1 -1
- package/dist/studio/NextStudioClientOnly.js +1 -0
- package/dist/studio/NextStudioClientOnly.js.map +1 -1
- package/dist/studio/NextStudioLayout.cjs +1 -0
- package/dist/studio/NextStudioLayout.cjs.map +1 -1
- package/dist/studio/NextStudioLayout.js +1 -0
- package/dist/studio/NextStudioLayout.js.map +1 -1
- package/dist/studio/NextStudioLoading.cjs +1 -0
- package/dist/studio/NextStudioLoading.cjs.map +1 -1
- package/dist/studio/NextStudioLoading.js +1 -0
- package/dist/studio/NextStudioLoading.js.map +1 -1
- package/dist/studio/NextStudioNoScript.cjs +1 -0
- package/dist/studio/NextStudioNoScript.cjs.map +1 -1
- package/dist/studio/NextStudioNoScript.js +1 -0
- package/dist/studio/NextStudioNoScript.js.map +1 -1
- package/dist/studio/head/NextStudioHead.cjs +1 -0
- package/dist/studio/head/NextStudioHead.cjs.map +1 -1
- package/dist/studio/head/NextStudioHead.js +1 -0
- package/dist/studio/head/NextStudioHead.js.map +1 -1
- package/dist/studio/head.cjs +1 -0
- package/dist/studio/head.cjs.map +1 -1
- package/dist/studio/head.js +1 -0
- package/dist/studio/head.js.map +1 -1
- package/dist/studio/index.cjs +1 -0
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +1 -0
- package/dist/studio/index.js.map +1 -1
- package/dist/studio/loading.cjs +1 -0
- package/dist/studio/loading.cjs.map +1 -1
- package/dist/studio/loading.js +1 -0
- package/dist/studio/loading.js.map +1 -1
- package/dist/studio/metadata.cjs +1 -0
- package/dist/studio/metadata.cjs.map +1 -1
- package/dist/studio/metadata.js +1 -0
- package/dist/studio/metadata.js.map +1 -1
- package/dist/studio/usePrefersColorScheme.cjs +1 -0
- package/dist/studio/usePrefersColorScheme.cjs.map +1 -1
- package/dist/studio/usePrefersColorScheme.js +1 -0
- package/dist/studio/usePrefersColorScheme.js.map +1 -1
- package/dist/studio/useTheme.cjs +1 -0
- package/dist/studio/useTheme.cjs.map +1 -1
- package/dist/studio/useTheme.js +1 -0
- package/dist/studio/useTheme.js.map +1 -1
- package/dist/webhook/config.cjs +1 -0
- package/dist/webhook/config.cjs.map +1 -1
- package/dist/webhook/config.js +1 -0
- package/dist/webhook/config.js.map +1 -1
- package/dist/webhook/parseBody.cjs +1 -0
- package/dist/webhook/parseBody.cjs.map +1 -1
- package/dist/webhook/parseBody.js +1 -0
- package/dist/webhook/parseBody.js.map +1 -1
- package/dist/webhook/readBody.cjs +1 -0
- package/dist/webhook/readBody.cjs.map +1 -1
- package/dist/webhook/readBody.js +1 -0
- package/dist/webhook/readBody.js.map +1 -1
- package/dist/webhook.cjs +1 -0
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.js +1 -0
- package/dist/webhook.js.map +1 -1
- package/package.json +28 -29
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID // "pv8y60vp"
|
|
|
106
106
|
const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET // "production"
|
|
107
107
|
const apiVersion = process.env.NEXT_PUBLIC_SANITY_API_VERSION || '2023-05-03'
|
|
108
108
|
|
|
109
|
-
const client = createClient({
|
|
109
|
+
export const client = createClient({
|
|
110
110
|
projectId,
|
|
111
111
|
dataset,
|
|
112
112
|
apiVersion, // https://www.sanity.io/docs/api-versioning
|
|
@@ -225,9 +225,9 @@ type HomePageProps = {
|
|
|
225
225
|
|
|
226
226
|
export async function HomeLayout({children}) {
|
|
227
227
|
const home = await client.fetch<HomePageProps>(`*[_id == "home"][0]{...,navItems[]->}`,
|
|
228
|
-
next: {
|
|
228
|
+
{next: {
|
|
229
229
|
revalidate: 3600 // look for updates to revalidate cache every hour
|
|
230
|
-
}
|
|
230
|
+
}}
|
|
231
231
|
})
|
|
232
232
|
|
|
233
233
|
return (
|
|
@@ -337,7 +337,7 @@ You can use this [template][webhook-template] to quickly configure the webhook f
|
|
|
337
337
|
The code example below uses the built-in `parseBody` function to validate that the request comes from your Sanity project (using a shared secret + looking at the request headers). Then it looks at the document type information in the webhook payload and matches that against the revalidation tags in your app:
|
|
338
338
|
|
|
339
339
|
```ts
|
|
340
|
-
// ./src/app/api/revalidate.ts
|
|
340
|
+
// ./src/app/api/revalidate/route.ts
|
|
341
341
|
import {revalidateTag} from 'next/cache'
|
|
342
342
|
import {type NextRequest, NextResponse} from 'next/server'
|
|
343
343
|
import {parseBody} from 'next-sanity/webhook'
|
|
@@ -361,7 +361,7 @@ export async function POST(req: NextRequest) {
|
|
|
361
361
|
|
|
362
362
|
// If the `_type` is `page`, then all `client.fetch` calls with
|
|
363
363
|
// `{next: {tags: ['page']}}` will be revalidated
|
|
364
|
-
|
|
364
|
+
revalidateTag(body._type)
|
|
365
365
|
|
|
366
366
|
return NextResponse.json({body})
|
|
367
367
|
} catch (err) {
|
|
@@ -472,7 +472,6 @@ import 'server-only'
|
|
|
472
472
|
import {draftMode} from 'next/headers'
|
|
473
473
|
import type {QueryParams} from '@sanity/client'
|
|
474
474
|
import {createClient, groq} from 'next-sanity'
|
|
475
|
-
import {draftMode} from 'next/headers'
|
|
476
475
|
|
|
477
476
|
const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID // "pv8y60vp"
|
|
478
477
|
const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET // "production"
|
package/dist/client.cjs
CHANGED
package/dist/client.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = studioUrl ? 'auto' : false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"client.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = studioUrl ? 'auto' : false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["studioUrl","encodeSourceMap"],"mappings":";;;;;;;AAgCO;;AACD;AAEFA;AACAC;AACE;;AAGgBA;AACpB;;AAC+B;;AAAsBA;AAAgB;AACvE;"}
|
package/dist/client.js
CHANGED
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = studioUrl ? 'auto' : false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = studioUrl ? 'auto' : false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["studioUrl","encodeSourceMap"],"mappings":";;AAgCO;;AACD;AAEFA;AACAC;AACE;;AAGgBA;AACpB;AACA;AAA+B;;AAAsBA;AAAgB;AACvE;"}
|
package/dist/index.cjs
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/preview/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/preview/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-query.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"live-query.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-query.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"live-query.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudio.cjs","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["import {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioClientOnly} from './NextStudioClientOnly'\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioLoading} from './NextStudioLoading'\nimport {NextStudioNoScript} from './NextStudioNoScript'\n\nexport type {NextStudioLoadingProps} from './NextStudioLoading'\n\n/** @beta */\nexport interface NextStudioProps extends StudioProps {\n children?: React.ReactNode\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n /**\n * Render in a faster mode that requires `styled-components` SSR to be setup.\n * @defaultValue false\n * @alpha\n */\n unstable__fastRender?: 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__noScript = true,\n unstable__fastRender,\n scheme,\n ...props\n}: NextStudioProps) => {\n if (unstable__fastRender) {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </>\n )\n }\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioClientOnly\n fallback={\n <NextStudioLoading\n unstable__noScript={unstable__noScript}\n config={config}\n scheme={scheme}\n />\n }\n >\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </NextStudioClientOnly>\n </>\n )\n}\n\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 * ```\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 * @beta\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudio.cjs","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["import {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioClientOnly} from './NextStudioClientOnly'\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioLoading} from './NextStudioLoading'\nimport {NextStudioNoScript} from './NextStudioNoScript'\n\nexport type {NextStudioLoadingProps} from './NextStudioLoading'\n\n/** @beta */\nexport interface NextStudioProps extends StudioProps {\n children?: React.ReactNode\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n /**\n * Render in a faster mode that requires `styled-components` SSR to be setup.\n * @defaultValue false\n * @alpha\n */\n unstable__fastRender?: 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__noScript = true,\n unstable__fastRender,\n scheme,\n ...props\n}: NextStudioProps) => {\n if (unstable__fastRender) {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </>\n )\n }\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioClientOnly\n fallback={\n <NextStudioLoading\n unstable__noScript={unstable__noScript}\n config={config}\n scheme={scheme}\n />\n }\n >\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </NextStudioClientOnly>\n </>\n )\n}\n\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 * ```\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 * @beta\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["unstable__noScript","unstable_globalStyles","scheme"],"mappings":";;;;;;;;;;;;;AA8BA;;;;AAGEA;;;;AAIF;AACE;;;;;;;;AAMkDC;;;;AAG9C;AAEJ;;;;;;AAUUC;AAAA;;;;;;;AAMwCD;;;;AAE5C;AAEJ;AAEJ;AAiBa;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudio.js","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["import {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioClientOnly} from './NextStudioClientOnly'\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioLoading} from './NextStudioLoading'\nimport {NextStudioNoScript} from './NextStudioNoScript'\n\nexport type {NextStudioLoadingProps} from './NextStudioLoading'\n\n/** @beta */\nexport interface NextStudioProps extends StudioProps {\n children?: React.ReactNode\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n /**\n * Render in a faster mode that requires `styled-components` SSR to be setup.\n * @defaultValue false\n * @alpha\n */\n unstable__fastRender?: 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__noScript = true,\n unstable__fastRender,\n scheme,\n ...props\n}: NextStudioProps) => {\n if (unstable__fastRender) {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </>\n )\n }\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioClientOnly\n fallback={\n <NextStudioLoading\n unstable__noScript={unstable__noScript}\n config={config}\n scheme={scheme}\n />\n }\n >\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </NextStudioClientOnly>\n </>\n )\n}\n\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 * ```\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 * @beta\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudio.js","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["import {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioClientOnly} from './NextStudioClientOnly'\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioLoading} from './NextStudioLoading'\nimport {NextStudioNoScript} from './NextStudioNoScript'\n\nexport type {NextStudioLoadingProps} from './NextStudioLoading'\n\n/** @beta */\nexport interface NextStudioProps extends StudioProps {\n children?: React.ReactNode\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n /**\n * Render in a faster mode that requires `styled-components` SSR to be setup.\n * @defaultValue false\n * @alpha\n */\n unstable__fastRender?: 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__noScript = true,\n unstable__fastRender,\n scheme,\n ...props\n}: NextStudioProps) => {\n if (unstable__fastRender) {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </>\n )\n }\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioClientOnly\n fallback={\n <NextStudioLoading\n unstable__noScript={unstable__noScript}\n config={config}\n scheme={scheme}\n />\n }\n >\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </NextStudioClientOnly>\n </>\n )\n}\n\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 * ```\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 * @beta\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["unstable__noScript","children","unstable_globalStyles","fallback","scheme"],"mappings":";;;;;;;;AA8BA;;;;AAGEA;;;;AAIF;AACE;AACE;AAEKC;;;AAEEA;;;AACyCC;;;;AAG9C;AAEJ;AAEA;AAEKD;AAECE;;;AAIIC;AAAA;AAIJH;;;AACGA;;;AACyCC;;;;AAE5C;AAEJ;AAEJ;AAiBa;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioClientOnly.cjs","sources":["../../src/studio/NextStudioClientOnly.tsx"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioClientOnly.cjs","sources":["../../src/studio/NextStudioClientOnly.tsx"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n"],"names":["fallback","useEffect","children"],"mappings":";;;;;;;;AASO;;;AAAyCA;;;AAEpCC;;AAEAC;AAA8B;AAC1C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioClientOnly.js","sources":["../../src/studio/NextStudioClientOnly.tsx"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioClientOnly.js","sources":["../../src/studio/NextStudioClientOnly.tsx"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n"],"names":["fallback","useEffect","children"],"mappings":";;;AASO;;;AAAyCA;;;AAEpCC;AAEH;AAAGC;AAA8B;AAC1C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioLayout.cjs","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\n\nimport {useTheme} from './useTheme'\n\n/** @alpha */\nexport interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'scheme'> {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({\n children,\n config,\n scheme = 'light',\n}: NextStudioLayoutProps) => {\n const theme = useTheme(config)\n\n return (\n <div\n data-ui=\"NextStudioLayout\"\n style={{\n fontFamily: theme.fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n {children}\n </div>\n )\n}\n\n/** @alpha */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioLayout.cjs","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\n\nimport {useTheme} from './useTheme'\n\n/** @alpha */\nexport interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'scheme'> {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({\n children,\n config,\n scheme = 'light',\n}: NextStudioLayoutProps) => {\n const theme = useTheme(config)\n\n return (\n <div\n data-ui=\"NextStudioLayout\"\n style={{\n fontFamily: theme.fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n {children}\n </div>\n )\n}\n\n/** @alpha */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["scheme","style","fontFamily","backgroundColor","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","children"],"mappings":";;;;;;;;;AAWA;;;;AAGEA;AACF;AACQ;AAGJ;AACE;AACAC;AACEC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;;AAGDC;AAAA;AAGP;AAGa;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioLayout.js","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\n\nimport {useTheme} from './useTheme'\n\n/** @alpha */\nexport interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'scheme'> {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({\n children,\n config,\n scheme = 'light',\n}: NextStudioLayoutProps) => {\n const theme = useTheme(config)\n\n return (\n <div\n data-ui=\"NextStudioLayout\"\n style={{\n fontFamily: theme.fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n {children}\n </div>\n )\n}\n\n/** @alpha */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioLayout.js","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\n\nimport {useTheme} from './useTheme'\n\n/** @alpha */\nexport interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'scheme'> {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({\n children,\n config,\n scheme = 'light',\n}: NextStudioLayoutProps) => {\n const theme = useTheme(config)\n\n return (\n <div\n data-ui=\"NextStudioLayout\"\n style={{\n fontFamily: theme.fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n {children}\n </div>\n )\n}\n\n/** @alpha */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["scheme","style","fontFamily","backgroundColor","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","children"],"mappings":";;;;AAWA;;;;AAGEA;AACF;AACQ;AAGJ;AACE;AACAC;AACEC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;;AAGDC;AAAA;AAGP;AAGa;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioLoading.cjs","sources":["../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["'use client'\n\n/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["scheme","unstable__noScript","media","iconSize","wrapper","display","width","height","svg","margin","style","fontFamily","backgroundColor","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","children","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","position","fontWeight","fontSize","lineHeight","transform"],"mappings":"
|
|
1
|
+
{"version":3,"file":"NextStudioLoading.cjs","sources":["../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["'use client'\n\n/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["scheme","unstable__noScript","media","iconSize","wrapper","display","width","height","svg","margin","style","fontFamily","backgroundColor","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","children","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","position","fontWeight","fontSize","lineHeight","transform"],"mappings":";;;;;;;;;;;;AA8BA;AAcO;;;AACUA;AAAkBC;AAA6B;;AAExD;;;AACQC;AAAS;AAEvB;;;;;AACsDC;;AAC9C;;AAGJC;AACEC;;;AAKAC;AACAC;;AAEFC;AACEH;AACAC;AACAC;AACAE;AACF;;;;;AAQEC;AACEC;AACAC;AACAL;AACAM;AACAC;AACAC;AACAC;;AAGFC;AACE;AACAP;AACEL;AACAa;AACAC;AACAC;AACAC;AACAC;AACAf;AACAE;AACAc;AAAS;AAETC;;;AAGmBP;;AAEnB;AACAP;AACEe;AAAU;AAEVC;AAAY;AAEZH;AAAS;AAETI;AAAU;AAEVC;AAAY;AAEZC;;;AAMFZ;AAAMA;;;AAEH;;;;;;;AAGP;AAEJ;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioLoading.js","sources":["../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["'use client'\n\n/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["scheme","unstable__noScript","media","iconSize","wrapper","display","width","svg","height","margin","children","style","fontFamily","backgroundColor","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","position","fontWeight","fontSize","lineHeight","transform"],"mappings":"
|
|
1
|
+
{"version":3,"file":"NextStudioLoading.js","sources":["../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["'use client'\n\n/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["scheme","unstable__noScript","media","iconSize","wrapper","display","width","svg","height","margin","children","style","fontFamily","backgroundColor","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","position","fontWeight","fontSize","lineHeight","transform"],"mappings":";;;;;;;AA8BA;AAcO;;;AACUA;AAAkBC;AAA6B;;AAExD;;;AACQC;AAAS;;;;;;AAG+BC;;AAC9C;;AAGJC;AACEC;;;AAKAC;;;AAGFC;AACEF;AACAC;AACAE;AACAC;AACF;;;AAIJ;AAEKC;AAECC;AACEC;AACAC;AACAL;AACAM;AACAC;AACAC;AACAC;;AAGFP;AACE;AACAC;AACEN;AACAa;AACAC;AACAC;AACAC;AACAC;AACAd;AACAC;AACAc;AAAS;AAETC;;AAGFd;AAAqBA;;AAEnB;AACAC;AACEc;AAAU;AAEVC;AAAY;AAEZH;AAAS;AAETI;AAAU;AAEVC;AAAY;AAEZC;;;AAMFnB;AAAMA;;AAAQ;AAEX;;AACHA;;;;;AAEJ;AAEJ;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioNoScript.cjs","sources":["../../src/studio/NextStudioNoScript.tsx"],"sourcesContent":["/* eslint-disable react/no-danger */\n\nconst style = {\n __html: `\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n`,\n} as const\n\n/** @alpha */\nexport const NextStudioNoScript = () => (\n <noscript>\n <div className=\"sanity-app-no-js__root\">\n <div className=\"sanity-app-no-js__content\">\n <style type=\"text/css\" dangerouslySetInnerHTML={style} />\n <h1>JavaScript disabled</h1>\n <p>\n Please <a href=\"https://www.enable-javascript.com/\">enable JavaScript</a> in your\n browser and reload the page to proceed.\n </p>\n </div>\n </div>\n </noscript>\n)\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioNoScript.cjs","sources":["../../src/studio/NextStudioNoScript.tsx"],"sourcesContent":["/* eslint-disable react/no-danger */\n\nconst style = {\n __html: `\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n`,\n} as const\n\n/** @alpha */\nexport const NextStudioNoScript = () => (\n <noscript>\n <div className=\"sanity-app-no-js__root\">\n <div className=\"sanity-app-no-js__content\">\n <style type=\"text/css\" dangerouslySetInnerHTML={style} />\n <h1>JavaScript disabled</h1>\n <p>\n Please <a href=\"https://www.enable-javascript.com/\">enable JavaScript</a> in your\n browser and reload the page to proceed.\n </p>\n </div>\n </div>\n </noscript>\n)\n"],"names":["__html","children","className","type","dangerouslySetInnerHTML","href"],"mappings":";;;;;;;AAEA;AACEA;AAoBF;AAGa;AAETC;AAAKC;AACHD;AAAKC;;AACIC;AAAgBC;;AACnBH;;;AAEQI;AAA0CJ;;;;;AAK5D;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
const style = {
|
|
3
4
|
__html: "\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioNoScript.js","sources":["../../src/studio/NextStudioNoScript.tsx"],"sourcesContent":["/* eslint-disable react/no-danger */\n\nconst style = {\n __html: `\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n`,\n} as const\n\n/** @alpha */\nexport const NextStudioNoScript = () => (\n <noscript>\n <div className=\"sanity-app-no-js__root\">\n <div className=\"sanity-app-no-js__content\">\n <style type=\"text/css\" dangerouslySetInnerHTML={style} />\n <h1>JavaScript disabled</h1>\n <p>\n Please <a href=\"https://www.enable-javascript.com/\">enable JavaScript</a> in your\n browser and reload the page to proceed.\n </p>\n </div>\n </div>\n </noscript>\n)\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioNoScript.js","sources":["../../src/studio/NextStudioNoScript.tsx"],"sourcesContent":["/* eslint-disable react/no-danger */\n\nconst style = {\n __html: `\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n`,\n} as const\n\n/** @alpha */\nexport const NextStudioNoScript = () => (\n <noscript>\n <div className=\"sanity-app-no-js__root\">\n <div className=\"sanity-app-no-js__content\">\n <style type=\"text/css\" dangerouslySetInnerHTML={style} />\n <h1>JavaScript disabled</h1>\n <p>\n Please <a href=\"https://www.enable-javascript.com/\">enable JavaScript</a> in your\n browser and reload the page to proceed.\n </p>\n </div>\n </div>\n </noscript>\n)\n"],"names":["__html","children","className","type","dangerouslySetInnerHTML","href"],"mappings":";;AAEA;AACEA;AAoBF;AAGa;AAETC;AAAKC;AACHD;AAAKC;AACHD;AAAOE;AAAgBC;;AACnBH;AAAmB;;AAEXI;AAA0CJ;;;;;AAK5D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioHead.cjs","sources":["../../../src/studio/head/NextStudioHead.tsx"],"sourcesContent":["import _faviconPng from './apple-touch-icon.png'\nimport _faviconIco from './favicon.ico'\nimport _faviconSvg from './favicon.svg'\n\nconst faviconPng = typeof _faviconPng === 'string' ? _faviconPng : _faviconPng.default\nconst faviconIco = typeof _faviconIco === 'string' ? _faviconIco : _faviconIco.default\nconst faviconSvg = typeof _faviconSvg === 'string' ? _faviconSvg : _faviconSvg.default\n\n/** @public */\nexport interface NextStudioHeadProps {\n /**\n * @defaultValue 'utf-8'\n */\n charSet?: false | string\n /**\n * Sets the viewport to `viewport-fit=cover` to integrate with iOS devices with display cutouts (The Notch, Dynamic Island).\n * Also sets `width=device-width, initial-scale=1` to make the studio page responsive.\n * @defaultValue true\n */\n viewport?: boolean\n /**\n * It's common practice to hide the address to your Sanity Studio from search engines by setting `robots` to `noindex`\n * @defaultValue 'noindex'\n */\n robots?: false | string\n /**\n * @defaultValue 'same-origin'\n */\n referrer?: false | string\n /**\n * Adds the same favicons as the `npx sanity dev` pipeline.\n * @defaultValue true\n */\n favicons?: boolean\n /**\n * @defaultValue 'Sanity'\n */\n title?: false | string\n}\n\n/**\n * In Next 13 appDir mode (`/app/studio/[[...index]]/head.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the head component directly:\n * export {NextStudioHead as default} from 'next-sanity/studio/head'\n *\n * // To customize it, use it as a children component:\n * import {NextStudioHead} from 'next-sanity/studio/head'\n *\n * export default function CustomStudioHead() {\n * return (\n * <>\n * <NextStudioHead favicons={false} />\n * <link\n * rel=\"icon\"\n * type=\"image/png\"\n * sizes=\"32x32\"\n * href=\"https://www.sanity.io/static/images/favicons/favicon-32x32.png\"\n * />\n * </>\n * )\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} from 'next-sanity/studio'\n * import {NextStudioHead} from 'next-sanity/studio/head'\n *\n * export default function StudioPage() {\n * return (\n * <>\n * <Head>\n * <NextStudioHead />\n * </Head>\n * <NextStudio config={config} />\n * </>\n * )\n * }\n * ```\n * @public\n * @deprecated Use `import {metadata} from 'next-sanity/studio'` instead, this component will be removed in the next major release.\n */\nexport function NextStudioHead(props: NextStudioHeadProps) {\n const {\n charSet = 'utf-8',\n viewport = true,\n robots = 'noindex',\n referrer = 'same-origin',\n favicons = true,\n title = 'Sanity',\n } = props\n\n return (\n <>\n {charSet && <meta key=\"charset\" charSet={charSet} />}\n {viewport && (\n <meta\n key=\"viewport\"\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 )}\n {robots && <meta key=\"robots\" name=\"robots\" content={robots} />}\n {referrer && <meta key=\"referrer\" name=\"referrer\" content={referrer} />}\n {title && <title>{title}</title>}\n {favicons && <link key=\"favicon.ico\" rel=\"icon\" href={faviconIco} sizes=\"any\" />}\n {favicons && <link key=\"apple-touch-icon.png\" rel=\"apple-touch-icon\" href={faviconPng} />}\n {favicons && <link key=\"favicon.svg\" rel=\"icon\" href={faviconSvg} type=\"image/svg+xml\" />}\n </>\n )\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioHead.cjs","sources":["../../../src/studio/head/NextStudioHead.tsx"],"sourcesContent":["import _faviconPng from './apple-touch-icon.png'\nimport _faviconIco from './favicon.ico'\nimport _faviconSvg from './favicon.svg'\n\nconst faviconPng = typeof _faviconPng === 'string' ? _faviconPng : _faviconPng.default\nconst faviconIco = typeof _faviconIco === 'string' ? _faviconIco : _faviconIco.default\nconst faviconSvg = typeof _faviconSvg === 'string' ? _faviconSvg : _faviconSvg.default\n\n/** @public */\nexport interface NextStudioHeadProps {\n /**\n * @defaultValue 'utf-8'\n */\n charSet?: false | string\n /**\n * Sets the viewport to `viewport-fit=cover` to integrate with iOS devices with display cutouts (The Notch, Dynamic Island).\n * Also sets `width=device-width, initial-scale=1` to make the studio page responsive.\n * @defaultValue true\n */\n viewport?: boolean\n /**\n * It's common practice to hide the address to your Sanity Studio from search engines by setting `robots` to `noindex`\n * @defaultValue 'noindex'\n */\n robots?: false | string\n /**\n * @defaultValue 'same-origin'\n */\n referrer?: false | string\n /**\n * Adds the same favicons as the `npx sanity dev` pipeline.\n * @defaultValue true\n */\n favicons?: boolean\n /**\n * @defaultValue 'Sanity'\n */\n title?: false | string\n}\n\n/**\n * In Next 13 appDir mode (`/app/studio/[[...index]]/head.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the head component directly:\n * export {NextStudioHead as default} from 'next-sanity/studio/head'\n *\n * // To customize it, use it as a children component:\n * import {NextStudioHead} from 'next-sanity/studio/head'\n *\n * export default function CustomStudioHead() {\n * return (\n * <>\n * <NextStudioHead favicons={false} />\n * <link\n * rel=\"icon\"\n * type=\"image/png\"\n * sizes=\"32x32\"\n * href=\"https://www.sanity.io/static/images/favicons/favicon-32x32.png\"\n * />\n * </>\n * )\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} from 'next-sanity/studio'\n * import {NextStudioHead} from 'next-sanity/studio/head'\n *\n * export default function StudioPage() {\n * return (\n * <>\n * <Head>\n * <NextStudioHead />\n * </Head>\n * <NextStudio config={config} />\n * </>\n * )\n * }\n * ```\n * @public\n * @deprecated Use `import {metadata} from 'next-sanity/studio'` instead, this component will be removed in the next major release.\n */\nexport function NextStudioHead(props: NextStudioHeadProps) {\n const {\n charSet = 'utf-8',\n viewport = true,\n robots = 'noindex',\n referrer = 'same-origin',\n favicons = true,\n title = 'Sanity',\n } = props\n\n return (\n <>\n {charSet && <meta key=\"charset\" charSet={charSet} />}\n {viewport && (\n <meta\n key=\"viewport\"\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 )}\n {robots && <meta key=\"robots\" name=\"robots\" content={robots} />}\n {referrer && <meta key=\"referrer\" name=\"referrer\" content={referrer} />}\n {title && <title>{title}</title>}\n {favicons && <link key=\"favicon.ico\" rel=\"icon\" href={faviconIco} sizes=\"any\" />}\n {favicons && <link key=\"apple-touch-icon.png\" rel=\"apple-touch-icon\" href={faviconPng} />}\n {favicons && <link key=\"favicon.svg\" rel=\"icon\" href={faviconSvg} type=\"image/svg+xml\" />}\n </>\n )\n}\n"],"names":["charSet","viewport","robots","referrer","favicons","title","name","content","children","rel","href","sizes","type"],"mappings":";;;;;;;;;;AAIA;AACA;AACA;AA6EO;;AAEHA;AACAC;AACAC;AACAC;AACAC;AACAC;AACE;;;AAIgCL;AAAA;AAI5BM;AAEAC;AAAQ;AAGkBD;AAAcC;;AACVD;AAAgBC;;AAChCC;;AACmBC;AAAWC;AAAkBC;AAAM;AAC1BF;AAAuBC;;AAChCD;AAAWC;AAAkBE;;AACpE;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioHead.js","sources":["../../../src/studio/head/NextStudioHead.tsx"],"sourcesContent":["import _faviconPng from './apple-touch-icon.png'\nimport _faviconIco from './favicon.ico'\nimport _faviconSvg from './favicon.svg'\n\nconst faviconPng = typeof _faviconPng === 'string' ? _faviconPng : _faviconPng.default\nconst faviconIco = typeof _faviconIco === 'string' ? _faviconIco : _faviconIco.default\nconst faviconSvg = typeof _faviconSvg === 'string' ? _faviconSvg : _faviconSvg.default\n\n/** @public */\nexport interface NextStudioHeadProps {\n /**\n * @defaultValue 'utf-8'\n */\n charSet?: false | string\n /**\n * Sets the viewport to `viewport-fit=cover` to integrate with iOS devices with display cutouts (The Notch, Dynamic Island).\n * Also sets `width=device-width, initial-scale=1` to make the studio page responsive.\n * @defaultValue true\n */\n viewport?: boolean\n /**\n * It's common practice to hide the address to your Sanity Studio from search engines by setting `robots` to `noindex`\n * @defaultValue 'noindex'\n */\n robots?: false | string\n /**\n * @defaultValue 'same-origin'\n */\n referrer?: false | string\n /**\n * Adds the same favicons as the `npx sanity dev` pipeline.\n * @defaultValue true\n */\n favicons?: boolean\n /**\n * @defaultValue 'Sanity'\n */\n title?: false | string\n}\n\n/**\n * In Next 13 appDir mode (`/app/studio/[[...index]]/head.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the head component directly:\n * export {NextStudioHead as default} from 'next-sanity/studio/head'\n *\n * // To customize it, use it as a children component:\n * import {NextStudioHead} from 'next-sanity/studio/head'\n *\n * export default function CustomStudioHead() {\n * return (\n * <>\n * <NextStudioHead favicons={false} />\n * <link\n * rel=\"icon\"\n * type=\"image/png\"\n * sizes=\"32x32\"\n * href=\"https://www.sanity.io/static/images/favicons/favicon-32x32.png\"\n * />\n * </>\n * )\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} from 'next-sanity/studio'\n * import {NextStudioHead} from 'next-sanity/studio/head'\n *\n * export default function StudioPage() {\n * return (\n * <>\n * <Head>\n * <NextStudioHead />\n * </Head>\n * <NextStudio config={config} />\n * </>\n * )\n * }\n * ```\n * @public\n * @deprecated Use `import {metadata} from 'next-sanity/studio'` instead, this component will be removed in the next major release.\n */\nexport function NextStudioHead(props: NextStudioHeadProps) {\n const {\n charSet = 'utf-8',\n viewport = true,\n robots = 'noindex',\n referrer = 'same-origin',\n favicons = true,\n title = 'Sanity',\n } = props\n\n return (\n <>\n {charSet && <meta key=\"charset\" charSet={charSet} />}\n {viewport && (\n <meta\n key=\"viewport\"\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 )}\n {robots && <meta key=\"robots\" name=\"robots\" content={robots} />}\n {referrer && <meta key=\"referrer\" name=\"referrer\" content={referrer} />}\n {title && <title>{title}</title>}\n {favicons && <link key=\"favicon.ico\" rel=\"icon\" href={faviconIco} sizes=\"any\" />}\n {favicons && <link key=\"apple-touch-icon.png\" rel=\"apple-touch-icon\" href={faviconPng} />}\n {favicons && <link key=\"favicon.svg\" rel=\"icon\" href={faviconSvg} type=\"image/svg+xml\" />}\n </>\n )\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioHead.js","sources":["../../../src/studio/head/NextStudioHead.tsx"],"sourcesContent":["import _faviconPng from './apple-touch-icon.png'\nimport _faviconIco from './favicon.ico'\nimport _faviconSvg from './favicon.svg'\n\nconst faviconPng = typeof _faviconPng === 'string' ? _faviconPng : _faviconPng.default\nconst faviconIco = typeof _faviconIco === 'string' ? _faviconIco : _faviconIco.default\nconst faviconSvg = typeof _faviconSvg === 'string' ? _faviconSvg : _faviconSvg.default\n\n/** @public */\nexport interface NextStudioHeadProps {\n /**\n * @defaultValue 'utf-8'\n */\n charSet?: false | string\n /**\n * Sets the viewport to `viewport-fit=cover` to integrate with iOS devices with display cutouts (The Notch, Dynamic Island).\n * Also sets `width=device-width, initial-scale=1` to make the studio page responsive.\n * @defaultValue true\n */\n viewport?: boolean\n /**\n * It's common practice to hide the address to your Sanity Studio from search engines by setting `robots` to `noindex`\n * @defaultValue 'noindex'\n */\n robots?: false | string\n /**\n * @defaultValue 'same-origin'\n */\n referrer?: false | string\n /**\n * Adds the same favicons as the `npx sanity dev` pipeline.\n * @defaultValue true\n */\n favicons?: boolean\n /**\n * @defaultValue 'Sanity'\n */\n title?: false | string\n}\n\n/**\n * In Next 13 appDir mode (`/app/studio/[[...index]]/head.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the head component directly:\n * export {NextStudioHead as default} from 'next-sanity/studio/head'\n *\n * // To customize it, use it as a children component:\n * import {NextStudioHead} from 'next-sanity/studio/head'\n *\n * export default function CustomStudioHead() {\n * return (\n * <>\n * <NextStudioHead favicons={false} />\n * <link\n * rel=\"icon\"\n * type=\"image/png\"\n * sizes=\"32x32\"\n * href=\"https://www.sanity.io/static/images/favicons/favicon-32x32.png\"\n * />\n * </>\n * )\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} from 'next-sanity/studio'\n * import {NextStudioHead} from 'next-sanity/studio/head'\n *\n * export default function StudioPage() {\n * return (\n * <>\n * <Head>\n * <NextStudioHead />\n * </Head>\n * <NextStudio config={config} />\n * </>\n * )\n * }\n * ```\n * @public\n * @deprecated Use `import {metadata} from 'next-sanity/studio'` instead, this component will be removed in the next major release.\n */\nexport function NextStudioHead(props: NextStudioHeadProps) {\n const {\n charSet = 'utf-8',\n viewport = true,\n robots = 'noindex',\n referrer = 'same-origin',\n favicons = true,\n title = 'Sanity',\n } = props\n\n return (\n <>\n {charSet && <meta key=\"charset\" charSet={charSet} />}\n {viewport && (\n <meta\n key=\"viewport\"\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 )}\n {robots && <meta key=\"robots\" name=\"robots\" content={robots} />}\n {referrer && <meta key=\"referrer\" name=\"referrer\" content={referrer} />}\n {title && <title>{title}</title>}\n {favicons && <link key=\"favicon.ico\" rel=\"icon\" href={faviconIco} sizes=\"any\" />}\n {favicons && <link key=\"apple-touch-icon.png\" rel=\"apple-touch-icon\" href={faviconPng} />}\n {favicons && <link key=\"favicon.svg\" rel=\"icon\" href={faviconSvg} type=\"image/svg+xml\" />}\n </>\n )\n}\n"],"names":["charSet","viewport","robots","referrer","favicons","title","name","content","children","rel","href","sizes","type"],"mappings":";;;;;AAIA;AACA;AACA;AA6EO;;AAEHA;AACAC;AACAC;AACAC;AACAC;AACAC;AACE;AAEJ;;AAEoCL;;AAI5BM;AAEAC;;AAG0BD;AAAcC;;AACVD;AAAgBC;;AAChCC;;AACmBC;AAAWC;AAAkBC;;AACpBF;AAAuBC;;AAChCD;AAAWC;AAAkBE;;AACpE;AAEJ;"}
|
package/dist/studio/head.cjs
CHANGED
package/dist/studio/head.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"head.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"head.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/dist/studio/head.js
CHANGED
package/dist/studio/head.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"head.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"head.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/studio/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
package/dist/studio/index.js
CHANGED
package/dist/studio/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
package/dist/studio/loading.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loading.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/dist/studio/loading.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"loading.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/studio/metadata.cjs
CHANGED
|
@@ -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":["
|
|
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;"}
|
package/dist/studio/metadata.js
CHANGED
|
@@ -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":["
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefersColorScheme.cjs","sources":["../../src/studio/usePrefersColorScheme.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport type {ThemeColorSchemeKey} from '@sanity/ui'\nimport {useSyncExternalStore} from 'react'\n\nfunction createStore() {\n if (typeof document === 'undefined') {\n return {\n subscribe: () => () => {},\n getSnapshot: () => 'light' as const,\n getServerSnapshot: () => 'light' as const,\n }\n }\n\n const matchMedia = window.matchMedia('(prefers-color-scheme: dark)')\n\n return {\n subscribe: (onStoreChange: () => void) => {\n matchMedia.addEventListener('change', onStoreChange)\n return () => matchMedia.removeEventListener('change', onStoreChange)\n },\n getSnapshot: () => (matchMedia.matches ? 'dark' : 'light'),\n getServerSnapshot: () => 'light' as const,\n }\n}\nconst store = createStore()\n\n/** @alpha */\nexport function usePrefersColorScheme(): ThemeColorSchemeKey {\n return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot)\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"usePrefersColorScheme.cjs","sources":["../../src/studio/usePrefersColorScheme.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport type {ThemeColorSchemeKey} from '@sanity/ui'\nimport {useSyncExternalStore} from 'react'\n\nfunction createStore() {\n if (typeof document === 'undefined') {\n return {\n subscribe: () => () => {},\n getSnapshot: () => 'light' as const,\n getServerSnapshot: () => 'light' as const,\n }\n }\n\n const matchMedia = window.matchMedia('(prefers-color-scheme: dark)')\n\n return {\n subscribe: (onStoreChange: () => void) => {\n matchMedia.addEventListener('change', onStoreChange)\n return () => matchMedia.removeEventListener('change', onStoreChange)\n },\n getSnapshot: () => (matchMedia.matches ? 'dark' : 'light'),\n getServerSnapshot: () => 'light' as const,\n }\n}\nconst store = createStore()\n\n/** @alpha */\nexport function usePrefersColorScheme(): ThemeColorSchemeKey {\n return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot)\n}\n"],"names":["subscribe","matchMedia"],"mappings":";;;;;;;AAIA;AACM;;AAEAA;;;;AAIJ;AAEM;;;AAISC;;;;;;AAMjB;AACA;AAGO;AACL;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrefersColorScheme.js","sources":["../../src/studio/usePrefersColorScheme.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport type {ThemeColorSchemeKey} from '@sanity/ui'\nimport {useSyncExternalStore} from 'react'\n\nfunction createStore() {\n if (typeof document === 'undefined') {\n return {\n subscribe: () => () => {},\n getSnapshot: () => 'light' as const,\n getServerSnapshot: () => 'light' as const,\n }\n }\n\n const matchMedia = window.matchMedia('(prefers-color-scheme: dark)')\n\n return {\n subscribe: (onStoreChange: () => void) => {\n matchMedia.addEventListener('change', onStoreChange)\n return () => matchMedia.removeEventListener('change', onStoreChange)\n },\n getSnapshot: () => (matchMedia.matches ? 'dark' : 'light'),\n getServerSnapshot: () => 'light' as const,\n }\n}\nconst store = createStore()\n\n/** @alpha */\nexport function usePrefersColorScheme(): ThemeColorSchemeKey {\n return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot)\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"usePrefersColorScheme.js","sources":["../../src/studio/usePrefersColorScheme.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport type {ThemeColorSchemeKey} from '@sanity/ui'\nimport {useSyncExternalStore} from 'react'\n\nfunction createStore() {\n if (typeof document === 'undefined') {\n return {\n subscribe: () => () => {},\n getSnapshot: () => 'light' as const,\n getServerSnapshot: () => 'light' as const,\n }\n }\n\n const matchMedia = window.matchMedia('(prefers-color-scheme: dark)')\n\n return {\n subscribe: (onStoreChange: () => void) => {\n matchMedia.addEventListener('change', onStoreChange)\n return () => matchMedia.removeEventListener('change', onStoreChange)\n },\n getSnapshot: () => (matchMedia.matches ? 'dark' : 'light'),\n getServerSnapshot: () => 'light' as const,\n }\n}\nconst store = createStore()\n\n/** @alpha */\nexport function usePrefersColorScheme(): ThemeColorSchemeKey {\n return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot)\n}\n"],"names":["subscribe","matchMedia"],"mappings":";;AAIA;AACM;;AAEAA;;;;AAIJ;AAEM;;;AAISC;;;;;;AAMjB;AACA;AAGO;AACL;AACF;"}
|
package/dist/studio/useTheme.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.cjs","sources":["../../src/studio/useTheme.ts"],"sourcesContent":["import {studioTheme} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport type {Config, SingleWorkspace, StudioTheme} from 'sanity'\n\n/** @alpha */\nexport function useTheme(\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>,\n): StudioTheme {\n const workspace = useMemo<\n SingleWorkspace | Required<Pick<SingleWorkspace, 'theme'>> | undefined\n >(() => (Array.isArray(config) ? config[0] : config), [config])\n return useMemo<StudioTheme>(() => workspace?.theme || studioTheme, [workspace])\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useTheme.cjs","sources":["../../src/studio/useTheme.ts"],"sourcesContent":["import {studioTheme} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport type {Config, SingleWorkspace, StudioTheme} from 'sanity'\n\n/** @alpha */\nexport function useTheme(\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>,\n): StudioTheme {\n const workspace = useMemo<\n SingleWorkspace | Required<Pick<SingleWorkspace, 'theme'>> | undefined\n >(() => (Array.isArray(config) ? config[0] : config), [config])\n return useMemo<StudioTheme>(() => workspace?.theme || studioTheme, [workspace])\n}\n"],"names":[],"mappings":";;;;;;;;AAKO;;;AAOP;"}
|
package/dist/studio/useTheme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.js","sources":["../../src/studio/useTheme.ts"],"sourcesContent":["import {studioTheme} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport type {Config, SingleWorkspace, StudioTheme} from 'sanity'\n\n/** @alpha */\nexport function useTheme(\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>,\n): StudioTheme {\n const workspace = useMemo<\n SingleWorkspace | Required<Pick<SingleWorkspace, 'theme'>> | undefined\n >(() => (Array.isArray(config) ? config[0] : config), [config])\n return useMemo<StudioTheme>(() => workspace?.theme || studioTheme, [workspace])\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useTheme.js","sources":["../../src/studio/useTheme.ts"],"sourcesContent":["import {studioTheme} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport type {Config, SingleWorkspace, StudioTheme} from 'sanity'\n\n/** @alpha */\nexport function useTheme(\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>,\n): StudioTheme {\n const workspace = useMemo<\n SingleWorkspace | Required<Pick<SingleWorkspace, 'theme'>> | undefined\n >(() => (Array.isArray(config) ? config[0] : config), [config])\n return useMemo<StudioTheme>(() => workspace?.theme || studioTheme, [workspace])\n}\n"],"names":[],"mappings":";;;AAKO;;;AAOP;"}
|
package/dist/webhook/config.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","sources":["../../src/webhook/config.ts"],"sourcesContent":["import type {PageConfig} from 'next/types'\n\n/**\n * Configurates the API function with the right runtime and body parsing to handle Sanity Webhook events.\n * @public\n */\nexport const config: PageConfig = {\n api: {\n /**\n * Next.js will by default parse the body, which can lead to invalid signatures.\n */\n bodyParser: false,\n },\n /**\n * `@sanity/webhook` isn't updated to support the edge runtime yet, and currently requires Node.js APIs such as Buffer.\n */\n runtime: 'nodejs',\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"config.cjs","sources":["../../src/webhook/config.ts"],"sourcesContent":["import type {PageConfig} from 'next/types'\n\n/**\n * Configurates the API function with the right runtime and body parsing to handle Sanity Webhook events.\n * @public\n */\nexport const config: PageConfig = {\n api: {\n /**\n * Next.js will by default parse the body, which can lead to invalid signatures.\n */\n bodyParser: false,\n },\n /**\n * `@sanity/webhook` isn't updated to support the edge runtime yet, and currently requires Node.js APIs such as Buffer.\n */\n runtime: 'nodejs',\n}\n"],"names":["api","bodyParser","runtime"],"mappings":";;;;;;AAMO;AACLA;AAAK;AAAA;AAAA;AAIHC;;AACF;AAAA;AAAA;AAIAC;AACF;"}
|
package/dist/webhook/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../src/webhook/config.ts"],"sourcesContent":["import type {PageConfig} from 'next/types'\n\n/**\n * Configurates the API function with the right runtime and body parsing to handle Sanity Webhook events.\n * @public\n */\nexport const config: PageConfig = {\n api: {\n /**\n * Next.js will by default parse the body, which can lead to invalid signatures.\n */\n bodyParser: false,\n },\n /**\n * `@sanity/webhook` isn't updated to support the edge runtime yet, and currently requires Node.js APIs such as Buffer.\n */\n runtime: 'nodejs',\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../src/webhook/config.ts"],"sourcesContent":["import type {PageConfig} from 'next/types'\n\n/**\n * Configurates the API function with the right runtime and body parsing to handle Sanity Webhook events.\n * @public\n */\nexport const config: PageConfig = {\n api: {\n /**\n * Next.js will by default parse the body, which can lead to invalid signatures.\n */\n bodyParser: false,\n },\n /**\n * `@sanity/webhook` isn't updated to support the edge runtime yet, and currently requires Node.js APIs such as Buffer.\n */\n runtime: 'nodejs',\n}\n"],"names":["api","bodyParser","runtime"],"mappings":";AAMO;AACLA;AAAK;AAAA;AAAA;AAIHC;;AACF;AAAA;AAAA;AAIAC;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBody.cjs","sources":["../../src/webhook/parseBody.ts"],"sourcesContent":["import type {SanityDocument} from '@sanity/types'\nimport {isValidSignature, SIGNATURE_HEADER_NAME} from '@sanity/webhook'\nimport type {NextApiRequest} from 'next'\nimport type {NextRequest} from 'next/server'\n\nimport {_readBody as readBody} from './readBody'\n\n/** @public */\nexport type ParsedBody<T> = {\n /**\n * If a secret is given then it returns a boolean. If no secret is provided then no validation is done on the signature, and it'll return `null`\n */\n isValidSignature: boolean | null\n body: T | null\n}\n\n/**\n * @deprecated Use `ParsedBody` instead\n * @public\n */\nexport type ParseBody<Body = SanityDocument> = ParsedBody<Body>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\n// eslint-disable-next-line require-await\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest | NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n // @ts-expect-error -- add global typings for EdgeRuntime\n if (typeof EdgeRuntime !== 'undefined') {\n throw new TypeError(\n `The edge runtime isn't supported. You'll have to use the 'nodejs' runtime until the underlying \\`@sanity/webhook\\` package is updated to support it.`,\n )\n }\n return 'text' in req\n ? parseAppBody(req, secret, waitForContentLakeEventualConsistency)\n : parsePageBody(req, secret, waitForContentLakeEventualConsistency)\n}\n\nasync function parsePageBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n let signature = req.headers[SIGNATURE_HEADER_NAME]\n if (Array.isArray(signature)) {\n signature = signature[0]\n }\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n if (req.readableEnded) {\n throw new Error(\n `Request already ended and the POST body can't be read. Have you setup \\`export {config} from 'next-sanity/webhook' in your webhook API handler?\\``,\n )\n }\n\n const body = await readBody(req)\n const validSignature = secret ? isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 1000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n\n/**\n * @deprecated Use `ParsedBody` instead\n * @public\n */\nexport type ParseAppBody<Body = SanityDocument> = ParsedBody<Body>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @deprecated Use `parseBody` instead\n * @public\n */\nexport async function parseAppBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n const signature = req.headers.get(SIGNATURE_HEADER_NAME)!\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n const body = await req.text()\n const validSignature = secret ? isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 1000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"parseBody.cjs","sources":["../../src/webhook/parseBody.ts"],"sourcesContent":["import type {SanityDocument} from '@sanity/types'\nimport {isValidSignature, SIGNATURE_HEADER_NAME} from '@sanity/webhook'\nimport type {NextApiRequest} from 'next'\nimport type {NextRequest} from 'next/server'\n\nimport {_readBody as readBody} from './readBody'\n\n/** @public */\nexport type ParsedBody<T> = {\n /**\n * If a secret is given then it returns a boolean. If no secret is provided then no validation is done on the signature, and it'll return `null`\n */\n isValidSignature: boolean | null\n body: T | null\n}\n\n/**\n * @deprecated Use `ParsedBody` instead\n * @public\n */\nexport type ParseBody<Body = SanityDocument> = ParsedBody<Body>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\n// eslint-disable-next-line require-await\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest | NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n // @ts-expect-error -- add global typings for EdgeRuntime\n if (typeof EdgeRuntime !== 'undefined') {\n throw new TypeError(\n `The edge runtime isn't supported. You'll have to use the 'nodejs' runtime until the underlying \\`@sanity/webhook\\` package is updated to support it.`,\n )\n }\n return 'text' in req\n ? parseAppBody(req, secret, waitForContentLakeEventualConsistency)\n : parsePageBody(req, secret, waitForContentLakeEventualConsistency)\n}\n\nasync function parsePageBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n let signature = req.headers[SIGNATURE_HEADER_NAME]\n if (Array.isArray(signature)) {\n signature = signature[0]\n }\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n if (req.readableEnded) {\n throw new Error(\n `Request already ended and the POST body can't be read. Have you setup \\`export {config} from 'next-sanity/webhook' in your webhook API handler?\\``,\n )\n }\n\n const body = await readBody(req)\n const validSignature = secret ? isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 1000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n\n/**\n * @deprecated Use `ParsedBody` instead\n * @public\n */\nexport type ParseAppBody<Body = SanityDocument> = ParsedBody<Body>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @deprecated Use `parseBody` instead\n * @public\n */\nexport async function parseAppBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n const signature = req.headers.get(SIGNATURE_HEADER_NAME)!\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n const body = await req.text()\n const validSignature = secret ? isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 1000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n"],"names":["signature","console","body","isValidSignature"],"mappings":";;;;;;;;AA+CA;AAI6B;AAEvB;AACF;AAGF;;AAIF;AAEA;AAI6B;;AAEvB;AACFA;AACF;;AAEEC;;AACQC;AAAYC;;AACtB;;AAGE;AAGF;;AAGM;AAEF;;AAEJ;;AAGED;AACAC;;AAEJ;AAaA;AAI6B;;;AAGzBF;;AACQC;AAAYC;;AACtB;AAEM;AACA;AAEF;;AAEJ;;AAGED;AACAC;;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBody.js","sources":["../../src/webhook/parseBody.ts"],"sourcesContent":["import type {SanityDocument} from '@sanity/types'\nimport {isValidSignature, SIGNATURE_HEADER_NAME} from '@sanity/webhook'\nimport type {NextApiRequest} from 'next'\nimport type {NextRequest} from 'next/server'\n\nimport {_readBody as readBody} from './readBody'\n\n/** @public */\nexport type ParsedBody<T> = {\n /**\n * If a secret is given then it returns a boolean. If no secret is provided then no validation is done on the signature, and it'll return `null`\n */\n isValidSignature: boolean | null\n body: T | null\n}\n\n/**\n * @deprecated Use `ParsedBody` instead\n * @public\n */\nexport type ParseBody<Body = SanityDocument> = ParsedBody<Body>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\n// eslint-disable-next-line require-await\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest | NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n // @ts-expect-error -- add global typings for EdgeRuntime\n if (typeof EdgeRuntime !== 'undefined') {\n throw new TypeError(\n `The edge runtime isn't supported. You'll have to use the 'nodejs' runtime until the underlying \\`@sanity/webhook\\` package is updated to support it.`,\n )\n }\n return 'text' in req\n ? parseAppBody(req, secret, waitForContentLakeEventualConsistency)\n : parsePageBody(req, secret, waitForContentLakeEventualConsistency)\n}\n\nasync function parsePageBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n let signature = req.headers[SIGNATURE_HEADER_NAME]\n if (Array.isArray(signature)) {\n signature = signature[0]\n }\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n if (req.readableEnded) {\n throw new Error(\n `Request already ended and the POST body can't be read. Have you setup \\`export {config} from 'next-sanity/webhook' in your webhook API handler?\\``,\n )\n }\n\n const body = await readBody(req)\n const validSignature = secret ? isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 1000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n\n/**\n * @deprecated Use `ParsedBody` instead\n * @public\n */\nexport type ParseAppBody<Body = SanityDocument> = ParsedBody<Body>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @deprecated Use `parseBody` instead\n * @public\n */\nexport async function parseAppBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n const signature = req.headers.get(SIGNATURE_HEADER_NAME)!\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n const body = await req.text()\n const validSignature = secret ? isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 1000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"parseBody.js","sources":["../../src/webhook/parseBody.ts"],"sourcesContent":["import type {SanityDocument} from '@sanity/types'\nimport {isValidSignature, SIGNATURE_HEADER_NAME} from '@sanity/webhook'\nimport type {NextApiRequest} from 'next'\nimport type {NextRequest} from 'next/server'\n\nimport {_readBody as readBody} from './readBody'\n\n/** @public */\nexport type ParsedBody<T> = {\n /**\n * If a secret is given then it returns a boolean. If no secret is provided then no validation is done on the signature, and it'll return `null`\n */\n isValidSignature: boolean | null\n body: T | null\n}\n\n/**\n * @deprecated Use `ParsedBody` instead\n * @public\n */\nexport type ParseBody<Body = SanityDocument> = ParsedBody<Body>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\n// eslint-disable-next-line require-await\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest | NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n // @ts-expect-error -- add global typings for EdgeRuntime\n if (typeof EdgeRuntime !== 'undefined') {\n throw new TypeError(\n `The edge runtime isn't supported. You'll have to use the 'nodejs' runtime until the underlying \\`@sanity/webhook\\` package is updated to support it.`,\n )\n }\n return 'text' in req\n ? parseAppBody(req, secret, waitForContentLakeEventualConsistency)\n : parsePageBody(req, secret, waitForContentLakeEventualConsistency)\n}\n\nasync function parsePageBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n let signature = req.headers[SIGNATURE_HEADER_NAME]\n if (Array.isArray(signature)) {\n signature = signature[0]\n }\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n if (req.readableEnded) {\n throw new Error(\n `Request already ended and the POST body can't be read. Have you setup \\`export {config} from 'next-sanity/webhook' in your webhook API handler?\\``,\n )\n }\n\n const body = await readBody(req)\n const validSignature = secret ? isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 1000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n\n/**\n * @deprecated Use `ParsedBody` instead\n * @public\n */\nexport type ParseAppBody<Body = SanityDocument> = ParsedBody<Body>\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @deprecated Use `parseBody` instead\n * @public\n */\nexport async function parseAppBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n const signature = req.headers.get(SIGNATURE_HEADER_NAME)!\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n const body = await req.text()\n const validSignature = secret ? isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 1000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n"],"names":["signature","console","body","isValidSignature"],"mappings":";;;AA+CA;AAI6B;AAEvB;AACF;AAGF;;AAIF;AAEA;AAI6B;AACvB;AACA;AACFA;AACF;;AAEEC;;AACQC;AAAYC;;AACtB;;AAGE;AAGF;AAEM;AACA;AAEF;;AAEJ;;AAGED;AACAC;;AAEJ;AAaA;AAI6B;;;AAGzBF;;AACQC;AAAYC;;AACtB;AAEM;AACA;AAEF;;AAEJ;;AAGED;AACAC;;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readBody.cjs","sources":["../../src/webhook/readBody.ts"],"sourcesContent":["import type {NextApiRequest} from 'next'\n\n/** @internal */\nexport async function _readBody(readable: NextApiRequest): Promise<string> {\n const chunks = []\n for await (const chunk of readable) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)\n }\n return Buffer.concat(chunks).toString('utf8')\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"readBody.cjs","sources":["../../src/webhook/readBody.ts"],"sourcesContent":["import type {NextApiRequest} from 'next'\n\n/** @internal */\nexport async function _readBody(readable: NextApiRequest): Promise<string> {\n const chunks = []\n for await (const chunk of readable) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)\n }\n return Buffer.concat(chunks).toString('utf8')\n}\n"],"names":["chunks"],"mappings":";;;;;;AAGA;;AAEE;AACSA;AACT;;AAEF;"}
|
package/dist/webhook/readBody.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readBody.js","sources":["../../src/webhook/readBody.ts"],"sourcesContent":["import type {NextApiRequest} from 'next'\n\n/** @internal */\nexport async function _readBody(readable: NextApiRequest): Promise<string> {\n const chunks = []\n for await (const chunk of readable) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)\n }\n return Buffer.concat(chunks).toString('utf8')\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"readBody.js","sources":["../../src/webhook/readBody.ts"],"sourcesContent":["import type {NextApiRequest} from 'next'\n\n/** @internal */\nexport async function _readBody(readable: NextApiRequest): Promise<string> {\n const chunks = []\n for await (const chunk of readable) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)\n }\n return Buffer.concat(chunks).toString('utf8')\n}\n"],"names":["chunks"],"mappings":";AAGA;;AAEE;AACSA;AACT;;AAEF;"}
|
package/dist/webhook.cjs
CHANGED
package/dist/webhook.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhook.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
package/dist/webhook.js
CHANGED
package/dist/webhook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhook.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.6",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"lint": "eslint --max-warnings 0 .",
|
|
159
159
|
"prepublishOnly": "npm run build",
|
|
160
160
|
"prettier": "npx prettier --ignore-path .gitignore",
|
|
161
|
-
"test": "
|
|
161
|
+
"test": "vitest",
|
|
162
162
|
"test:node-esm-cjs": "node test.mjs && node test.cjs",
|
|
163
163
|
"type-check": "tsc --noEmit",
|
|
164
164
|
"update:icons": "cp node_modules/sanity/static/favicons/* src/studio/head"
|
|
@@ -174,53 +174,52 @@
|
|
|
174
174
|
"singleQuote": true
|
|
175
175
|
},
|
|
176
176
|
"dependencies": {
|
|
177
|
+
"@sanity/client": "^6.4.9",
|
|
177
178
|
"@sanity/preview-kit": "3.1.6",
|
|
178
179
|
"@sanity/webhook": "3.0.1",
|
|
179
|
-
"groq": "^3.0.0"
|
|
180
|
-
"@sanity/client": "^6.4.12"
|
|
180
|
+
"groq": "^3.0.0"
|
|
181
181
|
},
|
|
182
182
|
"devDependencies": {
|
|
183
|
-
"@next/bundle-analyzer": "^13.4
|
|
184
|
-
"@next/eslint-plugin-next": "13.4
|
|
185
|
-
"@rollup/plugin-url": "^8.0.
|
|
183
|
+
"@next/bundle-analyzer": "^13.5.4",
|
|
184
|
+
"@next/eslint-plugin-next": "13.5.4",
|
|
185
|
+
"@rollup/plugin-url": "^8.0.2",
|
|
186
186
|
"@sanity/eslint-config-studio": "^3.0.1",
|
|
187
187
|
"@sanity/image-url": "^1.0.2",
|
|
188
|
-
"@sanity/pkg-utils": "^
|
|
188
|
+
"@sanity/pkg-utils": "^3.0.0",
|
|
189
189
|
"@sanity/ui": "^1.8.2",
|
|
190
|
-
"@sanity/vision": "3.
|
|
191
|
-
"@types/
|
|
192
|
-
"@types/
|
|
193
|
-
"@types/
|
|
194
|
-
"@
|
|
195
|
-
"@
|
|
196
|
-
"
|
|
197
|
-
"
|
|
198
|
-
"eslint": "^8.49.0",
|
|
190
|
+
"@sanity/vision": "3.17.0",
|
|
191
|
+
"@types/react": "^18.2.28",
|
|
192
|
+
"@types/react-dom": "^18.2.13",
|
|
193
|
+
"@types/styled-components": "^5.1.28",
|
|
194
|
+
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
|
195
|
+
"@vitest/coverage-v8": "^0.34.6",
|
|
196
|
+
"autoprefixer": "^10.4.16",
|
|
197
|
+
"eslint": "^8.51.0",
|
|
199
198
|
"eslint-config-prettier": "^9.0.0",
|
|
200
|
-
"eslint-config-sanity": "^
|
|
199
|
+
"eslint-config-sanity": "^7.0.1",
|
|
201
200
|
"eslint-gitignore": "^0.1.0",
|
|
202
|
-
"eslint-plugin-prettier": "^5.0.
|
|
201
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
203
202
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
204
203
|
"groqd": "^0.15.9",
|
|
205
|
-
"jest": "^29.7.0",
|
|
206
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
207
204
|
"ls-engines": "^0.9.0",
|
|
208
|
-
"next": "13.4
|
|
209
|
-
"postcss": "^8.4.
|
|
205
|
+
"next": "13.5.4",
|
|
206
|
+
"postcss": "^8.4.31",
|
|
210
207
|
"prettier": "^3.0.3",
|
|
211
|
-
"prettier-plugin-packagejson": "^2.4.
|
|
212
|
-
"prettier-plugin-tailwindcss": "^0.5.
|
|
208
|
+
"prettier-plugin-packagejson": "^2.4.6",
|
|
209
|
+
"prettier-plugin-tailwindcss": "^0.5.5",
|
|
213
210
|
"react": "^18.2.0",
|
|
214
211
|
"react-dom": "^18.2.0",
|
|
215
212
|
"react-is": "^18.2.0",
|
|
216
|
-
"rollup": "^
|
|
217
|
-
"sanity": "3.
|
|
213
|
+
"rollup": "^4.0.2",
|
|
214
|
+
"sanity": "3.17.0",
|
|
218
215
|
"server-only": "^0.0.1",
|
|
219
216
|
"styled-components": "^5.3.11",
|
|
220
217
|
"suspend-react": "^0.1.3",
|
|
221
218
|
"tailwindcss": "^3.3.3",
|
|
222
219
|
"typescript": "^5.2.2",
|
|
223
|
-
"url-loader": "^4.1.1"
|
|
220
|
+
"url-loader": "^4.1.1",
|
|
221
|
+
"vitest": "^0.34.6",
|
|
222
|
+
"vitest-github-actions-reporter": "^0.10.0"
|
|
224
223
|
},
|
|
225
224
|
"peerDependencies": {
|
|
226
225
|
"@sanity/client": "^6.4.9",
|
|
@@ -233,6 +232,6 @@
|
|
|
233
232
|
"styled-components": "^5.2.0 || ^6.0.0"
|
|
234
233
|
},
|
|
235
234
|
"engines": {
|
|
236
|
-
"node": ">=
|
|
235
|
+
"node": ">=18"
|
|
237
236
|
}
|
|
238
237
|
}
|