sanity 5.22.0-next.23 → 5.22.0-next.26
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/version.js +2 -2
- package/lib/index.js +87 -76
- package/lib/index.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version = "5.22.0-next.
|
|
1
|
+
var version = "5.22.0-next.26+311ac2d615";
|
|
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.22.0-next.
|
|
10
|
+
"5.22.0-next.26+311ac2d615";
|
|
11
11
|
} catch {
|
|
12
12
|
}
|
|
13
13
|
const SANITY_VERSION = buildVersion || `${version}-dev`;
|
package/lib/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import { isValid } from "date-fns/isValid";
|
|
|
22
22
|
import { parse } from "date-fns/parse";
|
|
23
23
|
import QuickLRU from "quick-lru";
|
|
24
24
|
import isEqual$1 from "lodash-es/isEqual.js";
|
|
25
|
+
import { encodeJsonParams, IntentLink, useRouter, RouterContext, useIntentLink, route, useRouterState, useStateLink, Link as Link$1, StateLink, RouteScope, STICKY_PARAMS, RouterProvider } from "sanity/router";
|
|
25
26
|
import { uuid } from "@sanity/uuid";
|
|
26
27
|
import { COLOR_HUES, hues, white, red, gray, yellow, purple, black, green, blue } from "@sanity/color";
|
|
27
28
|
import { darken, lighten, hasBadContrast, readableColor } from "color2k";
|
|
@@ -69,7 +70,6 @@ import * as legacyDateFormat from "@sanity/util/legacyDateFormat";
|
|
|
69
70
|
import { sanitizeLocale, format as format$1, DEFAULT_DATE_FORMAT, parse as parse$2, isValidTimeZoneString, DEFAULT_TIME_FORMAT } from "@sanity/util/legacyDateFormat";
|
|
70
71
|
import { getImageDimensions, isDefaultCrop, isDefaultHotspot, isImageSource, isFileSource, isSanityImageUrl, parseImageAssetUrl, isAssetObjectStub, isImageAssetId, isFileAssetId } from "@sanity/asset-utils";
|
|
71
72
|
import { createImageUrlBuilder } from "@sanity/image-url";
|
|
72
|
-
import { encodeJsonParams, IntentLink, useRouter, RouterContext, useIntentLink, route, useRouterState, useStateLink, Link as Link$1, StateLink, RouteScope, STICKY_PARAMS, RouterProvider } from "sanity/router";
|
|
73
73
|
import { addHours } from "date-fns/addHours";
|
|
74
74
|
import { startOfHour } from "date-fns/startOfHour";
|
|
75
75
|
import { format } from "date-fns/format";
|
|
@@ -4019,12 +4019,13 @@ const usePluginPostMessage = (origin, handleMessage) => {
|
|
|
4019
4019
|
return $[4] !== t0 || $[5] !== t2 ? (t3 = /* @__PURE__ */ jsx(Card, { style: t0, children: t2 }), $[4] = t0, $[5] = t2, $[6] = t3) : t3 = $[6], t3;
|
|
4020
4020
|
});
|
|
4021
4021
|
function OpenInSourceDialog(props2) {
|
|
4022
|
-
const $ = c(
|
|
4022
|
+
const $ = c(36), {
|
|
4023
4023
|
asset,
|
|
4024
4024
|
dialogHeaderTitle,
|
|
4025
4025
|
onClose,
|
|
4026
4026
|
onSelectNewAsset,
|
|
4027
|
-
selectNewAssetButtonLabel
|
|
4027
|
+
selectNewAssetButtonLabel,
|
|
4028
|
+
pickerPersistenceKey
|
|
4028
4029
|
} = props2, theme = useTheme(), {
|
|
4029
4030
|
t
|
|
4030
4031
|
} = useTranslation(), {
|
|
@@ -4033,18 +4034,19 @@ function OpenInSourceDialog(props2) {
|
|
|
4033
4034
|
let t1;
|
|
4034
4035
|
$[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
|
|
4035
4036
|
let t2;
|
|
4036
|
-
$[1] !== authType || $[2] !== t0 ? (t2 = {
|
|
4037
|
+
$[1] !== authType || $[2] !== pickerPersistenceKey || $[3] !== t0 ? (t2 = {
|
|
4037
4038
|
scheme: t0,
|
|
4038
4039
|
auth: authType,
|
|
4039
4040
|
disableNavigation: !0,
|
|
4040
4041
|
selectAssetTypes: t1,
|
|
4041
|
-
selectionType: "single"
|
|
4042
|
-
|
|
4042
|
+
selectionType: "single",
|
|
4043
|
+
pickerPersistenceKey
|
|
4044
|
+
}, $[1] = authType, $[2] = pickerPersistenceKey, $[3] = t0, $[4] = t2) : t2 = $[4];
|
|
4043
4045
|
const params = t2, iframeUrl = usePluginFrameUrl(`/assets/${sourceAssetId}`, params);
|
|
4044
4046
|
let t3;
|
|
4045
|
-
$[
|
|
4047
|
+
$[5] !== onClose ? (t3 = (message) => {
|
|
4046
4048
|
message.type === "pageUnloaded" && onClose();
|
|
4047
|
-
}, $[
|
|
4049
|
+
}, $[5] = onClose, $[6] = t3) : t3 = $[6];
|
|
4048
4050
|
const handlePluginMessage = t3, {
|
|
4049
4051
|
setIframe
|
|
4050
4052
|
} = usePluginPostMessage(appHost, handlePluginMessage);
|
|
@@ -4053,43 +4055,43 @@ function OpenInSourceDialog(props2) {
|
|
|
4053
4055
|
asset
|
|
4054
4056
|
}), null;
|
|
4055
4057
|
let t4;
|
|
4056
|
-
$[
|
|
4058
|
+
$[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = {
|
|
4057
4059
|
position: "relative",
|
|
4058
4060
|
minHeight: "2dvh"
|
|
4059
|
-
}, $[
|
|
4061
|
+
}, $[7] = t4) : t4 = $[7];
|
|
4060
4062
|
let t5;
|
|
4061
|
-
$[
|
|
4063
|
+
$[8] !== onSelectNewAsset || $[9] !== selectNewAssetButtonLabel ? (t5 = /* @__PURE__ */ jsx(Button, { onClick: onSelectNewAsset, text: selectNewAssetButtonLabel, size: "large", tone: "neutral" }), $[8] = onSelectNewAsset, $[9] = selectNewAssetButtonLabel, $[10] = t5) : t5 = $[10];
|
|
4062
4064
|
let t6;
|
|
4063
|
-
$[
|
|
4065
|
+
$[11] !== t ? (t6 = t("asset-source.dialog.button.cancel"), $[11] = t, $[12] = t6) : t6 = $[12];
|
|
4064
4066
|
let t7;
|
|
4065
|
-
$[
|
|
4067
|
+
$[13] !== onClose || $[14] !== t6 ? (t7 = /* @__PURE__ */ jsx(Button, { mode: "bleed", onClick: onClose, text: t6, size: "large" }), $[13] = onClose, $[14] = t6, $[15] = t7) : t7 = $[15];
|
|
4066
4068
|
let t8;
|
|
4067
|
-
$[
|
|
4069
|
+
$[16] !== t ? (t8 = t("asset-sources.media-library.open-in-source-dialog.button.done"), $[16] = t, $[17] = t8) : t8 = $[17];
|
|
4068
4070
|
let t9;
|
|
4069
|
-
$[
|
|
4071
|
+
$[18] !== onClose || $[19] !== t8 ? (t9 = /* @__PURE__ */ jsx(Button, { onClick: onClose, text: t8, size: "large", tone: "primary" }), $[18] = onClose, $[19] = t8, $[20] = t9) : t9 = $[20];
|
|
4070
4072
|
let t10;
|
|
4071
|
-
$[
|
|
4073
|
+
$[21] !== t7 || $[22] !== t9 ? (t10 = /* @__PURE__ */ jsxs(Flex, { gap: 2, align: "center", children: [
|
|
4072
4074
|
t7,
|
|
4073
4075
|
t9
|
|
4074
|
-
] }), $[
|
|
4076
|
+
] }), $[21] = t7, $[22] = t9, $[23] = t10) : t10 = $[23];
|
|
4075
4077
|
let t11;
|
|
4076
|
-
$[
|
|
4078
|
+
$[24] !== t10 || $[25] !== t5 ? (t11 = /* @__PURE__ */ jsx(Card, { width: "full", height: "fill", padding: 3, shadow: 1, style: t4, children: /* @__PURE__ */ jsxs(Flex, { width: "full", gap: 3, align: "center", justify: "space-between", children: [
|
|
4077
4079
|
t5,
|
|
4078
4080
|
t10
|
|
4079
|
-
] }) }), $[
|
|
4081
|
+
] }) }), $[24] = t10, $[25] = t5, $[26] = t11) : t11 = $[26];
|
|
4080
4082
|
let t12;
|
|
4081
|
-
$[
|
|
4083
|
+
$[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t12 = {
|
|
4082
4084
|
position: "absolute",
|
|
4083
4085
|
inset: 0,
|
|
4084
4086
|
borderTop: "1px solid",
|
|
4085
4087
|
borderColor: "var(--card-border-color)",
|
|
4086
4088
|
overflow: "hidden",
|
|
4087
4089
|
display: "flex"
|
|
4088
|
-
}, $[
|
|
4090
|
+
}, $[27] = t12) : t12 = $[27];
|
|
4089
4091
|
let t13;
|
|
4090
|
-
$[
|
|
4092
|
+
$[28] !== iframeUrl || $[29] !== setIframe ? (t13 = /* @__PURE__ */ jsx(Box, { style: t12, children: /* @__PURE__ */ jsx(Iframe, { ref: setIframe, src: iframeUrl }) }), $[28] = iframeUrl, $[29] = setIframe, $[30] = t13) : t13 = $[30];
|
|
4091
4093
|
let t14;
|
|
4092
|
-
return $[
|
|
4094
|
+
return $[31] !== dialogHeaderTitle || $[32] !== onClose || $[33] !== t11 || $[34] !== t13 ? (t14 = /* @__PURE__ */ jsx(AppDialog, { header: dialogHeaderTitle, id: "media-library-plugin-dialog-open-in-source", onClose, onClickOutside: onClose, open: !0, "data-testid": "media-library-plugin-dialog-open-in-source", width: 3, footer: t11, children: t13 }), $[31] = dialogHeaderTitle, $[32] = onClose, $[33] = t11, $[34] = t13, $[35] = t14) : t14 = $[35], t14;
|
|
4093
4095
|
}
|
|
4094
4096
|
const AddedVersion = defineEvent({
|
|
4095
4097
|
name: "Version Document Added to Release ",
|
|
@@ -19045,7 +19047,7 @@ function createSearchQuery$1(searchTerms, searchParams, {
|
|
|
19045
19047
|
cursor ?? []
|
|
19046
19048
|
].flat(), projection = sortOrder.map(({
|
|
19047
19049
|
field
|
|
19048
|
-
}) => field).concat("_type", "_id", "_originalId").join(", "), query = [`*[${filters.join(" && ")}]`, isScored ? ["|", `score(${score.join(", ")})`] : [], ["|", `order(${toOrderClause(sortOrder)})`], isScored ? "[_score > 0]" : [], "[0...$__limit]", `{${projection}}`].flat().join(" "), rawQuery = typeof searchParams == "string" ? searchParams : searchParams.query, finalParams = {
|
|
19050
|
+
}) => field).concat("_type", "_id", "_originalId").map((field) => fieldNeedsEscape(field) ? `"${field}": ${field}` : field).join(", "), query = [`*[${filters.join(" && ")}]`, isScored ? ["|", `score(${score.join(", ")})`] : [], ["|", `order(${toOrderClause(sortOrder)})`], isScored ? "[_score > 0]" : [], "[0...$__limit]", `{${projection}}`].flat().join(" "), rawQuery = typeof searchParams == "string" ? searchParams : searchParams.query, finalParams = {
|
|
19049
19051
|
__types: searchTerms.types.map((type) => isSchemaType(type) ? type.name : type.type),
|
|
19050
19052
|
// Overfetch by 1 to determine whether there is another page to fetch.
|
|
19051
19053
|
__limit: (limit2 ?? DEFAULT_LIMIT$1) + 1,
|
|
@@ -61970,11 +61972,12 @@ function filterMediaValidationMarkers(validationMarkers) {
|
|
|
61970
61972
|
return validationMarkers.filter((marker) => "__internal_metadata" in marker && typeof marker.__internal_metadata == "object" && marker.__internal_metadata !== null && "name" in marker.__internal_metadata && marker.__internal_metadata?.name === "media");
|
|
61971
61973
|
}
|
|
61972
61974
|
function SelectAssetsDialog(props2) {
|
|
61973
|
-
const $ = c(
|
|
61975
|
+
const $ = c(72), theme = useTheme(), {
|
|
61974
61976
|
t
|
|
61975
61977
|
} = useTranslation(), {
|
|
61976
61978
|
dark
|
|
61977
61979
|
} = theme.sanity.color, mediaLibraryIds = useMediaLibraryIds(), mediaLibraryConfig = useSanityMediaLibraryConfig(), appHost = mediaLibraryConfig.__internal.hosts.app, authType = useAuthType(), {
|
|
61980
|
+
pickerPersistenceKey,
|
|
61978
61981
|
dialogHeaderTitle,
|
|
61979
61982
|
onClose,
|
|
61980
61983
|
open,
|
|
@@ -62032,24 +62035,25 @@ function SelectAssetsDialog(props2) {
|
|
|
62032
62035
|
let t9;
|
|
62033
62036
|
$[16] !== selectAssetType ? (t9 = selectAssetType ? [selectAssetType] : [], $[16] = selectAssetType, $[17] = t9) : t9 = $[17];
|
|
62034
62037
|
let t10;
|
|
62035
|
-
$[18] !== authType || $[19] !==
|
|
62038
|
+
$[18] !== authType || $[19] !== pickerPersistenceKey || $[20] !== pluginFilters || $[21] !== selectionType || $[22] !== t8 || $[23] !== t9 ? (t10 = {
|
|
62036
62039
|
auth: authType,
|
|
62037
62040
|
capabilities: t7,
|
|
62038
62041
|
pluginFilters,
|
|
62039
62042
|
scheme: t8,
|
|
62040
62043
|
selectAssetTypes: t9,
|
|
62041
|
-
selectionType
|
|
62042
|
-
|
|
62044
|
+
selectionType,
|
|
62045
|
+
pickerPersistenceKey
|
|
62046
|
+
}, $[18] = authType, $[19] = pickerPersistenceKey, $[20] = pluginFilters, $[21] = selectionType, $[22] = t8, $[23] = t9, $[24] = t10) : t10 = $[24];
|
|
62043
62047
|
const iframeUrl = usePluginFrameUrl("/assets", t10);
|
|
62044
62048
|
let t11;
|
|
62045
|
-
$[
|
|
62049
|
+
$[25] !== schemaType ? (t11 = {
|
|
62046
62050
|
schemaType
|
|
62047
|
-
}, $[
|
|
62051
|
+
}, $[25] = schemaType, $[26] = t11) : t11 = $[26];
|
|
62048
62052
|
const {
|
|
62049
62053
|
onLinkAssets
|
|
62050
62054
|
} = useLinkAssets(t11);
|
|
62051
62055
|
let t12;
|
|
62052
|
-
$[
|
|
62056
|
+
$[27] !== assetSelection || $[28] !== onClose || $[29] !== onLinkAssets || $[30] !== onSelect || $[31] !== t || $[32] !== toast ? (t12 = async () => {
|
|
62053
62057
|
try {
|
|
62054
62058
|
setDidSelect(!0);
|
|
62055
62059
|
const assets = await onLinkAssets([assetSelection[0]]);
|
|
@@ -62063,68 +62067,68 @@ function SelectAssetsDialog(props2) {
|
|
|
62063
62067
|
title: t("asset-source.dialog.insert-asset-error")
|
|
62064
62068
|
}), console.error(error), setDidSelect(!1);
|
|
62065
62069
|
}
|
|
62066
|
-
}, $[
|
|
62070
|
+
}, $[27] = assetSelection, $[28] = onClose, $[29] = onLinkAssets, $[30] = onSelect, $[31] = t, $[32] = toast, $[33] = t12) : t12 = $[33];
|
|
62067
62071
|
const handleSelect = t12;
|
|
62068
62072
|
let t13;
|
|
62069
|
-
$[
|
|
62073
|
+
$[34] !== onClose ? (t13 = () => {
|
|
62070
62074
|
onClose();
|
|
62071
|
-
}, $[
|
|
62075
|
+
}, $[34] = onClose, $[35] = t13) : t13 = $[35];
|
|
62072
62076
|
const handleClose = t13;
|
|
62073
62077
|
let t14;
|
|
62074
|
-
$[
|
|
62078
|
+
$[36] !== validateSelection ? (t14 = async (assetSelectionItems) => {
|
|
62075
62079
|
if (assetSelectionItems.length === 0) {
|
|
62076
62080
|
setValidation([]);
|
|
62077
62081
|
return;
|
|
62078
62082
|
}
|
|
62079
62083
|
const validationResult = await validateSelection(assetSelectionItems[0]);
|
|
62080
62084
|
validationResult.some(_temp3$i) && setValidation(validationResult);
|
|
62081
|
-
}, $[
|
|
62085
|
+
}, $[36] = validateSelection, $[37] = t14) : t14 = $[37];
|
|
62082
62086
|
const handleAssetSelection = t14;
|
|
62083
62087
|
let t15;
|
|
62084
|
-
$[
|
|
62088
|
+
$[38] !== handleAssetSelection ? (t15 = (message) => {
|
|
62085
62089
|
message.type === "assetSelection" && (setAssetSelection(message.selection), handleAssetSelection(message.selection));
|
|
62086
|
-
}, $[
|
|
62090
|
+
}, $[38] = handleAssetSelection, $[39] = t15) : t15 = $[39];
|
|
62087
62091
|
const handlePluginMessage = t15, {
|
|
62088
62092
|
setIframe
|
|
62089
62093
|
} = usePluginPostMessage(appHost, handlePluginMessage);
|
|
62090
62094
|
if (!open)
|
|
62091
62095
|
return null;
|
|
62092
62096
|
let t16;
|
|
62093
|
-
$[
|
|
62097
|
+
$[40] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t16 = {
|
|
62094
62098
|
position: "relative",
|
|
62095
62099
|
minHeight: "2dvh"
|
|
62096
|
-
}, $[
|
|
62100
|
+
}, $[40] = t16) : t16 = $[40];
|
|
62097
62101
|
let t17;
|
|
62098
|
-
$[
|
|
62102
|
+
$[41] !== validation2 ? (t17 = validation2.length > 0 && /* @__PURE__ */ jsx(FormFieldValidationStatus, { fontSize: 2, placement: "top", validation: validation2 }), $[41] = validation2, $[42] = t17) : t17 = $[42];
|
|
62099
62103
|
let t18;
|
|
62100
|
-
$[
|
|
62104
|
+
$[43] !== t ? (t18 = t("asset-source.dialog.button.cancel"), $[43] = t, $[44] = t18) : t18 = $[44];
|
|
62101
62105
|
let t19;
|
|
62102
|
-
$[
|
|
62106
|
+
$[45] !== handleClose || $[46] !== t18 ? (t19 = /* @__PURE__ */ jsx(Button, { mode: "bleed", onClick: handleClose, text: t18, size: "large" }), $[45] = handleClose, $[46] = t18, $[47] = t19) : t19 = $[47];
|
|
62103
62107
|
let t20;
|
|
62104
|
-
$[
|
|
62108
|
+
$[48] !== assetSelection.length || $[49] !== validation2 ? (t20 = assetSelection.length === 0 || validation2.some(_temp4$8), $[48] = assetSelection.length, $[49] = validation2, $[50] = t20) : t20 = $[50];
|
|
62105
62109
|
let t21;
|
|
62106
|
-
$[
|
|
62110
|
+
$[51] !== t ? (t21 = t("asset-source.dialog.button.select"), $[51] = t, $[52] = t21) : t21 = $[52];
|
|
62107
62111
|
let t22;
|
|
62108
|
-
$[
|
|
62112
|
+
$[53] !== didSelect || $[54] !== handleSelect || $[55] !== t20 || $[56] !== t21 ? (t22 = /* @__PURE__ */ jsx(Button, { onClick: handleSelect, loading: didSelect, disabled: t20, text: t21, size: "large", tone: "primary" }), $[53] = didSelect, $[54] = handleSelect, $[55] = t20, $[56] = t21, $[57] = t22) : t22 = $[57];
|
|
62109
62113
|
let t23;
|
|
62110
|
-
$[
|
|
62114
|
+
$[58] !== t17 || $[59] !== t19 || $[60] !== t22 ? (t23 = /* @__PURE__ */ jsx(Card, { width: "full", height: "fill", padding: 3, shadow: 1, style: t16, children: /* @__PURE__ */ jsx(Flex, { width: "full", gap: 3, justify: "flex-end", children: /* @__PURE__ */ jsxs(Flex, { width: "full", gap: 2, justify: "flex-end", align: "center", children: [
|
|
62111
62115
|
t17,
|
|
62112
62116
|
t19,
|
|
62113
62117
|
t22
|
|
62114
|
-
] }) }) }), $[
|
|
62118
|
+
] }) }) }), $[58] = t17, $[59] = t19, $[60] = t22, $[61] = t23) : t23 = $[61];
|
|
62115
62119
|
let t24;
|
|
62116
|
-
$[
|
|
62120
|
+
$[62] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t24 = {
|
|
62117
62121
|
position: "absolute",
|
|
62118
62122
|
inset: 0,
|
|
62119
62123
|
borderTop: "1px solid",
|
|
62120
62124
|
borderColor: "var(--card-border-color)",
|
|
62121
62125
|
overflow: "hidden",
|
|
62122
62126
|
display: "flex"
|
|
62123
|
-
}, $[
|
|
62127
|
+
}, $[62] = t24) : t24 = $[62];
|
|
62124
62128
|
let t25;
|
|
62125
|
-
$[
|
|
62129
|
+
$[63] !== iframeUrl || $[64] !== setIframe ? (t25 = /* @__PURE__ */ jsx(Box, { style: t24, children: /* @__PURE__ */ jsx(Iframe, { ref: setIframe, src: iframeUrl }) }), $[63] = iframeUrl, $[64] = setIframe, $[65] = t25) : t25 = $[65];
|
|
62126
62130
|
let t26;
|
|
62127
|
-
return $[
|
|
62131
|
+
return $[66] !== dialogHeaderTitle || $[67] !== handleClose || $[68] !== ref || $[69] !== t23 || $[70] !== t25 ? (t26 = /* @__PURE__ */ jsx(AppDialog, { header: dialogHeaderTitle, id: "media-library-plugin-dialog-select-assets", onClose: handleClose, onClickOutside: handleClose, open: !0, ref, "data-testid": "media-library-plugin-dialog-select-assets", width: 3, footer: t23, children: t25 }), $[66] = dialogHeaderTitle, $[67] = handleClose, $[68] = ref, $[69] = t23, $[70] = t25, $[71] = t26) : t26 = $[71], t26;
|
|
62128
62132
|
}
|
|
62129
62133
|
function _temp4$8(marker_0) {
|
|
62130
62134
|
return marker_0.level === "error";
|
|
@@ -62253,7 +62257,7 @@ function _temp$1p(file_0) {
|
|
|
62253
62257
|
return file_0.status === "pending";
|
|
62254
62258
|
}
|
|
62255
62259
|
const MediaLibraryAssetSourceComponent = function(props2, ref) {
|
|
62256
|
-
const $ = c(
|
|
62260
|
+
const $ = c(47), {
|
|
62257
62261
|
action: t0,
|
|
62258
62262
|
assetToOpen,
|
|
62259
62263
|
assetType: t1,
|
|
@@ -62274,41 +62278,48 @@ const MediaLibraryAssetSourceComponent = function(props2, ref) {
|
|
|
62274
62278
|
const client = useClient(t2);
|
|
62275
62279
|
let t3;
|
|
62276
62280
|
$[1] !== client ? (t3 = client.config(), $[1] = client, $[2] = t3) : t3 = $[2];
|
|
62277
|
-
const projectId = t3.projectId,
|
|
62281
|
+
const projectId = t3.projectId, workspace = useWorkspace();
|
|
62278
62282
|
let t4;
|
|
62279
|
-
$[3] !==
|
|
62283
|
+
$[3] !== workspace.dataset || $[4] !== workspace.name || $[5] !== workspace.projectId ? (t4 = encodeJsonParams({
|
|
62284
|
+
projectId: workspace.projectId,
|
|
62285
|
+
dataset: workspace.dataset,
|
|
62286
|
+
workspaceName: workspace.name
|
|
62287
|
+
}) || void 0, $[3] = workspace.dataset, $[4] = workspace.name, $[5] = workspace.projectId, $[6] = t4) : t4 = $[6];
|
|
62288
|
+
const pickerPersistenceKey = t4, portalElement = useRootPortalElement();
|
|
62289
|
+
let t5;
|
|
62290
|
+
$[7] !== onChangeAction ? (t5 = () => {
|
|
62280
62291
|
onChangeAction && onChangeAction("select");
|
|
62281
|
-
}, $[
|
|
62282
|
-
const handleSelectNewAsset =
|
|
62292
|
+
}, $[7] = onChangeAction, $[8] = t5) : t5 = $[8];
|
|
62293
|
+
const handleSelectNewAsset = t5;
|
|
62283
62294
|
if (!projectId)
|
|
62284
62295
|
throw new Error("No projectId found");
|
|
62285
|
-
const selectAssetType = assetType === "sanity.video" ? "video" : assetType,
|
|
62286
|
-
let t6;
|
|
62287
|
-
$[5] !== onClose || $[6] !== onSelect || $[7] !== schemaType || $[8] !== t5 || $[9] !== uploader ? (t6 = /* @__PURE__ */ jsx(UploadAssetsDialog, { open: t5, onClose, onSelect, schemaType, uploader }), $[5] = onClose, $[6] = onSelect, $[7] = schemaType, $[8] = t5, $[9] = uploader, $[10] = t6) : t6 = $[10];
|
|
62296
|
+
const selectAssetType = assetType === "sanity.video" ? "video" : assetType, t6 = action === "upload";
|
|
62288
62297
|
let t7;
|
|
62289
|
-
$[
|
|
62298
|
+
$[9] !== onClose || $[10] !== onSelect || $[11] !== schemaType || $[12] !== t6 || $[13] !== uploader ? (t7 = /* @__PURE__ */ jsx(UploadAssetsDialog, { open: t6, onClose, onSelect, schemaType, uploader }), $[9] = onClose, $[10] = onSelect, $[11] = schemaType, $[12] = t6, $[13] = uploader, $[14] = t7) : t7 = $[14];
|
|
62299
|
+
let t8;
|
|
62300
|
+
$[15] !== dialogHeaderTitle || $[16] !== schemaType?.title || $[17] !== selectAssetType || $[18] !== t ? (t8 = dialogHeaderTitle || t("asset-sources.media-library.select-dialog.title", {
|
|
62290
62301
|
context: selectAssetType,
|
|
62291
62302
|
targetTitle: schemaType?.title
|
|
62292
|
-
}), $[
|
|
62293
|
-
const
|
|
62294
|
-
let t9;
|
|
62295
|
-
$[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = [], $[16] = t9) : t9 = $[16];
|
|
62303
|
+
}), $[15] = dialogHeaderTitle, $[16] = schemaType?.title, $[17] = selectAssetType, $[18] = t, $[19] = t8) : t8 = $[19];
|
|
62304
|
+
const t9 = action === "select";
|
|
62296
62305
|
let t10;
|
|
62297
|
-
$[
|
|
62306
|
+
$[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t10 = [], $[20] = t10) : t10 = $[20];
|
|
62298
62307
|
let t11;
|
|
62299
|
-
$[
|
|
62300
|
-
targetTitle: schemaType.title
|
|
62301
|
-
}) : t("asset-sources.media-library.open-in-source-dialog.button.select-new-asset-fallback"), onClose, onSelectNewAsset: handleSelectNewAsset }), $[25] = action, $[26] = assetToOpen, $[27] = handleSelectNewAsset, $[28] = onClose, $[29] = schemaType, $[30] = t, $[31] = t11) : t11 = $[31];
|
|
62308
|
+
$[21] !== onClose || $[22] !== onSelect || $[23] !== pickerPersistenceKey || $[24] !== ref || $[25] !== schemaType || $[26] !== selectAssetType || $[27] !== t8 || $[28] !== t9 ? (t11 = /* @__PURE__ */ jsx(SelectAssetsDialog, { pickerPersistenceKey, dialogHeaderTitle: t8, open: t9, ref, onClose, onSelect, selection: t10, schemaType, selectAssetType }), $[21] = onClose, $[22] = onSelect, $[23] = pickerPersistenceKey, $[24] = ref, $[25] = schemaType, $[26] = selectAssetType, $[27] = t8, $[28] = t9, $[29] = t11) : t11 = $[29];
|
|
62302
62309
|
let t12;
|
|
62303
|
-
$[32] !==
|
|
62304
|
-
|
|
62305
|
-
|
|
62306
|
-
] }), $[32] = portalElement, $[33] = t10, $[34] = t11, $[35] = t12) : t12 = $[35];
|
|
62310
|
+
$[30] !== action || $[31] !== assetToOpen || $[32] !== handleSelectNewAsset || $[33] !== onClose || $[34] !== pickerPersistenceKey || $[35] !== schemaType || $[36] !== t ? (t12 = action === "openInSource" && assetToOpen && /* @__PURE__ */ jsx(OpenInSourceDialog, { pickerPersistenceKey, asset: assetToOpen, dialogHeaderTitle: t("asset-sources.media-library.open-in-source-dialog.title"), selectNewAssetButtonLabel: schemaType?.title ? t("asset-sources.media-library.open-in-source-dialog.button.select-new-asset", {
|
|
62311
|
+
targetTitle: schemaType.title
|
|
62312
|
+
}) : t("asset-sources.media-library.open-in-source-dialog.button.select-new-asset-fallback"), onClose, onSelectNewAsset: handleSelectNewAsset }), $[30] = action, $[31] = assetToOpen, $[32] = handleSelectNewAsset, $[33] = onClose, $[34] = pickerPersistenceKey, $[35] = schemaType, $[36] = t, $[37] = t12) : t12 = $[37];
|
|
62307
62313
|
let t13;
|
|
62308
|
-
|
|
62309
|
-
|
|
62314
|
+
$[38] !== portalElement || $[39] !== t11 || $[40] !== t12 ? (t13 = /* @__PURE__ */ jsxs(PortalProvider, { element: portalElement, children: [
|
|
62315
|
+
t11,
|
|
62310
62316
|
t12
|
|
62311
|
-
] }), $[
|
|
62317
|
+
] }), $[38] = portalElement, $[39] = t11, $[40] = t12, $[41] = t13) : t13 = $[41];
|
|
62318
|
+
let t14;
|
|
62319
|
+
return $[42] !== libraryIdProp || $[43] !== projectId || $[44] !== t13 || $[45] !== t7 ? (t14 = /* @__PURE__ */ jsxs(MediaLibraryProvider, { projectId, libraryId: libraryIdProp, children: [
|
|
62320
|
+
t7,
|
|
62321
|
+
t13
|
|
62322
|
+
] }), $[42] = libraryIdProp, $[43] = projectId, $[44] = t13, $[45] = t7, $[46] = t14) : t14 = $[46], t14;
|
|
62312
62323
|
}, MediaLibraryAssetSource = memo(forwardRef(MediaLibraryAssetSourceComponent)), useRootPortalElement = () => {
|
|
62313
62324
|
const $ = c(3), [container] = useState(_temp$1o);
|
|
62314
62325
|
let t0, t1;
|