next-sanity 5.3.0 → 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.
@@ -3,10 +3,25 @@
3
3
  Object.defineProperty(exports, '__esModule', {
4
4
  value: true
5
5
  });
6
- var index = require('./LiveQueryProvider/index.cjs');
7
6
  var previewKit = require('@sanity/preview-kit');
8
- exports.LiveQueryProvider = index.LiveQueryProvider;
9
- exports.default = index.LiveQueryProvider;
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);
13
+ Object.defineProperty(exports, 'LiveQueryProvider', {
14
+ enumerable: true,
15
+ get: function () {
16
+ return previewKit.LiveQueryProvider;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, 'default', {
20
+ enumerable: true,
21
+ get: function () {
22
+ return previewKit__default.default;
23
+ }
24
+ });
10
25
  Object.defineProperty(exports, 'useLiveQuery', {
11
26
  enumerable: true,
12
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,12 +1,10 @@
1
- /// <reference types="react" />
2
-
3
1
  import {CacheOptions} from '@sanity/preview-kit'
4
2
  import {ClientQueryParams} from '@sanity/preview-kit'
5
- import {ComponentType} from 'react'
3
+ import {default as default_2} from '@sanity/preview-kit'
6
4
  import {isEqualFn} from '@sanity/preview-kit'
7
5
  import {LiveQueryHookOptions} from '@sanity/preview-kit'
6
+ import {LiveQueryProvider} from '@sanity/preview-kit'
8
7
  import {LiveQueryProviderProps} from '@sanity/preview-kit'
9
- import {LiveQueryProviderProps as LiveQueryProviderProps_2} from '@sanity/preview-kit/internals/create-live-query-provider'
10
8
  import {Logger} from '@sanity/preview-kit'
11
9
  import {QueryLoading} from '@sanity/preview-kit'
12
10
  import {useLiveQuery} from '@sanity/preview-kit'
@@ -15,13 +13,13 @@ export {CacheOptions}
15
13
 
16
14
  export {ClientQueryParams}
17
15
 
16
+ export default default_2
17
+
18
18
  export {isEqualFn}
19
19
 
20
20
  export {LiveQueryHookOptions}
21
21
 
22
- declare const LiveQueryProvider: ComponentType<LiveQueryProviderProps_2>
23
22
  export {LiveQueryProvider}
24
- export default LiveQueryProvider
25
23
 
26
24
  export {LiveQueryProviderProps}
27
25
 
@@ -1,3 +1,2 @@
1
- export { LiveQueryProvider, LiveQueryProvider as default } from './LiveQueryProvider/index.js';
2
- export { useLiveQuery } from '@sanity/preview-kit';
1
+ export { LiveQueryProvider, default, useLiveQuery } from '@sanity/preview-kit';
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -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,5 @@
1
+ import cjs from './live-query.cjs';
2
+
3
+ export const LiveQuery = cjs.LiveQuery;
4
+
5
+ export default cjs.default;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-query.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,7 @@
1
+ import {default as default_2} from '@sanity/preview-kit/live-query'
2
+
3
+ export default default_2
4
+
5
+ export * from '@sanity/preview-kit/live-query'
6
+
7
+ export {}
@@ -0,0 +1,3 @@
1
+ export * from '@sanity/preview-kit/live-query';
2
+ export { default } from '@sanity/preview-kit/live-query';
3
+ //# sourceMappingURL=live-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-query.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', {
@@ -1 +1 @@
1
- {"version":3,"file":"NextStudioLoading.cjs","sources":["../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["/* 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":["keyframes","NextStudioLoading","props","config","scheme","unstable__noScript","id","theme","useTheme","fonts","media","styles","_responsive","size","ascenderHeight","descenderHeight","lineHeight","iconSize","text","sizes","capHeight","wrapper","display","animation","concat","color","default","muted","enabled","fg","width","rem","height","svg","margin","jsxs","Fragment","children","NextStudioNoScript","jsx","style","fontFamily","family","backgroundColor","base","bg","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","position","fontWeight","fontSize","transform","SpinnerIcon"],"mappings":";;;;;;;;;;AA4BA,MAAMA,SAAY,GAAA,oFAAA;AAcX,SAASC,kBAAkBC,KAA+B,EAAA;EAC/D,MAAM;IAACC,MAAQ;IAAAC,MAAA,GAAS,OAAS;IAAAC,kBAAA,GAAqB;EAAQ,CAAA,GAAAH,KAAA;EAC9D,MAAMI,EAAK,GAAA,qBAAA;EACL,MAAAC,KAAA,GAAQC,kBAASL,MAAM,CAAA;EACvB,MAAA;IAACM,KAAO;IAAAC;EAAS,CAAA,GAAAH,KAAA;EAEvB,MAAMI,SAAcC,EAAAA,CAAAA,WAAY,CAAAF,KAAA,EAAO,CAAC,CAAC,CAAA,EAAIG,IAAiB,IAAA;IACtD,MAAA;MAACC;MAAgBC,eAAiB;MAAAC,UAAA;MAAYC;KAAY,GAAAR,KAAA,CAAMS,IAAK,CAAAC,KAAA,CAAMN,IAAI,CAAA;IAC/E,MAAAO,SAAA,GAAYJ,aAAaF,cAAiB,GAAAC,eAAA;IAEzC,OAAA;MACLM,OAAS,EAAA;QACPC,OAAS,EAAA,OAAA;QACTC,SAAA,EAAW,GAAGC,MAAE,CAAAlB,EAAA,EAAA,wBAAA,CAAA;QAChBmB,KACE,EAAAlB,KAAA,CAAMkB,KAAM,CAAArB,MAAA,KAAW,MAAS,GAAA,MAAA,GAAS,OAAO,CAAA,CAAEsB,OAAQ,CAAAC,KAAA,CAAMD,OAAQ,CAAAE,OAAA,CAAQD,KAC7E,CAAAE,EAAA;QACLC,KAAA,EAAOC,OAAIX,SAAS,CAAA;QACpBY,MAAA,EAAQD,OAAIX,SAAS;MACvB,CAAA;MACAa,GAAK,EAAA;QACHX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B,SAAA,EAAS;WAAvCI,MAA2C,CAAA,EAAA,eACvDmC,UAAA,CAAAA,GAAA,CAAC,KAAA,EAAA;UACC,SAAQ,EAAA,MAAA;UACRC,KAAO,EAAA;YACLiB,QAAU,EAAA,UAAA;YAAA;YAEVC,UAAY,EAAA,GAAA;YAAA;YAEZH,OAAS,EAAA,SAAA;YAAA;YAETI,QAAU,EAAA,MAAA;YAAA;YAEV3C,UAAY,EAAA,cAAA;YAAA;YAEZ4C,SAAW,EAAA,kBAAA;YACXnC,KACE,EAAAlB,KAAA,CAAMkB,KAAM,CAAArB,MAAA,KAAW,MAAS,GAAA,MAAA,GAAS,OAAO,CAAA,CAAEsB,OAAQ,CAAAC,KAAA,CAAMD,OAAQ,CAAAE,OAAA,CACrED,KAAM,CAAAE;UACb,CAAA;UAEAQ,QAAA,EAAAE,eAAAA,UAAAA,CAAAA,GAAA,CAAC;YAAKF,QAAQ,EAAA;UAAA,CAAA;QAAA,CAChB,CAAA,EAAA,eACCE,UAAA,CAAAA,GAAA,CAAA,KAAA,EAAA;UAAI,SAAQ,EAAA,SAAA;UAAUC,KAAO,EAAA7B,MAAA,CAAOU,OACnC;UAAAgB,QAAA,EAAA,eAAAE,UAAA,CAAAA,GAAA,CAACsB,KAAY,CAAAA,WAAA,EAAA;YAAArB,KAAA,EAAO7B,MAAO,CAAAsB;UAAK,CAAA;SAClC,CAAA;MAAA,CACF;IAAA,CACF,CAAA;EACF,CAAA,CAAA;AAEJ;"}
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;"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
3
  import { SpinnerIcon } from '@sanity/icons';
3
4
  import { _responsive, rem } from '@sanity/ui';
@@ -1 +1 @@
1
- {"version":3,"file":"NextStudioLoading.js","sources":["../../src/studio/NextStudioLoading.tsx"],"sourcesContent":["/* 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":["keyframes","NextStudioLoading","props","config","scheme","unstable__noScript","id","theme","useTheme","fonts","media","styles","_responsive","size","ascenderHeight","descenderHeight","lineHeight","iconSize","text","sizes","capHeight","wrapper","display","animation","concat","color","default","muted","enabled","fg","width","rem","height","svg","margin","jsxs","Fragment","children","NextStudioNoScript","jsx","style","fontFamily","family","backgroundColor","base","bg","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","position","fontWeight","fontSize","transform","SpinnerIcon"],"mappings":";;;;;AA4BA,MAAMA,SAAY,GAAA,oFAAA;AAcX,SAASC,kBAAkBC,KAA+B,EAAA;EAC/D,MAAM;IAACC,MAAQ;IAAAC,MAAA,GAAS,OAAS;IAAAC,kBAAA,GAAqB;EAAQ,CAAA,GAAAH,KAAA;EAC9D,MAAMI,EAAK,GAAA,qBAAA;EACL,MAAAC,KAAA,GAAQC,SAASL,MAAM,CAAA;EACvB,MAAA;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AAA,CAAA,KAAA,EAAA;UAAI,SAAQ,EAAA,SAAA;UAAUC,KAAO,EAAA7B,MAAA,CAAOU,OACnC;UAAAgB,QAAA,EAAA,eAAAE,GAAA,CAACsB,WAAY,EAAA;YAAArB,KAAA,EAAO7B,MAAO,CAAAsB;UAAK,CAAA;SAClC,CAAA;MAAA,CACF;IAAA,CACF,CAAA;EACF,CAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"NextStudioLoading.js","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","svg","height","margin","children","style","fontFamily","backgroundColor","maxHeight","overscrollBehavior","WebkitFontSmoothing","overflow","minWidth","minHeight","alignItems","justifyContent","flexDirection","padding","gap","position","fontWeight","fontSize","lineHeight","transform"],"mappings":";;;;;;AA8BA;AAcO;;;AACUA;AAAkBC;AAA6B;;AAExD;;;AACQC;AAAS;;;;;;AAG+BC;;AAC9C;;AAGJC;AACEC;;;AAKAC;;;AAGFC;AACEF;AACAC;AACAE;AACAC;AACF;;;AAIJ;AAEKC;AAECC;AACEC;AACAC;AACAL;AACAM;AACAC;AACAC;AACAC;;AAGFP;AACE;AACAC;AACEN;AACAa;AACAC;AACAC;AACAC;AACAC;AACAd;AACAC;AACAc;AAAS;AAETC;;AAGFd;AAAqBA;;AAEnB;AACAC;AACEc;AAAU;AAEVC;AAAY;AAEZH;AAAS;AAETI;AAAU;AAEVC;AAAY;AAEZC;;;AAMFnB;AAAMA;;AAAQ;AAEX;;AACHA;;;;;AAEJ;AAEJ;AAEJ;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-sanity",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "description": "Sanity.io toolkit for Next.js",
5
5
  "keywords": [
6
6
  "sanity",
@@ -46,6 +46,17 @@
46
46
  "import": "./dist/preview/index.js",
47
47
  "default": "./dist/preview/index.js"
48
48
  },
49
+ "./preview/live-query": {
50
+ "types": "./dist/preview/live-query.d.ts",
51
+ "source": "./src/preview/LiveQuery/index.ts",
52
+ "require": "./dist/preview/live-query.cjs",
53
+ "node": {
54
+ "module": "./dist/preview/live-query.js",
55
+ "import": "./dist/preview/live-query.cjs.js"
56
+ },
57
+ "import": "./dist/preview/live-query.js",
58
+ "default": "./dist/preview/live-query.js"
59
+ },
49
60
  "./studio": {
50
61
  "types": "./dist/studio/index.d.ts",
51
62
  "source": "./src/studio/index.ts",
@@ -112,6 +123,9 @@
112
123
  "preview": [
113
124
  "./dist/preview/index.d.ts"
114
125
  ],
126
+ "preview/live-query": [
127
+ "./dist/preview/live-query.d.ts"
128
+ ],
115
129
  "studio": [
116
130
  "./dist/studio/index.d.ts"
117
131
  ],
@@ -160,7 +174,7 @@
160
174
  "singleQuote": true
161
175
  },
162
176
  "dependencies": {
163
- "@sanity/preview-kit": "3.0.0",
177
+ "@sanity/preview-kit": "3.1.0",
164
178
  "@sanity/webhook": "2.0.0",
165
179
  "groq": "^3.0.0"
166
180
  },
@@ -173,7 +187,7 @@
173
187
  "@sanity/image-url": "^1.0.2",
174
188
  "@sanity/pkg-utils": "^2.4.5",
175
189
  "@sanity/semantic-release-preset": "^4.1.3",
176
- "@sanity/ui": "^1.7.4",
190
+ "@sanity/ui": "^1.7.7",
177
191
  "@sanity/vision": "3.15.1",
178
192
  "@types/eventsource": "^1.1.11",
179
193
  "@types/jest": "^29.5.3",
@@ -0,0 +1,10 @@
1
+ import {createConditionalLiveQuery} from '@sanity/preview-kit/internals/create-conditional-live-query'
2
+
3
+ import ClientComponent from './LiveQueryClientComponent'
4
+
5
+ export type * from '@sanity/preview-kit/live-query'
6
+
7
+ /**
8
+ * This is an experimental new API that might have breaking changes in minor versions.
9
+ * @alpha */
10
+ export const LiveQuery = createConditionalLiveQuery({ClientComponent})
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+
3
+ import {lazy} from 'react'
4
+
5
+ // Re-exporting in a file with `use client` ensures the component stays server-only
6
+ // and isn't preloaded in the client bundle, instead it's loaded only on demand.
7
+
8
+ export default lazy(() => import('@sanity/preview-kit/internals/live-query'))
@@ -0,0 +1,2 @@
1
+ export * from '@sanity/preview-kit/live-query'
2
+ export {default} from '@sanity/preview-kit/live-query'
@@ -1,4 +1,3 @@
1
- export {default, LiveQueryProvider} from './LiveQueryProvider'
2
1
  export type {
3
2
  CacheOptions,
4
3
  ClientQueryParams,
@@ -8,4 +7,4 @@ export type {
8
7
  Logger,
9
8
  QueryLoading,
10
9
  } from '@sanity/preview-kit'
11
- export {useLiveQuery} from '@sanity/preview-kit'
10
+ export {default, LiveQueryProvider, useLiveQuery} from '@sanity/preview-kit'
@@ -1,3 +1,5 @@
1
+ 'use client'
2
+
1
3
  /* eslint-disable no-warning-comments */
2
4
  // Intentionally not using `styled-components` to ensure it works in any `next` setup.
3
5
  // Whether 'styled-components' SSR is setup or not.
@@ -1,23 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', {
5
- value: true
6
- });
7
- var createLiveQueryProvider = require('@sanity/preview-kit/internals/create-live-query-provider');
8
- var dynamic = require('next/dynamic');
9
- function _interopDefaultCompat(e) {
10
- return e && typeof e === 'object' && 'default' in e ? e : {
11
- default: e
12
- };
13
- }
14
- var dynamic__default = /*#__PURE__*/_interopDefaultCompat(dynamic);
15
- const GroqStoreProvider = dynamic__default.default(() => import('@sanity/preview-kit/internals/groq-store-provider'));
16
- const LiveStoreProvider = dynamic__default.default(() => import('@sanity/preview-kit/internals/live-store-provider'));
17
- const LiveQueryProvider = createLiveQueryProvider.createLiveQueryProvider({
18
- GroqStoreProvider,
19
- LiveStoreProvider
20
- });
21
- exports.LiveQueryProvider = LiveQueryProvider;
22
- exports.default = LiveQueryProvider;
23
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/preview/LiveQueryProvider/index.tsx"],"sourcesContent":["'use client'\n\nimport {createLiveQueryProvider} from '@sanity/preview-kit/internals/create-live-query-provider'\nimport dynamic from 'next/dynamic'\n\nexport type {CacheOptions, LiveQueryProviderProps, Logger} from '@sanity/preview-kit'\n\nconst GroqStoreProvider = dynamic(\n () => import('@sanity/preview-kit/internals/groq-store-provider'),\n)\nconst LiveStoreProvider = dynamic(\n () => import('@sanity/preview-kit/internals/live-store-provider'),\n)\n\nexport const LiveQueryProvider = createLiveQueryProvider({GroqStoreProvider, LiveStoreProvider})\nexport default LiveQueryProvider\n"],"names":["LiveStoreProvider"],"mappings":";;;;;;;;;;;;;;AAOA;AAGA;AAIO;;AAAsEA;AAAkB;;"}
@@ -1,11 +0,0 @@
1
- 'use client';
2
- import { createLiveQueryProvider } from '@sanity/preview-kit/internals/create-live-query-provider';
3
- import dynamic from 'next/dynamic';
4
- const GroqStoreProvider = dynamic(() => import('@sanity/preview-kit/internals/groq-store-provider'));
5
- const LiveStoreProvider = dynamic(() => import('@sanity/preview-kit/internals/live-store-provider'));
6
- const LiveQueryProvider = createLiveQueryProvider({
7
- GroqStoreProvider,
8
- LiveStoreProvider
9
- });
10
- export { LiveQueryProvider, LiveQueryProvider as default };
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/preview/LiveQueryProvider/index.tsx"],"sourcesContent":["'use client'\n\nimport {createLiveQueryProvider} from '@sanity/preview-kit/internals/create-live-query-provider'\nimport dynamic from 'next/dynamic'\n\nexport type {CacheOptions, LiveQueryProviderProps, Logger} from '@sanity/preview-kit'\n\nconst GroqStoreProvider = dynamic(\n () => import('@sanity/preview-kit/internals/groq-store-provider'),\n)\nconst LiveStoreProvider = dynamic(\n () => import('@sanity/preview-kit/internals/live-store-provider'),\n)\n\nexport const LiveQueryProvider = createLiveQueryProvider({GroqStoreProvider, LiveStoreProvider})\nexport default LiveQueryProvider\n"],"names":["LiveStoreProvider"],"mappings":";;;AAOA;AAGA;AAIO;;AAAsEA;AAAkB;"}
@@ -1,16 +0,0 @@
1
- 'use client'
2
-
3
- import {createLiveQueryProvider} from '@sanity/preview-kit/internals/create-live-query-provider'
4
- import dynamic from 'next/dynamic'
5
-
6
- export type {CacheOptions, LiveQueryProviderProps, Logger} from '@sanity/preview-kit'
7
-
8
- const GroqStoreProvider = dynamic(
9
- () => import('@sanity/preview-kit/internals/groq-store-provider'),
10
- )
11
- const LiveStoreProvider = dynamic(
12
- () => import('@sanity/preview-kit/internals/live-store-provider'),
13
- )
14
-
15
- export const LiveQueryProvider = createLiveQueryProvider({GroqStoreProvider, LiveStoreProvider})
16
- export default LiveQueryProvider