next-sanity 8.0.0 → 8.0.2
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 +8 -8
- package/dist/index.cjs +1 -2
- package/dist/index.js +1 -2
- package/dist/preview/index.cjs +1 -2
- package/dist/preview/index.js +1 -2
- package/dist/preview/live-query.cjs +1 -2
- package/dist/preview/live-query.js +1 -2
- package/dist/studio/NextStudio.cjs +1 -2
- package/dist/studio/NextStudio.cjs.map +1 -1
- package/dist/studio/NextStudio.js +1 -2
- package/dist/studio/NextStudio.js.map +1 -1
- package/dist/studio/NextStudioLayout.cjs +1 -2
- package/dist/studio/NextStudioLayout.cjs.map +1 -1
- package/dist/studio/NextStudioLayout.js +1 -2
- package/dist/studio/NextStudioLayout.js.map +1 -1
- package/dist/studio/NextStudioNoScript.cjs +1 -2
- package/dist/studio/NextStudioNoScript.cjs.map +1 -1
- package/dist/studio/NextStudioNoScript.js +1 -2
- package/dist/studio/NextStudioNoScript.js.map +1 -1
- package/dist/studio/head.cjs +1 -2
- package/dist/studio/head.cjs.map +1 -1
- package/dist/studio/head.js +1 -2
- package/dist/studio/index.cjs +1 -2
- package/dist/studio/index.js +1 -2
- package/dist/studio/metadata.cjs +1 -2
- package/dist/studio/metadata.cjs.map +1 -1
- package/dist/studio/metadata.js +1 -2
- package/dist/studio/metadata.js.map +1 -1
- package/dist/studio/registry.cjs +1 -2
- package/dist/studio/registry.cjs.map +1 -1
- package/dist/studio/registry.js +1 -2
- package/dist/studio/registry.js.map +1 -1
- package/dist/studio/viewport.cjs +1 -2
- package/dist/studio/viewport.cjs.map +1 -1
- package/dist/studio/viewport.js +1 -2
- package/dist/studio/viewport.js.map +1 -1
- package/dist/visual-editing/VisualEditing.cjs +1 -2
- package/dist/visual-editing/VisualEditing.cjs.map +1 -1
- package/dist/visual-editing/VisualEditing.js +1 -2
- package/dist/visual-editing/VisualEditing.js.map +1 -1
- package/dist/visual-editing/index.cjs +1 -2
- package/dist/visual-editing/index.cjs.map +1 -1
- package/dist/visual-editing/index.js +1 -2
- package/dist/visual-editing/index.js.map +1 -1
- package/dist/webhook.cjs +1 -2
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.ts +3 -3
- package/dist/webhook.js +1 -2
- package/dist/webhook.js.map +1 -1
- package/package.json +26 -58
- package/src/webhook/index.ts +4 -4
package/README.md
CHANGED
|
@@ -749,12 +749,12 @@ MIT-licensed. See [LICENSE][LICENSE].
|
|
|
749
749
|
[groq-webhook]: https://www.sanity.io/docs/webhooks?utm_source=github&utm_medium=readme&utm_campaign=next-sanity
|
|
750
750
|
[image-url]: https://www.sanity.io/docs/presenting-images?utm_source=github&utm_medium=readme&utm_campaign=next-sanity
|
|
751
751
|
[LICENSE]: LICENSE
|
|
752
|
-
[migrate-v1-to-v4]:
|
|
753
|
-
[migrate-v4-to-v5-app]:
|
|
754
|
-
[migrate-v4-to-v5-pages]:
|
|
755
|
-
[migrate-v5-to-v6]:
|
|
756
|
-
[migrate-v6-to-v7]:
|
|
757
|
-
[migrate-v7-to-v8]:
|
|
752
|
+
[migrate-v1-to-v4]: https://github.com/sanity-io/next-sanity/blob/main/packages/next-sanity/MIGRATE-v1-to-v4.md
|
|
753
|
+
[migrate-v4-to-v5-app]: https://github.com/sanity-io/next-sanity/blob/main/packages/next-sanity/MIGRATE-v4-to-v5-app-router.md
|
|
754
|
+
[migrate-v4-to-v5-pages]: https://github.com/sanity-io/next-sanity/blob/main/packages/next-sanity/MIGRATE-v4-to-v5-pages-router.md
|
|
755
|
+
[migrate-v5-to-v6]: https://github.com/sanity-io/next-sanity/blob/main/packages/next-sanity/MIGRATE-v5-to-v6.md
|
|
756
|
+
[migrate-v6-to-v7]: https://github.com/sanity-io/next-sanity/blob/main/packages/next-sanity/MIGRATE-v6-to-v7.md
|
|
757
|
+
[migrate-v7-to-v8]: https://github.com/sanity-io/next-sanity/blob/main/packages/next-sanity/MIGRATE-v7-to-v8.md
|
|
758
758
|
[next-cache]: https://nextjs.org/docs/app/building-your-application/caching
|
|
759
759
|
[next-data-fetching]: https://nextjs.org/docs/basic-features/data-fetching/overview
|
|
760
760
|
[next-preview-mode]: https://nextjs.org/docs/advanced-features/preview-mode
|
|
@@ -763,12 +763,12 @@ MIT-licensed. See [LICENSE][LICENSE].
|
|
|
763
763
|
[personal-website-template]: https://github.com/sanity-io/sanity-template-nextjs-app-router-personal-website
|
|
764
764
|
[perspectives-docs]: https://www.sanity.io/docs/perspectives?utm_source=github&utm_medium=readme&utm_campaign=next-sanity
|
|
765
765
|
[portable-text]: https://portabletext.org
|
|
766
|
-
[preivew-app-router]:
|
|
766
|
+
[preivew-app-router]: https://github.com/sanity-io/next-sanity/blob/main/packages/next-sanity/PREVIEW-app-router.md
|
|
767
767
|
[preview-kit-client]: https://github.com/sanity-io/preview-kit#sanitypreview-kitclient
|
|
768
768
|
[preview-kit-documentation]: https://github.com/sanity-io/preview-kit#sanitypreview-kit-1
|
|
769
769
|
[preview-kit-livequery]: https://github.com/sanity-io/preview-kit#using-the-livequery-wrapper-component-instead-of-the-uselivequery-hook
|
|
770
770
|
[preview-kit]: https://github.com/sanity-io/preview-kit
|
|
771
|
-
[preview-pages-router]:
|
|
771
|
+
[preview-pages-router]: https://github.com/sanity-io/next-sanity/blob/main/packages/next-sanity/PREVIEW-pages-router.md
|
|
772
772
|
[revalidate-tag]: https://nextjs.org/docs/app/api-reference/functions/revalidateTag
|
|
773
773
|
[sales-cta]: https://www.sanity.io/contact/sales?utm_source=github&utm_medium=readme&utm_campaign=next-sanity
|
|
774
774
|
[sanity-client]: https://www.sanity.io/docs/js-client?utm_source=github&utm_medium=readme&utm_campaign=next-sanity
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/client"),t=require("./visual-editing/index.cjs");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(require("groq"));Object.defineProperty(exports,"createClient",{enumerable:!0,get:function(){return e.createClient}}),Object.defineProperty(exports,"unstable__adapter",{enumerable:!0,get:function(){return e.unstable__adapter}}),Object.defineProperty(exports,"unstable__environment",{enumerable:!0,get:function(){return e.unstable__environment}}),exports.VisualEditing=t.VisualEditing,Object.defineProperty(exports,"groq",{enumerable:!0,get:function(){return n.default}})
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/client"),t=require("./visual-editing/index.cjs");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(require("groq"));Object.defineProperty(exports,"createClient",{enumerable:!0,get:function(){return e.createClient}}),Object.defineProperty(exports,"unstable__adapter",{enumerable:!0,get:function(){return e.unstable__adapter}}),Object.defineProperty(exports,"unstable__environment",{enumerable:!0,get:function(){return e.unstable__environment}}),exports.VisualEditing=t.VisualEditing,Object.defineProperty(exports,"groq",{enumerable:!0,get:function(){return n.default}});//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{createClient as i,unstable__adapter as o,unstable__environment as r}from"@sanity/client";import{VisualEditing as t}from"./visual-editing/index.js";import{default as m}from"groq";export{t as VisualEditing,i as createClient,m as groq,o as unstable__adapter,r as unstable__environment};//# sourceMappingURL=index.js.map
|
package/dist/preview/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/preview-kit");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=r(e);Object.defineProperty(exports,"LiveQueryProvider",{enumerable:!0,get:function(){return e.LiveQueryProvider}}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"useLiveQuery",{enumerable:!0,get:function(){return e.useLiveQuery}})
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/preview-kit");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=r(e);Object.defineProperty(exports,"LiveQueryProvider",{enumerable:!0,get:function(){return e.LiveQueryProvider}}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(exports,"useLiveQuery",{enumerable:!0,get:function(){return e.useLiveQuery}});//# sourceMappingURL=index.cjs.map
|
package/dist/preview/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{LiveQueryProvider as t,default as a,useLiveQuery as e}from"@sanity/preview-kit";export{t as LiveQueryProvider,a as default,e as useLiveQuery};//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/preview-kit/live-query");Object.defineProperty(exports,"LiveQuery",{enumerable:!0,get:function(){return e.LiveQuery}}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e.LiveQuery}})
|
|
2
|
-
//# sourceMappingURL=live-query.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/preview-kit/live-query");Object.defineProperty(exports,"LiveQuery",{enumerable:!0,get:function(){return e.LiveQuery}}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e.LiveQuery}});//# sourceMappingURL=live-query.cjs.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=live-query.js.map
|
|
1
|
+
import{LiveQuery as e,LiveQuery as i}from"@sanity/preview-kit/live-query";export{e as LiveQuery,i as default};//# sourceMappingURL=live-query.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("sanity"),i=require("./NextStudioLayout.cjs"),s=require("./NextStudioNoScript.cjs"),o=require("./registry.cjs");const u=t.memo((({children:t,config:u,unstable__noScript:c=!0,scheme:n,...d})=>e.jsxs(e.Fragment,{children:[c&&e.jsx(s.NextStudioNoScript,{}),e.jsx(o.StyledComponentsRegistry,{children:e.jsx(i.NextStudioLayout,{children:t||e.jsx(r.Studio,{config:u,scheme:n,unstable_globalStyles:!0,...d})})})]})));exports.NextStudio=u
|
|
2
|
-
//# sourceMappingURL=NextStudio.cjs.map
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("sanity"),i=require("./NextStudioLayout.cjs"),s=require("./NextStudioNoScript.cjs"),o=require("./registry.cjs");const u=t.memo((({children:t,config:u,unstable__noScript:c=!0,scheme:n,...d})=>e.jsxs(e.Fragment,{children:[c&&e.jsx(s.NextStudioNoScript,{}),e.jsx(o.StyledComponentsRegistry,{children:e.jsx(i.NextStudioLayout,{children:t||e.jsx(r.Studio,{config:u,scheme:n,unstable_globalStyles:!0,...d})})})]})));exports.NextStudio=u;//# sourceMappingURL=NextStudio.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudio.cjs","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["'use client'\n\nimport {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {StyledComponentsRegistry} from './registry'\n\n/** @public */\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/**\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 scheme,\n ...props\n}: NextStudioProps) => {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <StyledComponentsRegistry>\n <NextStudioLayout>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </StyledComponentsRegistry>\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 * @public\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["NextStudio","memo","children","config","unstable__noScript","scheme","props","jsxs","Fragment","NextStudioNoScript","
|
|
1
|
+
{"version":3,"file":"NextStudio.cjs","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["'use client'\n\nimport {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {StyledComponentsRegistry} from './registry'\n\n/** @public */\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/**\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 scheme,\n ...props\n}: NextStudioProps) => {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <StyledComponentsRegistry>\n <NextStudioLayout>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </StyledComponentsRegistry>\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 * @public\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["NextStudio","memo","children","config","unstable__noScript","scheme","props","jsxRuntime","jsxs","Fragment","NextStudioNoScript","StyledComponentsRegistry","jsx","NextStudioLayout","Studio","unstable_globalStyles","exports"],"mappings":"iQAuBA,MAoCaA,EAAaC,QApCE,EAC1BC,WACAC,SACAC,sBAAqB,EACrBC,YACGC,KAIEC,EAAAC,KAAAC,WAAA,CAAAP,SAAA,CAAAE,SAAuBM,EAAmBA,mBAAA,UAC1CC,EAAAA,yBAAA,CACCT,SAACU,EAAAA,IAAAC,EAAAA,iBAAA,CACEX,YACEU,EAAAA,IAAAE,EAAAA,OAAA,CAAOX,SAAgBE,SAAgBU,uBAAqB,KAAKT,aAuB5BU,QAAAhB,WAAAA"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as r,Fragment as t,jsx as o}from"react/jsx-runtime";import{memo as e}from"react";import{Studio as i}from"sanity";import{NextStudioLayout as m}from"./NextStudioLayout.js";import{NextStudioNoScript as c}from"./NextStudioNoScript.js";import{StyledComponentsRegistry as n}from"./registry.js";const s=e((({children:e,config:s,unstable__noScript:l=!0,scheme:p,...f})=>r(t,{children:[l&&o(c,{}),o(n,{children:o(m,{children:e||o(i,{config:s,scheme:p,unstable_globalStyles:!0,...f})})})]})));export{s as NextStudio}
|
|
2
|
-
//# sourceMappingURL=NextStudio.js.map
|
|
1
|
+
"use client";import{jsxs as r,Fragment as t,jsx as o}from"react/jsx-runtime";import{memo as e}from"react";import{Studio as i}from"sanity";import{NextStudioLayout as m}from"./NextStudioLayout.js";import{NextStudioNoScript as c}from"./NextStudioNoScript.js";import{StyledComponentsRegistry as n}from"./registry.js";const s=e((({children:e,config:s,unstable__noScript:l=!0,scheme:p,...f})=>r(t,{children:[l&&o(c,{}),o(n,{children:o(m,{children:e||o(i,{config:s,scheme:p,unstable_globalStyles:!0,...f})})})]})));export{s as NextStudio};//# sourceMappingURL=NextStudio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudio.js","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["'use client'\n\nimport {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {StyledComponentsRegistry} from './registry'\n\n/** @public */\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/**\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 scheme,\n ...props\n}: NextStudioProps) => {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <StyledComponentsRegistry>\n <NextStudioLayout>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </StyledComponentsRegistry>\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 * @public\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["NextStudio","memo","children","config","unstable__noScript","scheme","props","jsxs","Fragment","NextStudioNoScript","jsx","StyledComponentsRegistry","NextStudioLayout","Studio","unstable_globalStyles"],"mappings":"yTAuBA,MAoCaA,EAAaC,GApCE,EAC1BC,WACAC,SACAC,sBAAqB,EACrBC,YACGC,KAIEC,EAAAC,EAAA,CAAAN,SAAA,CAAAE,KAAuBK,EAAmB,IAC1CC,EAAAC,EAAA,CACCT,
|
|
1
|
+
{"version":3,"file":"NextStudio.js","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["'use client'\n\nimport {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {StyledComponentsRegistry} from './registry'\n\n/** @public */\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/**\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 scheme,\n ...props\n}: NextStudioProps) => {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <StyledComponentsRegistry>\n <NextStudioLayout>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </StyledComponentsRegistry>\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 * @public\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["NextStudio","memo","children","config","unstable__noScript","scheme","props","jsxs","Fragment","NextStudioNoScript","jsx","StyledComponentsRegistry","NextStudioLayout","Studio","unstable_globalStyles"],"mappings":"yTAuBA,MAoCaA,EAAaC,GApCE,EAC1BC,WACAC,SACAC,sBAAqB,EACrBC,YACGC,KAIEC,EAAAC,EAAA,CAAAN,SAAA,CAAAE,KAAuBK,EAAmB,IAC1CC,EAAAC,EAAA,CACCT,WAACU,EAAA,CACEV,YACEQ,EAAAG,EAAA,CAAOV,SAAgBE,SAAgBS,uBAAqB,KAAKR"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");const t=require("react").memo((({children:t})=>e.jsx("div",{id:"sanity","data-ui":"NextStudioLayout",style:{height:"100vh",maxHeight:"100dvh",overscrollBehavior:"none",WebkitFontSmoothing:"antialiased",overflow:"auto"},children:t})));exports.NextStudioLayout=t
|
|
2
|
-
//# sourceMappingURL=NextStudioLayout.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");const t=require("react").memo((({children:t})=>e.jsx("div",{id:"sanity","data-ui":"NextStudioLayout",style:{height:"100vh",maxHeight:"100dvh",overscrollBehavior:"none",WebkitFontSmoothing:"antialiased",overflow:"auto"},children:t})));exports.NextStudioLayout=t;//# sourceMappingURL=NextStudioLayout.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioLayout.cjs","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["import {memo} from 'react'\n\n/** @public */\nexport interface NextStudioLayoutProps {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({children}: NextStudioLayoutProps) => {\n return (\n <div\n id=\"sanity\"\n data-ui=\"NextStudioLayout\"\n style={{\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/** @public */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["NextStudioLayout","children","jsx","id","style","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow"],"mappings":"
|
|
1
|
+
{"version":3,"file":"NextStudioLayout.cjs","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["import {memo} from 'react'\n\n/** @public */\nexport interface NextStudioLayoutProps {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({children}: NextStudioLayoutProps) => {\n return (\n <div\n id=\"sanity\"\n data-ui=\"NextStudioLayout\"\n style={{\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/** @public */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["Object","defineProperty","exports","value","jsxRuntime","require","NextStudioLayout","children","jsx","id","style","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow"],"mappings":"aAOAA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IAAA,IAAAC,EAAAC,QAAA,qBAAA,MAmBaC,EAnBbD,QAAA,eAAkC,EAAEE,cAEhCH,EAAAI,IAAC,MAAA,CACCC,GAAG,SACH,UAAQ,mBACRC,MAAO,CACLC,OAAQ,QACRC,UAAW,SACXC,mBAAoB,OACpBC,oBAAqB,cACrBC,SAAU,QAGXR,eAMuDL,QAAAI,iBAAAA"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{memo as o}from"react";const i=o((({children:o})=>t("div",{id:"sanity","data-ui":"NextStudioLayout",style:{height:"100vh",maxHeight:"100dvh",overscrollBehavior:"none",WebkitFontSmoothing:"antialiased",overflow:"auto"},children:o})));export{i as NextStudioLayout}
|
|
2
|
-
//# sourceMappingURL=NextStudioLayout.js.map
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{memo as o}from"react";const i=o((({children:o})=>t("div",{id:"sanity","data-ui":"NextStudioLayout",style:{height:"100vh",maxHeight:"100dvh",overscrollBehavior:"none",WebkitFontSmoothing:"antialiased",overflow:"auto"},children:o})));export{i as NextStudioLayout};//# sourceMappingURL=NextStudioLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioLayout.js","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["import {memo} from 'react'\n\n/** @public */\nexport interface NextStudioLayoutProps {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({children}: NextStudioLayoutProps) => {\n return (\n <div\n id=\"sanity\"\n data-ui=\"NextStudioLayout\"\n style={{\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/** @public */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["
|
|
1
|
+
{"version":3,"file":"NextStudioLayout.js","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["import {memo} from 'react'\n\n/** @public */\nexport interface NextStudioLayoutProps {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({children}: NextStudioLayoutProps) => {\n return (\n <div\n id=\"sanity\"\n data-ui=\"NextStudioLayout\"\n style={{\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/** @public */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["jsx","memo","NextStudioLayout","children","id","style","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow"],"mappings":"cAOAA,MAAA,mCAAAC,MAAA,QAAA,MAmBaC,EAAmBD,GAnBE,EAAEE,cAEhCH,EAAC,MAAA,CACCI,GAAG,SACH,UAAQ,mBACRC,MAAO,CACLC,OAAQ,QACRC,UAAW,SACXC,mBAAoB,OACpBC,oBAAqB,cACrBC,SAAU,QAGXP"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react/jsx-runtime");const e={__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"};exports.NextStudioNoScript=()=>n.jsx("noscript",{children:n.jsx("div",{className:"sanity-app-no-js__root",children:n.jsxs("div",{className:"sanity-app-no-js__content",children:[n.jsx("style",{type:"text/css",dangerouslySetInnerHTML:e}),n.jsx("h1",{children:"JavaScript disabled"}),n.jsxs("p",{children:["Please ",n.jsx("a",{href:"https://www.enable-javascript.com/",children:"enable JavaScript"})," in your browser and reload the page to proceed."]})]})})})
|
|
2
|
-
//# sourceMappingURL=NextStudioNoScript.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react/jsx-runtime");const e={__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"};exports.NextStudioNoScript=()=>n.jsx("noscript",{children:n.jsx("div",{className:"sanity-app-no-js__root",children:n.jsxs("div",{className:"sanity-app-no-js__content",children:[n.jsx("style",{type:"text/css",dangerouslySetInnerHTML:e}),n.jsx("h1",{children:"JavaScript disabled"}),n.jsxs("p",{children:["Please ",n.jsx("a",{href:"https://www.enable-javascript.com/",children:"enable JavaScript"})," in your browser and reload the page to proceed."]})]})})});//# sourceMappingURL=NextStudioNoScript.cjs.map
|
|
@@ -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/** @internal */\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":["style","__html","jsx","children","className","
|
|
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/** @internal */\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":["Object","defineProperty","exports","value","jsxRuntime","require","style","__html","NextStudioNoScript","jsx","children","className","type","dangerouslySetInnerHTML","href"],"mappings":"aAEAA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IAAA,IAAAC,EAAAC,QAAA,qBAAA,MAAMC,EAAQ,CACZC,OAAQ,gVAmCRL,QAAAM,mBAZgC,IAChCC,EAAAA,IAAC,WACC,CAAAC,WAAAD,IAAC,MAAI,CAAAE,UAAU,yBACbD,gBAAC,MAAI,CAAAC,UAAU,4BACbD,SAAA,CAAAD,EAAAA,IAAC,QAAM,CAAAG,KAAK,WAAWC,wBAAyBP,MAChDG,IAAC,MAAGC,SAAmB,+BACtB,IAAE,CAAAA,SAAA,CAAA,UACOD,EAAAA,IAAA,IAAA,CAAEK,KAAK,qCAAqCJ,SAAiB,sBAAI"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{jsx as n,jsxs as t}from"react/jsx-runtime";const e={__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"},a=()=>n("noscript",{children:n("div",{className:"sanity-app-no-js__root",children:t("div",{className:"sanity-app-no-js__content",children:[n("style",{type:"text/css",dangerouslySetInnerHTML:e}),n("h1",{children:"JavaScript disabled"}),t("p",{children:["Please ",n("a",{href:"https://www.enable-javascript.com/",children:"enable JavaScript"})," in your browser and reload the page to proceed."]})]})})});export{a as NextStudioNoScript}
|
|
2
|
-
//# sourceMappingURL=NextStudioNoScript.js.map
|
|
1
|
+
import{jsx as n,jsxs as t}from"react/jsx-runtime";const e={__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"},a=()=>n("noscript",{children:n("div",{className:"sanity-app-no-js__root",children:t("div",{className:"sanity-app-no-js__content",children:[n("style",{type:"text/css",dangerouslySetInnerHTML:e}),n("h1",{children:"JavaScript disabled"}),t("p",{children:["Please ",n("a",{href:"https://www.enable-javascript.com/",children:"enable JavaScript"})," in your browser and reload the page to proceed."]})]})})});export{a as NextStudioNoScript};//# sourceMappingURL=NextStudioNoScript.js.map
|
|
@@ -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/** @internal */\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/** @internal */\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":["jsx","jsxs","style","__html","NextStudioNoScript","children","className","type","dangerouslySetInnerHTML","href"],"mappings":"cAEAA,UAAAC,MAAA,oBAAA,MAAMC,EAAQ,CACZC,OAAQ,gVAuBGC,EAAqB,IAChCJ,EAAC,WACC,CAAAK,SAACL,EAAA,MAAI,CAAAM,UAAU,yBACbD,SAAAJ,EAAC,MAAI,CAAAK,UAAU,4BACbD,SAAA,GAAC,QAAM,CAAAE,KAAK,WAAWC,wBAAyBN,IAC/CF,EAAA,MAAGK,SAAmB,0BACtB,IAAE,CAAAA,SAAA,CAAA,YACO,IAAA,CAAEI,KAAK,qCAAqCJ,SAAiB,sBAAI"}
|
package/dist/studio/head.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata={referrer:"same-origin",robots:"noindex"},exports.viewport={width:"device-width",initialScale:1,viewportFit:"cover"}
|
|
2
|
-
//# sourceMappingURL=head.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata={referrer:"same-origin",robots:"noindex"},exports.viewport={width:"device-width",initialScale:1,viewportFit:"cover"};//# sourceMappingURL=head.cjs.map
|
package/dist/studio/head.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"head.cjs","sources":["../../src/studio/head.tsx"],"sourcesContent":["import type {Metadata, Viewport} from 'next'\n\n/**\n * In router segments (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the viewport config directly:\n * export {viewport} from 'next-sanity/studio'\n *\n * // To customize the viewport config, spread it on the export:\n * import {viewport as studioViewport} from 'next-sanity/studio'\n * import type { Viewport } from 'next'\n *\n * export const viewport: Viewport = {\n * ...studioViewport,\n * // Overrides the viewport to resize behavior\n * interactiveWidget: 'resizes-content'\n * })\n * ```\n * @public\n */\nexport const viewport = {\n width: 'device-width',\n initialScale: 1,\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n viewportFit: 'cover',\n} satisfies Viewport\n\n/**\n * In router segments (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the metadata directly:\n * export {metadata} from 'next-sanity/studio'\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 * // Set another title\n * title: 'My Studio',\n * })\n * ```\n * @public\n */\nexport const metadata = {\n referrer: 'same-origin' as const,\n robots: 'noindex' as const,\n} satisfies Metadata\n"],"names":["referrer","robots","width","initialScale","viewportFit"],"mappings":"
|
|
1
|
+
{"version":3,"file":"head.cjs","sources":["../../src/studio/head.tsx"],"sourcesContent":["import type {Metadata, Viewport} from 'next'\n\n/**\n * In router segments (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the viewport config directly:\n * export {viewport} from 'next-sanity/studio'\n *\n * // To customize the viewport config, spread it on the export:\n * import {viewport as studioViewport} from 'next-sanity/studio'\n * import type { Viewport } from 'next'\n *\n * export const viewport: Viewport = {\n * ...studioViewport,\n * // Overrides the viewport to resize behavior\n * interactiveWidget: 'resizes-content'\n * })\n * ```\n * @public\n */\nexport const viewport = {\n width: 'device-width',\n initialScale: 1,\n // Studio implements display cutouts CSS (The iPhone Notch ™ ) and needs `viewport-fit=covered` for it to work correctly\n viewportFit: 'cover',\n} satisfies Viewport\n\n/**\n * In router segments (`/app/studio/[[...index]]/page.tsx`):\n * ```tsx\n * // If you don't want to change any defaults you can just re-export the metadata directly:\n * export {metadata} from 'next-sanity/studio'\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 * // Set another title\n * title: 'My Studio',\n * })\n * ```\n * @public\n */\nexport const metadata = {\n referrer: 'same-origin' as const,\n robots: 'noindex' as const,\n} satisfies Metadata\n"],"names":["Object","defineProperty","exports","value","metadata","referrer","robots","viewport","width","initialScale","viewportFit"],"mappings":"aAoBOA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IA4BPD,QAAAE,SAHwB,CACtBC,SAAU,cACVC,OAAQ,WACVJ,QAAAK,SA5BwB,CACtBC,MAAO,eACPC,aAAc,EAEdC,YAAa"}
|
package/dist/studio/head.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
const e={width:"device-width",initialScale:1,viewportFit:"cover"},i={referrer:"same-origin",robots:"noindex"};export{i as metadata,e as viewport}
|
|
2
|
-
//# sourceMappingURL=head.js.map
|
|
1
|
+
const e={width:"device-width",initialScale:1,viewportFit:"cover"},i={referrer:"same-origin",robots:"noindex"};export{i as metadata,e as viewport};//# sourceMappingURL=head.js.map
|
package/dist/studio/index.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./head.cjs"),e=require("./NextStudio.cjs"),o=require("./NextStudioLayout.cjs"),r=require("./NextStudioNoScript.cjs");exports.metadata=t.metadata,exports.viewport=t.viewport,exports.NextStudio=e.NextStudio,exports.NextStudioLayout=o.NextStudioLayout,exports.NextStudioNoScript=r.NextStudioNoScript
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./head.cjs"),e=require("./NextStudio.cjs"),o=require("./NextStudioLayout.cjs"),r=require("./NextStudioNoScript.cjs");exports.metadata=t.metadata,exports.viewport=t.viewport,exports.NextStudio=e.NextStudio,exports.NextStudioLayout=o.NextStudioLayout,exports.NextStudioNoScript=r.NextStudioNoScript;//# sourceMappingURL=index.cjs.map
|
package/dist/studio/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{metadata as o,viewport as t}from"./head.js";import{NextStudio as r}from"./NextStudio.js";import{NextStudioLayout as i}from"./NextStudioLayout.js";import{NextStudioNoScript as m}from"./NextStudioNoScript.js";export{r as NextStudio,i as NextStudioLayout,m as NextStudioNoScript,o as metadata,t as viewport};//# sourceMappingURL=index.js.map
|
package/dist/studio/metadata.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("./head.cjs").metadata;exports.metadata=e
|
|
2
|
-
//# sourceMappingURL=metadata.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("./head.cjs").metadata;exports.metadata=e;//# sourceMappingURL=metadata.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.cjs","sources":["../../src/studio/metadata.ts"],"sourcesContent":["import type {Metadata} from 'next'\n\nimport {metadata as _metadata} from './head'\n\n/**\n * @public\n * @deprecated use `export {metadata} from 'next-sanity/studio'` instead\n */\nexport const metadata = _metadata satisfies Metadata\n"],"names":["metadata","_metadata"],"mappings":"
|
|
1
|
+
{"version":3,"file":"metadata.cjs","sources":["../../src/studio/metadata.ts"],"sourcesContent":["import type {Metadata} from 'next'\n\nimport {metadata as _metadata} from './head'\n\n/**\n * @public\n * @deprecated use `export {metadata} from 'next-sanity/studio'` instead\n */\nexport const metadata = _metadata satisfies Metadata\n"],"names":["Object","defineProperty","exports","value","metadata","require","_metadata"],"mappings":"aAQOA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IAAA,MAAMC,EAANC,QAAA,cAAiBC,SAAAA,QAAAA,SAAAA"}
|
package/dist/studio/metadata.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{metadata as a}from"./head.js";const t=a;export{t as metadata}
|
|
2
|
-
//# sourceMappingURL=metadata.js.map
|
|
1
|
+
import{metadata as a}from"./head.js";const t=a;export{t as metadata};//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sources":["../../src/studio/metadata.ts"],"sourcesContent":["import type {Metadata} from 'next'\n\nimport {metadata as _metadata} from './head'\n\n/**\n * @public\n * @deprecated use `export {metadata} from 'next-sanity/studio'` instead\n */\nexport const metadata = _metadata satisfies Metadata\n"],"names":["metadata","_metadata"],"mappings":"
|
|
1
|
+
{"version":3,"file":"metadata.js","sources":["../../src/studio/metadata.ts"],"sourcesContent":["import type {Metadata} from 'next'\n\nimport {metadata as _metadata} from './head'\n\n/**\n * @public\n * @deprecated use `export {metadata} from 'next-sanity/studio'` instead\n */\nexport const metadata = _metadata satisfies Metadata\n"],"names":["metadata$1","metadata","_metadata"],"mappings":"mBAQOA,MAAA,YAAA,MAAMC,EAAWC"}
|
package/dist/studio/registry.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("next/navigation.js"),r=require("react"),n=require("styled-components");exports.StyledComponentsRegistry=function({children:s}){const[i]=r.useState((()=>new n.ServerStyleSheet));return t.useServerInsertedHTML((()=>{const t=i.getStyleElement();return i.instance.clearTag(),e.jsx(e.Fragment,{children:t})})),
|
|
2
|
-
//# sourceMappingURL=registry.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("next/navigation.js"),r=require("react"),n=require("styled-components");exports.StyledComponentsRegistry=function({children:s}){const[i]=r.useState((()=>new n.ServerStyleSheet));return t.useServerInsertedHTML((()=>{const t=i.getStyleElement();return i.instance.clearTag(),e.jsx(e.Fragment,{children:t})})),typeof window<"u"?e.jsx(e.Fragment,{children:s}):e.jsx(n.StyleSheetManager,{sheet:i.instance,children:s})};//# sourceMappingURL=registry.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.cjs","sources":["../../src/studio/registry.tsx"],"sourcesContent":["// https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components\nimport {useServerInsertedHTML} from 'next/navigation.js'\nimport {useState} from 'react'\nimport {ServerStyleSheet, StyleSheetManager} from 'styled-components'\n\nexport function StyledComponentsRegistry({children}: {children: React.ReactNode}) {\n // Only create stylesheet once with lazy initial state\n // x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state\n const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet())\n\n useServerInsertedHTML(() => {\n const styles = styledComponentsStyleSheet.getStyleElement()\n styledComponentsStyleSheet.instance.clearTag()\n return <>{styles}</>\n })\n\n if (typeof window !== 'undefined') return <>{children}</>\n\n return (\n <StyleSheetManager sheet={styledComponentsStyleSheet.instance}>{children}</StyleSheetManager>\n )\n}\n"],"names":["children","styledComponentsStyleSheet","useState","ServerStyleSheet","useServerInsertedHTML","styles","getStyleElement","instance","clearTag","
|
|
1
|
+
{"version":3,"file":"registry.cjs","sources":["../../src/studio/registry.tsx"],"sourcesContent":["// https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components\nimport {useServerInsertedHTML} from 'next/navigation.js'\nimport {useState} from 'react'\nimport {ServerStyleSheet, StyleSheetManager} from 'styled-components'\n\nexport function StyledComponentsRegistry({children}: {children: React.ReactNode}) {\n // Only create stylesheet once with lazy initial state\n // x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state\n const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet())\n\n useServerInsertedHTML(() => {\n const styles = styledComponentsStyleSheet.getStyleElement()\n styledComponentsStyleSheet.instance.clearTag()\n return <>{styles}</>\n })\n\n if (typeof window !== 'undefined') return <>{children}</>\n\n return (\n <StyleSheetManager sheet={styledComponentsStyleSheet.instance}>{children}</StyleSheetManager>\n )\n}\n"],"names":["Object","defineProperty","exports","value","jsxRuntime","require","navigation_js","react","styledComponents","StyledComponentsRegistry","children","styledComponentsStyleSheet","useState","ServerStyleSheet","useServerInsertedHTML","styles","getStyleElement","instance","clearTag","jsx","Fragment","window","StyleSheetManager","sheet"],"mappings":"aAKgBA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IAAA,IAAAC,EAAAC,QAAA,qBAAAC,EAAAD,QAAA,sBAAAE,EAAAF,QAAA,SAAAG,EAAAH,QAAA,qBAgBhBH,QAAAO,yBAhBgB,UAAyBC,SAACA,IAGlC,MAACC,GAA8BC,EAAAA,UAAS,IAAM,IAAIC,EAAAA,mBAExDC,OAAAA,yBAAsB,KACd,MAAAC,EAASJ,EAA2BK,kBAC1C,OAAAL,EAA2BM,SAASC,WAC7BC,EAAAA,IAAAC,EAAAA,SAAA,CAAGV,SAAOK,GAAA,WAGRM,OAAW,IAAoBF,EAAAA,IAAAC,EAAAA,SAAA,CAAGV,aAG1CS,EAAAA,IAAAG,EAAAA,kBAAA,CAAkBC,MAAOZ,EAA2BM,SAAWP,YAEpE"}
|
package/dist/studio/registry.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as
|
|
2
|
-
//# sourceMappingURL=registry.js.map
|
|
1
|
+
import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useServerInsertedHTML as n}from"next/navigation.js";import{useState as r}from"react";import{ServerStyleSheet as o,StyleSheetManager as i}from"styled-components";function c({children:c}){const[m]=r((()=>new o));return n((()=>{const n=m.getStyleElement();return m.instance.clearTag(),e(t,{children:n})})),typeof window<"u"?e(t,{children:c}):e(i,{sheet:m.instance,children:c})}export{c as StyledComponentsRegistry};//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sources":["../../src/studio/registry.tsx"],"sourcesContent":["// https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components\nimport {useServerInsertedHTML} from 'next/navigation.js'\nimport {useState} from 'react'\nimport {ServerStyleSheet, StyleSheetManager} from 'styled-components'\n\nexport function StyledComponentsRegistry({children}: {children: React.ReactNode}) {\n // Only create stylesheet once with lazy initial state\n // x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state\n const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet())\n\n useServerInsertedHTML(() => {\n const styles = styledComponentsStyleSheet.getStyleElement()\n styledComponentsStyleSheet.instance.clearTag()\n return <>{styles}</>\n })\n\n if (typeof window !== 'undefined') return <>{children}</>\n\n return (\n <StyleSheetManager sheet={styledComponentsStyleSheet.instance}>{children}</StyleSheetManager>\n )\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"registry.js","sources":["../../src/studio/registry.tsx"],"sourcesContent":["// https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components\nimport {useServerInsertedHTML} from 'next/navigation.js'\nimport {useState} from 'react'\nimport {ServerStyleSheet, StyleSheetManager} from 'styled-components'\n\nexport function StyledComponentsRegistry({children}: {children: React.ReactNode}) {\n // Only create stylesheet once with lazy initial state\n // x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state\n const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet())\n\n useServerInsertedHTML(() => {\n const styles = styledComponentsStyleSheet.getStyleElement()\n styledComponentsStyleSheet.instance.clearTag()\n return <>{styles}</>\n })\n\n if (typeof window !== 'undefined') return <>{children}</>\n\n return (\n <StyleSheetManager sheet={styledComponentsStyleSheet.instance}>{children}</StyleSheetManager>\n )\n}\n"],"names":["jsx","Fragment","useServerInsertedHTML","useState","ServerStyleSheet","StyleSheetManager","StyledComponentsRegistry","children","styledComponentsStyleSheet","styles","getStyleElement","instance","clearTag","window","sheet"],"mappings":"cAKgBA,cAAAC,MAAA,oDAAAC,MAAA,wCAAAC,MAAA,mCAAAC,uBAAAC,MAAA,oBAAA,SAAAC,GAAyBC,SAACA,IAGxC,MAAOC,GAA8BL,GAAS,IAAM,IAAIC,IAQxD,OANAF,GAAsB,KACd,MAAAO,EAASD,EAA2BE,kBAC1C,OAAAF,EAA2BG,SAASC,aAC7BX,EAAA,CAAGM,SAAOE,GAAA,WAGRI,OAAW,IAAoBb,EAAAC,EAAA,CAAGM,eAG1CF,EAAA,CAAkBS,MAAON,EAA2BG,SAAWJ,YAEpE"}
|
package/dist/studio/viewport.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("./head.cjs").viewport;exports.viewport=e
|
|
2
|
-
//# sourceMappingURL=viewport.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("./head.cjs").viewport;exports.viewport=e;//# sourceMappingURL=viewport.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.cjs","sources":["../../src/studio/viewport.ts"],"sourcesContent":["import type {Viewport} from 'next'\n\nimport {viewport as _viewport} from './head'\n\n/**\n * @public\n * @deprecated use `export {viewport} from 'next-sanity/studio'` instead\n */\nexport const viewport = _viewport satisfies Viewport\n"],"names":["viewport","_viewport"],"mappings":"
|
|
1
|
+
{"version":3,"file":"viewport.cjs","sources":["../../src/studio/viewport.ts"],"sourcesContent":["import type {Viewport} from 'next'\n\nimport {viewport as _viewport} from './head'\n\n/**\n * @public\n * @deprecated use `export {viewport} from 'next-sanity/studio'` instead\n */\nexport const viewport = _viewport satisfies Viewport\n"],"names":["Object","defineProperty","exports","value","viewport","require","_viewport"],"mappings":"aAQOA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IAAA,MAAMC,EAANC,QAAA,cAAiBC,SAAAA,QAAAA,SAAAA"}
|
package/dist/studio/viewport.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{viewport as o}from"./head.js";const r=o;export{r as viewport}
|
|
2
|
-
//# sourceMappingURL=viewport.js.map
|
|
1
|
+
import{viewport as o}from"./head.js";const r=o;export{r as viewport};//# sourceMappingURL=viewport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.js","sources":["../../src/studio/viewport.ts"],"sourcesContent":["import type {Viewport} from 'next'\n\nimport {viewport as _viewport} from './head'\n\n/**\n * @public\n * @deprecated use `export {viewport} from 'next-sanity/studio'` instead\n */\nexport const viewport = _viewport satisfies Viewport\n"],"names":["viewport","_viewport"],"mappings":"
|
|
1
|
+
{"version":3,"file":"viewport.js","sources":["../../src/studio/viewport.ts"],"sourcesContent":["import type {Viewport} from 'next'\n\nimport {viewport as _viewport} from './head'\n\n/**\n * @public\n * @deprecated use `export {viewport} from 'next-sanity/studio'` instead\n */\nexport const viewport = _viewport satisfies Viewport\n"],"names":["viewport$1","viewport","_viewport"],"mappings":"mBAQOA,MAAA,YAAA,MAAMC,EAAWC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";"use strict";var e=require("@sanity/visual-editing"),
|
|
2
|
-
//# sourceMappingURL=VisualEditing.cjs.map
|
|
1
|
+
"use client";"use strict";var e=require("@sanity/visual-editing"),r=require("next/navigation.js"),t=require("react");module.exports=function(u){const{zIndex:n}=u,s=r.useRouter(),a=t.useRef(s),[c,i]=t.useState();t.useEffect((()=>{a.current=s}),[s]),t.useEffect((()=>{const r=e.enableVisualEditing({zIndex:n,history:{subscribe:e=>(i((()=>e)),()=>i(void 0)),update:e=>{switch(e.type){case"push":return a.current.push(e.url);case"pop":return a.current.back();case"replace":return a.current.replace(e.url);default:throw new Error(`Unknown update type: ${e.type}`)}}}});return()=>r()}),[n]);const l=r.usePathname(),o=r.useSearchParams();return t.useEffect((()=>{c&&c({type:"push",url:`${l}${null!=o&&o.size?`?${o}`:""}`})}),[c,l,o]),null};//# sourceMappingURL=VisualEditing.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisualEditing.cjs","sources":["../../src/visual-editing/VisualEditing.tsx"],"sourcesContent":["'use client'\n\nimport {\n enableVisualEditing,\n type HistoryAdapterNavigate,\n type VisualEditingOptions,\n} from '@sanity/visual-editing'\nimport {usePathname, useRouter, useSearchParams} from 'next/navigation.js'\nimport {useEffect, useRef, useState} from 'react'\n\n/**\n * @public\n */\nexport interface VisualEditingProps extends Omit<VisualEditingOptions, 'history'> {\n /**\n * @deprecated The histoy adapter is already implemented\n */\n history?: never\n}\n\nexport default function VisualEditing(props: VisualEditingProps): null {\n const {zIndex} = props\n\n const router = useRouter()\n const routerRef = useRef(router)\n const [navigate, setNavigate] = useState<HistoryAdapterNavigate | undefined>()\n\n useEffect(() => {\n routerRef.current = router\n }, [router])\n useEffect(() => {\n const disable = enableVisualEditing({\n zIndex,\n history: {\n subscribe: (_navigate) => {\n setNavigate(() => _navigate)\n return () => setNavigate(undefined)\n },\n update: (update) => {\n switch (update.type) {\n case 'push':\n return routerRef.current.push(update.url)\n case 'pop':\n return routerRef.current.back()\n case 'replace':\n return routerRef.current.replace(update.url)\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n },\n },\n })\n return () => disable()\n }, [zIndex])\n\n const pathname = usePathname()\n const searchParams = useSearchParams()\n useEffect(() => {\n if (navigate) {\n navigate({\n type: 'push',\n url: `${pathname}${searchParams?.size ? `?${searchParams}` : ''}`,\n })\n }\n }, [navigate, pathname, searchParams])\n\n return null\n}\n"],"names":["props","zIndex","router","useRouter","routerRef","useRef","navigate","setNavigate","useState","useEffect","current","disable","enableVisualEditing","history","subscribe","_navigate","update","type","push","url","back","replace","Error","
|
|
1
|
+
{"version":3,"file":"VisualEditing.cjs","sources":["../../src/visual-editing/VisualEditing.tsx"],"sourcesContent":["'use client'\n\nimport {\n enableVisualEditing,\n type HistoryAdapterNavigate,\n type VisualEditingOptions,\n} from '@sanity/visual-editing'\nimport {usePathname, useRouter, useSearchParams} from 'next/navigation.js'\nimport {useEffect, useRef, useState} from 'react'\n\n/**\n * @public\n */\nexport interface VisualEditingProps extends Omit<VisualEditingOptions, 'history'> {\n /**\n * @deprecated The histoy adapter is already implemented\n */\n history?: never\n}\n\nexport default function VisualEditing(props: VisualEditingProps): null {\n const {zIndex} = props\n\n const router = useRouter()\n const routerRef = useRef(router)\n const [navigate, setNavigate] = useState<HistoryAdapterNavigate | undefined>()\n\n useEffect(() => {\n routerRef.current = router\n }, [router])\n useEffect(() => {\n const disable = enableVisualEditing({\n zIndex,\n history: {\n subscribe: (_navigate) => {\n setNavigate(() => _navigate)\n return () => setNavigate(undefined)\n },\n update: (update) => {\n switch (update.type) {\n case 'push':\n return routerRef.current.push(update.url)\n case 'pop':\n return routerRef.current.back()\n case 'replace':\n return routerRef.current.replace(update.url)\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n },\n },\n })\n return () => disable()\n }, [zIndex])\n\n const pathname = usePathname()\n const searchParams = useSearchParams()\n useEffect(() => {\n if (navigate) {\n navigate({\n type: 'push',\n url: `${pathname}${searchParams?.size ? `?${searchParams}` : ''}`,\n })\n }\n }, [navigate, pathname, searchParams])\n\n return null\n}\n"],"names":["module","exports","props","zIndex","router","useRouter","routerRef","useRef","navigate","setNavigate","useState","useEffect","current","disable","enableVisualEditing","history","subscribe","_navigate","update","type","push","url","back","replace","Error","pathname","usePathname","searchParams","useSearchParams","size"],"mappings":"qHAmEAA,OAAAC,QA/CA,SAAsCC,GACpC,MAAMC,OAACA,GAAUD,EAEXE,EAASC,EAAUA,YACnBC,EAAYC,EAAAA,OAAOH,IAClBI,EAAUC,GAAeC,EAA6CA,WAE7EC,EAAAA,WAAU,KACRL,EAAUM,QAAUR,CAAA,GACnB,CAACA,IACJO,EAAAA,WAAU,KACF,MAAAE,EAAUC,EAAAA,oBAAoB,CAClCX,SACAY,QAAS,CACPC,UAAYC,IACVR,GAAY,IAAMQ,IACX,IAAMR,OAAY,IAE3BS,OAASA,IACP,OAAQA,EAAOC,MACb,IAAK,OACH,OAAOb,EAAUM,QAAQQ,KAAKF,EAAOG,KACvC,IAAK,MACI,OAAAf,EAAUM,QAAQU,OAC3B,IAAK,UACH,OAAOhB,EAAUM,QAAQW,QAAQL,EAAOG,KAC1C,QACE,MAAM,IAAIG,MAAM,wBAAwBN,EAAOC,QACnD,KAIN,MAAO,IAAMN,GAAQ,GACpB,CAACV,IAEJ,MAAMsB,EAAWC,EAAAA,cACXC,EAAeC,EAAgBA,kBACrCjB,OAAAA,EAAAA,WAAU,KACJH,GACFA,EAAS,CACPW,KAAM,OACNE,IAAK,GAAGI,UAAWE,KAAcE,KAAO,IAAIF,IAAiB,MAC9D,GAEF,CAACnB,EAAUiB,EAAUE,IAEjB,IACT"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";import{enableVisualEditing as
|
|
2
|
-
//# sourceMappingURL=VisualEditing.js.map
|
|
1
|
+
"use client";import{enableVisualEditing as r}from"@sanity/visual-editing";import{useRouter as e,usePathname as t,useSearchParams as n}from"next/navigation.js";import{useRef as u,useState as s,useEffect as c}from"react";function o(o){const{zIndex:p}=o,a=e(),i=u(a),[l,d]=s();c((()=>{i.current=a}),[a]),c((()=>{const e=r({zIndex:p,history:{subscribe:r=>(d((()=>r)),()=>d(void 0)),update:r=>{switch(r.type){case"push":return i.current.push(r.url);case"pop":return i.current.back();case"replace":return i.current.replace(r.url);default:throw new Error(`Unknown update type: ${r.type}`)}}}});return()=>e()}),[p]);const f=t(),h=n();return c((()=>{l&&l({type:"push",url:`${f}${null!=h&&h.size?`?${h}`:""}`})}),[l,f,h]),null}export{o as default};//# sourceMappingURL=VisualEditing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisualEditing.js","sources":["../../src/visual-editing/VisualEditing.tsx"],"sourcesContent":["'use client'\n\nimport {\n enableVisualEditing,\n type HistoryAdapterNavigate,\n type VisualEditingOptions,\n} from '@sanity/visual-editing'\nimport {usePathname, useRouter, useSearchParams} from 'next/navigation.js'\nimport {useEffect, useRef, useState} from 'react'\n\n/**\n * @public\n */\nexport interface VisualEditingProps extends Omit<VisualEditingOptions, 'history'> {\n /**\n * @deprecated The histoy adapter is already implemented\n */\n history?: never\n}\n\nexport default function VisualEditing(props: VisualEditingProps): null {\n const {zIndex} = props\n\n const router = useRouter()\n const routerRef = useRef(router)\n const [navigate, setNavigate] = useState<HistoryAdapterNavigate | undefined>()\n\n useEffect(() => {\n routerRef.current = router\n }, [router])\n useEffect(() => {\n const disable = enableVisualEditing({\n zIndex,\n history: {\n subscribe: (_navigate) => {\n setNavigate(() => _navigate)\n return () => setNavigate(undefined)\n },\n update: (update) => {\n switch (update.type) {\n case 'push':\n return routerRef.current.push(update.url)\n case 'pop':\n return routerRef.current.back()\n case 'replace':\n return routerRef.current.replace(update.url)\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n },\n },\n })\n return () => disable()\n }, [zIndex])\n\n const pathname = usePathname()\n const searchParams = useSearchParams()\n useEffect(() => {\n if (navigate) {\n navigate({\n type: 'push',\n url: `${pathname}${searchParams?.size ? `?${searchParams}` : ''}`,\n })\n }\n }, [navigate, pathname, searchParams])\n\n return null\n}\n"],"names":["VisualEditing","props","zIndex","router","useRouter","routerRef","useRef","navigate","setNavigate","useState","useEffect","current","disable","enableVisualEditing","history","subscribe","_navigate","update","type","push","url","back","replace","Error","
|
|
1
|
+
{"version":3,"file":"VisualEditing.js","sources":["../../src/visual-editing/VisualEditing.tsx"],"sourcesContent":["'use client'\n\nimport {\n enableVisualEditing,\n type HistoryAdapterNavigate,\n type VisualEditingOptions,\n} from '@sanity/visual-editing'\nimport {usePathname, useRouter, useSearchParams} from 'next/navigation.js'\nimport {useEffect, useRef, useState} from 'react'\n\n/**\n * @public\n */\nexport interface VisualEditingProps extends Omit<VisualEditingOptions, 'history'> {\n /**\n * @deprecated The histoy adapter is already implemented\n */\n history?: never\n}\n\nexport default function VisualEditing(props: VisualEditingProps): null {\n const {zIndex} = props\n\n const router = useRouter()\n const routerRef = useRef(router)\n const [navigate, setNavigate] = useState<HistoryAdapterNavigate | undefined>()\n\n useEffect(() => {\n routerRef.current = router\n }, [router])\n useEffect(() => {\n const disable = enableVisualEditing({\n zIndex,\n history: {\n subscribe: (_navigate) => {\n setNavigate(() => _navigate)\n return () => setNavigate(undefined)\n },\n update: (update) => {\n switch (update.type) {\n case 'push':\n return routerRef.current.push(update.url)\n case 'pop':\n return routerRef.current.back()\n case 'replace':\n return routerRef.current.replace(update.url)\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n },\n },\n })\n return () => disable()\n }, [zIndex])\n\n const pathname = usePathname()\n const searchParams = useSearchParams()\n useEffect(() => {\n if (navigate) {\n navigate({\n type: 'push',\n url: `${pathname}${searchParams?.size ? `?${searchParams}` : ''}`,\n })\n }\n }, [navigate, pathname, searchParams])\n\n return null\n}\n"],"names":["VisualEditing","props","zIndex","router","useRouter","routerRef","useRef","navigate","setNavigate","useState","useEffect","current","disable","enableVisualEditing","history","subscribe","_navigate","update","type","push","url","back","replace","Error","pathname","usePathname","searchParams","useSearchParams","size"],"mappings":"2NAoBA,SAAwBA,EAAcC,GACpC,MAAMC,OAACA,GAAUD,EAEXE,EAASC,IACTC,EAAYC,EAAOH,IAClBI,EAAUC,GAAeC,IAEhCC,GAAU,KACRL,EAAUM,QAAUR,CAAA,GACnB,CAACA,IACJO,GAAU,KACR,MAAME,EAAUC,EAAoB,CAClCX,SACAY,QAAS,CACPC,UAAYC,IACVR,GAAY,IAAMQ,IACX,IAAMR,OAAY,IAE3BS,OAASA,IACP,OAAQA,EAAOC,MACb,IAAK,OACH,OAAOb,EAAUM,QAAQQ,KAAKF,EAAOG,KACvC,IAAK,MACI,OAAAf,EAAUM,QAAQU,OAC3B,IAAK,UACH,OAAOhB,EAAUM,QAAQW,QAAQL,EAAOG,KAC1C,QACE,MAAM,IAAIG,MAAM,wBAAwBN,EAAOC,QACnD,KAIN,MAAO,IAAMN,GAAQ,GACpB,CAACV,IAEJ,MAAMsB,EAAWC,IACXC,EAAeC,IACrB,OAAAjB,GAAU,KACJH,GACFA,EAAS,CACPW,KAAM,OACNE,IAAK,GAAGI,UAAWE,KAAcE,KAAO,IAAIF,IAAiB,MAC9D,GAEF,CAACnB,EAAUiB,EAAUE,IAEjB,IACT"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react");function t(e){return Object.freeze({__proto__:null,default:e})}const n=r.lazy((()=>Promise.resolve().then((function(){return t(require("./VisualEditing.cjs"))}))));exports.VisualEditing=function(t){return e.jsx(r.Suspense,{fallback:null,children:e.jsx(n,{...t})})}
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react");function t(e){return Object.freeze({__proto__:null,default:e})}const n=r.lazy((()=>Promise.resolve().then((function(){return t(require("./VisualEditing.cjs"))}))));exports.VisualEditing=function(t){return e.jsx(r.Suspense,{fallback:null,children:e.jsx(n,{...t})})};//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/visual-editing/index.tsx"],"sourcesContent":["import {lazy, Suspense} from 'react'\n\nimport type {VisualEditingProps} from './VisualEditing'\n\nconst VisualEditingComponent = lazy(() => import('./VisualEditing'))\n\n/**\n * @public\n */\nexport function VisualEditing(props: VisualEditingProps): React.ReactElement {\n return (\n <Suspense fallback={null}>\n <VisualEditingComponent {...props} />\n </Suspense>\n )\n}\n"],"names":["VisualEditingComponent","lazy","Promise","resolve","then","_interopNamespaceDefaultOnly","require","
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/visual-editing/index.tsx"],"sourcesContent":["import {lazy, Suspense} from 'react'\n\nimport type {VisualEditingProps} from './VisualEditing'\n\nconst VisualEditingComponent = lazy(() => import('./VisualEditing'))\n\n/**\n * @public\n */\nexport function VisualEditing(props: VisualEditingProps): React.ReactElement {\n return (\n <Suspense fallback={null}>\n <VisualEditingComponent {...props} />\n </Suspense>\n )\n}\n"],"names":["VisualEditingComponent","lazy","Promise","resolve","then","_interopNamespaceDefaultOnly","require","exports","VisualEditing","props","Suspense","fallback","children"],"mappings":"yLAIA,MAAMA,EAAyBC,EAAAA,MAAK,IAAMC,QAAOC,UAAAC,MAAA,WAAA,OAAAC,EAAAC,QAAA,uBAAkB,MAWnEC,QAAAC,cANO,SAAuBC,GAE1B,aAACC,EAAAA,UAASC,SAAU,KAClBC,eAACZ,EAAwB,IAAGS,KAGlC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{lazy as t,Suspense as i}from"react";const n=t((()=>import("./VisualEditing.js")));function o(t){return r(i,{fallback:null,children:r(n,{...t})})}export{o as VisualEditing}
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{lazy as t,Suspense as i}from"react";const n=t((()=>import("./VisualEditing.js")));function o(t){return r(i,{fallback:null,children:r(n,{...t})})}export{o as VisualEditing};//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/visual-editing/index.tsx"],"sourcesContent":["import {lazy, Suspense} from 'react'\n\nimport type {VisualEditingProps} from './VisualEditing'\n\nconst VisualEditingComponent = lazy(() => import('./VisualEditing'))\n\n/**\n * @public\n */\nexport function VisualEditing(props: VisualEditingProps): React.ReactElement {\n return (\n <Suspense fallback={null}>\n <VisualEditingComponent {...props} />\n </Suspense>\n )\n}\n"],"names":["VisualEditingComponent","lazy","import","VisualEditing","props","jsx","Suspense","fallback","children"],"mappings":"mFAIA,MAAMA,EAAyBC,GAAK,IAAMC,OAAO,wBAK1C,SAASC,EAAcC,GAE1B,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/visual-editing/index.tsx"],"sourcesContent":["import {lazy, Suspense} from 'react'\n\nimport type {VisualEditingProps} from './VisualEditing'\n\nconst VisualEditingComponent = lazy(() => import('./VisualEditing'))\n\n/**\n * @public\n */\nexport function VisualEditing(props: VisualEditingProps): React.ReactElement {\n return (\n <Suspense fallback={null}>\n <VisualEditingComponent {...props} />\n </Suspense>\n )\n}\n"],"names":["VisualEditingComponent","lazy","import","VisualEditing","props","jsx","Suspense","fallback","children"],"mappings":"mFAIA,MAAMA,EAAyBC,GAAK,IAAMC,OAAO,wBAK1C,SAASC,EAAcC,GAE1B,OAACC,EAAAC,GAASC,SAAU,KAClBC,SAACH,EAAAL,EAAwB,IAAGI,KAGlC"}
|
package/dist/webhook.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/webhook");exports.config={api:{bodyParser:!1},runtime:"nodejs"},exports.parseBody=async function(r,t,n=!0){return"text"in r?async function(r,t,n=!0){const i=r.headers.get(e.SIGNATURE_HEADER_NAME);if(!i)return console.error("Missing signature header"),{body:null,isValidSignature:null};const a=await r.text(),o=t?await e.isValidSignature(a,i,t.trim()):null
|
|
2
|
-
//# sourceMappingURL=webhook.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@sanity/webhook");exports.config={api:{bodyParser:!1},runtime:"nodejs"},exports.parseBody=async function(r,t,n=!0){return"text"in r?async function(r,t,n=!0){const i=r.headers.get(e.SIGNATURE_HEADER_NAME);if(!i)return console.error("Missing signature header"),{body:null,isValidSignature:null};const a=await r.text(),o=t?await e.isValidSignature(a,i,t.trim()):null;return!1!==o&&n&&await new Promise((e=>setTimeout(e,3e3))),{body:a.trim()?JSON.parse(a):null,isValidSignature:o}}(r,t,n):async function(r,t,n=!0){let i=r.headers[e.SIGNATURE_HEADER_NAME];if(Array.isArray(i)&&(i=i[0]),!i)return console.error("Missing signature header"),{body:null,isValidSignature:null};if(r.readableEnded)throw new Error("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?`");const a=await async function(e){const r=[];for await(const t of e)r.push("string"==typeof t?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}(r),o=t?await e.isValidSignature(a,i,t.trim()):null;return!1!==o&&n&&await new Promise((e=>setTimeout(e,1e3))),{body:a.trim()?JSON.parse(a):null,isValidSignature:o}}(r,t,n)};//# sourceMappingURL=webhook.cjs.map
|
package/dist/webhook.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.cjs","sources":["../src/webhook/index.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'\nimport 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 * @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.\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 runtime: 'nodejs',\n}\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 * 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
|
|
1
|
+
{"version":3,"file":"webhook.cjs","sources":["../src/webhook/index.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'\nimport 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 * @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.\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 runtime: 'nodejs',\n}\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 * 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 * @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n// eslint-disable-next-line require-await\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest | NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n return 'text' in req\n ? parseAppBody(req, secret, waitForContentLakeEventualConsistency)\n : parsePageBody(req, secret, waitForContentLakeEventualConsistency)\n}\n\n/** @deprecated */\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 ? await 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\nasync 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 ? await isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 3000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n\nasync 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":["Object","defineProperty","exports","value","webhook","require","config","api","bodyParser","runtime","parseBody","async","req","secret","waitForContentLakeEventualConsistency","signature","headers","get","SIGNATURE_HEADER_NAME","console","error","body","isValidSignature","text","validSignature","trim","Promise","resolve","setTimeout","JSON","parse","parseAppBody","Array","isArray","readableEnded","Error","readable","chunks","chunk","push","Buffer","from","concat","toString","readBody","parsePageBody"],"mappings":"aAWOA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IAAA,IAAAC,EAAAC,QAAA,mBAmHPH,QAAAI,OAnHkC,CAChCC,IAAK,CAIHC,YAAY,GAEdC,QAAS,UA4GXP,QAAAQ,UA1EAC,eACEC,EACAC,EACAC,GAAiD,GAE1C,MAAA,SAAUF,EAuCnBD,eACEC,EACAC,EACAC,GAAiD,GAEjD,MAAMC,EAAYH,EAAII,QAAQC,IAAIC,EAAqBA,uBACvD,IAAKH,EACH,OAAAI,QAAQC,MAAM,4BACP,CAACC,KAAM,KAAMC,iBAAkB,MAGxC,MAAMD,QAAaT,EAAIW,OACjBC,EAAiBX,QAAeS,EAAAA,iBAAiBD,EAAMN,EAAWF,EAAOY,QAAU,KAEzF,OAAuB,IAAnBD,GAA4BV,SACxB,IAAIY,SAASC,GAAYC,WAAWD,EAAS,OAG9C,CACLN,KAAMA,EAAKI,OAASI,KAAKC,MAAMT,GAAQ,KACvCC,iBAAkBE,EAEtB,CA5DMO,CAAanB,EAAKC,EAAQC,GAKhCH,eACEC,EACAC,EACAC,GAAiD,GAE7C,IAAAC,EAAYH,EAAII,QAAQE,EAAqBA,uBAC7C,GAAAc,MAAMC,QAAQlB,KAChBA,EAAYA,EAAU,KAEnBA,EACH,OAAAI,QAAQC,MAAM,4BACP,CAACC,KAAM,KAAMC,iBAAkB,MAGxC,GAAIV,EAAIsB,cACN,MAAM,IAAIC,MACR,mJAIJ,MAAMd,QAqCRV,eAAwByB,GACtB,MAAMC,EAAS,GACf,UAAA,MAAiBC,KAASF,EACjBC,EAAAE,KAAsB,iBAAVD,EAAqBE,OAAOC,KAAKH,GAASA,GAE/D,OAAOE,OAAOE,OAAOL,GAAQM,SAAS,OACxC,CA3CqBC,CAAShC,GACtBY,EAAiBX,QAAeS,EAAAA,iBAAiBD,EAAMN,EAAWF,EAAOY,QAAU,KAEzF,OAAuB,IAAnBD,GAA4BV,SACxB,IAAIY,SAASC,GAAYC,WAAWD,EAAS,OAG9C,CACLN,KAAMA,EAAKI,OAASI,KAAKC,MAAMT,GAAQ,KACvCC,iBAAkBE,EAEtB,CAnCMqB,CAAcjC,EAAKC,EAAQC,EACjC"}
|
package/dist/webhook.d.ts
CHANGED
|
@@ -14,10 +14,9 @@ export declare const config: PageConfig
|
|
|
14
14
|
* Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
|
|
15
15
|
* without worrying about getting stale data.
|
|
16
16
|
* @public
|
|
17
|
-
* @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.
|
|
18
17
|
*/
|
|
19
18
|
export declare function parseBody<Body = SanityDocument>(
|
|
20
|
-
req:
|
|
19
|
+
req: NextRequest,
|
|
21
20
|
secret?: string,
|
|
22
21
|
waitForContentLakeEventualConsistency?: boolean,
|
|
23
22
|
): Promise<ParsedBody<Body>>
|
|
@@ -26,9 +25,10 @@ export declare function parseBody<Body = SanityDocument>(
|
|
|
26
25
|
* Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
|
|
27
26
|
* without worrying about getting stale data.
|
|
28
27
|
* @public
|
|
28
|
+
* @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.
|
|
29
29
|
*/
|
|
30
30
|
export declare function parseBody<Body = SanityDocument>(
|
|
31
|
-
req:
|
|
31
|
+
req: NextApiRequest,
|
|
32
32
|
secret?: string,
|
|
33
33
|
waitForContentLakeEventualConsistency?: boolean,
|
|
34
34
|
): Promise<ParsedBody<Body>>
|
package/dist/webhook.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{isValidSignature as e,SIGNATURE_HEADER_NAME as r}from"@sanity/webhook";const n={api:{bodyParser:!1},runtime:"nodejs"};async function t(n,t,i=!0){return"text"in n?async function(n,t,i=!0){const a=n.headers.get(r);if(!a)return console.error("Missing signature header"),{body:null,isValidSignature:null};const o=await n.text(),s=t?await e(o,a,t.trim()):null
|
|
2
|
-
//# sourceMappingURL=webhook.js.map
|
|
1
|
+
import{isValidSignature as e,SIGNATURE_HEADER_NAME as r}from"@sanity/webhook";const n={api:{bodyParser:!1},runtime:"nodejs"};async function t(n,t,i=!0){return"text"in n?async function(n,t,i=!0){const a=n.headers.get(r);if(!a)return console.error("Missing signature header"),{body:null,isValidSignature:null};const o=await n.text(),s=t?await e(o,a,t.trim()):null;return!1!==s&&i&&await new Promise((e=>setTimeout(e,3e3))),{body:o.trim()?JSON.parse(o):null,isValidSignature:s}}(n,t,i):async function(n,t,i=!0){let a=n.headers[r];if(Array.isArray(a)&&(a=a[0]),!a)return console.error("Missing signature header"),{body:null,isValidSignature:null};if(n.readableEnded)throw new Error("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?`");const o=await async function(e){const r=[];for await(const n of e)r.push("string"==typeof n?Buffer.from(n):n);return Buffer.concat(r).toString("utf8")}(n),s=t?await e(o,a,t.trim()):null;return!1!==s&&i&&await new Promise((e=>setTimeout(e,1e3))),{body:o.trim()?JSON.parse(o):null,isValidSignature:s}}(n,t,i)}export{n as config,t as parseBody};//# sourceMappingURL=webhook.js.map
|
package/dist/webhook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sources":["../src/webhook/index.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'\nimport 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 * @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.\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 runtime: 'nodejs',\n}\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 * 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
|
|
1
|
+
{"version":3,"file":"webhook.js","sources":["../src/webhook/index.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'\nimport 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 * @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.\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 runtime: 'nodejs',\n}\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 * 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 * @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency?: boolean,\n): Promise<ParsedBody<Body>>\n// eslint-disable-next-line require-await\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest | NextApiRequest,\n secret?: string,\n waitForContentLakeEventualConsistency: boolean = true,\n): Promise<ParsedBody<Body>> {\n return 'text' in req\n ? parseAppBody(req, secret, waitForContentLakeEventualConsistency)\n : parsePageBody(req, secret, waitForContentLakeEventualConsistency)\n}\n\n/** @deprecated */\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 ? await 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\nasync 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 ? await isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 3000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n\nasync 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":["isValidSignature","SIGNATURE_HEADER_NAME","config","api","bodyParser","runtime","async","parseBody","req","secret","waitForContentLakeEventualConsistency","signature","headers","get","console","error","body","text","validSignature","trim","Promise","resolve","setTimeout","JSON","parse","parseAppBody","Array","isArray","readableEnded","Error","readable","chunks","chunk","push","Buffer","from","concat","toString","readBody","parsePageBody"],"mappings":"2BAWOA,2BAAAC,MAAA,kBAAA,MAAMC,EAAqB,CAChCC,IAAK,CAIHC,YAAY,GAEdC,QAAS,UAkCXC,eAAsBC,EACpBC,EACAC,EACAC,GAAiD,GAE1C,MAAA,SAAUF,EAuCnBF,eACEE,EACAC,EACAC,GAAiD,GAEjD,MAAMC,EAAYH,EAAII,QAAQC,IAAIZ,GAClC,IAAKU,EACH,OAAAG,QAAQC,MAAM,4BACP,CAACC,KAAM,KAAMhB,iBAAkB,MAGxC,MAAMgB,QAAaR,EAAIS,OACjBC,EAAiBT,QAAeT,EAAiBgB,EAAML,EAAWF,EAAOU,QAAU,KAEzF,OAAuB,IAAnBD,GAA4BR,SACxB,IAAIU,SAASC,GAAYC,WAAWD,EAAS,OAG9C,CACLL,KAAMA,EAAKG,OAASI,KAAKC,MAAMR,GAAQ,KACvChB,iBAAkBkB,EAEtB,CA5DMO,CAAajB,EAAKC,EAAQC,GAKhCJ,eACEE,EACAC,EACAC,GAAiD,GAE7C,IAAAC,EAAYH,EAAII,QAAQX,GACxB,GAAAyB,MAAMC,QAAQhB,KAChBA,EAAYA,EAAU,KAEnBA,EACH,OAAAG,QAAQC,MAAM,4BACP,CAACC,KAAM,KAAMhB,iBAAkB,MAGxC,GAAIQ,EAAIoB,cACN,MAAM,IAAIC,MACR,mJAIJ,MAAMb,QAqCRV,eAAwBwB,GACtB,MAAMC,EAAS,GACf,UAAA,MAAiBC,KAASF,EACjBC,EAAAE,KAAsB,iBAAVD,EAAqBE,OAAOC,KAAKH,GAASA,GAE/D,OAAOE,OAAOE,OAAOL,GAAQM,SAAS,OACxC,CA3CqBC,CAAS9B,GACtBU,EAAiBT,QAAeT,EAAiBgB,EAAML,EAAWF,EAAOU,QAAU,KAEzF,OAAuB,IAAnBD,GAA4BR,SACxB,IAAIU,SAASC,GAAYC,WAAWD,EAAS,OAG9C,CACLL,KAAMA,EAAKG,OAASI,KAAKC,MAAMR,GAAQ,KACvChB,iBAAkBkB,EAEtB,CAnCMqB,CAAc/B,EAAKC,EAAQC,EACjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git+ssh://git@github.com/sanity-io/next-sanity.git"
|
|
20
|
+
"url": "git+ssh://git@github.com/sanity-io/next-sanity.git",
|
|
21
|
+
"directory": "packages/next-sanity"
|
|
21
22
|
},
|
|
22
23
|
"license": "MIT",
|
|
23
24
|
"author": "Sanity.io <hello@sanity.io>",
|
|
@@ -134,82 +135,38 @@
|
|
|
134
135
|
"dist",
|
|
135
136
|
"src"
|
|
136
137
|
],
|
|
137
|
-
"scripts": {
|
|
138
|
-
"prebuild": "npm run clean",
|
|
139
|
-
"build": "pkg build --strict && pkg --strict",
|
|
140
|
-
"clean": "rimraf dist",
|
|
141
|
-
"coverage": "npm test -- --coverage",
|
|
142
|
-
"dev": "next",
|
|
143
|
-
"format": "npm run prettier -- --write . && eslint --fix .",
|
|
144
|
-
"lint": "eslint --max-warnings 0 .",
|
|
145
|
-
"prepublishOnly": "npm run build",
|
|
146
|
-
"prettier": "npx prettier --ignore-path .gitignore",
|
|
147
|
-
"test": "vitest",
|
|
148
|
-
"test:node-esm-cjs": "node test.mjs && node test.cjs",
|
|
149
|
-
"type-check": "tsc --noEmit"
|
|
150
|
-
},
|
|
151
138
|
"browserslist": "extends @sanity/browserslist-config",
|
|
152
|
-
"prettier": {
|
|
153
|
-
"bracketSpacing": false,
|
|
154
|
-
"plugins": [
|
|
155
|
-
"prettier-plugin-packagejson",
|
|
156
|
-
"prettier-plugin-tailwindcss"
|
|
157
|
-
],
|
|
158
|
-
"printWidth": 98,
|
|
159
|
-
"semi": false,
|
|
160
|
-
"singleQuote": true
|
|
161
|
-
},
|
|
162
139
|
"dependencies": {
|
|
163
|
-
"@sanity/client": "^6.
|
|
164
|
-
"@sanity/preview-kit": "5.0.
|
|
165
|
-
"@sanity/visual-editing": "1.
|
|
140
|
+
"@sanity/client": "^6.14.3",
|
|
141
|
+
"@sanity/preview-kit": "5.0.24",
|
|
142
|
+
"@sanity/visual-editing": "1.5.0",
|
|
166
143
|
"@sanity/webhook": "4.0.0",
|
|
167
144
|
"groq": "^3.19"
|
|
168
145
|
},
|
|
169
146
|
"devDependencies": {
|
|
170
|
-
"@
|
|
171
|
-
"@next/eslint-plugin-next": "14.1.0",
|
|
172
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
173
|
-
"@sanity/browserslist-config": "^1.0.1",
|
|
147
|
+
"@sanity/browserslist-config": "^1.0.3",
|
|
174
148
|
"@sanity/eslint-config-studio": "^3.0.1",
|
|
175
|
-
"@sanity/
|
|
176
|
-
"@
|
|
177
|
-
"@sanity/ui": "^2.0.2",
|
|
178
|
-
"@sanity/vision": "3.28.0",
|
|
179
|
-
"@types/react": "^18.2.55",
|
|
180
|
-
"@types/react-dom": "^18.2.19",
|
|
149
|
+
"@sanity/pkg-utils": "^4.2.11",
|
|
150
|
+
"@types/react": "^18.2.58",
|
|
181
151
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
182
|
-
"@vitest/coverage-v8": "^1.
|
|
183
|
-
"autoprefixer": "^10.4.17",
|
|
152
|
+
"@vitest/coverage-v8": "^1.3.1",
|
|
184
153
|
"eslint": "^8.56.0",
|
|
185
154
|
"eslint-config-prettier": "^9.1.0",
|
|
186
|
-
"eslint-config-sanity": "^7.0.
|
|
155
|
+
"eslint-config-sanity": "^7.0.2",
|
|
187
156
|
"eslint-gitignore": "^0.1.0",
|
|
188
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
189
157
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
190
|
-
"groqd": "^0.15.10",
|
|
191
158
|
"ls-engines": "^0.9.1",
|
|
192
159
|
"next": "14.1.0",
|
|
193
|
-
"postcss": "^8.4.35",
|
|
194
|
-
"prettier": "^3.2.5",
|
|
195
|
-
"prettier-plugin-packagejson": "^2.4.10",
|
|
196
|
-
"prettier-plugin-tailwindcss": "^0.5.11",
|
|
197
160
|
"react": "^18.2.0",
|
|
198
|
-
"
|
|
199
|
-
"react-is": "^18.2.0",
|
|
200
|
-
"rollup": "^4.10.0",
|
|
201
|
-
"sanity": "3.28.0",
|
|
202
|
-
"server-only": "^0.0.1",
|
|
161
|
+
"rimraf": "^5.0.5",
|
|
203
162
|
"styled-components": "^6.1.8",
|
|
204
|
-
"suspend-react": "^0.1.3",
|
|
205
|
-
"tailwindcss": "^3.4.1",
|
|
206
163
|
"typescript": "^5.3.3",
|
|
207
164
|
"url-loader": "^4.1.1",
|
|
208
|
-
"vitest": "^1.
|
|
165
|
+
"vitest": "^1.3.1",
|
|
209
166
|
"vitest-github-actions-reporter": "^0.11.1"
|
|
210
167
|
},
|
|
211
168
|
"peerDependencies": {
|
|
212
|
-
"@sanity/client": "^6.
|
|
169
|
+
"@sanity/client": "^6.14.3",
|
|
213
170
|
"@sanity/icons": "^2.8",
|
|
214
171
|
"@sanity/types": "^3.25",
|
|
215
172
|
"@sanity/ui": "^1.8 || ^2.0.0-beta || ^2.0",
|
|
@@ -220,5 +177,16 @@
|
|
|
220
177
|
},
|
|
221
178
|
"engines": {
|
|
222
179
|
"node": ">=18.17"
|
|
180
|
+
},
|
|
181
|
+
"scripts": {
|
|
182
|
+
"prebuild": "npm run clean",
|
|
183
|
+
"build": "pkg build --strict && pkg --strict",
|
|
184
|
+
"clean": "npx rimraf dist",
|
|
185
|
+
"coverage": "npm test -- --coverage",
|
|
186
|
+
"dev": "next",
|
|
187
|
+
"format": "eslint --fix .",
|
|
188
|
+
"lint": "eslint --max-warnings 0 .",
|
|
189
|
+
"test": "vitest",
|
|
190
|
+
"type-check": "tsc --noEmit"
|
|
223
191
|
}
|
|
224
|
-
}
|
|
192
|
+
}
|
package/src/webhook/index.ts
CHANGED
|
@@ -32,10 +32,9 @@ export type ParsedBody<T> = {
|
|
|
32
32
|
* Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
|
|
33
33
|
* without worrying about getting stale data.
|
|
34
34
|
* @public
|
|
35
|
-
* @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.
|
|
36
35
|
*/
|
|
37
36
|
export async function parseBody<Body = SanityDocument>(
|
|
38
|
-
req:
|
|
37
|
+
req: NextRequest,
|
|
39
38
|
secret?: string,
|
|
40
39
|
waitForContentLakeEventualConsistency?: boolean,
|
|
41
40
|
): Promise<ParsedBody<Body>>
|
|
@@ -43,15 +42,16 @@ export async function parseBody<Body = SanityDocument>(
|
|
|
43
42
|
* Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
|
|
44
43
|
* without worrying about getting stale data.
|
|
45
44
|
* @public
|
|
45
|
+
* @deprecated using `parseBody` with `NextApiRequest` is deprecated and will be removed in the next major version. Use `parseBody` with `NextRequest` instead from a Route Handler in App Router.
|
|
46
46
|
*/
|
|
47
47
|
export async function parseBody<Body = SanityDocument>(
|
|
48
|
-
req:
|
|
48
|
+
req: NextApiRequest,
|
|
49
49
|
secret?: string,
|
|
50
50
|
waitForContentLakeEventualConsistency?: boolean,
|
|
51
51
|
): Promise<ParsedBody<Body>>
|
|
52
52
|
// eslint-disable-next-line require-await
|
|
53
53
|
export async function parseBody<Body = SanityDocument>(
|
|
54
|
-
req:
|
|
54
|
+
req: NextRequest | NextApiRequest,
|
|
55
55
|
secret?: string,
|
|
56
56
|
waitForContentLakeEventualConsistency: boolean = true,
|
|
57
57
|
): Promise<ParsedBody<Body>> {
|