next-sanity 11.6.6 → 11.6.7
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/NextStudio.js +2 -2
- package/dist/NextStudio.js.map +1 -1
- package/dist/PresentationComlink.js +1 -1
- package/dist/SanityLiveStream.js +3 -3
- package/dist/VisualEditing.js +1 -1
- package/dist/draft-mode/index.js +2 -2
- package/dist/experimental/client-components/live.js +4 -4
- package/dist/experimental/live.js +3 -3
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/image/index.js +2 -2
- package/dist/image/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/live/client-components/live/index.js +3 -3
- package/dist/live/server-actions/index.js +1 -1
- package/dist/live.js +5 -5
- package/dist/studio/client-component/index.js +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/visual-editing/client-component/index.js +1 -1
- package/package.json +9 -9
package/dist/NextStudio.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as NextStudioLayout, t as NextStudioNoScript } from "./NextStudioNoScript.js";
|
|
2
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { useMemo, useSyncExternalStore } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Studio } from "sanity";
|
|
5
5
|
import { createHashHistory } from "history";
|
|
6
6
|
function createHashHistoryForStudio() {
|
|
@@ -44,7 +44,7 @@ function useIsMounted() {
|
|
|
44
44
|
return useSyncExternalStore(emptySubscribe, () => true, () => false);
|
|
45
45
|
}
|
|
46
46
|
const emptySubscribe = () => () => {};
|
|
47
|
-
function NextStudioComponent({ children, config, unstable__noScript = true, scheme, history
|
|
47
|
+
function NextStudioComponent({ children, config, unstable__noScript = true, scheme, history, ...props }) {
|
|
48
48
|
const isMounted = useIsMounted();
|
|
49
49
|
const unstableHistory = useMemo(() => {
|
|
50
50
|
if (props.unstable_history && history) throw new Error("Cannot use both `unstable_history` and `history` props at the same time");
|
package/dist/NextStudio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextStudio.js","names":[],"sources":["../src/studio/client-component/createHashHistoryForStudio.ts","../src/studio/client-component/useIsMounted.ts","../src/studio/client-component/NextStudio.tsx"],"sourcesContent":["import {createHashHistory, type History, type Listener} from 'history'\n\n/** @internal */\nexport function createHashHistoryForStudio(): History {\n const history = createHashHistory()\n return {\n get action() {\n return history.action\n },\n get location() {\n return history.location\n },\n get createHref() {\n return history.createHref\n },\n get push() {\n return history.push\n },\n get replace() {\n return history.replace\n },\n get go() {\n return history.go\n },\n get back() {\n return history.back\n },\n get forward() {\n return history.forward\n },\n get block() {\n return history.block\n },\n // Overriding listen to workaround a problem where native history provides history.listen(location => void), but the npm package is history.listen(({action, location}) => void)\n listen(listener: Listener) {\n // return history.listen(({ action, location }) => {\n return history.listen(({location}) => {\n // console.debug('history.listen', action, location)\n // @ts-expect-error -- working around a bug? in studio\n listener(location)\n })\n },\n }\n}\n","import {useSyncExternalStore} from 'react'\n\n/** @internal */\nexport function useIsMounted(): boolean {\n return useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n )\n}\n// eslint-disable-next-line no-empty-function\nconst emptySubscribe = () => () => {}\n","import {useMemo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioLayout} from '../NextStudioLayout'\nimport {NextStudioNoScript} from '../NextStudioNoScript'\nimport {createHashHistoryForStudio} from './createHashHistoryForStudio'\nimport {useIsMounted} from './useIsMounted'\n\n/** @public */\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 * The 'hash' option is new feature that is not yet stable for production, but is available for testing and its API won't change in a breaking way.\n * If 'hash' doesn't work for you, or if you want to use a memory based history, you can use the `unstable_history` prop instead.\n * @alpha\n * @defaultValue 'browser'\n */\n history?: 'browser' | 'hash'\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 * @public\n */\nexport default function NextStudioComponent({\n children,\n config,\n unstable__noScript = true,\n scheme,\n history,\n ...props\n}: NextStudioProps): React.JSX.Element {\n const isMounted = useIsMounted()\n const unstableHistory = useMemo<typeof props.unstable_history>(() => {\n if (props.unstable_history && history) {\n throw new Error('Cannot use both `unstable_history` and `history` props at the same time')\n }\n\n if (isMounted && history === 'hash') {\n return createHashHistoryForStudio()\n }\n return props.unstable_history\n }, [history, isMounted, props.unstable_history])\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout>\n {history === 'hash' && !isMounted\n ? null\n : children || (\n <Studio\n config={config}\n scheme={scheme}\n unstable_globalStyles\n {...props}\n unstable_history={unstableHistory}\n />\n )}\n </NextStudioLayout>\n </>\n )\n}\n"],"mappings":";;;;;AAGA,SAAgB,6BAAsC;CACpD,MAAM,UAAU,mBAAmB;AACnC,QAAO;EACL,IAAI,SAAS;AACX,UAAO,QAAQ;;EAEjB,IAAI,WAAW;AACb,UAAO,QAAQ;;EAEjB,IAAI,aAAa;AACf,UAAO,QAAQ;;EAEjB,IAAI,OAAO;AACT,UAAO,QAAQ;;EAEjB,IAAI,UAAU;AACZ,UAAO,QAAQ;;EAEjB,IAAI,KAAK;AACP,UAAO,QAAQ;;EAEjB,IAAI,OAAO;AACT,UAAO,QAAQ;;EAEjB,IAAI,UAAU;AACZ,UAAO,QAAQ;;EAEjB,IAAI,QAAQ;AACV,UAAO,QAAQ;;EAGjB,OAAO,UAAoB;AAEzB,UAAO,QAAQ,QAAQ,EAAC,eAAc;AAGpC,aAAS,SAAS;KAClB;;EAEL;;ACvCH,SAAgB,eAAwB;AACtC,QAAO,qBACL,sBACM,YACA,MACP;;AAGH,MAAM,6BAA6B;AC6BnC,SAAwB,oBAAoB,EAC1C,UACA,QACA,qBAAqB,MACrB,QACA,
|
|
1
|
+
{"version":3,"file":"NextStudio.js","names":[],"sources":["../src/studio/client-component/createHashHistoryForStudio.ts","../src/studio/client-component/useIsMounted.ts","../src/studio/client-component/NextStudio.tsx"],"sourcesContent":["import {createHashHistory, type History, type Listener} from 'history'\n\n/** @internal */\nexport function createHashHistoryForStudio(): History {\n const history = createHashHistory()\n return {\n get action() {\n return history.action\n },\n get location() {\n return history.location\n },\n get createHref() {\n return history.createHref\n },\n get push() {\n return history.push\n },\n get replace() {\n return history.replace\n },\n get go() {\n return history.go\n },\n get back() {\n return history.back\n },\n get forward() {\n return history.forward\n },\n get block() {\n return history.block\n },\n // Overriding listen to workaround a problem where native history provides history.listen(location => void), but the npm package is history.listen(({action, location}) => void)\n listen(listener: Listener) {\n // return history.listen(({ action, location }) => {\n return history.listen(({location}) => {\n // console.debug('history.listen', action, location)\n // @ts-expect-error -- working around a bug? in studio\n listener(location)\n })\n },\n }\n}\n","import {useSyncExternalStore} from 'react'\n\n/** @internal */\nexport function useIsMounted(): boolean {\n return useSyncExternalStore(\n emptySubscribe,\n () => true,\n () => false,\n )\n}\n// eslint-disable-next-line no-empty-function\nconst emptySubscribe = () => () => {}\n","import {useMemo} from 'react'\nimport {Studio, type StudioProps} from 'sanity'\n\nimport {NextStudioLayout} from '../NextStudioLayout'\nimport {NextStudioNoScript} from '../NextStudioNoScript'\nimport {createHashHistoryForStudio} from './createHashHistoryForStudio'\nimport {useIsMounted} from './useIsMounted'\n\n/** @public */\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 * The 'hash' option is new feature that is not yet stable for production, but is available for testing and its API won't change in a breaking way.\n * If 'hash' doesn't work for you, or if you want to use a memory based history, you can use the `unstable_history` prop instead.\n * @alpha\n * @defaultValue 'browser'\n */\n history?: 'browser' | 'hash'\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 * @public\n */\nexport default function NextStudioComponent({\n children,\n config,\n unstable__noScript = true,\n scheme,\n history,\n ...props\n}: NextStudioProps): React.JSX.Element {\n const isMounted = useIsMounted()\n const unstableHistory = useMemo<typeof props.unstable_history>(() => {\n if (props.unstable_history && history) {\n throw new Error('Cannot use both `unstable_history` and `history` props at the same time')\n }\n\n if (isMounted && history === 'hash') {\n return createHashHistoryForStudio()\n }\n return props.unstable_history\n }, [history, isMounted, props.unstable_history])\n\n return (\n <>\n {unstable__noScript && <NextStudioNoScript />}\n <NextStudioLayout>\n {history === 'hash' && !isMounted\n ? null\n : children || (\n <Studio\n config={config}\n scheme={scheme}\n unstable_globalStyles\n {...props}\n unstable_history={unstableHistory}\n />\n )}\n </NextStudioLayout>\n </>\n )\n}\n"],"mappings":";;;;;AAGA,SAAgB,6BAAsC;CACpD,MAAM,UAAU,mBAAmB;AACnC,QAAO;EACL,IAAI,SAAS;AACX,UAAO,QAAQ;;EAEjB,IAAI,WAAW;AACb,UAAO,QAAQ;;EAEjB,IAAI,aAAa;AACf,UAAO,QAAQ;;EAEjB,IAAI,OAAO;AACT,UAAO,QAAQ;;EAEjB,IAAI,UAAU;AACZ,UAAO,QAAQ;;EAEjB,IAAI,KAAK;AACP,UAAO,QAAQ;;EAEjB,IAAI,OAAO;AACT,UAAO,QAAQ;;EAEjB,IAAI,UAAU;AACZ,UAAO,QAAQ;;EAEjB,IAAI,QAAQ;AACV,UAAO,QAAQ;;EAGjB,OAAO,UAAoB;AAEzB,UAAO,QAAQ,QAAQ,EAAC,eAAc;AAGpC,aAAS,SAAS;KAClB;;EAEL;;ACvCH,SAAgB,eAAwB;AACtC,QAAO,qBACL,sBACM,YACA,MACP;;AAGH,MAAM,6BAA6B;AC6BnC,SAAwB,oBAAoB,EAC1C,UACA,QACA,qBAAqB,MACrB,QACA,SACA,GAAG,SACkC;CACrC,MAAM,YAAY,cAAc;CAChC,MAAM,kBAAkB,cAA6C;AACnE,MAAI,MAAM,oBAAoB,QAC5B,OAAM,IAAI,MAAM,0EAA0E;AAG5F,MAAI,aAAa,YAAY,OAC3B,QAAO,4BAA4B;AAErC,SAAO,MAAM;IACZ;EAAC;EAAS;EAAW,MAAM;EAAiB,CAAC;AAEhD,QACE,qBAAA,UAAA,EAAA,UAAA,CACG,sBAAsB,oBAAC,oBAAA,EAAA,CAAqB,EAC7C,oBAAC,kBAAA,EAAA,UACE,YAAY,UAAU,CAAC,YACpB,OACA,YACE,oBAAC,QAAA;EACS;EACA;EACR,uBAAA;EACA,GAAI;EACJ,kBAAkB;GAClB,EAAA,CAES,CAAA,EAAA,CAClB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as sanitizePerspective } from "./utils.js";
|
|
2
1
|
import { f as setPerspective, l as setComlink, s as perspective, u as setComlinkClientConfig } from "./context.js";
|
|
2
|
+
import { t as sanitizePerspective } from "./utils.js";
|
|
3
3
|
import { useRouter } from "next/navigation";
|
|
4
4
|
import { startTransition, useEffect } from "react";
|
|
5
5
|
import { createNode, createNodeMachine } from "@sanity/comlink";
|
package/dist/SanityLiveStream.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as comlinkListeners, t as comlink } from "./context.js";
|
|
2
|
-
import "@sanity/client";
|
|
3
|
-
import { stegaEncodeSourceMap } from "@sanity/client/stega";
|
|
4
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
2
|
import { use, useCallback, useEffect, useState, useSyncExternalStore } from "react";
|
|
3
|
+
import { stegaEncodeSourceMap } from "@sanity/client/stega";
|
|
6
4
|
import { dequal } from "dequal/lite";
|
|
7
5
|
import { useEffectEvent } from "use-effect-event";
|
|
6
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
7
|
+
import "@sanity/client";
|
|
8
8
|
const LISTEN_HEARTBEAT_INTERVAL = 1e4;
|
|
9
9
|
function SanityLiveStream(props) {
|
|
10
10
|
const { query, dataset, params = {}, perspective, projectId, stega } = props;
|
package/dist/VisualEditing.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
3
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
3
|
import { VisualEditing as VisualEditing$1 } from "@sanity/visual-editing/react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { revalidateRootLayout } from "next-sanity/visual-editing/server-actions";
|
|
6
6
|
function pathHasPrefix(path, prefix) {
|
|
7
7
|
if (typeof path !== "string") return false;
|
package/dist/draft-mode/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cookies, draftMode } from "next/headers";
|
|
2
|
-
import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
|
|
3
1
|
import { validatePreviewUrl } from "@sanity/preview-url-secret";
|
|
2
|
+
import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
|
|
3
|
+
import { cookies, draftMode } from "next/headers";
|
|
4
4
|
import { redirect } from "next/navigation";
|
|
5
5
|
function defineEnableDraftMode(options) {
|
|
6
6
|
const { client } = options;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { d as setEnvironment, f as setPerspective } from "../../context.js";
|
|
3
3
|
import { t as sanitizePerspective } from "../../utils.js";
|
|
4
4
|
import { n as PUBLISHED_SYNC_TAG_PREFIX } from "../../constants.js";
|
|
5
|
-
import {
|
|
6
|
-
import { createClient } from "@sanity/client";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { t as isCorsOriginError } from "../../isCorsOriginError.js";
|
|
8
6
|
import { useRouter } from "next/navigation";
|
|
9
7
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
10
8
|
import { isMaybePresentation, isMaybePreviewWindow } from "@sanity/presentation-comlink";
|
|
11
9
|
import { useEffectEvent } from "use-effect-event";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { createClient } from "@sanity/client";
|
|
12
12
|
import dynamic from "next/dynamic";
|
|
13
13
|
const PresentationComlink = dynamic(() => import("../../PresentationComlink.js"), { ssr: false });
|
|
14
14
|
const RefreshOnMount = dynamic(() => import("../../RefreshOnMount.js"), { ssr: false });
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as sanitizePerspective } from "../utils.js";
|
|
2
2
|
import { n as PUBLISHED_SYNC_TAG_PREFIX, t as DRAFT_SYNC_TAG_PREFIX } from "../constants.js";
|
|
3
|
-
import { stegaEncodeSourceMap } from "@sanity/client/stega";
|
|
4
|
-
import { preconnect } from "react-dom";
|
|
5
|
-
import { cookies, draftMode } from "next/headers";
|
|
6
3
|
import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
|
|
4
|
+
import { cookies, draftMode } from "next/headers";
|
|
5
|
+
import { stegaEncodeSourceMap } from "@sanity/client/stega";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
8
7
|
import "server-only";
|
|
9
8
|
import { createClient } from "next-sanity";
|
|
10
9
|
import SanityLiveClientComponent from "next-sanity/experimental/client-components/live";
|
|
11
10
|
import { cacheLife, cacheTag, updateTag } from "next/cache";
|
|
11
|
+
import { preconnect } from "react-dom";
|
|
12
12
|
async function resolvePerspectiveFromCookies({ cookies: jar }) {
|
|
13
13
|
return jar.has(perspectiveCookieName) ? sanitizePerspective(jar.get(perspectiveCookieName)?.value, "drafts") : "drafts";
|
|
14
14
|
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ClientPerspective, ClientPerspective as ClientPerspective$1, ClientReturn, ContentSourceMap, QueryParams } from "@sanity/client";
|
|
2
1
|
import "@sanity/comlink";
|
|
3
2
|
import "@sanity/presentation-comlink";
|
|
4
3
|
import { useOptimistic } from "@sanity/visual-editing/react";
|
|
4
|
+
import { ClientPerspective, ClientPerspective as ClientPerspective$1, ClientReturn, ContentSourceMap, QueryParams } from "@sanity/client";
|
|
5
5
|
|
|
6
6
|
//#region src/live/hooks/context.d.ts
|
|
7
7
|
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { a as environment, c as perspectiveListeners, i as comlinkProjectId, n as comlinkDataset, o as environmentListeners, r as comlinkListeners, s as perspective, t as comlink } from "../context.js";
|
|
3
|
-
import { stegaEncodeSourceMap } from "@sanity/client/stega";
|
|
4
3
|
import { useCallback, useEffect, useMemo, useReducer, useSyncExternalStore } from "react";
|
|
4
|
+
import { stegaEncodeSourceMap } from "@sanity/client/stega";
|
|
5
5
|
import { dequal } from "dequal/lite";
|
|
6
6
|
import { useEffectEvent } from "use-effect-event";
|
|
7
7
|
import { useOptimistic } from "@sanity/visual-editing/react";
|
package/dist/image/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import NextImage from "next/image";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
const imageLoader = ({ src, width, quality }) => {
|
|
5
5
|
const url = new URL(src);
|
|
6
6
|
url.searchParams.set("auto", "format");
|
|
@@ -15,7 +15,7 @@ const imageLoader = ({ src, width, quality }) => {
|
|
|
15
15
|
return url.href;
|
|
16
16
|
};
|
|
17
17
|
function Image(props) {
|
|
18
|
-
const { loader, src
|
|
18
|
+
const { loader, src, ...rest } = props;
|
|
19
19
|
if (loader) throw new TypeError("The `loader` prop is not supported on `Image` components. Use `next/image` directly to use a custom loader.");
|
|
20
20
|
let srcUrl;
|
|
21
21
|
try {
|
package/dist/image/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["imageLoader: ImageLoader","srcUrl: URL"],"sources":["../../src/image/imageLoader.ts","../../src/image/Image.tsx"],"sourcesContent":["import type {ImageLoader} from 'next/image'\n\n/**\n * @alpha\n */\nexport const imageLoader: ImageLoader = ({src, width, quality}) => {\n const url = new URL(src)\n url.searchParams.set('auto', 'format')\n if (!url.searchParams.has('fit')) {\n url.searchParams.set('fit', url.searchParams.has('h') ? 'min' : 'max')\n }\n if (url.searchParams.has('h') && url.searchParams.has('w')) {\n const originalHeight = parseInt(url.searchParams.get('h')!, 10)\n const originalWidth = parseInt(url.searchParams.get('w')!, 10)\n url.searchParams.set('h', Math.round((originalHeight / originalWidth) * width).toString())\n }\n url.searchParams.set('w', width.toString())\n if (quality) {\n url.searchParams.set('q', quality.toString())\n }\n return url.href\n}\n","import NextImage, {type ImageProps as NextImageProps} from 'next/image'\n\nimport {imageLoader} from './imageLoader'\n\n/**\n * @alpha\n */\nexport interface ImageProps extends Omit<NextImageProps, 'loader' | 'src'> {\n /**\n * The `loader` prop is not supported on `Image` components. Use `next/image` directly to use a custom loader.\n */\n loader?: never\n /**\n * Must be a string that is a valid URL to an image on the Sanity Image CDN.\n */\n src: string\n}\n\n/**\n * @alpha\n */\nexport function Image(props: ImageProps): React.JSX.Element {\n const {loader, src, ...rest} = props\n if (loader) {\n throw new TypeError(\n 'The `loader` prop is not supported on `Image` components. Use `next/image` directly to use a custom loader.',\n )\n }\n let srcUrl: URL\n try {\n srcUrl = new URL(src)\n if (props.height) {\n srcUrl.searchParams.set('h', `${props.height}`)\n }\n if (props.width) {\n srcUrl.searchParams.set('w', `${props.width}`)\n }\n } catch (err) {\n throw new TypeError('The `src` prop must be a valid URL to an image on the Sanity Image CDN.', {\n cause: err,\n })\n }\n return <NextImage {...rest} src={srcUrl.toString()} loader={imageLoader} />\n}\n"],"mappings":";;;AAKA,MAAaA,eAA4B,EAAC,KAAK,OAAO,cAAa;CACjE,MAAM,MAAM,IAAI,IAAI,IAAI;AACxB,KAAI,aAAa,IAAI,QAAQ,SAAS;AACtC,KAAI,CAAC,IAAI,aAAa,IAAI,MAAM,CAC9B,KAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,IAAI,GAAG,QAAQ,MAAM;AAExE,KAAI,IAAI,aAAa,IAAI,IAAI,IAAI,IAAI,aAAa,IAAI,IAAI,EAAE;EAC1D,MAAM,iBAAiB,SAAS,IAAI,aAAa,IAAI,IAAI,EAAG,GAAG;EAC/D,MAAM,gBAAgB,SAAS,IAAI,aAAa,IAAI,IAAI,EAAG,GAAG;AAC9D,MAAI,aAAa,IAAI,KAAK,KAAK,MAAO,iBAAiB,gBAAiB,MAAM,CAAC,UAAU,CAAC;;AAE5F,KAAI,aAAa,IAAI,KAAK,MAAM,UAAU,CAAC;AAC3C,KAAI,QACF,KAAI,aAAa,IAAI,KAAK,QAAQ,UAAU,CAAC;AAE/C,QAAO,IAAI;;ACCb,SAAgB,MAAM,OAAsC;CAC1D,MAAM,EAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","names":["imageLoader: ImageLoader","srcUrl: URL"],"sources":["../../src/image/imageLoader.ts","../../src/image/Image.tsx"],"sourcesContent":["import type {ImageLoader} from 'next/image'\n\n/**\n * @alpha\n */\nexport const imageLoader: ImageLoader = ({src, width, quality}) => {\n const url = new URL(src)\n url.searchParams.set('auto', 'format')\n if (!url.searchParams.has('fit')) {\n url.searchParams.set('fit', url.searchParams.has('h') ? 'min' : 'max')\n }\n if (url.searchParams.has('h') && url.searchParams.has('w')) {\n const originalHeight = parseInt(url.searchParams.get('h')!, 10)\n const originalWidth = parseInt(url.searchParams.get('w')!, 10)\n url.searchParams.set('h', Math.round((originalHeight / originalWidth) * width).toString())\n }\n url.searchParams.set('w', width.toString())\n if (quality) {\n url.searchParams.set('q', quality.toString())\n }\n return url.href\n}\n","import NextImage, {type ImageProps as NextImageProps} from 'next/image'\n\nimport {imageLoader} from './imageLoader'\n\n/**\n * @alpha\n */\nexport interface ImageProps extends Omit<NextImageProps, 'loader' | 'src'> {\n /**\n * The `loader` prop is not supported on `Image` components. Use `next/image` directly to use a custom loader.\n */\n loader?: never\n /**\n * Must be a string that is a valid URL to an image on the Sanity Image CDN.\n */\n src: string\n}\n\n/**\n * @alpha\n */\nexport function Image(props: ImageProps): React.JSX.Element {\n const {loader, src, ...rest} = props\n if (loader) {\n throw new TypeError(\n 'The `loader` prop is not supported on `Image` components. Use `next/image` directly to use a custom loader.',\n )\n }\n let srcUrl: URL\n try {\n srcUrl = new URL(src)\n if (props.height) {\n srcUrl.searchParams.set('h', `${props.height}`)\n }\n if (props.width) {\n srcUrl.searchParams.set('w', `${props.width}`)\n }\n } catch (err) {\n throw new TypeError('The `src` prop must be a valid URL to an image on the Sanity Image CDN.', {\n cause: err,\n })\n }\n return <NextImage {...rest} src={srcUrl.toString()} loader={imageLoader} />\n}\n"],"mappings":";;;AAKA,MAAaA,eAA4B,EAAC,KAAK,OAAO,cAAa;CACjE,MAAM,MAAM,IAAI,IAAI,IAAI;AACxB,KAAI,aAAa,IAAI,QAAQ,SAAS;AACtC,KAAI,CAAC,IAAI,aAAa,IAAI,MAAM,CAC9B,KAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,IAAI,GAAG,QAAQ,MAAM;AAExE,KAAI,IAAI,aAAa,IAAI,IAAI,IAAI,IAAI,aAAa,IAAI,IAAI,EAAE;EAC1D,MAAM,iBAAiB,SAAS,IAAI,aAAa,IAAI,IAAI,EAAG,GAAG;EAC/D,MAAM,gBAAgB,SAAS,IAAI,aAAa,IAAI,IAAI,EAAG,GAAG;AAC9D,MAAI,aAAa,IAAI,KAAK,KAAK,MAAO,iBAAiB,gBAAiB,MAAM,CAAC,UAAU,CAAC;;AAE5F,KAAI,aAAa,IAAI,KAAK,MAAM,UAAU,CAAC;AAC3C,KAAI,QACF,KAAI,aAAa,IAAI,KAAK,QAAQ,UAAU,CAAC;AAE/C,QAAO,IAAI;;ACCb,SAAgB,MAAM,OAAsC;CAC1D,MAAM,EAAC,QAAQ,KAAK,GAAG,SAAQ;AAC/B,KAAI,OACF,OAAM,IAAI,UACR,8GACD;CAEH,IAAIC;AACJ,KAAI;AACF,WAAS,IAAI,IAAI,IAAI;AACrB,MAAI,MAAM,OACR,QAAO,aAAa,IAAI,KAAK,GAAG,MAAM,SAAS;AAEjD,MAAI,MAAM,MACR,QAAO,aAAa,IAAI,KAAK,GAAG,MAAM,QAAQ;UAEzC,KAAK;AACZ,QAAM,IAAI,UAAU,2EAA2E,EAC7F,OAAO,KACR,CAAC;;AAEJ,QAAO,oBAAC,WAAA;EAAU,GAAI;EAAM,KAAK,OAAO,UAAU;EAAE,QAAQ;GAAe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as isCorsOriginError } from "./isCorsOriginError.js";
|
|
2
|
-
import { createClient, unstable__adapter, unstable__environment } from "@sanity/client";
|
|
3
2
|
import { stegaClean } from "@sanity/client/stega";
|
|
3
|
+
import { createClient, unstable__adapter, unstable__environment } from "@sanity/client";
|
|
4
4
|
import { CreateDataAttribute, CreateDataAttributeProps, createDataAttribute } from "@sanity/visual-editing/create-data-attribute";
|
|
5
5
|
import groq, { defineQuery } from "groq";
|
|
6
6
|
export * from "@sanity/client";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as isCorsOriginError } from "./isCorsOriginError.js";
|
|
2
|
-
import { createClient, unstable__adapter, unstable__environment } from "@sanity/client";
|
|
3
2
|
import { stegaClean } from "@sanity/client/stega";
|
|
3
|
+
import { createClient, unstable__adapter, unstable__environment } from "@sanity/client";
|
|
4
4
|
import { createDataAttribute } from "@sanity/visual-editing/create-data-attribute";
|
|
5
5
|
import groq, { defineQuery } from "groq";
|
|
6
6
|
export * from "@portabletext/react";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as isCorsOriginError } from "../../../isCorsOriginError.js";
|
|
3
2
|
import { d as setEnvironment, f as setPerspective } from "../../../context.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { t as isCorsOriginError } from "../../../isCorsOriginError.js";
|
|
6
4
|
import { useRouter } from "next/navigation";
|
|
7
5
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
8
6
|
import { isMaybePresentation, isMaybePreviewWindow } from "@sanity/presentation-comlink";
|
|
9
7
|
import { useEffectEvent } from "use-effect-event";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { createClient } from "@sanity/client";
|
|
10
10
|
import dynamic from "next/dynamic";
|
|
11
11
|
import { revalidateSyncTags } from "next-sanity/live/server-actions";
|
|
12
12
|
const PresentationComlink = dynamic(() => import("../../../PresentationComlink2.js"), { ssr: false });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
import { t as sanitizePerspective } from "../../utils.js";
|
|
3
|
-
import { cookies, draftMode } from "next/headers";
|
|
4
3
|
import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
|
|
4
|
+
import { cookies, draftMode } from "next/headers";
|
|
5
5
|
import { revalidateTag } from "next/cache";
|
|
6
6
|
async function revalidateSyncTags(tags) {
|
|
7
7
|
await revalidateTag("sanity:fetch-sync-tags", "max");
|
package/dist/live.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as isCorsOriginError } from "./isCorsOriginError.js";
|
|
2
1
|
import { t as sanitizePerspective } from "./utils.js";
|
|
3
|
-
import "
|
|
2
|
+
import { t as isCorsOriginError } from "./isCorsOriginError.js";
|
|
3
|
+
import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
|
|
4
|
+
import { cookies, draftMode } from "next/headers";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
6
|
import { preconnect, prefetchDNS } from "react-dom";
|
|
7
|
+
import "@sanity/client";
|
|
5
8
|
import SanityLiveClientComponent from "next-sanity/live/client-components/live";
|
|
6
9
|
import SanityLiveStreamClientComponent from "next-sanity/live/client-components/live-stream";
|
|
7
|
-
import { cookies, draftMode } from "next/headers";
|
|
8
|
-
import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
async function resolveCookiePerspective() {
|
|
11
11
|
return (await draftMode()).isEnabled ? (await cookies()).has(perspectiveCookieName) ? sanitizePerspective((await cookies()).get(perspectiveCookieName)?.value, "drafts") : "drafts" : "published";
|
|
12
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { Suspense, lazy } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
const NextStudioClientComponent = lazy(() => import("../../NextStudio.js"));
|
|
5
5
|
function NextStudioLazyClientComponent(props) {
|
|
6
6
|
return /* @__PURE__ */ jsx(Suspense, {
|
package/dist/studio/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as NextStudioLayout, t as NextStudioNoScript } from "../NextStudioNoScript.js";
|
|
2
|
-
import { preloadModule } from "react-dom";
|
|
3
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { preloadModule } from "react-dom";
|
|
4
4
|
import { NextStudio } from "next-sanity/studio/client-component";
|
|
5
5
|
const viewport = {
|
|
6
6
|
width: "device-width",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { Suspense, lazy } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
const VisualEditingClientComponent = lazy(() => import("../../VisualEditing.js"));
|
|
5
5
|
function VisualEditingLazyClientComponent(props) {
|
|
6
6
|
return /* @__PURE__ */ jsx(Suspense, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.7",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -106,36 +106,36 @@
|
|
|
106
106
|
"@sanity/preview-url-secret": "^2.1.15",
|
|
107
107
|
"@sanity/visual-editing": "^4.0.0",
|
|
108
108
|
"dequal": "^2.0.3",
|
|
109
|
-
"groq": "^4.
|
|
109
|
+
"groq": "^4.15.0",
|
|
110
110
|
"history": "^5.3.0",
|
|
111
111
|
"server-only": "^0.0.1",
|
|
112
112
|
"use-effect-event": "^2.0.3"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@sanity/browserslist-config": "^1.0.5",
|
|
116
|
-
"@sanity/pkg-utils": "^9.0
|
|
117
|
-
"@sanity/types": "^4.
|
|
116
|
+
"@sanity/pkg-utils": "^9.1.0",
|
|
117
|
+
"@sanity/types": "^4.15.0",
|
|
118
118
|
"@sanity/webhook": "4.0.4",
|
|
119
119
|
"@types/node": "^24",
|
|
120
120
|
"@types/react": "^19.1.8",
|
|
121
121
|
"@types/react-dom": "^19.1.6",
|
|
122
|
-
"@vitest/coverage-v8": "^4.0.
|
|
123
|
-
"next": "16.0.2-canary.
|
|
122
|
+
"@vitest/coverage-v8": "^4.0.9",
|
|
123
|
+
"next": "16.0.2-canary.21",
|
|
124
124
|
"publint": "^0.3.15",
|
|
125
125
|
"react": "^19.2.0",
|
|
126
126
|
"react-dom": "^19.2.0",
|
|
127
127
|
"styled-components": "^6.1.19",
|
|
128
|
-
"tsdown": "0.16.
|
|
128
|
+
"tsdown": "0.16.5",
|
|
129
129
|
"typescript": "5.9.3",
|
|
130
130
|
"vite-tsconfig-paths": "^5.1.4",
|
|
131
|
-
"vitest": "^4.0.
|
|
131
|
+
"vitest": "^4.0.9"
|
|
132
132
|
},
|
|
133
133
|
"peerDependencies": {
|
|
134
134
|
"@sanity/client": "^7.12.1",
|
|
135
135
|
"next": "^15.1.0-0 || ^16.0.0-0",
|
|
136
136
|
"react": "^18.3 || ^19",
|
|
137
137
|
"react-dom": "^18.3 || ^19",
|
|
138
|
-
"sanity": "^4.
|
|
138
|
+
"sanity": "^4.15.0",
|
|
139
139
|
"styled-components": "^6.1"
|
|
140
140
|
},
|
|
141
141
|
"engines": {
|