next-sanity 5.2.7 → 5.4.0
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/client.cjs +23 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.js +18 -0
- package/dist/client.js.map +1 -0
- package/dist/index.cjs +2 -17
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -17
- package/dist/index.js.map +1 -1
- package/dist/preview/index.cjs +12 -0
- package/dist/preview/index.cjs.js +1 -0
- package/dist/preview/index.cjs.map +1 -1
- package/dist/preview/index.d.ts +3 -3
- package/dist/preview/index.js +1 -1
- package/dist/preview/live-query.cjs +21 -0
- package/dist/preview/live-query.cjs.js +5 -0
- package/dist/preview/live-query.cjs.map +1 -0
- package/dist/preview/live-query.d.ts +7 -0
- package/dist/preview/live-query.js +3 -0
- package/dist/preview/live-query.js.map +1 -0
- package/dist/studio/NextStudio.cjs +58 -0
- package/dist/studio/NextStudio.cjs.map +1 -0
- package/dist/studio/NextStudio.js +53 -0
- package/dist/studio/NextStudio.js.map +1 -0
- package/dist/studio/NextStudioClientOnly.cjs +20 -0
- package/dist/studio/NextStudioClientOnly.cjs.map +1 -0
- package/dist/studio/NextStudioClientOnly.js +15 -0
- package/dist/studio/NextStudioClientOnly.js.map +1 -0
- package/dist/studio/NextStudioLayout.cjs +32 -0
- package/dist/studio/NextStudioLayout.cjs.map +1 -0
- package/dist/studio/NextStudioLayout.js +27 -0
- package/dist/studio/NextStudioLayout.js.map +1 -0
- package/dist/{_chunks/loading-225bb240.cjs → studio/NextStudioLoading.cjs} +9 -32
- package/dist/studio/NextStudioLoading.cjs.map +1 -0
- package/dist/{_chunks/loading-2003f32a.js → studio/NextStudioLoading.js} +7 -31
- package/dist/studio/NextStudioLoading.js.map +1 -0
- package/dist/studio/NextStudioNoScript.cjs +30 -0
- package/dist/studio/NextStudioNoScript.cjs.map +1 -0
- package/dist/studio/NextStudioNoScript.js +25 -0
- package/dist/studio/NextStudioNoScript.js.map +1 -0
- package/dist/studio/head/NextStudioHead.cjs +51 -0
- package/dist/studio/head/NextStudioHead.cjs.map +1 -0
- package/dist/studio/head/NextStudioHead.js +46 -0
- package/dist/studio/head/NextStudioHead.js.map +1 -0
- package/dist/studio/head/apple-touch-icon.png.cjs +5 -0
- package/dist/studio/head/apple-touch-icon.png.cjs.map +1 -0
- package/dist/studio/head/apple-touch-icon.png.js +3 -0
- package/dist/studio/head/apple-touch-icon.png.js.map +1 -0
- package/dist/studio/head/favicon.ico.cjs +5 -0
- package/dist/studio/head/favicon.ico.cjs.map +1 -0
- package/dist/studio/head/favicon.ico.js +3 -0
- package/dist/studio/head/favicon.ico.js.map +1 -0
- package/dist/studio/head/favicon.svg.cjs +5 -0
- package/dist/studio/head/favicon.svg.cjs.map +1 -0
- package/dist/studio/head/favicon.svg.js +3 -0
- package/dist/studio/head/favicon.svg.js.map +1 -0
- package/dist/studio/head.cjs +2 -45
- package/dist/studio/head.cjs.map +1 -1
- package/dist/studio/head.js +1 -45
- package/dist/studio/head.js.map +1 -1
- package/dist/studio/index.cjs +12 -109
- package/dist/studio/index.cjs.js +2 -2
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +6 -104
- package/dist/studio/index.js.map +1 -1
- package/dist/studio/loading.cjs +2 -2
- package/dist/studio/loading.js +1 -1
- package/dist/studio/usePrefersColorScheme.cjs +30 -0
- package/dist/studio/usePrefersColorScheme.cjs.map +1 -0
- package/dist/studio/usePrefersColorScheme.js +25 -0
- package/dist/studio/usePrefersColorScheme.js.map +1 -0
- package/dist/studio/useTheme.cjs +13 -0
- package/dist/studio/useTheme.cjs.map +1 -0
- package/dist/studio/useTheme.js +8 -0
- package/dist/studio/useTheme.js.map +1 -0
- package/dist/webhook/config.cjs +19 -0
- package/dist/webhook/config.cjs.map +1 -0
- package/dist/webhook/config.js +14 -0
- package/dist/webhook/config.js.map +1 -0
- package/dist/webhook/parseBody.cjs +39 -0
- package/dist/webhook/parseBody.cjs.map +1 -0
- package/dist/webhook/parseBody.js +33 -0
- package/dist/webhook/parseBody.js.map +1 -0
- package/dist/webhook/readBody.cjs +14 -0
- package/dist/webhook/readBody.cjs.map +1 -0
- package/dist/webhook/readBody.js +9 -0
- package/dist/webhook/readBody.js.map +1 -0
- package/dist/webhook.cjs +5 -52
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.js +2 -50
- package/dist/webhook.js.map +1 -1
- package/package.json +20 -4
- package/src/preview/LiveQuery/LiveQuery.tsx +10 -0
- package/src/preview/LiveQuery/LiveQueryClientComponent.tsx +8 -0
- package/src/preview/LiveQuery/index.ts +2 -0
- package/src/preview/index.ts +1 -2
- package/src/studio/NextStudioLoading.tsx +2 -0
- package/dist/_chunks/loading-2003f32a.js.map +0 -1
- package/dist/_chunks/loading-225bb240.cjs.map +0 -1
- package/src/preview/LiveQueryProvider/index.tsx +0 -29
package/dist/client.cjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var client = require('@sanity/preview-kit/client');
|
|
7
|
+
function createClient(config) {
|
|
8
|
+
let {
|
|
9
|
+
// eslint-disable-next-line prefer-const, no-process-env
|
|
10
|
+
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,
|
|
11
|
+
encodeSourceMap = studioUrl ? "auto" : false
|
|
12
|
+
} = config;
|
|
13
|
+
if (encodeSourceMap === "auto" && process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") {
|
|
14
|
+
encodeSourceMap = true;
|
|
15
|
+
}
|
|
16
|
+
return client.createClient({
|
|
17
|
+
...config,
|
|
18
|
+
studioUrl,
|
|
19
|
+
encodeSourceMap
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
exports.createClient = createClient;
|
|
23
|
+
//# sourceMappingURL=client.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.cjs","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = studioUrl ? 'auto' : false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","createPreviewKitClient"],"mappings":";;;;;;AAgCO,SAASA,aAAaC,MAAoC,EAAA;EAC3D,IAAA;IAAA;IAEFC,SAAA,GAAYC,QAAQC,GAAI,CAAAC,6BAAA;IACxBC,eAAA,GAAkBJ,YAAY,MAAS,GAAA;EACrC,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,aAAuB;IAAC,GAAGP,MAAQ;IAAAC,SAAA;IAAWI;EAAgB,CAAA,CAAA;AACvE;"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createClient as createClient$1 } from '@sanity/preview-kit/client';
|
|
2
|
+
function createClient(config) {
|
|
3
|
+
let {
|
|
4
|
+
// eslint-disable-next-line prefer-const, no-process-env
|
|
5
|
+
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,
|
|
6
|
+
encodeSourceMap = studioUrl ? "auto" : false
|
|
7
|
+
} = config;
|
|
8
|
+
if (encodeSourceMap === "auto" && process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") {
|
|
9
|
+
encodeSourceMap = true;
|
|
10
|
+
}
|
|
11
|
+
return createClient$1({
|
|
12
|
+
...config,
|
|
13
|
+
studioUrl,
|
|
14
|
+
encodeSourceMap
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { createClient };
|
|
18
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import {\n createClient as createPreviewKitClient,\n type PreviewKitClientConfig,\n} from '@sanity/preview-kit/client'\n\nexport type * from '@sanity/preview-kit/client'\n\n/** @public */\nexport interface ClientConfig\n extends Omit<PreviewKitClientConfig, 'studioUrl' | 'encodeSourceMap'> {\n /**\n * Where the Studio is hosted.\n * If it's embedded in the app, use the base path for example `/studio`.\n * Otherwise provide the full URL to where the Studio is hosted, for example: `https://blog.sanity.studio`.\n * @defaultValue process.env.NEXT_PUBLIC_SANITY_STUDIO_URL\n * @alpha\n */\n studioUrl?: PreviewKitClientConfig['studioUrl']\n /**\n * If there's no `studioUrl` then the default value is `none` and the normal `@sanity/client` will be used. If `studioUrl` is set, then it's `auto` by default.\n * @defaultValue process.env.MEXT_PUBLIC_SANITY_SOURCE_MAP || studioUrl ? 'auto' : 'none'\n * @alpha\n */\n encodeSourceMap?: PreviewKitClientConfig['encodeSourceMap']\n}\n\n/** @public */\nexport type SanityClient = ReturnType<typeof createPreviewKitClient>\n\n/**\n * @public\n */\nexport function createClient(config: ClientConfig): SanityClient {\n let {\n // eslint-disable-next-line prefer-const, no-process-env\n studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL! as PreviewKitClientConfig['studioUrl'],\n encodeSourceMap = studioUrl ? 'auto' : false,\n } = config\n // eslint-disable-next-line no-process-env\n if (encodeSourceMap === 'auto' && process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {\n encodeSourceMap = true\n }\n return createPreviewKitClient({...config, studioUrl, encodeSourceMap})\n}\n"],"names":["createClient","config","studioUrl","process","env","NEXT_PUBLIC_SANITY_STUDIO_URL","encodeSourceMap","NEXT_PUBLIC_VERCEL_ENV","createPreviewKitClient"],"mappings":";AAgCO,SAASA,aAAaC,MAAoC,EAAA;EAC3D,IAAA;IAAA;IAEFC,SAAA,GAAYC,QAAQC,GAAI,CAAAC,6BAAA;IACxBC,eAAA,GAAkBJ,YAAY,MAAS,GAAA;EACrC,CAAA,GAAAD,MAAA;EAEJ,IAAIK,eAAoB,KAAA,MAAA,IAAUH,OAAQ,CAAAC,GAAA,CAAIG,2BAA2B,SAAW,EAAA;IAChED,eAAA,GAAA,IAAA;EACpB;EACA,OAAOE,eAAuB;IAAC,GAAGP,MAAQ;IAAAC,SAAA;IAAWI;EAAgB,CAAA,CAAA;AACvE;"}
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var client = require('
|
|
6
|
+
var client = require('./client.cjs');
|
|
7
7
|
var groq = require('groq');
|
|
8
8
|
function _interopDefaultCompat(e) {
|
|
9
9
|
return e && typeof e === 'object' && 'default' in e ? e : {
|
|
@@ -11,26 +11,11 @@ function _interopDefaultCompat(e) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
var groq__default = /*#__PURE__*/_interopDefaultCompat(groq);
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
// eslint-disable-next-line prefer-const, no-process-env
|
|
17
|
-
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,
|
|
18
|
-
encodeSourceMap = studioUrl ? "auto" : false
|
|
19
|
-
} = config;
|
|
20
|
-
if (encodeSourceMap === "auto" && process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") {
|
|
21
|
-
encodeSourceMap = true;
|
|
22
|
-
}
|
|
23
|
-
return client.createClient({
|
|
24
|
-
...config,
|
|
25
|
-
studioUrl,
|
|
26
|
-
encodeSourceMap
|
|
27
|
-
});
|
|
28
|
-
}
|
|
14
|
+
exports.createClient = client.createClient;
|
|
29
15
|
Object.defineProperty(exports, 'groq', {
|
|
30
16
|
enumerable: true,
|
|
31
17
|
get: function () {
|
|
32
18
|
return groq__default.default;
|
|
33
19
|
}
|
|
34
20
|
});
|
|
35
|
-
exports.createClient = createClient;
|
|
36
21
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.js
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export { createClient } from './client.js';
|
|
2
2
|
export { default as groq } from 'groq';
|
|
3
|
-
function createClient(config) {
|
|
4
|
-
let {
|
|
5
|
-
// eslint-disable-next-line prefer-const, no-process-env
|
|
6
|
-
studioUrl = process.env.NEXT_PUBLIC_SANITY_STUDIO_URL,
|
|
7
|
-
encodeSourceMap = studioUrl ? "auto" : false
|
|
8
|
-
} = config;
|
|
9
|
-
if (encodeSourceMap === "auto" && process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") {
|
|
10
|
-
encodeSourceMap = true;
|
|
11
|
-
}
|
|
12
|
-
return createClient$1({
|
|
13
|
-
...config,
|
|
14
|
-
studioUrl,
|
|
15
|
-
encodeSourceMap
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export { createClient };
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/preview/index.cjs
CHANGED
|
@@ -4,12 +4,24 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var previewKit = require('@sanity/preview-kit');
|
|
7
|
+
function _interopDefaultCompat(e) {
|
|
8
|
+
return e && typeof e === 'object' && 'default' in e ? e : {
|
|
9
|
+
default: e
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
var previewKit__default = /*#__PURE__*/_interopDefaultCompat(previewKit);
|
|
7
13
|
Object.defineProperty(exports, 'LiveQueryProvider', {
|
|
8
14
|
enumerable: true,
|
|
9
15
|
get: function () {
|
|
10
16
|
return previewKit.LiveQueryProvider;
|
|
11
17
|
}
|
|
12
18
|
});
|
|
19
|
+
Object.defineProperty(exports, 'default', {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return previewKit__default.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
13
25
|
Object.defineProperty(exports, 'useLiveQuery', {
|
|
14
26
|
enumerable: true,
|
|
15
27
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/preview/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {CacheOptions} from '@sanity/preview-kit'
|
|
2
2
|
import {ClientQueryParams} from '@sanity/preview-kit'
|
|
3
|
+
import {default as default_2} from '@sanity/preview-kit'
|
|
3
4
|
import {isEqualFn} from '@sanity/preview-kit'
|
|
4
|
-
import {ListenerStatus} from '@sanity/preview-kit'
|
|
5
5
|
import {LiveQueryHookOptions} from '@sanity/preview-kit'
|
|
6
6
|
import {LiveQueryProvider} from '@sanity/preview-kit'
|
|
7
7
|
import {LiveQueryProviderProps} from '@sanity/preview-kit'
|
|
@@ -13,9 +13,9 @@ export {CacheOptions}
|
|
|
13
13
|
|
|
14
14
|
export {ClientQueryParams}
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export default default_2
|
|
17
17
|
|
|
18
|
-
export {
|
|
18
|
+
export {isEqualFn}
|
|
19
19
|
|
|
20
20
|
export {LiveQueryHookOptions}
|
|
21
21
|
|
package/dist/preview/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { LiveQueryProvider, useLiveQuery } from '@sanity/preview-kit';
|
|
1
|
+
export { LiveQueryProvider, default, useLiveQuery } from '@sanity/preview-kit';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var liveQuery = require('@sanity/preview-kit/live-query');
|
|
7
|
+
Object.defineProperty(exports, 'default', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return liveQuery__namespace.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.keys(liveQuery).forEach(function (k) {
|
|
14
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return liveQuery[k];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=live-query.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-query.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-query.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var sanity = require('sanity');
|
|
9
|
+
var NextStudioClientOnly = require('./NextStudioClientOnly.cjs');
|
|
10
|
+
var NextStudioLayout = require('./NextStudioLayout.cjs');
|
|
11
|
+
var NextStudioLoading = require('./NextStudioLoading.cjs');
|
|
12
|
+
var NextStudioNoScript = require('./NextStudioNoScript.cjs');
|
|
13
|
+
const NextStudioComponent = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
children,
|
|
16
|
+
config,
|
|
17
|
+
unstable__noScript = true,
|
|
18
|
+
unstable__fastRender,
|
|
19
|
+
scheme,
|
|
20
|
+
...props
|
|
21
|
+
} = _ref;
|
|
22
|
+
if (unstable__fastRender) {
|
|
23
|
+
return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
24
|
+
children: [unstable__noScript && /* @__PURE__ */jsxRuntime.jsx(NextStudioNoScript.NextStudioNoScript, {}), /* @__PURE__ */jsxRuntime.jsx(NextStudioLayout.NextStudioLayout, {
|
|
25
|
+
config,
|
|
26
|
+
scheme,
|
|
27
|
+
children: children || /* @__PURE__ */jsxRuntime.jsx(sanity.Studio, {
|
|
28
|
+
config,
|
|
29
|
+
scheme,
|
|
30
|
+
unstable_globalStyles: true,
|
|
31
|
+
...props
|
|
32
|
+
})
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
37
|
+
children: [unstable__noScript && /* @__PURE__ */jsxRuntime.jsx(NextStudioNoScript.NextStudioNoScript, {}), /* @__PURE__ */jsxRuntime.jsx(NextStudioClientOnly.NextStudioClientOnly, {
|
|
38
|
+
fallback: /* @__PURE__ */jsxRuntime.jsx(NextStudioLoading.NextStudioLoading, {
|
|
39
|
+
unstable__noScript,
|
|
40
|
+
config,
|
|
41
|
+
scheme
|
|
42
|
+
}),
|
|
43
|
+
children: /* @__PURE__ */jsxRuntime.jsx(NextStudioLayout.NextStudioLayout, {
|
|
44
|
+
config,
|
|
45
|
+
scheme,
|
|
46
|
+
children: children || /* @__PURE__ */jsxRuntime.jsx(sanity.Studio, {
|
|
47
|
+
config,
|
|
48
|
+
scheme,
|
|
49
|
+
unstable_globalStyles: true,
|
|
50
|
+
...props
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const NextStudio = react.memo(NextStudioComponent);
|
|
57
|
+
exports.NextStudio = NextStudio;
|
|
58
|
+
//# sourceMappingURL=NextStudio.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextStudio.cjs","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["import {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioClientOnly} from './NextStudioClientOnly'\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioLoading} from './NextStudioLoading'\nimport {NextStudioNoScript} from './NextStudioNoScript'\n\nexport type {NextStudioLoadingProps} from './NextStudioLoading'\n\n/** @beta */\nexport interface NextStudioProps extends StudioProps {\n children?: React.ReactNode\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n /**\n * Render in a faster mode that requires `styled-components` SSR to be setup.\n * @defaultValue false\n * @alpha\n */\n unstable__fastRender?: boolean\n}\n/**\n * Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noScript = true,\n unstable__fastRender,\n scheme,\n ...props\n}: NextStudioProps) => {\n if (unstable__fastRender) {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </>\n )\n }\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioClientOnly\n fallback={\n <NextStudioLoading\n unstable__noScript={unstable__noScript}\n config={config}\n scheme={scheme}\n />\n }\n >\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </NextStudioClientOnly>\n </>\n )\n}\n\n/**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * ```\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n * ```\n * @beta\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["NextStudioComponent","_ref","children","config","unstable__noScript","unstable__fastRender","scheme","props","jsxs","Fragment","NextStudioNoScript","jsx","NextStudioLayout","Studio","unstable_globalStyles","NextStudioClientOnly","fallback","NextStudioLoading","NextStudio","memo"],"mappings":";;;;;;;;;;;;AA8BA,MAAMA,sBAAsBC,IAAA,IAOL;EAAA,IAPM;IAC3BC,QAAA;IACAC,MAAA;IACAC,kBAAqB,GAAA,IAAA;IACrBC,oBAAA;IACAC,MAAA;IACA,GAAGC;EACL,CAAuB,GAAAN,IAAA;EACrB,IAAII,oBAAsB,EAAA;IACxB,sBAEKG,UAAA,CAAAA,IAAA,CAAAC,mBAAA,EAAA;MAAAP,QAAA,EAAA,CAAAE,kBAAA,kCAAuBM,kBAAmB,CAAAA,kBAAA,EAAA,EAAA,CAAA,EAAA,eAC1CC,UAAA,CAAAA,GAAA,CAAAC,gBAAA,CAAAA,gBAAA,EAAA;QAAiBT,MAAgB;QAAAG,MAAA;QAC/BJ,QACC,EAAAA,QAAA,mBAAAS,UAAA,CAAAA,GAAA,CAACE,MAAO,CAAAA,MAAA,EAAA;UAAAV,MAAA;UAAgBG,MAAgB;UAAAQ,qBAAA,EAAqB,IAAE;UAAA,GAAGP;QAAO,CAAA;OAE7E,CAAA;IACF,CAAA,CAAA;EAEJ;EAEA,sBAEKC,UAAA,CAAAA,IAAA,CAAAC,mBAAA,EAAA;IAAAP,QAAA,EAAA,CAAAE,kBAAA,kCAAuBM,kBAAmB,CAAAA,kBAAA,EAAA,EAAA,CAAA,EAAA,eAC3CC,UAAA,CAAAA,GAAA,CAACI,oBAAA,CAAAA,oBAAA,EAAA;MACCC,QACE,iBAAAL,UAAA,CAAAA,GAAA,CAACM,iBAAA,CAAAA,iBAAA,EAAA;QACCb,kBAAA;QACAD,MAAA;QACAG;MAAA,CACF,CAAA;MAGFJ,QAAC,EAAA,eAAAS,UAAA,CAAAA,GAAA,CAAAC,iCAAA,EAAA;QAAiBT,MAAgB;QAAAG,MAAA;QAC/BJ,QACC,EAAAA,QAAA,IAAAS,eAAAA,UAAAA,CAAAA,GAAA,CAACE,MAAAA,CAAAA,MAAO,EAAA;UAAAV,MAAA;UAAgBG,MAAgB;UAAAQ,qBAAA,EAAqB,IAAE;UAAA,GAAGP;QAAO,CAAA;OAE7E;IAAA,CACF,CAAA;EACF,CAAA,CAAA;AAEJ,CAAA;AAiBa,MAAAW,UAAA,GAAaC,WAAKnB,mBAAmB,CAAA;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { Studio } from 'sanity';
|
|
4
|
+
import { NextStudioClientOnly } from './NextStudioClientOnly.js';
|
|
5
|
+
import { NextStudioLayout } from './NextStudioLayout.js';
|
|
6
|
+
import { NextStudioLoading } from './NextStudioLoading.js';
|
|
7
|
+
import { NextStudioNoScript } from './NextStudioNoScript.js';
|
|
8
|
+
const NextStudioComponent = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
config,
|
|
12
|
+
unstable__noScript = true,
|
|
13
|
+
unstable__fastRender,
|
|
14
|
+
scheme,
|
|
15
|
+
...props
|
|
16
|
+
} = _ref;
|
|
17
|
+
if (unstable__fastRender) {
|
|
18
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
19
|
+
children: [unstable__noScript && /* @__PURE__ */jsx(NextStudioNoScript, {}), /* @__PURE__ */jsx(NextStudioLayout, {
|
|
20
|
+
config,
|
|
21
|
+
scheme,
|
|
22
|
+
children: children || /* @__PURE__ */jsx(Studio, {
|
|
23
|
+
config,
|
|
24
|
+
scheme,
|
|
25
|
+
unstable_globalStyles: true,
|
|
26
|
+
...props
|
|
27
|
+
})
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
32
|
+
children: [unstable__noScript && /* @__PURE__ */jsx(NextStudioNoScript, {}), /* @__PURE__ */jsx(NextStudioClientOnly, {
|
|
33
|
+
fallback: /* @__PURE__ */jsx(NextStudioLoading, {
|
|
34
|
+
unstable__noScript,
|
|
35
|
+
config,
|
|
36
|
+
scheme
|
|
37
|
+
}),
|
|
38
|
+
children: /* @__PURE__ */jsx(NextStudioLayout, {
|
|
39
|
+
config,
|
|
40
|
+
scheme,
|
|
41
|
+
children: children || /* @__PURE__ */jsx(Studio, {
|
|
42
|
+
config,
|
|
43
|
+
scheme,
|
|
44
|
+
unstable_globalStyles: true,
|
|
45
|
+
...props
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const NextStudio = memo(NextStudioComponent);
|
|
52
|
+
export { NextStudio };
|
|
53
|
+
//# sourceMappingURL=NextStudio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextStudio.js","sources":["../../src/studio/NextStudio.tsx"],"sourcesContent":["import {memo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioClientOnly} from './NextStudioClientOnly'\nimport {NextStudioLayout} from './NextStudioLayout'\nimport {NextStudioLoading} from './NextStudioLoading'\nimport {NextStudioNoScript} from './NextStudioNoScript'\n\nexport type {NextStudioLoadingProps} from './NextStudioLoading'\n\n/** @beta */\nexport interface NextStudioProps extends StudioProps {\n children?: React.ReactNode\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n /**\n * Render in a faster mode that requires `styled-components` SSR to be setup.\n * @defaultValue false\n * @alpha\n */\n unstable__fastRender?: boolean\n}\n/**\n * Intended to render at the root of a page, letting the Studio own that page and render much like it would if you used `npx sanity start` to render\n * It's a drop-in replacement for `import {Studio} from 'sanity'`\n */\nconst NextStudioComponent = ({\n children,\n config,\n unstable__noScript = true,\n unstable__fastRender,\n scheme,\n ...props\n}: NextStudioProps) => {\n if (unstable__fastRender) {\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </>\n )\n }\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioClientOnly\n fallback={\n <NextStudioLoading\n unstable__noScript={unstable__noScript}\n config={config}\n scheme={scheme}\n />\n }\n >\n <NextStudioLayout config={config} scheme={scheme}>\n {children || (\n <Studio config={config} scheme={scheme} unstable_globalStyles {...props} />\n )}\n </NextStudioLayout>\n </NextStudioClientOnly>\n </>\n )\n}\n\n/**\n * Override how the Studio renders by passing children.\n * This is useful for advanced use cases where you're using StudioProvider and StudioLayout instead of Studio:\n * ```\n * import {StudioProvider, StudioLayout} from 'sanity'\n * import {NextStudio} from 'next-sanity/studio'\n * <NextStudio config={config}>\n * <StudioProvider config={config}>\n * <CustomComponentThatUsesContextFromStudioProvider />\n * <StudioLayout />\n * </StudioProvider>\n * </NextStudio>\n * ```\n * @beta\n */\nexport const NextStudio = memo(NextStudioComponent)\n"],"names":["NextStudioComponent","_ref","children","config","unstable__noScript","unstable__fastRender","scheme","props","jsxs","Fragment","NextStudioNoScript","jsx","NextStudioLayout","Studio","unstable_globalStyles","NextStudioClientOnly","fallback","NextStudioLoading","NextStudio","memo"],"mappings":";;;;;;;AA8BA,MAAMA,sBAAsBC,IAAA,IAOL;EAAA,IAPM;IAC3BC,QAAA;IACAC,MAAA;IACAC,kBAAqB,GAAA,IAAA;IACrBC,oBAAA;IACAC,MAAA;IACA,GAAGC;EACL,CAAuB,GAAAN,IAAA;EACrB,IAAII,oBAAsB,EAAA;IACxB,sBAEKG,IAAA,CAAAC,QAAA,EAAA;MAAAP,QAAA,EAAA,CAAAE,kBAAA,uBAAuBM,kBAAmB,EAAA,EAAA,CAAA,EAAA,eAC1CC,GAAA,CAAAC,gBAAA,EAAA;QAAiBT,MAAgB;QAAAG,MAAA;QAC/BJ,QACC,EAAAA,QAAA,mBAAAS,GAAA,CAACE,MAAO,EAAA;UAAAV,MAAA;UAAgBG,MAAgB;UAAAQ,qBAAA,EAAqB,IAAE;UAAA,GAAGP;QAAO,CAAA;OAE7E,CAAA;IACF,CAAA,CAAA;EAEJ;EAEA,sBAEKC,IAAA,CAAAC,QAAA,EAAA;IAAAP,QAAA,EAAA,CAAAE,kBAAA,uBAAuBM,kBAAmB,EAAA,EAAA,CAAA,EAAA,eAC3CC,GAAA,CAACI,oBAAA,EAAA;MACCC,QACE,iBAAAL,GAAA,CAACM,iBAAA,EAAA;QACCb,kBAAA;QACAD,MAAA;QACAG;MAAA,CACF,CAAA;MAGFJ,QAAC,EAAA,eAAAS,GAAA,CAAAC,gBAAA,EAAA;QAAiBT,MAAgB;QAAAG,MAAA;QAC/BJ,QACC,EAAAA,QAAA,IAAA,eAAAS,GAAA,CAACE,MAAO,EAAA;UAAAV,MAAA;UAAgBG,MAAgB;UAAAQ,qBAAA,EAAqB,IAAE;UAAA,GAAGP;QAAO,CAAA;OAE7E;IAAA,CACF,CAAA;EACF,CAAA,CAAA;AAEJ,CAAA;AAiBa,MAAAW,UAAA,GAAaC,KAAKnB,mBAAmB,CAAA;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
function NextStudioClientOnly(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
fallback
|
|
12
|
+
} = _ref;
|
|
13
|
+
const [mounted, setMounted] = react.useState(false);
|
|
14
|
+
react.useEffect(() => react.startTransition(() => setMounted(true)), []);
|
|
15
|
+
return /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
16
|
+
children: mounted ? children : fallback
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.NextStudioClientOnly = NextStudioClientOnly;
|
|
20
|
+
//# sourceMappingURL=NextStudioClientOnly.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextStudioClientOnly.cjs","sources":["../../src/studio/NextStudioClientOnly.tsx"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n"],"names":["NextStudioClientOnly","_ref","children","fallback","mounted","setMounted","useState","useEffect","startTransition","jsx","Fragment"],"mappings":";;;;;;;AASO,SAASA,oBAAqBA,CAAAC,IAAA,EAAiD;EAAA,IAAjD;IAACC,QAAU;IAAAC;GAAsC,GAAAF,IAAA;EACpF,MAAM,CAACG,OAAA,EAASC,UAAU,CAAA,GAAIC,eAAS,KAAK,CAAA;EAClCC,KAAA,CAAAA,SAAA,CAAA,MAAMC,KAAAA,CAAAA,gBAAgB,MAAMH,UAAA,CAAW,IAAI,CAAC,CAAA,EAAG,EAAE,CAAA;EAEpD,OAAAI,eAAAA,UAAAA,CAAAA,GAAA,CAAAC,UAAAA,CAAAA,QAAA,EAAA;IAAGR,QAAU,EAAAE,OAAA,GAAAF,QAAA,GAAWC;EAAS,CAAA,CAAA;AAC1C;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect, startTransition } from 'react';
|
|
3
|
+
function NextStudioClientOnly(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
fallback
|
|
7
|
+
} = _ref;
|
|
8
|
+
const [mounted, setMounted] = useState(false);
|
|
9
|
+
useEffect(() => startTransition(() => setMounted(true)), []);
|
|
10
|
+
return /* @__PURE__ */jsx(Fragment, {
|
|
11
|
+
children: mounted ? children : fallback
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export { NextStudioClientOnly };
|
|
15
|
+
//# sourceMappingURL=NextStudioClientOnly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextStudioClientOnly.js","sources":["../../src/studio/NextStudioClientOnly.tsx"],"sourcesContent":["import {type ReactNode, startTransition, useEffect, useState} from 'react'\n\n/** @alpha */\nexport type NextStudioClientOnlyProps = {\n children: ReactNode\n fallback: ReactNode\n}\n\n/** @alpha */\nexport function NextStudioClientOnly({children, fallback}: NextStudioClientOnlyProps) {\n const [mounted, setMounted] = useState(false)\n useEffect(() => startTransition(() => setMounted(true)), [])\n\n return <>{mounted ? children : fallback}</>\n}\n"],"names":["NextStudioClientOnly","_ref","children","fallback","mounted","setMounted","useState","useEffect","startTransition","jsx","Fragment"],"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;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var useTheme = require('./useTheme.cjs');
|
|
9
|
+
const NextStudioLayoutComponent = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
children,
|
|
12
|
+
config,
|
|
13
|
+
scheme = "light"
|
|
14
|
+
} = _ref;
|
|
15
|
+
const theme = useTheme.useTheme(config);
|
|
16
|
+
return /* @__PURE__ */jsxRuntime.jsx("div", {
|
|
17
|
+
"data-ui": "NextStudioLayout",
|
|
18
|
+
style: {
|
|
19
|
+
fontFamily: theme.fonts.text.family,
|
|
20
|
+
backgroundColor: theme.color[scheme === "dark" ? "dark" : "light"].default.base.bg,
|
|
21
|
+
height: "100vh",
|
|
22
|
+
maxHeight: "100dvh",
|
|
23
|
+
overscrollBehavior: "none",
|
|
24
|
+
WebkitFontSmoothing: "antialiased",
|
|
25
|
+
overflow: "auto"
|
|
26
|
+
},
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const NextStudioLayout = react.memo(NextStudioLayoutComponent);
|
|
31
|
+
exports.NextStudioLayout = NextStudioLayout;
|
|
32
|
+
//# sourceMappingURL=NextStudioLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextStudioLayout.cjs","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\n\nimport {useTheme} from './useTheme'\n\n/** @alpha */\nexport interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'scheme'> {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({\n children,\n config,\n scheme = 'light',\n}: NextStudioLayoutProps) => {\n const theme = useTheme(config)\n\n return (\n <div\n data-ui=\"NextStudioLayout\"\n style={{\n fontFamily: theme.fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n {children}\n </div>\n )\n}\n\n/** @alpha */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["NextStudioLayoutComponent","_ref","children","config","scheme","theme","useTheme","jsx","style","fontFamily","fonts","text","family","backgroundColor","color","default","base","bg","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","NextStudioLayout","memo"],"mappings":";;;;;;;;AAWA,MAAMA,4BAA4BC,IAAA,IAIL;EAAA,IAJM;IACjCC,QAAA;IACAC,MAAA;IACAC,MAAS,GAAA;EACX,CAA6B,GAAAH,IAAA;EACrB,MAAAI,KAAA,GAAQC,kBAASH,MAAM,CAAA;EAG3B,sBAAAI,UAAA,CAAAA,GAAA,CAAC,KAAA,EAAA;IACC,SAAQ,EAAA,kBAAA;IACRC,KAAO,EAAA;MACLC,UAAA,EAAYJ,KAAM,CAAAK,KAAA,CAAMC,IAAK,CAAAC,MAAA;MAC7BC,eAAA,EAAiBR,MAAMS,KAAM,CAAAV,MAAA,KAAW,SAAS,MAAS,GAAA,OAAO,CAAE,CAAAW,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;IAECpB;EAAA,CAAA,CACH;AAEJ,CAAA;AAGa,MAAAqB,gBAAA,GAAmBC,WAAKxB,yBAAyB,CAAA;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { useTheme } from './useTheme.js';
|
|
4
|
+
const NextStudioLayoutComponent = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
config,
|
|
8
|
+
scheme = "light"
|
|
9
|
+
} = _ref;
|
|
10
|
+
const theme = useTheme(config);
|
|
11
|
+
return /* @__PURE__ */jsx("div", {
|
|
12
|
+
"data-ui": "NextStudioLayout",
|
|
13
|
+
style: {
|
|
14
|
+
fontFamily: theme.fonts.text.family,
|
|
15
|
+
backgroundColor: theme.color[scheme === "dark" ? "dark" : "light"].default.base.bg,
|
|
16
|
+
height: "100vh",
|
|
17
|
+
maxHeight: "100dvh",
|
|
18
|
+
overscrollBehavior: "none",
|
|
19
|
+
WebkitFontSmoothing: "antialiased",
|
|
20
|
+
overflow: "auto"
|
|
21
|
+
},
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const NextStudioLayout = memo(NextStudioLayoutComponent);
|
|
26
|
+
export { NextStudioLayout };
|
|
27
|
+
//# sourceMappingURL=NextStudioLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextStudioLayout.js","sources":["../../src/studio/NextStudioLayout.tsx"],"sourcesContent":["/* eslint-disable camelcase */\nimport {memo} from 'react'\nimport type {StudioProps} from 'sanity'\n\nimport {useTheme} from './useTheme'\n\n/** @alpha */\nexport interface NextStudioLayoutProps extends Pick<StudioProps, 'config' | 'scheme'> {\n children: React.ReactNode\n}\n\nconst NextStudioLayoutComponent = ({\n children,\n config,\n scheme = 'light',\n}: NextStudioLayoutProps) => {\n const theme = useTheme(config)\n\n return (\n <div\n data-ui=\"NextStudioLayout\"\n style={{\n fontFamily: theme.fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n {children}\n </div>\n )\n}\n\n/** @alpha */\nexport const NextStudioLayout = memo(NextStudioLayoutComponent)\n"],"names":["NextStudioLayoutComponent","_ref","children","config","scheme","theme","useTheme","jsx","style","fontFamily","fonts","text","family","backgroundColor","color","default","base","bg","height","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","NextStudioLayout","memo"],"mappings":";;;AAWA,MAAMA,4BAA4BC,IAAA,IAIL;EAAA,IAJM;IACjCC,QAAA;IACAC,MAAA;IACAC,MAAS,GAAA;EACX,CAA6B,GAAAH,IAAA;EACrB,MAAAI,KAAA,GAAQC,SAASH,MAAM,CAAA;EAG3B,sBAAAI,GAAA,CAAC,KAAA,EAAA;IACC,SAAQ,EAAA,kBAAA;IACRC,KAAO,EAAA;MACLC,UAAA,EAAYJ,KAAM,CAAAK,KAAA,CAAMC,IAAK,CAAAC,MAAA;MAC7BC,eAAA,EAAiBR,MAAMS,KAAM,CAAAV,MAAA,KAAW,SAAS,MAAS,GAAA,OAAO,CAAE,CAAAW,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;IAECpB;EAAA,CAAA,CACH;AAEJ,CAAA;AAGa,MAAAqB,gBAAA,GAAmBC,KAAKxB,yBAAyB,CAAA;"}
|
|
@@ -1,35 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
4
|
+
Object.defineProperty(exports, '__esModule', {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
3
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
8
|
var icons = require('@sanity/icons');
|
|
5
9
|
var ui = require('@sanity/ui');
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
const workspace = react.useMemo(() => Array.isArray(config) ? config[0] : config, [config]);
|
|
9
|
-
return react.useMemo(() => (workspace == null ? void 0 : workspace.theme) || ui.studioTheme, [workspace]);
|
|
10
|
-
}
|
|
11
|
-
const style = {
|
|
12
|
-
__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"
|
|
13
|
-
};
|
|
14
|
-
const NextStudioNoScript = () => /* @__PURE__ */jsxRuntime.jsx("noscript", {
|
|
15
|
-
children: /* @__PURE__ */jsxRuntime.jsx("div", {
|
|
16
|
-
className: "sanity-app-no-js__root",
|
|
17
|
-
children: /* @__PURE__ */jsxRuntime.jsxs("div", {
|
|
18
|
-
className: "sanity-app-no-js__content",
|
|
19
|
-
children: [/* @__PURE__ */jsxRuntime.jsx("style", {
|
|
20
|
-
type: "text/css",
|
|
21
|
-
dangerouslySetInnerHTML: style
|
|
22
|
-
}), /* @__PURE__ */jsxRuntime.jsx("h1", {
|
|
23
|
-
children: "JavaScript disabled"
|
|
24
|
-
}), /* @__PURE__ */jsxRuntime.jsxs("p", {
|
|
25
|
-
children: ["Please ", /* @__PURE__ */jsxRuntime.jsx("a", {
|
|
26
|
-
href: "https://www.enable-javascript.com/",
|
|
27
|
-
children: "enable JavaScript"
|
|
28
|
-
}), " in your browser and reload the page to proceed."]
|
|
29
|
-
})]
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
});
|
|
10
|
+
var NextStudioNoScript = require('./NextStudioNoScript.cjs');
|
|
11
|
+
var useTheme = require('./useTheme.cjs');
|
|
33
12
|
const keyframes = "\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n";
|
|
34
13
|
function NextStudioLoading(props) {
|
|
35
14
|
const {
|
|
@@ -38,7 +17,7 @@ function NextStudioLoading(props) {
|
|
|
38
17
|
unstable__noScript = true
|
|
39
18
|
} = props;
|
|
40
19
|
const id = "next-sanity-spinner";
|
|
41
|
-
const theme = useTheme(config);
|
|
20
|
+
const theme = useTheme.useTheme(config);
|
|
42
21
|
const {
|
|
43
22
|
fonts,
|
|
44
23
|
media
|
|
@@ -68,7 +47,7 @@ function NextStudioLoading(props) {
|
|
|
68
47
|
};
|
|
69
48
|
})[0];
|
|
70
49
|
return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
71
|
-
children: [unstable__noScript && /* @__PURE__ */jsxRuntime.jsx(NextStudioNoScript, {}), /* @__PURE__ */jsxRuntime.jsx("div", {
|
|
50
|
+
children: [unstable__noScript && /* @__PURE__ */jsxRuntime.jsx(NextStudioNoScript.NextStudioNoScript, {}), /* @__PURE__ */jsxRuntime.jsx("div", {
|
|
72
51
|
style: {
|
|
73
52
|
fontFamily: fonts.text.family,
|
|
74
53
|
backgroundColor: theme.color[scheme === "dark" ? "dark" : "light"].default.base.bg,
|
|
@@ -126,6 +105,4 @@ function NextStudioLoading(props) {
|
|
|
126
105
|
});
|
|
127
106
|
}
|
|
128
107
|
exports.NextStudioLoading = NextStudioLoading;
|
|
129
|
-
|
|
130
|
-
exports.useTheme = useTheme;
|
|
131
|
-
//# sourceMappingURL=loading-225bb240.cjs.map
|
|
108
|
+
//# sourceMappingURL=NextStudioLoading.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextStudioLoading.cjs","sources":["../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["'use client'\n\n/* eslint-disable no-warning-comments */\n// Intentionally not using `styled-components` to ensure it works in any `next` setup.\n// Whether 'styled-components' SSR is setup or not.\n\nimport {SpinnerIcon} from '@sanity/icons'\nimport {_responsive, rem} from '@sanity/ui'\nimport type {Config, SingleWorkspace, StudioProps} from 'sanity'\n\nimport {NextStudioNoScript} from './NextStudioNoScript'\nimport {useTheme} from './useTheme'\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport interface NextStudioLoadingProps extends Pick<StudioProps, 'scheme'> {\n /**\n * If your Studio Config has a custom theme you can pass it here to ensure the loading screen matches your theme.\n */\n config?: Config | Required<Pick<SingleWorkspace, 'theme'>>\n /**\n * Render the <noscript> tag\n * @defaultValue true\n * @alpha\n */\n unstable__noScript?: boolean\n}\n\nconst keyframes = `\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n`\n\n/**\n * @alpha\n * @deprecated Will be removed in the next major release\n */\nexport function NextStudioLoading(props: NextStudioLoadingProps) {\n const {config, scheme = 'light', unstable__noScript = true} = props\n const id = 'next-sanity-spinner'\n const theme = useTheme(config)\n const {fonts, media} = theme\n\n const styles: any = _responsive(media, [2], (size: number) => {\n const {ascenderHeight, descenderHeight, lineHeight, iconSize} = fonts.text.sizes[size]\n const capHeight = lineHeight - ascenderHeight - descenderHeight\n\n return {\n wrapper: {\n display: 'block',\n animation: `${id} 500ms linear infinite`,\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled.muted\n .fg,\n width: rem(capHeight),\n height: rem(capHeight),\n },\n svg: {\n display: 'block',\n width: rem(iconSize),\n height: rem(iconSize),\n margin: (capHeight - iconSize) / 2,\n },\n }\n })[0]\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <div\n style={{\n fontFamily: fonts.text.family,\n backgroundColor: theme.color[scheme === 'dark' ? 'dark' : 'light'].default.base.bg,\n height: '100vh',\n maxHeight: '100dvh',\n overscrollBehavior: 'none',\n WebkitFontSmoothing: 'antialiased',\n overflow: 'auto',\n }}\n >\n <div\n data-ui=\"Flex\"\n style={{\n display: 'flex',\n minWidth: 0,\n minHeight: 0,\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n height: '100%',\n margin: 0,\n padding: 0,\n // @TODO use rem calc\n gap: '10px',\n }}\n >\n <style key={scheme}>{`@keyframes ${id} {${keyframes}}`}</style>\n <div\n data-ui=\"Text\"\n style={{\n position: 'relative',\n // @TODO read from theme\n fontWeight: 400,\n // @TODO read from theme\n padding: '1px 0px',\n // @TODO use rem calc\n fontSize: '1rem',\n // @TODO use rem calc\n lineHeight: 'calc(1.3125)',\n // @TODO use rem calc\n transform: 'translateY(-5px)',\n color:\n theme.color[scheme === 'dark' ? 'dark' : 'light'].default.muted.default.enabled\n .muted.fg,\n }}\n >\n <span>Loading…</span>\n </div>\n <div data-ui=\"Spinner\" style={styles.wrapper}>\n <SpinnerIcon style={styles.svg} />\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["scheme","unstable__noScript","media","iconSize","wrapper","display","width","height","svg","margin","style","fontFamily","backgroundColor","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","children","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","position","fontWeight","fontSize","lineHeight","transform"],"mappings":";;;;;;;;;;;AA8BA;AAcO;;;AACUA;AAAkBC;AAA6B;;AAExD;;;AACQC;AAAS;AAEvB;;;;;AACsDC;;AAC9C;;AAGJC;AACEC;;;AAKAC;AACAC;;AAEFC;AACEH;AACAC;AACAC;AACAE;AACF;;;;;AAQEC;AACEC;AACAC;AACAL;AACAM;AACAC;AACAC;AACAC;;AAGFC;AACE;AACAP;AACEL;AACAa;AACAC;AACAC;AACAC;AACAC;AACAf;AACAE;AACAc;AAAS;AAETC;;;AAGmBP;;AAEnB;AACAP;AACEe;AAAU;AAEVC;AAAY;AAEZH;AAAS;AAETI;AAAU;AAEVC;AAAY;AAEZC;;;AAMFZ;AAAMA;;;AAEH;;;;;;;AAGP;AAEJ;AAEJ;"}
|