UNPKG

next-sanity

Version:
66 lines (65 loc) 2.21 kB
import { n as NextStudioLayout, t as NextStudioNoScript } from "../NextStudioNoScript.js"; import { Fragment, jsx, jsxs } from "react/jsx-runtime"; import { preloadModule } from "react-dom"; import { NextStudio } from "next-sanity/studio/client-component"; /** * In router segments (`/app/studio/[[...index]]/page.tsx`): * ```tsx * // If you don't want to change any defaults you can just re-export the viewport config directly: * export {viewport} from 'next-sanity/studio' * * // To customize the viewport config, spread it on the export: * import {viewport as studioViewport} from 'next-sanity/studio' * import type { Viewport } from 'next' * * export const viewport: Viewport = { * ...studioViewport, * // Overrides the viewport to resize behavior * interactiveWidget: 'resizes-content' * }) * ``` * @public */ const viewport = { width: "device-width", initialScale: 1, viewportFit: "cover" }; /** * In router segments (`/app/studio/[[...index]]/page.tsx`): * ```tsx * // If you don't want to change any defaults you can just re-export the metadata directly: * export {metadata} from 'next-sanity/studio' * * // To customize the metadata, spread it on the export: * import {metadata as studioMetadata} from 'next-sanity/studio' * import type { Metadata } from 'next' * * export const metadata: Metadata = { * ...studioMetadata, * // Set another title * title: 'My Studio', * }) * ``` * @public */ const metadata = { referrer: "same-origin", robots: "noindex" }; /** * Loads the bridge script the same way Sanity Studio does: * https://github.com/sanity-io/sanity/blob/bd5b1acb5015baaddd8d96c2abd1eaf579b3c904/packages/sanity/src/_internal/cli/server/renderDocument.tsx#L124-L139 */ const bridgeScript = "https://core.sanity-cdn.com/bridge.js"; function NextStudioWithBridge(props) { preloadModule(bridgeScript, { as: "script" }); return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("script", { src: bridgeScript, async: true, type: "module", "data-sanity-core": true }), /* @__PURE__ */ jsx(NextStudio, { ...props })] }); } export { NextStudioWithBridge as NextStudio, NextStudioLayout, NextStudioNoScript, metadata, viewport }; //# sourceMappingURL=index.js.map