sanity 3.87.0 → 3.87.1-canary.4
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-cjs/pane.js +95 -84
- package/lib/_chunks-cjs/pane.js.map +1 -1
- package/lib/_chunks-cjs/version.js +1 -1
- package/lib/_chunks-es/pane.mjs +96 -85
- package/lib/_chunks-es/pane.mjs.map +1 -1
- package/lib/_chunks-es/version.mjs +1 -1
- package/package.json +12 -12
- package/src/structure/panes/document/documentPanel/DocumentPanel.tsx +12 -3
- package/src/structure/panes/document/documentPanel/banners/{AddToReleaseBanner.tsx → DocumentNotInReleaseBanner.tsx} +15 -8
package/lib/_chunks-cjs/pane.js
CHANGED
@@ -3862,6 +3862,47 @@ const ReferenceChangedBanner = React.memo(() => {
|
|
3862
3862
|
);
|
3863
3863
|
});
|
3864
3864
|
ReferenceChangedBanner.displayName = "Memo(ReferenceChangedBanner)";
|
3865
|
+
function ArchivedReleaseDocumentBanner() {
|
3866
|
+
const {
|
3867
|
+
t
|
3868
|
+
} = sanity.useTranslation(StructureToolProvider.structureLocaleNamespace), {
|
3869
|
+
t: tCore
|
3870
|
+
} = sanity.useTranslation(), {
|
3871
|
+
data: archivedReleases
|
3872
|
+
} = sanity.useArchivedReleases(), {
|
3873
|
+
params,
|
3874
|
+
setParams
|
3875
|
+
} = usePaneRouter(), handleGoBack = () => {
|
3876
|
+
setParams({
|
3877
|
+
...params,
|
3878
|
+
rev: params?.historyEvent || void 0,
|
3879
|
+
since: void 0,
|
3880
|
+
historyVersion: void 0
|
3881
|
+
});
|
3882
|
+
}, release = React.useMemo(() => archivedReleases.find((r) => sanity.getReleaseIdFromReleaseDocumentId(r._id) === params?.historyVersion), [archivedReleases, params?.historyVersion]), description = release?.state === "published" ? "banners.published-release.description" : "banners.archived-release.description", title = release?.metadata.title || tCore("release.placeholder-untitled-release");
|
3883
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Banner, { tone: "caution", content: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.Translate, { t, i18nKey: description, values: {
|
3884
|
+
title
|
3885
|
+
}, components: {
|
3886
|
+
VersionBadge: sanity.getVersionInlineBadge(release)
|
3887
|
+
} }) }), action: params?.archivedRelease ? void 0 : {
|
3888
|
+
text: "Go back to published version",
|
3889
|
+
onClick: handleGoBack
|
3890
|
+
} });
|
3891
|
+
}
|
3892
|
+
function CreateLinkedBanner() {
|
3893
|
+
const $ = reactCompilerRuntime.c(5), {
|
3894
|
+
value
|
3895
|
+
} = useDocumentPane(), {
|
3896
|
+
documentLinkedBannerContent: CreateLinkedBannerContent
|
3897
|
+
} = sanity.useSanityCreateConfig().components ?? {};
|
3898
|
+
let t0;
|
3899
|
+
$[0] !== value ? (t0 = sanity.getSanityCreateLinkMetadata(value), $[0] = value, $[1] = t0) : t0 = $[1];
|
3900
|
+
const createLinkMetadata = t0;
|
3901
|
+
if (!CreateLinkedBannerContent || !createLinkMetadata)
|
3902
|
+
return null;
|
3903
|
+
let t1;
|
3904
|
+
return $[2] !== CreateLinkedBannerContent || $[3] !== createLinkMetadata ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(Banner, { tone: "transparent", "data-test-id": "sanity-create-read-only-banner", content: /* @__PURE__ */ jsxRuntime.jsx(CreateLinkedBannerContent, { metadata: createLinkMetadata }) }), $[2] = CreateLinkedBannerContent, $[3] = createLinkMetadata, $[4] = t1) : t1 = $[4], t1;
|
3905
|
+
}
|
3865
3906
|
const LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24;
|
3866
3907
|
function useConditionalToast(params) {
|
3867
3908
|
const $ = reactCompilerRuntime.c(4), toast = ui.useToast();
|
@@ -3877,10 +3918,11 @@ function useConditionalToast(params) {
|
|
3877
3918
|
}), t1 = [params, toast], $[0] = params, $[1] = toast, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), React.useEffect(t0, t1);
|
3878
3919
|
}
|
3879
3920
|
const TOAST_DELAY = 1e3;
|
3880
|
-
function
|
3921
|
+
function DocumentNotInReleaseBanner({
|
3881
3922
|
documentId,
|
3882
3923
|
currentRelease,
|
3883
|
-
value
|
3924
|
+
value,
|
3925
|
+
isScheduledRelease
|
3884
3926
|
}) {
|
3885
3927
|
const tone = sanity.getReleaseTone(currentRelease ?? sanity.LATEST), {
|
3886
3928
|
t
|
@@ -3918,17 +3960,24 @@ function AddToReleaseBanner({
|
|
3918
3960
|
closable: !0,
|
3919
3961
|
title: t("banners.release.waiting.title"),
|
3920
3962
|
description: t("banners.release.waiting.description")
|
3921
|
-
}), /* @__PURE__ */ jsxRuntime.jsx(
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
3925
|
-
|
3926
|
-
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
|
3963
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(
|
3964
|
+
Banner,
|
3965
|
+
{
|
3966
|
+
tone,
|
3967
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.Translate, { i18nKey: "banners.release.not-in-release", t, values: {
|
3968
|
+
title: currentRelease?.metadata?.title || tCore("release.placeholder-untitled-release")
|
3969
|
+
}, components: {
|
3970
|
+
VersionBadge: sanity.getVersionInlineBadge(currentRelease)
|
3971
|
+
} }) }),
|
3972
|
+
action: isScheduledRelease ? void 0 : {
|
3973
|
+
text: t("banners.release.action.add-to-release"),
|
3974
|
+
tone,
|
3975
|
+
disabled: !!versionCreateState,
|
3976
|
+
onClick: handleAddToRelease,
|
3977
|
+
mode: "default"
|
3978
|
+
}
|
3979
|
+
}
|
3980
|
+
);
|
3932
3981
|
}
|
3933
3982
|
function useCurrentTime(updateIntervalMs) {
|
3934
3983
|
const $ = reactCompilerRuntime.c(4);
|
@@ -3943,47 +3992,6 @@ function useCurrentTime(updateIntervalMs) {
|
|
3943
3992
|
return () => clearInterval(intervalId);
|
3944
3993
|
}, t2 = [updateIntervalMs], $[1] = updateIntervalMs, $[2] = t1, $[3] = t2) : (t1 = $[2], t2 = $[3]), React.useEffect(t1, t2), currentTime;
|
3945
3994
|
}
|
3946
|
-
function ArchivedReleaseDocumentBanner() {
|
3947
|
-
const {
|
3948
|
-
t
|
3949
|
-
} = sanity.useTranslation(StructureToolProvider.structureLocaleNamespace), {
|
3950
|
-
t: tCore
|
3951
|
-
} = sanity.useTranslation(), {
|
3952
|
-
data: archivedReleases
|
3953
|
-
} = sanity.useArchivedReleases(), {
|
3954
|
-
params,
|
3955
|
-
setParams
|
3956
|
-
} = usePaneRouter(), handleGoBack = () => {
|
3957
|
-
setParams({
|
3958
|
-
...params,
|
3959
|
-
rev: params?.historyEvent || void 0,
|
3960
|
-
since: void 0,
|
3961
|
-
historyVersion: void 0
|
3962
|
-
});
|
3963
|
-
}, release = React.useMemo(() => archivedReleases.find((r) => sanity.getReleaseIdFromReleaseDocumentId(r._id) === params?.historyVersion), [archivedReleases, params?.historyVersion]), description = release?.state === "published" ? "banners.published-release.description" : "banners.archived-release.description", title = release?.metadata.title || tCore("release.placeholder-untitled-release");
|
3964
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Banner, { tone: "caution", content: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(sanity.Translate, { t, i18nKey: description, values: {
|
3965
|
-
title
|
3966
|
-
}, components: {
|
3967
|
-
VersionBadge: sanity.getVersionInlineBadge(release)
|
3968
|
-
} }) }), action: params?.archivedRelease ? void 0 : {
|
3969
|
-
text: "Go back to published version",
|
3970
|
-
onClick: handleGoBack
|
3971
|
-
} });
|
3972
|
-
}
|
3973
|
-
function CreateLinkedBanner() {
|
3974
|
-
const $ = reactCompilerRuntime.c(5), {
|
3975
|
-
value
|
3976
|
-
} = useDocumentPane(), {
|
3977
|
-
documentLinkedBannerContent: CreateLinkedBannerContent
|
3978
|
-
} = sanity.useSanityCreateConfig().components ?? {};
|
3979
|
-
let t0;
|
3980
|
-
$[0] !== value ? (t0 = sanity.getSanityCreateLinkMetadata(value), $[0] = value, $[1] = t0) : t0 = $[1];
|
3981
|
-
const createLinkMetadata = t0;
|
3982
|
-
if (!CreateLinkedBannerContent || !createLinkMetadata)
|
3983
|
-
return null;
|
3984
|
-
let t1;
|
3985
|
-
return $[2] !== CreateLinkedBannerContent || $[3] !== createLinkMetadata ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(Banner, { tone: "transparent", "data-test-id": "sanity-create-read-only-banner", content: /* @__PURE__ */ jsxRuntime.jsx(CreateLinkedBannerContent, { metadata: createLinkMetadata }) }), $[2] = CreateLinkedBannerContent, $[3] = createLinkMetadata, $[4] = t1) : t1 = $[4], t1;
|
3986
|
-
}
|
3987
3995
|
const ResolvedLiveEdit = telemetry.defineEvent({
|
3988
3996
|
name: "LiveEdit Draft Resolved",
|
3989
3997
|
version: 1,
|
@@ -4535,7 +4543,7 @@ const DocumentPanelSubHeader = React.memo(function() {
|
|
4535
4543
|
scroll-behavior: smooth;
|
4536
4544
|
outline: none;
|
4537
4545
|
`), DocumentPanel = function(props) {
|
4538
|
-
const $ = reactCompilerRuntime.c(
|
4546
|
+
const $ = reactCompilerRuntime.c(85), {
|
4539
4547
|
footerHeight,
|
4540
4548
|
headerHeight,
|
4541
4549
|
isInspectOpen,
|
@@ -4626,53 +4634,56 @@ const DocumentPanelSubHeader = React.memo(function() {
|
|
4626
4634
|
$[34] === Symbol.for("react.memo_cache_sentinel") ? (t133 = /* @__PURE__ */ jsxRuntime.jsx(ArchivedReleaseDocumentBanner, {}), $[34] = t133) : t133 = $[34], t12 = t133;
|
4627
4635
|
break bb1;
|
4628
4636
|
}
|
4629
|
-
|
4630
|
-
|
4631
|
-
|
4632
|
-
|
4637
|
+
let t132;
|
4638
|
+
$[35] !== selectedPerspective ? (t132 = sanity.isReleaseDocument(selectedPerspective) && sanity.isReleaseScheduledOrScheduling(selectedPerspective), $[35] = selectedPerspective, $[36] = t132) : t132 = $[36];
|
4639
|
+
const isScheduledRelease = t132;
|
4640
|
+
if (isScheduledRelease && displayed?._id && sanity.getVersionFromId(displayed?._id) === selectedReleaseId) {
|
4641
|
+
const t143 = selectedPerspective;
|
4642
|
+
let t153;
|
4643
|
+
$[37] !== t143 ? (t153 = /* @__PURE__ */ jsxRuntime.jsx(ScheduledReleaseBanner, { currentRelease: t143 }), $[37] = t143, $[38] = t153) : t153 = $[38], t12 = t153;
|
4633
4644
|
break bb1;
|
4634
4645
|
}
|
4635
|
-
let
|
4636
|
-
$[
|
4637
|
-
const isPinnedDraftOrPublish =
|
4646
|
+
let t142;
|
4647
|
+
$[39] !== selectedPerspective ? (t142 = sanity.isSystemBundle(selectedPerspective), $[39] = selectedPerspective, $[40] = t142) : t142 = $[40];
|
4648
|
+
const isPinnedDraftOrPublish = t142;
|
4638
4649
|
if (displayed?._id && sanity.getVersionFromId(displayed._id) !== selectedReleaseId && ready && !isPinnedDraftOrPublish) {
|
4639
|
-
const
|
4640
|
-
let
|
4641
|
-
$[
|
4650
|
+
const t153 = selectedPerspective, t162 = displayed || void 0;
|
4651
|
+
let t172;
|
4652
|
+
$[41] !== isScheduledRelease || $[42] !== t153 || $[43] !== t162 || $[44] !== value._id ? (t172 = /* @__PURE__ */ jsxRuntime.jsx(DocumentNotInReleaseBanner, { documentId: value._id, currentRelease: t153, value: t162, isScheduledRelease }), $[41] = isScheduledRelease, $[42] = t153, $[43] = t162, $[44] = value._id, $[45] = t172) : t172 = $[45], t12 = t172;
|
4642
4653
|
break bb1;
|
4643
4654
|
}
|
4644
4655
|
if (activeView.type === "form" && isLiveEdit && ready && editState?.draft?._id && !selectedReleaseId) {
|
4645
|
-
let
|
4646
|
-
$[
|
4656
|
+
let t153;
|
4657
|
+
$[46] !== displayed || $[47] !== documentId || $[48] !== schemaType ? (t153 = /* @__PURE__ */ jsxRuntime.jsx(DraftLiveEditBanner, { displayed, documentId, schemaType }), $[46] = displayed, $[47] = documentId, $[48] = schemaType, $[49] = t153) : t153 = $[49], t12 = t153;
|
4647
4658
|
break bb1;
|
4648
4659
|
}
|
4649
4660
|
if (activeView.type !== "form" || isPermissionsLoading || !ready) {
|
4650
4661
|
t12 = null;
|
4651
4662
|
break bb1;
|
4652
4663
|
}
|
4653
|
-
let t142;
|
4654
|
-
$[47] !== showCreateBanner ? (t142 = showCreateBanner && /* @__PURE__ */ jsxRuntime.jsx(CreateLinkedBanner, {}), $[47] = showCreateBanner, $[48] = t142) : t142 = $[48];
|
4655
4664
|
let t152;
|
4656
|
-
$[
|
4657
|
-
let t16
|
4658
|
-
$[52]
|
4659
|
-
|
4660
|
-
|
4661
|
-
|
4665
|
+
$[50] !== showCreateBanner ? (t152 = showCreateBanner && /* @__PURE__ */ jsxRuntime.jsx(CreateLinkedBanner, {}), $[50] = showCreateBanner, $[51] = t152) : t152 = $[51];
|
4666
|
+
let t16;
|
4667
|
+
$[52] !== permissions?.granted || $[53] !== requiredPermission ? (t16 = !permissions?.granted && /* @__PURE__ */ jsxRuntime.jsx(InsufficientPermissionBanner, { requiredPermission }), $[52] = permissions?.granted, $[53] = requiredPermission, $[54] = t16) : t16 = $[54];
|
4668
|
+
let t17, t18, t19, t20;
|
4669
|
+
$[55] === Symbol.for("react.memo_cache_sentinel") ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(ReferenceChangedBanner, {}), t18 = /* @__PURE__ */ jsxRuntime.jsx(DeprecatedDocumentTypeBanner, {}), t19 = /* @__PURE__ */ jsxRuntime.jsx(DeletedDocumentBanners, {}), t20 = /* @__PURE__ */ jsxRuntime.jsx(UnpublishedDocumentBanner, {}), $[55] = t17, $[56] = t18, $[57] = t19, $[58] = t20) : (t17 = $[55], t18 = $[56], t19 = $[57], t20 = $[58]);
|
4670
|
+
const t21 = displayed?._id ?? documentId;
|
4662
4671
|
let t22;
|
4663
|
-
$[59] !==
|
4664
|
-
|
4672
|
+
$[59] !== isPinnedDraftOrPublish || $[60] !== t21 ? (t22 = /* @__PURE__ */ jsxRuntime.jsx(OpenReleaseToEditBanner, { documentId: t21, isPinnedDraftOrPublished: isPinnedDraftOrPublish }), $[59] = isPinnedDraftOrPublish, $[60] = t21, $[61] = t22) : t22 = $[61];
|
4673
|
+
let t23;
|
4674
|
+
$[62] !== t152 || $[63] !== t16 || $[64] !== t22 ? (t23 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
4665
4675
|
t152,
|
4666
4676
|
t16,
|
4667
4677
|
t17,
|
4668
4678
|
t18,
|
4669
4679
|
t19,
|
4670
|
-
|
4671
|
-
|
4680
|
+
t20,
|
4681
|
+
t22
|
4682
|
+
] }), $[62] = t152, $[63] = t16, $[64] = t22, $[65] = t23) : t23 = $[65], t12 = t23;
|
4672
4683
|
}
|
4673
4684
|
const banners = t12, showFormView = features.resizablePanes || !showInspector;
|
4674
4685
|
let t13;
|
4675
|
-
$[
|
4686
|
+
$[66] !== activeViewNode || $[67] !== banners || $[68] !== documentScrollElement || $[69] !== footer || $[70] !== formViewHidden || $[71] !== inspectDialog || $[72] !== layoutCollapsed || $[73] !== margins || $[74] !== portalElement || $[75] !== showFormView ? (t13 = showFormView && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { height: "fill", direction: "column", width: "fill", flex: 2, children: [
|
4676
4687
|
/* @__PURE__ */ jsxRuntime.jsxs(sanity.LegacyLayerProvider, { zOffset: "paneHeader", children: [
|
4677
4688
|
banners,
|
4678
4689
|
/* @__PURE__ */ jsxRuntime.jsx(DocumentPanelSubHeader, {})
|
@@ -4688,14 +4699,14 @@ const DocumentPanelSubHeader = React.memo(function() {
|
|
4688
4699
|
/* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "document-panel-portal", ref: setPortalElement })
|
4689
4700
|
] }) }) }) }),
|
4690
4701
|
footer
|
4691
|
-
] }), $[
|
4702
|
+
] }), $[66] = activeViewNode, $[67] = banners, $[68] = documentScrollElement, $[69] = footer, $[70] = formViewHidden, $[71] = inspectDialog, $[72] = layoutCollapsed, $[73] = margins, $[74] = portalElement, $[75] = showFormView, $[76] = t13) : t13 = $[76];
|
4692
4703
|
let t14;
|
4693
|
-
$[
|
4704
|
+
$[77] !== documentId || $[78] !== rootElement || $[79] !== schemaType || $[80] !== showInspector ? (t14 = showInspector && /* @__PURE__ */ jsxRuntime.jsx(ui.BoundaryElementProvider, { element: rootElement, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentInspectorPanel, { documentId, documentType: schemaType.name, flex: 1 }) }), $[77] = documentId, $[78] = rootElement, $[79] = schemaType, $[80] = showInspector, $[81] = t14) : t14 = $[81];
|
4694
4705
|
let t15;
|
4695
|
-
return $[
|
4706
|
+
return $[82] !== t13 || $[83] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(PaneContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { height: "fill", children: [
|
4696
4707
|
t13,
|
4697
4708
|
t14
|
4698
|
-
] }) }), $[
|
4709
|
+
] }) }), $[82] = t13, $[83] = t14, $[84] = t15) : t15 = $[84], t15;
|
4699
4710
|
};
|
4700
4711
|
DocumentPanel.displayName = "DocumentPanel";
|
4701
4712
|
const _DEBUG = !1, EMPTY_PARAMS$1 = Object.freeze({}), LOADING_PANE = Symbol("LOADING_PANE"), DOCUMENT_PANEL_PORTAL_ELEMENT = "documentPanelPortalElement", POPOVER_FALLBACK_PLACEMENTS = ["left", "bottom"], DIALOG_WIDTH_TO_UI_WIDTH = {
|