sanity 5.4.0-next.8 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks-es/package.js +1 -1
- package/lib/_chunks-es/version.js +1 -1
- package/lib/index.js +18 -8
- package/lib/index.js.map +1 -1
- package/package.json +16 -16
|
@@ -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.4.0
|
|
10
|
+
"5.4.0";
|
|
11
11
|
} catch {
|
|
12
12
|
}
|
|
13
13
|
const SANITY_VERSION = buildVersion || `${version}-dev`;
|
package/lib/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import { getVersionId, getDraftId, getPublishedId, isPublishedId, isDraftId, get
|
|
|
37
37
|
import { DRAFTS_FOLDER as DRAFTS_FOLDER2, VERSION_FOLDER, getDraftId as getDraftId2, getPublishedId as getPublishedId2, getVersionFromId as getVersionFromId2, getVersionId as getVersionId2, isDraftId as isDraftId2, isPublishedId as isPublishedId2, isVersionId as isVersionId2 } from "@sanity/client/csm";
|
|
38
38
|
import * as legacyDateFormat from "@sanity/util/legacyDateFormat";
|
|
39
39
|
import { sanitizeLocale, format as format$1, DEFAULT_DATE_FORMAT, parse as parse$2, isValidTimeZoneString, DEFAULT_TIME_FORMAT } from "@sanity/util/legacyDateFormat";
|
|
40
|
-
import { getImageDimensions, isDefaultCrop, isDefaultHotspot, isImageSource, isFileSource, isAssetObjectStub, isImageAssetId, isFileAssetId } from "@sanity/asset-utils";
|
|
40
|
+
import { getImageDimensions, isDefaultCrop, isDefaultHotspot, isImageSource, isSanityImageUrl, parseImageAssetUrl, isFileSource, isAssetObjectStub, isImageAssetId, isFileAssetId } from "@sanity/asset-utils";
|
|
41
41
|
import { createImageUrlBuilder } from "@sanity/image-url";
|
|
42
42
|
import { tz, TZDate } from "@date-fns/tz";
|
|
43
43
|
import { formatRelative, isValid, parse, differenceInMonths, differenceInYears, differenceInWeeks, differenceInDays, differenceInHours, differenceInMinutes, differenceInSeconds, format, isPast, addDays, startOfMonth, eachWeekOfInterval, lastDayOfMonth, getWeek, isSameDay, isSameMonth, setDate, setMonth, addMonths, setYear, setMinutes, setHours, parseISO, getMinutes, startOfHour, addHours, isBefore, startOfMinute, isWeekend, startOfDay, endOfDay, isAfter, set as set$2, startOfToday, endOfMinute, sub, formatDistance, isToday, isThisISOWeek, addWeeks } from "date-fns";
|
|
@@ -24095,7 +24095,13 @@ const SanityDefaultPreview = memo(function(props2) {
|
|
|
24095
24095
|
const imageBuilder = t0;
|
|
24096
24096
|
let t1;
|
|
24097
24097
|
$[10] !== client || $[11] !== imageBuilder || $[12] !== mediaProp || $[13] !== title ? (t1 = (options) => {
|
|
24098
|
-
|
|
24098
|
+
let imageSource = mediaProp;
|
|
24099
|
+
if (isString(imageSource) && isSanityImageUrl(imageSource)) {
|
|
24100
|
+
const {
|
|
24101
|
+
assetId
|
|
24102
|
+
} = parseImageAssetUrl(imageSource);
|
|
24103
|
+
imageSource = assetId;
|
|
24104
|
+
}
|
|
24099
24105
|
return /* @__PURE__ */ jsx(SanityDefaultMedia, { client, dimensions: options.dimensions, imageSource, imageUrlBuilder: imageBuilder, title });
|
|
24100
24106
|
}, $[10] = client, $[11] = imageBuilder, $[12] = mediaProp, $[13] = title, $[14] = t1) : t1 = $[14];
|
|
24101
24107
|
const renderMedia2 = t1;
|
|
@@ -24108,6 +24114,14 @@ const SanityDefaultPreview = memo(function(props2) {
|
|
|
24108
24114
|
t3 = !1;
|
|
24109
24115
|
break bb0;
|
|
24110
24116
|
}
|
|
24117
|
+
if (isString(mediaProp) && isSanityImageUrl(mediaProp)) {
|
|
24118
|
+
t3 = renderMedia2;
|
|
24119
|
+
break bb0;
|
|
24120
|
+
}
|
|
24121
|
+
if (isImageSource(mediaProp)) {
|
|
24122
|
+
t3 = renderMedia2;
|
|
24123
|
+
break bb0;
|
|
24124
|
+
}
|
|
24111
24125
|
if (isValidElementType(mediaProp)) {
|
|
24112
24126
|
t3 = mediaProp;
|
|
24113
24127
|
break bb0;
|
|
@@ -24116,10 +24130,6 @@ const SanityDefaultPreview = memo(function(props2) {
|
|
|
24116
24130
|
t3 = mediaProp;
|
|
24117
24131
|
break bb0;
|
|
24118
24132
|
}
|
|
24119
|
-
if (isImageSource(mediaProp)) {
|
|
24120
|
-
t3 = renderMedia2;
|
|
24121
|
-
break bb0;
|
|
24122
|
-
}
|
|
24123
24133
|
if (isString(imageUrl)) {
|
|
24124
24134
|
const t42 = isString(title) ? title : void 0;
|
|
24125
24135
|
let t52;
|
|
@@ -53942,7 +53952,7 @@ function ConfirmActiveScheduledDraftsBanner(t0) {
|
|
|
53942
53952
|
}, $[2] = t2) : t2 = $[2];
|
|
53943
53953
|
const handleCloseDialog = t2;
|
|
53944
53954
|
let t3;
|
|
53945
|
-
$[3] !== onNavigateToPaused || $[4] !== shouldOpenDialog ? (t3 = () => shouldOpenDialog ? setIsDialogOpen(!0) : onNavigateToPaused, $[3] = onNavigateToPaused, $[4] = shouldOpenDialog, $[5] = t3) : t3 = $[5];
|
|
53955
|
+
$[3] !== onNavigateToPaused || $[4] !== shouldOpenDialog ? (t3 = () => shouldOpenDialog ? setIsDialogOpen(!0) : onNavigateToPaused(), $[3] = onNavigateToPaused, $[4] = shouldOpenDialog, $[5] = t3) : t3 = $[5];
|
|
53946
53956
|
const handleClick = t3;
|
|
53947
53957
|
if (activeScheduledDrafts.length === 0)
|
|
53948
53958
|
return null;
|
|
@@ -88800,7 +88810,7 @@ function renderMedia(props2) {
|
|
|
88800
88810
|
media,
|
|
88801
88811
|
styles
|
|
88802
88812
|
} = props2;
|
|
88803
|
-
return
|
|
88813
|
+
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;
|
|
88804
88814
|
}
|
|
88805
88815
|
function renderPreviewMedia(value, layout, dimensions) {
|
|
88806
88816
|
return isValidElementType(value) ? /* @__PURE__ */ jsx(value, { layout, dimensions }) : typeof value == "string" ? /* @__PURE__ */ jsx("div", { children: value }) : value;
|