sanity 5.27.0-next.8 → 5.27.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.
@@ -29,6 +29,7 @@ import { CSSProperties as CSSProperties$1, ExecutionProps } from "styled-compone
29
29
  import { ThrottleSettings } from "lodash-es/throttle.js";
30
30
  import { DEFAULT_ANNOTATIONS, DEFAULT_DECORATORS } from "@sanity/schema";
31
31
  import * as _$styled_components_dist_types0 from "/home/runner/work/sanity/sanity/node_modules/.pnpm/@sanity+styled-components@6.1.24_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@sanity/styled-components/dist/types.js";
32
+ import { SanityImageSource } from "@sanity/asset-utils";
32
33
  import { PortableTextMemberSchemaTypes } from "@portabletext/sanity-bridge";
33
34
  import { ImageUrlBuilder, ImageUrlBuilder as ImageUrlBuilder$1 } from "@sanity/image-url";
34
35
  import { MarkdownShortcutsPluginProps } from "@portabletext/plugin-markdown-shortcuts";
@@ -9901,7 +9902,7 @@ interface PreviewProps<TLayoutKey = PreviewLayoutKey> {
9901
9902
  imageUrl?: string;
9902
9903
  isPlaceholder?: boolean;
9903
9904
  layout?: TLayoutKey;
9904
- media?: ReactNode | ComponentType<{
9905
+ media?: ReactNode | SanityImageSource | ComponentType<{
9905
9906
  dimensions: PreviewMediaDimensions;
9906
9907
  layout: TLayoutKey;
9907
9908
  }>;
@@ -1,4 +1,4 @@
1
- var version = "5.27.0-next.8+e296b6ce59";
1
+ var version = "5.27.0";
2
2
  let buildVersion;
3
3
  try {
4
4
  buildVersion = process.env.PKG_BUILD_VERSION;
@@ -7,7 +7,7 @@ try {
7
7
  try {
8
8
  buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
9
9
  // and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
10
- "5.27.0-next.8+e296b6ce59";
10
+ "5.27.0";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.js CHANGED
@@ -58,7 +58,7 @@ import orderBy from "lodash-es/orderBy.js";
58
58
  import { nanoid, customAlphabet } from "nanoid";
59
59
  import * as legacyDateFormat from "@sanity/util/legacyDateFormat";
60
60
  import { sanitizeLocale, format as format$1, DEFAULT_DATE_FORMAT, parse as parse$2, isValidTimeZoneString, DEFAULT_TIME_FORMAT } from "@sanity/util/legacyDateFormat";
61
- import { getImageDimensions, isDefaultCrop, isDefaultHotspot, isImageSource, isFileSource, isSanityImageUrl, parseImageAssetUrl, isAssetObjectStub, isImageAssetId, isFileAssetId } from "@sanity/asset-utils";
61
+ import { getImageDimensions, isDefaultCrop, isDefaultHotspot, isImageSource, isFileSource, tryGetImageDimensions, isSanityImageUrl, parseImageAssetUrl, isAssetObjectStub, isImageAssetId, isFileAssetId } from "@sanity/asset-utils";
62
62
  import { createImageUrlBuilder } from "@sanity/image-url";
63
63
  import uniq from "lodash-es/uniq.js";
64
64
  import xor from "lodash-es/xor.js";
@@ -92,6 +92,7 @@ import { differenceInSeconds } from "date-fns/differenceInSeconds";
92
92
  import { differenceInWeeks } from "date-fns/differenceInWeeks";
93
93
  import { differenceInYears } from "date-fns/differenceInYears";
94
94
  import { mergeMapArray } from "rxjs-mergemap-array";
95
+ import { useDevicePixelRatio, getDevicePixelRatio } from "use-device-pixel-ratio";
95
96
  import { useSyncExternalStore as useSyncExternalStore$1 } from "use-sync-external-store/shim/index.js";
96
97
  import DataLoader from "dataloader";
97
98
  import { createNode } from "@sanity/comlink";
@@ -103,7 +104,6 @@ import partition from "lodash-es/partition.js";
103
104
  import { diffInput, wrap as wrap$1 } from "@sanity/diff";
104
105
  import { applyPatch as applyPatch$1, incremental } from "mendoza";
105
106
  import pick from "lodash-es/pick.js";
106
- import { useDevicePixelRatio, getDevicePixelRatio } from "use-device-pixel-ratio";
107
107
  import classNames from "classnames";
108
108
  import debounce from "lodash-es/debounce.js";
109
109
  import sortBy from "lodash-es/sortBy.js";
@@ -33079,7 +33079,7 @@ const noOutlineStyle = {
33079
33079
  `;
33080
33080
  });
33081
33081
  function Editor(props2) {
33082
- const $ = c(56), {
33082
+ const $ = c(58), {
33083
33083
  elementRef,
33084
33084
  hideToolbar,
33085
33085
  hotkeys,
@@ -33109,7 +33109,7 @@ function Editor(props2) {
33109
33109
  isTopLayer
33110
33110
  } = useLayer(), {
33111
33111
  element: boundaryElement
33112
- } = useBoundaryElement();
33112
+ } = useBoundaryElement(), [rootElement, setRootElement] = useState(null);
33113
33113
  let t0;
33114
33114
  $[0] !== isFullscreen || $[1] !== isTopLayer || $[2] !== onToggleFullscreen ? (t0 = (event) => {
33115
33115
  !isTopLayer || !isFullscreen || event.key === "Escape" && onToggleFullscreen();
@@ -33147,26 +33147,26 @@ function Editor(props2) {
33147
33147
  }, $[22] = onItemOpen, $[23] = path, $[24] = t4) : t4 = $[24];
33148
33148
  const handleToolBarOnMemberOpen = t4, collapsibleToolbar = id2 === FORM_BUILDER_DEFAULT_ID;
33149
33149
  let t5;
33150
- $[25] !== collapsibleToolbar || $[26] !== handleToolBarOnMemberOpen || $[27] !== hideToolbar || $[28] !== hotkeys || $[29] !== isActive || $[30] !== isFullscreen || $[31] !== onToggleFullscreen || $[32] !== readOnly ? (t5 = isActive && !hideToolbar && /* @__PURE__ */ jsx(TooltipDelayGroupProvider, { children: /* @__PURE__ */ jsx(ToolbarCard, { "data-testid": "pt-editor__toolbar-card", shadow: 1, children: /* @__PURE__ */ jsx(Toolbar, { collapsible: collapsibleToolbar, hotkeys, isFullscreen, onMemberOpen: handleToolBarOnMemberOpen, onToggleFullscreen, readOnly }) }) }), $[25] = collapsibleToolbar, $[26] = handleToolBarOnMemberOpen, $[27] = hideToolbar, $[28] = hotkeys, $[29] = isActive, $[30] = isFullscreen, $[31] = onToggleFullscreen, $[32] = readOnly, $[33] = t5) : t5 = $[33];
33150
+ $[25] !== boundaryElement || $[26] !== collapsibleToolbar || $[27] !== handleToolBarOnMemberOpen || $[28] !== hideToolbar || $[29] !== hotkeys || $[30] !== isActive || $[31] !== isFullscreen || $[32] !== onToggleFullscreen || $[33] !== readOnly || $[34] !== rootElement ? (t5 = isActive && !hideToolbar && /* @__PURE__ */ jsx(BoundaryElementProvider, { element: isFullscreen ? rootElement : boundaryElement, children: /* @__PURE__ */ jsx(TooltipDelayGroupProvider, { children: /* @__PURE__ */ jsx(ToolbarCard, { "data-testid": "pt-editor__toolbar-card", shadow: 1, children: /* @__PURE__ */ jsx(Toolbar, { collapsible: collapsibleToolbar, hotkeys, isFullscreen, onMemberOpen: handleToolBarOnMemberOpen, onToggleFullscreen, readOnly }) }) }) }), $[25] = boundaryElement, $[26] = collapsibleToolbar, $[27] = handleToolBarOnMemberOpen, $[28] = hideToolbar, $[29] = hotkeys, $[30] = isActive, $[31] = isFullscreen, $[32] = onToggleFullscreen, $[33] = readOnly, $[34] = rootElement, $[35] = t5) : t5 = $[35];
33151
33151
  const t6 = readOnly ? "transparent" : "default", t7 = readOnly ? "transparent" : "default", t8 = isFullscreen ? scrollElement : boundaryElement;
33152
33152
  let t9;
33153
- $[34] !== editable || $[35] !== t8 ? (t9 = /* @__PURE__ */ jsx(BoundaryElementProvider, { element: t8, children: editable }), $[34] = editable, $[35] = t8, $[36] = t9) : t9 = $[36];
33153
+ $[36] !== editable || $[37] !== t8 ? (t9 = /* @__PURE__ */ jsx(BoundaryElementProvider, { element: t8, children: editable }), $[36] = editable, $[37] = t8, $[38] = t9) : t9 = $[38];
33154
33154
  let t10;
33155
- $[37] !== isFullscreen || $[38] !== isOneLine || $[39] !== t7 || $[40] !== t9 ? (t10 = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(EditableWrapper, { $isFullscreen: isFullscreen, $isOneLine: isOneLine, tone: t7, children: t9 }) }), $[37] = isFullscreen, $[38] = isOneLine, $[39] = t7, $[40] = t9, $[41] = t10) : t10 = $[41];
33155
+ $[39] !== isFullscreen || $[40] !== isOneLine || $[41] !== t7 || $[42] !== t9 ? (t10 = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(EditableWrapper, { $isFullscreen: isFullscreen, $isOneLine: isOneLine, tone: t7, children: t9 }) }), $[39] = isFullscreen, $[40] = isOneLine, $[41] = t7, $[42] = t9, $[43] = t10) : t10 = $[43];
33156
33156
  let t11;
33157
- $[42] !== setScrollElement || $[43] !== t10 ? (t11 = /* @__PURE__ */ jsx(Scroller, { ref: setScrollElement, children: t10 }), $[42] = setScrollElement, $[43] = t10, $[44] = t11) : t11 = $[44];
33157
+ $[44] !== setScrollElement || $[45] !== t10 ? (t11 = /* @__PURE__ */ jsx(Scroller, { ref: setScrollElement, children: t10 }), $[44] = setScrollElement, $[45] = t10, $[46] = t11) : t11 = $[46];
33158
33158
  let t12;
33159
- $[45] !== setPortalElement ? (t12 = /* @__PURE__ */ jsx("div", { "data-portal": "", ref: setPortalElement }), $[45] = setPortalElement, $[46] = t12) : t12 = $[46];
33159
+ $[47] !== setPortalElement ? (t12 = /* @__PURE__ */ jsx("div", { "data-portal": "", ref: setPortalElement }), $[47] = setPortalElement, $[48] = t12) : t12 = $[48];
33160
33160
  let t13;
33161
- $[47] !== t11 || $[48] !== t12 || $[49] !== t6 ? (t13 = /* @__PURE__ */ jsxs(EditableCard, { flex: 1, tone: t6, children: [
33161
+ $[49] !== t11 || $[50] !== t12 || $[51] !== t6 ? (t13 = /* @__PURE__ */ jsxs(EditableCard, { flex: 1, tone: t6, children: [
33162
33162
  t11,
33163
33163
  t12
33164
- ] }), $[47] = t11, $[48] = t12, $[49] = t6, $[50] = t13) : t13 = $[50];
33164
+ ] }), $[49] = t11, $[50] = t12, $[51] = t6, $[52] = t13) : t13 = $[52];
33165
33165
  let t14;
33166
- return $[51] !== isFullscreen || $[52] !== isOneLine || $[53] !== t13 || $[54] !== t5 ? (t14 = /* @__PURE__ */ jsxs(Root$j, { "data-fullscreen": isFullscreen, "data-testid": "pt-editor", $isOneLine: isOneLine, children: [
33166
+ return $[53] !== isFullscreen || $[54] !== isOneLine || $[55] !== t13 || $[56] !== t5 ? (t14 = /* @__PURE__ */ jsxs(Root$j, { "data-fullscreen": isFullscreen, "data-testid": "pt-editor", ref: setRootElement, $isOneLine: isOneLine, children: [
33167
33167
  t5,
33168
33168
  t13
33169
- ] }), $[51] = isFullscreen, $[52] = isOneLine, $[53] = t13, $[54] = t5, $[55] = t14) : t14 = $[55], t14;
33169
+ ] }), $[53] = isFullscreen, $[54] = isOneLine, $[55] = t13, $[56] = t5, $[57] = t14) : t14 = $[57], t14;
33170
33170
  }
33171
33171
  function _temp3$D(listItemProps) {
33172
33172
  return /* @__PURE__ */ jsx(ListItem$1, { ...listItemProps });
@@ -33274,9 +33274,10 @@ function _temp$2S(m) {
33274
33274
  const POPOVER_FALLBACK_PLACEMENTS$6 = ["top", "bottom"];
33275
33275
  function CombinedAnnotationPopover(props2) {
33276
33276
  const $ = c(37), {
33277
- floatingBoundary,
33278
33277
  referenceBoundary
33279
33278
  } = props2, {
33279
+ element: floatingBoundary
33280
+ } = useBoundaryElement(), {
33280
33281
  annotations
33281
33282
  } = useSelectedAnnotations(), [cursorRect, setCursorRect] = useState(null), [popoverOpen, setPopoverOpen] = useState(!1), rangeRef = useRef(null), {
33282
33283
  sanity
@@ -33943,7 +33944,7 @@ function _temp$2Q(m) {
33943
33944
  return m.kind === "annotation" && m.member.open;
33944
33945
  }
33945
33946
  function Compositor(props2) {
33946
- const $ = c(167), {
33947
+ const $ = c(169), {
33947
33948
  changed,
33948
33949
  elementRef,
33949
33950
  focused,
@@ -33990,7 +33991,7 @@ function Compositor(props2) {
33990
33991
  schemaTypes
33991
33992
  }), $[0] = onPaste, $[1] = schemaTypes, $[2] = t210) : t210 = $[2], t1 = t210;
33992
33993
  }
33993
- const wrappedOnPaste = t1, boundaryElement = useBoundaryElement().element, [wrapperElement, setWrapperElement] = useState(null), [scrollElement, setScrollElement] = useState(null);
33994
+ const wrappedOnPaste = t1, boundaryElement = useBoundaryElement().element, [wrapperElement, setWrapperElement] = useState(null), [scrollElement, setScrollElement] = useState(null), floatingBoundary = isFullscreen ? scrollElement : boundaryElement;
33994
33995
  let t2;
33995
33996
  $[3] !== onToggleFullscreen ? (t2 = () => {
33996
33997
  onToggleFullscreen();
@@ -34008,7 +34009,7 @@ function Compositor(props2) {
34008
34009
  }, $[8] = hotkeys, $[9] = t4, $[10] = t5) : t5 = $[10];
34009
34010
  const editorHotkeys = useHotkeys(t5), _renderBlockActions = value && renderBlockActions ? renderBlockActions : void 0, _renderCustomMarkers = value && renderCustomMarkers ? renderCustomMarkers : void 0, [portalElement, setPortalElement] = useState(null);
34010
34011
  let t6;
34011
- $[11] !== _renderBlockActions || $[12] !== _renderCustomMarkers || $[13] !== boundaryElement || $[14] !== isFullscreen || $[15] !== onItemClose || $[16] !== onItemOpen || $[17] !== onItemRemove || $[18] !== onPathFocus || $[19] !== path || $[20] !== readOnly || $[21] !== renderAnnotation || $[22] !== renderBlock2 || $[23] !== renderField || $[24] !== renderInlineBlock || $[25] !== renderInput || $[26] !== renderItem2 || $[27] !== renderPreview || $[28] !== schemaTypes.block || $[29] !== scrollElement || $[30] !== setElementRef ? (t6 = (blockProps) => {
34012
+ $[11] !== _renderBlockActions || $[12] !== _renderCustomMarkers || $[13] !== floatingBoundary || $[14] !== isFullscreen || $[15] !== onItemClose || $[16] !== onItemOpen || $[17] !== onItemRemove || $[18] !== onPathFocus || $[19] !== path || $[20] !== readOnly || $[21] !== renderAnnotation || $[22] !== renderBlock2 || $[23] !== renderField || $[24] !== renderInlineBlock || $[25] !== renderInput || $[26] !== renderItem2 || $[27] !== renderPreview || $[28] !== schemaTypes.block || $[29] !== scrollElement || $[30] !== setElementRef ? (t6 = (blockProps) => {
34012
34013
  const {
34013
34014
  children,
34014
34015
  focused: blockFocused,
@@ -34016,11 +34017,11 @@ function Compositor(props2) {
34016
34017
  selected,
34017
34018
  value: block
34018
34019
  } = blockProps, fullyQualifiedPath = path.concat(blockPath);
34019
- return /* @__PURE__ */ jsx(TextBlock, { floatingBoundary: boundaryElement, focused: blockFocused, isFullscreen, onItemClose, onItemOpen, onItemRemove, onPathFocus, path: path.concat(blockPath), readOnly, referenceBoundary: scrollElement, renderAnnotation, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderBlockActions: _renderBlockActions, renderCustomMarkers: _renderCustomMarkers, renderPreview, renderBlock: renderBlock2, schemaType: schemaTypes.block, selected, setElementRef, value: block, anchorIdent: pathToAnchorIdent("input", fullyQualifiedPath), children });
34020
- }, $[11] = _renderBlockActions, $[12] = _renderCustomMarkers, $[13] = boundaryElement, $[14] = isFullscreen, $[15] = onItemClose, $[16] = onItemOpen, $[17] = onItemRemove, $[18] = onPathFocus, $[19] = path, $[20] = readOnly, $[21] = renderAnnotation, $[22] = renderBlock2, $[23] = renderField, $[24] = renderInlineBlock, $[25] = renderInput, $[26] = renderItem2, $[27] = renderPreview, $[28] = schemaTypes.block, $[29] = scrollElement, $[30] = setElementRef, $[31] = t6) : t6 = $[31];
34020
+ return /* @__PURE__ */ jsx(TextBlock, { floatingBoundary, focused: blockFocused, isFullscreen, onItemClose, onItemOpen, onItemRemove, onPathFocus, path: path.concat(blockPath), readOnly, referenceBoundary: scrollElement, renderAnnotation, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderBlockActions: _renderBlockActions, renderCustomMarkers: _renderCustomMarkers, renderPreview, renderBlock: renderBlock2, schemaType: schemaTypes.block, selected, setElementRef, value: block, anchorIdent: pathToAnchorIdent("input", fullyQualifiedPath), children });
34021
+ }, $[11] = _renderBlockActions, $[12] = _renderCustomMarkers, $[13] = floatingBoundary, $[14] = isFullscreen, $[15] = onItemClose, $[16] = onItemOpen, $[17] = onItemRemove, $[18] = onPathFocus, $[19] = path, $[20] = readOnly, $[21] = renderAnnotation, $[22] = renderBlock2, $[23] = renderField, $[24] = renderInlineBlock, $[25] = renderInput, $[26] = renderItem2, $[27] = renderPreview, $[28] = schemaTypes.block, $[29] = scrollElement, $[30] = setElementRef, $[31] = t6) : t6 = $[31];
34021
34022
  const renderTextBlock = t6;
34022
34023
  let t7;
34023
- $[32] !== _renderBlockActions || $[33] !== _renderCustomMarkers || $[34] !== boundaryElement || $[35] !== isFullscreen || $[36] !== onItemClose || $[37] !== onItemOpen || $[38] !== onItemRemove || $[39] !== onPathFocus || $[40] !== path || $[41] !== readOnly || $[42] !== renderAnnotation || $[43] !== renderBlock2 || $[44] !== renderField || $[45] !== renderInlineBlock || $[46] !== renderInput || $[47] !== renderItem2 || $[48] !== renderPreview || $[49] !== schemaTypes.blockObjects || $[50] !== scrollElement || $[51] !== setElementRef ? (t7 = (blockProps_0) => {
34024
+ $[32] !== _renderBlockActions || $[33] !== _renderCustomMarkers || $[34] !== floatingBoundary || $[35] !== isFullscreen || $[36] !== onItemClose || $[37] !== onItemOpen || $[38] !== onItemRemove || $[39] !== onPathFocus || $[40] !== path || $[41] !== readOnly || $[42] !== renderAnnotation || $[43] !== renderBlock2 || $[44] !== renderField || $[45] !== renderInlineBlock || $[46] !== renderInput || $[47] !== renderItem2 || $[48] !== renderPreview || $[49] !== schemaTypes.blockObjects || $[50] !== scrollElement || $[51] !== setElementRef ? (t7 = (blockProps_0) => {
34024
34025
  const {
34025
34026
  focused: blockFocused_0,
34026
34027
  path: blockPath_0,
@@ -34030,8 +34031,8 @@ function Compositor(props2) {
34030
34031
  } = blockProps_0, sanitySchemaType = schemaTypes.blockObjects.find((type) => type.name === blockSchemaType.name);
34031
34032
  if (!sanitySchemaType)
34032
34033
  throw new Error(`Could not find Sanity schema type for block object: ${blockSchemaType.name}`);
34033
- return /* @__PURE__ */ jsx(BlockObject, { floatingBoundary: boundaryElement, focused: blockFocused_0, isFullscreen, onItemClose, onItemOpen, onItemRemove, onPathFocus, path: path.concat(blockPath_0), readOnly, referenceBoundary: scrollElement, relativePath: blockPath_0, renderAnnotation, renderBlock: renderBlock2, renderBlockActions: _renderBlockActions, renderCustomMarkers: _renderCustomMarkers, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderPreview, schemaType: sanitySchemaType, selected: blockSelected, setElementRef, value: blockValue });
34034
- }, $[32] = _renderBlockActions, $[33] = _renderCustomMarkers, $[34] = boundaryElement, $[35] = isFullscreen, $[36] = onItemClose, $[37] = onItemOpen, $[38] = onItemRemove, $[39] = onPathFocus, $[40] = path, $[41] = readOnly, $[42] = renderAnnotation, $[43] = renderBlock2, $[44] = renderField, $[45] = renderInlineBlock, $[46] = renderInput, $[47] = renderItem2, $[48] = renderPreview, $[49] = schemaTypes.blockObjects, $[50] = scrollElement, $[51] = setElementRef, $[52] = t7) : t7 = $[52];
34034
+ return /* @__PURE__ */ jsx(BlockObject, { floatingBoundary, focused: blockFocused_0, isFullscreen, onItemClose, onItemOpen, onItemRemove, onPathFocus, path: path.concat(blockPath_0), readOnly, referenceBoundary: scrollElement, relativePath: blockPath_0, renderAnnotation, renderBlock: renderBlock2, renderBlockActions: _renderBlockActions, renderCustomMarkers: _renderCustomMarkers, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderPreview, schemaType: sanitySchemaType, selected: blockSelected, setElementRef, value: blockValue });
34035
+ }, $[32] = _renderBlockActions, $[33] = _renderCustomMarkers, $[34] = floatingBoundary, $[35] = isFullscreen, $[36] = onItemClose, $[37] = onItemOpen, $[38] = onItemRemove, $[39] = onPathFocus, $[40] = path, $[41] = readOnly, $[42] = renderAnnotation, $[43] = renderBlock2, $[44] = renderField, $[45] = renderInlineBlock, $[46] = renderInput, $[47] = renderItem2, $[48] = renderPreview, $[49] = schemaTypes.blockObjects, $[50] = scrollElement, $[51] = setElementRef, $[52] = t7) : t7 = $[52];
34035
34036
  const renderObjectBlock = t7;
34036
34037
  let t8;
34037
34038
  $[53] !== renderObjectBlock || $[54] !== renderTextBlock || $[55] !== schemaTypes.block.name ? (t8 = (blockProps_1) => {
@@ -34042,7 +34043,7 @@ function Compositor(props2) {
34042
34043
  }, $[53] = renderObjectBlock, $[54] = renderTextBlock, $[55] = schemaTypes.block.name, $[56] = t8) : t8 = $[56];
34043
34044
  const editorRenderBlock = t8;
34044
34045
  let t9;
34045
- $[57] !== boundaryElement || $[58] !== onItemClose || $[59] !== onItemOpen || $[60] !== onPathFocus || $[61] !== path || $[62] !== readOnly || $[63] !== renderAnnotation || $[64] !== renderBlock2 || $[65] !== renderCustomMarkers || $[66] !== renderField || $[67] !== renderInlineBlock || $[68] !== renderInput || $[69] !== renderItem2 || $[70] !== renderPreview || $[71] !== schemaTypes.inlineObjects || $[72] !== schemaTypes.span.name || $[73] !== scrollElement || $[74] !== setElementRef ? (t9 = (childProps) => {
34046
+ $[57] !== floatingBoundary || $[58] !== onItemClose || $[59] !== onItemOpen || $[60] !== onPathFocus || $[61] !== path || $[62] !== readOnly || $[63] !== renderAnnotation || $[64] !== renderBlock2 || $[65] !== renderCustomMarkers || $[66] !== renderField || $[67] !== renderInlineBlock || $[68] !== renderInput || $[69] !== renderItem2 || $[70] !== renderPreview || $[71] !== schemaTypes.inlineObjects || $[72] !== schemaTypes.span.name || $[73] !== scrollElement || $[74] !== setElementRef ? (t9 = (childProps) => {
34046
34047
  const {
34047
34048
  children: children_0,
34048
34049
  focused: childFocused,
@@ -34056,11 +34057,11 @@ function Compositor(props2) {
34056
34057
  const sanitySchemaType_0 = schemaTypes.inlineObjects.find((type_0) => type_0.name === childSchemaType.name);
34057
34058
  if (!sanitySchemaType_0)
34058
34059
  throw new Error(`Could not find Sanity schema type for inline object: ${childSchemaType.name}`);
34059
- return /* @__PURE__ */ jsx(InlineObject, { floatingBoundary: boundaryElement, focused: childFocused, onItemClose, onItemOpen, onPathFocus, path: path.concat(childPath), readOnly, referenceBoundary: scrollElement, relativePath: childPath, renderAnnotation, renderBlock: renderBlock2, renderCustomMarkers, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderPreview, schemaType: sanitySchemaType_0, selected: selected_0, setElementRef, value: child });
34060
- }, $[57] = boundaryElement, $[58] = onItemClose, $[59] = onItemOpen, $[60] = onPathFocus, $[61] = path, $[62] = readOnly, $[63] = renderAnnotation, $[64] = renderBlock2, $[65] = renderCustomMarkers, $[66] = renderField, $[67] = renderInlineBlock, $[68] = renderInput, $[69] = renderItem2, $[70] = renderPreview, $[71] = schemaTypes.inlineObjects, $[72] = schemaTypes.span.name, $[73] = scrollElement, $[74] = setElementRef, $[75] = t9) : t9 = $[75];
34060
+ return /* @__PURE__ */ jsx(InlineObject, { floatingBoundary, focused: childFocused, onItemClose, onItemOpen, onPathFocus, path: path.concat(childPath), readOnly, referenceBoundary: scrollElement, relativePath: childPath, renderAnnotation, renderBlock: renderBlock2, renderCustomMarkers, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderPreview, schemaType: sanitySchemaType_0, selected: selected_0, setElementRef, value: child });
34061
+ }, $[57] = floatingBoundary, $[58] = onItemClose, $[59] = onItemOpen, $[60] = onPathFocus, $[61] = path, $[62] = readOnly, $[63] = renderAnnotation, $[64] = renderBlock2, $[65] = renderCustomMarkers, $[66] = renderField, $[67] = renderInlineBlock, $[68] = renderInput, $[69] = renderItem2, $[70] = renderPreview, $[71] = schemaTypes.inlineObjects, $[72] = schemaTypes.span.name, $[73] = scrollElement, $[74] = setElementRef, $[75] = t9) : t9 = $[75];
34061
34062
  const editorRenderChild = t9;
34062
34063
  let t10;
34063
- $[76] !== boundaryElement || $[77] !== focused || $[78] !== onItemClose || $[79] !== onItemOpen || $[80] !== onPathFocus || $[81] !== path || $[82] !== readOnly || $[83] !== renderAnnotation || $[84] !== renderBlock2 || $[85] !== renderCustomMarkers || $[86] !== renderField || $[87] !== renderInlineBlock || $[88] !== renderInput || $[89] !== renderItem2 || $[90] !== renderPreview || $[91] !== schemaTypes.annotations || $[92] !== scrollElement || $[93] !== setElementRef ? (t10 = (annotationProps) => {
34064
+ $[76] !== floatingBoundary || $[77] !== focused || $[78] !== onItemClose || $[79] !== onItemOpen || $[80] !== onPathFocus || $[81] !== path || $[82] !== readOnly || $[83] !== renderAnnotation || $[84] !== renderBlock2 || $[85] !== renderCustomMarkers || $[86] !== renderField || $[87] !== renderInlineBlock || $[88] !== renderInput || $[89] !== renderItem2 || $[90] !== renderPreview || $[91] !== schemaTypes.annotations || $[92] !== scrollElement || $[93] !== setElementRef ? (t10 = (annotationProps) => {
34064
34065
  const {
34065
34066
  children: children_1,
34066
34067
  focused: editorNodeFocused,
@@ -34071,8 +34072,8 @@ function Compositor(props2) {
34071
34072
  } = annotationProps, sanitySchemaType_1 = schemaTypes.annotations.find((type_1) => type_1.name === aSchemaType.name);
34072
34073
  if (!sanitySchemaType_1)
34073
34074
  throw new Error(`Could not find Sanity schema type for annotation: ${aSchemaType.name}`);
34074
- return /* @__PURE__ */ jsx(Annotation, { editorNodeFocused, floatingBoundary: boundaryElement, focused: !!focused, onItemClose, onItemOpen, onPathFocus, path: path.concat(aPath), readOnly, referenceBoundary: scrollElement, renderAnnotation, renderBlock: renderBlock2, renderCustomMarkers, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderPreview, schemaType: sanitySchemaType_1, selected: selected_1, setElementRef, value: aValue, children: children_1 });
34075
- }, $[76] = boundaryElement, $[77] = focused, $[78] = onItemClose, $[79] = onItemOpen, $[80] = onPathFocus, $[81] = path, $[82] = readOnly, $[83] = renderAnnotation, $[84] = renderBlock2, $[85] = renderCustomMarkers, $[86] = renderField, $[87] = renderInlineBlock, $[88] = renderInput, $[89] = renderItem2, $[90] = renderPreview, $[91] = schemaTypes.annotations, $[92] = scrollElement, $[93] = setElementRef, $[94] = t10) : t10 = $[94];
34075
+ return /* @__PURE__ */ jsx(Annotation, { editorNodeFocused, floatingBoundary, focused: !!focused, onItemClose, onItemOpen, onPathFocus, path: path.concat(aPath), readOnly, referenceBoundary: scrollElement, renderAnnotation, renderBlock: renderBlock2, renderCustomMarkers, renderField, renderInlineBlock, renderInput, renderItem: renderItem2, renderPreview, schemaType: sanitySchemaType_1, selected: selected_1, setElementRef, value: aValue, children: children_1 });
34076
+ }, $[76] = floatingBoundary, $[77] = focused, $[78] = onItemClose, $[79] = onItemOpen, $[80] = onPathFocus, $[81] = path, $[82] = readOnly, $[83] = renderAnnotation, $[84] = renderBlock2, $[85] = renderCustomMarkers, $[86] = renderField, $[87] = renderInlineBlock, $[88] = renderInput, $[89] = renderItem2, $[90] = renderPreview, $[91] = schemaTypes.annotations, $[92] = scrollElement, $[93] = setElementRef, $[94] = t10) : t10 = $[94];
34076
34077
  const editorRenderAnnotation = t10, ariaDescribedBy = elementProps["aria-describedby"];
34077
34078
  let t11;
34078
34079
  $[95] !== focusPath || $[96] !== hasFocusWithin ? (t11 = () => {
@@ -34114,26 +34115,28 @@ function Compositor(props2) {
34114
34115
  let t24;
34115
34116
  $[136] !== focused || $[137] !== onItemClose || $[138] !== scrollElement ? (t24 = /* @__PURE__ */ jsx(AnnotationObjectEditModal, { focused, onItemClose, referenceBoundary: scrollElement }), $[136] = focused, $[137] = onItemClose, $[138] = scrollElement, $[139] = t24) : t24 = $[139];
34116
34117
  let t25;
34117
- $[140] !== boundaryElement || $[141] !== scrollElement ? (t25 = /* @__PURE__ */ jsx(CombinedAnnotationPopover, { floatingBoundary: boundaryElement, referenceBoundary: scrollElement }), $[140] = boundaryElement, $[141] = scrollElement, $[142] = t25) : t25 = $[142];
34118
+ $[140] !== scrollElement ? (t25 = /* @__PURE__ */ jsx(CombinedAnnotationPopover, { referenceBoundary: scrollElement }), $[140] = scrollElement, $[141] = t25) : t25 = $[141];
34118
34119
  let t26;
34119
- $[143] !== t22 || $[144] !== t23 || $[145] !== t24 || $[146] !== t25 ? (t26 = /* @__PURE__ */ jsx(Box, { "data-wrapper": "", ref: setWrapperElement, children: /* @__PURE__ */ jsxs(Portal, { __unstable_name: t22, children: [
34120
+ $[142] !== t22 || $[143] !== t23 || $[144] !== t24 || $[145] !== t25 ? (t26 = /* @__PURE__ */ jsx(Box, { "data-wrapper": "", ref: setWrapperElement, children: /* @__PURE__ */ jsxs(Portal, { __unstable_name: t22, children: [
34120
34121
  t23,
34121
34122
  t24,
34122
34123
  t25
34123
- ] }) }), $[143] = t22, $[144] = t23, $[145] = t24, $[146] = t25, $[147] = t26) : t26 = $[147];
34124
+ ] }) }), $[142] = t22, $[143] = t23, $[144] = t24, $[145] = t25, $[146] = t26) : t26 = $[146];
34124
34125
  let t27;
34125
- $[148] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t27 = /* @__PURE__ */ jsx("div", { "data-border": "" }), $[148] = t27) : t27 = $[148];
34126
+ $[147] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t27 = /* @__PURE__ */ jsx("div", { "data-border": "" }), $[147] = t27) : t27 = $[147];
34126
34127
  let t28;
34127
- $[149] !== t20 || $[150] !== t21 || $[151] !== t26 ? (t28 = /* @__PURE__ */ jsxs(Root$m, { "data-focused": t20, "data-read-only": t21, children: [
34128
+ $[148] !== t20 || $[149] !== t21 || $[150] !== t26 ? (t28 = /* @__PURE__ */ jsxs(Root$m, { "data-focused": t20, "data-read-only": t21, children: [
34128
34129
  t26,
34129
34130
  t27
34130
- ] }), $[149] = t20, $[150] = t21, $[151] = t26, $[152] = t28) : t28 = $[152];
34131
+ ] }), $[148] = t20, $[149] = t21, $[150] = t26, $[151] = t28) : t28 = $[151];
34131
34132
  let t29;
34132
- $[153] !== changed || $[154] !== isFullscreen || $[155] !== path || $[156] !== t19 || $[157] !== t28 ? (t29 = /* @__PURE__ */ jsx(ChangeIndicator, { disabled: isFullscreen, hasFocus: t19, isChanged: changed, path, children: t28 }), $[153] = changed, $[154] = isFullscreen, $[155] = path, $[156] = t19, $[157] = t28, $[158] = t29) : t29 = $[158];
34133
+ $[152] !== changed || $[153] !== isFullscreen || $[154] !== path || $[155] !== t19 || $[156] !== t28 ? (t29 = /* @__PURE__ */ jsx(ChangeIndicator, { disabled: isFullscreen, hasFocus: t19, isChanged: changed, path, children: t28 }), $[152] = changed, $[153] = isFullscreen, $[154] = path, $[155] = t19, $[156] = t28, $[157] = t29) : t29 = $[157];
34133
34134
  let t30;
34134
- $[159] !== onActivate || $[160] !== t18 || $[161] !== t29 ? (t30 = /* @__PURE__ */ jsx(ActivateOnFocus, { onActivate, isOverlayActive: t18, children: t29 }), $[159] = onActivate, $[160] = t18, $[161] = t29, $[162] = t30) : t30 = $[162];
34135
+ $[158] !== onActivate || $[159] !== t18 || $[160] !== t29 ? (t30 = /* @__PURE__ */ jsx(ActivateOnFocus, { onActivate, isOverlayActive: t18, children: t29 }), $[158] = onActivate, $[159] = t18, $[160] = t29, $[161] = t30) : t30 = $[161];
34135
34136
  let t31;
34136
- return $[163] !== portal.element || $[164] !== portalElements || $[165] !== t30 ? (t31 = /* @__PURE__ */ jsx(SelectedAnnotationsProvider, { children: /* @__PURE__ */ jsx(PortalProvider, { __unstable_elements: portalElements, element: t17, children: t30 }) }), $[163] = portal.element, $[164] = portalElements, $[165] = t30, $[166] = t31) : t31 = $[166], t31;
34137
+ $[162] !== floatingBoundary || $[163] !== t30 ? (t31 = /* @__PURE__ */ jsx(BoundaryElementProvider, { element: floatingBoundary, children: t30 }), $[162] = floatingBoundary, $[163] = t30, $[164] = t31) : t31 = $[164];
34138
+ let t32;
34139
+ return $[165] !== portal.element || $[166] !== portalElements || $[167] !== t31 ? (t32 = /* @__PURE__ */ jsx(SelectedAnnotationsProvider, { children: /* @__PURE__ */ jsx(PortalProvider, { __unstable_elements: portalElements, element: t17, children: t31 }) }), $[165] = portal.element, $[166] = portalElements, $[167] = t31, $[168] = t32) : t32 = $[168], t32;
34137
34140
  }
34138
34141
  function FullscreenPTEProvider(t0) {
34139
34142
  const $ = c(17), {
@@ -45395,6 +45398,75 @@ function Preview$1(props2) {
45395
45398
  let t0;
45396
45399
  return $[0] !== PreviewComponent || $[1] !== props2 ? (t0 = /* @__PURE__ */ jsx(PreviewLoader, { ...props2, component: PreviewComponent }), $[0] = PreviewComponent, $[1] = props2, $[2] = t0) : t0 = $[2], t0;
45397
45400
  }
45401
+ const PREVIEW_SIZES = {
45402
+ block: {
45403
+ icon: 25,
45404
+ media: {
45405
+ width: 33,
45406
+ height: 33
45407
+ }
45408
+ },
45409
+ blockImage: {
45410
+ icon: 25,
45411
+ media: {
45412
+ width: 600,
45413
+ height: 400
45414
+ }
45415
+ },
45416
+ compact: {
45417
+ icon: 21,
45418
+ media: {
45419
+ width: 25,
45420
+ height: 25
45421
+ }
45422
+ },
45423
+ default: {
45424
+ icon: 21,
45425
+ media: {
45426
+ width: 33,
45427
+ height: 33
45428
+ }
45429
+ },
45430
+ detail: {
45431
+ icon: 25,
45432
+ media: {
45433
+ width: 73,
45434
+ height: 73
45435
+ }
45436
+ },
45437
+ inline: {
45438
+ icon: 15,
45439
+ media: {
45440
+ width: 15,
45441
+ height: 15
45442
+ }
45443
+ },
45444
+ media: {
45445
+ icon: 25,
45446
+ media: {
45447
+ width: 160,
45448
+ height: 160
45449
+ }
45450
+ }
45451
+ };
45452
+ function renderPreviewMedia(value, layout, dimensions) {
45453
+ return isValidElementType(value) ? /* @__PURE__ */ jsx(value, { layout, dimensions }) : typeof value == "string" ? /* @__PURE__ */ jsx("div", { children: value }) : isValidElement(value) || value === null || typeof value == "number" || typeof value == "boolean" ? value : null;
45454
+ }
45455
+ function renderPreviewNode(value, layout, fallbackNode) {
45456
+ return typeof value == "string" ? value : isValidElementType(value) ? /* @__PURE__ */ jsx(value, { layout }) : value || fallbackNode;
45457
+ }
45458
+ function resolveBlockImageDimensions(source) {
45459
+ const sourceDimensions = tryGetImageDimensions(source);
45460
+ if (typeof sourceDimensions > "u")
45461
+ return;
45462
+ const max2 = PREVIEW_SIZES.blockImage.media, scale = Math.min(max2.width / sourceDimensions.width, 1);
45463
+ return {
45464
+ width: Math.round(sourceDimensions.width * scale),
45465
+ height: Math.round(sourceDimensions.height * scale),
45466
+ fit: "max",
45467
+ dpr: getDevicePixelRatio()
45468
+ };
45469
+ }
45398
45470
  const _previewComponents = {
45399
45471
  block: BlockPreview,
45400
45472
  blockImage: BlockImagePreview,
@@ -45472,7 +45544,7 @@ function SanityDefaultMedia(t0) {
45472
45544
  return $[14] !== t5 || $[15] !== url ? (t6 = /* @__PURE__ */ jsx("img", { alt: t5, onError: handleError, referrerPolicy: "strict-origin-when-cross-origin", src: url }), $[14] = t5, $[15] = url, $[16] = t6) : t6 = $[16], t6;
45473
45545
  }
45474
45546
  const SanityDefaultPreview = memo(function(props2) {
45475
- const $ = c(34);
45547
+ const $ = c(37);
45476
45548
  let Icon2, imageUrl, layout, mediaProp, restProps, title, tooltip;
45477
45549
  $[0] !== props2 ? ({
45478
45550
  icon: Icon2,
@@ -45532,25 +45604,44 @@ const SanityDefaultPreview = memo(function(props2) {
45532
45604
  }
45533
45605
  t3 = renderIcon;
45534
45606
  }
45535
- const t4 = t3;
45607
+ const media = t3;
45608
+ let t4;
45609
+ bb1: {
45610
+ if (props2.mediaDimensions) {
45611
+ t4 = props2.mediaDimensions;
45612
+ break bb1;
45613
+ }
45614
+ if (layout !== "blockImage") {
45615
+ t4 = void 0;
45616
+ break bb1;
45617
+ }
45618
+ if (!isImageSource(mediaProp)) {
45619
+ t4 = void 0;
45620
+ break bb1;
45621
+ }
45622
+ let t52;
45623
+ $[20] !== mediaProp ? (t52 = resolveBlockImageDimensions(mediaProp), $[20] = mediaProp, $[21] = t52) : t52 = $[21], t4 = t52;
45624
+ }
45625
+ const resolvedMediaDimensions = t4;
45536
45626
  let t5;
45537
- $[20] !== restProps || $[21] !== t4 || $[22] !== title ? (t5 = {
45627
+ $[22] !== media || $[23] !== resolvedMediaDimensions || $[24] !== restProps || $[25] !== title ? (t5 = {
45538
45628
  ...restProps,
45539
- media: t4,
45629
+ media,
45630
+ mediaDimensions: resolvedMediaDimensions,
45540
45631
  title
45541
- }, $[20] = restProps, $[21] = t4, $[22] = title, $[23] = t5) : t5 = $[23];
45632
+ }, $[22] = media, $[23] = resolvedMediaDimensions, $[24] = restProps, $[25] = title, $[26] = t5) : t5 = $[26];
45542
45633
  const previewProps = t5, LayoutComponent = _previewComponents[layout || "default"];
45543
45634
  let t6;
45544
- $[24] !== LayoutComponent || $[25] !== previewProps ? (t6 = /* @__PURE__ */ jsx(LayoutComponent, { ...previewProps }), $[24] = LayoutComponent, $[25] = previewProps, $[26] = t6) : t6 = $[26];
45635
+ $[27] !== LayoutComponent || $[28] !== previewProps ? (t6 = /* @__PURE__ */ jsx(LayoutComponent, { ...previewProps }), $[27] = LayoutComponent, $[28] = previewProps, $[29] = t6) : t6 = $[29];
45545
45636
  const children = t6;
45546
45637
  if (tooltip) {
45547
45638
  const t7 = !tooltip;
45548
45639
  let t8;
45549
- $[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t8 = ["top-end", "bottom-end"], $[27] = t8) : t8 = $[27];
45640
+ $[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t8 = ["top-end", "bottom-end"], $[30] = t8) : t8 = $[30];
45550
45641
  let t9;
45551
- $[28] !== children ? (t9 = /* @__PURE__ */ jsx("div", { children }), $[28] = children, $[29] = t9) : t9 = $[29];
45642
+ $[31] !== children ? (t9 = /* @__PURE__ */ jsx("div", { children }), $[31] = children, $[32] = t9) : t9 = $[32];
45552
45643
  let t10;
45553
- return $[30] !== t7 || $[31] !== t9 || $[32] !== tooltip ? (t10 = /* @__PURE__ */ jsx(Tooltip, { content: tooltip, disabled: t7, fallbackPlacements: t8, placement: "right", children: t9 }), $[30] = t7, $[31] = t9, $[32] = tooltip, $[33] = t10) : t10 = $[33], t10;
45644
+ return $[33] !== t7 || $[34] !== t9 || $[35] !== tooltip ? (t10 = /* @__PURE__ */ jsx(Tooltip, { content: tooltip, disabled: t7, fallbackPlacements: t8, placement: "right", children: t9 }), $[33] = t7, $[34] = t9, $[35] = tooltip, $[36] = t10) : t10 = $[36], t10;
45554
45645
  }
45555
45646
  return children;
45556
45647
  });
@@ -57265,56 +57356,6 @@ const ReleaseDocumentsCounter = (t0) => {
57265
57356
  } = t0, t1 = documentCount || "-";
57266
57357
  let t2;
57267
57358
  return $[0] !== t1 ? (t2 = /* @__PURE__ */ jsx(Text$1, { muted: !0, size: 1, children: t1 }), $[0] = t1, $[1] = t2) : t2 = $[1], t2;
57268
- }, PREVIEW_SIZES = {
57269
- block: {
57270
- icon: 25,
57271
- media: {
57272
- width: 33,
57273
- height: 33
57274
- }
57275
- },
57276
- blockImage: {
57277
- icon: 25,
57278
- media: {
57279
- width: 600,
57280
- height: 400
57281
- }
57282
- },
57283
- compact: {
57284
- icon: 21,
57285
- media: {
57286
- width: 25,
57287
- height: 25
57288
- }
57289
- },
57290
- default: {
57291
- icon: 21,
57292
- media: {
57293
- width: 33,
57294
- height: 33
57295
- }
57296
- },
57297
- detail: {
57298
- icon: 25,
57299
- media: {
57300
- width: 73,
57301
- height: 73
57302
- }
57303
- },
57304
- inline: {
57305
- icon: 15,
57306
- media: {
57307
- width: 15,
57308
- height: 15
57309
- }
57310
- },
57311
- media: {
57312
- icon: 25,
57313
- media: {
57314
- width: 160,
57315
- height: 160
57316
- }
57317
- }
57318
57359
  }, RootFlex$2 = styled(Flex).attrs({
57319
57360
  align: "center"
57320
57361
  }).withConfig({
@@ -93638,12 +93679,6 @@ function renderMedia(props2) {
93638
93679
  } = props2;
93639
93680
  return typeof media == "string" ? /* @__PURE__ */ jsx(Text$1, { as: "span", className: styles?.mediaString, size: 1, children: media }) : isValidElementType(media) ? /* @__PURE__ */ jsx(media, { dimensions, layout }) : isValidElement(media) ? media : null;
93640
93681
  }
93641
- function renderPreviewMedia(value, layout, dimensions) {
93642
- return isValidElementType(value) ? /* @__PURE__ */ jsx(value, { layout, dimensions }) : typeof value == "string" ? /* @__PURE__ */ jsx("div", { children: value }) : value;
93643
- }
93644
- function renderPreviewNode(value, layout, fallbackNode) {
93645
- return typeof value == "string" ? value : isValidElementType(value) ? /* @__PURE__ */ jsx(value, { layout }) : value || fallbackNode;
93646
- }
93647
93682
  const DEFAULT_MEDIA_DIMENSIONS$6 = {
93648
93683
  ...PREVIEW_SIZES.compact.media,
93649
93684
  aspect: 1,