next-sanity 5.2.2 → 5.2.3
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/studio/index.cjs +14 -31
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +14 -25
- package/dist/studio/index.js.map +1 -1
- package/package.json +2 -2
- package/src/studio/NextStudioLayout.tsx +11 -19
package/dist/studio/index.cjs
CHANGED
|
@@ -6,14 +6,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var sanity = require('sanity');
|
|
9
|
-
var styled = require('styled-components');
|
|
10
9
|
var studio_loading = require('../_chunks/loading-225bb240.cjs');
|
|
11
|
-
function _interopDefaultCompat(e) {
|
|
12
|
-
return e && typeof e === 'object' && 'default' in e ? e : {
|
|
13
|
-
default: e
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
17
10
|
function NextStudioClientOnly(_ref) {
|
|
18
11
|
let {
|
|
19
12
|
children,
|
|
@@ -25,39 +18,29 @@ function NextStudioClientOnly(_ref) {
|
|
|
25
18
|
children: mounted ? children : fallback
|
|
26
19
|
});
|
|
27
20
|
}
|
|
28
|
-
|
|
29
|
-
var __defProp = Object.defineProperty;
|
|
30
|
-
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", {
|
|
31
|
-
value: __freeze(raw || cooked.slice())
|
|
32
|
-
}));
|
|
33
|
-
var _a;
|
|
34
|
-
const Layout = styled__default.default.div(_a || (_a = __template(["\n font-family: ", ";\n background-color: ", ";\n height: 100vh;\n max-height: 100dvh;\n overscroll-behavior: none;\n -webkit-font-smoothing: antialiased;\n overflow: auto;\n"])), _ref2 => {
|
|
35
|
-
let {
|
|
36
|
-
$fontFamily
|
|
37
|
-
} = _ref2;
|
|
38
|
-
return $fontFamily;
|
|
39
|
-
}, _ref3 => {
|
|
40
|
-
let {
|
|
41
|
-
$bg
|
|
42
|
-
} = _ref3;
|
|
43
|
-
return $bg;
|
|
44
|
-
});
|
|
45
|
-
const NextStudioLayoutComponent = _ref4 => {
|
|
21
|
+
const NextStudioLayoutComponent = _ref2 => {
|
|
46
22
|
let {
|
|
47
23
|
children,
|
|
48
24
|
config,
|
|
49
25
|
scheme = "light"
|
|
50
|
-
} =
|
|
26
|
+
} = _ref2;
|
|
51
27
|
const theme = studio_loading.useTheme(config);
|
|
52
|
-
return /* @__PURE__ */jsxRuntime.jsx(
|
|
28
|
+
return /* @__PURE__ */jsxRuntime.jsx("div", {
|
|
53
29
|
"data-ui": "NextStudioLayout",
|
|
54
|
-
|
|
55
|
-
|
|
30
|
+
style: {
|
|
31
|
+
fontFamily: theme.fonts.text.family,
|
|
32
|
+
backgroundColor: theme.color[scheme === "dark" ? "dark" : "light"].default.base.bg,
|
|
33
|
+
height: "100vh",
|
|
34
|
+
maxHeight: "100dvh",
|
|
35
|
+
overscrollBehavior: "none",
|
|
36
|
+
WebkitFontSmoothing: "antialiased",
|
|
37
|
+
overflow: "auto"
|
|
38
|
+
},
|
|
56
39
|
children
|
|
57
40
|
});
|
|
58
41
|
};
|
|
59
42
|
const NextStudioLayout = react.memo(NextStudioLayoutComponent);
|
|
60
|
-
const NextStudioComponent =
|
|
43
|
+
const NextStudioComponent = _ref3 => {
|
|
61
44
|
let {
|
|
62
45
|
children,
|
|
63
46
|
config,
|
|
@@ -65,7 +48,7 @@ const NextStudioComponent = _ref5 => {
|
|
|
65
48
|
unstable__fastRender,
|
|
66
49
|
scheme,
|
|
67
50
|
...props
|
|
68
|
-
} =
|
|
51
|
+
} = _ref3;
|
|
69
52
|
if (unstable__fastRender) {
|
|
70
53
|
return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
71
54
|
children: [unstable__noScript && /* @__PURE__ */jsxRuntime.jsx(studio_loading.NextStudioNoScript, {}), /* @__PURE__ */jsxRuntime.jsx(NextStudioLayout, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/studio/NextStudioClientOnly.tsx","../../src/studio/NextStudioLayout.tsx","../../src/studio/NextStudio.tsx","../../src/studio/usePrefersColorScheme.ts"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n","/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/studio/NextStudioClientOnly.tsx","../../src/studio/NextStudioLayout.tsx","../../src/studio/NextStudio.tsx","../../src/studio/usePrefersColorScheme.ts"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n","/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\n\nimport {useTheme} from './useTheme'\n\n/** @alpha */\nexport interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'scheme'> {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({\n children,\n config,\n scheme = 'light',\n}: NextStudioLayoutProps) => {\n const theme = useTheme(config)\n\n return (\n <div\n data-ui=\"NextStudioLayout\"\n style={{\n fontFamily: theme.fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n {children}\n </div>\n )\n}\n\n/** @alpha */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n","import {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioClientOnly} from './NextStudioClientOnly'\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioLoading} from './NextStudioLoading'\nimport {NextStudioNoScript} from './NextStudioNoScript'\n\nexport type {NextStudioLoadingProps} from './NextStudioLoading'\n\n/** @beta */\nexport interface NextStudioProps extends StudioProps {\n children?: React.ReactNode\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n /**\n * Render in a faster mode that requires `styled-components` SSR to be setup.\n * @defaultValue false\n * @alpha\n */\n unstable__fastRender?: boolean\n}\n/**\n * Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noScript = true,\n unstable__fastRender,\n scheme,\n ...props\n}: NextStudioProps) => {\n if (unstable__fastRender) {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </>\n )\n }\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioClientOnly\n fallback={\n <NextStudioLoading\n unstable__noScript={unstable__noScript}\n config={config}\n scheme={scheme}\n />\n }\n >\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </NextStudioClientOnly>\n </>\n )\n}\n\n/**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * ```\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n * ```\n * @beta\n */\nexport const NextStudio = memo(NextStudioComponent)\n","/* eslint-disable @typescript-eslint/no-empty-function */\nimport type {ThemeColorSchemeKey} from '@sanity/ui'\nimport {useSyncExternalStore} from 'react'\n\nfunction createStore() {\n if (typeof document === 'undefined') {\n return {\n subscribe: () => () => {},\n getSnapshot: () => 'light' as const,\n getServerSnapshot: () => 'light' as const,\n }\n }\n\n const matchMedia = window.matchMedia('(prefers-color-scheme: dark)')\n\n return {\n subscribe: (onStoreChange: () => void) => {\n matchMedia.addEventListener('change', onStoreChange)\n return () => matchMedia.removeEventListener('change', onStoreChange)\n },\n getSnapshot: () => (matchMedia.matches ? 'dark' : 'light'),\n getServerSnapshot: () => 'light' as const,\n }\n}\nconst store = createStore()\n\n/** @alpha */\nexport function usePrefersColorScheme(): ThemeColorSchemeKey {\n return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot)\n}\n"],"names":["NextStudioClientOnly","_ref","children","fallback","mounted","setMounted","useState","useEffect","startTransition","jsx","Fragment","NextStudioLayoutComponent","_ref2","config","scheme","theme","useTheme","style","fontFamily","fonts","text","family","backgroundColor","color","default","base","bg","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","NextStudioLayout","memo","NextStudioComponent","_ref3","unstable__noScript","unstable__fastRender","props","jsxs","NextStudioNoScript","Studio","unstable_globalStyles","NextStudioLoading","NextStudio","createStore","document","subscribe","getSnapshot","getServerSnapshot","matchMedia","window","onStoreChange","addEventListener","removeEventListener","matches","store","usePrefersColorScheme","useSyncExternalStore"],"mappings":";;;;;;;;;AASO,SAASA,oBAAqBA,CAAAC,IAAA,EAAiD;EAAA,IAAjD;IAACC,QAAU;IAAAC;GAAsC,GAA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A,KAAM,MAAM,CAAC,CAAA;MACxBC,aAAaA,CAAA,KAAM,OAAA;MACnBC,mBAAmBA,CAAA,KAAM;IAAA,CAC3B;EACF;EAEM,MAAAC,UAAA,GAAaC,MAAO,CAAAD,UAAA,CAAW,8BAA8B,CAAA;EAE5D,OAAA;IACLH,SAAA,EAAYK,aAA8B,IAAA;MAC7BF,UAAA,CAAAG,gBAAA,CAAiB,UAAUD,aAAa,CAAA;MACnD,OAAO,MAAMF,UAAA,CAAWI,mBAAoB,CAAA,QAAA,EAAUF,aAAa,CAAA;IACrE,CAAA;IACAJ,WAAa,EAAAA,CAAA,KAAOE,UAAW,CAAAK,OAAA,GAAU,MAAS,GAAA,OAAA;IAClDN,mBAAmBA,CAAA,KAAM;EAAA,CAC3B;AACF;AACA,MAAMO,QAAQX,WAAY,CAAA,CAAA;AAGnB,SAASY,qBAA6CA,CAAA,EAAA;EAC3D,OAAOC,KAAAA,CAAAA,qBAAqBF,KAAM,CAAAT,SAAA,EAAWS,KAAM,CAAAR,WAAA,EAAaQ,MAAMP,iBAAiB,CAAA;AACzF;;;;;;"}
|
package/dist/studio/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useEffect, startTransition, memo, useSyncExternalStore } from 'react';
|
|
3
3
|
import { Studio } from 'sanity';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
4
|
import { useTheme, NextStudioNoScript, NextStudioLoading } from '../_chunks/loading-2003f32a.js';
|
|
6
5
|
function NextStudioClientOnly(_ref) {
|
|
7
6
|
let {
|
|
@@ -14,39 +13,29 @@ function NextStudioClientOnly(_ref) {
|
|
|
14
13
|
children: mounted ? children : fallback
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
var __defProp = Object.defineProperty;
|
|
19
|
-
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", {
|
|
20
|
-
value: __freeze(raw || cooked.slice())
|
|
21
|
-
}));
|
|
22
|
-
var _a;
|
|
23
|
-
const Layout = styled.div(_a || (_a = __template(["\n font-family: ", ";\n background-color: ", ";\n height: 100vh;\n max-height: 100dvh;\n overscroll-behavior: none;\n -webkit-font-smoothing: antialiased;\n overflow: auto;\n"])), _ref2 => {
|
|
24
|
-
let {
|
|
25
|
-
$fontFamily
|
|
26
|
-
} = _ref2;
|
|
27
|
-
return $fontFamily;
|
|
28
|
-
}, _ref3 => {
|
|
29
|
-
let {
|
|
30
|
-
$bg
|
|
31
|
-
} = _ref3;
|
|
32
|
-
return $bg;
|
|
33
|
-
});
|
|
34
|
-
const NextStudioLayoutComponent = _ref4 => {
|
|
16
|
+
const NextStudioLayoutComponent = _ref2 => {
|
|
35
17
|
let {
|
|
36
18
|
children,
|
|
37
19
|
config,
|
|
38
20
|
scheme = "light"
|
|
39
|
-
} =
|
|
21
|
+
} = _ref2;
|
|
40
22
|
const theme = useTheme(config);
|
|
41
|
-
return /* @__PURE__ */jsx(
|
|
23
|
+
return /* @__PURE__ */jsx("div", {
|
|
42
24
|
"data-ui": "NextStudioLayout",
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
style: {
|
|
26
|
+
fontFamily: theme.fonts.text.family,
|
|
27
|
+
backgroundColor: theme.color[scheme === "dark" ? "dark" : "light"].default.base.bg,
|
|
28
|
+
height: "100vh",
|
|
29
|
+
maxHeight: "100dvh",
|
|
30
|
+
overscrollBehavior: "none",
|
|
31
|
+
WebkitFontSmoothing: "antialiased",
|
|
32
|
+
overflow: "auto"
|
|
33
|
+
},
|
|
45
34
|
children
|
|
46
35
|
});
|
|
47
36
|
};
|
|
48
37
|
const NextStudioLayout = memo(NextStudioLayoutComponent);
|
|
49
|
-
const NextStudioComponent =
|
|
38
|
+
const NextStudioComponent = _ref3 => {
|
|
50
39
|
let {
|
|
51
40
|
children,
|
|
52
41
|
config,
|
|
@@ -54,7 +43,7 @@ const NextStudioComponent = _ref5 => {
|
|
|
54
43
|
unstable__fastRender,
|
|
55
44
|
scheme,
|
|
56
45
|
...props
|
|
57
|
-
} =
|
|
46
|
+
} = _ref3;
|
|
58
47
|
if (unstable__fastRender) {
|
|
59
48
|
return /* @__PURE__ */jsxs(Fragment, {
|
|
60
49
|
children: [unstable__noScript && /* @__PURE__ */jsx(NextStudioNoScript, {}), /* @__PURE__ */jsx(NextStudioLayout, {
|
package/dist/studio/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/studio/NextStudioClientOnly.tsx","../../src/studio/NextStudioLayout.tsx","../../src/studio/NextStudio.tsx","../../src/studio/usePrefersColorScheme.ts"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n","/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/studio/NextStudioClientOnly.tsx","../../src/studio/NextStudioLayout.tsx","../../src/studio/NextStudio.tsx","../../src/studio/usePrefersColorScheme.ts"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n","/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\n\nimport {useTheme} from './useTheme'\n\n/** @alpha */\nexport interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'scheme'> {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({\n children,\n config,\n scheme = 'light',\n}: NextStudioLayoutProps) => {\n const theme = useTheme(config)\n\n return (\n <div\n data-ui=\"NextStudioLayout\"\n style={{\n fontFamily: theme.fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n {children}\n </div>\n )\n}\n\n/** @alpha */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n","import {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioClientOnly} from './NextStudioClientOnly'\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioLoading} from './NextStudioLoading'\nimport {NextStudioNoScript} from './NextStudioNoScript'\n\nexport type {NextStudioLoadingProps} from './NextStudioLoading'\n\n/** @beta */\nexport interface NextStudioProps extends StudioProps {\n children?: React.ReactNode\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n /**\n * Render in a faster mode that requires `styled-components` SSR to be setup.\n * @defaultValue false\n * @alpha\n */\n unstable__fastRender?: boolean\n}\n/**\n * Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noScript = true,\n unstable__fastRender,\n scheme,\n ...props\n}: NextStudioProps) => {\n if (unstable__fastRender) {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </>\n )\n }\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioClientOnly\n fallback={\n <NextStudioLoading\n unstable__noScript={unstable__noScript}\n config={config}\n scheme={scheme}\n />\n }\n >\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </NextStudioClientOnly>\n </>\n )\n}\n\n/**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * ```\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n * ```\n * @beta\n */\nexport const NextStudio = memo(NextStudioComponent)\n","/* eslint-disable @typescript-eslint/no-empty-function */\nimport type {ThemeColorSchemeKey} from '@sanity/ui'\nimport {useSyncExternalStore} from 'react'\n\nfunction createStore() {\n if (typeof document === 'undefined') {\n return {\n subscribe: () => () => {},\n getSnapshot: () => 'light' as const,\n getServerSnapshot: () => 'light' as const,\n }\n }\n\n const matchMedia = window.matchMedia('(prefers-color-scheme: dark)')\n\n return {\n subscribe: (onStoreChange: () => void) => {\n matchMedia.addEventListener('change', onStoreChange)\n return () => matchMedia.removeEventListener('change', onStoreChange)\n },\n getSnapshot: () => (matchMedia.matches ? 'dark' : 'light'),\n getServerSnapshot: () => 'light' as const,\n }\n}\nconst store = createStore()\n\n/** @alpha */\nexport function usePrefersColorScheme(): ThemeColorSchemeKey {\n return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot)\n}\n"],"names":["NextStudioClientOnly","_ref","children","fallback","mounted","setMounted","useState","useEffect","startTransition","jsx","Fragment","NextStudioLayoutComponent","_ref2","config","scheme","theme","useTheme","style","fontFamily","fonts","text","family","backgroundColor","color","default","base","bg","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","NextStudioLayout","memo","NextStudioComponent","_ref3","unstable__noScript","unstable__fastRender","props","jsxs","NextStudioNoScript","Studio","unstable_globalStyles","NextStudioLoading","NextStudio","createStore","document","subscribe","getSnapshot","getServerSnapshot","matchMedia","window","onStoreChange","addEventListener","removeEventListener","matches","store","usePrefersColorScheme","useSyncExternalStore"],"mappings":";;;;AASO,SAASA,oBAAqBA,CAAAC,IAAA,EAAiD;EAAA,IAAjD;IAACC,QAAU;IAAAC;GAAsC,GAAAF,IAAA;EACpF,MAAM,CAACG,OAAA,EAASC,UAAU,CAAA,GAAIC,SAAS,KAAK,CAAA;EAClCC,SAAA,CAAA,MAAMC,gBAAgB,MAAMH,UAAA,CAAW,IAAI,CAAC,CAAA,EAAG,EAAE,CAAA;EAEpD,OAAA,eAAAI,GAAA,CAAAC,QAAA,EAAA;IAAGR,QAAU,EAAAE,OAAA,GAAAF,QAAA,GAAWC;EAAS,CAAA,CAAA;AAC1C;ACHA,MAAMQ,4BAA4BC,KAAA,IAIL;EAAA,IAJM;IACjCV,QAAA;IACAW,MAAA;IACAC,MAAS,GAAA;EACX,CAA6B,GAAAF,KAAA;EACrB,MAAAG,KAAA,GAAQC,SAASH,MAAM,CAAA;EAG3B,sBAAAJ,GAAA,CAAC,KAAA,EAAA;IACC,SAAQ,EAAA,kBAAA;IACRQ,KAAO,EAAA;MACLC,UAAA,EAAYH,KAAM,CAAAI,KAAA,CAAMC,IAAK,CAAAC,MAAA;MAC7BC,eAAA,EAAiBP,MAAMQ,KAAM,CAAAT,MAAA,KAAW,SAAS,MAAS,GAAA,OAAO,CAAE,CAAAU,OAAA,CAAQC,IAAK,CAAAC,EAAA;MAChFC,MAAQ,EAAA,OAAA;MACRC,SAAW,EAAA,QAAA;MACXC,kBAAoB,EAAA,MAAA;MACpBC,mBAAqB,EAAA,aAAA;MACrBC,QAAU,EAAA;IACZ,CAAA;IAEC7B;EAAA,CAAA,CACH;AAEJ,CAAA;AAGa,MAAA8B,gBAAA,GAAmBC,KAAKtB,yBAAyB,CAAA;ACP9D,MAAMuB,sBAAsBC,KAAA,IAOL;EAAA,IAPM;IAC3Bj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;MACxBC,aAAaA,CAAA,KAAM,OAAA;MACnBC,mBAAmBA,CAAA,KAAM;IAAA,CAC3B;EACF;EAEM,MAAAC,UAAA,GAAaC,MAAO,CAAAD,UAAA,CAAW,8BAA8B,CAAA;EAE5D,OAAA;IACLH,SAAA,EAAYK,aAA8B,IAAA;MAC7BF,UAAA,CAAAG,gBAAA,CAAiB,UAAUD,aAAa,CAAA;MACnD,OAAO,MAAMF,UAAA,CAAWI,mBAAoB,CAAA,QAAA,EAAUF,aAAa,CAAA;IACrE,CAAA;IACAJ,WAAa,EAAAA,CAAA,KAAOE,UAAW,CAAAK,OAAA,GAAU,MAAS,GAAA,OAAA;IAClDN,mBAAmBA,CAAA,KAAM;EAAA,CAC3B;AACF;AACA,MAAMO,QAAQX,WAAY,CAAA,CAAA;AAGnB,SAASY,qBAA6CA,CAAA,EAAA;EAC3D,OAAOC,qBAAqBF,KAAM,CAAAT,SAAA,EAAWS,KAAM,CAAAR,WAAA,EAAaQ,MAAMP,iBAAiB,CAAA;AACzF;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.3",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"@sanity/client": "6.4.3",
|
|
171
171
|
"@sanity/eslint-config-studio": "^3.0.0",
|
|
172
172
|
"@sanity/image-url": "^1.0.2",
|
|
173
|
-
"@sanity/pkg-utils": "^2.4.
|
|
173
|
+
"@sanity/pkg-utils": "^2.4.1",
|
|
174
174
|
"@sanity/semantic-release-preset": "^4.1.3",
|
|
175
175
|
"@sanity/ui": "^1.7.4",
|
|
176
176
|
"@sanity/vision": "3.14.5",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import {memo} from 'react'
|
|
3
3
|
import type {StudioProps} from 'sanity'
|
|
4
|
-
import styled from 'styled-components'
|
|
5
4
|
|
|
6
5
|
import {useTheme} from './useTheme'
|
|
7
6
|
|
|
@@ -10,20 +9,6 @@ export interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'sch
|
|
|
10
9
|
children: React.ReactNode
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
type LayoutProps = {
|
|
14
|
-
$bg: string
|
|
15
|
-
$fontFamily: string
|
|
16
|
-
}
|
|
17
|
-
const Layout = styled.div<LayoutProps>`
|
|
18
|
-
font-family: ${({$fontFamily}) => $fontFamily};
|
|
19
|
-
background-color: ${({$bg}: any) => $bg};
|
|
20
|
-
height: 100vh;
|
|
21
|
-
max-height: 100dvh;
|
|
22
|
-
overscroll-behavior: none;
|
|
23
|
-
-webkit-font-smoothing: antialiased;
|
|
24
|
-
overflow: auto;
|
|
25
|
-
`
|
|
26
|
-
|
|
27
12
|
const NextStudioLayoutComponent = ({
|
|
28
13
|
children,
|
|
29
14
|
config,
|
|
@@ -32,13 +17,20 @@ const NextStudioLayoutComponent = ({
|
|
|
32
17
|
const theme = useTheme(config)
|
|
33
18
|
|
|
34
19
|
return (
|
|
35
|
-
<
|
|
20
|
+
<div
|
|
36
21
|
data-ui="NextStudioLayout"
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
style={{
|
|
23
|
+
fontFamily: theme.fonts.text.family,
|
|
24
|
+
backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,
|
|
25
|
+
height: '100vh',
|
|
26
|
+
maxHeight: '100dvh',
|
|
27
|
+
overscrollBehavior: 'none',
|
|
28
|
+
WebkitFontSmoothing: 'antialiased',
|
|
29
|
+
overflow: 'auto',
|
|
30
|
+
}}
|
|
39
31
|
>
|
|
40
32
|
{children}
|
|
41
|
-
</
|
|
33
|
+
</div>
|
|
42
34
|
)
|
|
43
35
|
}
|
|
44
36
|
|