next-sanity 4.2.2-dev.0 → 4.2.2-dev.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/dist/_chunks/NextStudioLoading-2003f32a.js.map +1 -1
- package/dist/_chunks/NextStudioLoading-225bb240.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -10
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/studio/loading.d.ts +4 -0
- package/package.json +1 -1
- package/src/client.ts +4 -1
- package/src/index.ts +0 -1
- package/src/studio/NextStudioLoading.tsx +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioLoading-2003f32a.js","sources":["../../src/studio/useTheme.ts","../../src/studio/NextStudioNoScript.tsx","../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["import {studioTheme} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport type {Config, SingleWorkspace, StudioTheme} from 'sanity'\n\n/** @alpha */\nexport function useTheme(\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n): StudioTheme {\n const workspace = useMemo<\n SingleWorkspace | Required<Pick<SingleWorkspace, 'theme'>> | undefined\n >(() => (Array.isArray(config) ? config[0] : config), [config])\n return useMemo<StudioTheme>(() => workspace?.theme || studioTheme, [workspace])\n}\n","/* eslint-disable react/no-danger */\n\nconst style = {\n __html: `\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n`,\n} as const\n\n/** @alpha */\nexport const NextStudioNoScript = () => (\n <noscript>\n <div className=\"sanity-app-no-js__root\">\n <div className=\"sanity-app-no-js__content\">\n <style type=\"text/css\" dangerouslySetInnerHTML={style} />\n <h1>JavaScript disabled</h1>\n <p>\n Please <a href=\"https://www.enable-javascript.com/\">enable JavaScript</a> in your\n browser and reload the page to proceed.\n </p>\n </div>\n </div>\n </noscript>\n)\n","/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["useTheme","config","workspace","useMemo","Array","isArray","theme","studioTheme","style","__html","NextStudioNoScript","jsx","children","className","jsxs","type","dangerouslySetInnerHTML","href","keyframes","NextStudioLoading","props","scheme","unstable__noScript","id","fonts","media","styles","_responsive","size","ascenderHeight","descenderHeight","lineHeight","iconSize","text","sizes","capHeight","wrapper","display","animation","color","default","muted","enabled","fg","width","rem","height","svg","margin","Fragment","fontFamily","family","backgroundColor","base","bg","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","concat","position","fontWeight","fontSize","transform","SpinnerIcon"],"mappings":";;;;AAKO,SAASA,SACdC,MACa,EAAA;EACb,MAAMC,SAAY,GAAAC,OAAA,CAEhB,MAAOC,KAAA,CAAMC,OAAQ,CAAAJ,MAAM,CAAI,GAAAA,MAAA,CAAO,CAAC,CAAA,GAAIA,MAAS,EAAA,CAACA,MAAM,CAAC,CAAA;EAC9D,OAAOE,QAAqB,MAAM,CAAAD,SAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAAA,SAAA,CAAWI,UAASC,WAAa,EAAA,CAACL,SAAS,CAAC,CAAA;AAChF;ACVA,MAAMM,KAAQ,GAAA;EACZC,MAAQ;AAoBV,CAAA;AAGa,MAAAC,kBAAA,GAAqBA,CAAA,KAChC,eAAAC,GAAA,CAAC,UACC,EAAA;EAAAC,QAAA,EAAA,eAAAD,GAAA,CAAC,KAAI,EAAA;IAAAE,SAAA,EAAU,wBACb;IAAAD,QAAA,EAAA,eAAAE,IAAA,CAAC,KAAI,EAAA;MAAAD,SAAA,EAAU,2BACb;MAAAD,QAAA,EAAA,CAAA,eAAAD,GAAA,CAAC,OAAM,EAAA;QAAAI,IAAA,EAAK,UAAW;QAAAC,uBAAA,EAAyBR;OAAO,CAAA,EACvD,eAAAG,GAAA,CAAC;QAAGC,QAAmB,EAAA;MAAA,CAAA,CAAA,EAAA,oBACtB,GAAE,EAAA;QAAAA,QAAA,EAAA,CAAA,SAAA,EAAA,eACOD,GAAA,CAAA,GAAA,EAAA;UAAEM,IAAK,EAAA,oCAAA;UAAqCL,QAAiB,EAAA;SAAA,CAAA,EAAI,kDAAA;OAE3E,CAAA;IACF,CAAA;EACF,CAAA;AACF,CAAA,CAAA;ACVF,MAAMM,SAAY,uFAAA;
|
|
1
|
+
{"version":3,"file":"NextStudioLoading-2003f32a.js","sources":["../../src/studio/useTheme.ts","../../src/studio/NextStudioNoScript.tsx","../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["import {studioTheme} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport type {Config, SingleWorkspace, StudioTheme} from 'sanity'\n\n/** @alpha */\nexport function useTheme(\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n): StudioTheme {\n const workspace = useMemo<\n SingleWorkspace | Required<Pick<SingleWorkspace, 'theme'>> | undefined\n >(() => (Array.isArray(config) ? config[0] : config), [config])\n return useMemo<StudioTheme>(() => workspace?.theme || studioTheme, [workspace])\n}\n","/* eslint-disable react/no-danger */\n\nconst style = {\n __html: `\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n`,\n} as const\n\n/** @alpha */\nexport const NextStudioNoScript = () => (\n <noscript>\n <div className=\"sanity-app-no-js__root\">\n <div className=\"sanity-app-no-js__content\">\n <style type=\"text/css\" dangerouslySetInnerHTML={style} />\n <h1>JavaScript disabled</h1>\n <p>\n Please <a href=\"https://www.enable-javascript.com/\">enable JavaScript</a> in your\n browser and reload the page to proceed.\n </p>\n </div>\n </div>\n </noscript>\n)\n","/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["useTheme","config","workspace","useMemo","Array","isArray","theme","studioTheme","style","__html","NextStudioNoScript","jsx","children","className","jsxs","type","dangerouslySetInnerHTML","href","keyframes","NextStudioLoading","props","scheme","unstable__noScript","id","fonts","media","styles","_responsive","size","ascenderHeight","descenderHeight","lineHeight","iconSize","text","sizes","capHeight","wrapper","display","animation","color","default","muted","enabled","fg","width","rem","height","svg","margin","Fragment","fontFamily","family","backgroundColor","base","bg","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","concat","position","fontWeight","fontSize","transform","SpinnerIcon"],"mappings":";;;;AAKO,SAASA,SACdC,MACa,EAAA;EACb,MAAMC,SAAY,GAAAC,OAAA,CAEhB,MAAOC,KAAA,CAAMC,OAAQ,CAAAJ,MAAM,CAAI,GAAAA,MAAA,CAAO,CAAC,CAAA,GAAIA,MAAS,EAAA,CAACA,MAAM,CAAC,CAAA;EAC9D,OAAOE,QAAqB,MAAM,CAAAD,SAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAAA,SAAA,CAAWI,UAASC,WAAa,EAAA,CAACL,SAAS,CAAC,CAAA;AAChF;ACVA,MAAMM,KAAQ,GAAA;EACZC,MAAQ;AAoBV,CAAA;AAGa,MAAAC,kBAAA,GAAqBA,CAAA,KAChC,eAAAC,GAAA,CAAC,UACC,EAAA;EAAAC,QAAA,EAAA,eAAAD,GAAA,CAAC,KAAI,EAAA;IAAAE,SAAA,EAAU,wBACb;IAAAD,QAAA,EAAA,eAAAE,IAAA,CAAC,KAAI,EAAA;MAAAD,SAAA,EAAU,2BACb;MAAAD,QAAA,EAAA,CAAA,eAAAD,GAAA,CAAC,OAAM,EAAA;QAAAI,IAAA,EAAK,UAAW;QAAAC,uBAAA,EAAyBR;OAAO,CAAA,EACvD,eAAAG,GAAA,CAAC;QAAGC,QAAmB,EAAA;MAAA,CAAA,CAAA,EAAA,oBACtB,GAAE,EAAA;QAAAA,QAAA,EAAA,CAAA,SAAA,EAAA,eACOD,GAAA,CA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YAAA;YAEVtC,UAAY,EAAA,cAAA;YAAA;YAEZuC,SAAW,EAAA,kBAAA;YACX/B,KACE,EAAAjC,KAAA,CAAMiC,KAAM,CAAAlB,MAAA,KAAW,MAAS,GAAA,MAAA,GAAS,OAAO,CAAA,CAAEmB,OAAQ,CAAAC,KAAA,CAAMD,OAAQ,CAAAE,OAAA,CACrED,KAAM,CAAAE;UACb,CAAA;UAEA/B,QAAA,EAAA,eAAAD,GAAA,CAAC;YAAKC,QAAQ,EAAA;UAAA,CAAA;QAAA,CAAA,CAChB,EAAA,eACCD,GAAA,CAAA,KAAA,EAAA;UAAI,SAAQ,EAAA,SAAA;UAAUH,KAAO,EAAAkB,MAAA,CAAOU,OACnC;UAAAxB,QAAA,EAAA,eAAAD,GAAA,CAAC4D,WAAY,EAAA;YAAA/D,KAAA,EAAOkB,MAAO,CAAAqB;UAAK,CAAA;SAClC,CAAA;MAAA,CAAA;IACF,CAAA,CACF;EACF,CAAA,CAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudioLoading-225bb240.cjs","sources":["../../src/studio/useTheme.ts","../../src/studio/NextStudioNoScript.tsx","../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["import {studioTheme} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport type {Config, SingleWorkspace, StudioTheme} from 'sanity'\n\n/** @alpha */\nexport function useTheme(\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n): StudioTheme {\n const workspace = useMemo<\n SingleWorkspace | Required<Pick<SingleWorkspace, 'theme'>> | undefined\n >(() => (Array.isArray(config) ? config[0] : config), [config])\n return useMemo<StudioTheme>(() => workspace?.theme || studioTheme, [workspace])\n}\n","/* eslint-disable react/no-danger */\n\nconst style = {\n __html: `\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n`,\n} as const\n\n/** @alpha */\nexport const NextStudioNoScript = () => (\n <noscript>\n <div className=\"sanity-app-no-js__root\">\n <div className=\"sanity-app-no-js__content\">\n <style type=\"text/css\" dangerouslySetInnerHTML={style} />\n <h1>JavaScript disabled</h1>\n <p>\n Please <a href=\"https://www.enable-javascript.com/\">enable JavaScript</a> in your\n browser and reload the page to proceed.\n </p>\n </div>\n </div>\n </noscript>\n)\n","/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["useTheme","config","workspace","useMemo","Array","isArray","theme","studioTheme","style","__html","NextStudioNoScript","jsx","children","className","jsxs","type","dangerouslySetInnerHTML","href","keyframes","NextStudioLoading","props","scheme","unstable__noScript","id","fonts","media","styles","_responsive","size","ascenderHeight","descenderHeight","lineHeight","iconSize","text","sizes","capHeight","wrapper","display","animation","color","default","muted","enabled","fg","width","rem","height","svg","margin","Fragment","fontFamily","family","backgroundColor","base","bg","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","concat","position","fontWeight","fontSize","transform","SpinnerIcon"],"mappings":";;;;;;AAKO,SAASA,SACdC,MACa,EAAA;EACb,MAAMC,SAAY,GAAAC,KAAA,CAAAA,OAAA,CAEhB,MAAOC,KAAA,CAAMC,OAAQ,CAAAJ,MAAM,CAAI,GAAAA,MAAA,CAAO,CAAC,CAAA,GAAIA,MAAS,EAAA,CAACA,MAAM,CAAC,CAAA;EAC9D,OAAOE,cAAqB,MAAM,CAAAD,SAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAAA,SAAA,CAAWI,UAASC,EAAAA,CAAAA,WAAa,EAAA,CAACL,SAAS,CAAC,CAAA;AAChF;ACVA,MAAMM,KAAQ,GAAA;EACZC,MAAQ;AAoBV,CAAA;AAGa,MAAAC,kBAAA,GAAqBA,CAAA,KAChCC,eAAAA,UAAAA,CAAAA,GAAA,CAAC,UACC,EAAA;EAAAC,QAAA,EAAA,eAAAD,UAAA,CAAAA,GAAA,CAAC,KAAI,EAAA;IAAAE,SAAA,EAAU,wBACb;IAAAD,QAAA,EAAA,eAAAE,eAAA,CAAC,KAAI,EAAA;MAAAD,SAAA,EAAU,2BACb;MAAAD,QAAA,EAAA,CAAA,eAAAD,UAAA,CAAAA,GAAA,CAAC,OAAM,EAAA;QAAAI,IAAA,EAAK,UAAW;QAAAC,uBAAA,EAAyBR;OAAO,CAAA,EACvDG,eAAAA,UAAAA,CAAAA,GAAA,CAAC;QAAGC,QAAmB,EAAA;MAAA,CAAA,CAAA,EAAA,+BACtB,GAAE,EAAA;QAAAA,QAAA,EAAA,CAAA,SAAA,EAAA,eACOD,UAAA,CAAAA,GAAA,CAAA,GAAA,EAAA;UAAEM,IAAK,EAAA,oCAAA;UAAqCL,QAAiB,EAAA;SAAA,CAAA,EAAI,kDAAA;OAE3E,CAAA;IACF,CAAA;EACF,CAAA;AACF,CAAA,CAAA;ACVF,MAAMM,SAAY,uFAAA;
|
|
1
|
+
{"version":3,"file":"NextStudioLoading-225bb240.cjs","sources":["../../src/studio/useTheme.ts","../../src/studio/NextStudioNoScript.tsx","../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["import {studioTheme} from '@sanity/ui'\nimport {useMemo} from 'react'\nimport type {Config, SingleWorkspace, StudioTheme} from 'sanity'\n\n/** @alpha */\nexport function useTheme(\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n): StudioTheme {\n const workspace = useMemo<\n SingleWorkspace | Required<Pick<SingleWorkspace, 'theme'>> | undefined\n >(() => (Array.isArray(config) ? config[0] : config), [config])\n return useMemo<StudioTheme>(() => workspace?.theme || studioTheme, [workspace])\n}\n","/* eslint-disable react/no-danger */\n\nconst style = {\n __html: `\n.sanity-app-no-js__root {\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n background: #fff;\n z-index: 1;\n}\n\n.sanity-app-no-js__content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n font-family: helvetica, arial, sans-serif;\n}\n`,\n} as const\n\n/** @alpha */\nexport const NextStudioNoScript = () => (\n <noscript>\n <div className=\"sanity-app-no-js__root\">\n <div className=\"sanity-app-no-js__content\">\n <style type=\"text/css\" dangerouslySetInnerHTML={style} />\n <h1>JavaScript disabled</h1>\n <p>\n Please <a href=\"https://www.enable-javascript.com/\">enable JavaScript</a> in your\n browser and reload the page to proceed.\n </p>\n </div>\n </div>\n </noscript>\n)\n","/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["useTheme","config","workspace","useMemo","Array","isArray","theme","studioTheme","style","__html","NextStudioNoScript","jsx","children","className","jsxs","type","dangerouslySetInnerHTML","href","keyframes","NextStudioLoading","props","scheme","unstable__noScript","id","fonts","media","styles","_responsive","size","ascenderHeight","descenderHeight","lineHeight","iconSize","text","sizes","capHeight","wrapper","display","animation","color","default","muted","enabled","fg","width","rem","height","svg","margin","Fragment","fontFamily","family","backgroundColor","base","bg","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","concat","position","fontWeight","fontSize","transform","SpinnerIcon"],"mappings":";;;;;;AAKO,SAASA,SACdC,MACa,EAAA;EACb,MAAMC,SAAY,GAAAC,KAAA,CAAAA,OAAA,CAEhB,MAAOC,KAAA,CAAMC,OAAQ,CAAAJ,MAAM,CAAI,GAAAA,MAAA,CAAO,CAAC,CAAA,GAAIA,MAAS,EAAA,CAACA,MAAM,CAAC,CAAA;EAC9D,OAAOE,cAAqB,MAAM,CAAAD,SAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAAA,SAAA,CAAWI,UAASC,EAAAA,CAAAA,WAAa,EAAA,CAACL,SAAS,CAAC,CAAA;AAChF;ACVA,MAAMM,KAAQ,GAAA;EACZC,MAAQ;AAoBV,CAAA;AAGa,MAAAC,kBAAA,GAAqBA,CAAA,KAChCC,eAAAA,UAAAA,CAAAA,GAAA,CAAC,UACC,EAAA;EAAAC,QAAA,EAAA,eAAAD,UAAA,CAAAA,GAAA,CAAC,KAAI,EA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
13
|
var groq__default = /*#__PURE__*/_interopDefaultCompat(groq);
|
|
14
14
|
function createClient(config) {
|
|
15
15
|
let {
|
|
16
|
-
// eslint-disable-next-line prefer-const
|
|
16
|
+
// eslint-disable-next-line prefer-const, no-process-env
|
|
17
17
|
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,
|
|
18
18
|
encodeSourceMap = studioUrl ? "auto" : false
|
|
19
19
|
} = config;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n type ClientConfig as _ClientConfig,\n createClient as _createClient,\n} from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig extends Omit<_ClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: _ClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: _ClientConfig['encodeSourceMap']\n}\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): ReturnType<typeof _createClient> {\n let {\n // eslint-disable-next-line prefer-const\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\n } = config\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return _createClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","_createClient"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n type ClientConfig as _ClientConfig,\n createClient as _createClient,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig extends Omit<_ClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: _ClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: _ClientConfig['encodeSourceMap']\n}\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): ReturnType<typeof _createClient> {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return _createClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","_createClient"],"mappings":";;;;;;;;;;;;;AA4BO,SAASA,aAAaC,MAAwD,EAAA;EAC/E,IAAA;IAAA;IAEFC,SAAA,GAAYC,QAAQC,GAAI,CAAAC,6BAAA;IACxBC,eAAA,GAAmBJ,YAAY,MAAS,GAAA;EACtC,CAAA,GAAAD,MAAA;EAEJ,IAAIK,eAAoB,KAAA,MAAA,IAAUH,OAAQ,CAAAC,GAAA,CAAIG,2BAA2B,SAAW,EAAA;IAChED,eAAA,GAAA,IAAA;EACpB;EACA,OAAOE,MAAAA,CAAAA,aAAc;IAAC,GAAGP,MAAQ;IAAAC,SAAA;IAAWI;EAAgB,CAAA,CAAA;AAC9D;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {ClientConfig} from '@sanity/client'
|
|
2
|
-
import {ClientConfig as ClientConfig_3} from '@sanity/preview-kit/client'
|
|
1
|
+
import {ClientConfig as ClientConfig_2} from '@sanity/preview-kit/client'
|
|
3
2
|
import {createClient as createClient_2} from '@sanity/preview-kit/client'
|
|
4
3
|
import {default as groq} from 'groq'
|
|
5
|
-
import {SanityClient} from '@sanity/client'
|
|
6
|
-
|
|
7
|
-
export {ClientConfig}
|
|
8
4
|
|
|
9
5
|
/** @public */
|
|
10
|
-
declare interface
|
|
6
|
+
export declare interface ClientConfig
|
|
7
|
+
extends Omit<ClientConfig_2, 'studioUrl' | 'encodeSourceMap'> {
|
|
11
8
|
/**
|
|
12
9
|
* Where the Studio is hosted.
|
|
13
10
|
* If it's embedded in the app, use the base path for example `/studio`.
|
|
@@ -15,22 +12,22 @@ declare interface ClientConfig_2 extends Omit<ClientConfig_3, 'studioUrl' | 'enc
|
|
|
15
12
|
* @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL
|
|
16
13
|
* @alpha
|
|
17
14
|
*/
|
|
18
|
-
studioUrl?:
|
|
15
|
+
studioUrl?: ClientConfig_2['studioUrl']
|
|
19
16
|
/**
|
|
20
17
|
* If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.
|
|
21
18
|
* @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'
|
|
22
19
|
* @alpha
|
|
23
20
|
*/
|
|
24
|
-
encodeSourceMap?:
|
|
21
|
+
encodeSourceMap?: ClientConfig_2['encodeSourceMap']
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* @public
|
|
29
26
|
*/
|
|
30
|
-
export declare function createClient(config:
|
|
27
|
+
export declare function createClient(config: ClientConfig): ReturnType<typeof createClient_2>
|
|
31
28
|
|
|
32
29
|
export {groq}
|
|
33
30
|
|
|
34
|
-
export
|
|
31
|
+
export * from '@sanity/preview-kit/client'
|
|
35
32
|
|
|
36
33
|
export {}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createClient as createClient$1 } from '@sanity/preview-kit/client';
|
|
|
2
2
|
export { default as groq } from 'groq';
|
|
3
3
|
function createClient(config) {
|
|
4
4
|
let {
|
|
5
|
-
// eslint-disable-next-line prefer-const
|
|
5
|
+
// eslint-disable-next-line prefer-const, no-process-env
|
|
6
6
|
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,
|
|
7
7
|
encodeSourceMap = studioUrl ? "auto" : false
|
|
8
8
|
} = config;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/client.ts"],"sourcesContent":["import {\n type ClientConfig as _ClientConfig,\n createClient as _createClient,\n} from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig extends Omit<_ClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: _ClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: _ClientConfig['encodeSourceMap']\n}\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): ReturnType<typeof _createClient> {\n let {\n // eslint-disable-next-line prefer-const\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\n } = config\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return _createClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","_createClient"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/client.ts"],"sourcesContent":["import {\n type ClientConfig as _ClientConfig,\n createClient as _createClient,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig extends Omit<_ClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: _ClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: _ClientConfig['encodeSourceMap']\n}\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): ReturnType<typeof _createClient> {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],\n encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return _createClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","_createClient"],"mappings":";;AA4BO,SAASA,aAAaC,MAAwD,EAAA;EAC/E,IAAA;IAAA;IAEFC,SAAA,GAAYC,QAAQC,GAAI,CAAAC,6BAAA;IACxBC,eAAA,GAAmBJ,YAAY,MAAS,GAAA;EACtC,CAAA,GAAAD,MAAA;EAEJ,IAAIK,eAAoB,KAAA,MAAA,IAAUH,OAAQ,CAAAC,GAAA,CAAIG,2BAA2B,SAAW,EAAA;IAChED,eAAA,GAAA,IAAA;EACpB;EACA,OAAOE,eAAc;IAAC,GAAGP,MAAQ;IAAAC,SAAA;IAAWI;EAAgB,CAAA,CAAA;AAC9D;"}
|
package/dist/studio/loading.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import type {Config} from 'sanity'
|
|
|
4
4
|
import type {SingleWorkspace} from 'sanity'
|
|
5
5
|
import type {StudioProps} from 'sanity'
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @alpha
|
|
9
|
+
* @deprecated Will be removed in the next major release
|
|
10
|
+
*/
|
|
7
11
|
export declare function NextStudioLoading(props: NextStudioLoadingProps): JSX.Element
|
|
8
12
|
|
|
9
13
|
/**
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
createClient as _createClient,
|
|
4
4
|
} from '@sanity/preview-kit/client'
|
|
5
5
|
|
|
6
|
+
export type * from '@sanity/preview-kit/client'
|
|
7
|
+
|
|
6
8
|
/** @public */
|
|
7
9
|
export interface ClientConfig extends Omit<_ClientConfig, 'studioUrl' | 'encodeSourceMap'> {
|
|
8
10
|
/**
|
|
@@ -26,10 +28,11 @@ export interface ClientConfig extends Omit<_ClientConfig, 'studioUrl' | 'encodeS
|
|
|
26
28
|
*/
|
|
27
29
|
export function createClient(config: ClientConfig): ReturnType<typeof _createClient> {
|
|
28
30
|
let {
|
|
29
|
-
// eslint-disable-next-line prefer-const
|
|
31
|
+
// eslint-disable-next-line prefer-const, no-process-env
|
|
30
32
|
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as _ClientConfig['studioUrl'],
|
|
31
33
|
encodeSourceMap = (studioUrl ? 'auto' : false) satisfies _ClientConfig['encodeSourceMap'],
|
|
32
34
|
} = config
|
|
35
|
+
// eslint-disable-next-line no-process-env
|
|
33
36
|
if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
|
|
34
37
|
encodeSourceMap = true
|
|
35
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -36,6 +36,10 @@ to {
|
|
|
36
36
|
}
|
|
37
37
|
`
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @alpha
|
|
41
|
+
* @deprecated Will be removed in the next major release
|
|
42
|
+
*/
|
|
39
43
|
export function NextStudioLoading(props: NextStudioLoadingProps) {
|
|
40
44
|
const {config, scheme = 'light', unstable__noScript = true} = props
|
|
41
45
|
const id = 'next-sanity-spinner'
|